@itilite/lumina-ui 1.0.2-alpha → 1.0.3-alpha
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/AdvancedDateRangePicker-D7xn4So6.d.mts +59 -0
- package/dist/AdvancedDateRangePicker-D7xn4So6.d.ts +59 -0
- package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.d.mts +1 -1
- package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.d.ts +1 -1
- package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.js +896 -77
- package/dist/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.mjs +6 -2
- package/dist/atom/AdvancedDateRangePicker/InternalCalendar.js +5 -5
- package/dist/atom/AdvancedDateRangePicker/InternalCalendar.mjs +1 -1
- package/dist/atom/Table/Table.js +4 -3
- package/dist/atom/Table/Table.mjs +1 -1
- package/dist/chunk-27LRL4RO.mjs +428 -0
- package/dist/chunk-3HXZIFV6.mjs +438 -0
- package/dist/chunk-62VAYFZA.mjs +437 -0
- package/dist/chunk-6ON32H2N.mjs +431 -0
- package/dist/chunk-6XIT27XY.mjs +269 -0
- package/dist/chunk-772C454L.mjs +438 -0
- package/dist/chunk-7L267Y4P.mjs +429 -0
- package/dist/chunk-7WSVCE2C.mjs +269 -0
- package/dist/chunk-BFFLWW7N.mjs +250 -0
- package/dist/chunk-FTL3PFC2.mjs +438 -0
- package/dist/chunk-GZ4P7OL3.mjs +429 -0
- package/dist/chunk-K2A4TWA3.mjs +430 -0
- package/dist/chunk-L3L42SIL.mjs +429 -0
- package/dist/chunk-MA23J4WQ.mjs +430 -0
- package/dist/chunk-QRGHJP7U.mjs +437 -0
- package/dist/chunk-RC6IGURJ.mjs +428 -0
- package/dist/chunk-TQDZWJZP.mjs +269 -0
- package/dist/chunk-ZGV6QMVM.mjs +437 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +41 -32
- package/dist/index.mjs +14 -14
- package/dist/styles.css +385 -250
- package/package.json +1 -1
|
@@ -63,14 +63,14 @@ __export(AdvancedDateRangePicker_exports, {
|
|
|
63
63
|
default: () => AdvancedDateRangePicker_default
|
|
64
64
|
});
|
|
65
65
|
module.exports = __toCommonJS(AdvancedDateRangePicker_exports);
|
|
66
|
-
var
|
|
67
|
-
var
|
|
66
|
+
var import_react4 = require("react");
|
|
67
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
68
68
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
69
69
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
|
|
70
70
|
var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore.js"));
|
|
71
71
|
|
|
72
72
|
// src/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.module.scss
|
|
73
|
-
var AdvancedDateRangePicker_module_default = { "root": "AdvancedDateRangePicker-module__root___udir8", "inner": "AdvancedDateRangePicker-module__inner___P4OHa", "left": "AdvancedDateRangePicker-module__left___T6E84", "sidebarItem": "AdvancedDateRangePicker-module__sidebarItem___-NXPm", "sidebarItemActive": "AdvancedDateRangePicker-module__sidebarItemActive___5GmBY", "main": "AdvancedDateRangePicker-module__main___G4MU9", "header": "AdvancedDateRangePicker-module__header___mxXEE", "
|
|
73
|
+
var AdvancedDateRangePicker_module_default = { "root": "AdvancedDateRangePicker-module__root___udir8", "inner": "AdvancedDateRangePicker-module__inner___P4OHa", "left": "AdvancedDateRangePicker-module__left___T6E84", "sidebarItem": "AdvancedDateRangePicker-module__sidebarItem___-NXPm", "sidebarItemActive": "AdvancedDateRangePicker-module__sidebarItemActive___5GmBY", "main": "AdvancedDateRangePicker-module__main___G4MU9", "header": "AdvancedDateRangePicker-module__header___mxXEE", "timezoneWrapper": "AdvancedDateRangePicker-module__timezoneWrapper___886Qm", "dateTimeWrapper": "AdvancedDateRangePicker-module__dateTimeWrapper___unDQJ", "headerGroup": "AdvancedDateRangePicker-module__headerGroup___J7mJB", "headerLabel": "AdvancedDateRangePicker-module__headerLabel___Yvhkr", "headerSeparator": "AdvancedDateRangePicker-module__headerSeparator___Vwx6P", "timezoneSelect": "AdvancedDateRangePicker-module__timezoneSelect___f4oln", "timezoneSelectContainer": "AdvancedDateRangePicker-module__timezoneSelectContainer___8SMc4", "timezoneSelectInput": "AdvancedDateRangePicker-module__timezoneSelectInput___ol0-7", "timezoneDisabledBadge": "AdvancedDateRangePicker-module__timezoneDisabledBadge___VBxOd", "inputWrapper": "AdvancedDateRangePicker-module__inputWrapper___bFFNF", "dateTimeColumn": "AdvancedDateRangePicker-module__dateTimeColumn___tdDV3", "dateTimeGroup": "AdvancedDateRangePicker-module__dateTimeGroup___azF09", "dateInput": "AdvancedDateRangePicker-module__dateInput___0t9ww", "inputError": "AdvancedDateRangePicker-module__inputError___A5hid", "timeInput": "AdvancedDateRangePicker-module__timeInput___Jalr9", "errorMessage": "AdvancedDateRangePicker-module__errorMessage___gx7ag", "body": "AdvancedDateRangePicker-module__body___f8XYj", "footer": "AdvancedDateRangePicker-module__footer___rsJ2w", "doneBtn": "AdvancedDateRangePicker-module__doneBtn___mt-Sv" };
|
|
74
74
|
|
|
75
75
|
// src/atom/AdvancedDateRangePicker/InternalCalendar.tsx
|
|
76
76
|
var import_react = require("react");
|
|
@@ -316,14 +316,14 @@ var InternalCalendar = ({
|
|
|
316
316
|
] }) }),
|
|
317
317
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tw-grid tw-grid-cols-7 tw-mb-2", children: dayNames.map((day) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tw-py-2 tw-text-center tw-typography-caption2 tw-text-gray-500", children: day }, day)) }),
|
|
318
318
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tw-grid tw-grid-cols-7", children: days.map((date, index) => {
|
|
319
|
-
if (!date) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tw-h-
|
|
319
|
+
if (!date) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tw-h-7" }, index);
|
|
320
320
|
const isStart = isSameDate(date, startDate);
|
|
321
321
|
const isEnd = isSameDate(date, endDate);
|
|
322
322
|
const isInRange = isDateBetweenRange(date);
|
|
323
323
|
const isSelected = isDateInRange(date);
|
|
324
324
|
const isDisabled = isDateDisabled(date);
|
|
325
325
|
const isHovering = isSelectingEnd && hoverDate && isSameDate(date, hoverDate);
|
|
326
|
-
let cellClasses = "tw-relative tw-z-20 tw-h-
|
|
326
|
+
let cellClasses = "tw-relative tw-z-20 tw-h-7 tw-w-7 tw-flex tw-items-center tw-justify-center tw-typography-caption1Bold tw-cursor-pointer tw-transition-all ";
|
|
327
327
|
if (isDisabled) {
|
|
328
328
|
cellClasses += "tw-text-gray-300 tw-cursor-not-allowed ";
|
|
329
329
|
} else if (isStart || isEnd) {
|
|
@@ -337,9 +337,9 @@ var InternalCalendar = ({
|
|
|
337
337
|
cellClasses += "tw-border-2 tw-border-gray-400 tw-border-dashed ";
|
|
338
338
|
}
|
|
339
339
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "tw-relative tw-flex tw-justify-center", children: [
|
|
340
|
-
isInRange && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tw-absolute tw-inset-y-1 tw-inset-x-0 tw-bg-[#
|
|
341
|
-
isStart && endDate && !isSameDate(startDate, endDate) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tw-absolute tw-inset-y-1 tw-right-0 tw-left-1/2 tw-bg-[#
|
|
342
|
-
isEnd && startDate && !isSameDate(startDate, endDate) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tw-absolute tw-inset-y-1 tw-left-0 tw-right-1/2 tw-bg-[#
|
|
340
|
+
isInRange && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tw-absolute tw-inset-y-1 tw-inset-x-0 tw-bg-[#E5E9ED] tw-z-10" }),
|
|
341
|
+
isStart && endDate && !isSameDate(startDate, endDate) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tw-absolute tw-inset-y-1 tw-right-0 tw-left-1/2 tw-bg-[#E5E9ED] tw-z-10" }),
|
|
342
|
+
isEnd && startDate && !isSameDate(startDate, endDate) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "tw-absolute tw-inset-y-1 tw-left-0 tw-right-1/2 tw-bg-[#E5E9ED] tw-z-10" }),
|
|
343
343
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
344
344
|
"div",
|
|
345
345
|
{
|
|
@@ -380,8 +380,819 @@ var InternalCalendar = ({
|
|
|
380
380
|
};
|
|
381
381
|
var InternalCalendar_default = (0, import_react.memo)(InternalCalendar);
|
|
382
382
|
|
|
383
|
-
// src/atom/
|
|
383
|
+
// src/atom/Button/Button.tsx
|
|
384
|
+
var import_antd = require("antd");
|
|
385
|
+
var import_clsx = __toESM(require("clsx"));
|
|
386
|
+
|
|
387
|
+
// src/atom/Button/Button.module.scss
|
|
388
|
+
var Button_module_default = { "button": "Button-module__button___cLCyl", "size_large": "Button-module__size_large___S-mbU", "shape_circle": "Button-module__shape_circle___sPUS5", "size_normal": "Button-module__size_normal___qJUMj", "size_small": "Button-module__size_small___IUeei", "type_primary": "Button-module__type_primary___Tauz-", "variant_subtle": "Button-module__variant_subtle___BMbbd", "variant_text": "Button-module__variant_text___Pc5Ia", "variant_link": "Button-module__variant_link___Cj1O9", "disabled": "Button-module__disabled___nwPn4", "type_secondary": "Button-module__type_secondary___CLmrA", "type_critical": "Button-module__type_critical___6ILOp", "onHoverUnderline": "Button-module__onHoverUnderline___LOfXo" };
|
|
389
|
+
|
|
390
|
+
// src/atom/Button/Button.tsx
|
|
384
391
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
392
|
+
function Button(props) {
|
|
393
|
+
const {
|
|
394
|
+
type = "primary",
|
|
395
|
+
variant = "default",
|
|
396
|
+
size = "normal",
|
|
397
|
+
shape = "default",
|
|
398
|
+
className = "",
|
|
399
|
+
icon = null,
|
|
400
|
+
children,
|
|
401
|
+
onClick,
|
|
402
|
+
href = "",
|
|
403
|
+
disabled = false,
|
|
404
|
+
loading = false,
|
|
405
|
+
onHoverUnderline = false
|
|
406
|
+
} = props;
|
|
407
|
+
const buttonMap = {
|
|
408
|
+
default: "primary",
|
|
409
|
+
subtle: "default",
|
|
410
|
+
text: "text",
|
|
411
|
+
link: "link"
|
|
412
|
+
};
|
|
413
|
+
const sizeMap = {
|
|
414
|
+
small: "small",
|
|
415
|
+
normal: "middle",
|
|
416
|
+
// Map "default" to "middle"
|
|
417
|
+
large: "large"
|
|
418
|
+
};
|
|
419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
420
|
+
import_antd.Button,
|
|
421
|
+
{
|
|
422
|
+
className: (0, import_clsx.default)(
|
|
423
|
+
Button_module_default.button,
|
|
424
|
+
Button_module_default[`size_${size}`],
|
|
425
|
+
Button_module_default[`variant_${variant}`],
|
|
426
|
+
Button_module_default[`shape_${shape}`],
|
|
427
|
+
Button_module_default[`type_${type}`],
|
|
428
|
+
`size_${size}`,
|
|
429
|
+
`variant_${variant}`,
|
|
430
|
+
`shape_${shape}`,
|
|
431
|
+
`type_${type}`,
|
|
432
|
+
className,
|
|
433
|
+
{
|
|
434
|
+
"tw-cursor-not-allowed": disabled,
|
|
435
|
+
"tw-opacity-40": disabled
|
|
436
|
+
},
|
|
437
|
+
disabled && Button_module_default.disabled,
|
|
438
|
+
onHoverUnderline && Button_module_default.onHoverUnderline
|
|
439
|
+
),
|
|
440
|
+
"data-testid": "lumina-button",
|
|
441
|
+
disabled,
|
|
442
|
+
href: href || void 0,
|
|
443
|
+
icon,
|
|
444
|
+
loading,
|
|
445
|
+
onClick,
|
|
446
|
+
shape,
|
|
447
|
+
size: sizeMap[size],
|
|
448
|
+
type: buttonMap[variant],
|
|
449
|
+
children
|
|
450
|
+
}
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
Button.displayName = "Button";
|
|
454
|
+
var Button_default = Button;
|
|
455
|
+
|
|
456
|
+
// src/atom/Select/Select.tsx
|
|
457
|
+
var import_react3 = require("react");
|
|
458
|
+
var import_clsx2 = __toESM(require("clsx"));
|
|
459
|
+
|
|
460
|
+
// src/icons/Chevron.tsx
|
|
461
|
+
var React2 = __toESM(require("react"));
|
|
462
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
463
|
+
var Chevron2 = React2.memo(
|
|
464
|
+
(_a) => {
|
|
465
|
+
var _b = _a, { size = 16, color = "#6b7280", className } = _b, rest = __objRest(_b, ["size", "color", "className"]);
|
|
466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
467
|
+
"svg",
|
|
468
|
+
__spreadProps(__spreadValues({
|
|
469
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
470
|
+
width: size,
|
|
471
|
+
height: size,
|
|
472
|
+
fill: "none",
|
|
473
|
+
viewBox: "0 0 16 16",
|
|
474
|
+
className
|
|
475
|
+
}, rest), {
|
|
476
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
477
|
+
"path",
|
|
478
|
+
{
|
|
479
|
+
fill: color,
|
|
480
|
+
d: "M11.78 6.22a.75.75 0 00-1.06 0L8 8.94 5.28 6.22a.75.75 0 00-1.06 1.06l3.25 3.25a.75.75 0 001.06 0l3.25-3.25a.75.75 0 000-1.06z"
|
|
481
|
+
}
|
|
482
|
+
)
|
|
483
|
+
})
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
);
|
|
487
|
+
Chevron2.displayName = "Chevron";
|
|
488
|
+
|
|
489
|
+
// src/icons/CrossV2.tsx
|
|
490
|
+
var React3 = __toESM(require("react"));
|
|
491
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
492
|
+
var CrossV2 = React3.memo(
|
|
493
|
+
(_a) => {
|
|
494
|
+
var _b = _a, { size = 16, color = "#111827", className } = _b, rest = __objRest(_b, ["size", "color", "className"]);
|
|
495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
496
|
+
"svg",
|
|
497
|
+
__spreadProps(__spreadValues({
|
|
498
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
499
|
+
width: size,
|
|
500
|
+
height: size,
|
|
501
|
+
fill: "none",
|
|
502
|
+
viewBox: "0 0 20 20"
|
|
503
|
+
}, rest), {
|
|
504
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
505
|
+
"path",
|
|
506
|
+
{
|
|
507
|
+
fill: color,
|
|
508
|
+
d: "M4.411 4.41a.833.833 0 0 1 1.179 0L10 8.822l4.411-4.41a.833.833 0 1 1 1.179 1.178L11.179 10l4.41 4.41a.833.833 0 0 1-1.178 1.18l-4.41-4.411-4.411 4.41a.833.833 0 1 1-1.179-1.178L8.821 10l-4.41-4.41a.833.833 0 0 1 0-1.18"
|
|
509
|
+
}
|
|
510
|
+
)
|
|
511
|
+
})
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
);
|
|
515
|
+
CrossV2.displayName = "CrossV2";
|
|
516
|
+
|
|
517
|
+
// src/icons/Lock.tsx
|
|
518
|
+
var import_react2 = __toESM(require("react"));
|
|
519
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
520
|
+
var Lock = import_react2.default.memo((_a) => {
|
|
521
|
+
var _b = _a, { size = 16, color = "#000" } = _b, rest = __objRest(_b, ["size", "color"]);
|
|
522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
523
|
+
"svg",
|
|
524
|
+
__spreadProps(__spreadValues({
|
|
525
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
526
|
+
width: size,
|
|
527
|
+
height: size,
|
|
528
|
+
fill: "none",
|
|
529
|
+
viewBox: "0 0 16 16"
|
|
530
|
+
}, rest), {
|
|
531
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
532
|
+
"path",
|
|
533
|
+
{
|
|
534
|
+
fill: color,
|
|
535
|
+
d: "M9 9a1 1 0 11-2 0 1 1 0 012 0zM5 4h-.5A2.5 2.5 0 002 6.5v5A2.5 2.5 0 004.5 14h7a2.5 2.5 0 002.5-2.5v-5A2.5 2.5 0 0011.5 4H11v-.5a3 3 0 00-6 0V4zm1-.5a2 2 0 114 0V4H6v-.5zM11.5 5A1.5 1.5 0 0113 6.5v5a1.5 1.5 0 01-1.5 1.5h-7A1.5 1.5 0 013 11.5v-5A1.5 1.5 0 014.5 5h7z"
|
|
536
|
+
}
|
|
537
|
+
)
|
|
538
|
+
})
|
|
539
|
+
);
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
// src/atom/Tooltip/Tooltip.tsx
|
|
543
|
+
var import_antd2 = require("antd");
|
|
544
|
+
|
|
545
|
+
// src/atom/Tooltip/Tooltip.module.scss
|
|
546
|
+
var Tooltip_module_default = { "light": "Tooltip-module__light___H5oCc" };
|
|
547
|
+
|
|
548
|
+
// src/atom/Tooltip/Tooltip.tsx
|
|
549
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
550
|
+
var Tooltip = (_a) => {
|
|
551
|
+
var _b = _a, {
|
|
552
|
+
children,
|
|
553
|
+
title = "",
|
|
554
|
+
placement = "top",
|
|
555
|
+
color = "#1F2937",
|
|
556
|
+
className,
|
|
557
|
+
mode = "dark"
|
|
558
|
+
} = _b, rest = __objRest(_b, [
|
|
559
|
+
"children",
|
|
560
|
+
"title",
|
|
561
|
+
"placement",
|
|
562
|
+
"color",
|
|
563
|
+
"className",
|
|
564
|
+
"mode"
|
|
565
|
+
]);
|
|
566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
567
|
+
import_antd2.Tooltip,
|
|
568
|
+
__spreadProps(__spreadValues({
|
|
569
|
+
className,
|
|
570
|
+
color,
|
|
571
|
+
title,
|
|
572
|
+
placement,
|
|
573
|
+
overlayClassName: mode === "light" ? Tooltip_module_default.light : ""
|
|
574
|
+
}, rest), {
|
|
575
|
+
children
|
|
576
|
+
})
|
|
577
|
+
);
|
|
578
|
+
};
|
|
579
|
+
Tooltip.displayName = "Tooltip";
|
|
580
|
+
var Tooltip_default = Tooltip;
|
|
581
|
+
|
|
582
|
+
// src/atom/LoadingSpinner/LoadingSpinner.tsx
|
|
583
|
+
var import_icons = require("@ant-design/icons");
|
|
584
|
+
var import_antd3 = require("antd");
|
|
585
|
+
|
|
586
|
+
// src/atom/LoadingSpinner/LoadingSpinner.module.scss
|
|
587
|
+
var LoadingSpinner_module_default = { "spinnerContainer": "LoadingSpinner-module__spinnerContainer___DiPLf" };
|
|
588
|
+
|
|
589
|
+
// src/atom/LoadingSpinner/LoadingSpinner.tsx
|
|
590
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
591
|
+
var sizeMapping = {
|
|
592
|
+
xs: 16,
|
|
593
|
+
small: 24,
|
|
594
|
+
medium: 36,
|
|
595
|
+
large: 48
|
|
596
|
+
};
|
|
597
|
+
var LoadingSpinner = (_a) => {
|
|
598
|
+
var _b = _a, { size = "small", color = "#ec5d25" } = _b, rest = __objRest(_b, ["size", "color"]);
|
|
599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", __spreadProps(__spreadValues({ className: LoadingSpinner_module_default.spinnerContainer }, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
600
|
+
import_antd3.Spin,
|
|
601
|
+
{
|
|
602
|
+
indicator: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
603
|
+
import_icons.LoadingOutlined,
|
|
604
|
+
{
|
|
605
|
+
style: { fontSize: sizeMapping[size], color },
|
|
606
|
+
spin: true
|
|
607
|
+
}
|
|
608
|
+
)
|
|
609
|
+
}
|
|
610
|
+
) }));
|
|
611
|
+
};
|
|
612
|
+
LoadingSpinner.displayName = "LoadingSpinner";
|
|
613
|
+
var LoadingSpinner_default = LoadingSpinner;
|
|
614
|
+
|
|
615
|
+
// src/atom/Select/Select.tsx
|
|
616
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
617
|
+
var InputWrapper = (0, import_react3.memo)(({ children, disabled, disabledTooltip }) => {
|
|
618
|
+
if (disabled && disabledTooltip)
|
|
619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Tooltip_default, { title: disabledTooltip, children });
|
|
620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children });
|
|
621
|
+
});
|
|
622
|
+
var OptionItem = (0, import_react3.memo)(({
|
|
623
|
+
option,
|
|
624
|
+
index,
|
|
625
|
+
isSelected,
|
|
626
|
+
isHighlighted,
|
|
627
|
+
experience,
|
|
628
|
+
size,
|
|
629
|
+
optionClassName,
|
|
630
|
+
onSelectHandler,
|
|
631
|
+
onMouseEnterHandler
|
|
632
|
+
}) => {
|
|
633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
634
|
+
"div",
|
|
635
|
+
{
|
|
636
|
+
onClick: () => onSelectHandler(option),
|
|
637
|
+
onMouseEnter: () => onMouseEnterHandler(index),
|
|
638
|
+
className: (0, import_clsx2.default)(
|
|
639
|
+
"tw-transition-all tw-duration-150",
|
|
640
|
+
{ "tw-typography-body2": size !== "small" },
|
|
641
|
+
{ "tw-typography-caption1": size === "small" },
|
|
642
|
+
optionClassName
|
|
643
|
+
),
|
|
644
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
645
|
+
"div",
|
|
646
|
+
{
|
|
647
|
+
className: (0, import_clsx2.default)(
|
|
648
|
+
"tw-px-4 tw-cursor-pointer tw-py-2 tw-mx-0.5 tw-rounded-xl",
|
|
649
|
+
isSelected ? experience === "personal" ? "tw-bg-[#f1e8fa]" : "tw-bg-[#fff1e1]" : isHighlighted ? "tw-bg-[#f3f4f6] tw-text-gray-900" : "tw-text-gray-900 hover:tw-bg-[#1118270a]"
|
|
650
|
+
),
|
|
651
|
+
children: option.label
|
|
652
|
+
}
|
|
653
|
+
)
|
|
654
|
+
}
|
|
655
|
+
);
|
|
656
|
+
});
|
|
657
|
+
var Select = ({
|
|
658
|
+
label,
|
|
659
|
+
mandatory = false,
|
|
660
|
+
error = false,
|
|
661
|
+
options = [],
|
|
662
|
+
valueSelected = "",
|
|
663
|
+
// Keep for backward compatibility
|
|
664
|
+
value: _valueProp,
|
|
665
|
+
// Rename to avoid potential conflicts with native value attribute
|
|
666
|
+
onChange,
|
|
667
|
+
onSearch,
|
|
668
|
+
isLoading = false,
|
|
669
|
+
disabled = false,
|
|
670
|
+
disabledTooltip = "",
|
|
671
|
+
className = "",
|
|
672
|
+
dropdownClassName = "",
|
|
673
|
+
optionClassName = "",
|
|
674
|
+
style = {},
|
|
675
|
+
showDisplayValue = false,
|
|
676
|
+
// New prop to show displayValue instead of label
|
|
677
|
+
allowClear = true,
|
|
678
|
+
enableSearch = true,
|
|
679
|
+
doubleCharSearch = false,
|
|
680
|
+
id,
|
|
681
|
+
name,
|
|
682
|
+
tabIndex,
|
|
683
|
+
// Add tabIndex prop
|
|
684
|
+
// Additional styling props
|
|
685
|
+
size = "default",
|
|
686
|
+
// 'small', 'default', 'large'
|
|
687
|
+
variant = "default",
|
|
688
|
+
// 'default', 'filled', 'outlined'
|
|
689
|
+
wrapperClassName = "",
|
|
690
|
+
inputClassName = "",
|
|
691
|
+
// Custom class for input element specifically
|
|
692
|
+
labelClassName = "",
|
|
693
|
+
// Custom class for label element specifically
|
|
694
|
+
height = "tw-h-12",
|
|
695
|
+
// Custom height
|
|
696
|
+
experience = "business"
|
|
697
|
+
}) => {
|
|
698
|
+
const normalizeValue = (0, import_react3.useCallback)(
|
|
699
|
+
(val) => {
|
|
700
|
+
if (val === null || val === void 0) return "";
|
|
701
|
+
return String(val);
|
|
702
|
+
},
|
|
703
|
+
[]
|
|
704
|
+
);
|
|
705
|
+
const validatedOptions = (0, import_react3.useMemo)(() => {
|
|
706
|
+
if (!Array.isArray(options)) return [];
|
|
707
|
+
return options.filter(
|
|
708
|
+
(opt) => opt && typeof opt === "object" && opt.value !== void 0 && opt.value !== null && opt.label !== void 0
|
|
709
|
+
);
|
|
710
|
+
}, [options]);
|
|
711
|
+
const [isOpen, setIsOpen] = (0, import_react3.useState)(false);
|
|
712
|
+
const [isFocused, setIsFocused] = (0, import_react3.useState)(false);
|
|
713
|
+
const [searchTerm, setSearchTerm] = (0, import_react3.useState)("");
|
|
714
|
+
const [isHovering, setIsHovering] = (0, import_react3.useState)(false);
|
|
715
|
+
const [highlightedIndex, setHighlightedIndex] = (0, import_react3.useState)(-1);
|
|
716
|
+
const [selectedValue, setSelectedValue] = (0, import_react3.useState)(() => {
|
|
717
|
+
const initialValue = valueSelected;
|
|
718
|
+
if (initialValue === null || initialValue === void 0) return "";
|
|
719
|
+
return String(initialValue);
|
|
720
|
+
});
|
|
721
|
+
const inputRef = (0, import_react3.useRef)(null);
|
|
722
|
+
const inputValueRef = (0, import_react3.useRef)("");
|
|
723
|
+
const dropdownRef = (0, import_react3.useRef)(null);
|
|
724
|
+
const optionRefs = (0, import_react3.useRef)([]);
|
|
725
|
+
const optionListRef = (0, import_react3.useRef)(null);
|
|
726
|
+
const blurTimeoutRef = (0, import_react3.useRef)(null);
|
|
727
|
+
const hoverTimeoutRef = (0, import_react3.useRef)(null);
|
|
728
|
+
const isActive = isFocused || Boolean(selectedValue) || Boolean(valueSelected) || Boolean(searchTerm);
|
|
729
|
+
const sizeClasses = (0, import_react3.useMemo)(() => {
|
|
730
|
+
switch (size) {
|
|
731
|
+
case "small":
|
|
732
|
+
return {
|
|
733
|
+
input: "tw-h-6 tw-typography-caption1Bold !tw-rounded-lg",
|
|
734
|
+
padding: "tw-px-2 tw-py-1",
|
|
735
|
+
labelActive: "tw-top-0.5 tw-typography-caption2",
|
|
736
|
+
labelInactive: "tw-top-1.5 tw-typography-caption3"
|
|
737
|
+
};
|
|
738
|
+
case "medium":
|
|
739
|
+
return {
|
|
740
|
+
input: "tw-h-10 tw-px-4 tw-typography-body2",
|
|
741
|
+
padding: label ? "tw-pt-4 tw-pb-1" : "tw-py-2",
|
|
742
|
+
labelActive: "tw-top-1 tw-typography-caption3",
|
|
743
|
+
labelInactive: "tw-top-2.5 tw-typography-body2"
|
|
744
|
+
};
|
|
745
|
+
case "large":
|
|
746
|
+
return {
|
|
747
|
+
input: "tw-h-16 tw-px-5 tw-typography-bodyLarge",
|
|
748
|
+
padding: label ? "tw-pt-8 tw-pb-4" : "tw-py-5",
|
|
749
|
+
labelActive: "tw-top-1 tw-typography-caption2",
|
|
750
|
+
labelInactive: "tw-top-5 tw-typography-body1"
|
|
751
|
+
};
|
|
752
|
+
default:
|
|
753
|
+
return {
|
|
754
|
+
input: height + " tw-px-4 tw-typography-bodyLarge",
|
|
755
|
+
padding: label ? "tw-pt-6 tw-pb-3" : "tw-py-3",
|
|
756
|
+
labelActive: "tw-top-1 tw-typography-caption3",
|
|
757
|
+
labelInactive: "tw-top-3.5 tw-typography-body2"
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
}, [size, label, height]);
|
|
761
|
+
const variantClasses = (0, import_react3.useMemo)(() => {
|
|
762
|
+
switch (variant) {
|
|
763
|
+
case "filled":
|
|
764
|
+
return "tw-bg-gray-50 tw-border-transparent";
|
|
765
|
+
case "outlined":
|
|
766
|
+
return "tw-bg-transparent tw-border-2";
|
|
767
|
+
default:
|
|
768
|
+
return " tw-border";
|
|
769
|
+
}
|
|
770
|
+
}, [variant]);
|
|
771
|
+
const handleBlur = (0, import_react3.useCallback)(() => {
|
|
772
|
+
blurTimeoutRef.current = setTimeout(() => {
|
|
773
|
+
setIsOpen(false);
|
|
774
|
+
setSearchTerm("");
|
|
775
|
+
setHighlightedIndex(-1);
|
|
776
|
+
blurTimeoutRef.current = null;
|
|
777
|
+
setIsFocused(false);
|
|
778
|
+
}, 150);
|
|
779
|
+
}, []);
|
|
780
|
+
const handleSearchChange = (0, import_react3.useCallback)(
|
|
781
|
+
(e) => {
|
|
782
|
+
var _a;
|
|
783
|
+
const searchValue = doubleCharSearch ? e.target.value.slice(0, 2) || "" : e.target.value;
|
|
784
|
+
if (doubleCharSearch) {
|
|
785
|
+
setSearchTerm(searchValue);
|
|
786
|
+
} else {
|
|
787
|
+
setSearchTerm(searchValue);
|
|
788
|
+
}
|
|
789
|
+
setIsOpen(true);
|
|
790
|
+
setHighlightedIndex(-1);
|
|
791
|
+
if (onSearch && typeof onSearch === "function") {
|
|
792
|
+
onSearch(searchValue);
|
|
793
|
+
}
|
|
794
|
+
(_a = optionListRef == null ? void 0 : optionListRef.current) == null ? void 0 : _a.scrollTo({
|
|
795
|
+
top: 0,
|
|
796
|
+
behavior: "smooth"
|
|
797
|
+
});
|
|
798
|
+
},
|
|
799
|
+
[doubleCharSearch, onSearch]
|
|
800
|
+
);
|
|
801
|
+
const handleOptionSelect = (0, import_react3.useCallback)(
|
|
802
|
+
(option) => {
|
|
803
|
+
var _a;
|
|
804
|
+
if (blurTimeoutRef.current) {
|
|
805
|
+
clearTimeout(blurTimeoutRef.current);
|
|
806
|
+
blurTimeoutRef.current = null;
|
|
807
|
+
}
|
|
808
|
+
inputValueRef.current = option.label;
|
|
809
|
+
const normalizedValue = normalizeValue(option.value);
|
|
810
|
+
setSelectedValue(normalizedValue);
|
|
811
|
+
setSearchTerm("");
|
|
812
|
+
setIsOpen(false);
|
|
813
|
+
if (enableSearch) {
|
|
814
|
+
setIsFocused(false);
|
|
815
|
+
}
|
|
816
|
+
setIsHovering(false);
|
|
817
|
+
if (onChange) onChange(option.value);
|
|
818
|
+
if (enableSearch) (_a = inputRef.current) == null ? void 0 : _a.blur();
|
|
819
|
+
},
|
|
820
|
+
[normalizeValue, onChange, enableSearch]
|
|
821
|
+
);
|
|
822
|
+
const handleClear = (0, import_react3.useCallback)(
|
|
823
|
+
(e) => {
|
|
824
|
+
var _a;
|
|
825
|
+
inputValueRef.current = "";
|
|
826
|
+
e.stopPropagation();
|
|
827
|
+
e.preventDefault();
|
|
828
|
+
setSelectedValue("");
|
|
829
|
+
setSearchTerm("");
|
|
830
|
+
if (enableSearch) {
|
|
831
|
+
setIsOpen(true);
|
|
832
|
+
setIsFocused(true);
|
|
833
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
834
|
+
} else {
|
|
835
|
+
setIsOpen(false);
|
|
836
|
+
setIsFocused(false);
|
|
837
|
+
}
|
|
838
|
+
if (onChange) onChange(null);
|
|
839
|
+
},
|
|
840
|
+
[onChange, enableSearch]
|
|
841
|
+
);
|
|
842
|
+
(0, import_react3.useEffect)(() => {
|
|
843
|
+
if (!validatedOptions.length) {
|
|
844
|
+
setSelectedValue("");
|
|
845
|
+
setSearchTerm("");
|
|
846
|
+
inputValueRef.current = "";
|
|
847
|
+
}
|
|
848
|
+
}, [validatedOptions.length]);
|
|
849
|
+
(0, import_react3.useEffect)(() => {
|
|
850
|
+
const externalValue = _valueProp !== void 0 ? _valueProp : valueSelected;
|
|
851
|
+
const newValue = normalizeValue(externalValue);
|
|
852
|
+
setSelectedValue((prevValue) => {
|
|
853
|
+
const prevNormalized = normalizeValue(prevValue);
|
|
854
|
+
return prevNormalized !== newValue ? newValue : prevValue;
|
|
855
|
+
});
|
|
856
|
+
}, [valueSelected, _valueProp, normalizeValue]);
|
|
857
|
+
(0, import_react3.useEffect)(() => {
|
|
858
|
+
const handleClickOutside = (event) => {
|
|
859
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
860
|
+
if (blurTimeoutRef.current) {
|
|
861
|
+
clearTimeout(blurTimeoutRef.current);
|
|
862
|
+
blurTimeoutRef.current = null;
|
|
863
|
+
}
|
|
864
|
+
setIsOpen(false);
|
|
865
|
+
setIsFocused(false);
|
|
866
|
+
setSearchTerm("");
|
|
867
|
+
setHighlightedIndex(-1);
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
871
|
+
return () => {
|
|
872
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
873
|
+
if (blurTimeoutRef.current) {
|
|
874
|
+
clearTimeout(blurTimeoutRef.current);
|
|
875
|
+
}
|
|
876
|
+
if (hoverTimeoutRef.current) {
|
|
877
|
+
clearTimeout(hoverTimeoutRef.current);
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
}, []);
|
|
881
|
+
const getDisplayValue = (0, import_react3.useCallback)(() => {
|
|
882
|
+
if (selectedValue && (validatedOptions == null ? void 0 : validatedOptions.length) > 0) {
|
|
883
|
+
const selected = validatedOptions.find(
|
|
884
|
+
(opt) => normalizeValue(opt.value) === normalizeValue(selectedValue)
|
|
885
|
+
);
|
|
886
|
+
if (selected) {
|
|
887
|
+
return showDisplayValue && selected.displayValue ? selected.displayValue : selected.label;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
if (selectedValue && (!validatedOptions || validatedOptions.length === 0)) {
|
|
891
|
+
return selectedValue;
|
|
892
|
+
}
|
|
893
|
+
return "";
|
|
894
|
+
}, [selectedValue, validatedOptions, showDisplayValue, normalizeValue]);
|
|
895
|
+
const displayValue = (0, import_react3.useMemo)(() => getDisplayValue(), [getDisplayValue]);
|
|
896
|
+
const inputClasses = (0, import_react3.useMemo)(() => {
|
|
897
|
+
return (0, import_clsx2.default)(
|
|
898
|
+
"tw-w-full tw-rounded-xl tw-outline-none tw-transition-all tw-duration-200 tw-cursor-pointer tw-border-solid tw-text-color-text-default",
|
|
899
|
+
sizeClasses.input,
|
|
900
|
+
sizeClasses.padding,
|
|
901
|
+
variantClasses,
|
|
902
|
+
{
|
|
903
|
+
"tw-bg-white": valueSelected || displayValue || isFocused,
|
|
904
|
+
"tw-bg-color-gray-5": !valueSelected || !displayValue,
|
|
905
|
+
"!tw-bg-[#F8F7F6] tw-cursor-not-allowed tw-pointer-events-none": disabled
|
|
906
|
+
},
|
|
907
|
+
!label && "tw-flex tw-items-center",
|
|
908
|
+
{
|
|
909
|
+
"!tw-border-color-primary": isFocused && experience === "business"
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
"!tw-border-[#804D7B]": isFocused && experience === "personal"
|
|
913
|
+
},
|
|
914
|
+
error ? "!tw-border-color-text-critical " : "tw-border-[#EBE3DD] hover:tw-border-[#C5B7AC]",
|
|
915
|
+
"focus:tw-shadow-sm focus:tw-ring-offset-1",
|
|
916
|
+
className,
|
|
917
|
+
inputClassName
|
|
918
|
+
);
|
|
919
|
+
}, [sizeClasses, variantClasses, valueSelected, displayValue, isFocused, disabled, label, experience, error, className, inputClassName]);
|
|
920
|
+
const filteredOptions = (0, import_react3.useMemo)(() => {
|
|
921
|
+
var _a;
|
|
922
|
+
if (!enableSearch) {
|
|
923
|
+
return validatedOptions;
|
|
924
|
+
}
|
|
925
|
+
(_a = dropdownRef.current) == null ? void 0 : _a.scrollTo(0, 0);
|
|
926
|
+
const updatedFilteredOptions = validatedOptions.filter((option) => {
|
|
927
|
+
var _a2;
|
|
928
|
+
return (_a2 = option == null ? void 0 : option.label) == null ? void 0 : _a2.toLowerCase().includes(searchTerm == null ? void 0 : searchTerm.toLowerCase());
|
|
929
|
+
});
|
|
930
|
+
return updatedFilteredOptions;
|
|
931
|
+
}, [validatedOptions, searchTerm, enableSearch]);
|
|
932
|
+
const getSelectedOptionIndex = (0, import_react3.useCallback)(() => {
|
|
933
|
+
if (!selectedValue || !filteredOptions.length) {
|
|
934
|
+
return 0;
|
|
935
|
+
}
|
|
936
|
+
const index = filteredOptions.findIndex(
|
|
937
|
+
(option) => normalizeValue(option.value) === normalizeValue(selectedValue)
|
|
938
|
+
);
|
|
939
|
+
return index >= 0 ? index : 0;
|
|
940
|
+
}, [selectedValue, filteredOptions, normalizeValue]);
|
|
941
|
+
const handleInputInteraction = (0, import_react3.useCallback)(
|
|
942
|
+
(_e) => {
|
|
943
|
+
var _a;
|
|
944
|
+
if (blurTimeoutRef.current) {
|
|
945
|
+
clearTimeout(blurTimeoutRef.current);
|
|
946
|
+
blurTimeoutRef.current = null;
|
|
947
|
+
}
|
|
948
|
+
if (isOpen) {
|
|
949
|
+
setIsOpen(false);
|
|
950
|
+
setIsFocused(false);
|
|
951
|
+
setSearchTerm("");
|
|
952
|
+
setHighlightedIndex(-1);
|
|
953
|
+
(_a = inputRef.current) == null ? void 0 : _a.blur();
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
setIsFocused(true);
|
|
957
|
+
setIsOpen(true);
|
|
958
|
+
setHighlightedIndex(getSelectedOptionIndex());
|
|
959
|
+
if (inputRef.current) {
|
|
960
|
+
inputRef.current.focus();
|
|
961
|
+
}
|
|
962
|
+
},
|
|
963
|
+
[isOpen, getSelectedOptionIndex]
|
|
964
|
+
);
|
|
965
|
+
const handleKeyDown = (0, import_react3.useCallback)(
|
|
966
|
+
(e) => {
|
|
967
|
+
var _a;
|
|
968
|
+
if (!isOpen) return;
|
|
969
|
+
switch (e.key) {
|
|
970
|
+
case "ArrowDown":
|
|
971
|
+
e.preventDefault();
|
|
972
|
+
setHighlightedIndex((prev) => {
|
|
973
|
+
const nextIndex = prev < filteredOptions.length - 1 ? prev + 1 : prev;
|
|
974
|
+
return nextIndex;
|
|
975
|
+
});
|
|
976
|
+
break;
|
|
977
|
+
case "ArrowUp":
|
|
978
|
+
e.preventDefault();
|
|
979
|
+
setHighlightedIndex((prev) => {
|
|
980
|
+
const nextIndex = prev > 0 ? prev - 1 : prev;
|
|
981
|
+
return nextIndex;
|
|
982
|
+
});
|
|
983
|
+
break;
|
|
984
|
+
case "Enter":
|
|
985
|
+
e.preventDefault();
|
|
986
|
+
if (highlightedIndex >= 0 && filteredOptions[highlightedIndex]) {
|
|
987
|
+
handleOptionSelect(filteredOptions[highlightedIndex]);
|
|
988
|
+
}
|
|
989
|
+
break;
|
|
990
|
+
case "Escape":
|
|
991
|
+
e.preventDefault();
|
|
992
|
+
setIsOpen(false);
|
|
993
|
+
setIsFocused(false);
|
|
994
|
+
setSearchTerm("");
|
|
995
|
+
setHighlightedIndex(-1);
|
|
996
|
+
(_a = inputRef.current) == null ? void 0 : _a.blur();
|
|
997
|
+
break;
|
|
998
|
+
default:
|
|
999
|
+
break;
|
|
1000
|
+
}
|
|
1001
|
+
},
|
|
1002
|
+
[isOpen, highlightedIndex, filteredOptions, handleOptionSelect]
|
|
1003
|
+
);
|
|
1004
|
+
(0, import_react3.useEffect)(() => {
|
|
1005
|
+
if (highlightedIndex >= 0 && optionRefs.current[highlightedIndex]) {
|
|
1006
|
+
optionRefs.current[highlightedIndex].scrollIntoView({
|
|
1007
|
+
block: "nearest",
|
|
1008
|
+
behavior: "smooth"
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
}, [highlightedIndex]);
|
|
1012
|
+
(0, import_react3.useEffect)(() => {
|
|
1013
|
+
optionRefs.current = [];
|
|
1014
|
+
}, [filteredOptions.length]);
|
|
1015
|
+
const handleMouseEnter = (0, import_react3.useCallback)(() => {
|
|
1016
|
+
if (hoverTimeoutRef.current) {
|
|
1017
|
+
clearTimeout(hoverTimeoutRef.current);
|
|
1018
|
+
}
|
|
1019
|
+
if (!isHovering) {
|
|
1020
|
+
setIsHovering(true);
|
|
1021
|
+
}
|
|
1022
|
+
}, [isHovering]);
|
|
1023
|
+
const handleMouseLeave = (0, import_react3.useCallback)(() => {
|
|
1024
|
+
hoverTimeoutRef.current = setTimeout(() => {
|
|
1025
|
+
setIsHovering(false);
|
|
1026
|
+
}, 50);
|
|
1027
|
+
}, []);
|
|
1028
|
+
const handleChevronClick = (0, import_react3.useCallback)(
|
|
1029
|
+
(e) => {
|
|
1030
|
+
var _a;
|
|
1031
|
+
e.preventDefault();
|
|
1032
|
+
if (blurTimeoutRef.current) {
|
|
1033
|
+
clearTimeout(blurTimeoutRef.current);
|
|
1034
|
+
blurTimeoutRef.current = null;
|
|
1035
|
+
}
|
|
1036
|
+
if (isOpen) {
|
|
1037
|
+
setIsOpen(false);
|
|
1038
|
+
setIsFocused(false);
|
|
1039
|
+
setSearchTerm("");
|
|
1040
|
+
setHighlightedIndex(-1);
|
|
1041
|
+
(_a = inputRef.current) == null ? void 0 : _a.blur();
|
|
1042
|
+
} else {
|
|
1043
|
+
if (inputRef.current) {
|
|
1044
|
+
inputRef.current.focus();
|
|
1045
|
+
}
|
|
1046
|
+
handleInputInteraction();
|
|
1047
|
+
}
|
|
1048
|
+
},
|
|
1049
|
+
[isOpen, handleInputInteraction]
|
|
1050
|
+
);
|
|
1051
|
+
const handleChevronMouseDown = (0, import_react3.useCallback)(
|
|
1052
|
+
(e) => {
|
|
1053
|
+
if (isHovering && selectedValue && allowClear) {
|
|
1054
|
+
handleClear(e);
|
|
1055
|
+
} else {
|
|
1056
|
+
handleChevronClick(e);
|
|
1057
|
+
}
|
|
1058
|
+
},
|
|
1059
|
+
[isHovering, selectedValue, allowClear, handleClear, handleChevronClick]
|
|
1060
|
+
);
|
|
1061
|
+
const handleOptionClick = (0, import_react3.useCallback)((option) => {
|
|
1062
|
+
handleOptionSelect(option);
|
|
1063
|
+
}, [handleOptionSelect]);
|
|
1064
|
+
const handleOptionMouseEnter = (0, import_react3.useCallback)((index) => {
|
|
1065
|
+
setHighlightedIndex(index);
|
|
1066
|
+
}, []);
|
|
1067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InputWrapper, { disabled, disabledTooltip, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1068
|
+
"div",
|
|
1069
|
+
{
|
|
1070
|
+
style,
|
|
1071
|
+
className: (0, import_clsx2.default)("tw-relative tw-w-full", wrapperClassName, {
|
|
1072
|
+
"tw-cursor-not-allowed": disabled
|
|
1073
|
+
}),
|
|
1074
|
+
ref: dropdownRef,
|
|
1075
|
+
onMouseEnter: handleMouseEnter,
|
|
1076
|
+
onMouseLeave: handleMouseLeave,
|
|
1077
|
+
children: [
|
|
1078
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "tw-relative", children: [
|
|
1079
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1080
|
+
"input",
|
|
1081
|
+
{
|
|
1082
|
+
ref: inputRef,
|
|
1083
|
+
type: "text",
|
|
1084
|
+
id,
|
|
1085
|
+
name,
|
|
1086
|
+
tabIndex,
|
|
1087
|
+
autoComplete: "off",
|
|
1088
|
+
autoCorrect: "off",
|
|
1089
|
+
autoCapitalize: "off",
|
|
1090
|
+
spellCheck: "false",
|
|
1091
|
+
value: isFocused && enableSearch ? searchTerm : displayValue,
|
|
1092
|
+
onChange: enableSearch ? handleSearchChange : void 0,
|
|
1093
|
+
onClick: handleInputInteraction,
|
|
1094
|
+
onKeyDown: handleKeyDown,
|
|
1095
|
+
className: inputClasses,
|
|
1096
|
+
readOnly: !isFocused || !enableSearch
|
|
1097
|
+
}
|
|
1098
|
+
),
|
|
1099
|
+
label && size !== "small" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1100
|
+
"label",
|
|
1101
|
+
{
|
|
1102
|
+
htmlFor: id,
|
|
1103
|
+
className: (0, import_clsx2.default)(
|
|
1104
|
+
"tw-absolute tw-left-[18px] tw-pointer-events-none tw-transition-all tw-duration-200 tw-ease-out tw-text-gray-500",
|
|
1105
|
+
isActive ? sizeClasses.labelActive : sizeClasses.labelInactive,
|
|
1106
|
+
error && "tw-text-color-text-critical",
|
|
1107
|
+
labelClassName
|
|
1108
|
+
),
|
|
1109
|
+
children: [
|
|
1110
|
+
label,
|
|
1111
|
+
mandatory && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "tw-text-color-text-critical tw-ml-1", children: "*" })
|
|
1112
|
+
]
|
|
1113
|
+
}
|
|
1114
|
+
),
|
|
1115
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1116
|
+
"div",
|
|
1117
|
+
{
|
|
1118
|
+
className: (0, import_clsx2.default)(
|
|
1119
|
+
"tw-absolute tw-right-3 tw--translate-y-1/2 tw-flex tw-items-center",
|
|
1120
|
+
{
|
|
1121
|
+
"!tw-right-[5px]": doubleCharSearch && !(isHovering && selectedValue && allowClear),
|
|
1122
|
+
"tw-top-3 !tw-right-2": size === "small",
|
|
1123
|
+
"tw-top-1/2": size !== "small"
|
|
1124
|
+
}
|
|
1125
|
+
),
|
|
1126
|
+
children: [
|
|
1127
|
+
disabled && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "tw-absolute tw-right-0 -tw-top-2", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Lock, { size: 16 }) }),
|
|
1128
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LoadingSpinner_default, { size: "xs" }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1129
|
+
"div",
|
|
1130
|
+
{
|
|
1131
|
+
className: (0, import_clsx2.default)(
|
|
1132
|
+
"tw-transition-all tw-duration-200 tw-cursor-pointer tw-flex tw-items-center",
|
|
1133
|
+
// Only rotate chevron when open and not showing clear icon
|
|
1134
|
+
isOpen && !(isHovering && selectedValue && allowClear) && "-tw-rotate-180"
|
|
1135
|
+
),
|
|
1136
|
+
onMouseDown: handleChevronMouseDown,
|
|
1137
|
+
children: disabled ? null : isHovering && selectedValue && allowClear ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1138
|
+
CrossV2,
|
|
1139
|
+
{
|
|
1140
|
+
color: "#111827",
|
|
1141
|
+
className: (0, import_clsx2.default)({ "tw-mr-1": size !== "small" }),
|
|
1142
|
+
size: size === "small" ? 12 : 16
|
|
1143
|
+
}
|
|
1144
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1145
|
+
Chevron2,
|
|
1146
|
+
{
|
|
1147
|
+
className: (0, import_clsx2.default)("tw-text-gray-400"),
|
|
1148
|
+
color: "#6B7280"
|
|
1149
|
+
}
|
|
1150
|
+
)
|
|
1151
|
+
}
|
|
1152
|
+
)
|
|
1153
|
+
]
|
|
1154
|
+
}
|
|
1155
|
+
)
|
|
1156
|
+
] }),
|
|
1157
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1158
|
+
"div",
|
|
1159
|
+
{
|
|
1160
|
+
className: (0, import_clsx2.default)(
|
|
1161
|
+
"tw-absolute tw-z-[100] tw-w-full tw-mt-0 tw-bg-white tw-border tw-border-[#ebe3dd] tw-border-solid tw-rounded-xl tw-shadow-lg tw-overflow-y-auto tw-py-1",
|
|
1162
|
+
{ "tw-max-h-60": !doubleCharSearch },
|
|
1163
|
+
{ "tw-max-h-44": doubleCharSearch },
|
|
1164
|
+
dropdownClassName
|
|
1165
|
+
),
|
|
1166
|
+
ref: optionListRef,
|
|
1167
|
+
children: filteredOptions.length > 0 ? filteredOptions.map((option, index) => {
|
|
1168
|
+
const isSelected = normalizeValue(selectedValue) === normalizeValue(option.value);
|
|
1169
|
+
const isHighlighted = index === highlightedIndex;
|
|
1170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { ref: (el) => optionRefs.current[index] = el, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1171
|
+
OptionItem,
|
|
1172
|
+
{
|
|
1173
|
+
option,
|
|
1174
|
+
index,
|
|
1175
|
+
isSelected,
|
|
1176
|
+
isHighlighted,
|
|
1177
|
+
experience,
|
|
1178
|
+
size,
|
|
1179
|
+
optionClassName,
|
|
1180
|
+
onSelectHandler: handleOptionClick,
|
|
1181
|
+
onMouseEnterHandler: handleOptionMouseEnter
|
|
1182
|
+
}
|
|
1183
|
+
) }, doubleCharSearch ? option.label : option.value);
|
|
1184
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "tw-px-4 tw-py-3 tw-text-gray-500 tw-text-sm", children: "No options found" })
|
|
1185
|
+
}
|
|
1186
|
+
)
|
|
1187
|
+
]
|
|
1188
|
+
}
|
|
1189
|
+
) });
|
|
1190
|
+
};
|
|
1191
|
+
Select.displayName = "Select";
|
|
1192
|
+
var Select_default = Select;
|
|
1193
|
+
|
|
1194
|
+
// src/atom/AdvancedDateRangePicker/AdvancedDateRangePicker.tsx
|
|
1195
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
385
1196
|
import_dayjs2.default.extend(import_customParseFormat.default);
|
|
386
1197
|
import_dayjs2.default.extend(import_isSameOrBefore.default);
|
|
387
1198
|
var DEFAULT_TIME = { hour: "12", minute: "00", period: "PM" };
|
|
@@ -517,7 +1328,7 @@ function parseTimeInput(raw) {
|
|
|
517
1328
|
function formatTime(t) {
|
|
518
1329
|
return `${t.hour}:${t.minute} ${t.period}`;
|
|
519
1330
|
}
|
|
520
|
-
var DateTimeInputGroup = (0,
|
|
1331
|
+
var DateTimeInputGroup = (0, import_react4.memo)(function DateTimeInputGroup2({
|
|
521
1332
|
label,
|
|
522
1333
|
dateValue,
|
|
523
1334
|
timeValue,
|
|
@@ -526,27 +1337,30 @@ var DateTimeInputGroup = (0, import_react2.memo)(function DateTimeInputGroup2({
|
|
|
526
1337
|
onDateChange,
|
|
527
1338
|
onTimeChange
|
|
528
1339
|
}) {
|
|
529
|
-
const [isDateFocused, setIsDateFocused] = (0,
|
|
530
|
-
const [isTimeFocused, setIsTimeFocused] = (0,
|
|
1340
|
+
const [isDateFocused, setIsDateFocused] = (0, import_react4.useState)(false);
|
|
1341
|
+
const [isTimeFocused, setIsTimeFocused] = (0, import_react4.useState)(false);
|
|
531
1342
|
const showDateError = dateError && !isDateFocused;
|
|
532
|
-
const showTimeError = timeError && !isTimeFocused
|
|
533
|
-
return /* @__PURE__ */ (0,
|
|
534
|
-
/* @__PURE__ */ (0,
|
|
535
|
-
/* @__PURE__ */ (0,
|
|
536
|
-
/* @__PURE__ */ (0,
|
|
537
|
-
/* @__PURE__ */ (0,
|
|
1343
|
+
const showTimeError = timeError && !isTimeFocused;
|
|
1344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: AdvancedDateRangePicker_module_default.headerGroup, children: [
|
|
1345
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: AdvancedDateRangePicker_module_default.headerLabel, children: label }),
|
|
1346
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: AdvancedDateRangePicker_module_default.dateTimeColumn, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: AdvancedDateRangePicker_module_default.dateTimeGroup, children: [
|
|
1347
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: AdvancedDateRangePicker_module_default.inputWrapper, children: [
|
|
1348
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
538
1349
|
"input",
|
|
539
1350
|
{
|
|
540
1351
|
type: "text",
|
|
541
|
-
placeholder: "
|
|
1352
|
+
placeholder: "dd-mm-yyyy",
|
|
542
1353
|
value: dateValue,
|
|
543
1354
|
onFocus: () => setIsDateFocused(true),
|
|
544
1355
|
onBlur: () => setIsDateFocused(false),
|
|
545
1356
|
onChange: (e) => onDateChange(e.target.value),
|
|
546
|
-
className: (0,
|
|
1357
|
+
className: (0, import_clsx3.default)(AdvancedDateRangePicker_module_default.dateInput, { [AdvancedDateRangePicker_module_default.inputError]: showDateError })
|
|
547
1358
|
}
|
|
548
1359
|
),
|
|
549
|
-
/* @__PURE__ */ (0,
|
|
1360
|
+
showDateError && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: AdvancedDateRangePicker_module_default.errorMessage, children: "Enter valid date" })
|
|
1361
|
+
] }),
|
|
1362
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: AdvancedDateRangePicker_module_default.inputWrapper, children: [
|
|
1363
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
550
1364
|
"input",
|
|
551
1365
|
{
|
|
552
1366
|
type: "text",
|
|
@@ -555,13 +1369,12 @@ var DateTimeInputGroup = (0, import_react2.memo)(function DateTimeInputGroup2({
|
|
|
555
1369
|
onFocus: () => setIsTimeFocused(true),
|
|
556
1370
|
onBlur: () => setIsTimeFocused(false),
|
|
557
1371
|
onChange: (e) => onTimeChange(e.target.value),
|
|
558
|
-
className: (0,
|
|
1372
|
+
className: (0, import_clsx3.default)(AdvancedDateRangePicker_module_default.timeInput, { [AdvancedDateRangePicker_module_default.inputError]: showTimeError })
|
|
559
1373
|
}
|
|
560
|
-
)
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
] })
|
|
1374
|
+
),
|
|
1375
|
+
showTimeError && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: AdvancedDateRangePicker_module_default.errorMessage, children: "Enter valid time" })
|
|
1376
|
+
] })
|
|
1377
|
+
] }) })
|
|
565
1378
|
] });
|
|
566
1379
|
});
|
|
567
1380
|
function AdvancedDateRangePicker({
|
|
@@ -577,30 +1390,31 @@ function AdvancedDateRangePicker({
|
|
|
577
1390
|
id = "adv-drp",
|
|
578
1391
|
defaultTimezone = "UTC",
|
|
579
1392
|
isTimezoneDisabled = false,
|
|
580
|
-
timezoneOptions = []
|
|
1393
|
+
timezoneOptions = [],
|
|
1394
|
+
defaultPreset = "custom"
|
|
581
1395
|
}) {
|
|
582
1396
|
var _a, _b, _c;
|
|
583
|
-
const PRESETS = (0,
|
|
584
|
-
const [startDate, setStartDate] = (0,
|
|
585
|
-
const [endDate, setEndDate] = (0,
|
|
586
|
-
const [timezone, setTimezone] = (0,
|
|
587
|
-
const [fromDateStr, setFromDateStr] = (0,
|
|
588
|
-
const [toDateStr, setToDateStr] = (0,
|
|
589
|
-
const [fromTimeStr, setFromTimeStr] = (0,
|
|
1397
|
+
const PRESETS = (0, import_react4.useMemo)(() => getPresets(), []);
|
|
1398
|
+
const [startDate, setStartDate] = (0, import_react4.useState)((_a = value == null ? void 0 : value.startDate) != null ? _a : null);
|
|
1399
|
+
const [endDate, setEndDate] = (0, import_react4.useState)((_b = value == null ? void 0 : value.endDate) != null ? _b : null);
|
|
1400
|
+
const [timezone, setTimezone] = (0, import_react4.useState)((_c = value == null ? void 0 : value.timezone) != null ? _c : defaultTimezone);
|
|
1401
|
+
const [fromDateStr, setFromDateStr] = (0, import_react4.useState)(formatForDisplay(startDate));
|
|
1402
|
+
const [toDateStr, setToDateStr] = (0, import_react4.useState)(formatForDisplay(endDate));
|
|
1403
|
+
const [fromTimeStr, setFromTimeStr] = (0, import_react4.useState)(
|
|
590
1404
|
(value == null ? void 0 : value.startTime) ? formatTime(value.startTime) : "12:00 PM"
|
|
591
1405
|
);
|
|
592
|
-
const [toTimeStr, setToTimeStr] = (0,
|
|
1406
|
+
const [toTimeStr, setToTimeStr] = (0, import_react4.useState)(
|
|
593
1407
|
(value == null ? void 0 : value.endTime) ? formatTime(value.endTime) : "12:00 PM"
|
|
594
1408
|
);
|
|
595
|
-
const [activePreset, setActivePreset] = (0,
|
|
596
|
-
const fromDateError = (0,
|
|
597
|
-
const toDateError = (0,
|
|
598
|
-
const fromTimeError = (0,
|
|
599
|
-
const toTimeError = (0,
|
|
600
|
-
const isReady = (0,
|
|
1409
|
+
const [activePreset, setActivePreset] = (0, import_react4.useState)(defaultPreset);
|
|
1410
|
+
const fromDateError = (0, import_react4.useMemo)(() => fromDateStr.length > 0 && (fromDateStr.length < 10 || !validateDateString(fromDateStr)), [fromDateStr]);
|
|
1411
|
+
const toDateError = (0, import_react4.useMemo)(() => toDateStr.length > 0 && (toDateStr.length < 10 || !validateDateString(toDateStr)), [toDateStr]);
|
|
1412
|
+
const fromTimeError = (0, import_react4.useMemo)(() => fromTimeStr.length > 0 && (fromTimeStr.length < 8 || !validateTimeString(fromTimeStr)), [fromTimeStr]);
|
|
1413
|
+
const toTimeError = (0, import_react4.useMemo)(() => toTimeStr.length > 0 && (toTimeStr.length < 8 || !validateTimeString(toTimeStr)), [toTimeStr]);
|
|
1414
|
+
const isReady = (0, import_react4.useMemo)(() => {
|
|
601
1415
|
return startDate !== null && endDate !== null && validateDateString(fromDateStr) && validateDateString(toDateStr) && validateTimeString(fromTimeStr) && validateTimeString(toTimeStr) && (0, import_dayjs2.default)(startDate).isSameOrBefore((0, import_dayjs2.default)(endDate), "day");
|
|
602
1416
|
}, [startDate, endDate, fromDateStr, toDateStr, fromTimeStr, toTimeStr]);
|
|
603
|
-
(0,
|
|
1417
|
+
(0, import_react4.useEffect)(() => {
|
|
604
1418
|
var _a2, _b2, _c2;
|
|
605
1419
|
if (value) {
|
|
606
1420
|
setStartDate((_a2 = value.startDate) != null ? _a2 : null);
|
|
@@ -610,17 +1424,17 @@ function AdvancedDateRangePicker({
|
|
|
610
1424
|
if (value.endTime) setToTimeStr(formatTime(value.endTime));
|
|
611
1425
|
}
|
|
612
1426
|
}, [value, defaultTimezone]);
|
|
613
|
-
(0,
|
|
1427
|
+
(0, import_react4.useEffect)(() => {
|
|
614
1428
|
setFromDateStr(formatForDisplay(startDate));
|
|
615
1429
|
}, [startDate]);
|
|
616
|
-
(0,
|
|
1430
|
+
(0, import_react4.useEffect)(() => {
|
|
617
1431
|
setToDateStr(formatForDisplay(endDate));
|
|
618
1432
|
}, [endDate]);
|
|
619
|
-
const rangeValue = (0,
|
|
1433
|
+
const rangeValue = (0, import_react4.useMemo)(() => [
|
|
620
1434
|
startDate ? startDate.toISOString() : "",
|
|
621
1435
|
endDate ? endDate.toISOString() : ""
|
|
622
1436
|
], [startDate, endDate]);
|
|
623
|
-
const handleRangeChange = (0,
|
|
1437
|
+
const handleRangeChange = (0, import_react4.useCallback)(
|
|
624
1438
|
(range) => {
|
|
625
1439
|
const [s, e] = range;
|
|
626
1440
|
if (s) {
|
|
@@ -639,7 +1453,7 @@ function AdvancedDateRangePicker({
|
|
|
639
1453
|
},
|
|
640
1454
|
[]
|
|
641
1455
|
);
|
|
642
|
-
const handlePreset = (0,
|
|
1456
|
+
const handlePreset = (0, import_react4.useCallback)(
|
|
643
1457
|
(preset) => {
|
|
644
1458
|
const [s, e] = preset.getRange();
|
|
645
1459
|
setStartDate(s);
|
|
@@ -648,7 +1462,7 @@ function AdvancedDateRangePicker({
|
|
|
648
1462
|
},
|
|
649
1463
|
[]
|
|
650
1464
|
);
|
|
651
|
-
const handleFromDateChange = (0,
|
|
1465
|
+
const handleFromDateChange = (0, import_react4.useCallback)((v) => {
|
|
652
1466
|
const masked = applyDateMask(v, fromDateStr);
|
|
653
1467
|
setFromDateStr(masked);
|
|
654
1468
|
setActivePreset("custom");
|
|
@@ -662,7 +1476,7 @@ function AdvancedDateRangePicker({
|
|
|
662
1476
|
}
|
|
663
1477
|
}
|
|
664
1478
|
}, [fromDateStr, endDate]);
|
|
665
|
-
const handleToDateChange = (0,
|
|
1479
|
+
const handleToDateChange = (0, import_react4.useCallback)((v) => {
|
|
666
1480
|
const masked = applyDateMask(v, toDateStr);
|
|
667
1481
|
setToDateStr(masked);
|
|
668
1482
|
setActivePreset("custom");
|
|
@@ -676,17 +1490,17 @@ function AdvancedDateRangePicker({
|
|
|
676
1490
|
}
|
|
677
1491
|
}
|
|
678
1492
|
}, [toDateStr, startDate]);
|
|
679
|
-
const handleFromTimeChange = (0,
|
|
1493
|
+
const handleFromTimeChange = (0, import_react4.useCallback)((v) => {
|
|
680
1494
|
const masked = applyTimeMask(v, fromTimeStr);
|
|
681
1495
|
setFromTimeStr(masked);
|
|
682
1496
|
setActivePreset("custom");
|
|
683
1497
|
}, [fromTimeStr]);
|
|
684
|
-
const handleToTimeChange = (0,
|
|
1498
|
+
const handleToTimeChange = (0, import_react4.useCallback)((v) => {
|
|
685
1499
|
const masked = applyTimeMask(v, toTimeStr);
|
|
686
1500
|
setToTimeStr(masked);
|
|
687
1501
|
setActivePreset("custom");
|
|
688
1502
|
}, [toTimeStr]);
|
|
689
|
-
const handleDone = (0,
|
|
1503
|
+
const handleDone = (0, import_react4.useCallback)(() => {
|
|
690
1504
|
var _a2, _b2;
|
|
691
1505
|
if (!isReady) return;
|
|
692
1506
|
const fromTime = (_a2 = parseTimeInput(fromTimeStr)) != null ? _a2 : DEFAULT_TIME;
|
|
@@ -699,38 +1513,45 @@ function AdvancedDateRangePicker({
|
|
|
699
1513
|
timezone
|
|
700
1514
|
});
|
|
701
1515
|
}, [isReady, onChange, startDate, endDate, fromTimeStr, toTimeStr, timezone]);
|
|
702
|
-
return /* @__PURE__ */ (0,
|
|
703
|
-
/* @__PURE__ */ (0,
|
|
704
|
-
/* @__PURE__ */ (0,
|
|
1516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: (0, import_clsx3.default)(AdvancedDateRangePicker_module_default.root, className), id, children: [
|
|
1517
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: AdvancedDateRangePicker_module_default.inner, children: [
|
|
1518
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("aside", { className: AdvancedDateRangePicker_module_default.left, children: PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
705
1519
|
"button",
|
|
706
1520
|
{
|
|
707
1521
|
type: "button",
|
|
708
1522
|
onClick: () => handlePreset(p),
|
|
709
|
-
className: (0,
|
|
1523
|
+
className: (0, import_clsx3.default)(AdvancedDateRangePicker_module_default.sidebarItem, {
|
|
710
1524
|
[AdvancedDateRangePicker_module_default.sidebarItemActive]: activePreset === p.key
|
|
711
1525
|
}),
|
|
712
1526
|
children: p.label
|
|
713
1527
|
},
|
|
714
1528
|
p.key
|
|
715
1529
|
)) }),
|
|
716
|
-
/* @__PURE__ */ (0,
|
|
717
|
-
/* @__PURE__ */ (0,
|
|
718
|
-
/* @__PURE__ */ (0,
|
|
719
|
-
/* @__PURE__ */ (0,
|
|
720
|
-
|
|
721
|
-
|
|
1530
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: AdvancedDateRangePicker_module_default.main, children: [
|
|
1531
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("header", { className: AdvancedDateRangePicker_module_default.header, children: [
|
|
1532
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: AdvancedDateRangePicker_module_default.timezoneWrapper, children: [
|
|
1533
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: AdvancedDateRangePicker_module_default.headerLabel, children: "Timezone" }),
|
|
1534
|
+
isTimezoneDisabled ? (
|
|
1535
|
+
/* Disabled state: plain text badge instead of empty dropdown */
|
|
1536
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: AdvancedDateRangePicker_module_default.timezoneDisabledBadge, children: timezone })
|
|
1537
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1538
|
+
Select_default,
|
|
722
1539
|
{
|
|
723
1540
|
value: timezone,
|
|
724
|
-
onChange: (
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
1541
|
+
onChange: (val) => {
|
|
1542
|
+
if (val) setTimezone(String(val));
|
|
1543
|
+
},
|
|
1544
|
+
options: timezoneOptions,
|
|
1545
|
+
size: "small",
|
|
1546
|
+
allowClear: false,
|
|
1547
|
+
enableSearch: false,
|
|
1548
|
+
wrapperClassName: AdvancedDateRangePicker_module_default.timezoneSelectContainer,
|
|
1549
|
+
inputClassName: AdvancedDateRangePicker_module_default.timezoneSelectInput
|
|
728
1550
|
}
|
|
729
1551
|
)
|
|
730
1552
|
] }),
|
|
731
|
-
/* @__PURE__ */ (0,
|
|
732
|
-
|
|
733
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1553
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: AdvancedDateRangePicker_module_default.dateTimeWrapper, children: [
|
|
1554
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
734
1555
|
DateTimeInputGroup,
|
|
735
1556
|
{
|
|
736
1557
|
label: "From",
|
|
@@ -742,8 +1563,7 @@ function AdvancedDateRangePicker({
|
|
|
742
1563
|
onTimeChange: handleFromTimeChange
|
|
743
1564
|
}
|
|
744
1565
|
),
|
|
745
|
-
/* @__PURE__ */ (0,
|
|
746
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1566
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
747
1567
|
DateTimeInputGroup,
|
|
748
1568
|
{
|
|
749
1569
|
label: "To",
|
|
@@ -757,7 +1577,7 @@ function AdvancedDateRangePicker({
|
|
|
757
1577
|
)
|
|
758
1578
|
] })
|
|
759
1579
|
] }),
|
|
760
|
-
/* @__PURE__ */ (0,
|
|
1580
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: AdvancedDateRangePicker_module_default.body, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
761
1581
|
InternalCalendar_default,
|
|
762
1582
|
{
|
|
763
1583
|
id: `${id}-calendar`,
|
|
@@ -771,13 +1591,12 @@ function AdvancedDateRangePicker({
|
|
|
771
1591
|
) })
|
|
772
1592
|
] })
|
|
773
1593
|
] }),
|
|
774
|
-
/* @__PURE__ */ (0,
|
|
775
|
-
|
|
1594
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("footer", { className: AdvancedDateRangePicker_module_default.footer, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1595
|
+
Button_default,
|
|
776
1596
|
{
|
|
777
|
-
type: "button",
|
|
778
1597
|
onClick: handleDone,
|
|
779
1598
|
disabled: disabled || !isReady,
|
|
780
|
-
|
|
1599
|
+
shape: "round",
|
|
781
1600
|
children: confirmLabel
|
|
782
1601
|
}
|
|
783
1602
|
) })
|