@ikatec/nebula-react 1.0.14 → 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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React8 from 'react';
2
- import React8__default, { forwardRef, createElement, createContext, useMemo, useState, useCallback, useEffect, useContext } from 'react';
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
 
@@ -495,193 +499,6 @@ var TableCell = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__
495
499
  TableCell.displayName = "TableCell";
496
500
  var TableCaption = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("caption", { ref, className: cn("mt-4 text-sm", className), ...props }));
497
501
  TableCaption.displayName = "TableCaption";
498
-
499
- // ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
500
- var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
501
- var mergeClasses = (...classes) => classes.filter((className, index, array) => {
502
- return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
503
- }).join(" ").trim();
504
-
505
- // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
506
- var defaultAttributes = {
507
- xmlns: "http://www.w3.org/2000/svg",
508
- width: 24,
509
- height: 24,
510
- viewBox: "0 0 24 24",
511
- fill: "none",
512
- stroke: "currentColor",
513
- strokeWidth: 2,
514
- strokeLinecap: "round",
515
- strokeLinejoin: "round"
516
- };
517
-
518
- // ../../node_modules/lucide-react/dist/esm/Icon.js
519
- var Icon = forwardRef(
520
- ({
521
- color: color2 = "currentColor",
522
- size: size4 = 24,
523
- strokeWidth = 2,
524
- absoluteStrokeWidth,
525
- className = "",
526
- children,
527
- iconNode,
528
- ...rest
529
- }, ref) => {
530
- return createElement(
531
- "svg",
532
- {
533
- ref,
534
- ...defaultAttributes,
535
- width: size4,
536
- height: size4,
537
- stroke: color2,
538
- strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size4) : strokeWidth,
539
- className: mergeClasses("lucide", className),
540
- ...rest
541
- },
542
- [
543
- ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
544
- ...Array.isArray(children) ? children : [children]
545
- ]
546
- );
547
- }
548
- );
549
-
550
- // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
551
- var createLucideIcon = (iconName, iconNode) => {
552
- const Component = forwardRef(
553
- ({ className, ...props }, ref) => createElement(Icon, {
554
- ref,
555
- iconNode,
556
- className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
557
- ...props
558
- })
559
- );
560
- Component.displayName = `${iconName}`;
561
- return Component;
562
- };
563
-
564
- // ../../node_modules/lucide-react/dist/esm/icons/check.js
565
- var __iconNode = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
566
- var Check = createLucideIcon("Check", __iconNode);
567
-
568
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-down.js
569
- var __iconNode2 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
570
- var ChevronDown = createLucideIcon("ChevronDown", __iconNode2);
571
-
572
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-left.js
573
- var __iconNode3 = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
574
- var ChevronLeft = createLucideIcon("ChevronLeft", __iconNode3);
575
-
576
- // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
577
- var __iconNode4 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
578
- var ChevronRight = createLucideIcon("ChevronRight", __iconNode4);
579
-
580
- // ../../node_modules/lucide-react/dist/esm/icons/chevrons-left.js
581
- var __iconNode5 = [
582
- ["path", { d: "m11 17-5-5 5-5", key: "13zhaf" }],
583
- ["path", { d: "m18 17-5-5 5-5", key: "h8a8et" }]
584
- ];
585
- var ChevronsLeft = createLucideIcon("ChevronsLeft", __iconNode5);
586
-
587
- // ../../node_modules/lucide-react/dist/esm/icons/chevrons-right.js
588
- var __iconNode6 = [
589
- ["path", { d: "m6 17 5-5-5-5", key: "xnjwq" }],
590
- ["path", { d: "m13 17 5-5-5-5", key: "17xmmf" }]
591
- ];
592
- var ChevronsRight = createLucideIcon("ChevronsRight", __iconNode6);
593
-
594
- // ../../node_modules/lucide-react/dist/esm/icons/circle-check-big.js
595
- var __iconNode7 = [
596
- ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
597
- ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
598
- ];
599
- var CircleCheckBig = createLucideIcon("CircleCheckBig", __iconNode7);
600
-
601
- // ../../node_modules/lucide-react/dist/esm/icons/circle-x.js
602
- var __iconNode8 = [
603
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
604
- ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
605
- ["path", { d: "m9 9 6 6", key: "z0biqf" }]
606
- ];
607
- var CircleX = createLucideIcon("CircleX", __iconNode8);
608
-
609
- // ../../node_modules/lucide-react/dist/esm/icons/circle.js
610
- var __iconNode9 = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
611
- var Circle = createLucideIcon("Circle", __iconNode9);
612
-
613
- // ../../node_modules/lucide-react/dist/esm/icons/ellipsis.js
614
- var __iconNode10 = [
615
- ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
616
- ["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
617
- ["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
618
- ];
619
- var Ellipsis = createLucideIcon("Ellipsis", __iconNode10);
620
-
621
- // ../../node_modules/lucide-react/dist/esm/icons/eye-off.js
622
- var __iconNode11 = [
623
- [
624
- "path",
625
- {
626
- 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",
627
- key: "ct8e1f"
628
- }
629
- ],
630
- ["path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242", key: "151rxh" }],
631
- [
632
- "path",
633
- {
634
- 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",
635
- key: "13bj9a"
636
- }
637
- ],
638
- ["path", { d: "m2 2 20 20", key: "1ooewy" }]
639
- ];
640
- var EyeOff = createLucideIcon("EyeOff", __iconNode11);
641
-
642
- // ../../node_modules/lucide-react/dist/esm/icons/eye.js
643
- var __iconNode12 = [
644
- [
645
- "path",
646
- {
647
- 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",
648
- key: "1nclc0"
649
- }
650
- ],
651
- ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
652
- ];
653
- var Eye = createLucideIcon("Eye", __iconNode12);
654
-
655
- // ../../node_modules/lucide-react/dist/esm/icons/info.js
656
- var __iconNode13 = [
657
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
658
- ["path", { d: "M12 16v-4", key: "1dtifu" }],
659
- ["path", { d: "M12 8h.01", key: "e9boi3" }]
660
- ];
661
- var Info = createLucideIcon("Info", __iconNode13);
662
-
663
- // ../../node_modules/lucide-react/dist/esm/icons/minus.js
664
- var __iconNode14 = [["path", { d: "M5 12h14", key: "1ays0h" }]];
665
- var Minus = createLucideIcon("Minus", __iconNode14);
666
-
667
- // ../../node_modules/lucide-react/dist/esm/icons/phone.js
668
- var __iconNode15 = [
669
- [
670
- "path",
671
- {
672
- 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",
673
- key: "foiqr5"
674
- }
675
- ]
676
- ];
677
- var Phone = createLucideIcon("Phone", __iconNode15);
678
-
679
- // ../../node_modules/lucide-react/dist/esm/icons/x.js
680
- var __iconNode16 = [
681
- ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
682
- ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
683
- ];
684
- var X = createLucideIcon("X", __iconNode16);
685
502
  var DropdownMenu = DropdownMenuPrimitive.Root;
686
503
  var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
687
504
  var DropdownMenuGroup = DropdownMenuPrimitive.Group;
@@ -1287,15 +1104,22 @@ var messages3 = {
1287
1104
  };
1288
1105
  var input_phone_default = messages3;
1289
1106
 
1107
+ // src/i18n/messages/en/time-picker.ts
1108
+ var messages4 = {
1109
+ label: "Time"
1110
+ };
1111
+ var time_picker_default = messages4;
1112
+
1290
1113
  // src/i18n/messages/en/index.ts
1291
1114
  var enMessages = {
1292
1115
  pagination: pagination_default,
1293
1116
  inputSelect: input_select_default,
1294
- inputPhone: input_phone_default
1117
+ inputPhone: input_phone_default,
1118
+ timePicker: time_picker_default
1295
1119
  };
1296
1120
 
1297
1121
  // src/i18n/messages/es/pagination.ts
1298
- var messages4 = {
1122
+ var messages5 = {
1299
1123
  totalResultsLabel(pagesSize, totalResults) {
1300
1124
  if (totalResults < pagesSize) {
1301
1125
  pagesSize = totalResults;
@@ -1306,16 +1130,16 @@ var messages4 = {
1306
1130
  return `P\xE1gina ${currentPage} de ${totalPages}`;
1307
1131
  }
1308
1132
  };
1309
- var pagination_default2 = messages4;
1133
+ var pagination_default2 = messages5;
1310
1134
 
1311
1135
  // src/i18n/messages/es/input-select.ts
1312
- var messages5 = {
1136
+ var messages6 = {
1313
1137
  noOptions: "No hay opciones disponibles"
1314
1138
  };
1315
- var input_select_default2 = messages5;
1139
+ var input_select_default2 = messages6;
1316
1140
 
1317
1141
  // src/i18n/messages/es/input-phone.ts
1318
- var messages6 = {
1142
+ var messages7 = {
1319
1143
  countries: {
1320
1144
  empty: "Seleccionar",
1321
1145
  AF: "Afganist\xE1n",
@@ -1565,17 +1389,24 @@ var messages6 = {
1565
1389
  ZW: "Zimbabue"
1566
1390
  }
1567
1391
  };
1568
- var input_phone_default2 = messages6;
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;
1569
1399
 
1570
1400
  // src/i18n/messages/es/index.ts
1571
1401
  var esMessages = {
1572
1402
  pagination: pagination_default2,
1573
1403
  inputSelect: input_select_default2,
1574
- inputPhone: input_phone_default2
1404
+ inputPhone: input_phone_default2,
1405
+ timePicker: time_picker_default2
1575
1406
  };
1576
1407
 
1577
1408
  // src/i18n/messages/pt-br/pagination.ts
1578
- var messages7 = {
1409
+ var messages9 = {
1579
1410
  totalResultsLabel(pagesSize, totalResults) {
1580
1411
  if (totalResults < pagesSize) {
1581
1412
  pagesSize = totalResults;
@@ -1586,16 +1417,16 @@ var messages7 = {
1586
1417
  return `P\xE1gina ${currentPage} de ${totalPages}`;
1587
1418
  }
1588
1419
  };
1589
- var pagination_default3 = messages7;
1420
+ var pagination_default3 = messages9;
1590
1421
 
1591
1422
  // src/i18n/messages/pt-br/input-select.ts
1592
- var messages8 = {
1423
+ var messages10 = {
1593
1424
  noOptions: "Nenhuma op\xE7\xE3o dispon\xEDvel"
1594
1425
  };
1595
- var input_select_default3 = messages8;
1426
+ var input_select_default3 = messages10;
1596
1427
 
1597
1428
  // src/i18n/messages/pt-br/input-phone.ts
1598
- var messages9 = {
1429
+ var messages11 = {
1599
1430
  countries: {
1600
1431
  empty: "Selecione",
1601
1432
  AF: "Afeganist\xE3o",
@@ -1845,13 +1676,20 @@ var messages9 = {
1845
1676
  ZW: "Zimb\xE1bue"
1846
1677
  }
1847
1678
  };
1848
- var input_phone_default3 = messages9;
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;
1849
1686
 
1850
1687
  // src/i18n/messages/pt-br/index.ts
1851
1688
  var ptBrMessages = {
1852
1689
  pagination: pagination_default3,
1853
1690
  inputSelect: input_select_default3,
1854
- inputPhone: input_phone_default3
1691
+ inputPhone: input_phone_default3,
1692
+ timePicker: time_picker_default3
1855
1693
  };
1856
1694
 
1857
1695
  // src/i18n/message-storage-handler.ts
@@ -1876,7 +1714,7 @@ var setNebulaLanguage = (language) => {
1876
1714
  }
1877
1715
  localStorage.setItem(getNebulaI18nStorageKey(), language);
1878
1716
  };
1879
- var messages10 = /* @__PURE__ */ new Map([
1717
+ var messages13 = /* @__PURE__ */ new Map([
1880
1718
  [null, enMessages],
1881
1719
  [void 0, enMessages],
1882
1720
  ["en-US", enMessages],
@@ -1894,14 +1732,14 @@ var NebulaI18nProvider = ({
1894
1732
  () => customI18nStorageKey ?? localStorageKey,
1895
1733
  [customI18nStorageKey]
1896
1734
  );
1897
- const [messages11, setMessages] = useState(
1898
- messages10.get(getNebulaLanguage()) ?? messages10.get("en-US")
1735
+ const [messages14, setMessages] = useState(
1736
+ messages13.get(getNebulaLanguage()) ?? messages13.get("en-US")
1899
1737
  );
1900
1738
  const handleStorageChange = useCallback(
1901
1739
  ({ detail }) => {
1902
1740
  if (detail.key === storageKey) {
1903
1741
  setMessages(
1904
- messages10.get(detail.value) ?? messages10.get("en-US")
1742
+ messages13.get(detail.value) ?? messages13.get("en-US")
1905
1743
  );
1906
1744
  }
1907
1745
  },
@@ -1941,7 +1779,16 @@ var NebulaI18nProvider = ({
1941
1779
  localStorage.removeItem(localStorageKey);
1942
1780
  localStorage.setItem(customNebulaI18nStorageKey, customI18nStorageKey);
1943
1781
  }, [customI18nStorageKey]);
1944
- return /* @__PURE__ */ jsx(NebulaI18nContext.Provider, { value: { messages: messages11 }, children });
1782
+ return /* @__PURE__ */ jsx(
1783
+ NebulaI18nContext.Provider,
1784
+ {
1785
+ value: {
1786
+ messages: messages14,
1787
+ locale: getNebulaLanguage()
1788
+ },
1789
+ children
1790
+ }
1791
+ );
1945
1792
  };
1946
1793
  var useNebulaI18n = () => {
1947
1794
  const context = useContext(NebulaI18nContext);
@@ -1958,7 +1805,7 @@ var Pagination = ({
1958
1805
  onChangePage,
1959
1806
  ...props
1960
1807
  }) => {
1961
- const { messages: messages11 } = useNebulaI18n();
1808
+ const { messages: messages14 } = useNebulaI18n();
1962
1809
  const totalPages = useMemo(() => {
1963
1810
  return Math.ceil(total / (pageSize || 1));
1964
1811
  }, [total, pageSize]);
@@ -1991,13 +1838,13 @@ var Pagination = ({
1991
1838
  }, [totalPages, pageSize, total]);
1992
1839
  const totalResultsLabel = useMemo(() => {
1993
1840
  if (page === totalPages) {
1994
- return messages11.pagination.totalResultsLabel(lastPageSize, total);
1841
+ return messages14.pagination.totalResultsLabel(lastPageSize, total);
1995
1842
  }
1996
- return messages11.pagination.totalResultsLabel(pageSize, total);
1997
- }, [messages11.pagination, pageSize, total, page, totalPages, lastPageSize]);
1843
+ return messages14.pagination.totalResultsLabel(pageSize, total);
1844
+ }, [messages14.pagination, pageSize, total, page, totalPages, lastPageSize]);
1998
1845
  const currentPageLabel = useMemo(
1999
- () => messages11.pagination.currentPageLabel(normalizedPage, totalPages),
2000
- [messages11.pagination, normalizedPage, totalPages]
1846
+ () => messages14.pagination.currentPageLabel(normalizedPage, totalPages),
1847
+ [messages14.pagination, normalizedPage, totalPages]
2001
1848
  );
2002
1849
  return /* @__PURE__ */ jsxs(
2003
1850
  "nav",
@@ -2270,7 +2117,7 @@ var createStyledSelect = (BaseSelect, displayName) => {
2270
2117
  isError = false,
2271
2118
  ...props
2272
2119
  }) => {
2273
- const { messages: messages11 } = useNebulaI18n();
2120
+ const { messages: messages14 } = useNebulaI18n();
2274
2121
  const customClassNames = useMemo(() => {
2275
2122
  return {
2276
2123
  control: (props2) => controlStyles(props2, isError),
@@ -2317,7 +2164,7 @@ var createStyledSelect = (BaseSelect, displayName) => {
2317
2164
  isDisabled: disabled,
2318
2165
  components: customComponents,
2319
2166
  classNames: customClassNames,
2320
- noOptionsMessage: () => /* @__PURE__ */ jsx("p", { children: messages11.inputSelect.noOptions }),
2167
+ noOptionsMessage: () => /* @__PURE__ */ jsx("p", { children: messages14.inputSelect.noOptions }),
2321
2168
  ...props
2322
2169
  }
2323
2170
  );
@@ -2333,7 +2180,15 @@ var StyledAsyncCreatable = createStyledSelect(
2333
2180
  "AsyncCreatable"
2334
2181
  );
2335
2182
  var InputText = React8.forwardRef(
2336
- ({ className, icon, isError = false, onClean, ...props }, ref) => {
2183
+ ({
2184
+ className,
2185
+ icon,
2186
+ isError = false,
2187
+ onClean,
2188
+ iconPlacement = "start",
2189
+ disabled,
2190
+ ...props
2191
+ }, ref) => {
2337
2192
  const initialInputType = props.type || "text";
2338
2193
  const [type, setType] = React8.useState(initialInputType);
2339
2194
  const iconClass = {
@@ -2341,60 +2196,79 @@ var InputText = React8.forwardRef(
2341
2196
  "text-inputText-icon-default focus:text-inputText-icon-focus": !isError && !props.value,
2342
2197
  "text-inputText-icon-filled focus:text-inputText-icon-filled": !isError && !!props.value
2343
2198
  };
2344
- return /* @__PURE__ */ jsxs("div", { className: "nebula-ds relative w-full", children: [
2345
- icon && /* @__PURE__ */ jsx("span", { className: "nebula-ds absolute left-4 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ jsx(
2346
- "span",
2347
- {
2348
- className: cn(
2349
- "w-4 h-4 flex items-center justify-center disabled:text-inputText-icon-disabled",
2350
- iconClass
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
+ }
2351
2228
  ),
2352
- children: icon
2353
- }
2354
- ) }),
2355
- /* @__PURE__ */ jsx(
2356
- "input",
2357
- {
2358
- ref,
2359
- className: cn(
2360
- "w-full h-10 outline-none rounded-input text-sm leading-none font-medium",
2361
- "bg-inputText-background-default disabled:bg-inputText-background-disabled",
2362
- "border border-inputText-border-default focus:ring-[3px] focus:ring-inputText-border-focus focus:border-inputText-border-focus",
2363
- "text-inputText-text-filled focus:text-inputText-text-focus placeholder:text-inputText-text-default disabled:text-inputText-text-disabled",
2364
- "disabled:cursor-not-allowed",
2229
+ onClean && props.value && /* @__PURE__ */ jsx(
2230
+ "button",
2365
2231
  {
2366
- "pl-10 pr-4": !!icon,
2367
- "px-4": !icon,
2368
- "border-inputText-border-danger focus:border-inputText-border-danger focus:ring-button-danger-border-focus": isError
2369
- },
2370
- className
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
+ }
2371
2240
  ),
2372
- ...props,
2373
- type
2374
- }
2375
- ),
2376
- onClean && props.value && /* @__PURE__ */ jsx(
2377
- "button",
2378
- {
2379
- type: "button",
2380
- className: cn("absolute top-1/2 transform -translate-y-1/2", {
2381
- "right-10": initialInputType === "password",
2382
- "right-4": initialInputType === "text"
2383
- }),
2384
- onClick: onClean,
2385
- children: /* @__PURE__ */ jsx(CircleX, { className: cn("w-4 h-4", iconClass) })
2386
- }
2387
- ),
2388
- initialInputType === "password" && /* @__PURE__ */ jsx(
2389
- "button",
2390
- {
2391
- type: "button",
2392
- className: "nebula-ds absolute right-4 top-1/2 transform -translate-y-1/2",
2393
- onClick: () => setType((prev) => prev === "text" ? "password" : "text"),
2394
- children: type === "text" ? /* @__PURE__ */ jsx(Eye, { className: cn("w-4 h-4", iconClass) }) : /* @__PURE__ */ jsx(EyeOff, { className: cn("w-4 h-4", iconClass) })
2395
- }
2396
- )
2397
- ] });
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
+ );
2398
2272
  }
2399
2273
  );
2400
2274
  InputText.displayName = "InputText";
@@ -2867,7 +2741,7 @@ var BreadcrumbEllipsis = ({
2867
2741
  ),
2868
2742
  ...props,
2869
2743
  children: [
2870
- /* @__PURE__ */ jsx(Ellipsis, { className: "nebula-ds h-3 w-3" }),
2744
+ /* @__PURE__ */ jsx(MoreHorizontal, { className: "nebula-ds h-3 w-3" }),
2871
2745
  /* @__PURE__ */ jsx("span", { className: "nebula-ds sr-only", children: "More" })
2872
2746
  ]
2873
2747
  }
@@ -3293,13 +3167,13 @@ function custom(message, options) {
3293
3167
  }
3294
3168
  );
3295
3169
  }
3296
- async function promise(promise2, messages11, options) {
3170
+ async function promise(promise2, messages14, options) {
3297
3171
  const loadingToast = toast$1.custom(
3298
3172
  (t) => /* @__PURE__ */ jsx(
3299
3173
  ToastComponent,
3300
3174
  {
3301
3175
  type: "info",
3302
- message: messages11.loading,
3176
+ message: messages14.loading,
3303
3177
  options,
3304
3178
  t
3305
3179
  }
@@ -3313,7 +3187,7 @@ async function promise(promise2, messages11, options) {
3313
3187
  ToastComponent,
3314
3188
  {
3315
3189
  type: "success",
3316
- message: messages11.success,
3190
+ message: messages14.success,
3317
3191
  options,
3318
3192
  t
3319
3193
  }
@@ -3328,7 +3202,7 @@ async function promise(promise2, messages11, options) {
3328
3202
  ToastComponent,
3329
3203
  {
3330
3204
  type: "error",
3331
- message: messages11.error,
3205
+ message: messages14.error,
3332
3206
  options,
3333
3207
  t
3334
3208
  }
@@ -3498,12 +3372,12 @@ var CountrySelect = ({
3498
3372
  const handleSelect = (event) => {
3499
3373
  onChange(event.target.value);
3500
3374
  };
3501
- const { messages: messages11 } = useNebulaI18n();
3502
- const { countries } = messages11.inputPhone;
3375
+ const { messages: messages14 } = useNebulaI18n();
3376
+ const { countries } = messages14.inputPhone;
3503
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: [
3504
3378
  /* @__PURE__ */ jsxs("div", { className: "nebula-ds inline-flex items-center gap-1", "aria-hidden": "true", children: [
3505
3379
  /* @__PURE__ */ jsx(FlagComponent, { country: value, countryName: value, "aria-hidden": "true" }),
3506
- /* @__PURE__ */ jsx("span", { className: "nebula-ds text-inputText-text-filled focus:text-inputText-text-focus", children: /* @__PURE__ */ jsx(ChevronDown, { size: 16, "aria-hidden": "true" }) })
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" }) })
3507
3381
  ] }),
3508
3382
  /* @__PURE__ */ jsxs(
3509
3383
  "select",
@@ -3527,7 +3401,7 @@ var CountrySelect = ({
3527
3401
  };
3528
3402
  var FlagComponent = ({ country, countryName }) => {
3529
3403
  const Flag = flags[country];
3530
- return /* @__PURE__ */ jsx("span", { className: "nebula-ds w-5 overflow-hidden rounded-sm", children: Flag ? /* @__PURE__ */ jsx(Flag, { title: countryName }) : /* @__PURE__ */ jsx(Phone, { size: 16, "aria-hidden": "true" }) });
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" }) });
3531
3405
  };
3532
3406
  var PhoneInput = React8__default.forwardRef(({ className, ...props }, ref) => {
3533
3407
  return /* @__PURE__ */ jsxs("div", { className: "nebula-ds flex items-center justify-center rounded-e-[20px] w-full", children: [
@@ -3635,6 +3509,741 @@ var Skeleton = React8__default.forwardRef(
3635
3509
  }
3636
3510
  );
3637
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
+ };
3638
4247
 
3639
4248
  // src/tailwind.ts
3640
4249
  function content({ base = "./" } = {}) {
@@ -3645,35 +4254,5 @@ var tailwind = {
3645
4254
  content
3646
4255
  // plugin: () => require("tailwindcss")("node_modules/@nebulareact/dist/tailwind.config.js"),
3647
4256
  };
3648
- /*! Bundled license information:
3649
-
3650
- lucide-react/dist/esm/shared/src/utils.js:
3651
- lucide-react/dist/esm/defaultAttributes.js:
3652
- lucide-react/dist/esm/Icon.js:
3653
- lucide-react/dist/esm/createLucideIcon.js:
3654
- lucide-react/dist/esm/icons/check.js:
3655
- lucide-react/dist/esm/icons/chevron-down.js:
3656
- lucide-react/dist/esm/icons/chevron-left.js:
3657
- lucide-react/dist/esm/icons/chevron-right.js:
3658
- lucide-react/dist/esm/icons/chevrons-left.js:
3659
- lucide-react/dist/esm/icons/chevrons-right.js:
3660
- lucide-react/dist/esm/icons/circle-check-big.js:
3661
- lucide-react/dist/esm/icons/circle-x.js:
3662
- lucide-react/dist/esm/icons/circle.js:
3663
- lucide-react/dist/esm/icons/ellipsis.js:
3664
- lucide-react/dist/esm/icons/eye-off.js:
3665
- lucide-react/dist/esm/icons/eye.js:
3666
- lucide-react/dist/esm/icons/info.js:
3667
- lucide-react/dist/esm/icons/minus.js:
3668
- lucide-react/dist/esm/icons/phone.js:
3669
- lucide-react/dist/esm/icons/x.js:
3670
- lucide-react/dist/esm/lucide-react.js:
3671
- (**
3672
- * @license lucide-react v0.476.0 - ISC
3673
- *
3674
- * This source code is licensed under the ISC license.
3675
- * See the LICENSE file in the root directory of this source tree.
3676
- *)
3677
- */
3678
4257
 
3679
- 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, messages10 as messages, separatorVariants, setNebulaLanguage, tagVariantsEnum, tailwind, toast, useNebulaI18n };
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 };