@ikatec/nebula-react 1.0.13 → 1.0.15
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.d.mts +126 -59
- package/dist/index.d.ts +126 -59
- package/dist/index.js +933 -336
- package/dist/index.mjs +908 -316
- package/package.json +7 -3
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React8 from 'react';
|
|
2
|
-
import React8__default, {
|
|
2
|
+
import React8__default, { createContext, forwardRef, useMemo, useState, useEffect, useCallback, useContext, useRef } from 'react';
|
|
3
3
|
import { Slot } from '@radix-ui/react-slot';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import { extendTailwindMerge } from 'tailwind-merge';
|
|
@@ -7,6 +7,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
7
7
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
8
8
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
9
9
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
10
|
+
import { ChevronRight, Check, Circle, CircleX, Eye, EyeOff, X, Minus, ClockIcon, ChevronsLeft, ChevronLeft, ChevronsRight, MoreHorizontal, ChevronDown, ChevronLeftIcon, ChevronDownIcon, ChevronRightIcon, CalendarIcon, PhoneIcon, Info, CircleCheckBig } from 'lucide-react';
|
|
10
11
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
11
12
|
import Select, { components } from 'react-select';
|
|
12
13
|
import Creatable from 'react-select/creatable';
|
|
@@ -22,6 +23,9 @@ import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
|
22
23
|
import { Toaster as Toaster$1, toast as toast$1 } from 'sonner';
|
|
23
24
|
import * as RPNInput from 'react-phone-number-input';
|
|
24
25
|
import flags from 'react-phone-number-input/flags';
|
|
26
|
+
import { formatDate, isValid, addMonths } from 'date-fns';
|
|
27
|
+
import { DayPicker } from 'react-day-picker';
|
|
28
|
+
import { ptBR, enUS, es } from 'react-day-picker/locale';
|
|
25
29
|
|
|
26
30
|
// src/button.tsx
|
|
27
31
|
|
|
@@ -395,14 +399,26 @@ var Label = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
395
399
|
}
|
|
396
400
|
));
|
|
397
401
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
398
|
-
var Table = React8.forwardRef(({ className, ...props }, ref) =>
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
402
|
+
var Table = React8.forwardRef(({ className, noCardWrapper = false, ...props }, ref) => {
|
|
403
|
+
if (noCardWrapper) {
|
|
404
|
+
return /* @__PURE__ */ jsx(
|
|
405
|
+
"table",
|
|
406
|
+
{
|
|
407
|
+
ref,
|
|
408
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
409
|
+
...props
|
|
410
|
+
}
|
|
411
|
+
);
|
|
404
412
|
}
|
|
405
|
-
|
|
413
|
+
return /* @__PURE__ */ jsx("div", { className: "nebula-ds relative w-full overflow-auto border rounded-2xl border-table-border bg-table-background", children: /* @__PURE__ */ jsx(
|
|
414
|
+
"table",
|
|
415
|
+
{
|
|
416
|
+
ref,
|
|
417
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
418
|
+
...props
|
|
419
|
+
}
|
|
420
|
+
) });
|
|
421
|
+
});
|
|
406
422
|
Table.displayName = "Table";
|
|
407
423
|
var TableHeader = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
408
424
|
TableHeader.displayName = "TableHeader";
|
|
@@ -429,7 +445,7 @@ var TableFooter = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
429
445
|
TableFooter.displayName = "TableFooter";
|
|
430
446
|
var variants2 = {
|
|
431
447
|
variant: {
|
|
432
|
-
first: "bg-
|
|
448
|
+
first: "bg-transparent",
|
|
433
449
|
second: "bg-table-cell-background-second-layer"
|
|
434
450
|
}
|
|
435
451
|
};
|
|
@@ -483,193 +499,6 @@ var TableCell = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
483
499
|
TableCell.displayName = "TableCell";
|
|
484
500
|
var TableCaption = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("caption", { ref, className: cn("mt-4 text-sm", className), ...props }));
|
|
485
501
|
TableCaption.displayName = "TableCaption";
|
|
486
|
-
|
|
487
|
-
// ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
488
|
-
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
489
|
-
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
490
|
-
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
491
|
-
}).join(" ").trim();
|
|
492
|
-
|
|
493
|
-
// ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
|
|
494
|
-
var defaultAttributes = {
|
|
495
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
496
|
-
width: 24,
|
|
497
|
-
height: 24,
|
|
498
|
-
viewBox: "0 0 24 24",
|
|
499
|
-
fill: "none",
|
|
500
|
-
stroke: "currentColor",
|
|
501
|
-
strokeWidth: 2,
|
|
502
|
-
strokeLinecap: "round",
|
|
503
|
-
strokeLinejoin: "round"
|
|
504
|
-
};
|
|
505
|
-
|
|
506
|
-
// ../../node_modules/lucide-react/dist/esm/Icon.js
|
|
507
|
-
var Icon = forwardRef(
|
|
508
|
-
({
|
|
509
|
-
color: color2 = "currentColor",
|
|
510
|
-
size: size4 = 24,
|
|
511
|
-
strokeWidth = 2,
|
|
512
|
-
absoluteStrokeWidth,
|
|
513
|
-
className = "",
|
|
514
|
-
children,
|
|
515
|
-
iconNode,
|
|
516
|
-
...rest
|
|
517
|
-
}, ref) => {
|
|
518
|
-
return createElement(
|
|
519
|
-
"svg",
|
|
520
|
-
{
|
|
521
|
-
ref,
|
|
522
|
-
...defaultAttributes,
|
|
523
|
-
width: size4,
|
|
524
|
-
height: size4,
|
|
525
|
-
stroke: color2,
|
|
526
|
-
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size4) : strokeWidth,
|
|
527
|
-
className: mergeClasses("lucide", className),
|
|
528
|
-
...rest
|
|
529
|
-
},
|
|
530
|
-
[
|
|
531
|
-
...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
|
|
532
|
-
...Array.isArray(children) ? children : [children]
|
|
533
|
-
]
|
|
534
|
-
);
|
|
535
|
-
}
|
|
536
|
-
);
|
|
537
|
-
|
|
538
|
-
// ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
539
|
-
var createLucideIcon = (iconName, iconNode) => {
|
|
540
|
-
const Component = forwardRef(
|
|
541
|
-
({ className, ...props }, ref) => createElement(Icon, {
|
|
542
|
-
ref,
|
|
543
|
-
iconNode,
|
|
544
|
-
className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
|
|
545
|
-
...props
|
|
546
|
-
})
|
|
547
|
-
);
|
|
548
|
-
Component.displayName = `${iconName}`;
|
|
549
|
-
return Component;
|
|
550
|
-
};
|
|
551
|
-
|
|
552
|
-
// ../../node_modules/lucide-react/dist/esm/icons/check.js
|
|
553
|
-
var __iconNode = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
554
|
-
var Check = createLucideIcon("Check", __iconNode);
|
|
555
|
-
|
|
556
|
-
// ../../node_modules/lucide-react/dist/esm/icons/chevron-down.js
|
|
557
|
-
var __iconNode2 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
558
|
-
var ChevronDown = createLucideIcon("ChevronDown", __iconNode2);
|
|
559
|
-
|
|
560
|
-
// ../../node_modules/lucide-react/dist/esm/icons/chevron-left.js
|
|
561
|
-
var __iconNode3 = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
|
|
562
|
-
var ChevronLeft = createLucideIcon("ChevronLeft", __iconNode3);
|
|
563
|
-
|
|
564
|
-
// ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
|
565
|
-
var __iconNode4 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
|
|
566
|
-
var ChevronRight = createLucideIcon("ChevronRight", __iconNode4);
|
|
567
|
-
|
|
568
|
-
// ../../node_modules/lucide-react/dist/esm/icons/chevrons-left.js
|
|
569
|
-
var __iconNode5 = [
|
|
570
|
-
["path", { d: "m11 17-5-5 5-5", key: "13zhaf" }],
|
|
571
|
-
["path", { d: "m18 17-5-5 5-5", key: "h8a8et" }]
|
|
572
|
-
];
|
|
573
|
-
var ChevronsLeft = createLucideIcon("ChevronsLeft", __iconNode5);
|
|
574
|
-
|
|
575
|
-
// ../../node_modules/lucide-react/dist/esm/icons/chevrons-right.js
|
|
576
|
-
var __iconNode6 = [
|
|
577
|
-
["path", { d: "m6 17 5-5-5-5", key: "xnjwq" }],
|
|
578
|
-
["path", { d: "m13 17 5-5-5-5", key: "17xmmf" }]
|
|
579
|
-
];
|
|
580
|
-
var ChevronsRight = createLucideIcon("ChevronsRight", __iconNode6);
|
|
581
|
-
|
|
582
|
-
// ../../node_modules/lucide-react/dist/esm/icons/circle-check-big.js
|
|
583
|
-
var __iconNode7 = [
|
|
584
|
-
["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
|
|
585
|
-
["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
|
|
586
|
-
];
|
|
587
|
-
var CircleCheckBig = createLucideIcon("CircleCheckBig", __iconNode7);
|
|
588
|
-
|
|
589
|
-
// ../../node_modules/lucide-react/dist/esm/icons/circle-x.js
|
|
590
|
-
var __iconNode8 = [
|
|
591
|
-
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
592
|
-
["path", { d: "m15 9-6 6", key: "1uzhvr" }],
|
|
593
|
-
["path", { d: "m9 9 6 6", key: "z0biqf" }]
|
|
594
|
-
];
|
|
595
|
-
var CircleX = createLucideIcon("CircleX", __iconNode8);
|
|
596
|
-
|
|
597
|
-
// ../../node_modules/lucide-react/dist/esm/icons/circle.js
|
|
598
|
-
var __iconNode9 = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
|
|
599
|
-
var Circle = createLucideIcon("Circle", __iconNode9);
|
|
600
|
-
|
|
601
|
-
// ../../node_modules/lucide-react/dist/esm/icons/ellipsis.js
|
|
602
|
-
var __iconNode10 = [
|
|
603
|
-
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
604
|
-
["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
|
|
605
|
-
["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
|
|
606
|
-
];
|
|
607
|
-
var Ellipsis = createLucideIcon("Ellipsis", __iconNode10);
|
|
608
|
-
|
|
609
|
-
// ../../node_modules/lucide-react/dist/esm/icons/eye-off.js
|
|
610
|
-
var __iconNode11 = [
|
|
611
|
-
[
|
|
612
|
-
"path",
|
|
613
|
-
{
|
|
614
|
-
d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
|
|
615
|
-
key: "ct8e1f"
|
|
616
|
-
}
|
|
617
|
-
],
|
|
618
|
-
["path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242", key: "151rxh" }],
|
|
619
|
-
[
|
|
620
|
-
"path",
|
|
621
|
-
{
|
|
622
|
-
d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",
|
|
623
|
-
key: "13bj9a"
|
|
624
|
-
}
|
|
625
|
-
],
|
|
626
|
-
["path", { d: "m2 2 20 20", key: "1ooewy" }]
|
|
627
|
-
];
|
|
628
|
-
var EyeOff = createLucideIcon("EyeOff", __iconNode11);
|
|
629
|
-
|
|
630
|
-
// ../../node_modules/lucide-react/dist/esm/icons/eye.js
|
|
631
|
-
var __iconNode12 = [
|
|
632
|
-
[
|
|
633
|
-
"path",
|
|
634
|
-
{
|
|
635
|
-
d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
|
|
636
|
-
key: "1nclc0"
|
|
637
|
-
}
|
|
638
|
-
],
|
|
639
|
-
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
640
|
-
];
|
|
641
|
-
var Eye = createLucideIcon("Eye", __iconNode12);
|
|
642
|
-
|
|
643
|
-
// ../../node_modules/lucide-react/dist/esm/icons/info.js
|
|
644
|
-
var __iconNode13 = [
|
|
645
|
-
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
646
|
-
["path", { d: "M12 16v-4", key: "1dtifu" }],
|
|
647
|
-
["path", { d: "M12 8h.01", key: "e9boi3" }]
|
|
648
|
-
];
|
|
649
|
-
var Info = createLucideIcon("Info", __iconNode13);
|
|
650
|
-
|
|
651
|
-
// ../../node_modules/lucide-react/dist/esm/icons/minus.js
|
|
652
|
-
var __iconNode14 = [["path", { d: "M5 12h14", key: "1ays0h" }]];
|
|
653
|
-
var Minus = createLucideIcon("Minus", __iconNode14);
|
|
654
|
-
|
|
655
|
-
// ../../node_modules/lucide-react/dist/esm/icons/phone.js
|
|
656
|
-
var __iconNode15 = [
|
|
657
|
-
[
|
|
658
|
-
"path",
|
|
659
|
-
{
|
|
660
|
-
d: "M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",
|
|
661
|
-
key: "foiqr5"
|
|
662
|
-
}
|
|
663
|
-
]
|
|
664
|
-
];
|
|
665
|
-
var Phone = createLucideIcon("Phone", __iconNode15);
|
|
666
|
-
|
|
667
|
-
// ../../node_modules/lucide-react/dist/esm/icons/x.js
|
|
668
|
-
var __iconNode16 = [
|
|
669
|
-
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
670
|
-
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
671
|
-
];
|
|
672
|
-
var X = createLucideIcon("X", __iconNode16);
|
|
673
502
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
674
503
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
675
504
|
var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
@@ -1275,15 +1104,22 @@ var messages3 = {
|
|
|
1275
1104
|
};
|
|
1276
1105
|
var input_phone_default = messages3;
|
|
1277
1106
|
|
|
1107
|
+
// src/i18n/messages/en/time-picker.ts
|
|
1108
|
+
var messages4 = {
|
|
1109
|
+
label: "Time"
|
|
1110
|
+
};
|
|
1111
|
+
var time_picker_default = messages4;
|
|
1112
|
+
|
|
1278
1113
|
// src/i18n/messages/en/index.ts
|
|
1279
1114
|
var enMessages = {
|
|
1280
1115
|
pagination: pagination_default,
|
|
1281
1116
|
inputSelect: input_select_default,
|
|
1282
|
-
inputPhone: input_phone_default
|
|
1117
|
+
inputPhone: input_phone_default,
|
|
1118
|
+
timePicker: time_picker_default
|
|
1283
1119
|
};
|
|
1284
1120
|
|
|
1285
1121
|
// src/i18n/messages/es/pagination.ts
|
|
1286
|
-
var
|
|
1122
|
+
var messages5 = {
|
|
1287
1123
|
totalResultsLabel(pagesSize, totalResults) {
|
|
1288
1124
|
if (totalResults < pagesSize) {
|
|
1289
1125
|
pagesSize = totalResults;
|
|
@@ -1294,16 +1130,16 @@ var messages4 = {
|
|
|
1294
1130
|
return `P\xE1gina ${currentPage} de ${totalPages}`;
|
|
1295
1131
|
}
|
|
1296
1132
|
};
|
|
1297
|
-
var pagination_default2 =
|
|
1133
|
+
var pagination_default2 = messages5;
|
|
1298
1134
|
|
|
1299
1135
|
// src/i18n/messages/es/input-select.ts
|
|
1300
|
-
var
|
|
1136
|
+
var messages6 = {
|
|
1301
1137
|
noOptions: "No hay opciones disponibles"
|
|
1302
1138
|
};
|
|
1303
|
-
var input_select_default2 =
|
|
1139
|
+
var input_select_default2 = messages6;
|
|
1304
1140
|
|
|
1305
1141
|
// src/i18n/messages/es/input-phone.ts
|
|
1306
|
-
var
|
|
1142
|
+
var messages7 = {
|
|
1307
1143
|
countries: {
|
|
1308
1144
|
empty: "Seleccionar",
|
|
1309
1145
|
AF: "Afganist\xE1n",
|
|
@@ -1553,17 +1389,24 @@ var messages6 = {
|
|
|
1553
1389
|
ZW: "Zimbabue"
|
|
1554
1390
|
}
|
|
1555
1391
|
};
|
|
1556
|
-
var input_phone_default2 =
|
|
1392
|
+
var input_phone_default2 = messages7;
|
|
1393
|
+
|
|
1394
|
+
// src/i18n/messages/es/time-picker.ts
|
|
1395
|
+
var messages8 = {
|
|
1396
|
+
label: "Tiempo"
|
|
1397
|
+
};
|
|
1398
|
+
var time_picker_default2 = messages8;
|
|
1557
1399
|
|
|
1558
1400
|
// src/i18n/messages/es/index.ts
|
|
1559
1401
|
var esMessages = {
|
|
1560
1402
|
pagination: pagination_default2,
|
|
1561
1403
|
inputSelect: input_select_default2,
|
|
1562
|
-
inputPhone: input_phone_default2
|
|
1404
|
+
inputPhone: input_phone_default2,
|
|
1405
|
+
timePicker: time_picker_default2
|
|
1563
1406
|
};
|
|
1564
1407
|
|
|
1565
1408
|
// src/i18n/messages/pt-br/pagination.ts
|
|
1566
|
-
var
|
|
1409
|
+
var messages9 = {
|
|
1567
1410
|
totalResultsLabel(pagesSize, totalResults) {
|
|
1568
1411
|
if (totalResults < pagesSize) {
|
|
1569
1412
|
pagesSize = totalResults;
|
|
@@ -1574,16 +1417,16 @@ var messages7 = {
|
|
|
1574
1417
|
return `P\xE1gina ${currentPage} de ${totalPages}`;
|
|
1575
1418
|
}
|
|
1576
1419
|
};
|
|
1577
|
-
var pagination_default3 =
|
|
1420
|
+
var pagination_default3 = messages9;
|
|
1578
1421
|
|
|
1579
1422
|
// src/i18n/messages/pt-br/input-select.ts
|
|
1580
|
-
var
|
|
1423
|
+
var messages10 = {
|
|
1581
1424
|
noOptions: "Nenhuma op\xE7\xE3o dispon\xEDvel"
|
|
1582
1425
|
};
|
|
1583
|
-
var input_select_default3 =
|
|
1426
|
+
var input_select_default3 = messages10;
|
|
1584
1427
|
|
|
1585
1428
|
// src/i18n/messages/pt-br/input-phone.ts
|
|
1586
|
-
var
|
|
1429
|
+
var messages11 = {
|
|
1587
1430
|
countries: {
|
|
1588
1431
|
empty: "Selecione",
|
|
1589
1432
|
AF: "Afeganist\xE3o",
|
|
@@ -1833,13 +1676,20 @@ var messages9 = {
|
|
|
1833
1676
|
ZW: "Zimb\xE1bue"
|
|
1834
1677
|
}
|
|
1835
1678
|
};
|
|
1836
|
-
var input_phone_default3 =
|
|
1679
|
+
var input_phone_default3 = messages11;
|
|
1680
|
+
|
|
1681
|
+
// src/i18n/messages/pt-br/time-picker.ts
|
|
1682
|
+
var messages12 = {
|
|
1683
|
+
label: "Hor\xE1rio"
|
|
1684
|
+
};
|
|
1685
|
+
var time_picker_default3 = messages12;
|
|
1837
1686
|
|
|
1838
1687
|
// src/i18n/messages/pt-br/index.ts
|
|
1839
1688
|
var ptBrMessages = {
|
|
1840
1689
|
pagination: pagination_default3,
|
|
1841
1690
|
inputSelect: input_select_default3,
|
|
1842
|
-
inputPhone: input_phone_default3
|
|
1691
|
+
inputPhone: input_phone_default3,
|
|
1692
|
+
timePicker: time_picker_default3
|
|
1843
1693
|
};
|
|
1844
1694
|
|
|
1845
1695
|
// src/i18n/message-storage-handler.ts
|
|
@@ -1864,7 +1714,7 @@ var setNebulaLanguage = (language) => {
|
|
|
1864
1714
|
}
|
|
1865
1715
|
localStorage.setItem(getNebulaI18nStorageKey(), language);
|
|
1866
1716
|
};
|
|
1867
|
-
var
|
|
1717
|
+
var messages13 = /* @__PURE__ */ new Map([
|
|
1868
1718
|
[null, enMessages],
|
|
1869
1719
|
[void 0, enMessages],
|
|
1870
1720
|
["en-US", enMessages],
|
|
@@ -1882,14 +1732,14 @@ var NebulaI18nProvider = ({
|
|
|
1882
1732
|
() => customI18nStorageKey ?? localStorageKey,
|
|
1883
1733
|
[customI18nStorageKey]
|
|
1884
1734
|
);
|
|
1885
|
-
const [
|
|
1886
|
-
|
|
1735
|
+
const [messages14, setMessages] = useState(
|
|
1736
|
+
messages13.get(getNebulaLanguage()) ?? messages13.get("en-US")
|
|
1887
1737
|
);
|
|
1888
1738
|
const handleStorageChange = useCallback(
|
|
1889
1739
|
({ detail }) => {
|
|
1890
1740
|
if (detail.key === storageKey) {
|
|
1891
1741
|
setMessages(
|
|
1892
|
-
|
|
1742
|
+
messages13.get(detail.value) ?? messages13.get("en-US")
|
|
1893
1743
|
);
|
|
1894
1744
|
}
|
|
1895
1745
|
},
|
|
@@ -1929,7 +1779,16 @@ var NebulaI18nProvider = ({
|
|
|
1929
1779
|
localStorage.removeItem(localStorageKey);
|
|
1930
1780
|
localStorage.setItem(customNebulaI18nStorageKey, customI18nStorageKey);
|
|
1931
1781
|
}, [customI18nStorageKey]);
|
|
1932
|
-
return /* @__PURE__ */ jsx(
|
|
1782
|
+
return /* @__PURE__ */ jsx(
|
|
1783
|
+
NebulaI18nContext.Provider,
|
|
1784
|
+
{
|
|
1785
|
+
value: {
|
|
1786
|
+
messages: messages14,
|
|
1787
|
+
locale: getNebulaLanguage()
|
|
1788
|
+
},
|
|
1789
|
+
children
|
|
1790
|
+
}
|
|
1791
|
+
);
|
|
1933
1792
|
};
|
|
1934
1793
|
var useNebulaI18n = () => {
|
|
1935
1794
|
const context = useContext(NebulaI18nContext);
|
|
@@ -1946,7 +1805,7 @@ var Pagination = ({
|
|
|
1946
1805
|
onChangePage,
|
|
1947
1806
|
...props
|
|
1948
1807
|
}) => {
|
|
1949
|
-
const { messages:
|
|
1808
|
+
const { messages: messages14 } = useNebulaI18n();
|
|
1950
1809
|
const totalPages = useMemo(() => {
|
|
1951
1810
|
return Math.ceil(total / (pageSize || 1));
|
|
1952
1811
|
}, [total, pageSize]);
|
|
@@ -1979,13 +1838,13 @@ var Pagination = ({
|
|
|
1979
1838
|
}, [totalPages, pageSize, total]);
|
|
1980
1839
|
const totalResultsLabel = useMemo(() => {
|
|
1981
1840
|
if (page === totalPages) {
|
|
1982
|
-
return
|
|
1841
|
+
return messages14.pagination.totalResultsLabel(lastPageSize, total);
|
|
1983
1842
|
}
|
|
1984
|
-
return
|
|
1985
|
-
}, [
|
|
1843
|
+
return messages14.pagination.totalResultsLabel(pageSize, total);
|
|
1844
|
+
}, [messages14.pagination, pageSize, total, page, totalPages, lastPageSize]);
|
|
1986
1845
|
const currentPageLabel = useMemo(
|
|
1987
|
-
() =>
|
|
1988
|
-
[
|
|
1846
|
+
() => messages14.pagination.currentPageLabel(normalizedPage, totalPages),
|
|
1847
|
+
[messages14.pagination, normalizedPage, totalPages]
|
|
1989
1848
|
);
|
|
1990
1849
|
return /* @__PURE__ */ jsxs(
|
|
1991
1850
|
"nav",
|
|
@@ -2258,7 +2117,7 @@ var createStyledSelect = (BaseSelect, displayName) => {
|
|
|
2258
2117
|
isError = false,
|
|
2259
2118
|
...props
|
|
2260
2119
|
}) => {
|
|
2261
|
-
const { messages:
|
|
2120
|
+
const { messages: messages14 } = useNebulaI18n();
|
|
2262
2121
|
const customClassNames = useMemo(() => {
|
|
2263
2122
|
return {
|
|
2264
2123
|
control: (props2) => controlStyles(props2, isError),
|
|
@@ -2305,7 +2164,7 @@ var createStyledSelect = (BaseSelect, displayName) => {
|
|
|
2305
2164
|
isDisabled: disabled,
|
|
2306
2165
|
components: customComponents,
|
|
2307
2166
|
classNames: customClassNames,
|
|
2308
|
-
noOptionsMessage: () => /* @__PURE__ */ jsx("p", { children:
|
|
2167
|
+
noOptionsMessage: () => /* @__PURE__ */ jsx("p", { children: messages14.inputSelect.noOptions }),
|
|
2309
2168
|
...props
|
|
2310
2169
|
}
|
|
2311
2170
|
);
|
|
@@ -2321,7 +2180,15 @@ var StyledAsyncCreatable = createStyledSelect(
|
|
|
2321
2180
|
"AsyncCreatable"
|
|
2322
2181
|
);
|
|
2323
2182
|
var InputText = React8.forwardRef(
|
|
2324
|
-
({
|
|
2183
|
+
({
|
|
2184
|
+
className,
|
|
2185
|
+
icon,
|
|
2186
|
+
isError = false,
|
|
2187
|
+
onClean,
|
|
2188
|
+
iconPlacement = "start",
|
|
2189
|
+
disabled,
|
|
2190
|
+
...props
|
|
2191
|
+
}, ref) => {
|
|
2325
2192
|
const initialInputType = props.type || "text";
|
|
2326
2193
|
const [type, setType] = React8.useState(initialInputType);
|
|
2327
2194
|
const iconClass = {
|
|
@@ -2329,60 +2196,79 @@ var InputText = React8.forwardRef(
|
|
|
2329
2196
|
"text-inputText-icon-default focus:text-inputText-icon-focus": !isError && !props.value,
|
|
2330
2197
|
"text-inputText-icon-filled focus:text-inputText-icon-filled": !isError && !!props.value
|
|
2331
2198
|
};
|
|
2332
|
-
return /* @__PURE__ */ jsxs(
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
{
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2199
|
+
return /* @__PURE__ */ jsxs(
|
|
2200
|
+
"div",
|
|
2201
|
+
{
|
|
2202
|
+
className: cn("relative w-full", {
|
|
2203
|
+
"pointer-events-none": disabled
|
|
2204
|
+
}),
|
|
2205
|
+
children: [
|
|
2206
|
+
/* @__PURE__ */ jsx(
|
|
2207
|
+
"input",
|
|
2208
|
+
{
|
|
2209
|
+
ref,
|
|
2210
|
+
className: cn(
|
|
2211
|
+
"w-full h-10 outline-none rounded-input text-sm leading-none font-medium",
|
|
2212
|
+
"bg-inputText-background-default disabled:bg-inputText-background-disabled",
|
|
2213
|
+
"border border-inputText-border-default focus:ring-[3px] focus:ring-inputText-border-focus focus:border-inputText-border-focus",
|
|
2214
|
+
"text-inputText-text-filled focus:text-inputText-text-focus placeholder:text-inputText-text-default disabled:text-inputText-text-disabled",
|
|
2215
|
+
"disabled:cursor-not-allowed",
|
|
2216
|
+
{
|
|
2217
|
+
"pl-10 pr-4": !!icon && iconPlacement === "start",
|
|
2218
|
+
"pr-10 pl-4": !!icon && iconPlacement === "end" && initialInputType !== "password",
|
|
2219
|
+
"px-4": !icon,
|
|
2220
|
+
"border-inputText-border-danger focus:border-inputText-border-danger focus:ring-button-danger-border-focus": isError
|
|
2221
|
+
},
|
|
2222
|
+
className
|
|
2223
|
+
),
|
|
2224
|
+
...props,
|
|
2225
|
+
disabled,
|
|
2226
|
+
type
|
|
2227
|
+
}
|
|
2339
2228
|
),
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
) }),
|
|
2343
|
-
/* @__PURE__ */ jsx(
|
|
2344
|
-
"input",
|
|
2345
|
-
{
|
|
2346
|
-
ref,
|
|
2347
|
-
className: cn(
|
|
2348
|
-
"w-full h-10 outline-none rounded-input text-sm leading-none font-medium",
|
|
2349
|
-
"bg-inputText-background-default disabled:bg-inputText-background-disabled",
|
|
2350
|
-
"border border-inputText-border-default focus:ring-[3px] focus:ring-inputText-border-focus focus:border-inputText-border-focus",
|
|
2351
|
-
"text-inputText-text-filled focus:text-inputText-text-focus placeholder:text-inputText-text-default disabled:text-inputText-text-disabled",
|
|
2352
|
-
"disabled:cursor-not-allowed",
|
|
2229
|
+
onClean && props.value && /* @__PURE__ */ jsx(
|
|
2230
|
+
"button",
|
|
2353
2231
|
{
|
|
2354
|
-
|
|
2355
|
-
"
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2232
|
+
type: "button",
|
|
2233
|
+
className: cn("absolute top-1/2 transform -translate-y-1/2", {
|
|
2234
|
+
"right-10": initialInputType === "password" || iconPlacement === "end",
|
|
2235
|
+
"right-4": initialInputType === "text" && iconPlacement === "start"
|
|
2236
|
+
}),
|
|
2237
|
+
onClick: onClean,
|
|
2238
|
+
children: /* @__PURE__ */ jsx(CircleX, { className: cn("w-4 h-4", iconClass) })
|
|
2239
|
+
}
|
|
2359
2240
|
),
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
"
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2241
|
+
initialInputType === "password" && /* @__PURE__ */ jsx(
|
|
2242
|
+
"button",
|
|
2243
|
+
{
|
|
2244
|
+
type: "button",
|
|
2245
|
+
className: "nebula-ds absolute right-4 top-1/2 transform -translate-y-1/2",
|
|
2246
|
+
onClick: () => setType((prev) => prev === "text" ? "password" : "text"),
|
|
2247
|
+
children: type === "text" ? /* @__PURE__ */ jsx(Eye, { className: cn("w-4 h-4", iconClass) }) : /* @__PURE__ */ jsx(EyeOff, { className: cn("w-4 h-4", iconClass) })
|
|
2248
|
+
}
|
|
2249
|
+
),
|
|
2250
|
+
icon && /* @__PURE__ */ jsx(
|
|
2251
|
+
"span",
|
|
2252
|
+
{
|
|
2253
|
+
className: cn("absolute top-1/2 transform -translate-y-1/2", {
|
|
2254
|
+
"left-4": iconPlacement === "start",
|
|
2255
|
+
"right-4": iconPlacement === "end" && initialInputType !== "password"
|
|
2256
|
+
}),
|
|
2257
|
+
children: /* @__PURE__ */ jsx(
|
|
2258
|
+
"span",
|
|
2259
|
+
{
|
|
2260
|
+
className: cn(
|
|
2261
|
+
"w-4 h-4 flex items-center justify-center disabled:text-inputText-icon-disabled",
|
|
2262
|
+
iconClass
|
|
2263
|
+
),
|
|
2264
|
+
children: icon
|
|
2265
|
+
}
|
|
2266
|
+
)
|
|
2267
|
+
}
|
|
2268
|
+
)
|
|
2269
|
+
]
|
|
2270
|
+
}
|
|
2271
|
+
);
|
|
2386
2272
|
}
|
|
2387
2273
|
);
|
|
2388
2274
|
InputText.displayName = "InputText";
|
|
@@ -2855,7 +2741,7 @@ var BreadcrumbEllipsis = ({
|
|
|
2855
2741
|
),
|
|
2856
2742
|
...props,
|
|
2857
2743
|
children: [
|
|
2858
|
-
/* @__PURE__ */ jsx(
|
|
2744
|
+
/* @__PURE__ */ jsx(MoreHorizontal, { className: "nebula-ds h-3 w-3" }),
|
|
2859
2745
|
/* @__PURE__ */ jsx("span", { className: "nebula-ds sr-only", children: "More" })
|
|
2860
2746
|
]
|
|
2861
2747
|
}
|
|
@@ -3178,6 +3064,7 @@ var Box = ({
|
|
|
3178
3064
|
"bg-box-background-secondary": variant3 === "secondary"
|
|
3179
3065
|
},
|
|
3180
3066
|
{
|
|
3067
|
+
"p-0": paddingSize === "none",
|
|
3181
3068
|
"p-4": paddingSize === "sm",
|
|
3182
3069
|
"p-6": paddingSize === "md",
|
|
3183
3070
|
"p-8": paddingSize === "lg",
|
|
@@ -3280,13 +3167,13 @@ function custom(message, options) {
|
|
|
3280
3167
|
}
|
|
3281
3168
|
);
|
|
3282
3169
|
}
|
|
3283
|
-
async function promise(promise2,
|
|
3170
|
+
async function promise(promise2, messages14, options) {
|
|
3284
3171
|
const loadingToast = toast$1.custom(
|
|
3285
3172
|
(t) => /* @__PURE__ */ jsx(
|
|
3286
3173
|
ToastComponent,
|
|
3287
3174
|
{
|
|
3288
3175
|
type: "info",
|
|
3289
|
-
message:
|
|
3176
|
+
message: messages14.loading,
|
|
3290
3177
|
options,
|
|
3291
3178
|
t
|
|
3292
3179
|
}
|
|
@@ -3300,7 +3187,7 @@ async function promise(promise2, messages11, options) {
|
|
|
3300
3187
|
ToastComponent,
|
|
3301
3188
|
{
|
|
3302
3189
|
type: "success",
|
|
3303
|
-
message:
|
|
3190
|
+
message: messages14.success,
|
|
3304
3191
|
options,
|
|
3305
3192
|
t
|
|
3306
3193
|
}
|
|
@@ -3315,7 +3202,7 @@ async function promise(promise2, messages11, options) {
|
|
|
3315
3202
|
ToastComponent,
|
|
3316
3203
|
{
|
|
3317
3204
|
type: "error",
|
|
3318
|
-
message:
|
|
3205
|
+
message: messages14.error,
|
|
3319
3206
|
options,
|
|
3320
3207
|
t
|
|
3321
3208
|
}
|
|
@@ -3485,12 +3372,12 @@ var CountrySelect = ({
|
|
|
3485
3372
|
const handleSelect = (event) => {
|
|
3486
3373
|
onChange(event.target.value);
|
|
3487
3374
|
};
|
|
3488
|
-
const { messages:
|
|
3489
|
-
const { countries } =
|
|
3375
|
+
const { messages: messages14 } = useNebulaI18n();
|
|
3376
|
+
const { countries } = messages14.inputPhone;
|
|
3490
3377
|
return /* @__PURE__ */ jsxs("div", { className: "nebula-ds rounded-s-[20px] relative inline-flex items-center self-stretch py-2 ps-4 pe-2 transition-[color,box-shadow] outline-none has-disabled:pointer-events-none has-disabled:opacity-50", children: [
|
|
3491
3378
|
/* @__PURE__ */ jsxs("div", { className: "nebula-ds inline-flex items-center gap-1", "aria-hidden": "true", children: [
|
|
3492
3379
|
/* @__PURE__ */ jsx(FlagComponent, { country: value, countryName: value, "aria-hidden": "true" }),
|
|
3493
|
-
/* @__PURE__ */ jsx("span", { className: "nebula-ds text-inputText-text-filled focus:text-inputText-text-focus", children: /* @__PURE__ */ jsx(
|
|
3380
|
+
/* @__PURE__ */ jsx("span", { className: "nebula-ds text-inputText-text-filled focus:text-inputText-text-focus", children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: 16, "aria-hidden": "true" }) })
|
|
3494
3381
|
] }),
|
|
3495
3382
|
/* @__PURE__ */ jsxs(
|
|
3496
3383
|
"select",
|
|
@@ -3514,7 +3401,7 @@ var CountrySelect = ({
|
|
|
3514
3401
|
};
|
|
3515
3402
|
var FlagComponent = ({ country, countryName }) => {
|
|
3516
3403
|
const Flag = flags[country];
|
|
3517
|
-
return /* @__PURE__ */ jsx("span", { className: "nebula-ds w-5 overflow-hidden rounded-sm", children: Flag ? /* @__PURE__ */ jsx(Flag, { title: countryName }) : /* @__PURE__ */ jsx(
|
|
3404
|
+
return /* @__PURE__ */ jsx("span", { className: "nebula-ds w-5 overflow-hidden rounded-sm", children: Flag ? /* @__PURE__ */ jsx(Flag, { title: countryName }) : /* @__PURE__ */ jsx(PhoneIcon, { size: 16, "aria-hidden": "true" }) });
|
|
3518
3405
|
};
|
|
3519
3406
|
var PhoneInput = React8__default.forwardRef(({ className, ...props }, ref) => {
|
|
3520
3407
|
return /* @__PURE__ */ jsxs("div", { className: "nebula-ds flex items-center justify-center rounded-e-[20px] w-full", children: [
|
|
@@ -3622,6 +3509,741 @@ var Skeleton = React8__default.forwardRef(
|
|
|
3622
3509
|
}
|
|
3623
3510
|
);
|
|
3624
3511
|
Skeleton.displayName = "Skeleton";
|
|
3512
|
+
var MONTHS = [
|
|
3513
|
+
"01/01",
|
|
3514
|
+
"02/01",
|
|
3515
|
+
"03/01",
|
|
3516
|
+
"04/01",
|
|
3517
|
+
"05/01",
|
|
3518
|
+
"06/01",
|
|
3519
|
+
"07/01",
|
|
3520
|
+
"08/01",
|
|
3521
|
+
"09/01",
|
|
3522
|
+
"10/01",
|
|
3523
|
+
"11/01",
|
|
3524
|
+
"12/01"
|
|
3525
|
+
];
|
|
3526
|
+
var localeByi18nKey = {
|
|
3527
|
+
es,
|
|
3528
|
+
"en-US": enUS,
|
|
3529
|
+
"pt-BR": ptBR
|
|
3530
|
+
};
|
|
3531
|
+
var Calendar = ({
|
|
3532
|
+
numberOfMonths = 1,
|
|
3533
|
+
hideNavigation = false,
|
|
3534
|
+
month,
|
|
3535
|
+
onNextClick,
|
|
3536
|
+
onPrevClick,
|
|
3537
|
+
components: calendarComponents,
|
|
3538
|
+
...props
|
|
3539
|
+
}) => {
|
|
3540
|
+
const { locale } = useNebulaI18n();
|
|
3541
|
+
const [selectedMonth, setSelectedMonth] = useState(/* @__PURE__ */ new Date());
|
|
3542
|
+
const [showMonthGridSelection, setShowMonthGridSelection] = useState(false);
|
|
3543
|
+
const isRange = props.mode === "range";
|
|
3544
|
+
const currentMonth = useMemo(
|
|
3545
|
+
() => month ?? selectedMonth,
|
|
3546
|
+
[month, selectedMonth]
|
|
3547
|
+
);
|
|
3548
|
+
const handleSelectMonthByOption = useCallback(
|
|
3549
|
+
(monthOption) => {
|
|
3550
|
+
setShowMonthGridSelection(false);
|
|
3551
|
+
const calendarDate = currentMonth;
|
|
3552
|
+
currentMonth.setMonth(monthOption.getMonth());
|
|
3553
|
+
if (typeof month !== "undefined") {
|
|
3554
|
+
onNextClick?.(calendarDate);
|
|
3555
|
+
} else {
|
|
3556
|
+
setSelectedMonth(calendarDate);
|
|
3557
|
+
}
|
|
3558
|
+
},
|
|
3559
|
+
[currentMonth, month, onNextClick]
|
|
3560
|
+
);
|
|
3561
|
+
const components2 = useMemo(() => {
|
|
3562
|
+
return {
|
|
3563
|
+
Day(props2) {
|
|
3564
|
+
const {
|
|
3565
|
+
selected,
|
|
3566
|
+
range_end: rangeEnd,
|
|
3567
|
+
range_start: rangeStart
|
|
3568
|
+
} = props2.modifiers;
|
|
3569
|
+
const isSaturday = props2.day.date.getDay() === 0;
|
|
3570
|
+
const isSunday = props2.day.date.getDay() === 6;
|
|
3571
|
+
return /* @__PURE__ */ jsx(
|
|
3572
|
+
"td",
|
|
3573
|
+
{
|
|
3574
|
+
...props2,
|
|
3575
|
+
className: cn(props2.className, "!w-9 !h-9 !p-0", {
|
|
3576
|
+
"rounded-r-full": isSunday && selected || rangeEnd,
|
|
3577
|
+
"rounded-l-full": isSaturday && selected || rangeStart,
|
|
3578
|
+
"!bg-calendar-rowSelected-background [&>button]:!border-none": selected && isRange
|
|
3579
|
+
})
|
|
3580
|
+
}
|
|
3581
|
+
);
|
|
3582
|
+
},
|
|
3583
|
+
DayButton(props2) {
|
|
3584
|
+
const {
|
|
3585
|
+
outside,
|
|
3586
|
+
today,
|
|
3587
|
+
selected,
|
|
3588
|
+
range_middle: rangeMiddle,
|
|
3589
|
+
range_end: rangeEnd,
|
|
3590
|
+
range_start: rangeStart
|
|
3591
|
+
} = props2.modifiers;
|
|
3592
|
+
return /* @__PURE__ */ jsx(
|
|
3593
|
+
"button",
|
|
3594
|
+
{
|
|
3595
|
+
...props2,
|
|
3596
|
+
tabIndex: 0,
|
|
3597
|
+
className: cn(props2.className, "!w-9 !h-9", {
|
|
3598
|
+
"!text-calendar-day-color": !outside,
|
|
3599
|
+
"!text-calendar-outsideDay-color !opacity-1": outside,
|
|
3600
|
+
"!bg-calendar-daySelected-background !border-calendar-daySelected-background !text-calendar-daySelected-color rounded-full": (selected || rangeEnd || rangeStart) && !rangeMiddle
|
|
3601
|
+
}),
|
|
3602
|
+
children: /* @__PURE__ */ jsxs(
|
|
3603
|
+
"div",
|
|
3604
|
+
{
|
|
3605
|
+
className: cn({
|
|
3606
|
+
"flex flex-col relative items-center text-inherit": today
|
|
3607
|
+
}),
|
|
3608
|
+
children: [
|
|
3609
|
+
/* @__PURE__ */ jsx(
|
|
3610
|
+
Paragraph,
|
|
3611
|
+
{
|
|
3612
|
+
size: "md",
|
|
3613
|
+
className: "!font-medium !text-inherit text-center",
|
|
3614
|
+
children: props2.children
|
|
3615
|
+
}
|
|
3616
|
+
),
|
|
3617
|
+
today && /* @__PURE__ */ jsx("div", { className: "nebula-ds !bg-calendar-today-dotColor w-1 h-1 rounded-full absolute -bottom-[2px]" })
|
|
3618
|
+
]
|
|
3619
|
+
}
|
|
3620
|
+
)
|
|
3621
|
+
}
|
|
3622
|
+
);
|
|
3623
|
+
},
|
|
3624
|
+
MonthCaption({ calendarMonth, displayIndex, ...rest }) {
|
|
3625
|
+
const handleNextMonth = () => {
|
|
3626
|
+
const newMonth = addMonths(
|
|
3627
|
+
calendarMonth.date,
|
|
3628
|
+
props.pagedNavigation || numberOfMonths === 1 ? 1 : 0
|
|
3629
|
+
);
|
|
3630
|
+
if (typeof month !== "undefined") {
|
|
3631
|
+
onNextClick?.(newMonth);
|
|
3632
|
+
return;
|
|
3633
|
+
}
|
|
3634
|
+
setSelectedMonth(newMonth);
|
|
3635
|
+
};
|
|
3636
|
+
const handlePreviousMonth = () => {
|
|
3637
|
+
const newMonth = addMonths(
|
|
3638
|
+
calendarMonth.date,
|
|
3639
|
+
props.pagedNavigation ? -2 : -1
|
|
3640
|
+
);
|
|
3641
|
+
if (typeof month !== "undefined") {
|
|
3642
|
+
onPrevClick?.(newMonth);
|
|
3643
|
+
return;
|
|
3644
|
+
}
|
|
3645
|
+
setSelectedMonth(newMonth);
|
|
3646
|
+
};
|
|
3647
|
+
const handleToggleShowMonthGridSelection = () => {
|
|
3648
|
+
setShowMonthGridSelection((s) => !s);
|
|
3649
|
+
};
|
|
3650
|
+
return /* @__PURE__ */ jsxs(
|
|
3651
|
+
"div",
|
|
3652
|
+
{
|
|
3653
|
+
className: cn("flex justify-between items-center !h-9", {
|
|
3654
|
+
"ps-3": numberOfMonths === 1
|
|
3655
|
+
}),
|
|
3656
|
+
children: [
|
|
3657
|
+
!hideNavigation && numberOfMonths > 1 && /* @__PURE__ */ jsx(
|
|
3658
|
+
Button,
|
|
3659
|
+
{
|
|
3660
|
+
icon: true,
|
|
3661
|
+
size: "sm",
|
|
3662
|
+
variant: "ghost",
|
|
3663
|
+
onClick: handlePreviousMonth,
|
|
3664
|
+
className: cn({
|
|
3665
|
+
"pointer-events-none invisible": displayIndex === 1
|
|
3666
|
+
}),
|
|
3667
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "nebula-ds !w-[unset] !h-[unset]" })
|
|
3668
|
+
}
|
|
3669
|
+
),
|
|
3670
|
+
/* @__PURE__ */ jsx(
|
|
3671
|
+
"div",
|
|
3672
|
+
{
|
|
3673
|
+
...rest,
|
|
3674
|
+
className: cn(
|
|
3675
|
+
rest.className,
|
|
3676
|
+
"!h-auto select-none ",
|
|
3677
|
+
numberOfMonths > 1 && "pointer-events-none"
|
|
3678
|
+
),
|
|
3679
|
+
role: "button",
|
|
3680
|
+
onClick: handleToggleShowMonthGridSelection,
|
|
3681
|
+
children: /* @__PURE__ */ jsxs(Space, { size: "xs", className: "nebula-ds items-center", children: [
|
|
3682
|
+
/* @__PURE__ */ jsx("span", { className: "nebula-ds !text-calendar-month-label !text-sm !font-semibold", children: formatDate(calendarMonth.date, "LLL yyyy", {
|
|
3683
|
+
locale: localeByi18nKey[locale ?? "en-US"]
|
|
3684
|
+
}).replace(/^./, (char) => char.toUpperCase()) }),
|
|
3685
|
+
numberOfMonths === 1 && /* @__PURE__ */ jsx(ChevronDownIcon, { className: "nebula-ds !text-calendar-month-selectionChevron" })
|
|
3686
|
+
] })
|
|
3687
|
+
}
|
|
3688
|
+
),
|
|
3689
|
+
!hideNavigation && numberOfMonths === 1 && !showMonthGridSelection && /* @__PURE__ */ jsxs("div", { className: "nebula-ds flex gap-x-1", children: [
|
|
3690
|
+
/* @__PURE__ */ jsx(
|
|
3691
|
+
Button,
|
|
3692
|
+
{
|
|
3693
|
+
icon: true,
|
|
3694
|
+
size: "sm",
|
|
3695
|
+
variant: "ghost",
|
|
3696
|
+
onClick: handlePreviousMonth,
|
|
3697
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "nebula-ds !w-[unset] !h-[unset] !text-calendar-month-navigator" })
|
|
3698
|
+
}
|
|
3699
|
+
),
|
|
3700
|
+
/* @__PURE__ */ jsx(
|
|
3701
|
+
Button,
|
|
3702
|
+
{
|
|
3703
|
+
icon: true,
|
|
3704
|
+
size: "sm",
|
|
3705
|
+
variant: "ghost",
|
|
3706
|
+
onClick: handleNextMonth,
|
|
3707
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "nebula-ds !w-[unset] !h-[unset] !text-calendar-month-navigator" })
|
|
3708
|
+
}
|
|
3709
|
+
)
|
|
3710
|
+
] }),
|
|
3711
|
+
!hideNavigation && numberOfMonths > 1 && /* @__PURE__ */ jsx(
|
|
3712
|
+
Button,
|
|
3713
|
+
{
|
|
3714
|
+
icon: true,
|
|
3715
|
+
size: "sm",
|
|
3716
|
+
variant: "ghost",
|
|
3717
|
+
onClick: handleNextMonth,
|
|
3718
|
+
className: cn({
|
|
3719
|
+
"pointer-events-none invisible": displayIndex !== numberOfMonths - 1
|
|
3720
|
+
}),
|
|
3721
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "nebula-ds !w-[unset] !h-[unset]" })
|
|
3722
|
+
}
|
|
3723
|
+
)
|
|
3724
|
+
]
|
|
3725
|
+
}
|
|
3726
|
+
);
|
|
3727
|
+
},
|
|
3728
|
+
MonthGrid(props2) {
|
|
3729
|
+
if (!showMonthGridSelection) {
|
|
3730
|
+
return /* @__PURE__ */ jsx("table", { ...props2 });
|
|
3731
|
+
}
|
|
3732
|
+
return /* @__PURE__ */ jsx(
|
|
3733
|
+
Box,
|
|
3734
|
+
{
|
|
3735
|
+
className: "nebula-ds z-40 !p-0 flex gap-2 flex-col justify-between w-full",
|
|
3736
|
+
border: false,
|
|
3737
|
+
children: /* @__PURE__ */ jsx("div", { className: "nebula-ds z-40 grid grid-cols-2 gap-1 bg-inherit pt-2", children: MONTHS.map((monthOption) => {
|
|
3738
|
+
const monthOptionAsDate = new Date(monthOption);
|
|
3739
|
+
const isSelectedMonth = month ? month.getMonth() === monthOptionAsDate.getMonth() : monthOptionAsDate.getMonth() === currentMonth.getMonth();
|
|
3740
|
+
const monthLabel = formatDate(monthOptionAsDate, "LLLL", {
|
|
3741
|
+
locale: localeByi18nKey[locale ?? "en-US"]
|
|
3742
|
+
});
|
|
3743
|
+
return /* @__PURE__ */ jsx(
|
|
3744
|
+
Button,
|
|
3745
|
+
{
|
|
3746
|
+
variant: isSelectedMonth ? "primary" : "secondary",
|
|
3747
|
+
type: "button",
|
|
3748
|
+
className: cn("rounded-lg", {
|
|
3749
|
+
"border-neutral-200 dark:border-neutral-800": !isSelectedMonth
|
|
3750
|
+
}),
|
|
3751
|
+
size: "md",
|
|
3752
|
+
onClick: () => handleSelectMonthByOption(monthOptionAsDate),
|
|
3753
|
+
children: monthLabel
|
|
3754
|
+
},
|
|
3755
|
+
monthLabel
|
|
3756
|
+
);
|
|
3757
|
+
}) })
|
|
3758
|
+
}
|
|
3759
|
+
);
|
|
3760
|
+
},
|
|
3761
|
+
Months(props2) {
|
|
3762
|
+
return /* @__PURE__ */ jsx("div", { ...props2, className: cn(props2.className, "gap-2 flex p-2") });
|
|
3763
|
+
},
|
|
3764
|
+
Month(props2) {
|
|
3765
|
+
return /* @__PURE__ */ jsx(
|
|
3766
|
+
"div",
|
|
3767
|
+
{
|
|
3768
|
+
...props2,
|
|
3769
|
+
className: cn(
|
|
3770
|
+
props2.className,
|
|
3771
|
+
"[&:not(:last-child)]:pr-2 [&:not(:last-child)]:border-neutral-200 [&:not(:last-child)]:border-r dark:[&:not(:last-child)]:border-neutral-800"
|
|
3772
|
+
)
|
|
3773
|
+
}
|
|
3774
|
+
);
|
|
3775
|
+
},
|
|
3776
|
+
Week(props2) {
|
|
3777
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3778
|
+
/* @__PURE__ */ jsx("tr", { ...props2, className: cn(props2.className) }),
|
|
3779
|
+
/* @__PURE__ */ jsx("tr", { className: "nebula-ds h-1 last:h-0" })
|
|
3780
|
+
] });
|
|
3781
|
+
},
|
|
3782
|
+
Weekdays(props2) {
|
|
3783
|
+
return /* @__PURE__ */ jsx("tr", { ...props2 });
|
|
3784
|
+
},
|
|
3785
|
+
Weekday(props2) {
|
|
3786
|
+
return /* @__PURE__ */ jsx(
|
|
3787
|
+
"th",
|
|
3788
|
+
{
|
|
3789
|
+
...props2,
|
|
3790
|
+
className: cn(
|
|
3791
|
+
props2.className,
|
|
3792
|
+
"font-medium text-xs !text-calendar-weekDay-color"
|
|
3793
|
+
),
|
|
3794
|
+
children: String(props2.children)?.toUpperCase()?.[0]
|
|
3795
|
+
}
|
|
3796
|
+
);
|
|
3797
|
+
},
|
|
3798
|
+
Footer(props2) {
|
|
3799
|
+
if (showMonthGridSelection) return void 0;
|
|
3800
|
+
return /* @__PURE__ */ jsx(
|
|
3801
|
+
"div",
|
|
3802
|
+
{
|
|
3803
|
+
...props2,
|
|
3804
|
+
className: cn(props2.className, "p-3 border-t border-t-box-border")
|
|
3805
|
+
}
|
|
3806
|
+
);
|
|
3807
|
+
},
|
|
3808
|
+
...calendarComponents
|
|
3809
|
+
};
|
|
3810
|
+
}, [
|
|
3811
|
+
calendarComponents,
|
|
3812
|
+
isRange,
|
|
3813
|
+
currentMonth,
|
|
3814
|
+
handleSelectMonthByOption,
|
|
3815
|
+
hideNavigation,
|
|
3816
|
+
locale,
|
|
3817
|
+
month,
|
|
3818
|
+
numberOfMonths,
|
|
3819
|
+
onNextClick,
|
|
3820
|
+
onPrevClick,
|
|
3821
|
+
props.pagedNavigation,
|
|
3822
|
+
showMonthGridSelection
|
|
3823
|
+
]);
|
|
3824
|
+
return /* @__PURE__ */ jsx(
|
|
3825
|
+
Box,
|
|
3826
|
+
{
|
|
3827
|
+
border: true,
|
|
3828
|
+
className: cn("p-0 w-fit", numberOfMonths === 1 && "w-[270px]"),
|
|
3829
|
+
shadow: "md",
|
|
3830
|
+
children: /* @__PURE__ */ jsx(
|
|
3831
|
+
DayPicker,
|
|
3832
|
+
{
|
|
3833
|
+
showOutsideDays: true,
|
|
3834
|
+
mode: "single",
|
|
3835
|
+
animate: false,
|
|
3836
|
+
...props,
|
|
3837
|
+
month: month ?? selectedMonth,
|
|
3838
|
+
hideNavigation: true,
|
|
3839
|
+
numberOfMonths: Math.min(Math.max(numberOfMonths, 1), 2),
|
|
3840
|
+
components: components2,
|
|
3841
|
+
locale: localeByi18nKey[locale ?? "en-US"],
|
|
3842
|
+
footer: showMonthGridSelection ? void 0 : props.footer
|
|
3843
|
+
}
|
|
3844
|
+
)
|
|
3845
|
+
}
|
|
3846
|
+
);
|
|
3847
|
+
};
|
|
3848
|
+
|
|
3849
|
+
// src/utils/valid-date-format.ts
|
|
3850
|
+
function dateFormatIsValid(dateStr, locale) {
|
|
3851
|
+
const regexBR = /^(?:(?:31\/(0[13578]|1[02]))\/(?:\d{4})|(?:29|30)\/(0[13-9]|1[0-2])\/(?:\d{4})|29\/02\/(?:\d\d(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)|(?:0[1-9]|1\d|2[0-8])\/(0[1-9]|1[0-2])\/(?:\d{4}))$/;
|
|
3852
|
+
const regexUS = /^(?:(?:(0[13578]|1[02])\/31)\/(?:\d{4})|(?:(0[13-9]|1[0-2])\/(29|30))\/(?:\d{4})|(?:02\/29)\/(?:\d\d(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)|(?:(0[1-9]|1[0-2])\/(0[1-9]|1\d|2[0-8]))\/(?:\d{4}))$/;
|
|
3853
|
+
const regex = locale === "en-US" ? regexUS : regexBR;
|
|
3854
|
+
return regex.test(dateStr);
|
|
3855
|
+
}
|
|
3856
|
+
function timeFormatIsValid(timeStr) {
|
|
3857
|
+
const regex = /^(?:[01]\d|2[0-3]):[0-5]\d$/;
|
|
3858
|
+
return regex.test(timeStr);
|
|
3859
|
+
}
|
|
3860
|
+
var InputDatePickerSingle = ({
|
|
3861
|
+
portal,
|
|
3862
|
+
placeholder,
|
|
3863
|
+
className,
|
|
3864
|
+
value,
|
|
3865
|
+
onChange,
|
|
3866
|
+
numberOfMonths = 1,
|
|
3867
|
+
onClean,
|
|
3868
|
+
...rest
|
|
3869
|
+
}) => {
|
|
3870
|
+
const [popoverIsOpen, setPopoverIsOpen] = useState(false);
|
|
3871
|
+
const [innerDate, setInnerDate] = useState(
|
|
3872
|
+
value ? new Date(value) : void 0
|
|
3873
|
+
);
|
|
3874
|
+
const { locale } = useNebulaI18n();
|
|
3875
|
+
const [month, setMonth] = useState(/* @__PURE__ */ new Date());
|
|
3876
|
+
const handleClearValue = () => {
|
|
3877
|
+
setInnerDate(void 0);
|
|
3878
|
+
setMonth(/* @__PURE__ */ new Date());
|
|
3879
|
+
};
|
|
3880
|
+
const handleInnerInputChange = (text) => {
|
|
3881
|
+
const dateSlice = text.substring(0, 10).trim();
|
|
3882
|
+
onChange?.(text);
|
|
3883
|
+
if (!text) {
|
|
3884
|
+
handleClearValue();
|
|
3885
|
+
return;
|
|
3886
|
+
}
|
|
3887
|
+
const [day, month2, year] = [
|
|
3888
|
+
locale !== "en-US" ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
|
|
3889
|
+
locale === "en-US" ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
|
|
3890
|
+
dateSlice.substring(6)
|
|
3891
|
+
];
|
|
3892
|
+
if ([day, month2, year].some((value2) => !value2) || !dateFormatIsValid(dateSlice, locale)) {
|
|
3893
|
+
handleClearValue();
|
|
3894
|
+
return;
|
|
3895
|
+
}
|
|
3896
|
+
const date = new Date(Number(year), Number(month2) - 1, Number(day));
|
|
3897
|
+
if (!isValid(new Date(date))) {
|
|
3898
|
+
handleClearValue();
|
|
3899
|
+
return;
|
|
3900
|
+
}
|
|
3901
|
+
setInnerDate(date);
|
|
3902
|
+
};
|
|
3903
|
+
const handleKeyDown = (e) => {
|
|
3904
|
+
if ((e.altKey || e.ctrlKey || e.metaKey) && e.key !== "z") return;
|
|
3905
|
+
const allowedKeys = [
|
|
3906
|
+
"Backspace",
|
|
3907
|
+
"Delete",
|
|
3908
|
+
"Tab",
|
|
3909
|
+
"ArrowLeft",
|
|
3910
|
+
"ArrowRight",
|
|
3911
|
+
"Home",
|
|
3912
|
+
"End",
|
|
3913
|
+
"/"
|
|
3914
|
+
];
|
|
3915
|
+
if (!allowedKeys.includes(e.key) && !/^[0-9]$/.test(e.key)) {
|
|
3916
|
+
e.preventDefault();
|
|
3917
|
+
}
|
|
3918
|
+
};
|
|
3919
|
+
const handleCalendarSelect = (date) => {
|
|
3920
|
+
const dateToStr = Intl.DateTimeFormat(locale ?? "en-US", {
|
|
3921
|
+
month: "2-digit",
|
|
3922
|
+
year: "numeric",
|
|
3923
|
+
day: "2-digit"
|
|
3924
|
+
}).format(date);
|
|
3925
|
+
setInnerDate(date);
|
|
3926
|
+
onChange?.(dateToStr);
|
|
3927
|
+
};
|
|
3928
|
+
const normalizedCalendarDate = useMemo(() => {
|
|
3929
|
+
return isValid(innerDate) ? innerDate : void 0;
|
|
3930
|
+
}, [innerDate]);
|
|
3931
|
+
useEffect(() => {
|
|
3932
|
+
if (innerDate) setMonth(innerDate);
|
|
3933
|
+
}, [innerDate]);
|
|
3934
|
+
return /* @__PURE__ */ jsxs(Popover, { open: popoverIsOpen, onOpenChange: setPopoverIsOpen, children: [
|
|
3935
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { className, asChild: true, children: /* @__PURE__ */ jsx(
|
|
3936
|
+
"div",
|
|
3937
|
+
{
|
|
3938
|
+
onClick: (e) => e.preventDefault(),
|
|
3939
|
+
onFocus: (e) => e.preventDefault(),
|
|
3940
|
+
children: /* @__PURE__ */ jsx(
|
|
3941
|
+
InputText,
|
|
3942
|
+
{
|
|
3943
|
+
placeholder,
|
|
3944
|
+
value,
|
|
3945
|
+
className,
|
|
3946
|
+
onChange: (e) => handleInnerInputChange(e.target.value),
|
|
3947
|
+
onKeyDown: handleKeyDown,
|
|
3948
|
+
icon: /* @__PURE__ */ jsx(
|
|
3949
|
+
CalendarIcon,
|
|
3950
|
+
{
|
|
3951
|
+
tabIndex: 0,
|
|
3952
|
+
role: "button",
|
|
3953
|
+
onClick: () => setPopoverIsOpen((s) => !s),
|
|
3954
|
+
onKeyUp: (e) => {
|
|
3955
|
+
if (e.key === "Enter") {
|
|
3956
|
+
setPopoverIsOpen((s) => !s);
|
|
3957
|
+
}
|
|
3958
|
+
},
|
|
3959
|
+
className: "nebula-ds cursor-pointer"
|
|
3960
|
+
}
|
|
3961
|
+
),
|
|
3962
|
+
iconPlacement: "end",
|
|
3963
|
+
onKeyUp: (e) => {
|
|
3964
|
+
if (e.key === "ArrowDown") {
|
|
3965
|
+
setPopoverIsOpen(true);
|
|
3966
|
+
}
|
|
3967
|
+
},
|
|
3968
|
+
maxLength: 10,
|
|
3969
|
+
onClean: onClean ? () => {
|
|
3970
|
+
onClean();
|
|
3971
|
+
handleClearValue();
|
|
3972
|
+
} : void 0,
|
|
3973
|
+
...rest
|
|
3974
|
+
}
|
|
3975
|
+
)
|
|
3976
|
+
}
|
|
3977
|
+
) }),
|
|
3978
|
+
/* @__PURE__ */ jsx(
|
|
3979
|
+
PopoverContent,
|
|
3980
|
+
{
|
|
3981
|
+
portal,
|
|
3982
|
+
side: "bottom",
|
|
3983
|
+
className: "nebula-ds p-0 border-none bg-transparent shadow-none",
|
|
3984
|
+
align: "start",
|
|
3985
|
+
children: /* @__PURE__ */ jsx(
|
|
3986
|
+
Calendar,
|
|
3987
|
+
{
|
|
3988
|
+
required: false,
|
|
3989
|
+
mode: "single",
|
|
3990
|
+
numberOfMonths,
|
|
3991
|
+
selected: normalizedCalendarDate,
|
|
3992
|
+
onSelect: handleCalendarSelect,
|
|
3993
|
+
month,
|
|
3994
|
+
onPrevClick: setMonth,
|
|
3995
|
+
onNextClick: setMonth
|
|
3996
|
+
}
|
|
3997
|
+
)
|
|
3998
|
+
}
|
|
3999
|
+
)
|
|
4000
|
+
] });
|
|
4001
|
+
};
|
|
4002
|
+
var InputTime = forwardRef(
|
|
4003
|
+
({ value = "", onChange, placeholder = "--:--", ...rest }, ref) => {
|
|
4004
|
+
const [displayValue, setDisplayValue] = useState(value);
|
|
4005
|
+
const handleKeyDown = (e) => {
|
|
4006
|
+
const currentValue = e.currentTarget.value;
|
|
4007
|
+
if ((e.altKey || e.ctrlKey || e.metaKey) && e.key !== "z") return;
|
|
4008
|
+
const allowedKeys = [
|
|
4009
|
+
"Backspace",
|
|
4010
|
+
"Delete",
|
|
4011
|
+
"Tab",
|
|
4012
|
+
"ArrowLeft",
|
|
4013
|
+
"ArrowRight",
|
|
4014
|
+
"Home",
|
|
4015
|
+
"End",
|
|
4016
|
+
":"
|
|
4017
|
+
];
|
|
4018
|
+
if (!allowedKeys.includes(e.key) && !/^[0-9]$/.test(e.key)) {
|
|
4019
|
+
e.preventDefault();
|
|
4020
|
+
}
|
|
4021
|
+
if (currentValue.indexOf(":") > -1 && e.key === ":" || e.key === ":" && currentValue.length < 2) {
|
|
4022
|
+
e.preventDefault();
|
|
4023
|
+
}
|
|
4024
|
+
};
|
|
4025
|
+
const handleInput = (value2) => {
|
|
4026
|
+
if (value2.startsWith(":")) return;
|
|
4027
|
+
let clean = value2.replace(/\D/g, "");
|
|
4028
|
+
if (clean.length === 2) {
|
|
4029
|
+
clean = String(
|
|
4030
|
+
Math.min(Math.max(parseInt(clean || "0", 10), 0), 23)
|
|
4031
|
+
).padStart(2, "0");
|
|
4032
|
+
}
|
|
4033
|
+
if (clean.length === 4) {
|
|
4034
|
+
let h = parseInt(clean.slice(0, 2) || "0", 10);
|
|
4035
|
+
let m = parseInt(clean.slice(2, 4) || "0", 10);
|
|
4036
|
+
h = Math.min(Math.max(h, 0), 23);
|
|
4037
|
+
m = Math.min(Math.max(m, 0), 59);
|
|
4038
|
+
const value24h = `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;
|
|
4039
|
+
setDisplayValue(value24h);
|
|
4040
|
+
onChange?.(value24h);
|
|
4041
|
+
} else {
|
|
4042
|
+
setDisplayValue(value2);
|
|
4043
|
+
onChange?.(value2);
|
|
4044
|
+
}
|
|
4045
|
+
};
|
|
4046
|
+
useEffect(() => {
|
|
4047
|
+
if (!value) {
|
|
4048
|
+
setDisplayValue("");
|
|
4049
|
+
}
|
|
4050
|
+
}, [value]);
|
|
4051
|
+
return /* @__PURE__ */ jsx(
|
|
4052
|
+
InputText,
|
|
4053
|
+
{
|
|
4054
|
+
ref,
|
|
4055
|
+
type: "text",
|
|
4056
|
+
value: displayValue,
|
|
4057
|
+
placeholder,
|
|
4058
|
+
...rest,
|
|
4059
|
+
onChange: (e) => handleInput(e.target.value),
|
|
4060
|
+
onKeyDown: handleKeyDown,
|
|
4061
|
+
maxLength: 5,
|
|
4062
|
+
icon: /* @__PURE__ */ jsx(ClockIcon, {})
|
|
4063
|
+
}
|
|
4064
|
+
);
|
|
4065
|
+
}
|
|
4066
|
+
);
|
|
4067
|
+
InputTime.displayName = "InputTime";
|
|
4068
|
+
var InputDateTimePickerSingle = ({
|
|
4069
|
+
portal,
|
|
4070
|
+
placeholder,
|
|
4071
|
+
className,
|
|
4072
|
+
value,
|
|
4073
|
+
onChange,
|
|
4074
|
+
numberOfMonths = 1,
|
|
4075
|
+
onClean,
|
|
4076
|
+
...rest
|
|
4077
|
+
}) => {
|
|
4078
|
+
const [popoverIsOpen, setPopoverIsOpen] = useState(false);
|
|
4079
|
+
const [innerTimeValue, setInnerTimeValue] = useState();
|
|
4080
|
+
const [innerDate, setInnerDate] = useState(
|
|
4081
|
+
value ? new Date(value) : void 0
|
|
4082
|
+
);
|
|
4083
|
+
const { locale, messages: messages14 } = useNebulaI18n();
|
|
4084
|
+
const [month, setMonth] = useState(/* @__PURE__ */ new Date());
|
|
4085
|
+
const inputTimeRef = useRef(null);
|
|
4086
|
+
const handleClearValue = () => {
|
|
4087
|
+
setInnerTimeValue("");
|
|
4088
|
+
setInnerDate(void 0);
|
|
4089
|
+
setMonth(/* @__PURE__ */ new Date());
|
|
4090
|
+
};
|
|
4091
|
+
const handleInnerInputChange = (text) => {
|
|
4092
|
+
const dateSlice = text.substring(0, 11).trim();
|
|
4093
|
+
const hourSlice = text.substring(11).trim();
|
|
4094
|
+
onChange?.(text);
|
|
4095
|
+
if (!text) {
|
|
4096
|
+
handleClearValue();
|
|
4097
|
+
return;
|
|
4098
|
+
}
|
|
4099
|
+
const [day, month2, year] = [
|
|
4100
|
+
locale !== "en-US" ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
|
|
4101
|
+
locale === "en-US" ? dateSlice.substring(0, 2) : dateSlice.substring(3, 5),
|
|
4102
|
+
dateSlice.substring(6)
|
|
4103
|
+
];
|
|
4104
|
+
if ([day, month2, year].some((value2) => !value2) || !dateFormatIsValid(dateSlice, locale)) {
|
|
4105
|
+
handleClearValue();
|
|
4106
|
+
return;
|
|
4107
|
+
}
|
|
4108
|
+
if (!timeFormatIsValid(hourSlice)) {
|
|
4109
|
+
setInnerTimeValue("");
|
|
4110
|
+
} else {
|
|
4111
|
+
setInnerTimeValue(hourSlice);
|
|
4112
|
+
}
|
|
4113
|
+
const date = new Date(Number(year), Number(month2) - 1, Number(day));
|
|
4114
|
+
if (!isValid(new Date(date))) {
|
|
4115
|
+
handleClearValue();
|
|
4116
|
+
return;
|
|
4117
|
+
}
|
|
4118
|
+
setInnerDate(date);
|
|
4119
|
+
};
|
|
4120
|
+
const handleOnChangeTime = (newTime) => {
|
|
4121
|
+
const [date = ""] = value?.split(" ") ?? [];
|
|
4122
|
+
setInnerTimeValue(newTime);
|
|
4123
|
+
if (date && !dateFormatIsValid(date, locale)) {
|
|
4124
|
+
handleClearValue();
|
|
4125
|
+
}
|
|
4126
|
+
onChange?.(date + " " + newTime);
|
|
4127
|
+
};
|
|
4128
|
+
const handleKeyDown = (e) => {
|
|
4129
|
+
if ((e.altKey || e.ctrlKey || e.metaKey) && e.key !== "z") return;
|
|
4130
|
+
const allowedKeys = [
|
|
4131
|
+
"Backspace",
|
|
4132
|
+
"Delete",
|
|
4133
|
+
"Tab",
|
|
4134
|
+
"ArrowLeft",
|
|
4135
|
+
"ArrowRight",
|
|
4136
|
+
"Home",
|
|
4137
|
+
"End",
|
|
4138
|
+
":",
|
|
4139
|
+
"/",
|
|
4140
|
+
" "
|
|
4141
|
+
];
|
|
4142
|
+
if (!allowedKeys.includes(e.key) && !/^[0-9]$/.test(e.key)) {
|
|
4143
|
+
e.preventDefault();
|
|
4144
|
+
}
|
|
4145
|
+
};
|
|
4146
|
+
const handleCalendarSelect = (date) => {
|
|
4147
|
+
const dateToStr = Intl.DateTimeFormat(locale ?? "en-US", {
|
|
4148
|
+
month: "2-digit",
|
|
4149
|
+
year: "numeric",
|
|
4150
|
+
day: "2-digit"
|
|
4151
|
+
}).format(date);
|
|
4152
|
+
setInnerDate(date);
|
|
4153
|
+
onChange?.([dateToStr, innerTimeValue].filter(Boolean).join(" "));
|
|
4154
|
+
if (!innerTimeValue) {
|
|
4155
|
+
setTimeout(() => inputTimeRef.current?.focus(), 100);
|
|
4156
|
+
}
|
|
4157
|
+
};
|
|
4158
|
+
const normalizedCalendarDate = useMemo(() => {
|
|
4159
|
+
return isValid(innerDate) ? innerDate : void 0;
|
|
4160
|
+
}, [innerDate]);
|
|
4161
|
+
useEffect(() => {
|
|
4162
|
+
if (innerDate) setMonth(innerDate);
|
|
4163
|
+
}, [innerDate]);
|
|
4164
|
+
return /* @__PURE__ */ jsxs(Popover, { open: popoverIsOpen, onOpenChange: setPopoverIsOpen, children: [
|
|
4165
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { className, asChild: true, children: /* @__PURE__ */ jsx(
|
|
4166
|
+
"div",
|
|
4167
|
+
{
|
|
4168
|
+
onClick: (e) => e.preventDefault(),
|
|
4169
|
+
onFocus: (e) => e.preventDefault(),
|
|
4170
|
+
children: /* @__PURE__ */ jsx(
|
|
4171
|
+
InputText,
|
|
4172
|
+
{
|
|
4173
|
+
placeholder,
|
|
4174
|
+
value,
|
|
4175
|
+
className,
|
|
4176
|
+
onChange: (e) => handleInnerInputChange(e.target.value),
|
|
4177
|
+
onKeyDown: handleKeyDown,
|
|
4178
|
+
icon: /* @__PURE__ */ jsx(
|
|
4179
|
+
CalendarIcon,
|
|
4180
|
+
{
|
|
4181
|
+
tabIndex: 0,
|
|
4182
|
+
role: "button",
|
|
4183
|
+
onClick: () => setPopoverIsOpen((s) => !s),
|
|
4184
|
+
onKeyUp: (e) => {
|
|
4185
|
+
if (e.key === "Enter") {
|
|
4186
|
+
setPopoverIsOpen((s) => !s);
|
|
4187
|
+
}
|
|
4188
|
+
},
|
|
4189
|
+
className: "nebula-ds cursor-pointer"
|
|
4190
|
+
}
|
|
4191
|
+
),
|
|
4192
|
+
iconPlacement: "end",
|
|
4193
|
+
onKeyUp: (e) => {
|
|
4194
|
+
if (e.key === "ArrowDown") {
|
|
4195
|
+
setPopoverIsOpen(true);
|
|
4196
|
+
}
|
|
4197
|
+
},
|
|
4198
|
+
maxLength: 16,
|
|
4199
|
+
onClean: onClean ? () => {
|
|
4200
|
+
onClean();
|
|
4201
|
+
handleClearValue();
|
|
4202
|
+
} : void 0,
|
|
4203
|
+
...rest
|
|
4204
|
+
}
|
|
4205
|
+
)
|
|
4206
|
+
}
|
|
4207
|
+
) }),
|
|
4208
|
+
/* @__PURE__ */ jsx(
|
|
4209
|
+
PopoverContent,
|
|
4210
|
+
{
|
|
4211
|
+
portal,
|
|
4212
|
+
side: "bottom",
|
|
4213
|
+
className: "nebula-ds p-0 border-none bg-transparent shadow-none",
|
|
4214
|
+
align: "start",
|
|
4215
|
+
children: /* @__PURE__ */ jsx(
|
|
4216
|
+
Calendar,
|
|
4217
|
+
{
|
|
4218
|
+
required: false,
|
|
4219
|
+
mode: "single",
|
|
4220
|
+
numberOfMonths,
|
|
4221
|
+
selected: normalizedCalendarDate,
|
|
4222
|
+
onSelect: handleCalendarSelect,
|
|
4223
|
+
month,
|
|
4224
|
+
onPrevClick: setMonth,
|
|
4225
|
+
onNextClick: setMonth,
|
|
4226
|
+
footer: /* @__PURE__ */ jsxs(Space, { className: "nebula-ds items-center", children: [
|
|
4227
|
+
/* @__PURE__ */ jsxs(Label, { children: [
|
|
4228
|
+
messages14.timePicker.label,
|
|
4229
|
+
":"
|
|
4230
|
+
] }),
|
|
4231
|
+
/* @__PURE__ */ jsx(
|
|
4232
|
+
InputTime,
|
|
4233
|
+
{
|
|
4234
|
+
placeholder: "00:00",
|
|
4235
|
+
value: innerTimeValue,
|
|
4236
|
+
onChange: handleOnChangeTime,
|
|
4237
|
+
ref: inputTimeRef
|
|
4238
|
+
}
|
|
4239
|
+
)
|
|
4240
|
+
] })
|
|
4241
|
+
}
|
|
4242
|
+
)
|
|
4243
|
+
}
|
|
4244
|
+
)
|
|
4245
|
+
] });
|
|
4246
|
+
};
|
|
3625
4247
|
|
|
3626
4248
|
// src/tailwind.ts
|
|
3627
4249
|
function content({ base = "./" } = {}) {
|
|
@@ -3632,35 +4254,5 @@ var tailwind = {
|
|
|
3632
4254
|
content
|
|
3633
4255
|
// plugin: () => require("tailwindcss")("node_modules/@nebulareact/dist/tailwind.config.js"),
|
|
3634
4256
|
};
|
|
3635
|
-
/*! Bundled license information:
|
|
3636
|
-
|
|
3637
|
-
lucide-react/dist/esm/shared/src/utils.js:
|
|
3638
|
-
lucide-react/dist/esm/defaultAttributes.js:
|
|
3639
|
-
lucide-react/dist/esm/Icon.js:
|
|
3640
|
-
lucide-react/dist/esm/createLucideIcon.js:
|
|
3641
|
-
lucide-react/dist/esm/icons/check.js:
|
|
3642
|
-
lucide-react/dist/esm/icons/chevron-down.js:
|
|
3643
|
-
lucide-react/dist/esm/icons/chevron-left.js:
|
|
3644
|
-
lucide-react/dist/esm/icons/chevron-right.js:
|
|
3645
|
-
lucide-react/dist/esm/icons/chevrons-left.js:
|
|
3646
|
-
lucide-react/dist/esm/icons/chevrons-right.js:
|
|
3647
|
-
lucide-react/dist/esm/icons/circle-check-big.js:
|
|
3648
|
-
lucide-react/dist/esm/icons/circle-x.js:
|
|
3649
|
-
lucide-react/dist/esm/icons/circle.js:
|
|
3650
|
-
lucide-react/dist/esm/icons/ellipsis.js:
|
|
3651
|
-
lucide-react/dist/esm/icons/eye-off.js:
|
|
3652
|
-
lucide-react/dist/esm/icons/eye.js:
|
|
3653
|
-
lucide-react/dist/esm/icons/info.js:
|
|
3654
|
-
lucide-react/dist/esm/icons/minus.js:
|
|
3655
|
-
lucide-react/dist/esm/icons/phone.js:
|
|
3656
|
-
lucide-react/dist/esm/icons/x.js:
|
|
3657
|
-
lucide-react/dist/esm/lucide-react.js:
|
|
3658
|
-
(**
|
|
3659
|
-
* @license lucide-react v0.476.0 - ISC
|
|
3660
|
-
*
|
|
3661
|
-
* This source code is licensed under the ISC license.
|
|
3662
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
3663
|
-
*)
|
|
3664
|
-
*/
|
|
3665
4257
|
|
|
3666
|
-
export { Accordion, AccordionContent, AccordionDescription, AccordionItem, AccordionTitle, AccordionTrigger, ActionBar, ActionBarButton, ActionBarClose, ActionBarContent, ActionBarDivider, ActionBarPortal, ActionBarTrigger, Alert, AlertButton, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertTitle, StyledAsync as Async, StyledAsyncCreatable as AsyncCreatable, Badge, Box, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Caption, Checkbox, StyledCreatable as Creatable, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Heading, InputPhone, InputText, Label, Link, NebulaI18nProvider, Pagination, Paragraph, Popover, PopoverContent, PopoverTrigger, StyledSelect as Select, Separator2 as Separator, Skeleton, Space, SpaceDirectionEnum, SpaceSizeEnum, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Toaster, Tooltip, alertVariants, badgeSizeEnum, badgeVariantEnum, buttonSizeEnum, buttonVariantEnum, buttonVariantsConfig, getNebulaLanguage,
|
|
4258
|
+
export { Accordion, AccordionContent, AccordionDescription, AccordionItem, AccordionTitle, AccordionTrigger, ActionBar, ActionBarButton, ActionBarClose, ActionBarContent, ActionBarDivider, ActionBarPortal, ActionBarTrigger, Alert, AlertButton, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertTitle, StyledAsync as Async, StyledAsyncCreatable as AsyncCreatable, Badge, Box, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Caption, Checkbox, StyledCreatable as Creatable, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Heading, InputDatePickerSingle, InputDateTimePickerSingle, InputPhone, InputText, InputTime, Label, Link, NebulaI18nProvider, Pagination, Paragraph, Popover, PopoverContent, PopoverTrigger, StyledSelect as Select, Separator2 as Separator, Skeleton, Space, SpaceDirectionEnum, SpaceSizeEnum, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Toaster, Tooltip, alertVariants, badgeSizeEnum, badgeVariantEnum, buttonSizeEnum, buttonVariantEnum, buttonVariantsConfig, getNebulaLanguage, localeByi18nKey, messages13 as messages, separatorVariants, setNebulaLanguage, tagVariantsEnum, tailwind, toast, useNebulaI18n };
|