@chekinapp/ui 0.0.92 → 0.0.94
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 +1122 -611
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +140 -12
- package/dist/index.d.ts +140 -12
- package/dist/index.js +1103 -588
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
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,
|
|
@@ -333,11 +334,14 @@ __export(index_exports, {
|
|
|
333
334
|
buttonVariants: () => buttonVariants,
|
|
334
335
|
calendarClassNames: () => calendarClassNames,
|
|
335
336
|
cn: () => cn,
|
|
337
|
+
compressFile: () => compressFile,
|
|
338
|
+
compressImage: () => compressImage,
|
|
336
339
|
copyToClipboard: () => copyToClipboard,
|
|
337
340
|
createDisabledMatchers: () => createDisabledMatchers,
|
|
338
341
|
emptyMediaVariants: () => emptyMediaVariants,
|
|
339
342
|
formatDate: () => formatDate,
|
|
340
343
|
getErrorMessage: () => getErrorMessage,
|
|
344
|
+
getFileSizeMB: () => getFileSizeMB,
|
|
341
345
|
getScrollableAreaState: () => getScrollableAreaState,
|
|
342
346
|
getSidebarState: () => getSidebarState,
|
|
343
347
|
isDayBlocked: () => isDayBlocked,
|
|
@@ -2105,6 +2109,25 @@ function toCssSize(size) {
|
|
|
2105
2109
|
return size;
|
|
2106
2110
|
}
|
|
2107
2111
|
}
|
|
2112
|
+
function getCanvasBlob(canvas) {
|
|
2113
|
+
return new Promise((resolve) => {
|
|
2114
|
+
canvas.toBlob((blob) => {
|
|
2115
|
+
resolve(blob);
|
|
2116
|
+
});
|
|
2117
|
+
});
|
|
2118
|
+
}
|
|
2119
|
+
function toBase64(file) {
|
|
2120
|
+
return new Promise((resolve, reject) => {
|
|
2121
|
+
const reader = new FileReader();
|
|
2122
|
+
reader.readAsDataURL(file);
|
|
2123
|
+
reader.onload = () => resolve(String(reader.result));
|
|
2124
|
+
reader.onerror = () => reject(new Error("Failed to read file as base64"));
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2127
|
+
function getFileSizeMB(file) {
|
|
2128
|
+
if (!file) return;
|
|
2129
|
+
return file.size / Math.pow(1024, 2);
|
|
2130
|
+
}
|
|
2108
2131
|
|
|
2109
2132
|
// src/tooltip/Tooltip.tsx
|
|
2110
2133
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
@@ -3035,7 +3058,7 @@ function useCombinedRef(...refs) {
|
|
|
3035
3058
|
var import_react15 = require("react");
|
|
3036
3059
|
var MOBILE_BREAKPOINT = 768;
|
|
3037
3060
|
function useIsMobile({ breakpoint = MOBILE_BREAKPOINT } = {}) {
|
|
3038
|
-
const [
|
|
3061
|
+
const [isMobile3, setIsMobile] = (0, import_react15.useState)(void 0);
|
|
3039
3062
|
(0, import_react15.useEffect)(() => {
|
|
3040
3063
|
const mediaQuery = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
3041
3064
|
const onChange = () => {
|
|
@@ -3047,7 +3070,7 @@ function useIsMobile({ breakpoint = MOBILE_BREAKPOINT } = {}) {
|
|
|
3047
3070
|
mediaQuery.removeEventListener("change", onChange);
|
|
3048
3071
|
};
|
|
3049
3072
|
}, [breakpoint]);
|
|
3050
|
-
return !!
|
|
3073
|
+
return !!isMobile3;
|
|
3051
3074
|
}
|
|
3052
3075
|
|
|
3053
3076
|
// src/hooks/use-is-mounted.ts
|
|
@@ -5978,7 +6001,23 @@ var translation_default2 = {
|
|
|
5978
6001
|
past_dates: "Date cannot be before {{minDate}}",
|
|
5979
6002
|
future_dates: "Date cannot be after {{maxDate}}",
|
|
5980
6003
|
signature_placeholder_text: "Sign inside this box.<br/> Use your finger.<br/> Tap to start.",
|
|
6004
|
+
open_devices_camera: "Open device's camera",
|
|
6005
|
+
place_document_inside_frame: "Place your document inside the frame",
|
|
6006
|
+
close_other_application_that_may_be_using_your_camera: "Close other applications that may be using your camera",
|
|
6007
|
+
if_you_use_external_camera_disconnect_and_reconnect: "If you use an external camera, disconnect and reconnect it",
|
|
6008
|
+
close_the_browser_re_open_it: "Close the browser and reopen it",
|
|
5981
6009
|
camera_permissions_denied: "The camera doesn't open? Make sure to allow the browser permission to use the camera.",
|
|
6010
|
+
camera_errors: {
|
|
6011
|
+
experiencing_camera_issues: "Experiencing camera issues?",
|
|
6012
|
+
chekin_cant_use_your_camera: "Chekin can't use your camera",
|
|
6013
|
+
please_try_a_different_browser: "Your camera doesn't work in this browser. Please, try to open the link in a different browser.",
|
|
6014
|
+
permissions_denied: "Permission denied",
|
|
6015
|
+
camera_permissions_denied: "The camera doesn't open? Make sure to allow the browser permission to use the camera.",
|
|
6016
|
+
no_camera_device_found: "No camera device found. Please connect a camera.",
|
|
6017
|
+
constraints_camera_error: "Constraints cannot be satisfied by available devices.",
|
|
6018
|
+
safari_camera_error: "Safari could not satisfy the camera requirements",
|
|
6019
|
+
try_chrome_or_firefox: "Please try Chrome or Firefox"
|
|
6020
|
+
},
|
|
5982
6021
|
clear: "Clear",
|
|
5983
6022
|
show_less: "Show less",
|
|
5984
6023
|
show_more: "Show more"
|
|
@@ -8588,7 +8627,7 @@ var SidebarProvider = React28.forwardRef(
|
|
|
8588
8627
|
stateName = SIDEBAR_COOKIE_NAME_DEFAULT,
|
|
8589
8628
|
...props
|
|
8590
8629
|
}, ref) => {
|
|
8591
|
-
const
|
|
8630
|
+
const isMobile3 = useIsMobile({ breakpoint: 641 });
|
|
8592
8631
|
const [openMobile, setOpenMobile] = React28.useState(false);
|
|
8593
8632
|
const [_open, _setOpen] = React28.useState(defaultOpen);
|
|
8594
8633
|
const open = openProp ?? _open;
|
|
@@ -8605,8 +8644,8 @@ var SidebarProvider = React28.forwardRef(
|
|
|
8605
8644
|
[setOpenProp, open, stateName]
|
|
8606
8645
|
);
|
|
8607
8646
|
const toggleSidebar = React28.useCallback(() => {
|
|
8608
|
-
return
|
|
8609
|
-
}, [
|
|
8647
|
+
return isMobile3 ? setOpenMobile((value) => !value) : setOpen((value) => !value);
|
|
8648
|
+
}, [isMobile3, setOpen]);
|
|
8610
8649
|
React28.useEffect(() => {
|
|
8611
8650
|
const handleKeyDown = (event) => {
|
|
8612
8651
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
@@ -8623,12 +8662,12 @@ var SidebarProvider = React28.forwardRef(
|
|
|
8623
8662
|
state,
|
|
8624
8663
|
open,
|
|
8625
8664
|
setOpen,
|
|
8626
|
-
isMobile:
|
|
8665
|
+
isMobile: isMobile3,
|
|
8627
8666
|
openMobile,
|
|
8628
8667
|
setOpenMobile,
|
|
8629
8668
|
toggleSidebar
|
|
8630
8669
|
}),
|
|
8631
|
-
[state, open, setOpen,
|
|
8670
|
+
[state, open, setOpen, isMobile3, openMobile, setOpenMobile, toggleSidebar]
|
|
8632
8671
|
);
|
|
8633
8672
|
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)(
|
|
8634
8673
|
"div",
|
|
@@ -8655,7 +8694,7 @@ var Sidebar = React28.forwardRef(
|
|
|
8655
8694
|
children,
|
|
8656
8695
|
...props
|
|
8657
8696
|
}, ref) => {
|
|
8658
|
-
const { isMobile:
|
|
8697
|
+
const { isMobile: isMobile3, state, openMobile, setOpenMobile } = useSidebar();
|
|
8659
8698
|
if (collapsible === "none") {
|
|
8660
8699
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
8661
8700
|
"div",
|
|
@@ -8670,7 +8709,7 @@ var Sidebar = React28.forwardRef(
|
|
|
8670
8709
|
}
|
|
8671
8710
|
);
|
|
8672
8711
|
}
|
|
8673
|
-
if (
|
|
8712
|
+
if (isMobile3) {
|
|
8674
8713
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
8675
8714
|
SheetContent,
|
|
8676
8715
|
{
|
|
@@ -8741,7 +8780,7 @@ var Sidebar = React28.forwardRef(
|
|
|
8741
8780
|
);
|
|
8742
8781
|
Sidebar.displayName = "Sidebar";
|
|
8743
8782
|
var SidebarTrigger = React28.forwardRef(({ className, onClick, icon, ...props }, ref) => {
|
|
8744
|
-
const { toggleSidebar, open, isMobile:
|
|
8783
|
+
const { toggleSidebar, open, isMobile: isMobile3, openMobile } = useSidebar();
|
|
8745
8784
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
8746
8785
|
Button,
|
|
8747
8786
|
{
|
|
@@ -8760,7 +8799,7 @@ var SidebarTrigger = React28.forwardRef(({ className, onClick, icon, ...props },
|
|
|
8760
8799
|
},
|
|
8761
8800
|
...props,
|
|
8762
8801
|
children: [
|
|
8763
|
-
icon || (
|
|
8802
|
+
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, {}),
|
|
8764
8803
|
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
8765
8804
|
]
|
|
8766
8805
|
}
|
|
@@ -8980,7 +9019,7 @@ var SidebarMenuButton = React28.forwardRef(
|
|
|
8980
9019
|
...props
|
|
8981
9020
|
}, ref) => {
|
|
8982
9021
|
const Comp = asChild ? import_react_slot4.Slot : "button";
|
|
8983
|
-
const { isMobile:
|
|
9022
|
+
const { isMobile: isMobile3, state } = useSidebar();
|
|
8984
9023
|
const button = /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
8985
9024
|
Comp,
|
|
8986
9025
|
{
|
|
@@ -9004,7 +9043,7 @@ var SidebarMenuButton = React28.forwardRef(
|
|
|
9004
9043
|
{
|
|
9005
9044
|
side: "right",
|
|
9006
9045
|
align: "center",
|
|
9007
|
-
hidden: state !== "collapsed" ||
|
|
9046
|
+
hidden: state !== "collapsed" || isMobile3,
|
|
9008
9047
|
className: "capitalize",
|
|
9009
9048
|
variant: "dark",
|
|
9010
9049
|
...tooltipProps
|
|
@@ -9033,8 +9072,8 @@ var SidebarMenuAction = React28.forwardRef(({ className, asChild = false, showOn
|
|
|
9033
9072
|
SidebarMenuAction.displayName = "SidebarMenuAction";
|
|
9034
9073
|
var SidebarMenuBadge = React28.forwardRef(
|
|
9035
9074
|
({ className, ...props }, ref) => {
|
|
9036
|
-
const { open, isMobile:
|
|
9037
|
-
const isOpen =
|
|
9075
|
+
const { open, isMobile: isMobile3, openMobile } = useSidebar();
|
|
9076
|
+
const isOpen = isMobile3 ? openMobile : open;
|
|
9038
9077
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
9039
9078
|
"div",
|
|
9040
9079
|
{
|
|
@@ -11093,147 +11132,615 @@ function VideoPlayer({
|
|
|
11093
11132
|
}
|
|
11094
11133
|
|
|
11095
11134
|
// src/webcam/Webcam.tsx
|
|
11096
|
-
var
|
|
11097
|
-
var
|
|
11098
|
-
var import_react_device_detect = require("react-device-detect");
|
|
11135
|
+
var import_react85 = require("react");
|
|
11136
|
+
var import_react_device_detect3 = require("react-device-detect");
|
|
11099
11137
|
var import_react_webcam = __toESM(require("react-webcam"), 1);
|
|
11100
11138
|
|
|
11101
|
-
// src/
|
|
11102
|
-
|
|
11103
|
-
|
|
11139
|
+
// src/lib/compression.ts
|
|
11140
|
+
var IDENTITY_VERIFICATION_PHOTOS_MAX_SIZE_MB = 6;
|
|
11141
|
+
var IDENTITY_VERIFICATION_PHOTOS_QUALITY = 0.8;
|
|
11142
|
+
async function compressFile(file, { convertSize }) {
|
|
11143
|
+
const { default: Compressor } = await import("compressorjs");
|
|
11144
|
+
return new Promise((resolve, reject) => {
|
|
11145
|
+
new Compressor(file, {
|
|
11146
|
+
convertSize: convertSize ? convertSize * 1e6 : void 0,
|
|
11147
|
+
quality: 1,
|
|
11148
|
+
success: (result) => resolve(result),
|
|
11149
|
+
error: reject
|
|
11150
|
+
});
|
|
11151
|
+
});
|
|
11152
|
+
}
|
|
11153
|
+
async function compressImage(image) {
|
|
11154
|
+
const { default: Compressor } = await import("compressorjs");
|
|
11155
|
+
const parsedImage = new File([image], image.name, { type: image.type });
|
|
11156
|
+
return new Promise((resolve, reject) => {
|
|
11157
|
+
new Compressor(parsedImage, {
|
|
11158
|
+
convertSize: IDENTITY_VERIFICATION_PHOTOS_MAX_SIZE_MB * 1e6,
|
|
11159
|
+
quality: IDENTITY_VERIFICATION_PHOTOS_QUALITY,
|
|
11160
|
+
success: (compressedResult) => {
|
|
11161
|
+
toBase64(compressedResult).then((result) => {
|
|
11162
|
+
console.log(
|
|
11163
|
+
"Before: ",
|
|
11164
|
+
getFileSizeMB(image)?.toFixed(2),
|
|
11165
|
+
"MB",
|
|
11166
|
+
"After: ",
|
|
11167
|
+
getFileSizeMB(compressedResult)?.toFixed(2),
|
|
11168
|
+
"MB"
|
|
11169
|
+
);
|
|
11170
|
+
resolve(result);
|
|
11171
|
+
}, reject);
|
|
11172
|
+
},
|
|
11173
|
+
error: (error) => {
|
|
11174
|
+
if (error.message.includes("Failed to load the image")) {
|
|
11175
|
+
reject(
|
|
11176
|
+
new Error(
|
|
11177
|
+
"Unable to process the selected image. Please try a different image."
|
|
11178
|
+
)
|
|
11179
|
+
);
|
|
11180
|
+
return;
|
|
11181
|
+
}
|
|
11182
|
+
reject(error);
|
|
11183
|
+
}
|
|
11184
|
+
});
|
|
11185
|
+
});
|
|
11104
11186
|
}
|
|
11105
11187
|
|
|
11106
|
-
// src/webcam/
|
|
11107
|
-
var
|
|
11108
|
-
var
|
|
11109
|
-
var
|
|
11110
|
-
|
|
11111
|
-
|
|
11112
|
-
|
|
11113
|
-
height: { ideal: 2160 }
|
|
11114
|
-
}
|
|
11115
|
-
};
|
|
11188
|
+
// src/webcam/useErrorHandler.ts
|
|
11189
|
+
var import_react84 = require("react");
|
|
11190
|
+
var import_react_i18next23 = require("react-i18next");
|
|
11191
|
+
var import_react_device_detect2 = require("react-device-detect");
|
|
11192
|
+
|
|
11193
|
+
// src/webcam/utils.ts
|
|
11194
|
+
var import_react_device_detect = require("react-device-detect");
|
|
11116
11195
|
var isMobileOrTablet = () => import_react_device_detect.isMobile || import_react_device_detect.isTablet;
|
|
11117
|
-
|
|
11196
|
+
var getLivenessOptimizedConstraints = (deviceId, additional) => {
|
|
11197
|
+
const additionalConstraints = typeof additional === "object" && additional !== null ? additional : {};
|
|
11198
|
+
const baseConstraints = {
|
|
11199
|
+
deviceId: deviceId ? { exact: deviceId } : void 0,
|
|
11200
|
+
facingMode: { ideal: "user" },
|
|
11201
|
+
width: { min: 320, ideal: 800 },
|
|
11202
|
+
height: { min: 240, ideal: 600 },
|
|
11203
|
+
frameRate: { ideal: 24 },
|
|
11204
|
+
resizeMode: "crop-and-scale",
|
|
11205
|
+
aspectRatio: { ideal: 1.333 },
|
|
11206
|
+
...additionalConstraints
|
|
11207
|
+
};
|
|
11118
11208
|
if (isMobileOrTablet()) {
|
|
11119
11209
|
return {
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
}
|
|
11210
|
+
...baseConstraints,
|
|
11211
|
+
width: { min: 320, ideal: 640 },
|
|
11212
|
+
height: { min: 240, ideal: 480 },
|
|
11213
|
+
aspectRatio: { ideal: 1 },
|
|
11214
|
+
facingMode: { ideal: "environment" },
|
|
11215
|
+
...additionalConstraints
|
|
11125
11216
|
};
|
|
11126
11217
|
}
|
|
11218
|
+
return baseConstraints;
|
|
11219
|
+
};
|
|
11220
|
+
function getReducedVideoConstraints({
|
|
11221
|
+
deviceId,
|
|
11222
|
+
facingMode,
|
|
11223
|
+
additional
|
|
11224
|
+
}) {
|
|
11225
|
+
const additionalConstraints = typeof additional === "object" ? additional : {};
|
|
11127
11226
|
return {
|
|
11128
|
-
|
|
11227
|
+
deviceId: deviceId ? { exact: deviceId } : void 0,
|
|
11228
|
+
facingMode: { ideal: facingMode || "user" },
|
|
11229
|
+
width: { min: 320, ideal: 640 },
|
|
11230
|
+
height: { min: 240, ideal: 480 },
|
|
11231
|
+
...additionalConstraints
|
|
11129
11232
|
};
|
|
11130
11233
|
}
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11144
|
-
|
|
11145
|
-
|
|
11146
|
-
|
|
11147
|
-
|
|
11148
|
-
|
|
11149
|
-
|
|
11234
|
+
function getMobileOrDesktopVideoConstraints({
|
|
11235
|
+
deviceId,
|
|
11236
|
+
facingMode,
|
|
11237
|
+
additional,
|
|
11238
|
+
optimizedForLiveness = false
|
|
11239
|
+
}) {
|
|
11240
|
+
const additionalConstraints = typeof additional === "object" ? additional : {};
|
|
11241
|
+
if (optimizedForLiveness) {
|
|
11242
|
+
return getLivenessOptimizedConstraints(deviceId, additionalConstraints);
|
|
11243
|
+
}
|
|
11244
|
+
const initialConstraints = {
|
|
11245
|
+
deviceId: deviceId ? { exact: deviceId } : void 0,
|
|
11246
|
+
facingMode: { ideal: facingMode || "user" },
|
|
11247
|
+
width: import_react_device_detect.isSafari ? { min: 320, ideal: 1920 } : { min: 320, ideal: 4096, max: 4096 },
|
|
11248
|
+
height: import_react_device_detect.isSafari ? { min: 240, ideal: 1080 } : { min: 240, ideal: 2160, max: 2160 },
|
|
11249
|
+
frameRate: { ideal: 30 },
|
|
11250
|
+
resizeMode: "none",
|
|
11251
|
+
aspectRatio: { ideal: 1.777 },
|
|
11252
|
+
...additionalConstraints
|
|
11253
|
+
};
|
|
11254
|
+
if (isMobileOrTablet()) {
|
|
11255
|
+
return {
|
|
11256
|
+
...initialConstraints,
|
|
11257
|
+
aspectRatio: { ideal: 1 },
|
|
11258
|
+
facingMode: { ideal: "environment" },
|
|
11259
|
+
...additionalConstraints
|
|
11260
|
+
};
|
|
11261
|
+
}
|
|
11262
|
+
if (import_react_device_detect.isSafari && !import_react_device_detect.isMobile) {
|
|
11263
|
+
return {
|
|
11264
|
+
deviceId: deviceId ? { ideal: deviceId } : void 0,
|
|
11265
|
+
width: { min: 320, ideal: 1920 },
|
|
11266
|
+
height: { min: 240, ideal: 1080 },
|
|
11267
|
+
...additionalConstraints
|
|
11268
|
+
};
|
|
11269
|
+
}
|
|
11270
|
+
return initialConstraints;
|
|
11271
|
+
}
|
|
11272
|
+
function isDOMException(error) {
|
|
11273
|
+
return error instanceof DOMException && Boolean(error?.name);
|
|
11274
|
+
}
|
|
11275
|
+
function getPhotoCanvas({
|
|
11276
|
+
player,
|
|
11277
|
+
container,
|
|
11278
|
+
scanArea,
|
|
11279
|
+
canvas,
|
|
11280
|
+
cropToScanArea
|
|
11281
|
+
}) {
|
|
11282
|
+
if (!canvas) return;
|
|
11283
|
+
const playerWidth = player?.videoWidth ?? 1280;
|
|
11284
|
+
const playerHeight = player?.videoHeight ?? 720;
|
|
11285
|
+
const playerAR = playerWidth / playerHeight;
|
|
11286
|
+
const canvasWidth = container?.offsetWidth ?? 1280;
|
|
11287
|
+
const canvasHeight = container?.offsetHeight ?? 1280;
|
|
11288
|
+
const canvasAR = canvasWidth / canvasHeight;
|
|
11289
|
+
let sourceX;
|
|
11290
|
+
let sourceY;
|
|
11291
|
+
let sourceWidth;
|
|
11292
|
+
let sourceHeight;
|
|
11293
|
+
if (playerAR > canvasAR) {
|
|
11294
|
+
sourceHeight = playerHeight;
|
|
11295
|
+
sourceWidth = playerHeight * canvasAR;
|
|
11296
|
+
sourceX = (playerWidth - sourceWidth) / 2;
|
|
11297
|
+
sourceY = 0;
|
|
11298
|
+
} else {
|
|
11299
|
+
sourceWidth = playerWidth;
|
|
11300
|
+
sourceHeight = playerWidth / canvasAR;
|
|
11301
|
+
sourceX = 0;
|
|
11302
|
+
sourceY = (playerHeight - sourceHeight) / 2;
|
|
11303
|
+
}
|
|
11304
|
+
if (cropToScanArea && scanArea && player) {
|
|
11305
|
+
const scanAreaRect = scanArea.getBoundingClientRect();
|
|
11306
|
+
const scaleY = playerHeight / player.clientHeight;
|
|
11307
|
+
const offsetX = (playerWidth - player.clientWidth * scaleY) / 2;
|
|
11308
|
+
const offsetY = (playerHeight - player.clientHeight * scaleY) / 2;
|
|
11309
|
+
const cropX = offsetX + (player.clientWidth - scanAreaRect.width) / 2 * scaleY;
|
|
11310
|
+
const cropY = offsetY + (player.clientHeight - scanAreaRect.height) / 2 * scaleY;
|
|
11311
|
+
const cropWidth = scanAreaRect.width * scaleY;
|
|
11312
|
+
const cropHeight = scanAreaRect.height * scaleY;
|
|
11313
|
+
canvas.width = cropWidth;
|
|
11314
|
+
canvas.height = cropHeight;
|
|
11315
|
+
const context2 = canvas.getContext("2d");
|
|
11316
|
+
if (context2) {
|
|
11317
|
+
context2.drawImage(
|
|
11318
|
+
player,
|
|
11319
|
+
cropX,
|
|
11320
|
+
cropY,
|
|
11321
|
+
cropWidth,
|
|
11322
|
+
cropHeight,
|
|
11323
|
+
0,
|
|
11324
|
+
0,
|
|
11325
|
+
cropWidth,
|
|
11326
|
+
cropHeight
|
|
11327
|
+
);
|
|
11328
|
+
}
|
|
11329
|
+
return canvas;
|
|
11330
|
+
}
|
|
11331
|
+
canvas.width = sourceWidth;
|
|
11332
|
+
canvas.height = sourceHeight;
|
|
11333
|
+
const context = canvas.getContext("2d");
|
|
11334
|
+
if (context && player) {
|
|
11335
|
+
context.drawImage(
|
|
11336
|
+
player,
|
|
11337
|
+
sourceX,
|
|
11338
|
+
sourceY,
|
|
11339
|
+
sourceWidth,
|
|
11340
|
+
sourceHeight,
|
|
11341
|
+
0,
|
|
11342
|
+
0,
|
|
11343
|
+
sourceWidth,
|
|
11344
|
+
sourceHeight
|
|
11150
11345
|
);
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11157
|
-
|
|
11158
|
-
|
|
11159
|
-
|
|
11160
|
-
|
|
11161
|
-
|
|
11162
|
-
|
|
11163
|
-
|
|
11164
|
-
if (
|
|
11165
|
-
|
|
11166
|
-
|
|
11167
|
-
|
|
11168
|
-
|
|
11169
|
-
|
|
11170
|
-
|
|
11171
|
-
|
|
11172
|
-
|
|
11173
|
-
|
|
11174
|
-
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11346
|
+
}
|
|
11347
|
+
return canvas;
|
|
11348
|
+
}
|
|
11349
|
+
|
|
11350
|
+
// src/webcam/useErrorHandler.ts
|
|
11351
|
+
var GET_USER_MEDIA_ERROR = "getUserMedia is not implemented in this browser";
|
|
11352
|
+
function useErrorHandler({ onError }) {
|
|
11353
|
+
const { t } = (0, import_react_i18next23.useTranslation)();
|
|
11354
|
+
const handleError = useEvent(onError);
|
|
11355
|
+
const handleUserMediaError = (0, import_react84.useCallback)(
|
|
11356
|
+
(error) => {
|
|
11357
|
+
console.error(error);
|
|
11358
|
+
let errorText = "";
|
|
11359
|
+
if (error?.message === GET_USER_MEDIA_ERROR) {
|
|
11360
|
+
errorText = t("camera_errors.chekin_cant_use_your_camera");
|
|
11361
|
+
handleError({
|
|
11362
|
+
title: errorText,
|
|
11363
|
+
message: t("camera_errors.please_try_a_different_browser")
|
|
11364
|
+
});
|
|
11365
|
+
} else if (isDOMException(error)) {
|
|
11366
|
+
switch (error.name) {
|
|
11367
|
+
case "PermissionDeniedError":
|
|
11368
|
+
case "NotAllowedError":
|
|
11369
|
+
errorText = `${t("camera_errors.permissions_denied")}. ${t(
|
|
11370
|
+
"camera_errors.camera_permissions_denied"
|
|
11371
|
+
)}`;
|
|
11372
|
+
import_sonner2.toast.error(errorText);
|
|
11373
|
+
break;
|
|
11374
|
+
case "NotFoundError":
|
|
11375
|
+
errorText = t("camera_errors.no_camera_device_found");
|
|
11376
|
+
import_sonner2.toast.error(errorText);
|
|
11377
|
+
break;
|
|
11378
|
+
case "NotReadableError":
|
|
11379
|
+
case "AbortError":
|
|
11380
|
+
errorText = t("camera_errors.chekin_cant_use_your_camera");
|
|
11381
|
+
handleError({
|
|
11382
|
+
title: errorText,
|
|
11383
|
+
message: `${t("close_other_application_that_may_be_using_your_camera")}.
|
|
11384
|
+
${t("if_you_use_external_camera_disconnect_and_reconnect")}.
|
|
11385
|
+
${t("close_the_browser_re_open_it")}.`
|
|
11386
|
+
});
|
|
11387
|
+
break;
|
|
11388
|
+
case "OverconstrainedError":
|
|
11389
|
+
errorText = t("camera_errors.constraints_camera_error");
|
|
11390
|
+
if (import_react_device_detect2.isSafari) {
|
|
11391
|
+
handleError({
|
|
11392
|
+
title: errorText,
|
|
11393
|
+
message: `${t("camera_errors.safari_camera_error")}. ${t(
|
|
11394
|
+
"camera_errors.try_chrome_or_firefox"
|
|
11395
|
+
)}.`
|
|
11396
|
+
});
|
|
11397
|
+
} else {
|
|
11398
|
+
import_sonner2.toast.error(errorText);
|
|
11179
11399
|
}
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
|
|
11183
|
-
|
|
11400
|
+
break;
|
|
11401
|
+
default:
|
|
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
|
+
});
|
|
11184
11407
|
}
|
|
11408
|
+
} else {
|
|
11409
|
+
errorText = t("camera_errors.chekin_cant_use_your_camera");
|
|
11410
|
+
handleError({
|
|
11411
|
+
title: errorText,
|
|
11412
|
+
message: `${t("camera_errors.please_try_a_different_browser")} ${error}`
|
|
11413
|
+
});
|
|
11185
11414
|
}
|
|
11186
|
-
},
|
|
11187
|
-
|
|
11188
|
-
|
|
11189
|
-
|
|
11190
|
-
|
|
11191
|
-
|
|
11192
|
-
|
|
11415
|
+
},
|
|
11416
|
+
[handleError, t]
|
|
11417
|
+
);
|
|
11418
|
+
return { handleUserMediaError };
|
|
11419
|
+
}
|
|
11420
|
+
|
|
11421
|
+
// src/webcam/Webcam.tsx
|
|
11422
|
+
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
11423
|
+
var SCREENSHOT_FORMAT = "image/jpeg";
|
|
11424
|
+
var mirroredTransformStyle = { transform: "rotateY(180deg)" };
|
|
11425
|
+
var Webcam = (0, import_react85.memo)(
|
|
11426
|
+
(0, import_react85.forwardRef)(
|
|
11427
|
+
({
|
|
11428
|
+
onUserMedia,
|
|
11429
|
+
onDisabled,
|
|
11430
|
+
imageSmoothing,
|
|
11431
|
+
videoConstraints,
|
|
11432
|
+
additionalConstraints,
|
|
11433
|
+
hideScanArea,
|
|
11434
|
+
roundedScanArea,
|
|
11435
|
+
cropToScanArea,
|
|
11436
|
+
className,
|
|
11437
|
+
mirrored,
|
|
11438
|
+
children,
|
|
11439
|
+
isLoading,
|
|
11440
|
+
placeholderImage,
|
|
11441
|
+
screenshotMaxSize,
|
|
11442
|
+
minScreenshotH,
|
|
11443
|
+
minScreenshotW,
|
|
11444
|
+
videoSourceDeviceId,
|
|
11445
|
+
screenshotQuality = 1,
|
|
11446
|
+
compression,
|
|
11447
|
+
onError,
|
|
11448
|
+
...props
|
|
11449
|
+
}, ref) => {
|
|
11450
|
+
const [minScreenshotHeight, setMinScreenshotHeight] = (0, import_react85.useState)();
|
|
11451
|
+
const [minScreenshotWidth, setMinScreenshotWidth] = (0, import_react85.useState)();
|
|
11452
|
+
const [useReducedConstraints, setUseReducedConstraints] = (0, import_react85.useState)(false);
|
|
11453
|
+
const [numberOfCameras, setNumberOfCameras] = (0, import_react85.useState)(0);
|
|
11454
|
+
const constraints = (0, import_react85.useMemo)(() => {
|
|
11455
|
+
if (videoConstraints) {
|
|
11456
|
+
return videoConstraints;
|
|
11193
11457
|
}
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
|
|
11198
|
-
|
|
11199
|
-
|
|
11458
|
+
if (useReducedConstraints) {
|
|
11459
|
+
return getReducedVideoConstraints({
|
|
11460
|
+
deviceId: videoSourceDeviceId,
|
|
11461
|
+
additional: additionalConstraints
|
|
11462
|
+
});
|
|
11463
|
+
}
|
|
11464
|
+
return getMobileOrDesktopVideoConstraints({
|
|
11465
|
+
deviceId: videoSourceDeviceId,
|
|
11466
|
+
additional: additionalConstraints
|
|
11467
|
+
});
|
|
11468
|
+
}, [
|
|
11469
|
+
additionalConstraints,
|
|
11470
|
+
useReducedConstraints,
|
|
11471
|
+
videoConstraints,
|
|
11472
|
+
videoSourceDeviceId
|
|
11473
|
+
]);
|
|
11474
|
+
const isMirroredInCSS = mirrored === void 0 && !isMobileOrTablet();
|
|
11475
|
+
const webcamRef = (0, import_react85.useRef)(null);
|
|
11476
|
+
const scanAreaRef = (0, import_react85.useRef)(null);
|
|
11477
|
+
const canvasRef = (0, import_react85.useRef)(null);
|
|
11478
|
+
const containerRef = (0, import_react85.useRef)(null);
|
|
11479
|
+
const { handleUserMediaError } = useErrorHandler({
|
|
11480
|
+
onError: (errorDetails) => {
|
|
11481
|
+
onDisabled?.(true);
|
|
11482
|
+
onError(errorDetails);
|
|
11483
|
+
}
|
|
11484
|
+
});
|
|
11485
|
+
const handleUserMediaErrorWithFallback = (0, import_react85.useCallback)(
|
|
11486
|
+
(error) => {
|
|
11487
|
+
if (error instanceof DOMException && error.name === "OverconstrainedError" && !useReducedConstraints && !videoConstraints) {
|
|
11488
|
+
console.warn("Camera constraints failed, trying reduced constraints:", error);
|
|
11489
|
+
setUseReducedConstraints(true);
|
|
11490
|
+
return;
|
|
11491
|
+
}
|
|
11492
|
+
handleUserMediaError(error);
|
|
11493
|
+
},
|
|
11494
|
+
[handleUserMediaError, useReducedConstraints, videoConstraints]
|
|
11495
|
+
);
|
|
11496
|
+
const compressImage2 = async (canvas) => {
|
|
11497
|
+
if (!canvas) return;
|
|
11498
|
+
const blobImage = await getCanvasBlob(canvas);
|
|
11499
|
+
if (!blobImage) return;
|
|
11500
|
+
const compressedFile = await compressFile(blobImage, {
|
|
11501
|
+
convertSize: screenshotMaxSize
|
|
11502
|
+
});
|
|
11503
|
+
console.log(
|
|
11504
|
+
"Before: ",
|
|
11505
|
+
getFileSizeMB(blobImage)?.toFixed(2),
|
|
11506
|
+
"MB",
|
|
11507
|
+
"After: ",
|
|
11508
|
+
getFileSizeMB(compressedFile)?.toFixed(2),
|
|
11509
|
+
"MB"
|
|
11510
|
+
);
|
|
11511
|
+
return toBase64(compressedFile);
|
|
11512
|
+
};
|
|
11513
|
+
const handleTakePhoto = () => {
|
|
11514
|
+
const takenPhotoCanvas = getPhotoCanvas({
|
|
11515
|
+
player: webcamRef.current?.video,
|
|
11516
|
+
container: containerRef.current,
|
|
11517
|
+
canvas: canvasRef.current,
|
|
11518
|
+
scanArea: scanAreaRef.current,
|
|
11519
|
+
cropToScanArea
|
|
11520
|
+
});
|
|
11521
|
+
if (!takenPhotoCanvas) return;
|
|
11522
|
+
if (compression) return compressImage2(takenPhotoCanvas);
|
|
11523
|
+
return Promise.resolve(
|
|
11524
|
+
takenPhotoCanvas.toDataURL(SCREENSHOT_FORMAT, screenshotQuality)
|
|
11525
|
+
);
|
|
11526
|
+
};
|
|
11527
|
+
(0, import_react85.useImperativeHandle)(
|
|
11528
|
+
ref,
|
|
11529
|
+
() => ({
|
|
11530
|
+
takePhoto: handleTakePhoto,
|
|
11531
|
+
numberOfCameras,
|
|
11532
|
+
...webcamRef.current
|
|
11533
|
+
})
|
|
11534
|
+
);
|
|
11535
|
+
const handleUserMediaSuccess = (0, import_react85.useCallback)(
|
|
11536
|
+
(stream) => {
|
|
11537
|
+
if (!import_react_device_detect3.isMobile) {
|
|
11538
|
+
const track = stream.getVideoTracks()[0];
|
|
11539
|
+
const capabilities = !import_react_device_detect3.isFirefox && track?.getCapabilities();
|
|
11540
|
+
if (capabilities) {
|
|
11541
|
+
setMinScreenshotHeight(capabilities.height?.max);
|
|
11542
|
+
setMinScreenshotWidth(capabilities.width?.max);
|
|
11543
|
+
}
|
|
11544
|
+
} else {
|
|
11545
|
+
setMinScreenshotWidth(minScreenshotW);
|
|
11546
|
+
setMinScreenshotHeight(minScreenshotH);
|
|
11547
|
+
}
|
|
11548
|
+
navigator.mediaDevices.enumerateDevices().then((devices) => {
|
|
11549
|
+
setNumberOfCameras(
|
|
11550
|
+
devices.filter((device) => device.kind === "videoinput").length
|
|
11551
|
+
);
|
|
11552
|
+
}).catch((error) => {
|
|
11553
|
+
console.warn("Failed to enumerate devices:", error);
|
|
11554
|
+
setNumberOfCameras(1);
|
|
11555
|
+
});
|
|
11556
|
+
onUserMedia?.();
|
|
11557
|
+
},
|
|
11558
|
+
[minScreenshotH, minScreenshotW, onUserMedia]
|
|
11559
|
+
);
|
|
11560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(
|
|
11200
11561
|
"div",
|
|
11201
11562
|
{
|
|
11563
|
+
ref: containerRef,
|
|
11202
11564
|
className: cn(
|
|
11203
|
-
|
|
11204
|
-
|
|
11205
|
-
|
|
11565
|
+
className,
|
|
11566
|
+
"webcam relative z-[1] mx-auto flex h-[222px] w-[332px] items-center justify-center overflow-hidden rounded-[6px] text-center",
|
|
11567
|
+
"kiosko:h-[620px] kiosko:max-h-[620px] kiosko:w-[890px] kiosko:max-w-[890px]"
|
|
11206
11568
|
),
|
|
11207
|
-
|
|
11208
|
-
|
|
11569
|
+
style: isMirroredInCSS ? mirroredTransformStyle : void 0,
|
|
11570
|
+
children: [
|
|
11571
|
+
!hideScanArea && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(
|
|
11572
|
+
"div",
|
|
11573
|
+
{
|
|
11574
|
+
ref: scanAreaRef,
|
|
11575
|
+
className: cn(
|
|
11576
|
+
"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%)]",
|
|
11577
|
+
"h-[200px] rounded-[15px] min-[479px]:h-[calc(100%-32px)]",
|
|
11578
|
+
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%)]",
|
|
11579
|
+
"kiosko:h-[calc(100%-170px)] kiosko:w-[345px]"
|
|
11580
|
+
),
|
|
11581
|
+
style: isMirroredInCSS ? mirroredTransformStyle : void 0,
|
|
11582
|
+
children: [
|
|
11583
|
+
!roundedScanArea && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_jsx_runtime138.Fragment, { children: [
|
|
11584
|
+
/* @__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" }),
|
|
11585
|
+
/* @__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" }),
|
|
11586
|
+
/* @__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" }),
|
|
11587
|
+
/* @__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" })
|
|
11588
|
+
] }),
|
|
11589
|
+
placeholderImage
|
|
11590
|
+
]
|
|
11591
|
+
}
|
|
11592
|
+
),
|
|
11593
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)("canvas", { ref: canvasRef, className: "hidden" }),
|
|
11594
|
+
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)(
|
|
11595
|
+
import_react_webcam.default,
|
|
11596
|
+
{
|
|
11597
|
+
ref: webcamRef,
|
|
11598
|
+
mirrored: !!mirrored,
|
|
11599
|
+
width: props.width,
|
|
11600
|
+
height: props.height,
|
|
11601
|
+
videoConstraints: constraints,
|
|
11602
|
+
imageSmoothing: !!imageSmoothing,
|
|
11603
|
+
screenshotFormat: SCREENSHOT_FORMAT,
|
|
11604
|
+
onUserMedia: handleUserMediaSuccess,
|
|
11605
|
+
screenshotQuality,
|
|
11606
|
+
onUserMediaError: handleUserMediaErrorWithFallback,
|
|
11607
|
+
minScreenshotWidth,
|
|
11608
|
+
minScreenshotHeight,
|
|
11609
|
+
className: "webcam__video z-[1] h-full w-full bg-[#e2e2e2] object-cover",
|
|
11610
|
+
audio: false,
|
|
11611
|
+
disablePictureInPicture: false,
|
|
11612
|
+
forceScreenshotSourceSize: false
|
|
11613
|
+
}
|
|
11614
|
+
),
|
|
11615
|
+
children
|
|
11616
|
+
]
|
|
11617
|
+
}
|
|
11618
|
+
);
|
|
11619
|
+
}
|
|
11620
|
+
)
|
|
11621
|
+
);
|
|
11622
|
+
Webcam.displayName = "Webcam";
|
|
11623
|
+
|
|
11624
|
+
// src/mobile-webcam/MobileWebcam.tsx
|
|
11625
|
+
var import_lucide_react41 = require("lucide-react");
|
|
11626
|
+
var import_react87 = require("react");
|
|
11627
|
+
var import_react_dom = require("react-dom");
|
|
11628
|
+
var import_react_i18next25 = require("react-i18next");
|
|
11629
|
+
|
|
11630
|
+
// src/mobile-webcam/DeviceCamera/DeviceCamera.tsx
|
|
11631
|
+
var import_react86 = require("react");
|
|
11632
|
+
var import_react_i18next24 = require("react-i18next");
|
|
11633
|
+
var import_jsx_runtime139 = require("react/jsx-runtime");
|
|
11634
|
+
function DeviceCamera({ onChange, facingMode, className }) {
|
|
11635
|
+
const { t } = (0, import_react_i18next24.useTranslation)();
|
|
11636
|
+
const handleNativeScreenshot = (0, import_react86.useCallback)(
|
|
11637
|
+
(event) => {
|
|
11638
|
+
const file = event.target.files?.[0];
|
|
11639
|
+
onChange(file ? compressImage(file) : void 0);
|
|
11640
|
+
},
|
|
11641
|
+
[onChange]
|
|
11642
|
+
);
|
|
11643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
|
|
11644
|
+
"div",
|
|
11645
|
+
{
|
|
11646
|
+
className: cn(
|
|
11647
|
+
"mobile-webcam-device-camera flex flex-col items-center gap-3 rounded-xl bg-[#1c1b1f] p-4 text-sm text-white",
|
|
11648
|
+
className
|
|
11649
|
+
),
|
|
11650
|
+
children: [
|
|
11651
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { children: t("camera_errors.experiencing_camera_issues") }),
|
|
11652
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("label", { className: "text-[16px] font-semibold uppercase leading-6 text-[var(--text-button-color)]", children: [
|
|
11653
|
+
t("open_devices_camera"),
|
|
11654
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
|
|
11655
|
+
"input",
|
|
11209
11656
|
{
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
imageSmoothing,
|
|
11216
|
-
mirrored,
|
|
11217
|
-
screenshotQuality,
|
|
11218
|
-
videoConstraints: constraints,
|
|
11219
|
-
screenshotFormat: SCREENSHOT_FORMAT,
|
|
11220
|
-
minScreenshotHeight,
|
|
11221
|
-
minScreenshotWidth
|
|
11657
|
+
className: "sr-only",
|
|
11658
|
+
type: "file",
|
|
11659
|
+
accept: "image/*",
|
|
11660
|
+
capture: facingMode || "environment",
|
|
11661
|
+
onChange: handleNativeScreenshot
|
|
11222
11662
|
}
|
|
11223
11663
|
)
|
|
11224
|
-
}
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11664
|
+
] })
|
|
11665
|
+
]
|
|
11666
|
+
}
|
|
11667
|
+
);
|
|
11668
|
+
}
|
|
11669
|
+
|
|
11670
|
+
// src/mobile-webcam/MobileWebcam.tsx
|
|
11671
|
+
var import_jsx_runtime140 = require("react/jsx-runtime");
|
|
11672
|
+
var webcamClasses = "fixed left-0 top-0 z-[6] h-full w-full rounded-none";
|
|
11673
|
+
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]`;
|
|
11674
|
+
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`;
|
|
11675
|
+
function getAndMapFacingMode(constraints) {
|
|
11676
|
+
if (typeof constraints === "boolean" || !constraints) return;
|
|
11677
|
+
if (constraints.facingMode === "user") return "user";
|
|
11678
|
+
if (constraints.facingMode === "environment") return "environment";
|
|
11679
|
+
}
|
|
11680
|
+
var MobileWebcam = (0, import_react87.forwardRef)(
|
|
11681
|
+
({ onScreenshot, onBack, title, text, disabled, className, ...props }, ref) => {
|
|
11682
|
+
const rootElement = getDocument()?.body;
|
|
11683
|
+
const { t } = (0, import_react_i18next25.useTranslation)();
|
|
11684
|
+
const handleNativeScreenshot = (0, import_react87.useCallback)(
|
|
11685
|
+
(photo) => onScreenshot({ isNative: true, photo }),
|
|
11686
|
+
[onScreenshot]
|
|
11687
|
+
);
|
|
11688
|
+
return (0, import_react_dom.createPortal)(
|
|
11689
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "mobile-camera flex justify-center", children: [
|
|
11690
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
11691
|
+
"button",
|
|
11692
|
+
{
|
|
11693
|
+
type: "button",
|
|
11694
|
+
onClick: onBack,
|
|
11695
|
+
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]",
|
|
11696
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_lucide_react41.ChevronLeft, { size: 32, strokeWidth: 3, className: "text-white" })
|
|
11697
|
+
}
|
|
11698
|
+
),
|
|
11699
|
+
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 }),
|
|
11700
|
+
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") }),
|
|
11701
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
11702
|
+
Webcam,
|
|
11703
|
+
{
|
|
11704
|
+
ref,
|
|
11705
|
+
...props,
|
|
11706
|
+
className: cn(
|
|
11707
|
+
className,
|
|
11708
|
+
webcamClasses,
|
|
11709
|
+
props.roundedScanArea ? roundedWebcamClasses : scanAreaClasses
|
|
11710
|
+
)
|
|
11711
|
+
}
|
|
11712
|
+
),
|
|
11713
|
+
/* @__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: [
|
|
11714
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
11715
|
+
"button",
|
|
11716
|
+
{
|
|
11717
|
+
type: "button",
|
|
11718
|
+
disabled,
|
|
11719
|
+
onClick: () => onScreenshot({ isNative: false }),
|
|
11720
|
+
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",
|
|
11721
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_lucide_react41.Camera, { size: 26, className: "text-[var(--primary)]" })
|
|
11722
|
+
}
|
|
11723
|
+
),
|
|
11724
|
+
/* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
|
|
11725
|
+
DeviceCamera,
|
|
11726
|
+
{
|
|
11727
|
+
onChange: handleNativeScreenshot,
|
|
11728
|
+
facingMode: getAndMapFacingMode(props.additionalConstraints)
|
|
11729
|
+
}
|
|
11730
|
+
)
|
|
11731
|
+
] })
|
|
11732
|
+
] }),
|
|
11733
|
+
rootElement
|
|
11734
|
+
);
|
|
11228
11735
|
}
|
|
11229
11736
|
);
|
|
11230
|
-
|
|
11737
|
+
MobileWebcam.displayName = "MobileWebcam";
|
|
11231
11738
|
|
|
11232
11739
|
// src/wide-button/WideButton.tsx
|
|
11233
|
-
var
|
|
11234
|
-
var
|
|
11235
|
-
var WideButton = (0,
|
|
11236
|
-
({ className, disabled, ...props }, ref) => /* @__PURE__ */ (0,
|
|
11740
|
+
var import_react88 = require("react");
|
|
11741
|
+
var import_jsx_runtime141 = require("react/jsx-runtime");
|
|
11742
|
+
var WideButton = (0, import_react88.forwardRef)(
|
|
11743
|
+
({ className, disabled, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
11237
11744
|
Button,
|
|
11238
11745
|
{
|
|
11239
11746
|
ref,
|
|
@@ -11255,22 +11762,22 @@ WideButton.displayName = "WideButton";
|
|
|
11255
11762
|
var React42 = __toESM(require("react"), 1);
|
|
11256
11763
|
var DialogPrimitive2 = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
11257
11764
|
var import_react_draggable = __toESM(require("react-draggable"), 1);
|
|
11258
|
-
var
|
|
11765
|
+
var import_jsx_runtime142 = require("react/jsx-runtime");
|
|
11259
11766
|
var DRAWER_CLOSE_THRESHOLD = 72;
|
|
11260
11767
|
var DRAWER_MIN_OVERLAY_OPACITY = 0.1;
|
|
11261
11768
|
function Drawer({ ...props }) {
|
|
11262
|
-
return /* @__PURE__ */ (0,
|
|
11769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(DialogPrimitive2.Root, { "data-slot": "drawer", ...props });
|
|
11263
11770
|
}
|
|
11264
11771
|
function DrawerTrigger({ ...props }) {
|
|
11265
|
-
return /* @__PURE__ */ (0,
|
|
11772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(DialogPrimitive2.Trigger, { "data-slot": "drawer-trigger", ...props });
|
|
11266
11773
|
}
|
|
11267
11774
|
function DrawerPortal({ ...props }) {
|
|
11268
|
-
return /* @__PURE__ */ (0,
|
|
11775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(DialogPrimitive2.Portal, { "data-slot": "drawer-portal", ...props });
|
|
11269
11776
|
}
|
|
11270
11777
|
function DrawerClose({ ...props }) {
|
|
11271
|
-
return /* @__PURE__ */ (0,
|
|
11778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(DialogPrimitive2.Close, { "data-slot": "drawer-close", ...props });
|
|
11272
11779
|
}
|
|
11273
|
-
var DrawerOverlay = React42.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
11780
|
+
var DrawerOverlay = React42.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11274
11781
|
DialogPrimitive2.Overlay,
|
|
11275
11782
|
{
|
|
11276
11783
|
ref,
|
|
@@ -11320,14 +11827,14 @@ var DrawerContent = React42.forwardRef(
|
|
|
11320
11827
|
},
|
|
11321
11828
|
[onClose]
|
|
11322
11829
|
);
|
|
11323
|
-
return /* @__PURE__ */ (0,
|
|
11324
|
-
lockScroll ? /* @__PURE__ */ (0,
|
|
11830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(DrawerPortal, { container: finalContainer, children: [
|
|
11831
|
+
lockScroll ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11325
11832
|
DrawerOverlay,
|
|
11326
11833
|
{
|
|
11327
11834
|
style: { opacity: overlayOpacity },
|
|
11328
11835
|
onClick: closeOnOverlayClick ? onClose : void 0
|
|
11329
11836
|
}
|
|
11330
|
-
) : /* @__PURE__ */ (0,
|
|
11837
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11331
11838
|
"div",
|
|
11332
11839
|
{
|
|
11333
11840
|
className: cn(DrawerOverlayClasses),
|
|
@@ -11335,7 +11842,7 @@ var DrawerContent = React42.forwardRef(
|
|
|
11335
11842
|
onClick: closeOnOverlayClick ? onClose : void 0
|
|
11336
11843
|
}
|
|
11337
11844
|
),
|
|
11338
|
-
/* @__PURE__ */ (0,
|
|
11845
|
+
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11339
11846
|
DialogPrimitive2.Content,
|
|
11340
11847
|
{
|
|
11341
11848
|
asChild: true,
|
|
@@ -11351,7 +11858,7 @@ var DrawerContent = React42.forwardRef(
|
|
|
11351
11858
|
}
|
|
11352
11859
|
},
|
|
11353
11860
|
...props,
|
|
11354
|
-
children: /* @__PURE__ */ (0,
|
|
11861
|
+
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)(
|
|
11355
11862
|
import_react_draggable.default,
|
|
11356
11863
|
{
|
|
11357
11864
|
axis: "y",
|
|
@@ -11362,7 +11869,7 @@ var DrawerContent = React42.forwardRef(
|
|
|
11362
11869
|
onDrag: handleDrag,
|
|
11363
11870
|
onStop: handleStop,
|
|
11364
11871
|
position: { x: 0, y: dragOffsetY },
|
|
11365
|
-
children: /* @__PURE__ */ (0,
|
|
11872
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(
|
|
11366
11873
|
"div",
|
|
11367
11874
|
{
|
|
11368
11875
|
ref: nodeRef,
|
|
@@ -11371,7 +11878,7 @@ var DrawerContent = React42.forwardRef(
|
|
|
11371
11878
|
className
|
|
11372
11879
|
),
|
|
11373
11880
|
children: [
|
|
11374
|
-
showHandle && /* @__PURE__ */ (0,
|
|
11881
|
+
showHandle && /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11375
11882
|
"div",
|
|
11376
11883
|
{
|
|
11377
11884
|
"data-drawer-handle": true,
|
|
@@ -11379,10 +11886,10 @@ var DrawerContent = React42.forwardRef(
|
|
|
11379
11886
|
"mx-auto flex h-8 w-24 touch-none items-center justify-center",
|
|
11380
11887
|
disableDrag ? "cursor-default" : "cursor-grab active:cursor-grabbing"
|
|
11381
11888
|
),
|
|
11382
|
-
children: /* @__PURE__ */ (0,
|
|
11889
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("span", { className: "block h-1.5 w-12 rounded-full bg-[#D9D7D3]" })
|
|
11383
11890
|
}
|
|
11384
11891
|
),
|
|
11385
|
-
/* @__PURE__ */ (0,
|
|
11892
|
+
/* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto", children })
|
|
11386
11893
|
]
|
|
11387
11894
|
}
|
|
11388
11895
|
)
|
|
@@ -11394,7 +11901,7 @@ var DrawerContent = React42.forwardRef(
|
|
|
11394
11901
|
}
|
|
11395
11902
|
);
|
|
11396
11903
|
DrawerContent.displayName = DialogPrimitive2.Content.displayName;
|
|
11397
|
-
var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
11904
|
+
var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11398
11905
|
"div",
|
|
11399
11906
|
{
|
|
11400
11907
|
className: cn("flex flex-col gap-2 px-5 pt-2 text-center", className),
|
|
@@ -11402,9 +11909,9 @@ var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
11402
11909
|
}
|
|
11403
11910
|
);
|
|
11404
11911
|
DrawerHeader.displayName = "DrawerHeader";
|
|
11405
|
-
var DrawerFooter = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
11912
|
+
var DrawerFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: cn("flex flex-col gap-2 p-5", className), ...props });
|
|
11406
11913
|
DrawerFooter.displayName = "DrawerFooter";
|
|
11407
|
-
var DrawerTitle = React42.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
11914
|
+
var DrawerTitle = React42.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11408
11915
|
DialogPrimitive2.Title,
|
|
11409
11916
|
{
|
|
11410
11917
|
ref,
|
|
@@ -11414,7 +11921,7 @@ var DrawerTitle = React42.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
11414
11921
|
}
|
|
11415
11922
|
));
|
|
11416
11923
|
DrawerTitle.displayName = DialogPrimitive2.Title.displayName;
|
|
11417
|
-
var DrawerDescription = React42.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
11924
|
+
var DrawerDescription = React42.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
11418
11925
|
DialogPrimitive2.Description,
|
|
11419
11926
|
{
|
|
11420
11927
|
ref,
|
|
@@ -11441,7 +11948,7 @@ var DEVICE = {
|
|
|
11441
11948
|
};
|
|
11442
11949
|
|
|
11443
11950
|
// src/responsive-sheet/ResponsiveSheet.tsx
|
|
11444
|
-
var
|
|
11951
|
+
var import_jsx_runtime143 = require("react/jsx-runtime");
|
|
11445
11952
|
function ResponsiveSheet({
|
|
11446
11953
|
open,
|
|
11447
11954
|
onClose,
|
|
@@ -11460,8 +11967,8 @@ function ResponsiveSheet({
|
|
|
11460
11967
|
closeOnEscape = true,
|
|
11461
11968
|
disableDrag = false
|
|
11462
11969
|
}) {
|
|
11463
|
-
const { isMatch:
|
|
11464
|
-
const isMobileMode =
|
|
11970
|
+
const { isMatch: isMobile3 } = useScreenResize(DEVICE.tablet);
|
|
11971
|
+
const isMobileMode = isMobile3 && isMobileModalModeAvailable();
|
|
11465
11972
|
const handleOpenChange = (nextOpen) => {
|
|
11466
11973
|
if (!nextOpen) {
|
|
11467
11974
|
onClose();
|
|
@@ -11477,7 +11984,7 @@ function ResponsiveSheet({
|
|
|
11477
11984
|
event.preventDefault();
|
|
11478
11985
|
}
|
|
11479
11986
|
};
|
|
11480
|
-
const content = /* @__PURE__ */ (0,
|
|
11987
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(
|
|
11481
11988
|
"div",
|
|
11482
11989
|
{
|
|
11483
11990
|
className: cn(
|
|
@@ -11485,7 +11992,7 @@ function ResponsiveSheet({
|
|
|
11485
11992
|
contentClassName
|
|
11486
11993
|
),
|
|
11487
11994
|
children: [
|
|
11488
|
-
title ? /* @__PURE__ */ (0,
|
|
11995
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
|
|
11489
11996
|
"div",
|
|
11490
11997
|
{
|
|
11491
11998
|
"aria-hidden": "true",
|
|
@@ -11496,7 +12003,7 @@ function ResponsiveSheet({
|
|
|
11496
12003
|
children: title
|
|
11497
12004
|
}
|
|
11498
12005
|
) : null,
|
|
11499
|
-
description ? /* @__PURE__ */ (0,
|
|
12006
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
|
|
11500
12007
|
"p",
|
|
11501
12008
|
{
|
|
11502
12009
|
"aria-hidden": "true",
|
|
@@ -11512,7 +12019,7 @@ function ResponsiveSheet({
|
|
|
11512
12019
|
}
|
|
11513
12020
|
);
|
|
11514
12021
|
if (isMobileMode) {
|
|
11515
|
-
return /* @__PURE__ */ (0,
|
|
12022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(Drawer, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(
|
|
11516
12023
|
DrawerContent,
|
|
11517
12024
|
{
|
|
11518
12025
|
onClose,
|
|
@@ -11523,14 +12030,14 @@ function ResponsiveSheet({
|
|
|
11523
12030
|
onEscapeKeyDown: handleEscapeKeyDown,
|
|
11524
12031
|
className: cn(className, drawerClassName),
|
|
11525
12032
|
children: [
|
|
11526
|
-
title ? /* @__PURE__ */ (0,
|
|
11527
|
-
description ? /* @__PURE__ */ (0,
|
|
12033
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(DrawerTitle, { className: "sr-only", children: title }) : null,
|
|
12034
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(DrawerDescription, { className: "sr-only", children: description }) : null,
|
|
11528
12035
|
content
|
|
11529
12036
|
]
|
|
11530
12037
|
}
|
|
11531
12038
|
) });
|
|
11532
12039
|
}
|
|
11533
|
-
return /* @__PURE__ */ (0,
|
|
12040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(Dialog, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(
|
|
11534
12041
|
DialogContent,
|
|
11535
12042
|
{
|
|
11536
12043
|
showCloseButton,
|
|
@@ -11540,8 +12047,8 @@ function ResponsiveSheet({
|
|
|
11540
12047
|
className: cn("max-w-[560px] border-0 p-0 shadow-xl", className, dialogClassName),
|
|
11541
12048
|
lockScroll: false,
|
|
11542
12049
|
children: [
|
|
11543
|
-
title ? /* @__PURE__ */ (0,
|
|
11544
|
-
description ? /* @__PURE__ */ (0,
|
|
12050
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(DialogTitle, { className: "sr-only", children: title }) : null,
|
|
12051
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(DialogDescription, { className: "sr-only", children: description }) : null,
|
|
11545
12052
|
content
|
|
11546
12053
|
]
|
|
11547
12054
|
}
|
|
@@ -11550,7 +12057,7 @@ function ResponsiveSheet({
|
|
|
11550
12057
|
|
|
11551
12058
|
// src/responsive-dropdown/ResponsiveDropdown.tsx
|
|
11552
12059
|
var React43 = __toESM(require("react"), 1);
|
|
11553
|
-
var
|
|
12060
|
+
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
11554
12061
|
function ResponsiveDropdown({
|
|
11555
12062
|
trigger,
|
|
11556
12063
|
options,
|
|
@@ -11563,8 +12070,8 @@ function ResponsiveDropdown({
|
|
|
11563
12070
|
dropdownClassName,
|
|
11564
12071
|
drawerClassName
|
|
11565
12072
|
}) {
|
|
11566
|
-
const { isMatch:
|
|
11567
|
-
const isMobileMode =
|
|
12073
|
+
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
12074
|
+
const isMobileMode = isMobile3 && isMobileModalModeAvailable();
|
|
11568
12075
|
const [open, setOpen] = React43.useState(false);
|
|
11569
12076
|
const visibleOptions = options?.filter((option) => !option.hidden) ?? [];
|
|
11570
12077
|
const renderTrigger = (isOpen) => typeof trigger === "function" ? trigger(isOpen) : trigger;
|
|
@@ -11582,8 +12089,8 @@ function ResponsiveDropdown({
|
|
|
11582
12089
|
setOpen(false);
|
|
11583
12090
|
};
|
|
11584
12091
|
if (isMobileMode) {
|
|
11585
|
-
return /* @__PURE__ */ (0,
|
|
11586
|
-
/* @__PURE__ */ (0,
|
|
12092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(import_jsx_runtime144.Fragment, { children: [
|
|
12093
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
11587
12094
|
"div",
|
|
11588
12095
|
{
|
|
11589
12096
|
className: "responsive-dropdown__mobile-trigger",
|
|
@@ -11591,16 +12098,16 @@ function ResponsiveDropdown({
|
|
|
11591
12098
|
children: renderTrigger(open)
|
|
11592
12099
|
}
|
|
11593
12100
|
),
|
|
11594
|
-
/* @__PURE__ */ (0,
|
|
12101
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(Drawer, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
|
|
11595
12102
|
DrawerContent,
|
|
11596
12103
|
{
|
|
11597
12104
|
onClose: () => setOpen(false),
|
|
11598
12105
|
lockScroll: false,
|
|
11599
12106
|
className: cn("px-0 pb-2", className, drawerClassName),
|
|
11600
12107
|
children: [
|
|
11601
|
-
title ? /* @__PURE__ */ (0,
|
|
11602
|
-
/* @__PURE__ */ (0,
|
|
11603
|
-
visibleOptions.map((option) => /* @__PURE__ */ (0,
|
|
12108
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(DrawerTitle, { className: "sr-only", children: title }) : null,
|
|
12109
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: "flex flex-col", children: [
|
|
12110
|
+
visibleOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
11604
12111
|
"div",
|
|
11605
12112
|
{
|
|
11606
12113
|
role: "button",
|
|
@@ -11622,16 +12129,16 @@ function ResponsiveDropdown({
|
|
|
11622
12129
|
) })
|
|
11623
12130
|
] });
|
|
11624
12131
|
}
|
|
11625
|
-
return /* @__PURE__ */ (0,
|
|
11626
|
-
/* @__PURE__ */ (0,
|
|
11627
|
-
/* @__PURE__ */ (0,
|
|
12132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(DropdownMenu, { open, onOpenChange: handleOpenChange, children: [
|
|
12133
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(DropdownMenuTrigger, { asChild: true, disabled, children: renderTrigger(open) }),
|
|
12134
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
|
|
11628
12135
|
DropdownMenuContent,
|
|
11629
12136
|
{
|
|
11630
12137
|
side,
|
|
11631
12138
|
align,
|
|
11632
12139
|
className: cn("min-w-[295px]", className, dropdownClassName),
|
|
11633
12140
|
children: [
|
|
11634
|
-
visibleOptions.map((option) => /* @__PURE__ */ (0,
|
|
12141
|
+
visibleOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
11635
12142
|
DropdownMenuItem,
|
|
11636
12143
|
{
|
|
11637
12144
|
disabled: option.disabled,
|
|
@@ -11649,11 +12156,11 @@ function ResponsiveDropdown({
|
|
|
11649
12156
|
|
|
11650
12157
|
// src/dashboard/input/Input.tsx
|
|
11651
12158
|
var React44 = __toESM(require("react"), 1);
|
|
11652
|
-
var
|
|
11653
|
-
var
|
|
12159
|
+
var import_lucide_react42 = require("lucide-react");
|
|
12160
|
+
var import_react_i18next26 = require("react-i18next");
|
|
11654
12161
|
|
|
11655
12162
|
// src/dashboard/_fieldset/Fieldset.tsx
|
|
11656
|
-
var
|
|
12163
|
+
var import_jsx_runtime145 = require("react/jsx-runtime");
|
|
11657
12164
|
function Fieldset({
|
|
11658
12165
|
isActivated,
|
|
11659
12166
|
isFocused,
|
|
@@ -11673,8 +12180,8 @@ function Fieldset({
|
|
|
11673
12180
|
}) {
|
|
11674
12181
|
const showLegendText = Boolean(legend || typeof label === "string");
|
|
11675
12182
|
const raised = !isEmpty || isFocused;
|
|
11676
|
-
return /* @__PURE__ */ (0,
|
|
11677
|
-
/* @__PURE__ */ (0,
|
|
12183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(import_jsx_runtime145.Fragment, { children: [
|
|
12184
|
+
/* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(
|
|
11678
12185
|
"div",
|
|
11679
12186
|
{
|
|
11680
12187
|
onClick,
|
|
@@ -11690,7 +12197,7 @@ function Fieldset({
|
|
|
11690
12197
|
labelClassName
|
|
11691
12198
|
),
|
|
11692
12199
|
children: [
|
|
11693
|
-
/* @__PURE__ */ (0,
|
|
12200
|
+
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
11694
12201
|
"label",
|
|
11695
12202
|
{
|
|
11696
12203
|
id: labelId,
|
|
@@ -11702,7 +12209,7 @@ function Fieldset({
|
|
|
11702
12209
|
children: label
|
|
11703
12210
|
}
|
|
11704
12211
|
),
|
|
11705
|
-
tooltip && /* @__PURE__ */ (0,
|
|
12212
|
+
tooltip && /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("span", { className: "ml-1 inline-flex", children: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
11706
12213
|
HelpTooltip,
|
|
11707
12214
|
{
|
|
11708
12215
|
content: tooltip,
|
|
@@ -11713,7 +12220,7 @@ function Fieldset({
|
|
|
11713
12220
|
]
|
|
11714
12221
|
}
|
|
11715
12222
|
),
|
|
11716
|
-
/* @__PURE__ */ (0,
|
|
12223
|
+
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
11717
12224
|
"fieldset",
|
|
11718
12225
|
{
|
|
11719
12226
|
"aria-hidden": "true",
|
|
@@ -11725,7 +12232,7 @@ function Fieldset({
|
|
|
11725
12232
|
invalid && "border-[var(--error-message-color)]",
|
|
11726
12233
|
className
|
|
11727
12234
|
),
|
|
11728
|
-
children: /* @__PURE__ */ (0,
|
|
12235
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(
|
|
11729
12236
|
"legend",
|
|
11730
12237
|
{
|
|
11731
12238
|
className: cn(
|
|
@@ -11735,8 +12242,8 @@ function Fieldset({
|
|
|
11735
12242
|
!label && "w-0"
|
|
11736
12243
|
),
|
|
11737
12244
|
children: [
|
|
11738
|
-
showLegendText && /* @__PURE__ */ (0,
|
|
11739
|
-
tooltip && /* @__PURE__ */ (0,
|
|
12245
|
+
showLegendText && /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("span", { className: "visible inline-block pr-[6px] text-[14px] font-medium opacity-0", children: legend || label }),
|
|
12246
|
+
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" }) })
|
|
11740
12247
|
]
|
|
11741
12248
|
}
|
|
11742
12249
|
)
|
|
@@ -11746,7 +12253,7 @@ function Fieldset({
|
|
|
11746
12253
|
}
|
|
11747
12254
|
|
|
11748
12255
|
// src/dashboard/input/Input.tsx
|
|
11749
|
-
var
|
|
12256
|
+
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
11750
12257
|
var checkIfEmpty = ({
|
|
11751
12258
|
empty,
|
|
11752
12259
|
defaultValue,
|
|
@@ -11797,7 +12304,7 @@ var DashboardInput = React44.forwardRef(
|
|
|
11797
12304
|
const generatedId = React44.useId();
|
|
11798
12305
|
const inputId = id ?? name ?? generatedId;
|
|
11799
12306
|
const errorId = `${inputId}-error`;
|
|
11800
|
-
const { t } = (0,
|
|
12307
|
+
const { t } = (0, import_react_i18next26.useTranslation)();
|
|
11801
12308
|
const isEmpty = checkIfEmpty({ empty, value, defaultValue });
|
|
11802
12309
|
const [inputType, setInputType] = React44.useState(type);
|
|
11803
12310
|
const [isPasswordRevealed, setIsPasswordRevealed] = React44.useState(false);
|
|
@@ -11837,7 +12344,7 @@ var DashboardInput = React44.forwardRef(
|
|
|
11837
12344
|
};
|
|
11838
12345
|
const showRightPaddingForReset = Boolean(onReset);
|
|
11839
12346
|
const showRightPaddingForReveal = isPasswordReveal;
|
|
11840
|
-
return /* @__PURE__ */ (0,
|
|
12347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(
|
|
11841
12348
|
"div",
|
|
11842
12349
|
{
|
|
11843
12350
|
className: cn(
|
|
@@ -11848,7 +12355,7 @@ var DashboardInput = React44.forwardRef(
|
|
|
11848
12355
|
className
|
|
11849
12356
|
),
|
|
11850
12357
|
children: [
|
|
11851
|
-
topLabel && /* @__PURE__ */ (0,
|
|
12358
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11852
12359
|
"label",
|
|
11853
12360
|
{
|
|
11854
12361
|
htmlFor: inputId,
|
|
@@ -11856,7 +12363,7 @@ var DashboardInput = React44.forwardRef(
|
|
|
11856
12363
|
children: topLabel
|
|
11857
12364
|
}
|
|
11858
12365
|
),
|
|
11859
|
-
/* @__PURE__ */ (0,
|
|
12366
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(
|
|
11860
12367
|
"div",
|
|
11861
12368
|
{
|
|
11862
12369
|
className: cn(
|
|
@@ -11865,8 +12372,8 @@ var DashboardInput = React44.forwardRef(
|
|
|
11865
12372
|
fieldClassName
|
|
11866
12373
|
),
|
|
11867
12374
|
children: [
|
|
11868
|
-
/* @__PURE__ */ (0,
|
|
11869
|
-
/* @__PURE__ */ (0,
|
|
12375
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("div", { className: cn("relative w-full cursor-text", contentClassName), children: [
|
|
12376
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11870
12377
|
Fieldset,
|
|
11871
12378
|
{
|
|
11872
12379
|
isFocused: isFocused && !readOnly,
|
|
@@ -11887,8 +12394,8 @@ var DashboardInput = React44.forwardRef(
|
|
|
11887
12394
|
})
|
|
11888
12395
|
}
|
|
11889
12396
|
),
|
|
11890
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
11891
|
-
/* @__PURE__ */ (0,
|
|
12397
|
+
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 }) }),
|
|
12398
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11892
12399
|
"input",
|
|
11893
12400
|
{
|
|
11894
12401
|
...props,
|
|
@@ -11925,9 +12432,9 @@ var DashboardInput = React44.forwardRef(
|
|
|
11925
12432
|
)
|
|
11926
12433
|
}
|
|
11927
12434
|
),
|
|
11928
|
-
sign && /* @__PURE__ */ (0,
|
|
11929
|
-
trailingAdornment && /* @__PURE__ */ (0,
|
|
11930
|
-
onReset && !isEmpty && /* @__PURE__ */ (0,
|
|
12435
|
+
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 }),
|
|
12436
|
+
trailingAdornment && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("span", { className: "pointer-events-none absolute right-[14px] top-0 flex h-full items-center", children: trailingAdornment }),
|
|
12437
|
+
onReset && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11931
12438
|
"button",
|
|
11932
12439
|
{
|
|
11933
12440
|
type: "button",
|
|
@@ -11935,18 +12442,18 @@ var DashboardInput = React44.forwardRef(
|
|
|
11935
12442
|
disabled,
|
|
11936
12443
|
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",
|
|
11937
12444
|
"aria-label": "Reset",
|
|
11938
|
-
children: /* @__PURE__ */ (0,
|
|
12445
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(import_lucide_react42.X, { size: 14 })
|
|
11939
12446
|
}
|
|
11940
12447
|
),
|
|
11941
|
-
isPasswordReveal && /* @__PURE__ */ (0,
|
|
12448
|
+
isPasswordReveal && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11942
12449
|
"button",
|
|
11943
12450
|
{
|
|
11944
12451
|
type: "button",
|
|
11945
12452
|
onClick: togglePasswordReveal,
|
|
11946
12453
|
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",
|
|
11947
12454
|
"aria-label": isPasswordRevealed ? "Hide password" : "Show password",
|
|
11948
|
-
children: /* @__PURE__ */ (0,
|
|
11949
|
-
|
|
12455
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
12456
|
+
import_lucide_react42.Eye,
|
|
11950
12457
|
{
|
|
11951
12458
|
size: 20,
|
|
11952
12459
|
className: cn(
|
|
@@ -11957,32 +12464,32 @@ var DashboardInput = React44.forwardRef(
|
|
|
11957
12464
|
}
|
|
11958
12465
|
)
|
|
11959
12466
|
] }),
|
|
11960
|
-
type === "number" && showNumberButtons && /* @__PURE__ */ (0,
|
|
11961
|
-
/* @__PURE__ */ (0,
|
|
12467
|
+
type === "number" && showNumberButtons && /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)("div", { className: "absolute right-[18px] top-[13px] inline-flex items-center text-right", children: [
|
|
12468
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11962
12469
|
"button",
|
|
11963
12470
|
{
|
|
11964
12471
|
type: "button",
|
|
11965
12472
|
onClick: onDecrement,
|
|
11966
12473
|
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",
|
|
11967
12474
|
"aria-label": "Decrement",
|
|
11968
|
-
children: /* @__PURE__ */ (0,
|
|
12475
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(import_lucide_react42.Minus, { size: 16, strokeWidth: 3, "aria-hidden": true })
|
|
11969
12476
|
}
|
|
11970
12477
|
),
|
|
11971
|
-
/* @__PURE__ */ (0,
|
|
12478
|
+
/* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11972
12479
|
"button",
|
|
11973
12480
|
{
|
|
11974
12481
|
type: "button",
|
|
11975
12482
|
onClick: onIncrement,
|
|
11976
12483
|
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",
|
|
11977
12484
|
"aria-label": "Increment",
|
|
11978
|
-
children: /* @__PURE__ */ (0,
|
|
12485
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(import_lucide_react42.Plus, { size: 16, strokeWidth: 3, "aria-hidden": true })
|
|
11979
12486
|
}
|
|
11980
12487
|
)
|
|
11981
12488
|
] })
|
|
11982
12489
|
]
|
|
11983
12490
|
}
|
|
11984
12491
|
),
|
|
11985
|
-
!errorMessage && optional && /* @__PURE__ */ (0,
|
|
12492
|
+
!errorMessage && optional && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11986
12493
|
"span",
|
|
11987
12494
|
{
|
|
11988
12495
|
"data-testid": `${name}-optional`,
|
|
@@ -11990,8 +12497,8 @@ var DashboardInput = React44.forwardRef(
|
|
|
11990
12497
|
children: typeof optional === "string" ? optional : t("optional")
|
|
11991
12498
|
}
|
|
11992
12499
|
),
|
|
11993
|
-
!errorMessage && helperText && /* @__PURE__ */ (0,
|
|
11994
|
-
errorMessage && renderErrorMessage && /* @__PURE__ */ (0,
|
|
12500
|
+
!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 }),
|
|
12501
|
+
errorMessage && renderErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime146.jsx)(
|
|
11995
12502
|
FieldErrorMessage,
|
|
11996
12503
|
{
|
|
11997
12504
|
id: errorId,
|
|
@@ -12010,11 +12517,11 @@ DashboardInput.displayName = "DashboardInput";
|
|
|
12010
12517
|
|
|
12011
12518
|
// src/dashboard/select/Select.tsx
|
|
12012
12519
|
var React48 = __toESM(require("react"), 1);
|
|
12013
|
-
var
|
|
12520
|
+
var import_react_i18next30 = require("react-i18next");
|
|
12014
12521
|
|
|
12015
12522
|
// src/dashboard/_select-internals/SelectFieldShell.tsx
|
|
12016
|
-
var
|
|
12017
|
-
var
|
|
12523
|
+
var import_react_i18next27 = require("react-i18next");
|
|
12524
|
+
var import_jsx_runtime147 = require("react/jsx-runtime");
|
|
12018
12525
|
function SelectFieldShell({
|
|
12019
12526
|
containerRef,
|
|
12020
12527
|
className,
|
|
@@ -12033,9 +12540,9 @@ function SelectFieldShell({
|
|
|
12033
12540
|
onBlur,
|
|
12034
12541
|
children
|
|
12035
12542
|
}) {
|
|
12036
|
-
const { t } = (0,
|
|
12543
|
+
const { t } = (0, import_react_i18next27.useTranslation)();
|
|
12037
12544
|
const wrapperWidth = toCssSize(width);
|
|
12038
|
-
return /* @__PURE__ */ (0,
|
|
12545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(
|
|
12039
12546
|
"div",
|
|
12040
12547
|
{
|
|
12041
12548
|
ref: containerRef,
|
|
@@ -12048,9 +12555,9 @@ function SelectFieldShell({
|
|
|
12048
12555
|
),
|
|
12049
12556
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
12050
12557
|
children: [
|
|
12051
|
-
name && /* @__PURE__ */ (0,
|
|
12052
|
-
/* @__PURE__ */ (0,
|
|
12053
|
-
topLabel && /* @__PURE__ */ (0,
|
|
12558
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("input", { type: "hidden", name, value: hiddenValue ?? "" }),
|
|
12559
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "relative min-h-[68px] w-full", children: [
|
|
12560
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
12054
12561
|
"label",
|
|
12055
12562
|
{
|
|
12056
12563
|
htmlFor: triggerId,
|
|
@@ -12058,10 +12565,10 @@ function SelectFieldShell({
|
|
|
12058
12565
|
children: topLabel
|
|
12059
12566
|
}
|
|
12060
12567
|
),
|
|
12061
|
-
/* @__PURE__ */ (0,
|
|
12062
|
-
!errorMessage && optional && /* @__PURE__ */ (0,
|
|
12063
|
-
!errorMessage && helperText && /* @__PURE__ */ (0,
|
|
12064
|
-
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
12568
|
+
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: "relative w-full", children }),
|
|
12569
|
+
!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") }),
|
|
12570
|
+
!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 }),
|
|
12571
|
+
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
|
|
12065
12572
|
FieldErrorMessage,
|
|
12066
12573
|
{
|
|
12067
12574
|
id: errorId,
|
|
@@ -12076,7 +12583,7 @@ function SelectFieldShell({
|
|
|
12076
12583
|
}
|
|
12077
12584
|
|
|
12078
12585
|
// src/dashboard/_select-internals/SelectMenu.tsx
|
|
12079
|
-
var
|
|
12586
|
+
var import_react_i18next28 = require("react-i18next");
|
|
12080
12587
|
|
|
12081
12588
|
// src/dashboard/_select-internals/utils.ts
|
|
12082
12589
|
function getOptionIndex(options, option) {
|
|
@@ -12107,7 +12614,7 @@ function isOptionSelected(option, selectedValue, selectedValues) {
|
|
|
12107
12614
|
}
|
|
12108
12615
|
|
|
12109
12616
|
// src/dashboard/_select-internals/SelectMenu.tsx
|
|
12110
|
-
var
|
|
12617
|
+
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
12111
12618
|
function SelectMenu({
|
|
12112
12619
|
id,
|
|
12113
12620
|
options,
|
|
@@ -12129,10 +12636,10 @@ function SelectMenu({
|
|
|
12129
12636
|
emptyContent,
|
|
12130
12637
|
footer
|
|
12131
12638
|
}) {
|
|
12132
|
-
const { t } = (0,
|
|
12639
|
+
const { t } = (0, import_react_i18next28.useTranslation)();
|
|
12133
12640
|
const emptyMessage = noOptionsMessage?.() ?? t("no_options");
|
|
12134
12641
|
const hasOptions = options.length > 0;
|
|
12135
|
-
return /* @__PURE__ */ (0,
|
|
12642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
|
|
12136
12643
|
"div",
|
|
12137
12644
|
{
|
|
12138
12645
|
id,
|
|
@@ -12149,13 +12656,13 @@ function SelectMenu({
|
|
|
12149
12656
|
menuClassName
|
|
12150
12657
|
),
|
|
12151
12658
|
children: [
|
|
12152
|
-
!hasOptions && (emptyContent ?? /* @__PURE__ */ (0,
|
|
12659
|
+
!hasOptions && (emptyContent ?? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "mt-[10px] text-left text-[16px] text-[var(--chekin-color-brand-navy)]", children: emptyMessage })),
|
|
12153
12660
|
options.map((option, index) => {
|
|
12154
12661
|
const isSelected = isOptionSelected(option, selectedValue, selectedValues);
|
|
12155
12662
|
const isHighlighted = index === highlightedIndex;
|
|
12156
12663
|
const optionKey = `${String(option.value)}-${index}`;
|
|
12157
12664
|
const isOptionDisabled = Boolean(disabled || option.isDisabled);
|
|
12158
|
-
return /* @__PURE__ */ (0,
|
|
12665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
|
|
12159
12666
|
"button",
|
|
12160
12667
|
{
|
|
12161
12668
|
id: getOptionId2(index),
|
|
@@ -12178,8 +12685,8 @@ function SelectMenu({
|
|
|
12178
12685
|
isOptionDisabled && "cursor-default opacity-30"
|
|
12179
12686
|
),
|
|
12180
12687
|
children: [
|
|
12181
|
-
/* @__PURE__ */ (0,
|
|
12182
|
-
option.description && /* @__PURE__ */ (0,
|
|
12688
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "block break-words", children: option.label }),
|
|
12689
|
+
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 })
|
|
12183
12690
|
]
|
|
12184
12691
|
},
|
|
12185
12692
|
optionKey
|
|
@@ -12192,11 +12699,11 @@ function SelectMenu({
|
|
|
12192
12699
|
}
|
|
12193
12700
|
|
|
12194
12701
|
// src/dashboard/_select-internals/SelectMenuPanel.tsx
|
|
12195
|
-
var
|
|
12196
|
-
var
|
|
12702
|
+
var import_react_i18next29 = require("react-i18next");
|
|
12703
|
+
var import_jsx_runtime149 = require("react/jsx-runtime");
|
|
12197
12704
|
function SelectMenuPanel({
|
|
12198
12705
|
isOpen,
|
|
12199
|
-
isMobile:
|
|
12706
|
+
isMobile: isMobile3,
|
|
12200
12707
|
onClose,
|
|
12201
12708
|
title,
|
|
12202
12709
|
description,
|
|
@@ -12205,29 +12712,29 @@ function SelectMenuPanel({
|
|
|
12205
12712
|
drawerContentClassName,
|
|
12206
12713
|
children
|
|
12207
12714
|
}) {
|
|
12208
|
-
const { t } = (0,
|
|
12715
|
+
const { t } = (0, import_react_i18next29.useTranslation)();
|
|
12209
12716
|
if (!isOpen) return null;
|
|
12210
|
-
if (
|
|
12717
|
+
if (isMobile3) {
|
|
12211
12718
|
const fallbackTitle = t("select_option");
|
|
12212
12719
|
const titleText = typeof title === "string" || typeof title === "number" ? String(title) : fallbackTitle;
|
|
12213
12720
|
const descriptionText = typeof description === "string" || typeof description === "number" ? String(description) : titleText;
|
|
12214
|
-
return /* @__PURE__ */ (0,
|
|
12721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
|
|
12215
12722
|
Drawer,
|
|
12216
12723
|
{
|
|
12217
12724
|
open: isOpen,
|
|
12218
12725
|
onOpenChange: (next) => {
|
|
12219
12726
|
if (!next) onClose();
|
|
12220
12727
|
},
|
|
12221
|
-
children: /* @__PURE__ */ (0,
|
|
12728
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)(
|
|
12222
12729
|
DrawerContent,
|
|
12223
12730
|
{
|
|
12224
12731
|
onClose,
|
|
12225
12732
|
lockScroll: false,
|
|
12226
12733
|
className: cn("max-h-[calc(100vh-1rem)]", drawerClassName),
|
|
12227
12734
|
children: [
|
|
12228
|
-
/* @__PURE__ */ (0,
|
|
12229
|
-
/* @__PURE__ */ (0,
|
|
12230
|
-
/* @__PURE__ */ (0,
|
|
12735
|
+
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)(DrawerTitle, { className: "sr-only", children: titleText }),
|
|
12736
|
+
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)(DrawerDescription, { className: "sr-only", children: descriptionText }),
|
|
12737
|
+
/* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
|
|
12231
12738
|
"div",
|
|
12232
12739
|
{
|
|
12233
12740
|
className: cn(
|
|
@@ -12243,7 +12750,7 @@ function SelectMenuPanel({
|
|
|
12243
12750
|
}
|
|
12244
12751
|
);
|
|
12245
12752
|
}
|
|
12246
|
-
return /* @__PURE__ */ (0,
|
|
12753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
|
|
12247
12754
|
"div",
|
|
12248
12755
|
{
|
|
12249
12756
|
className: cn(
|
|
@@ -12256,7 +12763,7 @@ function SelectMenuPanel({
|
|
|
12256
12763
|
}
|
|
12257
12764
|
|
|
12258
12765
|
// src/dashboard/_select-internals/SelectSearchInput.tsx
|
|
12259
|
-
var
|
|
12766
|
+
var import_jsx_runtime150 = require("react/jsx-runtime");
|
|
12260
12767
|
function SelectSearchInput({
|
|
12261
12768
|
inputRef,
|
|
12262
12769
|
value,
|
|
@@ -12266,7 +12773,7 @@ function SelectSearchInput({
|
|
|
12266
12773
|
onChange,
|
|
12267
12774
|
onKeyDown
|
|
12268
12775
|
}) {
|
|
12269
|
-
return /* @__PURE__ */ (0,
|
|
12776
|
+
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)(
|
|
12270
12777
|
"input",
|
|
12271
12778
|
{
|
|
12272
12779
|
ref: inputRef,
|
|
@@ -12284,8 +12791,8 @@ function SelectSearchInput({
|
|
|
12284
12791
|
}
|
|
12285
12792
|
|
|
12286
12793
|
// src/dashboard/_select-internals/SelectTrigger.tsx
|
|
12287
|
-
var
|
|
12288
|
-
var
|
|
12794
|
+
var import_lucide_react43 = require("lucide-react");
|
|
12795
|
+
var import_jsx_runtime151 = require("react/jsx-runtime");
|
|
12289
12796
|
function SelectTrigger({
|
|
12290
12797
|
triggerRef,
|
|
12291
12798
|
triggerId,
|
|
@@ -12306,7 +12813,7 @@ function SelectTrigger({
|
|
|
12306
12813
|
onBlur
|
|
12307
12814
|
}) {
|
|
12308
12815
|
const isEmpty = !hasValue;
|
|
12309
|
-
return /* @__PURE__ */ (0,
|
|
12816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(
|
|
12310
12817
|
"button",
|
|
12311
12818
|
{
|
|
12312
12819
|
id: triggerId,
|
|
@@ -12330,11 +12837,11 @@ function SelectTrigger({
|
|
|
12330
12837
|
loading && "cursor-progress"
|
|
12331
12838
|
),
|
|
12332
12839
|
children: [
|
|
12333
|
-
/* @__PURE__ */ (0,
|
|
12334
|
-
/* @__PURE__ */ (0,
|
|
12335
|
-
loading && /* @__PURE__ */ (0,
|
|
12336
|
-
/* @__PURE__ */ (0,
|
|
12337
|
-
|
|
12840
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { id: valueId, className: "block min-w-0 flex-1 truncate text-left", children: valueLabel ?? (isOpen ? placeholder : null) }),
|
|
12841
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
12842
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
12843
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
|
|
12844
|
+
import_lucide_react43.ChevronDown,
|
|
12338
12845
|
{
|
|
12339
12846
|
size: 16,
|
|
12340
12847
|
className: cn(
|
|
@@ -12388,7 +12895,7 @@ function useSelectIds({
|
|
|
12388
12895
|
var React46 = __toESM(require("react"), 1);
|
|
12389
12896
|
function useSelectMenuState({
|
|
12390
12897
|
isBlocked,
|
|
12391
|
-
isMobile:
|
|
12898
|
+
isMobile: isMobile3,
|
|
12392
12899
|
onOutsideClick
|
|
12393
12900
|
}) {
|
|
12394
12901
|
const containerRef = React46.useRef(null);
|
|
@@ -12409,7 +12916,7 @@ function useSelectMenuState({
|
|
|
12409
12916
|
setIsOpen(false);
|
|
12410
12917
|
onOutsideClick?.();
|
|
12411
12918
|
},
|
|
12412
|
-
isDisabled: !isOpen ||
|
|
12919
|
+
isDisabled: !isOpen || isMobile3
|
|
12413
12920
|
});
|
|
12414
12921
|
React46.useEffect(() => {
|
|
12415
12922
|
if (isBlocked) setIsOpen(false);
|
|
@@ -12434,7 +12941,7 @@ function useSelectSearch({
|
|
|
12434
12941
|
}
|
|
12435
12942
|
|
|
12436
12943
|
// src/dashboard/select/Select.tsx
|
|
12437
|
-
var
|
|
12944
|
+
var import_jsx_runtime152 = require("react/jsx-runtime");
|
|
12438
12945
|
function DashboardSelectInternal({
|
|
12439
12946
|
options = [],
|
|
12440
12947
|
value,
|
|
@@ -12468,8 +12975,8 @@ function DashboardSelectInternal({
|
|
|
12468
12975
|
const listRef = React48.useRef(null);
|
|
12469
12976
|
const optionRefs = React48.useRef([]);
|
|
12470
12977
|
const [highlightedIndex, setHighlightedIndex] = React48.useState(-1);
|
|
12471
|
-
const
|
|
12472
|
-
const { t } = (0,
|
|
12978
|
+
const isMobile3 = useIsMobile();
|
|
12979
|
+
const { t } = (0, import_react_i18next30.useTranslation)();
|
|
12473
12980
|
const resolvedSearchPlaceholder = searchPlaceholder ?? t("search_placeholder");
|
|
12474
12981
|
const hasValue = Boolean(value);
|
|
12475
12982
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
@@ -12479,7 +12986,7 @@ function DashboardSelectInternal({
|
|
|
12479
12986
|
const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
|
|
12480
12987
|
const { containerRef, isOpen, closeMenu, toggleMenu, setIsOpen } = useSelectMenuState({
|
|
12481
12988
|
isBlocked,
|
|
12482
|
-
isMobile:
|
|
12989
|
+
isMobile: isMobile3
|
|
12483
12990
|
});
|
|
12484
12991
|
const { triggerId, labelId, valueId, listboxId, describedErrorId, errorId, getOptionId: getOptionId2 } = useSelectIds({ name, hasValue, error, hideErrorMessage });
|
|
12485
12992
|
const { searchValue, setSearchValue, filteredOptions } = useSelectSearch({
|
|
@@ -12558,7 +13065,7 @@ function DashboardSelectInternal({
|
|
|
12558
13065
|
setIsOpen(false);
|
|
12559
13066
|
}
|
|
12560
13067
|
};
|
|
12561
|
-
return /* @__PURE__ */ (0,
|
|
13068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
|
|
12562
13069
|
SelectFieldShell,
|
|
12563
13070
|
{
|
|
12564
13071
|
containerRef,
|
|
@@ -12576,7 +13083,7 @@ function DashboardSelectInternal({
|
|
|
12576
13083
|
name,
|
|
12577
13084
|
hiddenValue: value ? String(value.value) : "",
|
|
12578
13085
|
children: [
|
|
12579
|
-
/* @__PURE__ */ (0,
|
|
13086
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
12580
13087
|
SelectTrigger,
|
|
12581
13088
|
{
|
|
12582
13089
|
triggerRef,
|
|
@@ -12598,7 +13105,7 @@ function DashboardSelectInternal({
|
|
|
12598
13105
|
onBlur
|
|
12599
13106
|
}
|
|
12600
13107
|
),
|
|
12601
|
-
/* @__PURE__ */ (0,
|
|
13108
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
12602
13109
|
Fieldset,
|
|
12603
13110
|
{
|
|
12604
13111
|
isFocused: isOpen,
|
|
@@ -12615,17 +13122,17 @@ function DashboardSelectInternal({
|
|
|
12615
13122
|
onClick: !isBlocked ? toggleMenu : void 0
|
|
12616
13123
|
}
|
|
12617
13124
|
),
|
|
12618
|
-
/* @__PURE__ */ (0,
|
|
13125
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
|
|
12619
13126
|
SelectMenuPanel,
|
|
12620
13127
|
{
|
|
12621
13128
|
isOpen,
|
|
12622
|
-
isMobile:
|
|
13129
|
+
isMobile: isMobile3,
|
|
12623
13130
|
onClose: closeMenu,
|
|
12624
13131
|
title: typeof label === "string" ? label : void 0,
|
|
12625
13132
|
className: dropdownClassName,
|
|
12626
13133
|
drawerClassName,
|
|
12627
13134
|
children: [
|
|
12628
|
-
searchable && /* @__PURE__ */ (0,
|
|
13135
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
12629
13136
|
SelectSearchInput,
|
|
12630
13137
|
{
|
|
12631
13138
|
inputRef: searchInputRef,
|
|
@@ -12637,7 +13144,7 @@ function DashboardSelectInternal({
|
|
|
12637
13144
|
onKeyDown: handleSearchKeyDown
|
|
12638
13145
|
}
|
|
12639
13146
|
),
|
|
12640
|
-
/* @__PURE__ */ (0,
|
|
13147
|
+
/* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
12641
13148
|
SelectMenu,
|
|
12642
13149
|
{
|
|
12643
13150
|
id: listboxId,
|
|
@@ -12671,23 +13178,23 @@ var DashboardSelect = React48.forwardRef(
|
|
|
12671
13178
|
|
|
12672
13179
|
// src/dashboard/multi-select/MultiSelect.tsx
|
|
12673
13180
|
var React49 = __toESM(require("react"), 1);
|
|
12674
|
-
var
|
|
12675
|
-
var
|
|
13181
|
+
var import_lucide_react45 = require("lucide-react");
|
|
13182
|
+
var import_react_i18next32 = require("react-i18next");
|
|
12676
13183
|
|
|
12677
13184
|
// src/dashboard/multi-select/MultiSelectChip.tsx
|
|
12678
|
-
var
|
|
12679
|
-
var
|
|
12680
|
-
var
|
|
13185
|
+
var import_lucide_react44 = require("lucide-react");
|
|
13186
|
+
var import_react_i18next31 = require("react-i18next");
|
|
13187
|
+
var import_jsx_runtime153 = require("react/jsx-runtime");
|
|
12681
13188
|
function MultiSelectChip({
|
|
12682
13189
|
option,
|
|
12683
13190
|
readOnly,
|
|
12684
13191
|
onRemove
|
|
12685
13192
|
}) {
|
|
12686
|
-
const { t } = (0,
|
|
13193
|
+
const { t } = (0, import_react_i18next31.useTranslation)();
|
|
12687
13194
|
const labelText = typeof option.label === "string" ? option.label : String(option.value);
|
|
12688
|
-
return /* @__PURE__ */ (0,
|
|
12689
|
-
/* @__PURE__ */ (0,
|
|
12690
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13195
|
+
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: [
|
|
13196
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "whitespace-nowrap", children: option.label }),
|
|
13197
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
12691
13198
|
"button",
|
|
12692
13199
|
{
|
|
12693
13200
|
type: "button",
|
|
@@ -12697,14 +13204,14 @@ function MultiSelectChip({
|
|
|
12697
13204
|
},
|
|
12698
13205
|
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]",
|
|
12699
13206
|
"aria-label": t("remove_item", { label: labelText }),
|
|
12700
|
-
children: /* @__PURE__ */ (0,
|
|
13207
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_lucide_react44.SquareX, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
12701
13208
|
}
|
|
12702
13209
|
)
|
|
12703
13210
|
] });
|
|
12704
13211
|
}
|
|
12705
13212
|
|
|
12706
13213
|
// src/dashboard/multi-select/MultiSelect.tsx
|
|
12707
|
-
var
|
|
13214
|
+
var import_jsx_runtime154 = require("react/jsx-runtime");
|
|
12708
13215
|
var isValueSelected = (selected, option) => selected.some((item) => item.value === option.value);
|
|
12709
13216
|
function DashboardMultiSelectInternal({
|
|
12710
13217
|
options = [],
|
|
@@ -12744,8 +13251,8 @@ function DashboardMultiSelectInternal({
|
|
|
12744
13251
|
const optionRefs = React49.useRef([]);
|
|
12745
13252
|
const [isFocused, setIsFocused] = React49.useState(false);
|
|
12746
13253
|
const [highlightedIndex, setHighlightedIndex] = React49.useState(-1);
|
|
12747
|
-
const
|
|
12748
|
-
const { t } = (0,
|
|
13254
|
+
const isMobile3 = useIsMobile();
|
|
13255
|
+
const { t } = (0, import_react_i18next32.useTranslation)();
|
|
12749
13256
|
const selectedValues = React49.useMemo(() => value ?? [], [value]);
|
|
12750
13257
|
const hasValue = selectedValues.length > 0;
|
|
12751
13258
|
const isEmpty = !hasValue;
|
|
@@ -12755,7 +13262,7 @@ function DashboardMultiSelectInternal({
|
|
|
12755
13262
|
const errorMessage = typeof error === "string" ? error : void 0;
|
|
12756
13263
|
const { containerRef, isOpen, closeMenu, setIsOpen } = useSelectMenuState({
|
|
12757
13264
|
isBlocked,
|
|
12758
|
-
isMobile:
|
|
13265
|
+
isMobile: isMobile3,
|
|
12759
13266
|
onOutsideClick: () => setIsFocused(false)
|
|
12760
13267
|
});
|
|
12761
13268
|
const { triggerId, labelId, valueId, listboxId, describedErrorId, errorId, getOptionId: getOptionId2 } = useSelectIds({ name, hasValue, error, hideErrorMessage });
|
|
@@ -12797,12 +13304,12 @@ function DashboardMultiSelectInternal({
|
|
|
12797
13304
|
});
|
|
12798
13305
|
}, [isOpen, filteredOptions]);
|
|
12799
13306
|
React49.useEffect(() => {
|
|
12800
|
-
if (!isOpen || !
|
|
13307
|
+
if (!isOpen || !isMobile3) return;
|
|
12801
13308
|
const frame = window.requestAnimationFrame(
|
|
12802
13309
|
() => mobileSearchInputRef.current?.focus()
|
|
12803
13310
|
);
|
|
12804
13311
|
return () => window.cancelAnimationFrame(frame);
|
|
12805
|
-
}, [isOpen,
|
|
13312
|
+
}, [isOpen, isMobile3]);
|
|
12806
13313
|
const openMenu = () => {
|
|
12807
13314
|
if (isBlocked) return;
|
|
12808
13315
|
setIsOpen(true);
|
|
@@ -12899,7 +13406,7 @@ function DashboardMultiSelectInternal({
|
|
|
12899
13406
|
setIsFocused(false);
|
|
12900
13407
|
onBlur?.(event);
|
|
12901
13408
|
};
|
|
12902
|
-
return /* @__PURE__ */ (0,
|
|
13409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(
|
|
12903
13410
|
SelectFieldShell,
|
|
12904
13411
|
{
|
|
12905
13412
|
containerRef,
|
|
@@ -12918,7 +13425,7 @@ function DashboardMultiSelectInternal({
|
|
|
12918
13425
|
hiddenValue: selectedValues.map((item) => String(item.value)).join(","),
|
|
12919
13426
|
onBlur: handleInputBlur,
|
|
12920
13427
|
children: [
|
|
12921
|
-
/* @__PURE__ */ (0,
|
|
13428
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(
|
|
12922
13429
|
"div",
|
|
12923
13430
|
{
|
|
12924
13431
|
id: triggerId,
|
|
@@ -12941,7 +13448,7 @@ function DashboardMultiSelectInternal({
|
|
|
12941
13448
|
),
|
|
12942
13449
|
children: [
|
|
12943
13450
|
selectedValues.map(
|
|
12944
|
-
(option) => renderChip ? /* @__PURE__ */ (0,
|
|
13451
|
+
(option) => renderChip ? /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(React49.Fragment, { children: renderChip(option, () => removeOption(option)) }, String(option.value)) : /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
12945
13452
|
MultiSelectChip,
|
|
12946
13453
|
{
|
|
12947
13454
|
option,
|
|
@@ -12951,7 +13458,7 @@ function DashboardMultiSelectInternal({
|
|
|
12951
13458
|
String(option.value)
|
|
12952
13459
|
)
|
|
12953
13460
|
),
|
|
12954
|
-
/* @__PURE__ */ (0,
|
|
13461
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
12955
13462
|
"input",
|
|
12956
13463
|
{
|
|
12957
13464
|
ref: inputRef,
|
|
@@ -12980,9 +13487,9 @@ function DashboardMultiSelectInternal({
|
|
|
12980
13487
|
"aria-activedescendant": isOpen && highlightedIndex >= 0 ? getOptionId2(highlightedIndex) : void 0
|
|
12981
13488
|
}
|
|
12982
13489
|
),
|
|
12983
|
-
/* @__PURE__ */ (0,
|
|
12984
|
-
loading && /* @__PURE__ */ (0,
|
|
12985
|
-
hasValue && !readOnly && /* @__PURE__ */ (0,
|
|
13490
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsxs)("span", { className: "ml-auto flex items-center gap-2 pl-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
13491
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
13492
|
+
hasValue && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
12986
13493
|
"button",
|
|
12987
13494
|
{
|
|
12988
13495
|
type: "button",
|
|
@@ -12992,10 +13499,10 @@ function DashboardMultiSelectInternal({
|
|
|
12992
13499
|
},
|
|
12993
13500
|
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]",
|
|
12994
13501
|
"aria-label": t("clear_all"),
|
|
12995
|
-
children: /* @__PURE__ */ (0,
|
|
13502
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(import_lucide_react45.SquareX, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
12996
13503
|
}
|
|
12997
13504
|
),
|
|
12998
|
-
/* @__PURE__ */ (0,
|
|
13505
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
12999
13506
|
RotateArrow,
|
|
13000
13507
|
{
|
|
13001
13508
|
shouldRotate: isOpen,
|
|
@@ -13008,7 +13515,7 @@ function DashboardMultiSelectInternal({
|
|
|
13008
13515
|
]
|
|
13009
13516
|
}
|
|
13010
13517
|
),
|
|
13011
|
-
/* @__PURE__ */ (0,
|
|
13518
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
13012
13519
|
Fieldset,
|
|
13013
13520
|
{
|
|
13014
13521
|
isFocused: isFocused || isOpen,
|
|
@@ -13026,11 +13533,11 @@ function DashboardMultiSelectInternal({
|
|
|
13026
13533
|
onClick: handleContainerClick
|
|
13027
13534
|
}
|
|
13028
13535
|
),
|
|
13029
|
-
/* @__PURE__ */ (0,
|
|
13536
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(
|
|
13030
13537
|
SelectMenuPanel,
|
|
13031
13538
|
{
|
|
13032
13539
|
isOpen,
|
|
13033
|
-
isMobile:
|
|
13540
|
+
isMobile: isMobile3,
|
|
13034
13541
|
onClose: () => {
|
|
13035
13542
|
closeMenu();
|
|
13036
13543
|
setIsFocused(false);
|
|
@@ -13039,7 +13546,7 @@ function DashboardMultiSelectInternal({
|
|
|
13039
13546
|
className: dropdownClassName,
|
|
13040
13547
|
drawerClassName,
|
|
13041
13548
|
children: [
|
|
13042
|
-
|
|
13549
|
+
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)(
|
|
13043
13550
|
"input",
|
|
13044
13551
|
{
|
|
13045
13552
|
ref: mobileSearchInputRef,
|
|
@@ -13054,7 +13561,7 @@ function DashboardMultiSelectInternal({
|
|
|
13054
13561
|
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)]"
|
|
13055
13562
|
}
|
|
13056
13563
|
) }),
|
|
13057
|
-
/* @__PURE__ */ (0,
|
|
13564
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
13058
13565
|
SelectMenu,
|
|
13059
13566
|
{
|
|
13060
13567
|
id: listboxId,
|
|
@@ -13076,7 +13583,7 @@ function DashboardMultiSelectInternal({
|
|
|
13076
13583
|
isMulti: true
|
|
13077
13584
|
}
|
|
13078
13585
|
),
|
|
13079
|
-
canCreateNewOption && /* @__PURE__ */ (0,
|
|
13586
|
+
canCreateNewOption && /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
13080
13587
|
"button",
|
|
13081
13588
|
{
|
|
13082
13589
|
type: "button",
|
|
@@ -13098,20 +13605,20 @@ var DashboardMultiSelect = React49.forwardRef(
|
|
|
13098
13605
|
|
|
13099
13606
|
// src/dashboard/creatable-multi-select/CreatableMultiSelect.tsx
|
|
13100
13607
|
var React50 = __toESM(require("react"), 1);
|
|
13101
|
-
var
|
|
13608
|
+
var import_jsx_runtime155 = require("react/jsx-runtime");
|
|
13102
13609
|
var DashboardCreatableMultiSelect = React50.forwardRef(
|
|
13103
13610
|
function DashboardCreatableMultiSelect2(props, ref) {
|
|
13104
|
-
return /* @__PURE__ */ (0,
|
|
13611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(DashboardMultiSelect, { ref, ...props, isCreatable: true });
|
|
13105
13612
|
}
|
|
13106
13613
|
);
|
|
13107
13614
|
|
|
13108
13615
|
// src/dashboard/infinite-scroll-select/InfiniteScrollSelect.tsx
|
|
13109
13616
|
var React51 = __toESM(require("react"), 1);
|
|
13110
13617
|
var import_react_virtual2 = require("@tanstack/react-virtual");
|
|
13111
|
-
var
|
|
13618
|
+
var import_react_i18next33 = require("react-i18next");
|
|
13112
13619
|
|
|
13113
13620
|
// src/dashboard/infinite-scroll-select/InfiniteScrollList.tsx
|
|
13114
|
-
var
|
|
13621
|
+
var import_jsx_runtime156 = require("react/jsx-runtime");
|
|
13115
13622
|
function InfiniteScrollList({
|
|
13116
13623
|
scrollRef,
|
|
13117
13624
|
listboxId,
|
|
@@ -13132,13 +13639,13 @@ function InfiniteScrollList({
|
|
|
13132
13639
|
onHighlight
|
|
13133
13640
|
}) {
|
|
13134
13641
|
const virtualItems = virtualizer.getVirtualItems();
|
|
13135
|
-
return /* @__PURE__ */ (0,
|
|
13642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
|
|
13136
13643
|
"div",
|
|
13137
13644
|
{
|
|
13138
13645
|
ref: scrollRef,
|
|
13139
13646
|
className: cn("overflow-y-auto", menuClassName),
|
|
13140
13647
|
style: { height: `${height}px` },
|
|
13141
|
-
children: /* @__PURE__ */ (0,
|
|
13648
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
|
|
13142
13649
|
"div",
|
|
13143
13650
|
{
|
|
13144
13651
|
id: listboxId,
|
|
@@ -13155,7 +13662,7 @@ function InfiniteScrollList({
|
|
|
13155
13662
|
const isSelected = !isLoaderRow && option ? option.value === value?.value : false;
|
|
13156
13663
|
const isHighlighted = virtualItem.index === highlightedIndex;
|
|
13157
13664
|
const isOptionDisabled = Boolean(isBlocked || option?.isDisabled);
|
|
13158
|
-
return /* @__PURE__ */ (0,
|
|
13665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
|
|
13159
13666
|
"div",
|
|
13160
13667
|
{
|
|
13161
13668
|
"data-index": virtualItem.index,
|
|
@@ -13164,10 +13671,10 @@ function InfiniteScrollList({
|
|
|
13164
13671
|
height: `${virtualItem.size}px`,
|
|
13165
13672
|
transform: `translateY(${virtualItem.start}px)`
|
|
13166
13673
|
},
|
|
13167
|
-
children: isLoaderRow ? /* @__PURE__ */ (0,
|
|
13168
|
-
/* @__PURE__ */ (0,
|
|
13169
|
-
/* @__PURE__ */ (0,
|
|
13170
|
-
] }) : /* @__PURE__ */ (0,
|
|
13674
|
+
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: [
|
|
13675
|
+
/* @__PURE__ */ (0, import_jsx_runtime156.jsx)(ThreeDotsLoader, { height: 36, width: 36 }),
|
|
13676
|
+
/* @__PURE__ */ (0, import_jsx_runtime156.jsx)("span", { children: loadingMoreText })
|
|
13677
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)(
|
|
13171
13678
|
"button",
|
|
13172
13679
|
{
|
|
13173
13680
|
id: getOptionId2(virtualItem.index),
|
|
@@ -13186,8 +13693,8 @@ function InfiniteScrollList({
|
|
|
13186
13693
|
isOptionDisabled && "cursor-default opacity-30"
|
|
13187
13694
|
),
|
|
13188
13695
|
children: [
|
|
13189
|
-
/* @__PURE__ */ (0,
|
|
13190
|
-
option?.description && /* @__PURE__ */ (0,
|
|
13696
|
+
/* @__PURE__ */ (0, import_jsx_runtime156.jsx)("span", { className: "block break-words", children: option?.label }),
|
|
13697
|
+
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 })
|
|
13191
13698
|
]
|
|
13192
13699
|
}
|
|
13193
13700
|
)
|
|
@@ -13202,7 +13709,7 @@ function InfiniteScrollList({
|
|
|
13202
13709
|
}
|
|
13203
13710
|
|
|
13204
13711
|
// src/dashboard/infinite-scroll-select/InfiniteScrollSelect.tsx
|
|
13205
|
-
var
|
|
13712
|
+
var import_jsx_runtime157 = require("react/jsx-runtime");
|
|
13206
13713
|
var DEFAULT_ITEM_HEIGHT = 60;
|
|
13207
13714
|
var DEFAULT_LIST_HEIGHT = 322;
|
|
13208
13715
|
var DEFAULT_OVERSCAN = 5;
|
|
@@ -13250,8 +13757,8 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13250
13757
|
const previousHighlightedIndexRef = React51.useRef(-1);
|
|
13251
13758
|
const lastLoadMoreOptionsLengthRef = React51.useRef(null);
|
|
13252
13759
|
const [highlightedIndex, setHighlightedIndex] = React51.useState(-1);
|
|
13253
|
-
const
|
|
13254
|
-
const { t } = (0,
|
|
13760
|
+
const isMobile3 = useIsMobile();
|
|
13761
|
+
const { t } = (0, import_react_i18next33.useTranslation)();
|
|
13255
13762
|
const resolvedSearchPlaceholder = searchPlaceholder ?? t("search_placeholder");
|
|
13256
13763
|
const resolvedLoadingMoreText = loadingMoreText ?? t("loading_more");
|
|
13257
13764
|
const hasValue = Boolean(value);
|
|
@@ -13262,7 +13769,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13262
13769
|
const valueLabel = value ? getValueLabel?.(value) ?? String(value.label) : void 0;
|
|
13263
13770
|
const { containerRef, isOpen, closeMenu, toggleMenu, setIsOpen } = useSelectMenuState({
|
|
13264
13771
|
isBlocked,
|
|
13265
|
-
isMobile:
|
|
13772
|
+
isMobile: isMobile3
|
|
13266
13773
|
});
|
|
13267
13774
|
const { triggerId, labelId, valueId, listboxId, describedErrorId, errorId, getOptionId: getOptionId2 } = useSelectIds({ name, hasValue, error, hideErrorMessage });
|
|
13268
13775
|
const { searchValue, setSearchValue, filteredOptions } = useSelectSearch({
|
|
@@ -13375,7 +13882,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13375
13882
|
const totalSize = virtualizer.getTotalSize();
|
|
13376
13883
|
const measuredListHeight = Math.min(listHeight, Math.max(totalSize, itemHeight));
|
|
13377
13884
|
const activeOptionId = highlightedIndex >= 0 ? getOptionId2(highlightedIndex) : void 0;
|
|
13378
|
-
return /* @__PURE__ */ (0,
|
|
13885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)(
|
|
13379
13886
|
SelectFieldShell,
|
|
13380
13887
|
{
|
|
13381
13888
|
containerRef,
|
|
@@ -13393,7 +13900,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13393
13900
|
name,
|
|
13394
13901
|
hiddenValue: value ? String(value.value) : "",
|
|
13395
13902
|
children: [
|
|
13396
|
-
/* @__PURE__ */ (0,
|
|
13903
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
13397
13904
|
SelectTrigger,
|
|
13398
13905
|
{
|
|
13399
13906
|
triggerRef,
|
|
@@ -13415,7 +13922,7 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13415
13922
|
onBlur
|
|
13416
13923
|
}
|
|
13417
13924
|
),
|
|
13418
|
-
/* @__PURE__ */ (0,
|
|
13925
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
13419
13926
|
Fieldset,
|
|
13420
13927
|
{
|
|
13421
13928
|
isFocused: isOpen,
|
|
@@ -13432,17 +13939,17 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13432
13939
|
onClick: !isBlocked ? toggleMenu : void 0
|
|
13433
13940
|
}
|
|
13434
13941
|
),
|
|
13435
|
-
/* @__PURE__ */ (0,
|
|
13942
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsxs)(
|
|
13436
13943
|
SelectMenuPanel,
|
|
13437
13944
|
{
|
|
13438
13945
|
isOpen,
|
|
13439
|
-
isMobile:
|
|
13946
|
+
isMobile: isMobile3,
|
|
13440
13947
|
onClose: closeMenu,
|
|
13441
13948
|
title: typeof label === "string" ? label : void 0,
|
|
13442
13949
|
className: dropdownClassName,
|
|
13443
13950
|
drawerClassName,
|
|
13444
13951
|
children: [
|
|
13445
|
-
searchable && /* @__PURE__ */ (0,
|
|
13952
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
13446
13953
|
SelectSearchInput,
|
|
13447
13954
|
{
|
|
13448
13955
|
inputRef: searchInputRef,
|
|
@@ -13454,10 +13961,10 @@ function DashboardInfiniteScrollSelectInternal({
|
|
|
13454
13961
|
onKeyDown: handleSearchKeyDown
|
|
13455
13962
|
}
|
|
13456
13963
|
),
|
|
13457
|
-
filteredOptions.length === 0 && isLoadingMore ? /* @__PURE__ */ (0,
|
|
13458
|
-
/* @__PURE__ */ (0,
|
|
13459
|
-
/* @__PURE__ */ (0,
|
|
13460
|
-
] }) : filteredOptions.length === 0 ? /* @__PURE__ */ (0,
|
|
13964
|
+
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: [
|
|
13965
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
13966
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)("span", { children: resolvedLoadingMoreText })
|
|
13967
|
+
] }) : 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)(
|
|
13461
13968
|
InfiniteScrollList,
|
|
13462
13969
|
{
|
|
13463
13970
|
scrollRef,
|
|
@@ -13492,8 +13999,8 @@ var DashboardInfiniteScrollSelect = React51.forwardRef(
|
|
|
13492
13999
|
|
|
13493
14000
|
// src/dashboard/textarea/Textarea.tsx
|
|
13494
14001
|
var React52 = __toESM(require("react"), 1);
|
|
13495
|
-
var
|
|
13496
|
-
var
|
|
14002
|
+
var import_react_i18next34 = require("react-i18next");
|
|
14003
|
+
var import_jsx_runtime158 = require("react/jsx-runtime");
|
|
13497
14004
|
var LINE_HEIGHT = 20;
|
|
13498
14005
|
var VERTICAL_PADDING = 32;
|
|
13499
14006
|
function getEmptyState(empty, value, defaultValue) {
|
|
@@ -13529,7 +14036,7 @@ var DashboardTextarea = React52.forwardRef(
|
|
|
13529
14036
|
const combinedRef = useCombinedRef(ref, innerRef);
|
|
13530
14037
|
const reactId = React52.useId();
|
|
13531
14038
|
const textareaId = id ?? name ?? `dash-textarea-${reactId}`;
|
|
13532
|
-
const { t } = (0,
|
|
14039
|
+
const { t } = (0, import_react_i18next34.useTranslation)();
|
|
13533
14040
|
const isInvalid = Boolean(invalid || error);
|
|
13534
14041
|
const isEmpty = getEmptyState(empty, value, defaultValue);
|
|
13535
14042
|
const isBlocked = Boolean(disabled);
|
|
@@ -13550,7 +14057,7 @@ var DashboardTextarea = React52.forwardRef(
|
|
|
13550
14057
|
resize();
|
|
13551
14058
|
onInput?.(event);
|
|
13552
14059
|
};
|
|
13553
|
-
return /* @__PURE__ */ (0,
|
|
14060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
|
|
13554
14061
|
"div",
|
|
13555
14062
|
{
|
|
13556
14063
|
className: cn(
|
|
@@ -13560,18 +14067,18 @@ var DashboardTextarea = React52.forwardRef(
|
|
|
13560
14067
|
className
|
|
13561
14068
|
),
|
|
13562
14069
|
children: [
|
|
13563
|
-
label && /* @__PURE__ */ (0,
|
|
14070
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
|
|
13564
14071
|
"label",
|
|
13565
14072
|
{
|
|
13566
14073
|
htmlFor: textareaId,
|
|
13567
14074
|
className: "mb-2 flex select-none items-center text-[16px] font-medium text-[var(--chekin-color-brand-navy)]",
|
|
13568
14075
|
children: [
|
|
13569
14076
|
label,
|
|
13570
|
-
tooltip && /* @__PURE__ */ (0,
|
|
14077
|
+
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 }) })
|
|
13571
14078
|
]
|
|
13572
14079
|
}
|
|
13573
14080
|
),
|
|
13574
|
-
/* @__PURE__ */ (0,
|
|
14081
|
+
/* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
13575
14082
|
"textarea",
|
|
13576
14083
|
{
|
|
13577
14084
|
ref: combinedRef,
|
|
@@ -13600,7 +14107,7 @@ var DashboardTextarea = React52.forwardRef(
|
|
|
13600
14107
|
...textareaProps
|
|
13601
14108
|
}
|
|
13602
14109
|
),
|
|
13603
|
-
error && /* @__PURE__ */ (0,
|
|
14110
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
|
|
13604
14111
|
FieldErrorMessage,
|
|
13605
14112
|
{
|
|
13606
14113
|
id: `${textareaId}-error`,
|
|
@@ -13608,8 +14115,8 @@ var DashboardTextarea = React52.forwardRef(
|
|
|
13608
14115
|
className: "mt-[1px] text-[14px]"
|
|
13609
14116
|
}
|
|
13610
14117
|
),
|
|
13611
|
-
!error && optional && /* @__PURE__ */ (0,
|
|
13612
|
-
!error && helperText && /* @__PURE__ */ (0,
|
|
14118
|
+
!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") }),
|
|
14119
|
+
!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 })
|
|
13613
14120
|
]
|
|
13614
14121
|
}
|
|
13615
14122
|
);
|
|
@@ -13618,8 +14125,8 @@ var DashboardTextarea = React52.forwardRef(
|
|
|
13618
14125
|
|
|
13619
14126
|
// src/dashboard/datepicker/Datepicker.tsx
|
|
13620
14127
|
var React54 = __toESM(require("react"), 1);
|
|
13621
|
-
var
|
|
13622
|
-
var
|
|
14128
|
+
var import_lucide_react46 = require("lucide-react");
|
|
14129
|
+
var import_react_i18next35 = require("react-i18next");
|
|
13623
14130
|
|
|
13624
14131
|
// src/airbnb-fields/datepicker/useDatePickerWheel.ts
|
|
13625
14132
|
var React53 = __toESM(require("react"), 1);
|
|
@@ -14043,7 +14550,7 @@ function useDatePickerWheel({
|
|
|
14043
14550
|
}
|
|
14044
14551
|
|
|
14045
14552
|
// src/airbnb-fields/datepicker/DatePickerWheelColumn.tsx
|
|
14046
|
-
var
|
|
14553
|
+
var import_jsx_runtime159 = require("react/jsx-runtime");
|
|
14047
14554
|
var spacerHeight = DATE_PICKER_OPTION_HEIGHT * DATE_PICKER_WHEEL_BUFFER_OPTIONS;
|
|
14048
14555
|
function AirbnbDatePickerWheelColumn({
|
|
14049
14556
|
id,
|
|
@@ -14057,7 +14564,7 @@ function AirbnbDatePickerWheelColumn({
|
|
|
14057
14564
|
onOptionSelect,
|
|
14058
14565
|
column
|
|
14059
14566
|
}) {
|
|
14060
|
-
return /* @__PURE__ */ (0,
|
|
14567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { className: "relative z-10 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)(
|
|
14061
14568
|
"div",
|
|
14062
14569
|
{
|
|
14063
14570
|
id,
|
|
@@ -14074,14 +14581,14 @@ function AirbnbDatePickerWheelColumn({
|
|
|
14074
14581
|
WebkitOverflowScrolling: "touch"
|
|
14075
14582
|
},
|
|
14076
14583
|
children: [
|
|
14077
|
-
/* @__PURE__ */ (0,
|
|
14584
|
+
/* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { style: { height: `${spacerHeight}px` } }),
|
|
14078
14585
|
items.map((item, index) => {
|
|
14079
14586
|
const { style } = getWheelOptionStyles(
|
|
14080
14587
|
index,
|
|
14081
14588
|
scrollTop,
|
|
14082
14589
|
DATE_PICKER_OPTION_HEIGHT
|
|
14083
14590
|
);
|
|
14084
|
-
return /* @__PURE__ */ (0,
|
|
14591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
|
|
14085
14592
|
"button",
|
|
14086
14593
|
{
|
|
14087
14594
|
id: `${id}-option-${index}`,
|
|
@@ -14097,14 +14604,14 @@ function AirbnbDatePickerWheelColumn({
|
|
|
14097
14604
|
`${column}-${item}-${index}`
|
|
14098
14605
|
);
|
|
14099
14606
|
}),
|
|
14100
|
-
/* @__PURE__ */ (0,
|
|
14607
|
+
/* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { style: { height: `${spacerHeight}px` } })
|
|
14101
14608
|
]
|
|
14102
14609
|
}
|
|
14103
14610
|
) });
|
|
14104
14611
|
}
|
|
14105
14612
|
|
|
14106
14613
|
// src/airbnb-fields/datepicker/DatePickerContent.tsx
|
|
14107
|
-
var
|
|
14614
|
+
var import_jsx_runtime160 = require("react/jsx-runtime");
|
|
14108
14615
|
function AirbnbDatePickerBody({
|
|
14109
14616
|
baseId,
|
|
14110
14617
|
label,
|
|
@@ -14126,19 +14633,19 @@ function AirbnbDatePickerBody({
|
|
|
14126
14633
|
onOptionSelect,
|
|
14127
14634
|
onDone
|
|
14128
14635
|
}) {
|
|
14129
|
-
return /* @__PURE__ */ (0,
|
|
14130
|
-
/* @__PURE__ */ (0,
|
|
14131
|
-
/* @__PURE__ */ (0,
|
|
14132
|
-
/* @__PURE__ */ (0,
|
|
14133
|
-
/* @__PURE__ */ (0,
|
|
14636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("div", { className: "px-6 pb-4 pt-1 bg-white", children: [
|
|
14637
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("div", { className: "relative overflow-hidden rounded-[24px]", children: [
|
|
14638
|
+
/* @__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" }),
|
|
14639
|
+
/* @__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" }),
|
|
14640
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
|
|
14134
14641
|
"div",
|
|
14135
14642
|
{
|
|
14136
14643
|
"aria-hidden": true,
|
|
14137
14644
|
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]"
|
|
14138
14645
|
}
|
|
14139
14646
|
),
|
|
14140
|
-
/* @__PURE__ */ (0,
|
|
14141
|
-
/* @__PURE__ */ (0,
|
|
14647
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("div", { className: "relative grid grid-cols-[1.35fr_0.7fr_1fr] gap-1", children: [
|
|
14648
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
|
|
14142
14649
|
AirbnbDatePickerWheelColumn,
|
|
14143
14650
|
{
|
|
14144
14651
|
id: `${baseId}-month`,
|
|
@@ -14153,7 +14660,7 @@ function AirbnbDatePickerBody({
|
|
|
14153
14660
|
onOptionSelect
|
|
14154
14661
|
}
|
|
14155
14662
|
),
|
|
14156
|
-
/* @__PURE__ */ (0,
|
|
14663
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
|
|
14157
14664
|
AirbnbDatePickerWheelColumn,
|
|
14158
14665
|
{
|
|
14159
14666
|
id: `${baseId}-day`,
|
|
@@ -14168,7 +14675,7 @@ function AirbnbDatePickerBody({
|
|
|
14168
14675
|
onOptionSelect
|
|
14169
14676
|
}
|
|
14170
14677
|
),
|
|
14171
|
-
/* @__PURE__ */ (0,
|
|
14678
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
|
|
14172
14679
|
AirbnbDatePickerWheelColumn,
|
|
14173
14680
|
{
|
|
14174
14681
|
id: `${baseId}-year`,
|
|
@@ -14185,13 +14692,13 @@ function AirbnbDatePickerBody({
|
|
|
14185
14692
|
)
|
|
14186
14693
|
] })
|
|
14187
14694
|
] }),
|
|
14188
|
-
/* @__PURE__ */ (0,
|
|
14695
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
14189
14696
|
] });
|
|
14190
14697
|
}
|
|
14191
14698
|
function AirbnbDatePickerContent({
|
|
14192
14699
|
baseId,
|
|
14193
14700
|
open,
|
|
14194
|
-
isMobile:
|
|
14701
|
+
isMobile: isMobile3,
|
|
14195
14702
|
label,
|
|
14196
14703
|
title,
|
|
14197
14704
|
doneLabel,
|
|
@@ -14213,7 +14720,7 @@ function AirbnbDatePickerContent({
|
|
|
14213
14720
|
onColumnKeyDown,
|
|
14214
14721
|
onOptionSelect
|
|
14215
14722
|
}) {
|
|
14216
|
-
const body = /* @__PURE__ */ (0,
|
|
14723
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
|
|
14217
14724
|
AirbnbDatePickerBody,
|
|
14218
14725
|
{
|
|
14219
14726
|
baseId,
|
|
@@ -14237,28 +14744,28 @@ function AirbnbDatePickerContent({
|
|
|
14237
14744
|
onDone
|
|
14238
14745
|
}
|
|
14239
14746
|
);
|
|
14240
|
-
if (
|
|
14241
|
-
return /* @__PURE__ */ (0,
|
|
14747
|
+
if (isMobile3) {
|
|
14748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Drawer, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(
|
|
14242
14749
|
DrawerContent,
|
|
14243
14750
|
{
|
|
14244
14751
|
onClose: () => onOpenChange(false),
|
|
14245
14752
|
className: "rounded-none rounded-t-[32px] border-0 p-0",
|
|
14246
14753
|
children: [
|
|
14247
|
-
/* @__PURE__ */ (0,
|
|
14248
|
-
/* @__PURE__ */ (0,
|
|
14754
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(DrawerTitle, { className: "sr-only", children: title }),
|
|
14755
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(DrawerDescription, { className: "sr-only", children: label }),
|
|
14249
14756
|
body
|
|
14250
14757
|
]
|
|
14251
14758
|
}
|
|
14252
14759
|
) });
|
|
14253
14760
|
}
|
|
14254
|
-
return /* @__PURE__ */ (0,
|
|
14761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(
|
|
14255
14762
|
DialogContent,
|
|
14256
14763
|
{
|
|
14257
14764
|
className: "max-w-[520px] rounded-[28px] border-0 p-0 shadow-xl",
|
|
14258
14765
|
showCloseButton: false,
|
|
14259
14766
|
children: [
|
|
14260
|
-
/* @__PURE__ */ (0,
|
|
14261
|
-
/* @__PURE__ */ (0,
|
|
14767
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(DialogTitle, { className: "sr-only", children: title }),
|
|
14768
|
+
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(DialogDescription, { className: "sr-only", children: label }),
|
|
14262
14769
|
body
|
|
14263
14770
|
]
|
|
14264
14771
|
}
|
|
@@ -14266,7 +14773,7 @@ function AirbnbDatePickerContent({
|
|
|
14266
14773
|
}
|
|
14267
14774
|
|
|
14268
14775
|
// src/dashboard/datepicker/Datepicker.tsx
|
|
14269
|
-
var
|
|
14776
|
+
var import_jsx_runtime161 = require("react/jsx-runtime");
|
|
14270
14777
|
var MONTHS_IN_YEAR2 = 12;
|
|
14271
14778
|
function getMonthLabels2(locale) {
|
|
14272
14779
|
const formatter = new Intl.DateTimeFormat(locale, { month: "long" });
|
|
@@ -14343,7 +14850,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14343
14850
|
const yearId = `${baseId}-year`;
|
|
14344
14851
|
const labelId = `${baseId}-label`;
|
|
14345
14852
|
const errorId = `${baseId}-error`;
|
|
14346
|
-
const { t } = (0,
|
|
14853
|
+
const { t } = (0, import_react_i18next35.useTranslation)();
|
|
14347
14854
|
const resolvedMonthLabels = React54.useMemo(
|
|
14348
14855
|
() => monthLabels ?? getMonthLabels2(locale),
|
|
14349
14856
|
[locale, monthLabels]
|
|
@@ -14366,7 +14873,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14366
14873
|
const [focusedField, setFocusedField] = React54.useState(null);
|
|
14367
14874
|
const [monthInputValue, setMonthInputValue] = React54.useState("");
|
|
14368
14875
|
const [monthHighlightIndex, setMonthHighlightIndex] = React54.useState(-1);
|
|
14369
|
-
const
|
|
14876
|
+
const isMobile3 = useIsMobile();
|
|
14370
14877
|
React54.useImperativeHandle(ref, () => dayInputRef.current, []);
|
|
14371
14878
|
React54.useEffect(() => {
|
|
14372
14879
|
if (!isControlled) return;
|
|
@@ -14416,7 +14923,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14416
14923
|
useOutsideClick({
|
|
14417
14924
|
elementRef: containerRef,
|
|
14418
14925
|
onOutsideClick: () => setIsMonthOpen(false),
|
|
14419
|
-
isDisabled: !isMonthOpen ||
|
|
14926
|
+
isDisabled: !isMonthOpen || isMobile3
|
|
14420
14927
|
});
|
|
14421
14928
|
const emitChange = React54.useCallback(
|
|
14422
14929
|
(nextDay, nextMonth, nextYear) => {
|
|
@@ -14525,7 +15032,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14525
15032
|
setIsWheelOpen(false);
|
|
14526
15033
|
mobileTriggerRef.current?.focus();
|
|
14527
15034
|
}, []);
|
|
14528
|
-
const showCoverage = isEmpty && !isFocused && !
|
|
15035
|
+
const showCoverage = isEmpty && !isFocused && !isMobile3;
|
|
14529
15036
|
const wheel = useDatePickerWheel({
|
|
14530
15037
|
isOpen: isWheelOpen,
|
|
14531
15038
|
value: currentDate,
|
|
@@ -14549,7 +15056,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14549
15056
|
const triggerText = currentDate ? (formatValue ?? defaultFormatValue)(currentDate) : void 0;
|
|
14550
15057
|
const monthListboxId = `${monthId}-listbox`;
|
|
14551
15058
|
const getMonthOptionId = (index) => `${monthId}-option-${index}`;
|
|
14552
|
-
const monthPanelContent = filteredMonths.length === 0 ? /* @__PURE__ */ (0,
|
|
15059
|
+
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)(
|
|
14553
15060
|
"ul",
|
|
14554
15061
|
{
|
|
14555
15062
|
ref: monthListRef,
|
|
@@ -14560,7 +15067,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14560
15067
|
children: filteredMonths.map((option, position) => {
|
|
14561
15068
|
const isSelected = option.index === monthIndex;
|
|
14562
15069
|
const isHighlighted = position === monthHighlightIndex;
|
|
14563
|
-
return /* @__PURE__ */ (0,
|
|
15070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime161.jsx)("li", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14564
15071
|
"button",
|
|
14565
15072
|
{
|
|
14566
15073
|
id: getMonthOptionId(option.index),
|
|
@@ -14587,7 +15094,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14587
15094
|
isBlocked && "cursor-not-allowed",
|
|
14588
15095
|
loading && "cursor-progress"
|
|
14589
15096
|
);
|
|
14590
|
-
return /* @__PURE__ */ (0,
|
|
15097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14591
15098
|
"div",
|
|
14592
15099
|
{
|
|
14593
15100
|
ref: containerRef,
|
|
@@ -14598,9 +15105,9 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14598
15105
|
className
|
|
14599
15106
|
),
|
|
14600
15107
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
14601
|
-
children: /* @__PURE__ */ (0,
|
|
14602
|
-
/* @__PURE__ */ (0,
|
|
14603
|
-
|
|
15108
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("div", { className: "relative min-h-[68px] w-full", children: [
|
|
15109
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("div", { className: "relative w-full", children: [
|
|
15110
|
+
isMobile3 ? /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)(
|
|
14604
15111
|
"button",
|
|
14605
15112
|
{
|
|
14606
15113
|
ref: mobileTriggerRef,
|
|
@@ -14619,11 +15126,11 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14619
15126
|
(isBlocked || readOnly) && "cursor-not-allowed"
|
|
14620
15127
|
),
|
|
14621
15128
|
children: [
|
|
14622
|
-
/* @__PURE__ */ (0,
|
|
14623
|
-
/* @__PURE__ */ (0,
|
|
14624
|
-
loading && /* @__PURE__ */ (0,
|
|
14625
|
-
/* @__PURE__ */ (0,
|
|
14626
|
-
|
|
15129
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)("span", { className: "block min-w-0 flex-1 truncate text-left", children: triggerText ?? (isWheelOpen ? mobilePlaceholder : null) }),
|
|
15130
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("span", { className: "pointer-events-none flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
15131
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
15132
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
15133
|
+
import_lucide_react46.ChevronDown,
|
|
14627
15134
|
{
|
|
14628
15135
|
size: 16,
|
|
14629
15136
|
className: cn(
|
|
@@ -14635,14 +15142,14 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14635
15142
|
] })
|
|
14636
15143
|
]
|
|
14637
15144
|
}
|
|
14638
|
-
) : /* @__PURE__ */ (0,
|
|
15145
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime161.jsxs)(
|
|
14639
15146
|
"div",
|
|
14640
15147
|
{
|
|
14641
15148
|
className: cn(
|
|
14642
15149
|
"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)]"
|
|
14643
15150
|
),
|
|
14644
15151
|
children: [
|
|
14645
|
-
/* @__PURE__ */ (0,
|
|
15152
|
+
/* @__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)(
|
|
14646
15153
|
"input",
|
|
14647
15154
|
{
|
|
14648
15155
|
ref: dayInputRef,
|
|
@@ -14664,8 +15171,8 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14664
15171
|
className: subInputClass
|
|
14665
15172
|
}
|
|
14666
15173
|
) }),
|
|
14667
|
-
/* @__PURE__ */ (0,
|
|
14668
|
-
/* @__PURE__ */ (0,
|
|
15174
|
+
/* @__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: [
|
|
15175
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14669
15176
|
"input",
|
|
14670
15177
|
{
|
|
14671
15178
|
ref: monthInputRef,
|
|
@@ -14708,8 +15215,8 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14708
15215
|
)
|
|
14709
15216
|
}
|
|
14710
15217
|
),
|
|
14711
|
-
/* @__PURE__ */ (0,
|
|
14712
|
-
|
|
15218
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
15219
|
+
import_lucide_react46.ChevronDown,
|
|
14713
15220
|
{
|
|
14714
15221
|
size: 14,
|
|
14715
15222
|
onMouseDown: (event) => {
|
|
@@ -14725,8 +15232,8 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14725
15232
|
}
|
|
14726
15233
|
)
|
|
14727
15234
|
] }),
|
|
14728
|
-
/* @__PURE__ */ (0,
|
|
14729
|
-
/* @__PURE__ */ (0,
|
|
15235
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsxs)("div", { className: "flex h-full min-w-0 items-center px-2 sm:px-4", children: [
|
|
15236
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14730
15237
|
"input",
|
|
14731
15238
|
{
|
|
14732
15239
|
ref: yearInputRef,
|
|
@@ -14748,7 +15255,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14748
15255
|
className: subInputClass
|
|
14749
15256
|
}
|
|
14750
15257
|
),
|
|
14751
|
-
loading && /* @__PURE__ */ (0,
|
|
15258
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14752
15259
|
ThreeDotsLoader,
|
|
14753
15260
|
{
|
|
14754
15261
|
height: 18,
|
|
@@ -14760,7 +15267,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14760
15267
|
]
|
|
14761
15268
|
}
|
|
14762
15269
|
),
|
|
14763
|
-
showCoverage && /* @__PURE__ */ (0,
|
|
15270
|
+
showCoverage && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14764
15271
|
"div",
|
|
14765
15272
|
{
|
|
14766
15273
|
className: "absolute inset-0 cursor-text rounded-[6px] bg-[var(--chekin-color-surface-input-empty)]",
|
|
@@ -14768,7 +15275,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14768
15275
|
"aria-hidden": "true"
|
|
14769
15276
|
}
|
|
14770
15277
|
),
|
|
14771
|
-
/* @__PURE__ */ (0,
|
|
15278
|
+
/* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14772
15279
|
Fieldset,
|
|
14773
15280
|
{
|
|
14774
15281
|
isFocused,
|
|
@@ -14783,12 +15290,12 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14783
15290
|
legend: label,
|
|
14784
15291
|
label,
|
|
14785
15292
|
tooltip,
|
|
14786
|
-
onClick:
|
|
15293
|
+
onClick: isMobile3 ? openWheel : showCoverage ? focusDayInput : void 0
|
|
14787
15294
|
}
|
|
14788
15295
|
),
|
|
14789
|
-
isMonthOpen && !
|
|
15296
|
+
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 })
|
|
14790
15297
|
] }),
|
|
14791
|
-
|
|
15298
|
+
isMobile3 && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14792
15299
|
AirbnbDatePickerContent,
|
|
14793
15300
|
{
|
|
14794
15301
|
baseId: wheelBaseId,
|
|
@@ -14816,9 +15323,9 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14816
15323
|
onOptionSelect: wheel.handleOptionSelect
|
|
14817
15324
|
}
|
|
14818
15325
|
),
|
|
14819
|
-
!error && optional && /* @__PURE__ */ (0,
|
|
14820
|
-
!error && helperText && /* @__PURE__ */ (0,
|
|
14821
|
-
error && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
15326
|
+
!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") }),
|
|
15327
|
+
!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 }),
|
|
15328
|
+
error && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime161.jsx)(
|
|
14822
15329
|
FieldErrorMessage,
|
|
14823
15330
|
{
|
|
14824
15331
|
id: errorId,
|
|
@@ -14834,7 +15341,7 @@ var DashboardDatepicker = React54.forwardRef(
|
|
|
14834
15341
|
|
|
14835
15342
|
// src/dashboard/date-range-picker/DateRangePicker.tsx
|
|
14836
15343
|
var React58 = __toESM(require("react"), 1);
|
|
14837
|
-
var
|
|
15344
|
+
var import_react_i18next36 = require("react-i18next");
|
|
14838
15345
|
|
|
14839
15346
|
// src/dashboard/date-range-picker/isDayBlocked.ts
|
|
14840
15347
|
var import_date_fns2 = require("date-fns");
|
|
@@ -15044,8 +15551,8 @@ function resolveRangeSelection({
|
|
|
15044
15551
|
}
|
|
15045
15552
|
|
|
15046
15553
|
// src/dashboard/date-range-picker/components/DateRangeInputs.tsx
|
|
15047
|
-
var
|
|
15048
|
-
var
|
|
15554
|
+
var import_lucide_react47 = require("lucide-react");
|
|
15555
|
+
var import_jsx_runtime162 = require("react/jsx-runtime");
|
|
15049
15556
|
var DEFAULT_PLACEHOLDER = "00-00-0000";
|
|
15050
15557
|
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)]";
|
|
15051
15558
|
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";
|
|
@@ -15087,7 +15594,7 @@ function DateRangeInputs({
|
|
|
15087
15594
|
isBlocked && "cursor-not-allowed",
|
|
15088
15595
|
loading && "cursor-progress"
|
|
15089
15596
|
);
|
|
15090
|
-
return /* @__PURE__ */ (0,
|
|
15597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)(
|
|
15091
15598
|
"div",
|
|
15092
15599
|
{
|
|
15093
15600
|
className: cn(
|
|
@@ -15096,7 +15603,7 @@ function DateRangeInputs({
|
|
|
15096
15603
|
),
|
|
15097
15604
|
onClick: onRowClick,
|
|
15098
15605
|
children: [
|
|
15099
|
-
/* @__PURE__ */ (0,
|
|
15606
|
+
/* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
15100
15607
|
"input",
|
|
15101
15608
|
{
|
|
15102
15609
|
ref: fromInputRef,
|
|
@@ -15120,7 +15627,7 @@ function DateRangeInputs({
|
|
|
15120
15627
|
)
|
|
15121
15628
|
}
|
|
15122
15629
|
),
|
|
15123
|
-
/* @__PURE__ */ (0,
|
|
15630
|
+
/* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
15124
15631
|
"span",
|
|
15125
15632
|
{
|
|
15126
15633
|
"aria-hidden": "true",
|
|
@@ -15131,7 +15638,7 @@ function DateRangeInputs({
|
|
|
15131
15638
|
children: "\u2192"
|
|
15132
15639
|
}
|
|
15133
15640
|
),
|
|
15134
|
-
/* @__PURE__ */ (0,
|
|
15641
|
+
/* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
15135
15642
|
"input",
|
|
15136
15643
|
{
|
|
15137
15644
|
ref: toInputRef,
|
|
@@ -15155,9 +15662,9 @@ function DateRangeInputs({
|
|
|
15155
15662
|
)
|
|
15156
15663
|
}
|
|
15157
15664
|
),
|
|
15158
|
-
/* @__PURE__ */ (0,
|
|
15159
|
-
loading && /* @__PURE__ */ (0,
|
|
15160
|
-
!readOnly && !hideClearDates && !isEmpty && /* @__PURE__ */ (0,
|
|
15665
|
+
/* @__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: [
|
|
15666
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
15667
|
+
!readOnly && !hideClearDates && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
15161
15668
|
"button",
|
|
15162
15669
|
{
|
|
15163
15670
|
type: "button",
|
|
@@ -15165,10 +15672,10 @@ function DateRangeInputs({
|
|
|
15165
15672
|
onClick: onReset,
|
|
15166
15673
|
className: iconButtonClass,
|
|
15167
15674
|
"aria-label": clearLabel,
|
|
15168
|
-
children: /* @__PURE__ */ (0,
|
|
15675
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(import_lucide_react47.SquareX, { size: 16, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
15169
15676
|
}
|
|
15170
15677
|
),
|
|
15171
|
-
!readOnly && !hideCalendarIcon && /* @__PURE__ */ (0,
|
|
15678
|
+
!readOnly && !hideCalendarIcon && /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
15172
15679
|
"button",
|
|
15173
15680
|
{
|
|
15174
15681
|
type: "button",
|
|
@@ -15180,7 +15687,7 @@ function DateRangeInputs({
|
|
|
15180
15687
|
focusedInput !== null || isOpen ? "text-[var(--chekin-color-brand-blue)]" : "text-[var(--chekin-color-gray-2)]"
|
|
15181
15688
|
),
|
|
15182
15689
|
"aria-label": openCalendarLabel,
|
|
15183
|
-
children: /* @__PURE__ */ (0,
|
|
15690
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(import_lucide_react47.CalendarDays, { size: 18 })
|
|
15184
15691
|
}
|
|
15185
15692
|
)
|
|
15186
15693
|
] })
|
|
@@ -15190,7 +15697,7 @@ function DateRangeInputs({
|
|
|
15190
15697
|
}
|
|
15191
15698
|
|
|
15192
15699
|
// src/dashboard/date-range-picker/components/DateRangeCalendar.tsx
|
|
15193
|
-
var
|
|
15700
|
+
var import_jsx_runtime163 = require("react/jsx-runtime");
|
|
15194
15701
|
function DateRangeCalendar({
|
|
15195
15702
|
value,
|
|
15196
15703
|
month,
|
|
@@ -15206,7 +15713,7 @@ function DateRangeCalendar({
|
|
|
15206
15713
|
components,
|
|
15207
15714
|
...dayPickerProps
|
|
15208
15715
|
}) {
|
|
15209
|
-
return /* @__PURE__ */ (0,
|
|
15716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(
|
|
15210
15717
|
Calendar,
|
|
15211
15718
|
{
|
|
15212
15719
|
mode: "range",
|
|
@@ -15229,10 +15736,10 @@ function DateRangeCalendar({
|
|
|
15229
15736
|
}
|
|
15230
15737
|
|
|
15231
15738
|
// src/dashboard/date-range-picker/components/DateRangePopover.tsx
|
|
15232
|
-
var
|
|
15739
|
+
var import_jsx_runtime164 = require("react/jsx-runtime");
|
|
15233
15740
|
function DateRangePopover({
|
|
15234
15741
|
isOpen,
|
|
15235
|
-
isMobile:
|
|
15742
|
+
isMobile: isMobile3,
|
|
15236
15743
|
openDirection,
|
|
15237
15744
|
drawerTitle,
|
|
15238
15745
|
drawerDescription,
|
|
@@ -15240,31 +15747,31 @@ function DateRangePopover({
|
|
|
15240
15747
|
children
|
|
15241
15748
|
}) {
|
|
15242
15749
|
if (!isOpen) return null;
|
|
15243
|
-
if (
|
|
15244
|
-
return /* @__PURE__ */ (0,
|
|
15750
|
+
if (isMobile3) {
|
|
15751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
|
|
15245
15752
|
Drawer,
|
|
15246
15753
|
{
|
|
15247
15754
|
open: isOpen,
|
|
15248
15755
|
onOpenChange: (next) => {
|
|
15249
15756
|
if (!next) onClose();
|
|
15250
15757
|
},
|
|
15251
|
-
children: /* @__PURE__ */ (0,
|
|
15758
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime164.jsxs)(
|
|
15252
15759
|
DrawerContent,
|
|
15253
15760
|
{
|
|
15254
15761
|
onClose,
|
|
15255
15762
|
lockScroll: false,
|
|
15256
15763
|
className: "max-h-[calc(100vh-1rem)]",
|
|
15257
15764
|
children: [
|
|
15258
|
-
/* @__PURE__ */ (0,
|
|
15259
|
-
/* @__PURE__ */ (0,
|
|
15260
|
-
/* @__PURE__ */ (0,
|
|
15765
|
+
/* @__PURE__ */ (0, import_jsx_runtime164.jsx)(DrawerTitle, { className: "sr-only", children: drawerTitle }),
|
|
15766
|
+
/* @__PURE__ */ (0, import_jsx_runtime164.jsx)(DrawerDescription, { className: "sr-only", children: drawerDescription }),
|
|
15767
|
+
/* @__PURE__ */ (0, import_jsx_runtime164.jsx)("div", { className: "flex items-start justify-center overflow-x-auto px-2 pb-4 pt-1", children })
|
|
15261
15768
|
]
|
|
15262
15769
|
}
|
|
15263
15770
|
)
|
|
15264
15771
|
}
|
|
15265
15772
|
);
|
|
15266
15773
|
}
|
|
15267
|
-
return /* @__PURE__ */ (0,
|
|
15774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(
|
|
15268
15775
|
"div",
|
|
15269
15776
|
{
|
|
15270
15777
|
className: cn(
|
|
@@ -15277,7 +15784,7 @@ function DateRangePopover({
|
|
|
15277
15784
|
}
|
|
15278
15785
|
|
|
15279
15786
|
// src/dashboard/date-range-picker/DateRangePicker.tsx
|
|
15280
|
-
var
|
|
15787
|
+
var import_jsx_runtime165 = require("react/jsx-runtime");
|
|
15281
15788
|
var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePicker2({
|
|
15282
15789
|
label,
|
|
15283
15790
|
value: externalValue,
|
|
@@ -15350,8 +15857,8 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15350
15857
|
const [isOpen, setIsOpen] = React58.useState(false);
|
|
15351
15858
|
const [focusedInput, setFocusedInput] = React58.useState(null);
|
|
15352
15859
|
const [autoFocus, setAutoFocus] = React58.useState(false);
|
|
15353
|
-
const
|
|
15354
|
-
const { t } = (0,
|
|
15860
|
+
const isMobile3 = useIsMobile();
|
|
15861
|
+
const { t } = (0, import_react_i18next36.useTranslation)();
|
|
15355
15862
|
const drawerTitle = label ?? t("select_dates");
|
|
15356
15863
|
const drawerDescription = label ?? t("pick_date_range");
|
|
15357
15864
|
const isEmpty = !value?.from && !value?.to;
|
|
@@ -15359,7 +15866,7 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15359
15866
|
const isInvalid = Boolean(invalid || error);
|
|
15360
15867
|
const isFocused = focusedInput !== null || isOpen;
|
|
15361
15868
|
const wrapperWidth = toCssSize(width);
|
|
15362
|
-
const monthsToShow = numberOfMonths ?? (
|
|
15869
|
+
const monthsToShow = numberOfMonths ?? (isMobile3 ? 1 : 2);
|
|
15363
15870
|
const closeCalendar = React58.useCallback(() => {
|
|
15364
15871
|
setIsOpen(false);
|
|
15365
15872
|
setFocusedInput(null);
|
|
@@ -15373,7 +15880,7 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15373
15880
|
useOutsideClick({
|
|
15374
15881
|
elementRef: containerRef,
|
|
15375
15882
|
onOutsideClick: closeCalendar,
|
|
15376
|
-
isDisabled: !isOpen ||
|
|
15883
|
+
isDisabled: !isOpen || isMobile3
|
|
15377
15884
|
});
|
|
15378
15885
|
const handlePickerChange = React58.useCallback(
|
|
15379
15886
|
(range, pickedDate) => {
|
|
@@ -15438,7 +15945,7 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15438
15945
|
syncMonthToValue
|
|
15439
15946
|
]
|
|
15440
15947
|
);
|
|
15441
|
-
return /* @__PURE__ */ (0,
|
|
15948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15442
15949
|
"div",
|
|
15443
15950
|
{
|
|
15444
15951
|
ref: containerRef,
|
|
@@ -15449,9 +15956,9 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15449
15956
|
className
|
|
15450
15957
|
),
|
|
15451
15958
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
15452
|
-
children: /* @__PURE__ */ (0,
|
|
15453
|
-
/* @__PURE__ */ (0,
|
|
15454
|
-
/* @__PURE__ */ (0,
|
|
15959
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)("div", { className: "relative min-h-[68px] w-full", children: [
|
|
15960
|
+
/* @__PURE__ */ (0, import_jsx_runtime165.jsxs)("div", { className: "relative w-full", children: [
|
|
15961
|
+
/* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15455
15962
|
DateRangeInputs,
|
|
15456
15963
|
{
|
|
15457
15964
|
fromId,
|
|
@@ -15502,7 +16009,7 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15502
16009
|
onToggleCalendar: toggleCalendar
|
|
15503
16010
|
}
|
|
15504
16011
|
),
|
|
15505
|
-
/* @__PURE__ */ (0,
|
|
16012
|
+
/* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15506
16013
|
Fieldset,
|
|
15507
16014
|
{
|
|
15508
16015
|
isFocused,
|
|
@@ -15519,16 +16026,16 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15519
16026
|
tooltip
|
|
15520
16027
|
}
|
|
15521
16028
|
),
|
|
15522
|
-
/* @__PURE__ */ (0,
|
|
16029
|
+
/* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15523
16030
|
DateRangePopover,
|
|
15524
16031
|
{
|
|
15525
|
-
isOpen: isOpen && !
|
|
16032
|
+
isOpen: isOpen && !isMobile3,
|
|
15526
16033
|
isMobile: false,
|
|
15527
16034
|
openDirection,
|
|
15528
16035
|
drawerTitle,
|
|
15529
16036
|
drawerDescription,
|
|
15530
16037
|
onClose: closeCalendar,
|
|
15531
|
-
children: /* @__PURE__ */ (0,
|
|
16038
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15532
16039
|
DateRangeCalendar,
|
|
15533
16040
|
{
|
|
15534
16041
|
value,
|
|
@@ -15549,16 +16056,16 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15549
16056
|
}
|
|
15550
16057
|
)
|
|
15551
16058
|
] }),
|
|
15552
|
-
/* @__PURE__ */ (0,
|
|
16059
|
+
/* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15553
16060
|
DateRangePopover,
|
|
15554
16061
|
{
|
|
15555
|
-
isOpen: isOpen &&
|
|
16062
|
+
isOpen: isOpen && isMobile3,
|
|
15556
16063
|
isMobile: true,
|
|
15557
16064
|
openDirection,
|
|
15558
16065
|
drawerTitle,
|
|
15559
16066
|
drawerDescription,
|
|
15560
16067
|
onClose: closeCalendar,
|
|
15561
|
-
children: /* @__PURE__ */ (0,
|
|
16068
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15562
16069
|
DateRangeCalendar,
|
|
15563
16070
|
{
|
|
15564
16071
|
value,
|
|
@@ -15578,9 +16085,9 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15578
16085
|
)
|
|
15579
16086
|
}
|
|
15580
16087
|
),
|
|
15581
|
-
!error && optional && /* @__PURE__ */ (0,
|
|
15582
|
-
!error && helperText && /* @__PURE__ */ (0,
|
|
15583
|
-
error && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
16088
|
+
!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") }),
|
|
16089
|
+
!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 }),
|
|
16090
|
+
error && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(
|
|
15584
16091
|
FieldErrorMessage,
|
|
15585
16092
|
{
|
|
15586
16093
|
id: errorId,
|
|
@@ -15595,7 +16102,7 @@ var DashboardDateRangePicker = React58.forwardRef(function DashboardDateRangePic
|
|
|
15595
16102
|
|
|
15596
16103
|
// src/dashboard/date-range-picker/useValidateDates.ts
|
|
15597
16104
|
var React59 = __toESM(require("react"), 1);
|
|
15598
|
-
var
|
|
16105
|
+
var import_react_i18next37 = require("react-i18next");
|
|
15599
16106
|
var import_date_fns4 = require("date-fns");
|
|
15600
16107
|
var import_react_day_picker2 = require("react-day-picker");
|
|
15601
16108
|
function isAfterMax(date, maxDate) {
|
|
@@ -15614,7 +16121,7 @@ function useValidateDates({
|
|
|
15614
16121
|
onSuccess,
|
|
15615
16122
|
displayFormat
|
|
15616
16123
|
}) {
|
|
15617
|
-
const { t } = (0,
|
|
16124
|
+
const { t } = (0, import_react_i18next37.useTranslation)();
|
|
15618
16125
|
const handleError = useEvent(onError);
|
|
15619
16126
|
const handleSuccess = useEvent(onSuccess);
|
|
15620
16127
|
const errorFormatter = React59.useMemo(
|
|
@@ -15673,7 +16180,7 @@ function useValidateDates({
|
|
|
15673
16180
|
// src/dashboard/time-picker/TimePicker.tsx
|
|
15674
16181
|
var React60 = __toESM(require("react"), 1);
|
|
15675
16182
|
var import_date_fns5 = require("date-fns");
|
|
15676
|
-
var
|
|
16183
|
+
var import_jsx_runtime166 = require("react/jsx-runtime");
|
|
15677
16184
|
var SHORT_TIME_FORMAT = "HH:mm";
|
|
15678
16185
|
function parseTime(value) {
|
|
15679
16186
|
return (0, import_date_fns5.parse)(value, SHORT_TIME_FORMAT, /* @__PURE__ */ new Date());
|
|
@@ -15722,15 +16229,15 @@ var DashboardTimePicker = React60.forwardRef(
|
|
|
15722
16229
|
const settings = timeSettings ?? FORMAT_SETTINGS[formatName];
|
|
15723
16230
|
return buildOptions(settings);
|
|
15724
16231
|
}, [formatName, options, timeSettings]);
|
|
15725
|
-
return /* @__PURE__ */ (0,
|
|
16232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(DashboardSelect, { ref, ...selectProps, options: resolvedOptions });
|
|
15726
16233
|
}
|
|
15727
16234
|
);
|
|
15728
16235
|
|
|
15729
16236
|
// src/dashboard/file-input/FileInput.tsx
|
|
15730
16237
|
var React61 = __toESM(require("react"), 1);
|
|
15731
|
-
var
|
|
15732
|
-
var
|
|
15733
|
-
var
|
|
16238
|
+
var import_lucide_react48 = require("lucide-react");
|
|
16239
|
+
var import_react_i18next38 = require("react-i18next");
|
|
16240
|
+
var import_jsx_runtime167 = require("react/jsx-runtime");
|
|
15734
16241
|
function defaultDownload(url) {
|
|
15735
16242
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
15736
16243
|
}
|
|
@@ -15759,7 +16266,7 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15759
16266
|
}, ref) {
|
|
15760
16267
|
const internalRef = React61.useRef(null);
|
|
15761
16268
|
const inputRef = useCombinedRef(ref, internalRef);
|
|
15762
|
-
const { t } = (0,
|
|
16269
|
+
const { t } = (0, import_react_i18next38.useTranslation)();
|
|
15763
16270
|
const resolvedLabel = label ?? t("upload_file");
|
|
15764
16271
|
const resolvedDownloadLabel = downloadLabel ?? t("download_attachment");
|
|
15765
16272
|
const reactId = React61.useId();
|
|
@@ -15788,7 +16295,7 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15788
16295
|
event.stopPropagation();
|
|
15789
16296
|
if (isUrl) onDownload(value);
|
|
15790
16297
|
};
|
|
15791
|
-
return /* @__PURE__ */ (0,
|
|
16298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
|
|
15792
16299
|
"label",
|
|
15793
16300
|
{
|
|
15794
16301
|
htmlFor: inputId,
|
|
@@ -15801,7 +16308,7 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15801
16308
|
),
|
|
15802
16309
|
style: wrapperWidth ? { width: wrapperWidth } : void 0,
|
|
15803
16310
|
children: [
|
|
15804
|
-
/* @__PURE__ */ (0,
|
|
16311
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
|
|
15805
16312
|
"input",
|
|
15806
16313
|
{
|
|
15807
16314
|
ref: inputRef,
|
|
@@ -15817,9 +16324,9 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15817
16324
|
"aria-invalid": isInvalid
|
|
15818
16325
|
}
|
|
15819
16326
|
),
|
|
15820
|
-
/* @__PURE__ */ (0,
|
|
15821
|
-
/* @__PURE__ */ (0,
|
|
15822
|
-
/* @__PURE__ */ (0,
|
|
16327
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "relative min-h-[68px] w-full", children: [
|
|
16328
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("div", { className: "relative w-full", children: [
|
|
16329
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
|
|
15823
16330
|
"div",
|
|
15824
16331
|
{
|
|
15825
16332
|
className: cn(
|
|
@@ -15827,25 +16334,25 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15827
16334
|
isEmpty && "bg-[var(--chekin-color-surface-input-empty)]"
|
|
15828
16335
|
),
|
|
15829
16336
|
children: [
|
|
15830
|
-
hasFileChip ? /* @__PURE__ */ (0,
|
|
16337
|
+
hasFileChip ? /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
|
|
15831
16338
|
"div",
|
|
15832
16339
|
{
|
|
15833
16340
|
className: "inline-flex h-6 max-w-[85%] items-center rounded-[4px] border border-[#acacd5] bg-[#f0f0f8] pl-[10px] pr-1",
|
|
15834
16341
|
onClick: (event) => event.preventDefault(),
|
|
15835
16342
|
children: [
|
|
15836
|
-
isUrl ? /* @__PURE__ */ (0,
|
|
16343
|
+
isUrl ? /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)(
|
|
15837
16344
|
"button",
|
|
15838
16345
|
{
|
|
15839
16346
|
type: "button",
|
|
15840
16347
|
onClick: handleDownload,
|
|
15841
16348
|
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",
|
|
15842
16349
|
children: [
|
|
15843
|
-
/* @__PURE__ */ (0,
|
|
15844
|
-
/* @__PURE__ */ (0,
|
|
16350
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "truncate", children: resolvedDownloadLabel }),
|
|
16351
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(import_lucide_react48.Download, { size: 15 })
|
|
15845
16352
|
]
|
|
15846
16353
|
}
|
|
15847
|
-
) : /* @__PURE__ */ (0,
|
|
15848
|
-
/* @__PURE__ */ (0,
|
|
16354
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime167.jsx)("span", { className: "truncate text-[14px] font-medium text-[var(--chekin-color-brand-navy)]", children: value.name }),
|
|
16355
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
|
|
15849
16356
|
"button",
|
|
15850
16357
|
{
|
|
15851
16358
|
type: "button",
|
|
@@ -15853,20 +16360,20 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15853
16360
|
onClick: handleClear,
|
|
15854
16361
|
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]",
|
|
15855
16362
|
"aria-label": t("remove_file"),
|
|
15856
|
-
children: /* @__PURE__ */ (0,
|
|
16363
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(import_lucide_react48.SquareX, { size: 15, fill: "#9696b9", color: "#f8f8f8", strokeWidth: 1.8 })
|
|
15857
16364
|
}
|
|
15858
16365
|
)
|
|
15859
16366
|
]
|
|
15860
16367
|
}
|
|
15861
|
-
) : /* @__PURE__ */ (0,
|
|
15862
|
-
/* @__PURE__ */ (0,
|
|
15863
|
-
loading && /* @__PURE__ */ (0,
|
|
15864
|
-
/* @__PURE__ */ (0,
|
|
16368
|
+
) : /* @__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 ?? "" }),
|
|
16369
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("span", { className: "ml-auto flex items-center gap-2 text-[var(--chekin-color-gray-2)]", children: [
|
|
16370
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(ThreeDotsLoader, { height: 18, width: 18 }),
|
|
16371
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(import_lucide_react48.Paperclip, { size: 20 })
|
|
15865
16372
|
] })
|
|
15866
16373
|
]
|
|
15867
16374
|
}
|
|
15868
16375
|
),
|
|
15869
|
-
/* @__PURE__ */ (0,
|
|
16376
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
|
|
15870
16377
|
Fieldset,
|
|
15871
16378
|
{
|
|
15872
16379
|
isFocused: false,
|
|
@@ -15884,9 +16391,9 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15884
16391
|
}
|
|
15885
16392
|
)
|
|
15886
16393
|
] }),
|
|
15887
|
-
!error && optional && /* @__PURE__ */ (0,
|
|
15888
|
-
!error && helperText && /* @__PURE__ */ (0,
|
|
15889
|
-
error && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
16394
|
+
!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") }),
|
|
16395
|
+
!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 }),
|
|
16396
|
+
error && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
|
|
15890
16397
|
FieldErrorMessage,
|
|
15891
16398
|
{
|
|
15892
16399
|
id: errorId,
|
|
@@ -15903,7 +16410,7 @@ var DashboardFileInput = React61.forwardRef(
|
|
|
15903
16410
|
|
|
15904
16411
|
// src/dashboard/select-icons-box/SelectIconsBox.tsx
|
|
15905
16412
|
var React62 = __toESM(require("react"), 1);
|
|
15906
|
-
var
|
|
16413
|
+
var import_jsx_runtime168 = require("react/jsx-runtime");
|
|
15907
16414
|
function DashboardSelectIconsBox({
|
|
15908
16415
|
children,
|
|
15909
16416
|
icons,
|
|
@@ -15939,7 +16446,7 @@ function DashboardSelectIconsBox({
|
|
|
15939
16446
|
onSelect(iconName);
|
|
15940
16447
|
setOpen(false);
|
|
15941
16448
|
};
|
|
15942
|
-
return /* @__PURE__ */ (0,
|
|
16449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
|
|
15943
16450
|
"div",
|
|
15944
16451
|
{
|
|
15945
16452
|
ref: containerRef,
|
|
@@ -15947,7 +16454,7 @@ function DashboardSelectIconsBox({
|
|
|
15947
16454
|
className: cn("relative inline-block", className),
|
|
15948
16455
|
children: [
|
|
15949
16456
|
children,
|
|
15950
|
-
isOpen && /* @__PURE__ */ (0,
|
|
16457
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
|
|
15951
16458
|
"div",
|
|
15952
16459
|
{
|
|
15953
16460
|
className: cn(
|
|
@@ -15958,7 +16465,7 @@ function DashboardSelectIconsBox({
|
|
|
15958
16465
|
boxClassName
|
|
15959
16466
|
),
|
|
15960
16467
|
style: { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` },
|
|
15961
|
-
children: icons.map((iconName) => /* @__PURE__ */ (0,
|
|
16468
|
+
children: icons.map((iconName) => /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
|
|
15962
16469
|
"button",
|
|
15963
16470
|
{
|
|
15964
16471
|
type: "button",
|
|
@@ -16039,14 +16546,14 @@ function getErrorMessage(error) {
|
|
|
16039
16546
|
|
|
16040
16547
|
// src/lib/toastResponseError.tsx
|
|
16041
16548
|
var import_i18next = __toESM(require("i18next"), 1);
|
|
16042
|
-
var
|
|
16549
|
+
var import_jsx_runtime169 = require("react/jsx-runtime");
|
|
16043
16550
|
function addSupportEmailToMessage(message, prefixText) {
|
|
16044
16551
|
if (typeof message !== "string") {
|
|
16045
16552
|
return message;
|
|
16046
16553
|
}
|
|
16047
16554
|
const builtMessage = `${prefixText ? `${prefixText} ` : ""}${message}`;
|
|
16048
|
-
return /* @__PURE__ */ (0,
|
|
16049
|
-
/* @__PURE__ */ (0,
|
|
16555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime169.jsxs)("div", { children: [
|
|
16556
|
+
/* @__PURE__ */ (0, import_jsx_runtime169.jsx)("div", { children: builtMessage }),
|
|
16050
16557
|
import_i18next.default.t("reach_us_at_email")
|
|
16051
16558
|
] });
|
|
16052
16559
|
}
|
|
@@ -16061,13 +16568,13 @@ function toastResponseError(error, options = {}) {
|
|
|
16061
16568
|
}
|
|
16062
16569
|
|
|
16063
16570
|
// src/legacy-fields/textarea/Textarea.tsx
|
|
16064
|
-
var
|
|
16065
|
-
var
|
|
16066
|
-
var LegacyTextarea = (0,
|
|
16571
|
+
var import_react89 = require("react");
|
|
16572
|
+
var import_jsx_runtime170 = require("react/jsx-runtime");
|
|
16573
|
+
var LegacyTextarea = (0, import_react89.forwardRef)(
|
|
16067
16574
|
({ className, textareaClassName, label, disabled, name, invalid, ...textareaProps }, ref) => {
|
|
16068
|
-
const inputId = (0,
|
|
16069
|
-
return /* @__PURE__ */ (0,
|
|
16070
|
-
/* @__PURE__ */ (0,
|
|
16575
|
+
const inputId = (0, import_react89.useId)();
|
|
16576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("div", { className: cn("relative", className), children: [
|
|
16577
|
+
/* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
16071
16578
|
"textarea",
|
|
16072
16579
|
{
|
|
16073
16580
|
ref,
|
|
@@ -16083,7 +16590,7 @@ var LegacyTextarea = (0, import_react86.forwardRef)(
|
|
|
16083
16590
|
...textareaProps
|
|
16084
16591
|
}
|
|
16085
16592
|
),
|
|
16086
|
-
label && /* @__PURE__ */ (0,
|
|
16593
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
16087
16594
|
"label",
|
|
16088
16595
|
{
|
|
16089
16596
|
htmlFor: inputId,
|
|
@@ -16102,13 +16609,13 @@ LegacyTextarea.displayName = "LegacyTextarea";
|
|
|
16102
16609
|
|
|
16103
16610
|
// src/airbnb-fields/datepicker/DatePicker.tsx
|
|
16104
16611
|
var React64 = __toESM(require("react"), 1);
|
|
16105
|
-
var
|
|
16612
|
+
var import_lucide_react50 = require("lucide-react");
|
|
16106
16613
|
|
|
16107
16614
|
// src/airbnb-fields/field-trigger/FieldTrigger.tsx
|
|
16108
16615
|
var React63 = __toESM(require("react"), 1);
|
|
16109
|
-
var
|
|
16110
|
-
var
|
|
16111
|
-
var
|
|
16616
|
+
var import_lucide_react49 = require("lucide-react");
|
|
16617
|
+
var import_react_i18next39 = require("react-i18next");
|
|
16618
|
+
var import_jsx_runtime171 = require("react/jsx-runtime");
|
|
16112
16619
|
var AirbnbFieldTrigger = React63.forwardRef(
|
|
16113
16620
|
({
|
|
16114
16621
|
as = "button",
|
|
@@ -16140,20 +16647,20 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16140
16647
|
onKeyDown,
|
|
16141
16648
|
...props
|
|
16142
16649
|
}, ref) => {
|
|
16143
|
-
const { t } = (0,
|
|
16650
|
+
const { t } = (0, import_react_i18next39.useTranslation)();
|
|
16144
16651
|
const hasValue = Boolean(valueText);
|
|
16145
16652
|
const isRaised = hasValue || forceFloatingLabel;
|
|
16146
16653
|
const optionalLabel = optional ? typeof optional === "string" ? optional : t("optional") : void 0;
|
|
16147
16654
|
const visibleLabelText = labelText ?? label;
|
|
16148
16655
|
const hasLabelMeta = Boolean(optionalLabel) || Boolean(tooltip);
|
|
16149
|
-
const resolvedLabelText = visibleLabelText && hasLabelMeta ? /* @__PURE__ */ (0,
|
|
16150
|
-
/* @__PURE__ */ (0,
|
|
16151
|
-
optionalLabel && /* @__PURE__ */ (0,
|
|
16656
|
+
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: [
|
|
16657
|
+
/* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { className: "min-w-0 truncate", children: visibleLabelText }),
|
|
16658
|
+
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: [
|
|
16152
16659
|
"(",
|
|
16153
16660
|
optionalLabel,
|
|
16154
16661
|
")"
|
|
16155
16662
|
] }),
|
|
16156
|
-
tooltip && /* @__PURE__ */ (0,
|
|
16663
|
+
tooltip && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16157
16664
|
HelpTooltip,
|
|
16158
16665
|
{
|
|
16159
16666
|
content: tooltip,
|
|
@@ -16169,10 +16676,10 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16169
16676
|
const hasInvalidState = Boolean(error);
|
|
16170
16677
|
const errorMessage = typeof error === "string" ? error : void 0;
|
|
16171
16678
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
16172
|
-
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */ (0,
|
|
16679
|
+
const resolvedTrailingAdornment = loading || trailingAdornment ? /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
16173
16680
|
trailingAdornment,
|
|
16174
|
-
loading && /* @__PURE__ */ (0,
|
|
16175
|
-
|
|
16681
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16682
|
+
import_lucide_react49.Loader2,
|
|
16176
16683
|
{
|
|
16177
16684
|
"aria-hidden": "true",
|
|
16178
16685
|
className: "h-5 w-5 animate-spin text-[var(--chekin-color-gray-1)]"
|
|
@@ -16187,8 +16694,8 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16187
16694
|
disabled ? "cursor-not-allowed opacity-50" : loading ? "cursor-progress" : isAirbnbVariant ? "cursor-pointer" : "cursor-text",
|
|
16188
16695
|
className
|
|
16189
16696
|
);
|
|
16190
|
-
const sharedContent = /* @__PURE__ */ (0,
|
|
16191
|
-
/* @__PURE__ */ (0,
|
|
16697
|
+
const sharedContent = /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(import_jsx_runtime171.Fragment, { children: [
|
|
16698
|
+
/* @__PURE__ */ (0, import_jsx_runtime171.jsxs)(
|
|
16192
16699
|
"span",
|
|
16193
16700
|
{
|
|
16194
16701
|
className: cn(
|
|
@@ -16197,7 +16704,7 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16197
16704
|
contentClassName
|
|
16198
16705
|
),
|
|
16199
16706
|
children: [
|
|
16200
|
-
/* @__PURE__ */ (0,
|
|
16707
|
+
/* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16201
16708
|
"span",
|
|
16202
16709
|
{
|
|
16203
16710
|
id: labelId,
|
|
@@ -16210,7 +16717,7 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16210
16717
|
children: animatedLabel
|
|
16211
16718
|
}
|
|
16212
16719
|
),
|
|
16213
|
-
children ? children : hasValue ? /* @__PURE__ */ (0,
|
|
16720
|
+
children ? children : hasValue ? /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16214
16721
|
"span",
|
|
16215
16722
|
{
|
|
16216
16723
|
id: valueId,
|
|
@@ -16221,11 +16728,11 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16221
16728
|
),
|
|
16222
16729
|
children: valueText
|
|
16223
16730
|
}
|
|
16224
|
-
) : /* @__PURE__ */ (0,
|
|
16731
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("span", { id: helperTextId, className: "sr-only", children: placeholder ?? label })
|
|
16225
16732
|
]
|
|
16226
16733
|
}
|
|
16227
16734
|
),
|
|
16228
|
-
resolvedTrailingAdornment && /* @__PURE__ */ (0,
|
|
16735
|
+
resolvedTrailingAdornment && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16229
16736
|
"span",
|
|
16230
16737
|
{
|
|
16231
16738
|
"aria-hidden": "true",
|
|
@@ -16237,9 +16744,9 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16237
16744
|
}
|
|
16238
16745
|
)
|
|
16239
16746
|
] });
|
|
16240
|
-
return /* @__PURE__ */ (0,
|
|
16241
|
-
topLabel && /* @__PURE__ */ (0,
|
|
16242
|
-
as === "button" ? /* @__PURE__ */ (0,
|
|
16747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("div", { className: "w-full", children: [
|
|
16748
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("p", { className: "mb-3 text-[16px] font-semibold leading-5 text-[#222222]", children: topLabel }),
|
|
16749
|
+
as === "button" ? /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16243
16750
|
"button",
|
|
16244
16751
|
{
|
|
16245
16752
|
id,
|
|
@@ -16256,7 +16763,7 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16256
16763
|
...props,
|
|
16257
16764
|
children: sharedContent
|
|
16258
16765
|
}
|
|
16259
|
-
) : /* @__PURE__ */ (0,
|
|
16766
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(
|
|
16260
16767
|
"div",
|
|
16261
16768
|
{
|
|
16262
16769
|
id,
|
|
@@ -16273,14 +16780,14 @@ var AirbnbFieldTrigger = React63.forwardRef(
|
|
|
16273
16780
|
children: sharedContent
|
|
16274
16781
|
}
|
|
16275
16782
|
),
|
|
16276
|
-
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0,
|
|
16783
|
+
errorMessage && !hideErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(FieldErrorMessage, { id: errorId, message: errorMessage })
|
|
16277
16784
|
] });
|
|
16278
16785
|
}
|
|
16279
16786
|
);
|
|
16280
16787
|
AirbnbFieldTrigger.displayName = "AirbnbFieldTrigger";
|
|
16281
16788
|
|
|
16282
16789
|
// src/airbnb-fields/datepicker/DatePicker.tsx
|
|
16283
|
-
var
|
|
16790
|
+
var import_jsx_runtime172 = require("react/jsx-runtime");
|
|
16284
16791
|
var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
|
|
16285
16792
|
var AirbnbDatePicker = React64.forwardRef(
|
|
16286
16793
|
({
|
|
@@ -16307,7 +16814,7 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16307
16814
|
doneLabel = "Done",
|
|
16308
16815
|
formatValue = formatDateValue
|
|
16309
16816
|
}, ref) => {
|
|
16310
|
-
const { isMatch:
|
|
16817
|
+
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
16311
16818
|
const [isOpen, setIsOpen] = React64.useState(false);
|
|
16312
16819
|
const triggerId = React64.useId();
|
|
16313
16820
|
const pickerId = React64.useId();
|
|
@@ -16397,8 +16904,8 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16397
16904
|
setIsOpen(false);
|
|
16398
16905
|
}
|
|
16399
16906
|
}, [isBlocked]);
|
|
16400
|
-
return /* @__PURE__ */ (0,
|
|
16401
|
-
name && /* @__PURE__ */ (0,
|
|
16907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: cn("relative w-full max-w-[var(--max-field-width)]", className), children: [
|
|
16908
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
16402
16909
|
"input",
|
|
16403
16910
|
{
|
|
16404
16911
|
type: "hidden",
|
|
@@ -16406,7 +16913,7 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16406
16913
|
value: resolvedValue ? formatDateInputValue(resolvedValue) : ""
|
|
16407
16914
|
}
|
|
16408
16915
|
),
|
|
16409
|
-
/* @__PURE__ */ (0,
|
|
16916
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
16410
16917
|
AirbnbFieldTrigger,
|
|
16411
16918
|
{
|
|
16412
16919
|
id: triggerId,
|
|
@@ -16433,15 +16940,15 @@ var AirbnbDatePicker = React64.forwardRef(
|
|
|
16433
16940
|
onClick: handleTriggerClick,
|
|
16434
16941
|
onKeyDown: handleTriggerKeyDown,
|
|
16435
16942
|
onBlur,
|
|
16436
|
-
trailingAdornment: /* @__PURE__ */ (0,
|
|
16943
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(import_lucide_react50.Calendar, { className: "h-5 w-5 text-[#1F1F1B]", strokeWidth: 2 })
|
|
16437
16944
|
}
|
|
16438
16945
|
),
|
|
16439
|
-
/* @__PURE__ */ (0,
|
|
16946
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
16440
16947
|
AirbnbDatePickerContent,
|
|
16441
16948
|
{
|
|
16442
16949
|
baseId: pickerId,
|
|
16443
16950
|
open: isOpen,
|
|
16444
|
-
isMobile:
|
|
16951
|
+
isMobile: isMobile3,
|
|
16445
16952
|
label,
|
|
16446
16953
|
title: mobileTitle ?? label,
|
|
16447
16954
|
doneLabel,
|
|
@@ -16471,7 +16978,7 @@ AirbnbDatePicker.displayName = "AirbnbDatePicker";
|
|
|
16471
16978
|
|
|
16472
16979
|
// src/airbnb-fields/input/Input.tsx
|
|
16473
16980
|
var React65 = __toESM(require("react"), 1);
|
|
16474
|
-
var
|
|
16981
|
+
var import_jsx_runtime173 = require("react/jsx-runtime");
|
|
16475
16982
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
16476
16983
|
var AirbnbInput = React65.forwardRef(
|
|
16477
16984
|
({
|
|
@@ -16554,7 +17061,7 @@ var AirbnbInput = React65.forwardRef(
|
|
|
16554
17061
|
setIsFocused(false);
|
|
16555
17062
|
onBlur?.(event);
|
|
16556
17063
|
};
|
|
16557
|
-
return /* @__PURE__ */ (0,
|
|
17064
|
+
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)(
|
|
16558
17065
|
AirbnbFieldTrigger,
|
|
16559
17066
|
{
|
|
16560
17067
|
as: "div",
|
|
@@ -16586,7 +17093,7 @@ var AirbnbInput = React65.forwardRef(
|
|
|
16586
17093
|
forceFloatingLabel: shouldShowLabel,
|
|
16587
17094
|
forceLabelText: hasLabelMeta,
|
|
16588
17095
|
hideErrorMessage: !renderErrorMessage,
|
|
16589
|
-
children: /* @__PURE__ */ (0,
|
|
17096
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(
|
|
16590
17097
|
"input",
|
|
16591
17098
|
{
|
|
16592
17099
|
...props,
|
|
@@ -16623,13 +17130,13 @@ AirbnbInput.displayName = "AirbnbInput";
|
|
|
16623
17130
|
|
|
16624
17131
|
// src/airbnb-fields/phone-field/PhoneField.tsx
|
|
16625
17132
|
var React71 = __toESM(require("react"), 1);
|
|
16626
|
-
var
|
|
17133
|
+
var import_lucide_react52 = require("lucide-react");
|
|
16627
17134
|
|
|
16628
17135
|
// src/airbnb-fields/select/Select.tsx
|
|
16629
17136
|
var React70 = __toESM(require("react"), 1);
|
|
16630
17137
|
|
|
16631
17138
|
// src/airbnb-fields/select/SelectDesktopMenu.tsx
|
|
16632
|
-
var
|
|
17139
|
+
var import_jsx_runtime174 = require("react/jsx-runtime");
|
|
16633
17140
|
function AirbnbSelectDesktopMenu({
|
|
16634
17141
|
id,
|
|
16635
17142
|
options,
|
|
@@ -16648,7 +17155,7 @@ function AirbnbSelectDesktopMenu({
|
|
|
16648
17155
|
noOptionsMessage
|
|
16649
17156
|
}) {
|
|
16650
17157
|
const emptyMessage = noOptionsMessage?.();
|
|
16651
|
-
return /* @__PURE__ */ (0,
|
|
17158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(
|
|
16652
17159
|
"div",
|
|
16653
17160
|
{
|
|
16654
17161
|
id,
|
|
@@ -16661,12 +17168,12 @@ function AirbnbSelectDesktopMenu({
|
|
|
16661
17168
|
onKeyDown,
|
|
16662
17169
|
className: cn("max-h-[280px] overflow-y-auto p-2 outline-none", menuClassName),
|
|
16663
17170
|
children: [
|
|
16664
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0,
|
|
17171
|
+
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,
|
|
16665
17172
|
options.map((option, index) => {
|
|
16666
17173
|
const isSelected = selectedValue?.value === option.value;
|
|
16667
17174
|
const isHighlighted = index === highlightedIndex;
|
|
16668
17175
|
const optionKey = `${String(option.value)}-${index}`;
|
|
16669
|
-
return /* @__PURE__ */ (0,
|
|
17176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(
|
|
16670
17177
|
"button",
|
|
16671
17178
|
{
|
|
16672
17179
|
id: getOptionId2(index),
|
|
@@ -16698,7 +17205,7 @@ function AirbnbSelectDesktopMenu({
|
|
|
16698
17205
|
}
|
|
16699
17206
|
|
|
16700
17207
|
// src/airbnb-fields/select/SelectDesktopContent.tsx
|
|
16701
|
-
var
|
|
17208
|
+
var import_jsx_runtime175 = require("react/jsx-runtime");
|
|
16702
17209
|
function AirbnbSelectDesktopContent({
|
|
16703
17210
|
isOpen,
|
|
16704
17211
|
listboxId,
|
|
@@ -16719,14 +17226,14 @@ function AirbnbSelectDesktopContent({
|
|
|
16719
17226
|
noOptionsMessage
|
|
16720
17227
|
}) {
|
|
16721
17228
|
if (!isOpen) return null;
|
|
16722
|
-
return /* @__PURE__ */ (0,
|
|
17229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
16723
17230
|
"div",
|
|
16724
17231
|
{
|
|
16725
17232
|
className: cn(
|
|
16726
17233
|
"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)]",
|
|
16727
17234
|
dropdownClassName
|
|
16728
17235
|
),
|
|
16729
|
-
children: /* @__PURE__ */ (0,
|
|
17236
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
16730
17237
|
AirbnbSelectDesktopMenu,
|
|
16731
17238
|
{
|
|
16732
17239
|
id: listboxId,
|
|
@@ -16824,7 +17331,7 @@ function getMobileOptionStyles(index, scrollTop) {
|
|
|
16824
17331
|
}
|
|
16825
17332
|
|
|
16826
17333
|
// src/airbnb-fields/select/SelectMobileWheel.tsx
|
|
16827
|
-
var
|
|
17334
|
+
var import_jsx_runtime176 = require("react/jsx-runtime");
|
|
16828
17335
|
function AirbnbSelectMobileWheel({
|
|
16829
17336
|
id,
|
|
16830
17337
|
options,
|
|
@@ -16843,7 +17350,7 @@ function AirbnbSelectMobileWheel({
|
|
|
16843
17350
|
}) {
|
|
16844
17351
|
const spacerHeight2 = getWheelSpacerHeight();
|
|
16845
17352
|
const emptyMessage = noOptionsMessage?.();
|
|
16846
|
-
return /* @__PURE__ */ (0,
|
|
17353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
|
|
16847
17354
|
"div",
|
|
16848
17355
|
{
|
|
16849
17356
|
id,
|
|
@@ -16855,10 +17362,10 @@ function AirbnbSelectMobileWheel({
|
|
|
16855
17362
|
onKeyDown,
|
|
16856
17363
|
className: cn("relative overflow-hidden outline-none", menuClassName),
|
|
16857
17364
|
children: [
|
|
16858
|
-
options.length === 0 && emptyMessage ? /* @__PURE__ */ (0,
|
|
16859
|
-
/* @__PURE__ */ (0,
|
|
16860
|
-
/* @__PURE__ */ (0,
|
|
16861
|
-
/* @__PURE__ */ (0,
|
|
17365
|
+
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,
|
|
17366
|
+
/* @__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" }),
|
|
17367
|
+
/* @__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" }),
|
|
17368
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
16862
17369
|
"div",
|
|
16863
17370
|
{
|
|
16864
17371
|
"aria-hidden": true,
|
|
@@ -16868,7 +17375,7 @@ function AirbnbSelectMobileWheel({
|
|
|
16868
17375
|
)
|
|
16869
17376
|
}
|
|
16870
17377
|
),
|
|
16871
|
-
/* @__PURE__ */ (0,
|
|
17378
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(
|
|
16872
17379
|
"div",
|
|
16873
17380
|
{
|
|
16874
17381
|
ref: listRef,
|
|
@@ -16883,11 +17390,11 @@ function AirbnbSelectMobileWheel({
|
|
|
16883
17390
|
WebkitOverflowScrolling: "touch"
|
|
16884
17391
|
},
|
|
16885
17392
|
children: [
|
|
16886
|
-
/* @__PURE__ */ (0,
|
|
17393
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { style: { height: `${spacerHeight2}px` } }),
|
|
16887
17394
|
options.map((option, index) => {
|
|
16888
17395
|
const { distance, style } = getMobileOptionStyles(index, scrollTop);
|
|
16889
17396
|
const optionKey = `${String(option.value)}-${index}`;
|
|
16890
|
-
return /* @__PURE__ */ (0,
|
|
17397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
16891
17398
|
"button",
|
|
16892
17399
|
{
|
|
16893
17400
|
id: getOptionId2(index),
|
|
@@ -16908,7 +17415,7 @@ function AirbnbSelectMobileWheel({
|
|
|
16908
17415
|
optionKey
|
|
16909
17416
|
);
|
|
16910
17417
|
}),
|
|
16911
|
-
/* @__PURE__ */ (0,
|
|
17418
|
+
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)("div", { style: { height: `${spacerHeight2}px` } })
|
|
16912
17419
|
]
|
|
16913
17420
|
}
|
|
16914
17421
|
)
|
|
@@ -16918,7 +17425,7 @@ function AirbnbSelectMobileWheel({
|
|
|
16918
17425
|
}
|
|
16919
17426
|
|
|
16920
17427
|
// src/airbnb-fields/select/SelectMobileContent.tsx
|
|
16921
|
-
var
|
|
17428
|
+
var import_jsx_runtime177 = require("react/jsx-runtime");
|
|
16922
17429
|
function AirbnbSelectMobileContent({
|
|
16923
17430
|
open,
|
|
16924
17431
|
onOpenChange,
|
|
@@ -16942,11 +17449,11 @@ function AirbnbSelectMobileContent({
|
|
|
16942
17449
|
getOptionId: getOptionId2,
|
|
16943
17450
|
noOptionsMessage
|
|
16944
17451
|
}) {
|
|
16945
|
-
return /* @__PURE__ */ (0,
|
|
16946
|
-
/* @__PURE__ */ (0,
|
|
16947
|
-
/* @__PURE__ */ (0,
|
|
16948
|
-
/* @__PURE__ */ (0,
|
|
16949
|
-
/* @__PURE__ */ (0,
|
|
17452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(Drawer, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(DrawerContent, { onClose, lockScroll: false, children: [
|
|
17453
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
17454
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(DrawerDescription, { className: "sr-only", children: label }),
|
|
17455
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsxs)("div", { className: "px-6 pb-4 pt-1", children: [
|
|
17456
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(
|
|
16950
17457
|
AirbnbSelectMobileWheel,
|
|
16951
17458
|
{
|
|
16952
17459
|
id: listboxId,
|
|
@@ -16965,15 +17472,15 @@ function AirbnbSelectMobileContent({
|
|
|
16965
17472
|
noOptionsMessage
|
|
16966
17473
|
}
|
|
16967
17474
|
),
|
|
16968
|
-
/* @__PURE__ */ (0,
|
|
17475
|
+
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(Button, { type: "button", onClick: onDone, className: "mt-4 h-12 mb-8 w-full", children: doneLabel })
|
|
16969
17476
|
] })
|
|
16970
17477
|
] }) });
|
|
16971
17478
|
}
|
|
16972
17479
|
|
|
16973
17480
|
// src/airbnb-fields/select/SelectTrigger.tsx
|
|
16974
17481
|
var React66 = __toESM(require("react"), 1);
|
|
16975
|
-
var
|
|
16976
|
-
var
|
|
17482
|
+
var import_lucide_react51 = require("lucide-react");
|
|
17483
|
+
var import_jsx_runtime178 = require("react/jsx-runtime");
|
|
16977
17484
|
var AirbnbSelectTrigger = React66.forwardRef(
|
|
16978
17485
|
({
|
|
16979
17486
|
id,
|
|
@@ -16999,7 +17506,7 @@ var AirbnbSelectTrigger = React66.forwardRef(
|
|
|
16999
17506
|
onKeyDown,
|
|
17000
17507
|
onBlur
|
|
17001
17508
|
}, ref) => {
|
|
17002
|
-
return /* @__PURE__ */ (0,
|
|
17509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
17003
17510
|
AirbnbFieldTrigger,
|
|
17004
17511
|
{
|
|
17005
17512
|
id,
|
|
@@ -17028,8 +17535,8 @@ var AirbnbSelectTrigger = React66.forwardRef(
|
|
|
17028
17535
|
onClick,
|
|
17029
17536
|
onKeyDown,
|
|
17030
17537
|
onBlur,
|
|
17031
|
-
trailingAdornment: /* @__PURE__ */ (0,
|
|
17032
|
-
|
|
17538
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
17539
|
+
import_lucide_react51.ChevronDown,
|
|
17033
17540
|
{
|
|
17034
17541
|
className: open ? "h-6 w-6 rotate-180 text-[#1F1F1B] transition-transform" : "h-6 w-6 text-[#1F1F1B] transition-transform"
|
|
17035
17542
|
}
|
|
@@ -17043,7 +17550,7 @@ AirbnbSelectTrigger.displayName = "AirbnbSelectTrigger";
|
|
|
17043
17550
|
// src/airbnb-fields/select/useDesktopSelect.ts
|
|
17044
17551
|
var React67 = __toESM(require("react"), 1);
|
|
17045
17552
|
function useDesktopSelect({
|
|
17046
|
-
isMobile:
|
|
17553
|
+
isMobile: isMobile3,
|
|
17047
17554
|
isOpen,
|
|
17048
17555
|
options,
|
|
17049
17556
|
value,
|
|
@@ -17056,7 +17563,7 @@ function useDesktopSelect({
|
|
|
17056
17563
|
const optionRefs = React67.useRef([]);
|
|
17057
17564
|
const selectedIndex = getOptionIndex2(options, value);
|
|
17058
17565
|
React67.useEffect(() => {
|
|
17059
|
-
if (!isOpen ||
|
|
17566
|
+
if (!isOpen || isMobile3) return;
|
|
17060
17567
|
setHighlightedIndex((currentIndex) => {
|
|
17061
17568
|
if (currentIndex >= 0) {
|
|
17062
17569
|
return currentIndex;
|
|
@@ -17069,13 +17576,13 @@ function useDesktopSelect({
|
|
|
17069
17576
|
return () => {
|
|
17070
17577
|
window.cancelAnimationFrame(frameId);
|
|
17071
17578
|
};
|
|
17072
|
-
}, [
|
|
17579
|
+
}, [isMobile3, isOpen, options, selectedIndex]);
|
|
17073
17580
|
React67.useEffect(() => {
|
|
17074
|
-
if (!isOpen ||
|
|
17581
|
+
if (!isOpen || isMobile3 || highlightedIndex < 0) return;
|
|
17075
17582
|
optionRefs.current[highlightedIndex]?.scrollIntoView({
|
|
17076
17583
|
block: "nearest"
|
|
17077
17584
|
});
|
|
17078
|
-
}, [highlightedIndex,
|
|
17585
|
+
}, [highlightedIndex, isMobile3, isOpen]);
|
|
17079
17586
|
React67.useEffect(() => {
|
|
17080
17587
|
if (isOpen) return;
|
|
17081
17588
|
setHighlightedIndex(-1);
|
|
@@ -17193,7 +17700,7 @@ function useDesktopSelect({
|
|
|
17193
17700
|
|
|
17194
17701
|
// src/airbnb-fields/select/useMobileSelectWheel.ts
|
|
17195
17702
|
var React68 = __toESM(require("react"), 1);
|
|
17196
|
-
function useMobileSelectWheel({ isMobile:
|
|
17703
|
+
function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, disabled }) {
|
|
17197
17704
|
const [pendingValue, setPendingValue] = React68.useState(
|
|
17198
17705
|
value ?? null
|
|
17199
17706
|
);
|
|
@@ -17248,14 +17755,14 @@ function useMobileSelectWheel({ isMobile: isMobile2, isOpen, options, value, dis
|
|
|
17248
17755
|
setPendingValue(value ?? null);
|
|
17249
17756
|
}, [value]);
|
|
17250
17757
|
React68.useLayoutEffect(() => {
|
|
17251
|
-
if (!
|
|
17758
|
+
if (!isMobile3 || !isOpen) return;
|
|
17252
17759
|
const frameId = window.requestAnimationFrame(() => {
|
|
17253
17760
|
syncScrollPosition(value ?? null, "instant");
|
|
17254
17761
|
});
|
|
17255
17762
|
return () => {
|
|
17256
17763
|
window.cancelAnimationFrame(frameId);
|
|
17257
17764
|
};
|
|
17258
|
-
}, [
|
|
17765
|
+
}, [isMobile3, isOpen, syncScrollPosition, value]);
|
|
17259
17766
|
const settleScroll = React68.useCallback(() => {
|
|
17260
17767
|
if (!mobileListRef.current) return;
|
|
17261
17768
|
const nextIndex = Math.round(mobileListRef.current.scrollTop / MOBILE_OPTION_HEIGHT);
|
|
@@ -17390,7 +17897,7 @@ function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
|
17390
17897
|
}
|
|
17391
17898
|
|
|
17392
17899
|
// src/airbnb-fields/select/Select.tsx
|
|
17393
|
-
var
|
|
17900
|
+
var import_jsx_runtime179 = require("react/jsx-runtime");
|
|
17394
17901
|
var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
17395
17902
|
options = [],
|
|
17396
17903
|
value,
|
|
@@ -17417,7 +17924,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17417
17924
|
name,
|
|
17418
17925
|
noOptionsMessage
|
|
17419
17926
|
}, ref) {
|
|
17420
|
-
const { isMatch:
|
|
17927
|
+
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
17421
17928
|
const [isOpen, setIsOpen] = React70.useState(false);
|
|
17422
17929
|
const containerRef = React70.useRef(null);
|
|
17423
17930
|
const hasValue = Boolean(value);
|
|
@@ -17448,7 +17955,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17448
17955
|
moveByStep,
|
|
17449
17956
|
moveToBoundary
|
|
17450
17957
|
} = useMobileSelectWheel({
|
|
17451
|
-
isMobile:
|
|
17958
|
+
isMobile: isMobile3,
|
|
17452
17959
|
isOpen,
|
|
17453
17960
|
options,
|
|
17454
17961
|
value,
|
|
@@ -17465,7 +17972,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17465
17972
|
handleMenuKeyDown,
|
|
17466
17973
|
handleTriggerKeyDown
|
|
17467
17974
|
} = useDesktopSelect({
|
|
17468
|
-
isMobile:
|
|
17975
|
+
isMobile: isMobile3,
|
|
17469
17976
|
isOpen,
|
|
17470
17977
|
options,
|
|
17471
17978
|
value,
|
|
@@ -17478,7 +17985,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17478
17985
|
useOutsideClick({
|
|
17479
17986
|
elementRef: containerRef,
|
|
17480
17987
|
onOutsideClick: () => setIsOpen(false),
|
|
17481
|
-
isDisabled: !isOpen ||
|
|
17988
|
+
isDisabled: !isOpen || isMobile3
|
|
17482
17989
|
});
|
|
17483
17990
|
React70.useEffect(() => {
|
|
17484
17991
|
if (isBlocked) {
|
|
@@ -17521,14 +18028,14 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17521
18028
|
if (isBlocked) return;
|
|
17522
18029
|
setIsOpen((prev) => {
|
|
17523
18030
|
const nextOpen = !prev;
|
|
17524
|
-
if (
|
|
18031
|
+
if (isMobile3) {
|
|
17525
18032
|
syncPendingValue(value ?? null);
|
|
17526
18033
|
}
|
|
17527
18034
|
return nextOpen;
|
|
17528
18035
|
});
|
|
17529
|
-
}, [isBlocked,
|
|
18036
|
+
}, [isBlocked, isMobile3, syncPendingValue, value]);
|
|
17530
18037
|
const handleRootTriggerKeyDown = (event) => {
|
|
17531
|
-
if (
|
|
18038
|
+
if (isMobile3) {
|
|
17532
18039
|
if (isBlocked) return;
|
|
17533
18040
|
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
17534
18041
|
event.preventDefault();
|
|
@@ -17570,13 +18077,13 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17570
18077
|
handleMobileOpenChange(false);
|
|
17571
18078
|
}
|
|
17572
18079
|
};
|
|
17573
|
-
return /* @__PURE__ */ (0,
|
|
18080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime179.jsxs)(
|
|
17574
18081
|
"div",
|
|
17575
18082
|
{
|
|
17576
18083
|
ref: containerRef,
|
|
17577
18084
|
className: cn("relative w-full max-w-[var(--max-field-width)]", className),
|
|
17578
18085
|
children: [
|
|
17579
|
-
name && /* @__PURE__ */ (0,
|
|
18086
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime179.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
17580
18087
|
renderTrigger ? renderTrigger({
|
|
17581
18088
|
id: triggerId,
|
|
17582
18089
|
open: isOpen,
|
|
@@ -17598,7 +18105,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17598
18105
|
onClick: handleTriggerClick,
|
|
17599
18106
|
onKeyDown: handleRootTriggerKeyDown,
|
|
17600
18107
|
onBlur
|
|
17601
|
-
}) : /* @__PURE__ */ (0,
|
|
18108
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
17602
18109
|
AirbnbSelectTrigger,
|
|
17603
18110
|
{
|
|
17604
18111
|
id: triggerId,
|
|
@@ -17626,7 +18133,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17626
18133
|
onBlur
|
|
17627
18134
|
}
|
|
17628
18135
|
),
|
|
17629
|
-
|
|
18136
|
+
isMobile3 ? /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
17630
18137
|
AirbnbSelectMobileContent,
|
|
17631
18138
|
{
|
|
17632
18139
|
open: isOpen,
|
|
@@ -17651,7 +18158,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17651
18158
|
getOptionId: getOptionId2,
|
|
17652
18159
|
noOptionsMessage
|
|
17653
18160
|
}
|
|
17654
|
-
) : /* @__PURE__ */ (0,
|
|
18161
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
|
|
17655
18162
|
AirbnbSelectDesktopContent,
|
|
17656
18163
|
{
|
|
17657
18164
|
isOpen,
|
|
@@ -17685,7 +18192,7 @@ var AirbnbSelect = React70.forwardRef(function AirbnbSelect2({
|
|
|
17685
18192
|
});
|
|
17686
18193
|
|
|
17687
18194
|
// src/airbnb-fields/phone-field/PhoneField.tsx
|
|
17688
|
-
var
|
|
18195
|
+
var import_jsx_runtime180 = require("react/jsx-runtime");
|
|
17689
18196
|
function formatPhoneCodeOptionLabel(option) {
|
|
17690
18197
|
const label = String(option.label);
|
|
17691
18198
|
const value = String(option.value);
|
|
@@ -17732,9 +18239,9 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17732
18239
|
const hasInvalidState = Boolean(error) || Boolean(invalid);
|
|
17733
18240
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
17734
18241
|
const isCodeBlocked = isBlocked || Boolean(codeReadOnly);
|
|
17735
|
-
return /* @__PURE__ */ (0,
|
|
17736
|
-
name && /* @__PURE__ */ (0,
|
|
17737
|
-
codeName && /* @__PURE__ */ (0,
|
|
18242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)("div", { className: cn("w-full max-w-[var(--max-field-width)]", className), children: [
|
|
18243
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("input", { type: "hidden", name, value: combinedValue, disabled }),
|
|
18244
|
+
codeName && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
17738
18245
|
"input",
|
|
17739
18246
|
{
|
|
17740
18247
|
type: "hidden",
|
|
@@ -17743,7 +18250,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17743
18250
|
disabled
|
|
17744
18251
|
}
|
|
17745
18252
|
),
|
|
17746
|
-
numberName && /* @__PURE__ */ (0,
|
|
18253
|
+
numberName && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
17747
18254
|
"input",
|
|
17748
18255
|
{
|
|
17749
18256
|
type: "hidden",
|
|
@@ -17752,7 +18259,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17752
18259
|
disabled
|
|
17753
18260
|
}
|
|
17754
18261
|
),
|
|
17755
|
-
topLabel && /* @__PURE__ */ (0,
|
|
18262
|
+
topLabel && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
17756
18263
|
"label",
|
|
17757
18264
|
{
|
|
17758
18265
|
htmlFor: inputId,
|
|
@@ -17760,8 +18267,8 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17760
18267
|
children: topLabel
|
|
17761
18268
|
}
|
|
17762
18269
|
),
|
|
17763
|
-
/* @__PURE__ */ (0,
|
|
17764
|
-
/* @__PURE__ */ (0,
|
|
18270
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsxs)("div", { className: "flex items-stretch", children: [
|
|
18271
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
17765
18272
|
AirbnbSelect,
|
|
17766
18273
|
{
|
|
17767
18274
|
ref,
|
|
@@ -17792,7 +18299,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17792
18299
|
onClick,
|
|
17793
18300
|
onKeyDown,
|
|
17794
18301
|
valueLabel
|
|
17795
|
-
}) => /* @__PURE__ */ (0,
|
|
18302
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(
|
|
17796
18303
|
"button",
|
|
17797
18304
|
{
|
|
17798
18305
|
id,
|
|
@@ -17814,9 +18321,9 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17814
18321
|
triggerDisabled ? "cursor-not-allowed opacity-50" : triggerLoading ? "cursor-progress" : "cursor-pointer"
|
|
17815
18322
|
),
|
|
17816
18323
|
children: [
|
|
17817
|
-
/* @__PURE__ */ (0,
|
|
17818
|
-
/* @__PURE__ */ (0,
|
|
17819
|
-
|
|
18324
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)("span", { children: valueLabel ?? codePlaceholder }),
|
|
18325
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
18326
|
+
import_lucide_react52.ChevronDown,
|
|
17820
18327
|
{
|
|
17821
18328
|
className: cn("h-5 w-5 transition-transform", open ? "rotate-180" : ""),
|
|
17822
18329
|
strokeWidth: 2
|
|
@@ -17827,7 +18334,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17827
18334
|
)
|
|
17828
18335
|
}
|
|
17829
18336
|
),
|
|
17830
|
-
/* @__PURE__ */ (0,
|
|
18337
|
+
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
|
|
17831
18338
|
AirbnbInput,
|
|
17832
18339
|
{
|
|
17833
18340
|
id: inputId,
|
|
@@ -17859,7 +18366,7 @@ var AirbnbPhoneField = React71.forwardRef(
|
|
|
17859
18366
|
}
|
|
17860
18367
|
)
|
|
17861
18368
|
] }),
|
|
17862
|
-
error && /* @__PURE__ */ (0,
|
|
18369
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(FieldErrorMessage, { message: error })
|
|
17863
18370
|
] });
|
|
17864
18371
|
}
|
|
17865
18372
|
);
|
|
@@ -17867,10 +18374,10 @@ AirbnbPhoneField.displayName = "AirbnbPhoneField";
|
|
|
17867
18374
|
|
|
17868
18375
|
// src/airbnb-fields/searchable-select/SearchableSelect.tsx
|
|
17869
18376
|
var React72 = __toESM(require("react"), 1);
|
|
17870
|
-
var
|
|
18377
|
+
var import_lucide_react53 = require("lucide-react");
|
|
17871
18378
|
var import_react_virtual3 = require("@tanstack/react-virtual");
|
|
17872
|
-
var
|
|
17873
|
-
var
|
|
18379
|
+
var import_react90 = require("react");
|
|
18380
|
+
var import_jsx_runtime181 = require("react/jsx-runtime");
|
|
17874
18381
|
var ROW_HEIGHT = 48;
|
|
17875
18382
|
var DESKTOP_LIST_HEIGHT = 280;
|
|
17876
18383
|
var MOBILE_LIST_HEIGHT = 420;
|
|
@@ -17910,7 +18417,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
17910
18417
|
noOptionsMessage,
|
|
17911
18418
|
loadingMessage
|
|
17912
18419
|
}, ref) => {
|
|
17913
|
-
const { isMatch:
|
|
18420
|
+
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
17914
18421
|
const reactId = React72.useId();
|
|
17915
18422
|
const [open, setOpen] = React72.useState(false);
|
|
17916
18423
|
const [internalSearchValue, setInternalSearchValue] = React72.useState("");
|
|
@@ -17945,10 +18452,10 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
17945
18452
|
useOutsideClick({
|
|
17946
18453
|
elementRef: containerRef,
|
|
17947
18454
|
onOutsideClick: () => closeSelect(),
|
|
17948
|
-
isDisabled: !open ||
|
|
18455
|
+
isDisabled: !open || isMobile3
|
|
17949
18456
|
});
|
|
17950
18457
|
const handleOnOpenChange = useEvent(onOpenChange);
|
|
17951
|
-
const setSelectOpen = (0,
|
|
18458
|
+
const setSelectOpen = (0, import_react90.useCallback)(
|
|
17952
18459
|
(nextOpen, options2) => {
|
|
17953
18460
|
setOpen(nextOpen);
|
|
17954
18461
|
handleOnOpenChange?.(nextOpen);
|
|
@@ -18039,7 +18546,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18039
18546
|
}
|
|
18040
18547
|
}
|
|
18041
18548
|
}
|
|
18042
|
-
const content = /* @__PURE__ */ (0,
|
|
18549
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18043
18550
|
AirbnbSearchableSelectContent,
|
|
18044
18551
|
{
|
|
18045
18552
|
inputId: searchInputId,
|
|
@@ -18058,7 +18565,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18058
18565
|
menuClassName,
|
|
18059
18566
|
noOptionsMessage,
|
|
18060
18567
|
loadingMessage,
|
|
18061
|
-
height:
|
|
18568
|
+
height: isMobile3 ? MOBILE_LIST_HEIGHT : DESKTOP_LIST_HEIGHT,
|
|
18062
18569
|
idPrefix: reactId,
|
|
18063
18570
|
onSearchChange: handleSearchChange,
|
|
18064
18571
|
onSearchKeyDown: handleSearchKeyDown,
|
|
@@ -18067,9 +18574,9 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18067
18574
|
}
|
|
18068
18575
|
);
|
|
18069
18576
|
React72.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
18070
|
-
return /* @__PURE__ */ (0,
|
|
18071
|
-
name && /* @__PURE__ */ (0,
|
|
18072
|
-
/* @__PURE__ */ (0,
|
|
18577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime181.jsxs)("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
|
|
18578
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
18579
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18073
18580
|
AirbnbFieldTrigger,
|
|
18074
18581
|
{
|
|
18075
18582
|
id: `${reactId}-trigger`,
|
|
@@ -18104,8 +18611,8 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18104
18611
|
},
|
|
18105
18612
|
onKeyDown: handleTriggerKeyDown,
|
|
18106
18613
|
onBlur,
|
|
18107
|
-
trailingAdornment: /* @__PURE__ */ (0,
|
|
18108
|
-
|
|
18614
|
+
trailingAdornment: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18615
|
+
import_lucide_react53.ChevronDown,
|
|
18109
18616
|
{
|
|
18110
18617
|
className: cn(
|
|
18111
18618
|
"h-6 w-6 text-[#1F1F1B] transition-transform",
|
|
@@ -18115,7 +18622,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18115
18622
|
)
|
|
18116
18623
|
}
|
|
18117
18624
|
),
|
|
18118
|
-
|
|
18625
|
+
isMobile3 ? /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18119
18626
|
Drawer,
|
|
18120
18627
|
{
|
|
18121
18628
|
open,
|
|
@@ -18127,13 +18634,13 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
18127
18634
|
}
|
|
18128
18635
|
closeSelect();
|
|
18129
18636
|
},
|
|
18130
|
-
children: /* @__PURE__ */ (0,
|
|
18131
|
-
/* @__PURE__ */ (0,
|
|
18132
|
-
/* @__PURE__ */ (0,
|
|
18133
|
-
/* @__PURE__ */ (0,
|
|
18637
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime181.jsxs)(DrawerContent, { onClose: closeSelect, lockScroll: false, children: [
|
|
18638
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)(DrawerTitle, { className: "sr-only", children: mobileTitle ?? label }),
|
|
18639
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)(DrawerDescription, { className: "sr-only", children: label }),
|
|
18640
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)("div", { className: "px-5 pb-5 pt-1", children: content })
|
|
18134
18641
|
] })
|
|
18135
18642
|
}
|
|
18136
|
-
) : open ? /* @__PURE__ */ (0,
|
|
18643
|
+
) : open ? /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18137
18644
|
"div",
|
|
18138
18645
|
{
|
|
18139
18646
|
className: cn(
|
|
@@ -18200,16 +18707,16 @@ function AirbnbSearchableSelectContent({
|
|
|
18200
18707
|
virtualizer.scrollToIndex(highlightedIndex, { align: "auto" });
|
|
18201
18708
|
}
|
|
18202
18709
|
}, [highlightedIndex, virtualizer]);
|
|
18203
|
-
return /* @__PURE__ */ (0,
|
|
18204
|
-
/* @__PURE__ */ (0,
|
|
18205
|
-
/* @__PURE__ */ (0,
|
|
18206
|
-
|
|
18710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime181.jsxs)("div", { className: "p-2", children: [
|
|
18711
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsxs)("div", { className: "relative mb-2", children: [
|
|
18712
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18713
|
+
import_lucide_react53.Search,
|
|
18207
18714
|
{
|
|
18208
18715
|
"aria-hidden": "true",
|
|
18209
18716
|
className: "absolute left-4 top-1/2 h-5 w-5 -translate-y-1/2 text-[#9696B9]"
|
|
18210
18717
|
}
|
|
18211
18718
|
),
|
|
18212
|
-
/* @__PURE__ */ (0,
|
|
18719
|
+
/* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18213
18720
|
"input",
|
|
18214
18721
|
{
|
|
18215
18722
|
id: inputId,
|
|
@@ -18228,7 +18735,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18228
18735
|
}
|
|
18229
18736
|
)
|
|
18230
18737
|
] }),
|
|
18231
|
-
loading && options.length === 0 ? /* @__PURE__ */ (0,
|
|
18738
|
+
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)(
|
|
18232
18739
|
"div",
|
|
18233
18740
|
{
|
|
18234
18741
|
id: listboxId,
|
|
@@ -18237,7 +18744,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18237
18744
|
"aria-labelledby": labelId,
|
|
18238
18745
|
className: cn("overflow-y-auto outline-none", menuClassName),
|
|
18239
18746
|
style: { height: Math.min(height, rowCount * ROW_HEIGHT) },
|
|
18240
|
-
children: /* @__PURE__ */ (0,
|
|
18747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18241
18748
|
"div",
|
|
18242
18749
|
{
|
|
18243
18750
|
className: "relative w-full",
|
|
@@ -18245,7 +18752,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18245
18752
|
children: virtualItems.map((virtualItem) => {
|
|
18246
18753
|
const option = options[virtualItem.index];
|
|
18247
18754
|
if (!option) {
|
|
18248
|
-
return /* @__PURE__ */ (0,
|
|
18755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18249
18756
|
"div",
|
|
18250
18757
|
{
|
|
18251
18758
|
className: "absolute left-0 top-0 flex w-full items-center px-4 text-base leading-6 text-[#6C6C6C]",
|
|
@@ -18260,7 +18767,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18260
18767
|
}
|
|
18261
18768
|
const isSelected = value?.value === option.value;
|
|
18262
18769
|
const isHighlighted = virtualItem.index === highlightedIndex;
|
|
18263
|
-
return /* @__PURE__ */ (0,
|
|
18770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(
|
|
18264
18771
|
"button",
|
|
18265
18772
|
{
|
|
18266
18773
|
id: getOptionId(idPrefix, virtualItem.index),
|
|
@@ -18282,7 +18789,7 @@ function AirbnbSearchableSelectContent({
|
|
|
18282
18789
|
height: `${virtualItem.size}px`,
|
|
18283
18790
|
transform: `translateY(${virtualItem.start}px)`
|
|
18284
18791
|
},
|
|
18285
|
-
children: /* @__PURE__ */ (0,
|
|
18792
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("span", { className: "truncate text-center", children: String(option.label) })
|
|
18286
18793
|
},
|
|
18287
18794
|
`${String(option.value)}-${virtualItem.index}`
|
|
18288
18795
|
);
|
|
@@ -18312,15 +18819,15 @@ function getNextEnabledIndex(options, startIndex, step) {
|
|
|
18312
18819
|
|
|
18313
18820
|
// src/airbnb-fields/search-input/SearchInput.tsx
|
|
18314
18821
|
var React73 = __toESM(require("react"), 1);
|
|
18315
|
-
var
|
|
18316
|
-
var
|
|
18317
|
-
var
|
|
18822
|
+
var import_react_i18next40 = require("react-i18next");
|
|
18823
|
+
var import_lucide_react54 = require("lucide-react");
|
|
18824
|
+
var import_jsx_runtime182 = require("react/jsx-runtime");
|
|
18318
18825
|
var AirbnbSearchInput = React73.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
18319
|
-
const { t } = (0,
|
|
18826
|
+
const { t } = (0, import_react_i18next40.useTranslation)();
|
|
18320
18827
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
18321
|
-
return /* @__PURE__ */ (0,
|
|
18322
|
-
/* @__PURE__ */ (0,
|
|
18323
|
-
/* @__PURE__ */ (0,
|
|
18828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
18829
|
+
/* @__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]" }),
|
|
18830
|
+
/* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
|
|
18324
18831
|
"input",
|
|
18325
18832
|
{
|
|
18326
18833
|
...props,
|
|
@@ -18339,13 +18846,13 @@ var AirbnbSearchInput = React73.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
18339
18846
|
)
|
|
18340
18847
|
}
|
|
18341
18848
|
),
|
|
18342
|
-
onReset && /* @__PURE__ */ (0,
|
|
18849
|
+
onReset && /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
|
|
18343
18850
|
Button,
|
|
18344
18851
|
{
|
|
18345
18852
|
variant: "ghost",
|
|
18346
18853
|
onClick: onReset,
|
|
18347
18854
|
className: "absolute right-0 top-1/2 h-5 w-5 -translate-y-1/2 transform text-[#9696B9]",
|
|
18348
|
-
children: /* @__PURE__ */ (0,
|
|
18855
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(import_lucide_react54.X, { className: "h-5 w-5" })
|
|
18349
18856
|
}
|
|
18350
18857
|
)
|
|
18351
18858
|
] });
|
|
@@ -18526,6 +19033,7 @@ AirbnbSearchInput.displayName = "AirbnbSearchInput";
|
|
|
18526
19033
|
LegacyTextarea,
|
|
18527
19034
|
Link,
|
|
18528
19035
|
LoadingBar,
|
|
19036
|
+
MobileWebcam,
|
|
18529
19037
|
Modal,
|
|
18530
19038
|
ModalButton,
|
|
18531
19039
|
ModalLoader,
|
|
@@ -18656,11 +19164,14 @@ AirbnbSearchInput.displayName = "AirbnbSearchInput";
|
|
|
18656
19164
|
buttonVariants,
|
|
18657
19165
|
calendarClassNames,
|
|
18658
19166
|
cn,
|
|
19167
|
+
compressFile,
|
|
19168
|
+
compressImage,
|
|
18659
19169
|
copyToClipboard,
|
|
18660
19170
|
createDisabledMatchers,
|
|
18661
19171
|
emptyMediaVariants,
|
|
18662
19172
|
formatDate,
|
|
18663
19173
|
getErrorMessage,
|
|
19174
|
+
getFileSizeMB,
|
|
18664
19175
|
getScrollableAreaState,
|
|
18665
19176
|
getSidebarState,
|
|
18666
19177
|
isDayBlocked,
|