analytica-frontend-lib 1.0.43 → 1.0.45

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.js CHANGED
@@ -39,6 +39,7 @@ __export(src_exports, {
39
39
  MenuItem: () => MenuItem,
40
40
  MenuLabel: () => MenuLabel,
41
41
  MenuSeparator: () => MenuSeparator,
42
+ Modal: () => Modal_default,
42
43
  NavButton: () => NavButton_default,
43
44
  ProfileMenuFooter: () => ProfileMenuFooter,
44
45
  ProfileMenuHeader: () => ProfileMenuHeader,
@@ -1301,7 +1302,7 @@ var STATE_CLASSES4 = {
1301
1302
  default: "border-border-300 placeholder:text-text-600 hover:border-border-400",
1302
1303
  error: "border-2 border-indicator-error placeholder:text-text-600",
1303
1304
  disabled: "border-border-300 placeholder:text-text-600 cursor-not-allowed opacity-40",
1304
- "read-only": "border-border-300 !text-text-600 cursor-default focus:outline-none bg-background-50"
1305
+ "read-only": "border-transparent !text-text-600 cursor-default focus:outline-none bg-transparent"
1305
1306
  };
1306
1307
  var VARIANT_CLASSES = {
1307
1308
  outlined: "border rounded-lg",
@@ -1340,6 +1341,9 @@ var getCombinedClasses = (actualState, variant) => {
1340
1341
  if (actualState === "error" && variant === "underlined") {
1341
1342
  return "border-0 border-b-2 border-indicator-error rounded-none bg-transparent focus:outline-none focus:border-primary-950 placeholder:text-text-600";
1342
1343
  }
1344
+ if (actualState === "read-only" && variant === "underlined") {
1345
+ return "border-0 border-b-0 rounded-none bg-transparent focus:outline-none !text-text-900 cursor-default";
1346
+ }
1343
1347
  return `${stateClasses} ${variantClasses}`;
1344
1348
  };
1345
1349
  var Input = (0, import_react8.forwardRef)(
@@ -1370,7 +1374,7 @@ var Input = (0, import_react8.forwardRef)(
1370
1374
  [actualState, variant]
1371
1375
  );
1372
1376
  const iconSize = getIconSize(size);
1373
- const baseClasses = "bg-background w-full py-2 px-3 font-normal text-text-900 focus:outline-primary-950";
1377
+ const baseClasses = `bg-background w-full py-2 ${actualState === "read-only" ? "px-0" : "px-3"} font-normal text-text-900 focus:outline-primary-950`;
1374
1378
  const generatedId = (0, import_react8.useId)();
1375
1379
  const inputId = id ?? `input-${generatedId}`;
1376
1380
  const togglePasswordVisibility = () => setShowPassword(!showPassword);
@@ -1522,101 +1526,397 @@ var VARIANT_CLASSES2 = {
1522
1526
  // Green for performance (#84D3A2)
1523
1527
  }
1524
1528
  };
1525
- var ProgressBar = ({
1526
- value,
1527
- max = 100,
1528
- size = "medium",
1529
- variant = "blue",
1530
- label,
1531
- showPercentage = false,
1532
- className = "",
1533
- labelClassName = "",
1534
- percentageClassName = ""
1535
- }) => {
1529
+ var calculateProgressValues = (value, max) => {
1536
1530
  const safeValue = isNaN(value) ? 0 : value;
1537
1531
  const clampedValue = Math.max(0, Math.min(safeValue, max));
1538
1532
  const percentage = max === 0 ? 0 : clampedValue / max * 100;
1539
- const sizeClasses = SIZE_CLASSES7[size];
1540
- const variantClasses = VARIANT_CLASSES2[variant];
1541
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1533
+ return { clampedValue, percentage };
1534
+ };
1535
+ var shouldShowHeader = (label, showPercentage, showHitCount) => {
1536
+ return !!(label || showPercentage || showHitCount);
1537
+ };
1538
+ var getDisplayPriority = (showHitCount, showPercentage, label, clampedValue, max, percentage) => {
1539
+ if (showHitCount) {
1540
+ return {
1541
+ type: "hitCount",
1542
+ content: `${Math.round(clampedValue)} de ${max}`,
1543
+ hasMetrics: true
1544
+ };
1545
+ }
1546
+ if (showPercentage) {
1547
+ return {
1548
+ type: "percentage",
1549
+ content: `${Math.round(percentage)}%`,
1550
+ hasMetrics: true
1551
+ };
1552
+ }
1553
+ return {
1554
+ type: "label",
1555
+ content: label,
1556
+ hasMetrics: false
1557
+ };
1558
+ };
1559
+ var getCompactLayoutConfig = ({
1560
+ showPercentage,
1561
+ showHitCount,
1562
+ percentage,
1563
+ clampedValue,
1564
+ max,
1565
+ label,
1566
+ percentageClassName,
1567
+ labelClassName
1568
+ }) => {
1569
+ const displayPriority = getDisplayPriority(
1570
+ showHitCount,
1571
+ showPercentage,
1572
+ label,
1573
+ clampedValue,
1574
+ max,
1575
+ percentage
1576
+ );
1577
+ return {
1578
+ color: displayPriority.hasMetrics ? "text-primary-600" : "text-primary-700",
1579
+ className: displayPriority.hasMetrics ? percentageClassName : labelClassName,
1580
+ content: displayPriority.content
1581
+ };
1582
+ };
1583
+ var getDefaultLayoutDisplayConfig = (size, label, showPercentage) => ({
1584
+ showHeader: size === "small" && !!(label || showPercentage),
1585
+ showPercentage: size === "medium" && showPercentage,
1586
+ showLabel: size === "medium" && !!label && !showPercentage
1587
+ // Only show label when percentage is not shown
1588
+ });
1589
+ var renderStackedHitCountDisplay = (showHitCount, showPercentage, clampedValue, max, percentage, percentageClassName) => {
1590
+ if (!showHitCount && !showPercentage) return null;
1591
+ const displayPriority = getDisplayPriority(
1592
+ showHitCount,
1593
+ showPercentage,
1594
+ null,
1595
+ // label is not relevant for stacked layout metrics display
1596
+ clampedValue,
1597
+ max,
1598
+ percentage
1599
+ );
1600
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1542
1601
  "div",
1543
1602
  {
1544
- className: `flex ${sizeClasses.layout} ${size === "medium" ? "gap-2" : sizeClasses.spacing} ${className}`,
1545
- children: [
1546
- size === "small" && (label || showPercentage) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-row items-center justify-between w-full", children: [
1547
- label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1548
- Text_default,
1549
- {
1550
- as: "div",
1551
- size: "xs",
1552
- weight: "medium",
1553
- className: `text-text-950 leading-none tracking-normal text-center ${labelClassName}`,
1554
- children: label
1555
- }
1556
- ),
1557
- showPercentage && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1558
- Text_default,
1559
- {
1560
- size: "xs",
1561
- weight: "medium",
1562
- className: `text-text-950 leading-none tracking-normal text-center ${percentageClassName}`,
1563
- children: [
1564
- Math.round(percentage),
1565
- "%"
1566
- ]
1567
- }
1568
- )
1569
- ] }),
1570
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1571
- "div",
1572
- {
1573
- className: `${size === "medium" ? "flex-grow" : "w-full"} ${sizeClasses.container} ${variantClasses.background} ${sizeClasses.borderRadius} overflow-hidden relative`,
1574
- children: [
1575
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1576
- "progress",
1577
- {
1578
- value: clampedValue,
1579
- max,
1580
- "aria-label": typeof label === "string" ? label : "Progress",
1581
- className: "absolute inset-0 w-full h-full opacity-0"
1582
- }
1583
- ),
1584
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1585
- "div",
1586
- {
1587
- className: `${sizeClasses.bar} ${variantClasses.fill} ${sizeClasses.borderRadius} transition-all duration-300 ease-out shadow-hard-shadow-3`,
1588
- style: { width: `${percentage}%` }
1589
- }
1590
- )
1591
- ]
1592
- }
1593
- ),
1594
- size === "medium" && showPercentage && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1603
+ className: `text-xs font-medium leading-[14px] text-right ${percentageClassName}`,
1604
+ children: displayPriority.type === "hitCount" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
1605
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-success-200", children: Math.round(clampedValue) }),
1606
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "text-text-600", children: [
1607
+ " de ",
1608
+ max
1609
+ ] })
1610
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Text_default, { size: "xs", weight: "medium", className: "text-success-200", children: [
1611
+ Math.round(percentage),
1612
+ "%"
1613
+ ] })
1614
+ }
1615
+ );
1616
+ };
1617
+ var ProgressBarBase = ({
1618
+ clampedValue,
1619
+ max,
1620
+ percentage,
1621
+ label,
1622
+ variantClasses,
1623
+ containerClassName,
1624
+ fillClassName
1625
+ }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1626
+ "div",
1627
+ {
1628
+ className: `${containerClassName} ${variantClasses.background} overflow-hidden relative`,
1629
+ children: [
1630
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1631
+ "progress",
1632
+ {
1633
+ value: clampedValue,
1634
+ max,
1635
+ "aria-label": typeof label === "string" ? `${label}: ${Math.round(percentage)}% complete` : `Progress: ${Math.round(percentage)}% of ${max}`,
1636
+ className: "absolute inset-0 w-full h-full opacity-0"
1637
+ }
1638
+ ),
1639
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1640
+ "div",
1641
+ {
1642
+ className: `${fillClassName} ${variantClasses.fill} transition-all duration-300 ease-out`,
1643
+ style: { width: `${percentage}%` }
1644
+ }
1645
+ )
1646
+ ]
1647
+ }
1648
+ );
1649
+ var StackedLayout = ({
1650
+ className,
1651
+ label,
1652
+ showPercentage,
1653
+ showHitCount,
1654
+ labelClassName,
1655
+ percentageClassName,
1656
+ clampedValue,
1657
+ max,
1658
+ percentage,
1659
+ variantClasses,
1660
+ dimensions
1661
+ }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1662
+ "div",
1663
+ {
1664
+ className: `flex flex-col items-start gap-2 ${dimensions.width} ${dimensions.height} ${className}`,
1665
+ children: [
1666
+ shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-row justify-between items-center w-full h-[19px]", children: [
1667
+ label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1595
1668
  Text_default,
1596
1669
  {
1597
- size: "xs",
1670
+ as: "div",
1671
+ size: "md",
1598
1672
  weight: "medium",
1599
- className: `text-text-950 leading-none tracking-normal text-center flex-none ${percentageClassName}`,
1600
- children: [
1601
- Math.round(percentage),
1602
- "%"
1603
- ]
1673
+ className: `text-text-600 leading-[19px] ${labelClassName}`,
1674
+ children: label
1604
1675
  }
1605
1676
  ),
1606
- size === "medium" && label && !showPercentage && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1677
+ renderStackedHitCountDisplay(
1678
+ showHitCount,
1679
+ showPercentage,
1680
+ clampedValue,
1681
+ max,
1682
+ percentage,
1683
+ percentageClassName
1684
+ )
1685
+ ] }),
1686
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1687
+ ProgressBarBase,
1688
+ {
1689
+ clampedValue,
1690
+ max,
1691
+ percentage,
1692
+ label,
1693
+ variantClasses,
1694
+ containerClassName: "w-full h-2 rounded-lg",
1695
+ fillClassName: "h-2 rounded-lg shadow-hard-shadow-3"
1696
+ }
1697
+ )
1698
+ ]
1699
+ }
1700
+ );
1701
+ var CompactLayout = ({
1702
+ className,
1703
+ label,
1704
+ showPercentage,
1705
+ showHitCount,
1706
+ labelClassName,
1707
+ percentageClassName,
1708
+ clampedValue,
1709
+ max,
1710
+ percentage,
1711
+ variantClasses,
1712
+ dimensions
1713
+ }) => {
1714
+ const {
1715
+ color,
1716
+ className: compactClassName,
1717
+ content
1718
+ } = getCompactLayoutConfig({
1719
+ showPercentage,
1720
+ showHitCount,
1721
+ percentage,
1722
+ clampedValue,
1723
+ max,
1724
+ label,
1725
+ percentageClassName,
1726
+ labelClassName
1727
+ });
1728
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1729
+ "div",
1730
+ {
1731
+ className: `flex flex-col items-start gap-1 ${dimensions.width} ${dimensions.height} ${className}`,
1732
+ children: [
1733
+ shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1607
1734
  Text_default,
1608
1735
  {
1609
1736
  as: "div",
1610
- size: "xs",
1737
+ size: "sm",
1611
1738
  weight: "medium",
1612
- className: `text-text-950 leading-none tracking-normal text-center flex-none ${labelClassName}`,
1613
- children: label
1739
+ color,
1740
+ className: `leading-4 w-full ${compactClassName}`,
1741
+ children: content
1742
+ }
1743
+ ),
1744
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1745
+ ProgressBarBase,
1746
+ {
1747
+ clampedValue,
1748
+ max,
1749
+ percentage,
1750
+ label,
1751
+ variantClasses,
1752
+ containerClassName: "w-full h-1 rounded-full",
1753
+ fillClassName: "h-1 rounded-full"
1614
1754
  }
1615
1755
  )
1616
1756
  ]
1617
1757
  }
1618
1758
  );
1619
1759
  };
1760
+ var DefaultLayout = ({
1761
+ className,
1762
+ size,
1763
+ sizeClasses,
1764
+ variantClasses,
1765
+ label,
1766
+ showPercentage,
1767
+ labelClassName,
1768
+ percentageClassName,
1769
+ clampedValue,
1770
+ max,
1771
+ percentage
1772
+ }) => {
1773
+ const gapClass = size === "medium" ? "gap-2" : sizeClasses.spacing;
1774
+ const progressBarClass = size === "medium" ? "flex-grow" : "w-full";
1775
+ const displayConfig = getDefaultLayoutDisplayConfig(
1776
+ size,
1777
+ label,
1778
+ showPercentage
1779
+ );
1780
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `flex ${sizeClasses.layout} ${gapClass} ${className}`, children: [
1781
+ displayConfig.showHeader && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-row items-center justify-between w-full", children: [
1782
+ label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1783
+ Text_default,
1784
+ {
1785
+ as: "div",
1786
+ size: "xs",
1787
+ weight: "medium",
1788
+ className: `text-text-950 leading-none tracking-normal text-center ${labelClassName}`,
1789
+ children: label
1790
+ }
1791
+ ),
1792
+ showPercentage && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1793
+ Text_default,
1794
+ {
1795
+ size: "xs",
1796
+ weight: "medium",
1797
+ className: `text-text-950 leading-none tracking-normal text-center ${percentageClassName}`,
1798
+ children: [
1799
+ Math.round(percentage),
1800
+ "%"
1801
+ ]
1802
+ }
1803
+ )
1804
+ ] }),
1805
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1806
+ ProgressBarBase,
1807
+ {
1808
+ clampedValue,
1809
+ max,
1810
+ percentage,
1811
+ label,
1812
+ variantClasses,
1813
+ containerClassName: `${progressBarClass} ${sizeClasses.container} ${sizeClasses.borderRadius}`,
1814
+ fillClassName: `${sizeClasses.bar} ${sizeClasses.borderRadius} shadow-hard-shadow-3`
1815
+ }
1816
+ ),
1817
+ displayConfig.showPercentage && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1818
+ Text_default,
1819
+ {
1820
+ size: "xs",
1821
+ weight: "medium",
1822
+ className: `text-text-950 leading-none tracking-normal text-center flex-none ${percentageClassName}`,
1823
+ children: [
1824
+ Math.round(percentage),
1825
+ "%"
1826
+ ]
1827
+ }
1828
+ ),
1829
+ displayConfig.showLabel && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1830
+ Text_default,
1831
+ {
1832
+ as: "div",
1833
+ size: "xs",
1834
+ weight: "medium",
1835
+ className: `text-text-950 leading-none tracking-normal text-center flex-none ${labelClassName}`,
1836
+ children: label
1837
+ }
1838
+ )
1839
+ ] });
1840
+ };
1841
+ var ProgressBar = ({
1842
+ value,
1843
+ max = 100,
1844
+ size = "medium",
1845
+ variant = "blue",
1846
+ layout = "default",
1847
+ label,
1848
+ showPercentage = false,
1849
+ showHitCount = false,
1850
+ className = "",
1851
+ labelClassName = "",
1852
+ percentageClassName = "",
1853
+ stackedWidth,
1854
+ stackedHeight,
1855
+ compactWidth,
1856
+ compactHeight
1857
+ }) => {
1858
+ const { clampedValue, percentage } = calculateProgressValues(value, max);
1859
+ const sizeClasses = SIZE_CLASSES7[size];
1860
+ const variantClasses = VARIANT_CLASSES2[variant];
1861
+ if (layout === "stacked") {
1862
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1863
+ StackedLayout,
1864
+ {
1865
+ className,
1866
+ label,
1867
+ showPercentage,
1868
+ showHitCount,
1869
+ labelClassName,
1870
+ percentageClassName,
1871
+ clampedValue,
1872
+ max,
1873
+ percentage,
1874
+ variantClasses,
1875
+ dimensions: {
1876
+ width: stackedWidth ?? "w-[380px]",
1877
+ height: stackedHeight ?? "h-[35px]"
1878
+ }
1879
+ }
1880
+ );
1881
+ }
1882
+ if (layout === "compact") {
1883
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1884
+ CompactLayout,
1885
+ {
1886
+ className,
1887
+ label,
1888
+ showPercentage,
1889
+ showHitCount,
1890
+ labelClassName,
1891
+ percentageClassName,
1892
+ clampedValue,
1893
+ max,
1894
+ percentage,
1895
+ variantClasses,
1896
+ dimensions: {
1897
+ width: compactWidth ?? "w-[131px]",
1898
+ height: compactHeight ?? "h-[24px]"
1899
+ }
1900
+ }
1901
+ );
1902
+ }
1903
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1904
+ DefaultLayout,
1905
+ {
1906
+ className,
1907
+ size,
1908
+ sizeClasses,
1909
+ variantClasses,
1910
+ label,
1911
+ showPercentage,
1912
+ labelClassName,
1913
+ percentageClassName,
1914
+ clampedValue,
1915
+ max,
1916
+ percentage
1917
+ }
1918
+ );
1919
+ };
1620
1920
  var ProgressBar_default = ProgressBar;
1621
1921
 
1622
1922
  // src/components/ProgressCircle/ProgressCircle.tsx
@@ -1860,7 +2160,7 @@ var getDayStyles = (day, variant, showActivities) => {
1860
2160
  dayStyle = "bg-primary-800";
1861
2161
  textStyle = "text-white";
1862
2162
  } else if (day.isToday) {
1863
- textStyle = "text-[#1c61b2]";
2163
+ textStyle = "text-primary-800";
1864
2164
  } else if (variant === "navigation" && showActivities && day.activities?.length) {
1865
2165
  const primaryActivity = day.activities[0];
1866
2166
  if (primaryActivity.status === "near-deadline") {
@@ -2096,7 +2396,7 @@ var Calendar = ({
2096
2396
  );
2097
2397
  let spanClass = "";
2098
2398
  if (day.isSelected && day.isToday) {
2099
- spanClass = "h-6 w-6 rounded-full bg-[#1c61b2] text-text";
2399
+ spanClass = "h-6 w-6 rounded-full bg-primary-800 text-text";
2100
2400
  } else if (day.isSelected) {
2101
2401
  spanClass = "h-6 w-6 rounded-full bg-primary-950 text-text";
2102
2402
  }
@@ -2108,12 +2408,12 @@ var Calendar = ({
2108
2408
  "button",
2109
2409
  {
2110
2410
  className: `
2111
- w-9 h-9
2112
- flex items-center justify-center
2113
- text-md font-normal
2114
- cursor-pointer
2411
+ w-9 h-9
2412
+ flex items-center justify-center
2413
+ text-md font-normal
2414
+ cursor-pointer
2115
2415
  rounded-full
2116
- ${dayStyle}
2416
+ ${dayStyle}
2117
2417
  ${textStyle}
2118
2418
  `,
2119
2419
  onClick: () => handleDateSelect(day),
@@ -2262,13 +2562,13 @@ var Calendar = ({
2262
2562
  "button",
2263
2563
  {
2264
2564
  className: `
2265
- w-10 h-10
2266
- flex items-center justify-center
2267
- text-xl font-normal
2268
- cursor-pointer
2565
+ w-10 h-10
2566
+ flex items-center justify-center
2567
+ text-xl font-normal
2568
+ cursor-pointer
2269
2569
  rounded-full
2270
2570
  focus:outline-none focus:ring-2 focus:ring-primary-600 focus:ring-offset-1
2271
- ${dayStyle}
2571
+ ${dayStyle}
2272
2572
  ${textStyle}
2273
2573
  `,
2274
2574
  onClick: () => handleDateSelect(day),
@@ -2286,11 +2586,107 @@ var Calendar = ({
2286
2586
  };
2287
2587
  var Calendar_default = Calendar;
2288
2588
 
2289
- // src/components/DropdownMenu/DropdownMenu.tsx
2290
- var import_phosphor_react7 = require("phosphor-react");
2589
+ // src/components/Modal/Modal.tsx
2291
2590
  var import_react10 = require("react");
2292
- var import_zustand2 = require("zustand");
2591
+ var import_phosphor_react7 = require("phosphor-react");
2293
2592
  var import_jsx_runtime21 = require("react/jsx-runtime");
2593
+ var SIZE_CLASSES9 = {
2594
+ xs: "max-w-[360px]",
2595
+ sm: "max-w-[420px]",
2596
+ md: "max-w-[510px]",
2597
+ lg: "max-w-[640px]",
2598
+ xl: "max-w-[970px]"
2599
+ };
2600
+ var Modal = ({
2601
+ isOpen,
2602
+ onClose,
2603
+ title,
2604
+ children,
2605
+ size = "md",
2606
+ className = "",
2607
+ closeOnBackdropClick = true,
2608
+ closeOnEscape = true,
2609
+ footer,
2610
+ hideCloseButton = false
2611
+ }) => {
2612
+ (0, import_react10.useEffect)(() => {
2613
+ if (!isOpen || !closeOnEscape) return;
2614
+ const handleEscape = (event) => {
2615
+ if (event.key === "Escape") {
2616
+ onClose();
2617
+ }
2618
+ };
2619
+ document.addEventListener("keydown", handleEscape);
2620
+ return () => document.removeEventListener("keydown", handleEscape);
2621
+ }, [isOpen, closeOnEscape, onClose]);
2622
+ (0, import_react10.useEffect)(() => {
2623
+ const originalOverflow = document.body.style.overflow;
2624
+ if (isOpen) {
2625
+ document.body.style.overflow = "hidden";
2626
+ } else {
2627
+ document.body.style.overflow = originalOverflow;
2628
+ }
2629
+ return () => {
2630
+ document.body.style.overflow = originalOverflow;
2631
+ };
2632
+ }, [isOpen]);
2633
+ const handleBackdropClick = (event) => {
2634
+ if (closeOnBackdropClick && event.target === event.currentTarget) {
2635
+ onClose();
2636
+ }
2637
+ };
2638
+ const handleBackdropKeyDown = (event) => {
2639
+ if (closeOnBackdropClick && (event.key === "Enter" || event.key === " ")) {
2640
+ onClose();
2641
+ }
2642
+ };
2643
+ if (!isOpen) return null;
2644
+ const sizeClasses = SIZE_CLASSES9[size];
2645
+ const baseClasses = "bg-background rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
2646
+ const modalClasses = `${baseClasses} ${sizeClasses} ${className}`;
2647
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2648
+ "div",
2649
+ {
2650
+ className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs",
2651
+ onClick: handleBackdropClick,
2652
+ onKeyDown: handleBackdropKeyDown,
2653
+ role: "none",
2654
+ "aria-hidden": "true",
2655
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2656
+ "div",
2657
+ {
2658
+ className: modalClasses,
2659
+ role: "dialog",
2660
+ "aria-modal": "true",
2661
+ "aria-labelledby": "modal-title",
2662
+ children: [
2663
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between px-6 py-6", children: [
2664
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { id: "modal-title", className: "text-lg font-semibold text-text-950", children: title }),
2665
+ !hideCloseButton && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2666
+ "button",
2667
+ {
2668
+ onClick: onClose,
2669
+ className: "p-1 text-text-500 hover:text-text-700 hover:bg-background-50 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-indicator-info focus:ring-offset-2",
2670
+ "aria-label": "Fechar modal",
2671
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_phosphor_react7.X, { size: 18 })
2672
+ }
2673
+ )
2674
+ ] }),
2675
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "px-6 pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
2676
+ footer && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
2677
+ ]
2678
+ }
2679
+ )
2680
+ }
2681
+ );
2682
+ };
2683
+ var Modal_default = Modal;
2684
+
2685
+ // src/components/DropdownMenu/DropdownMenu.tsx
2686
+ var import_phosphor_react8 = require("phosphor-react");
2687
+ var import_react11 = require("react");
2688
+ var import_zustand2 = require("zustand");
2689
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2294
2690
  function createDropdownStore() {
2295
2691
  return (0, import_zustand2.create)((set) => ({
2296
2692
  open: false,
@@ -2306,8 +2702,8 @@ var useDropdownStore = (externalStore) => {
2306
2702
  return externalStore;
2307
2703
  };
2308
2704
  var injectStore = (children, store) => {
2309
- return import_react10.Children.map(children, (child) => {
2310
- if ((0, import_react10.isValidElement)(child)) {
2705
+ return import_react11.Children.map(children, (child) => {
2706
+ if ((0, import_react11.isValidElement)(child)) {
2311
2707
  const typedChild = child;
2312
2708
  const newProps = {
2313
2709
  store
@@ -2315,23 +2711,24 @@ var injectStore = (children, store) => {
2315
2711
  if (typedChild.props.children) {
2316
2712
  newProps.children = injectStore(typedChild.props.children, store);
2317
2713
  }
2318
- return (0, import_react10.cloneElement)(typedChild, newProps);
2714
+ return (0, import_react11.cloneElement)(typedChild, newProps);
2319
2715
  }
2320
2716
  return child;
2321
2717
  });
2322
2718
  };
2323
- var DropdownMenu = ({ children, open, onOpenChange }) => {
2324
- const storeRef = (0, import_react10.useRef)(null);
2719
+ var DropdownMenu = ({
2720
+ children,
2721
+ open: propOpen,
2722
+ onOpenChange
2723
+ }) => {
2724
+ const storeRef = (0, import_react11.useRef)(null);
2325
2725
  storeRef.current ??= createDropdownStore();
2326
2726
  const store = storeRef.current;
2327
- const isControlled = open !== void 0;
2328
- const uncontrolledOpen = (0, import_zustand2.useStore)(store, (s) => s.open);
2329
- const currentOpen = isControlled ? open : uncontrolledOpen;
2727
+ const { open, setOpen: storeSetOpen } = (0, import_zustand2.useStore)(store, (s) => s);
2330
2728
  const setOpen = (newOpen) => {
2331
- onOpenChange?.(newOpen);
2332
- if (!isControlled) store.setState({ open: newOpen });
2729
+ storeSetOpen(newOpen);
2333
2730
  };
2334
- const menuRef = (0, import_react10.useRef)(null);
2731
+ const menuRef = (0, import_react11.useRef)(null);
2335
2732
  const handleArrowDownOrArrowUp = (event) => {
2336
2733
  const menuContent = menuRef.current?.querySelector('[role="menu"]');
2337
2734
  if (menuContent) {
@@ -2365,9 +2762,8 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
2365
2762
  setOpen(false);
2366
2763
  }
2367
2764
  };
2368
- (0, import_react10.useEffect)(() => {
2369
- onOpenChange?.(currentOpen);
2370
- if (currentOpen) {
2765
+ (0, import_react11.useEffect)(() => {
2766
+ if (open) {
2371
2767
  document.addEventListener("mousedown", handleClickOutside);
2372
2768
  document.addEventListener("keydown", handleDownkey);
2373
2769
  }
@@ -2375,13 +2771,17 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
2375
2771
  document.removeEventListener("mousedown", handleClickOutside);
2376
2772
  document.removeEventListener("keydown", handleDownkey);
2377
2773
  };
2378
- }, [currentOpen]);
2379
- (0, import_react10.useEffect)(() => {
2380
- if (isControlled) {
2381
- store.setState({ open });
2774
+ }, [open]);
2775
+ (0, import_react11.useEffect)(() => {
2776
+ setOpen(open);
2777
+ onOpenChange?.(open);
2778
+ }, [open, onOpenChange]);
2779
+ (0, import_react11.useEffect)(() => {
2780
+ if (propOpen) {
2781
+ setOpen(propOpen);
2382
2782
  }
2383
- }, []);
2384
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
2783
+ }, [propOpen]);
2784
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
2385
2785
  };
2386
2786
  var DropdownMenuTrigger = ({
2387
2787
  className,
@@ -2393,7 +2793,7 @@ var DropdownMenuTrigger = ({
2393
2793
  const store = useDropdownStore(externalStore);
2394
2794
  const open = (0, import_zustand2.useStore)(store, (s) => s.open);
2395
2795
  const toggleOpen = () => store.setState({ open: !open });
2396
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2796
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2397
2797
  Button_default,
2398
2798
  {
2399
2799
  variant: "outline",
@@ -2429,8 +2829,8 @@ var MENUCONTENT_VARIANT_CLASSES = {
2429
2829
  menu: "p-1",
2430
2830
  profile: "p-6"
2431
2831
  };
2432
- var MenuLabel = (0, import_react10.forwardRef)(({ className, inset, store: _store, ...props }, ref) => {
2433
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2832
+ var MenuLabel = (0, import_react11.forwardRef)(({ className, inset, store: _store, ...props }, ref) => {
2833
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2434
2834
  "div",
2435
2835
  {
2436
2836
  ref,
@@ -2440,7 +2840,7 @@ var MenuLabel = (0, import_react10.forwardRef)(({ className, inset, store: _stor
2440
2840
  );
2441
2841
  });
2442
2842
  MenuLabel.displayName = "MenuLabel";
2443
- var MenuContent = (0, import_react10.forwardRef)(
2843
+ var MenuContent = (0, import_react11.forwardRef)(
2444
2844
  ({
2445
2845
  className,
2446
2846
  align = "start",
@@ -2453,8 +2853,8 @@ var MenuContent = (0, import_react10.forwardRef)(
2453
2853
  }, ref) => {
2454
2854
  const store = useDropdownStore(externalStore);
2455
2855
  const open = (0, import_zustand2.useStore)(store, (s) => s.open);
2456
- const [isVisible, setIsVisible] = (0, import_react10.useState)(open);
2457
- (0, import_react10.useEffect)(() => {
2856
+ const [isVisible, setIsVisible] = (0, import_react11.useState)(open);
2857
+ (0, import_react11.useEffect)(() => {
2458
2858
  if (open) {
2459
2859
  setIsVisible(true);
2460
2860
  } else {
@@ -2469,7 +2869,7 @@ var MenuContent = (0, import_react10.forwardRef)(
2469
2869
  return `absolute ${vertical} ${horizontal}`;
2470
2870
  };
2471
2871
  const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
2472
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2872
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2473
2873
  "div",
2474
2874
  {
2475
2875
  ref,
@@ -2494,7 +2894,7 @@ var MenuContent = (0, import_react10.forwardRef)(
2494
2894
  }
2495
2895
  );
2496
2896
  MenuContent.displayName = "MenuContent";
2497
- var DropdownMenuItem = (0, import_react10.forwardRef)(
2897
+ var DropdownMenuItem = (0, import_react11.forwardRef)(
2498
2898
  ({
2499
2899
  className,
2500
2900
  size = "small",
@@ -2528,7 +2928,7 @@ var DropdownMenuItem = (0, import_react10.forwardRef)(
2528
2928
  const getVariantProps = () => {
2529
2929
  return variant === "profile" ? { "data-variant": "profile" } : {};
2530
2930
  };
2531
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2931
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2532
2932
  "div",
2533
2933
  {
2534
2934
  ref,
@@ -2550,7 +2950,7 @@ var DropdownMenuItem = (0, import_react10.forwardRef)(
2550
2950
  ...props,
2551
2951
  children: [
2552
2952
  iconLeft,
2553
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-full text-md", children }),
2953
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-full text-md", children }),
2554
2954
  iconRight
2555
2955
  ]
2556
2956
  }
@@ -2558,7 +2958,7 @@ var DropdownMenuItem = (0, import_react10.forwardRef)(
2558
2958
  }
2559
2959
  );
2560
2960
  DropdownMenuItem.displayName = "DropdownMenuItem";
2561
- var DropdownMenuSeparator = (0, import_react10.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2961
+ var DropdownMenuSeparator = (0, import_react11.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2562
2962
  "div",
2563
2963
  {
2564
2964
  ref,
@@ -2567,11 +2967,11 @@ var DropdownMenuSeparator = (0, import_react10.forwardRef)(({ className, store:
2567
2967
  }
2568
2968
  ));
2569
2969
  DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
2570
- var ProfileMenuTrigger = (0, import_react10.forwardRef)(({ className, onClick, store: externalStore, ...props }, ref) => {
2970
+ var ProfileMenuTrigger = (0, import_react11.forwardRef)(({ className, onClick, store: externalStore, ...props }, ref) => {
2571
2971
  const store = useDropdownStore(externalStore);
2572
2972
  const open = (0, import_zustand2.useStore)(store, (s) => s.open);
2573
2973
  const toggleOpen = () => store.setState({ open: !open });
2574
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2974
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2575
2975
  "button",
2576
2976
  {
2577
2977
  ref,
@@ -2583,13 +2983,13 @@ var ProfileMenuTrigger = (0, import_react10.forwardRef)(({ className, onClick, s
2583
2983
  },
2584
2984
  "aria-expanded": open,
2585
2985
  ...props,
2586
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "size-6 rounded-full bg-background-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_phosphor_react7.User, { className: "text-background-950", size: 18 }) })
2986
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "size-6 rounded-full bg-background-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_phosphor_react8.User, { className: "text-background-950", size: 18 }) })
2587
2987
  }
2588
2988
  );
2589
2989
  });
2590
2990
  ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
2591
- var ProfileMenuHeader = (0, import_react10.forwardRef)(({ className, name, email, store: _store, ...props }, ref) => {
2592
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2991
+ var ProfileMenuHeader = (0, import_react11.forwardRef)(({ className, name, email, store: _store, ...props }, ref) => {
2992
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2593
2993
  "div",
2594
2994
  {
2595
2995
  ref,
@@ -2600,18 +3000,18 @@ var ProfileMenuHeader = (0, import_react10.forwardRef)(({ className, name, email
2600
3000
  `,
2601
3001
  ...props,
2602
3002
  children: [
2603
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "size-16 bg-background-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_phosphor_react7.User, { size: 34, className: "text-background-950" }) }),
2604
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col ", children: [
2605
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xl font-bold text-text-950", children: name }),
2606
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-md text-text-600", children: email })
3003
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "size-16 bg-background-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_phosphor_react8.User, { size: 34, className: "text-background-950" }) }),
3004
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col ", children: [
3005
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-xl font-bold text-text-950", children: name }),
3006
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-md text-text-600", children: email })
2607
3007
  ] })
2608
3008
  ]
2609
3009
  }
2610
3010
  );
2611
3011
  });
2612
3012
  ProfileMenuHeader.displayName = "ProfileMenuHeader";
2613
- var ProfileMenuSection = (0, import_react10.forwardRef)(({ className, children, store: _store, ...props }, ref) => {
2614
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3013
+ var ProfileMenuSection = (0, import_react11.forwardRef)(({ className, children, store: _store, ...props }, ref) => {
3014
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2615
3015
  "div",
2616
3016
  {
2617
3017
  ref,
@@ -2634,7 +3034,7 @@ var ProfileMenuFooter = ({
2634
3034
  }) => {
2635
3035
  const store = useDropdownStore(externalStore);
2636
3036
  const setOpen = (0, import_zustand2.useStore)(store, (s) => s.setOpen);
2637
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3037
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2638
3038
  Button_default,
2639
3039
  {
2640
3040
  variant: "outline",
@@ -2646,8 +3046,8 @@ var ProfileMenuFooter = ({
2646
3046
  },
2647
3047
  ...props,
2648
3048
  children: [
2649
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_phosphor_react7.SignOut, {}) }),
2650
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Sair" })
3049
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_phosphor_react8.SignOut, {}) }),
3050
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "Sair" })
2651
3051
  ]
2652
3052
  }
2653
3053
  );
@@ -2657,15 +3057,15 @@ var DropdownMenu_default = DropdownMenu;
2657
3057
 
2658
3058
  // src/components/Select/Select.tsx
2659
3059
  var import_zustand3 = require("zustand");
2660
- var import_react11 = require("react");
2661
- var import_phosphor_react8 = require("phosphor-react");
2662
- var import_jsx_runtime22 = require("react/jsx-runtime");
3060
+ var import_react12 = require("react");
3061
+ var import_phosphor_react9 = require("phosphor-react");
3062
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2663
3063
  var VARIANT_CLASSES4 = {
2664
3064
  outlined: "border-2 rounded-sm focus:border-primary-950",
2665
3065
  underlined: "border-b-2 focus:border-primary-950",
2666
3066
  rounded: "border-2 rounded-4xl focus:border-primary-950"
2667
3067
  };
2668
- var SIZE_CLASSES9 = {
3068
+ var SIZE_CLASSES10 = {
2669
3069
  small: "text-sm",
2670
3070
  medium: "text-md",
2671
3071
  large: "text-lg"
@@ -2703,13 +3103,13 @@ function getLabelAsNode(children) {
2703
3103
  if (typeof children === "string" || typeof children === "number") {
2704
3104
  return children;
2705
3105
  }
2706
- const flattened = import_react11.Children.toArray(children);
3106
+ const flattened = import_react12.Children.toArray(children);
2707
3107
  if (flattened.length === 1) return flattened[0];
2708
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: flattened });
3108
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, { children: flattened });
2709
3109
  }
2710
3110
  var injectStore2 = (children, store) => {
2711
- return import_react11.Children.map(children, (child) => {
2712
- if ((0, import_react11.isValidElement)(child)) {
3111
+ return import_react12.Children.map(children, (child) => {
3112
+ if ((0, import_react12.isValidElement)(child)) {
2713
3113
  const typedChild = child;
2714
3114
  const newProps = {
2715
3115
  store
@@ -2717,7 +3117,7 @@ var injectStore2 = (children, store) => {
2717
3117
  if (typedChild.props.children) {
2718
3118
  newProps.children = injectStore2(typedChild.props.children, store);
2719
3119
  }
2720
- return (0, import_react11.cloneElement)(typedChild, newProps);
3120
+ return (0, import_react12.cloneElement)(typedChild, newProps);
2721
3121
  }
2722
3122
  return child;
2723
3123
  });
@@ -2729,21 +3129,19 @@ var Select = ({
2729
3129
  onValueChange,
2730
3130
  size = "small"
2731
3131
  }) => {
2732
- const storeRef = (0, import_react11.useRef)(null);
3132
+ const storeRef = (0, import_react12.useRef)(null);
2733
3133
  storeRef.current ??= createSelectStore();
2734
3134
  const store = storeRef.current;
2735
- const selectRef = (0, import_react11.useRef)(null);
3135
+ const selectRef = (0, import_react12.useRef)(null);
2736
3136
  const { open, setOpen, setValue, value, selectedLabel } = (0, import_zustand3.useStore)(
2737
3137
  store,
2738
3138
  (s) => s
2739
3139
  );
2740
- const isControlled = propValue !== void 0;
2741
- const currentValue = isControlled ? propValue : value;
2742
3140
  const findLabelForValue = (children2, targetValue) => {
2743
3141
  let found = null;
2744
3142
  const search = (nodes) => {
2745
- import_react11.Children.forEach(nodes, (child) => {
2746
- if (!(0, import_react11.isValidElement)(child)) return;
3143
+ import_react12.Children.forEach(nodes, (child) => {
3144
+ if (!(0, import_react12.isValidElement)(child)) return;
2747
3145
  const typedChild = child;
2748
3146
  if (typedChild.type === SelectItem && typedChild.props.value === targetValue) {
2749
3147
  if (typeof typedChild.props.children === "string")
@@ -2756,14 +3154,13 @@ var Select = ({
2756
3154
  search(children2);
2757
3155
  return found;
2758
3156
  };
2759
- (0, import_react11.useEffect)(() => {
3157
+ (0, import_react12.useEffect)(() => {
2760
3158
  if (!selectedLabel && defaultValue) {
2761
3159
  const label = findLabelForValue(children, defaultValue);
2762
3160
  if (label) store.setState({ selectedLabel: label });
2763
3161
  }
2764
3162
  }, [children, defaultValue, selectedLabel]);
2765
- (0, import_react11.useEffect)(() => {
2766
- setValue(currentValue);
3163
+ (0, import_react12.useEffect)(() => {
2767
3164
  const handleClickOutside = (event) => {
2768
3165
  if (selectRef.current && !selectRef.current.contains(event.target)) {
2769
3166
  setOpen(false);
@@ -2798,13 +3195,19 @@ var Select = ({
2798
3195
  document.removeEventListener("keydown", handleArrowKeys);
2799
3196
  };
2800
3197
  }, [open]);
2801
- (0, import_react11.useEffect)(() => {
2802
- if (onValueChange) {
2803
- onValueChange(value);
3198
+ (0, import_react12.useEffect)(() => {
3199
+ setValue(value);
3200
+ onValueChange?.(value);
3201
+ }, [value, onValueChange]);
3202
+ (0, import_react12.useEffect)(() => {
3203
+ if (propValue) {
3204
+ setValue(propValue);
3205
+ const label = findLabelForValue(children, propValue);
3206
+ if (label) store.setState({ selectedLabel: label });
2804
3207
  }
2805
- }, [value]);
2806
- const sizeClasses = SIZE_CLASSES9[size];
2807
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: `relative ${sizeClasses} w-[288px]`, ref: selectRef, children: injectStore2(children, store) });
3208
+ }, [propValue]);
3209
+ const sizeClasses = SIZE_CLASSES10[size];
3210
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: `relative ${sizeClasses} w-[288px]`, ref: selectRef, children: injectStore2(children, store) });
2808
3211
  };
2809
3212
  var SelectValue = ({
2810
3213
  placeholder,
@@ -2813,9 +3216,9 @@ var SelectValue = ({
2813
3216
  const store = useSelectStore(externalStore);
2814
3217
  const selectedLabel = (0, import_zustand3.useStore)(store, (s) => s.selectedLabel);
2815
3218
  const value = (0, import_zustand3.useStore)(store, (s) => s.value);
2816
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-inherit", children: selectedLabel || placeholder || value });
3219
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-inherit", children: selectedLabel || placeholder || value });
2817
3220
  };
2818
- var SelectTrigger = (0, import_react11.forwardRef)(
3221
+ var SelectTrigger = (0, import_react12.forwardRef)(
2819
3222
  ({
2820
3223
  className,
2821
3224
  invalid = false,
@@ -2828,7 +3231,7 @@ var SelectTrigger = (0, import_react11.forwardRef)(
2828
3231
  const open = (0, import_zustand3.useStore)(store, (s) => s.open);
2829
3232
  const toggleOpen = () => store.setState({ open: !open });
2830
3233
  const variantClasses = VARIANT_CLASSES4[variant];
2831
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3234
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2832
3235
  "button",
2833
3236
  {
2834
3237
  ref,
@@ -2847,8 +3250,8 @@ var SelectTrigger = (0, import_react11.forwardRef)(
2847
3250
  ...props,
2848
3251
  children: [
2849
3252
  props.children,
2850
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2851
- import_phosphor_react8.CaretDown,
3253
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3254
+ import_phosphor_react9.CaretDown,
2852
3255
  {
2853
3256
  className: `h-[1em] w-[1em] opacity-50 transition-transform ${open ? "rotate-180" : ""}`
2854
3257
  }
@@ -2859,7 +3262,7 @@ var SelectTrigger = (0, import_react11.forwardRef)(
2859
3262
  }
2860
3263
  );
2861
3264
  SelectTrigger.displayName = "SelectTrigger";
2862
- var SelectContent = (0, import_react11.forwardRef)(
3265
+ var SelectContent = (0, import_react12.forwardRef)(
2863
3266
  ({
2864
3267
  children,
2865
3268
  className,
@@ -2872,7 +3275,7 @@ var SelectContent = (0, import_react11.forwardRef)(
2872
3275
  const open = (0, import_zustand3.useStore)(store, (s) => s.open);
2873
3276
  if (!open) return null;
2874
3277
  const getPositionClasses = () => `w-full min-w-full absolute ${SIDE_CLASSES2[side]} ${ALIGN_CLASSES2[align]}`;
2875
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3278
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2876
3279
  "div",
2877
3280
  {
2878
3281
  role: "menu",
@@ -2885,7 +3288,7 @@ var SelectContent = (0, import_react11.forwardRef)(
2885
3288
  }
2886
3289
  );
2887
3290
  SelectContent.displayName = "SelectContent";
2888
- var SelectItem = (0, import_react11.forwardRef)(
3291
+ var SelectItem = (0, import_react12.forwardRef)(
2889
3292
  ({
2890
3293
  className,
2891
3294
  children,
@@ -2895,8 +3298,12 @@ var SelectItem = (0, import_react11.forwardRef)(
2895
3298
  ...props
2896
3299
  }, ref) => {
2897
3300
  const store = useSelectStore(externalStore);
2898
- const selectedValue = (0, import_zustand3.useStore)(store, (s) => s.value);
2899
- const { setValue, setSelectedLabel, setOpen } = store.getState();
3301
+ const {
3302
+ value: selectedValue,
3303
+ setValue,
3304
+ setOpen,
3305
+ setSelectedLabel
3306
+ } = (0, import_zustand3.useStore)(store, (s) => s);
2900
3307
  const handleClick = (e) => {
2901
3308
  const labelNode = getLabelAsNode(children);
2902
3309
  if (!disabled) {
@@ -2906,7 +3313,7 @@ var SelectItem = (0, import_react11.forwardRef)(
2906
3313
  }
2907
3314
  props.onClick?.(e);
2908
3315
  };
2909
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3316
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2910
3317
  "div",
2911
3318
  {
2912
3319
  role: "menuitem",
@@ -2926,7 +3333,7 @@ var SelectItem = (0, import_react11.forwardRef)(
2926
3333
  tabIndex: disabled ? -1 : 0,
2927
3334
  ...props,
2928
3335
  children: [
2929
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: selectedValue === value && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_phosphor_react8.Check, { className: "" }) }),
3336
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: selectedValue === value && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react9.Check, { className: "" }) }),
2930
3337
  children
2931
3338
  ]
2932
3339
  }
@@ -2938,9 +3345,9 @@ var Select_default = Select;
2938
3345
 
2939
3346
  // src/components/Menu/Menu.tsx
2940
3347
  var import_zustand4 = require("zustand");
2941
- var import_react12 = require("react");
2942
- var import_phosphor_react9 = require("phosphor-react");
2943
- var import_jsx_runtime23 = require("react/jsx-runtime");
3348
+ var import_react13 = require("react");
3349
+ var import_phosphor_react10 = require("phosphor-react");
3350
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2944
3351
  var createMenuStore = () => (0, import_zustand4.create)((set) => ({
2945
3352
  value: "",
2946
3353
  setValue: (value) => set({ value })
@@ -2954,7 +3361,7 @@ var VARIANT_CLASSES5 = {
2954
3361
  menu2: "overflow-x-auto scroll-smooth",
2955
3362
  breadcrumb: ""
2956
3363
  };
2957
- var Menu = (0, import_react12.forwardRef)(
3364
+ var Menu = (0, import_react13.forwardRef)(
2958
3365
  ({
2959
3366
  className,
2960
3367
  children,
@@ -2964,19 +3371,19 @@ var Menu = (0, import_react12.forwardRef)(
2964
3371
  onValueChange,
2965
3372
  ...props
2966
3373
  }, ref) => {
2967
- const storeRef = (0, import_react12.useRef)(null);
3374
+ const storeRef = (0, import_react13.useRef)(null);
2968
3375
  storeRef.current ??= createMenuStore();
2969
3376
  const store = storeRef.current;
2970
3377
  const { setValue, value } = (0, import_zustand4.useStore)(store, (s) => s);
2971
- (0, import_react12.useEffect)(() => {
3378
+ (0, import_react13.useEffect)(() => {
2972
3379
  setValue(propValue ?? defaultValue);
2973
3380
  }, [defaultValue, propValue, setValue]);
2974
- (0, import_react12.useEffect)(() => {
3381
+ (0, import_react13.useEffect)(() => {
2975
3382
  onValueChange?.(value);
2976
3383
  }, [value, onValueChange]);
2977
3384
  const baseClasses = "w-full flex flex-row items-center gap-2 py-2 px-6";
2978
3385
  const variantClasses = VARIANT_CLASSES5[variant];
2979
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3386
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2980
3387
  "ul",
2981
3388
  {
2982
3389
  ref,
@@ -2993,7 +3400,7 @@ var Menu = (0, import_react12.forwardRef)(
2993
3400
  }
2994
3401
  );
2995
3402
  Menu.displayName = "Menu";
2996
- var MenuItem = (0, import_react12.forwardRef)(
3403
+ var MenuItem = (0, import_react13.forwardRef)(
2997
3404
  ({
2998
3405
  className,
2999
3406
  children,
@@ -3021,7 +3428,7 @@ var MenuItem = (0, import_react12.forwardRef)(
3021
3428
  ...props
3022
3429
  };
3023
3430
  const variants = {
3024
- menu: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3431
+ menu: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3025
3432
  "li",
3026
3433
  {
3027
3434
  "data-variant": "menu",
@@ -3036,7 +3443,7 @@ var MenuItem = (0, import_react12.forwardRef)(
3036
3443
  children
3037
3444
  }
3038
3445
  ),
3039
- menu2: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3446
+ menu2: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3040
3447
  "li",
3041
3448
  {
3042
3449
  "data-variant": "menu2",
@@ -3048,7 +3455,7 @@ var MenuItem = (0, import_react12.forwardRef)(
3048
3455
  children
3049
3456
  }
3050
3457
  ),
3051
- breadcrumb: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3458
+ breadcrumb: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3052
3459
  "li",
3053
3460
  {
3054
3461
  "data-variant": "breadcrumb",
@@ -3059,7 +3466,7 @@ var MenuItem = (0, import_react12.forwardRef)(
3059
3466
  ${className ?? ""}
3060
3467
  `,
3061
3468
  ...commonProps,
3062
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3469
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3063
3470
  "span",
3064
3471
  {
3065
3472
  className: `
@@ -3076,24 +3483,24 @@ var MenuItem = (0, import_react12.forwardRef)(
3076
3483
  }
3077
3484
  );
3078
3485
  MenuItem.displayName = "MenuItem";
3079
- var MenuSeparator = (0, import_react12.forwardRef)(
3080
- ({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3486
+ var MenuSeparator = (0, import_react13.forwardRef)(
3487
+ ({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3081
3488
  "li",
3082
3489
  {
3083
3490
  ref,
3084
3491
  "aria-hidden": "true",
3085
3492
  className: `[&>svg]:w-4 [&>svg]:h-4 text-text-600 ${className ?? ""}`,
3086
3493
  ...props,
3087
- children: children ?? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react9.CaretRight, {})
3494
+ children: children ?? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_phosphor_react10.CaretRight, {})
3088
3495
  }
3089
3496
  )
3090
3497
  );
3091
3498
  MenuSeparator.displayName = "MenuSeparator";
3092
- var injectStore3 = (children, store) => import_react12.Children.map(children, (child) => {
3093
- if (!(0, import_react12.isValidElement)(child)) return child;
3499
+ var injectStore3 = (children, store) => import_react13.Children.map(children, (child) => {
3500
+ if (!(0, import_react13.isValidElement)(child)) return child;
3094
3501
  const typedChild = child;
3095
3502
  const shouldInject = typedChild.type === MenuItem;
3096
- return (0, import_react12.cloneElement)(typedChild, {
3503
+ return (0, import_react13.cloneElement)(typedChild, {
3097
3504
  ...shouldInject ? { store } : {},
3098
3505
  ...typedChild.props.children ? { children: injectStore3(typedChild.props.children, store) } : {}
3099
3506
  });
@@ -3120,6 +3527,7 @@ var Menu_default = Menu;
3120
3527
  MenuItem,
3121
3528
  MenuLabel,
3122
3529
  MenuSeparator,
3530
+ Modal,
3123
3531
  NavButton,
3124
3532
  ProfileMenuFooter,
3125
3533
  ProfileMenuHeader,