analytica-frontend-lib 1.0.42 → 1.0.44
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/Calendar/index.d.mts +60 -0
- package/dist/Calendar/index.d.ts +60 -0
- package/dist/Calendar/index.js +526 -0
- package/dist/Calendar/index.js.map +1 -0
- package/dist/Calendar/index.mjs +501 -0
- package/dist/Calendar/index.mjs.map +1 -0
- package/dist/Input/index.js +5 -2
- package/dist/Input/index.js.map +1 -1
- package/dist/Input/index.mjs +5 -2
- package/dist/Input/index.mjs.map +1 -1
- package/dist/ProgressBar/index.d.mts +36 -1
- package/dist/ProgressBar/index.d.ts +36 -1
- package/dist/ProgressBar/index.js +371 -75
- package/dist/ProgressBar/index.js.map +1 -1
- package/dist/ProgressBar/index.mjs +372 -76
- package/dist/ProgressBar/index.mjs.map +1 -1
- package/dist/index.css +141 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +952 -154
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +933 -136
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +141 -0
- package/dist/styles.css.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(src_exports, {
|
|
|
23
23
|
Alert: () => Alert_default,
|
|
24
24
|
Badge: () => Badge_default,
|
|
25
25
|
Button: () => Button_default,
|
|
26
|
+
Calendar: () => Calendar_default,
|
|
26
27
|
CheckBox: () => CheckBox_default,
|
|
27
28
|
Chips: () => Chips_default,
|
|
28
29
|
Divider: () => Divider_default,
|
|
@@ -1300,7 +1301,7 @@ var STATE_CLASSES4 = {
|
|
|
1300
1301
|
default: "border-border-300 placeholder:text-text-600 hover:border-border-400",
|
|
1301
1302
|
error: "border-2 border-indicator-error placeholder:text-text-600",
|
|
1302
1303
|
disabled: "border-border-300 placeholder:text-text-600 cursor-not-allowed opacity-40",
|
|
1303
|
-
"read-only": "border-
|
|
1304
|
+
"read-only": "border-transparent !text-text-600 cursor-default focus:outline-none bg-transparent"
|
|
1304
1305
|
};
|
|
1305
1306
|
var VARIANT_CLASSES = {
|
|
1306
1307
|
outlined: "border rounded-lg",
|
|
@@ -1339,6 +1340,9 @@ var getCombinedClasses = (actualState, variant) => {
|
|
|
1339
1340
|
if (actualState === "error" && variant === "underlined") {
|
|
1340
1341
|
return "border-0 border-b-2 border-indicator-error rounded-none bg-transparent focus:outline-none focus:border-primary-950 placeholder:text-text-600";
|
|
1341
1342
|
}
|
|
1343
|
+
if (actualState === "read-only" && variant === "underlined") {
|
|
1344
|
+
return "border-0 border-b-0 rounded-none bg-transparent focus:outline-none !text-text-900 cursor-default";
|
|
1345
|
+
}
|
|
1342
1346
|
return `${stateClasses} ${variantClasses}`;
|
|
1343
1347
|
};
|
|
1344
1348
|
var Input = (0, import_react8.forwardRef)(
|
|
@@ -1369,7 +1373,7 @@ var Input = (0, import_react8.forwardRef)(
|
|
|
1369
1373
|
[actualState, variant]
|
|
1370
1374
|
);
|
|
1371
1375
|
const iconSize = getIconSize(size);
|
|
1372
|
-
const baseClasses =
|
|
1376
|
+
const baseClasses = `bg-background w-full py-2 ${actualState === "read-only" ? "px-0" : "px-3"} font-normal text-text-900 focus:outline-primary-950`;
|
|
1373
1377
|
const generatedId = (0, import_react8.useId)();
|
|
1374
1378
|
const inputId = id ?? `input-${generatedId}`;
|
|
1375
1379
|
const togglePasswordVisibility = () => setShowPassword(!showPassword);
|
|
@@ -1521,101 +1525,397 @@ var VARIANT_CLASSES2 = {
|
|
|
1521
1525
|
// Green for performance (#84D3A2)
|
|
1522
1526
|
}
|
|
1523
1527
|
};
|
|
1524
|
-
var
|
|
1525
|
-
value,
|
|
1526
|
-
max = 100,
|
|
1527
|
-
size = "medium",
|
|
1528
|
-
variant = "blue",
|
|
1529
|
-
label,
|
|
1530
|
-
showPercentage = false,
|
|
1531
|
-
className = "",
|
|
1532
|
-
labelClassName = "",
|
|
1533
|
-
percentageClassName = ""
|
|
1534
|
-
}) => {
|
|
1528
|
+
var calculateProgressValues = (value, max) => {
|
|
1535
1529
|
const safeValue = isNaN(value) ? 0 : value;
|
|
1536
1530
|
const clampedValue = Math.max(0, Math.min(safeValue, max));
|
|
1537
1531
|
const percentage = max === 0 ? 0 : clampedValue / max * 100;
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1532
|
+
return { clampedValue, percentage };
|
|
1533
|
+
};
|
|
1534
|
+
var shouldShowHeader = (label, showPercentage, showHitCount) => {
|
|
1535
|
+
return !!(label || showPercentage || showHitCount);
|
|
1536
|
+
};
|
|
1537
|
+
var getDisplayPriority = (showHitCount, showPercentage, label, clampedValue, max, percentage) => {
|
|
1538
|
+
if (showHitCount) {
|
|
1539
|
+
return {
|
|
1540
|
+
type: "hitCount",
|
|
1541
|
+
content: `${Math.round(clampedValue)} de ${max}`,
|
|
1542
|
+
hasMetrics: true
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
if (showPercentage) {
|
|
1546
|
+
return {
|
|
1547
|
+
type: "percentage",
|
|
1548
|
+
content: `${Math.round(percentage)}%`,
|
|
1549
|
+
hasMetrics: true
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
return {
|
|
1553
|
+
type: "label",
|
|
1554
|
+
content: label,
|
|
1555
|
+
hasMetrics: false
|
|
1556
|
+
};
|
|
1557
|
+
};
|
|
1558
|
+
var getCompactLayoutConfig = ({
|
|
1559
|
+
showPercentage,
|
|
1560
|
+
showHitCount,
|
|
1561
|
+
percentage,
|
|
1562
|
+
clampedValue,
|
|
1563
|
+
max,
|
|
1564
|
+
label,
|
|
1565
|
+
percentageClassName,
|
|
1566
|
+
labelClassName
|
|
1567
|
+
}) => {
|
|
1568
|
+
const displayPriority = getDisplayPriority(
|
|
1569
|
+
showHitCount,
|
|
1570
|
+
showPercentage,
|
|
1571
|
+
label,
|
|
1572
|
+
clampedValue,
|
|
1573
|
+
max,
|
|
1574
|
+
percentage
|
|
1575
|
+
);
|
|
1576
|
+
return {
|
|
1577
|
+
color: displayPriority.hasMetrics ? "text-primary-600" : "text-primary-700",
|
|
1578
|
+
className: displayPriority.hasMetrics ? percentageClassName : labelClassName,
|
|
1579
|
+
content: displayPriority.content
|
|
1580
|
+
};
|
|
1581
|
+
};
|
|
1582
|
+
var getDefaultLayoutDisplayConfig = (size, label, showPercentage) => ({
|
|
1583
|
+
showHeader: size === "small" && !!(label || showPercentage),
|
|
1584
|
+
showPercentage: size === "medium" && showPercentage,
|
|
1585
|
+
showLabel: size === "medium" && !!label && !showPercentage
|
|
1586
|
+
// Only show label when percentage is not shown
|
|
1587
|
+
});
|
|
1588
|
+
var renderStackedHitCountDisplay = (showHitCount, showPercentage, clampedValue, max, percentage, percentageClassName) => {
|
|
1589
|
+
if (!showHitCount && !showPercentage) return null;
|
|
1590
|
+
const displayPriority = getDisplayPriority(
|
|
1591
|
+
showHitCount,
|
|
1592
|
+
showPercentage,
|
|
1593
|
+
null,
|
|
1594
|
+
// label is not relevant for stacked layout metrics display
|
|
1595
|
+
clampedValue,
|
|
1596
|
+
max,
|
|
1597
|
+
percentage
|
|
1598
|
+
);
|
|
1599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1541
1600
|
"div",
|
|
1542
1601
|
{
|
|
1543
|
-
className: `
|
|
1544
|
-
children: [
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1602
|
+
className: `text-xs font-medium leading-[14px] text-right ${percentageClassName}`,
|
|
1603
|
+
children: displayPriority.type === "hitCount" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1604
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-success-200", children: Math.round(clampedValue) }),
|
|
1605
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "text-text-600", children: [
|
|
1606
|
+
" de ",
|
|
1607
|
+
max
|
|
1608
|
+
] })
|
|
1609
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Text_default, { size: "xs", weight: "medium", className: "text-success-200", children: [
|
|
1610
|
+
Math.round(percentage),
|
|
1611
|
+
"%"
|
|
1612
|
+
] })
|
|
1613
|
+
}
|
|
1614
|
+
);
|
|
1615
|
+
};
|
|
1616
|
+
var ProgressBarBase = ({
|
|
1617
|
+
clampedValue,
|
|
1618
|
+
max,
|
|
1619
|
+
percentage,
|
|
1620
|
+
label,
|
|
1621
|
+
variantClasses,
|
|
1622
|
+
containerClassName,
|
|
1623
|
+
fillClassName
|
|
1624
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1625
|
+
"div",
|
|
1626
|
+
{
|
|
1627
|
+
className: `${containerClassName} ${variantClasses.background} overflow-hidden relative`,
|
|
1628
|
+
children: [
|
|
1629
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1630
|
+
"progress",
|
|
1631
|
+
{
|
|
1632
|
+
value: clampedValue,
|
|
1633
|
+
max,
|
|
1634
|
+
"aria-label": typeof label === "string" ? `${label}: ${Math.round(percentage)}% complete` : `Progress: ${Math.round(percentage)}% of ${max}`,
|
|
1635
|
+
className: "absolute inset-0 w-full h-full opacity-0"
|
|
1636
|
+
}
|
|
1637
|
+
),
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1639
|
+
"div",
|
|
1640
|
+
{
|
|
1641
|
+
className: `${fillClassName} ${variantClasses.fill} transition-all duration-300 ease-out`,
|
|
1642
|
+
style: { width: `${percentage}%` }
|
|
1643
|
+
}
|
|
1644
|
+
)
|
|
1645
|
+
]
|
|
1646
|
+
}
|
|
1647
|
+
);
|
|
1648
|
+
var StackedLayout = ({
|
|
1649
|
+
className,
|
|
1650
|
+
label,
|
|
1651
|
+
showPercentage,
|
|
1652
|
+
showHitCount,
|
|
1653
|
+
labelClassName,
|
|
1654
|
+
percentageClassName,
|
|
1655
|
+
clampedValue,
|
|
1656
|
+
max,
|
|
1657
|
+
percentage,
|
|
1658
|
+
variantClasses,
|
|
1659
|
+
dimensions
|
|
1660
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1661
|
+
"div",
|
|
1662
|
+
{
|
|
1663
|
+
className: `flex flex-col items-start gap-2 ${dimensions.width} ${dimensions.height} ${className}`,
|
|
1664
|
+
children: [
|
|
1665
|
+
shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-row justify-between items-center w-full h-[19px]", children: [
|
|
1666
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1594
1667
|
Text_default,
|
|
1595
1668
|
{
|
|
1596
|
-
|
|
1669
|
+
as: "div",
|
|
1670
|
+
size: "md",
|
|
1597
1671
|
weight: "medium",
|
|
1598
|
-
className: `text-text-
|
|
1599
|
-
children:
|
|
1600
|
-
Math.round(percentage),
|
|
1601
|
-
"%"
|
|
1602
|
-
]
|
|
1672
|
+
className: `text-text-600 leading-[19px] ${labelClassName}`,
|
|
1673
|
+
children: label
|
|
1603
1674
|
}
|
|
1604
1675
|
),
|
|
1605
|
-
|
|
1676
|
+
renderStackedHitCountDisplay(
|
|
1677
|
+
showHitCount,
|
|
1678
|
+
showPercentage,
|
|
1679
|
+
clampedValue,
|
|
1680
|
+
max,
|
|
1681
|
+
percentage,
|
|
1682
|
+
percentageClassName
|
|
1683
|
+
)
|
|
1684
|
+
] }),
|
|
1685
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1686
|
+
ProgressBarBase,
|
|
1687
|
+
{
|
|
1688
|
+
clampedValue,
|
|
1689
|
+
max,
|
|
1690
|
+
percentage,
|
|
1691
|
+
label,
|
|
1692
|
+
variantClasses,
|
|
1693
|
+
containerClassName: "w-full h-2 rounded-lg",
|
|
1694
|
+
fillClassName: "h-2 rounded-lg shadow-hard-shadow-3"
|
|
1695
|
+
}
|
|
1696
|
+
)
|
|
1697
|
+
]
|
|
1698
|
+
}
|
|
1699
|
+
);
|
|
1700
|
+
var CompactLayout = ({
|
|
1701
|
+
className,
|
|
1702
|
+
label,
|
|
1703
|
+
showPercentage,
|
|
1704
|
+
showHitCount,
|
|
1705
|
+
labelClassName,
|
|
1706
|
+
percentageClassName,
|
|
1707
|
+
clampedValue,
|
|
1708
|
+
max,
|
|
1709
|
+
percentage,
|
|
1710
|
+
variantClasses,
|
|
1711
|
+
dimensions
|
|
1712
|
+
}) => {
|
|
1713
|
+
const {
|
|
1714
|
+
color,
|
|
1715
|
+
className: compactClassName,
|
|
1716
|
+
content
|
|
1717
|
+
} = getCompactLayoutConfig({
|
|
1718
|
+
showPercentage,
|
|
1719
|
+
showHitCount,
|
|
1720
|
+
percentage,
|
|
1721
|
+
clampedValue,
|
|
1722
|
+
max,
|
|
1723
|
+
label,
|
|
1724
|
+
percentageClassName,
|
|
1725
|
+
labelClassName
|
|
1726
|
+
});
|
|
1727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1728
|
+
"div",
|
|
1729
|
+
{
|
|
1730
|
+
className: `flex flex-col items-start gap-1 ${dimensions.width} ${dimensions.height} ${className}`,
|
|
1731
|
+
children: [
|
|
1732
|
+
shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1606
1733
|
Text_default,
|
|
1607
1734
|
{
|
|
1608
1735
|
as: "div",
|
|
1609
|
-
size: "
|
|
1736
|
+
size: "sm",
|
|
1610
1737
|
weight: "medium",
|
|
1611
|
-
|
|
1612
|
-
|
|
1738
|
+
color,
|
|
1739
|
+
className: `leading-4 w-full ${compactClassName}`,
|
|
1740
|
+
children: content
|
|
1741
|
+
}
|
|
1742
|
+
),
|
|
1743
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1744
|
+
ProgressBarBase,
|
|
1745
|
+
{
|
|
1746
|
+
clampedValue,
|
|
1747
|
+
max,
|
|
1748
|
+
percentage,
|
|
1749
|
+
label,
|
|
1750
|
+
variantClasses,
|
|
1751
|
+
containerClassName: "w-full h-1 rounded-full",
|
|
1752
|
+
fillClassName: "h-1 rounded-full"
|
|
1613
1753
|
}
|
|
1614
1754
|
)
|
|
1615
1755
|
]
|
|
1616
1756
|
}
|
|
1617
1757
|
);
|
|
1618
1758
|
};
|
|
1759
|
+
var DefaultLayout = ({
|
|
1760
|
+
className,
|
|
1761
|
+
size,
|
|
1762
|
+
sizeClasses,
|
|
1763
|
+
variantClasses,
|
|
1764
|
+
label,
|
|
1765
|
+
showPercentage,
|
|
1766
|
+
labelClassName,
|
|
1767
|
+
percentageClassName,
|
|
1768
|
+
clampedValue,
|
|
1769
|
+
max,
|
|
1770
|
+
percentage
|
|
1771
|
+
}) => {
|
|
1772
|
+
const gapClass = size === "medium" ? "gap-2" : sizeClasses.spacing;
|
|
1773
|
+
const progressBarClass = size === "medium" ? "flex-grow" : "w-full";
|
|
1774
|
+
const displayConfig = getDefaultLayoutDisplayConfig(
|
|
1775
|
+
size,
|
|
1776
|
+
label,
|
|
1777
|
+
showPercentage
|
|
1778
|
+
);
|
|
1779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `flex ${sizeClasses.layout} ${gapClass} ${className}`, children: [
|
|
1780
|
+
displayConfig.showHeader && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-row items-center justify-between w-full", children: [
|
|
1781
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1782
|
+
Text_default,
|
|
1783
|
+
{
|
|
1784
|
+
as: "div",
|
|
1785
|
+
size: "xs",
|
|
1786
|
+
weight: "medium",
|
|
1787
|
+
className: `text-text-950 leading-none tracking-normal text-center ${labelClassName}`,
|
|
1788
|
+
children: label
|
|
1789
|
+
}
|
|
1790
|
+
),
|
|
1791
|
+
showPercentage && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1792
|
+
Text_default,
|
|
1793
|
+
{
|
|
1794
|
+
size: "xs",
|
|
1795
|
+
weight: "medium",
|
|
1796
|
+
className: `text-text-950 leading-none tracking-normal text-center ${percentageClassName}`,
|
|
1797
|
+
children: [
|
|
1798
|
+
Math.round(percentage),
|
|
1799
|
+
"%"
|
|
1800
|
+
]
|
|
1801
|
+
}
|
|
1802
|
+
)
|
|
1803
|
+
] }),
|
|
1804
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1805
|
+
ProgressBarBase,
|
|
1806
|
+
{
|
|
1807
|
+
clampedValue,
|
|
1808
|
+
max,
|
|
1809
|
+
percentage,
|
|
1810
|
+
label,
|
|
1811
|
+
variantClasses,
|
|
1812
|
+
containerClassName: `${progressBarClass} ${sizeClasses.container} ${sizeClasses.borderRadius}`,
|
|
1813
|
+
fillClassName: `${sizeClasses.bar} ${sizeClasses.borderRadius} shadow-hard-shadow-3`
|
|
1814
|
+
}
|
|
1815
|
+
),
|
|
1816
|
+
displayConfig.showPercentage && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1817
|
+
Text_default,
|
|
1818
|
+
{
|
|
1819
|
+
size: "xs",
|
|
1820
|
+
weight: "medium",
|
|
1821
|
+
className: `text-text-950 leading-none tracking-normal text-center flex-none ${percentageClassName}`,
|
|
1822
|
+
children: [
|
|
1823
|
+
Math.round(percentage),
|
|
1824
|
+
"%"
|
|
1825
|
+
]
|
|
1826
|
+
}
|
|
1827
|
+
),
|
|
1828
|
+
displayConfig.showLabel && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1829
|
+
Text_default,
|
|
1830
|
+
{
|
|
1831
|
+
as: "div",
|
|
1832
|
+
size: "xs",
|
|
1833
|
+
weight: "medium",
|
|
1834
|
+
className: `text-text-950 leading-none tracking-normal text-center flex-none ${labelClassName}`,
|
|
1835
|
+
children: label
|
|
1836
|
+
}
|
|
1837
|
+
)
|
|
1838
|
+
] });
|
|
1839
|
+
};
|
|
1840
|
+
var ProgressBar = ({
|
|
1841
|
+
value,
|
|
1842
|
+
max = 100,
|
|
1843
|
+
size = "medium",
|
|
1844
|
+
variant = "blue",
|
|
1845
|
+
layout = "default",
|
|
1846
|
+
label,
|
|
1847
|
+
showPercentage = false,
|
|
1848
|
+
showHitCount = false,
|
|
1849
|
+
className = "",
|
|
1850
|
+
labelClassName = "",
|
|
1851
|
+
percentageClassName = "",
|
|
1852
|
+
stackedWidth,
|
|
1853
|
+
stackedHeight,
|
|
1854
|
+
compactWidth,
|
|
1855
|
+
compactHeight
|
|
1856
|
+
}) => {
|
|
1857
|
+
const { clampedValue, percentage } = calculateProgressValues(value, max);
|
|
1858
|
+
const sizeClasses = SIZE_CLASSES7[size];
|
|
1859
|
+
const variantClasses = VARIANT_CLASSES2[variant];
|
|
1860
|
+
if (layout === "stacked") {
|
|
1861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1862
|
+
StackedLayout,
|
|
1863
|
+
{
|
|
1864
|
+
className,
|
|
1865
|
+
label,
|
|
1866
|
+
showPercentage,
|
|
1867
|
+
showHitCount,
|
|
1868
|
+
labelClassName,
|
|
1869
|
+
percentageClassName,
|
|
1870
|
+
clampedValue,
|
|
1871
|
+
max,
|
|
1872
|
+
percentage,
|
|
1873
|
+
variantClasses,
|
|
1874
|
+
dimensions: {
|
|
1875
|
+
width: stackedWidth ?? "w-[380px]",
|
|
1876
|
+
height: stackedHeight ?? "h-[35px]"
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
);
|
|
1880
|
+
}
|
|
1881
|
+
if (layout === "compact") {
|
|
1882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1883
|
+
CompactLayout,
|
|
1884
|
+
{
|
|
1885
|
+
className,
|
|
1886
|
+
label,
|
|
1887
|
+
showPercentage,
|
|
1888
|
+
showHitCount,
|
|
1889
|
+
labelClassName,
|
|
1890
|
+
percentageClassName,
|
|
1891
|
+
clampedValue,
|
|
1892
|
+
max,
|
|
1893
|
+
percentage,
|
|
1894
|
+
variantClasses,
|
|
1895
|
+
dimensions: {
|
|
1896
|
+
width: compactWidth ?? "w-[131px]",
|
|
1897
|
+
height: compactHeight ?? "h-[24px]"
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
);
|
|
1901
|
+
}
|
|
1902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1903
|
+
DefaultLayout,
|
|
1904
|
+
{
|
|
1905
|
+
className,
|
|
1906
|
+
size,
|
|
1907
|
+
sizeClasses,
|
|
1908
|
+
variantClasses,
|
|
1909
|
+
label,
|
|
1910
|
+
showPercentage,
|
|
1911
|
+
labelClassName,
|
|
1912
|
+
percentageClassName,
|
|
1913
|
+
clampedValue,
|
|
1914
|
+
max,
|
|
1915
|
+
percentage
|
|
1916
|
+
}
|
|
1917
|
+
);
|
|
1918
|
+
};
|
|
1619
1919
|
var ProgressBar_default = ProgressBar;
|
|
1620
1920
|
|
|
1621
1921
|
// src/components/ProgressCircle/ProgressCircle.tsx
|
|
@@ -1788,11 +2088,508 @@ var ProgressCircle = ({
|
|
|
1788
2088
|
};
|
|
1789
2089
|
var ProgressCircle_default = ProgressCircle;
|
|
1790
2090
|
|
|
2091
|
+
// src/components/Calendar/Calendar.tsx
|
|
2092
|
+
var import_react9 = require("react");
|
|
2093
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2094
|
+
var WEEK_DAYS = ["SEG", "TER", "QUA", "QUI", "SEX", "S\xC1B", "DOM"];
|
|
2095
|
+
var WEEK_DAYS_SHORT = ["S", "T", "Q", "Q", "S", "S", "D"];
|
|
2096
|
+
var MONTH_NAMES = [
|
|
2097
|
+
"Janeiro",
|
|
2098
|
+
"Fevereiro",
|
|
2099
|
+
"Mar\xE7o",
|
|
2100
|
+
"Abril",
|
|
2101
|
+
"Maio",
|
|
2102
|
+
"Junho",
|
|
2103
|
+
"Julho",
|
|
2104
|
+
"Agosto",
|
|
2105
|
+
"Setembro",
|
|
2106
|
+
"Outubro",
|
|
2107
|
+
"Novembro",
|
|
2108
|
+
"Dezembro"
|
|
2109
|
+
];
|
|
2110
|
+
var MonthYearPicker = ({
|
|
2111
|
+
monthPickerRef,
|
|
2112
|
+
availableYears,
|
|
2113
|
+
currentDate,
|
|
2114
|
+
onYearChange,
|
|
2115
|
+
onMonthChange
|
|
2116
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2117
|
+
"div",
|
|
2118
|
+
{
|
|
2119
|
+
ref: monthPickerRef,
|
|
2120
|
+
className: "absolute top-full left-0 z-50 mt-1 bg-white rounded-lg shadow-lg border border-border-200 p-4 min-w-[280px]",
|
|
2121
|
+
children: [
|
|
2122
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mb-4", children: [
|
|
2123
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h3", { className: "text-sm font-medium text-text-700 mb-2", children: "Selecionar Ano" }),
|
|
2124
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid grid-cols-4 gap-1 max-h-32 overflow-y-auto", children: availableYears.map((year) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2125
|
+
"button",
|
|
2126
|
+
{
|
|
2127
|
+
onClick: () => onYearChange(year),
|
|
2128
|
+
className: `
|
|
2129
|
+
px-2 py-1 text-xs rounded text-center hover:bg-background-100 transition-colors
|
|
2130
|
+
${year === currentDate.getFullYear() ? "bg-primary-800 text-text font-medium hover:text-text-950" : "text-text-700"}
|
|
2131
|
+
`,
|
|
2132
|
+
children: year
|
|
2133
|
+
},
|
|
2134
|
+
year
|
|
2135
|
+
)) })
|
|
2136
|
+
] }),
|
|
2137
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
|
|
2138
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h3", { className: "text-sm font-medium text-text-700 mb-2", children: "Selecionar M\xEAs" }),
|
|
2139
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid grid-cols-3 gap-1", children: MONTH_NAMES.map((month, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2140
|
+
"button",
|
|
2141
|
+
{
|
|
2142
|
+
onClick: () => onMonthChange(index, currentDate.getFullYear()),
|
|
2143
|
+
className: `
|
|
2144
|
+
px-2 py-2 text-xs rounded text-center hover:bg-background-100 transition-colors
|
|
2145
|
+
${index === currentDate.getMonth() ? "bg-primary-800 text-text font-medium hover:text-text-950" : "text-text-700"}
|
|
2146
|
+
`,
|
|
2147
|
+
children: month.substring(0, 3)
|
|
2148
|
+
},
|
|
2149
|
+
month
|
|
2150
|
+
)) })
|
|
2151
|
+
] })
|
|
2152
|
+
]
|
|
2153
|
+
}
|
|
2154
|
+
);
|
|
2155
|
+
var getDayStyles = (day, variant, showActivities) => {
|
|
2156
|
+
let dayStyle = "";
|
|
2157
|
+
let textStyle = "";
|
|
2158
|
+
if (variant === "selection" && day.isSelected) {
|
|
2159
|
+
dayStyle = "bg-primary-800";
|
|
2160
|
+
textStyle = "text-white";
|
|
2161
|
+
} else if (day.isToday) {
|
|
2162
|
+
textStyle = "text-[#1c61b2]";
|
|
2163
|
+
} else if (variant === "navigation" && showActivities && day.activities?.length) {
|
|
2164
|
+
const primaryActivity = day.activities[0];
|
|
2165
|
+
if (primaryActivity.status === "near-deadline") {
|
|
2166
|
+
dayStyle = "bg-warning-background border-2 border-warning-400";
|
|
2167
|
+
textStyle = "text-text-950";
|
|
2168
|
+
} else if (primaryActivity.status === "in-deadline") {
|
|
2169
|
+
dayStyle = "bg-success-background border-2 border-success-300";
|
|
2170
|
+
textStyle = "text-text-950";
|
|
2171
|
+
} else if (primaryActivity.status === "overdue") {
|
|
2172
|
+
dayStyle = "bg-error-background border-2 border-error-300";
|
|
2173
|
+
textStyle = "text-text-950";
|
|
2174
|
+
} else {
|
|
2175
|
+
dayStyle = "border-2 border-blue-500";
|
|
2176
|
+
textStyle = "text-blue-500";
|
|
2177
|
+
}
|
|
2178
|
+
} else {
|
|
2179
|
+
textStyle = "text-text-950 hover:bg-background-100";
|
|
2180
|
+
}
|
|
2181
|
+
return { dayStyle, textStyle };
|
|
2182
|
+
};
|
|
2183
|
+
var Calendar = ({
|
|
2184
|
+
variant = "selection",
|
|
2185
|
+
selectedDate,
|
|
2186
|
+
onDateSelect,
|
|
2187
|
+
onMonthChange,
|
|
2188
|
+
activities = {},
|
|
2189
|
+
showActivities = true,
|
|
2190
|
+
className = ""
|
|
2191
|
+
}) => {
|
|
2192
|
+
const [currentDate, setCurrentDate] = (0, import_react9.useState)(selectedDate || /* @__PURE__ */ new Date());
|
|
2193
|
+
const [isMonthPickerOpen, setIsMonthPickerOpen] = (0, import_react9.useState)(false);
|
|
2194
|
+
const monthPickerRef = (0, import_react9.useRef)(null);
|
|
2195
|
+
const monthPickerContainerRef = (0, import_react9.useRef)(null);
|
|
2196
|
+
(0, import_react9.useEffect)(() => {
|
|
2197
|
+
const handleClickOutside = (event) => {
|
|
2198
|
+
if (monthPickerContainerRef.current && !monthPickerContainerRef.current.contains(event.target)) {
|
|
2199
|
+
setIsMonthPickerOpen(false);
|
|
2200
|
+
}
|
|
2201
|
+
};
|
|
2202
|
+
if (isMonthPickerOpen) {
|
|
2203
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2204
|
+
}
|
|
2205
|
+
return () => {
|
|
2206
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
2207
|
+
};
|
|
2208
|
+
}, [isMonthPickerOpen]);
|
|
2209
|
+
const today = /* @__PURE__ */ new Date();
|
|
2210
|
+
const availableYears = (0, import_react9.useMemo)(() => {
|
|
2211
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
2212
|
+
const years = [];
|
|
2213
|
+
for (let year = currentYear - 10; year <= currentYear + 10; year++) {
|
|
2214
|
+
years.push(year);
|
|
2215
|
+
}
|
|
2216
|
+
return years;
|
|
2217
|
+
}, []);
|
|
2218
|
+
const calendarData = (0, import_react9.useMemo)(() => {
|
|
2219
|
+
const year = currentDate.getFullYear();
|
|
2220
|
+
const month = currentDate.getMonth();
|
|
2221
|
+
const firstDay = new Date(year, month, 1);
|
|
2222
|
+
const startDate = new Date(firstDay);
|
|
2223
|
+
const firstDayOfWeek = (firstDay.getDay() + 6) % 7;
|
|
2224
|
+
startDate.setDate(startDate.getDate() - firstDayOfWeek);
|
|
2225
|
+
const days = [];
|
|
2226
|
+
const currentCalendarDate = new Date(startDate);
|
|
2227
|
+
for (let i = 0; i < 42; i++) {
|
|
2228
|
+
const dateKey = currentCalendarDate.toISOString().split("T")[0];
|
|
2229
|
+
const dayActivities = activities[dateKey] || [];
|
|
2230
|
+
days.push({
|
|
2231
|
+
date: new Date(currentCalendarDate),
|
|
2232
|
+
isCurrentMonth: currentCalendarDate.getMonth() === month,
|
|
2233
|
+
isToday: currentCalendarDate.getFullYear() === today.getFullYear() && currentCalendarDate.getMonth() === today.getMonth() && currentCalendarDate.getDate() === today.getDate(),
|
|
2234
|
+
isSelected: selectedDate ? currentCalendarDate.getFullYear() === selectedDate.getFullYear() && currentCalendarDate.getMonth() === selectedDate.getMonth() && currentCalendarDate.getDate() === selectedDate.getDate() : false,
|
|
2235
|
+
activities: dayActivities
|
|
2236
|
+
});
|
|
2237
|
+
currentCalendarDate.setDate(currentCalendarDate.getDate() + 1);
|
|
2238
|
+
}
|
|
2239
|
+
return days;
|
|
2240
|
+
}, [currentDate, selectedDate, activities]);
|
|
2241
|
+
const goToPreviousMonth = () => {
|
|
2242
|
+
const newDate = new Date(currentDate);
|
|
2243
|
+
newDate.setMonth(newDate.getMonth() - 1);
|
|
2244
|
+
setCurrentDate(newDate);
|
|
2245
|
+
onMonthChange?.(newDate);
|
|
2246
|
+
};
|
|
2247
|
+
const goToNextMonth = () => {
|
|
2248
|
+
const newDate = new Date(currentDate);
|
|
2249
|
+
newDate.setMonth(newDate.getMonth() + 1);
|
|
2250
|
+
setCurrentDate(newDate);
|
|
2251
|
+
onMonthChange?.(newDate);
|
|
2252
|
+
};
|
|
2253
|
+
const goToMonth = (month, year) => {
|
|
2254
|
+
const newDate = new Date(year, month, 1);
|
|
2255
|
+
setCurrentDate(newDate);
|
|
2256
|
+
setIsMonthPickerOpen(false);
|
|
2257
|
+
onMonthChange?.(newDate);
|
|
2258
|
+
};
|
|
2259
|
+
const handleYearChange = (year) => {
|
|
2260
|
+
const newDate = new Date(year, currentDate.getMonth(), 1);
|
|
2261
|
+
setCurrentDate(newDate);
|
|
2262
|
+
};
|
|
2263
|
+
const toggleMonthPicker = (event) => {
|
|
2264
|
+
event.stopPropagation();
|
|
2265
|
+
setIsMonthPickerOpen(!isMonthPickerOpen);
|
|
2266
|
+
};
|
|
2267
|
+
const handleDateSelect = (day) => {
|
|
2268
|
+
onDateSelect?.(day.date);
|
|
2269
|
+
};
|
|
2270
|
+
if (variant === "navigation") {
|
|
2271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `bg-background rounded-xl p-3 ${className}`, children: [
|
|
2272
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between mb-4 px-6", children: [
|
|
2273
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "relative", ref: monthPickerContainerRef, children: [
|
|
2274
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2275
|
+
"button",
|
|
2276
|
+
{
|
|
2277
|
+
onClick: toggleMonthPicker,
|
|
2278
|
+
className: "flex items-center gap-1 hover:bg-background-100 rounded px-2 py-1 transition-colors",
|
|
2279
|
+
children: [
|
|
2280
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "text-sm font-medium text-text-600", children: [
|
|
2281
|
+
MONTH_NAMES[currentDate.getMonth()],
|
|
2282
|
+
" ",
|
|
2283
|
+
currentDate.getFullYear()
|
|
2284
|
+
] }),
|
|
2285
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2286
|
+
"svg",
|
|
2287
|
+
{
|
|
2288
|
+
className: `w-4 h-4 text-primary-950 transition-transform ${isMonthPickerOpen ? "rotate-180" : ""}`,
|
|
2289
|
+
fill: "none",
|
|
2290
|
+
stroke: "currentColor",
|
|
2291
|
+
viewBox: "0 0 24 24",
|
|
2292
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2293
|
+
"path",
|
|
2294
|
+
{
|
|
2295
|
+
strokeLinecap: "round",
|
|
2296
|
+
strokeLinejoin: "round",
|
|
2297
|
+
strokeWidth: 2,
|
|
2298
|
+
d: "M19 9l-7 7-7-7"
|
|
2299
|
+
}
|
|
2300
|
+
)
|
|
2301
|
+
}
|
|
2302
|
+
)
|
|
2303
|
+
]
|
|
2304
|
+
}
|
|
2305
|
+
),
|
|
2306
|
+
isMonthPickerOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2307
|
+
MonthYearPicker,
|
|
2308
|
+
{
|
|
2309
|
+
monthPickerRef,
|
|
2310
|
+
availableYears,
|
|
2311
|
+
currentDate,
|
|
2312
|
+
onYearChange: handleYearChange,
|
|
2313
|
+
onMonthChange: goToMonth
|
|
2314
|
+
}
|
|
2315
|
+
)
|
|
2316
|
+
] }),
|
|
2317
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-10", children: [
|
|
2318
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2319
|
+
"button",
|
|
2320
|
+
{
|
|
2321
|
+
onClick: goToPreviousMonth,
|
|
2322
|
+
className: "p-1 rounded hover:bg-background-100 transition-colors",
|
|
2323
|
+
"aria-label": "M\xEAs anterior",
|
|
2324
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2325
|
+
"svg",
|
|
2326
|
+
{
|
|
2327
|
+
className: "w-6 h-6 text-primary-950",
|
|
2328
|
+
fill: "none",
|
|
2329
|
+
stroke: "currentColor",
|
|
2330
|
+
viewBox: "0 0 24 24",
|
|
2331
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2332
|
+
"path",
|
|
2333
|
+
{
|
|
2334
|
+
strokeLinecap: "round",
|
|
2335
|
+
strokeLinejoin: "round",
|
|
2336
|
+
strokeWidth: 2,
|
|
2337
|
+
d: "M15 19l-7-7 7-7"
|
|
2338
|
+
}
|
|
2339
|
+
)
|
|
2340
|
+
}
|
|
2341
|
+
)
|
|
2342
|
+
}
|
|
2343
|
+
),
|
|
2344
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2345
|
+
"button",
|
|
2346
|
+
{
|
|
2347
|
+
onClick: goToNextMonth,
|
|
2348
|
+
className: "p-1 rounded hover:bg-background-100 transition-colors",
|
|
2349
|
+
"aria-label": "Pr\xF3ximo m\xEAs",
|
|
2350
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2351
|
+
"svg",
|
|
2352
|
+
{
|
|
2353
|
+
className: "w-6 h-6 text-primary-950",
|
|
2354
|
+
fill: "none",
|
|
2355
|
+
stroke: "currentColor",
|
|
2356
|
+
viewBox: "0 0 24 24",
|
|
2357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2358
|
+
"path",
|
|
2359
|
+
{
|
|
2360
|
+
strokeLinecap: "round",
|
|
2361
|
+
strokeLinejoin: "round",
|
|
2362
|
+
strokeWidth: 2,
|
|
2363
|
+
d: "M9 5l7 7-7 7"
|
|
2364
|
+
}
|
|
2365
|
+
)
|
|
2366
|
+
}
|
|
2367
|
+
)
|
|
2368
|
+
}
|
|
2369
|
+
)
|
|
2370
|
+
] })
|
|
2371
|
+
] }),
|
|
2372
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid grid-cols-7 gap-1 mb-2", children: WEEK_DAYS_SHORT.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2373
|
+
"div",
|
|
2374
|
+
{
|
|
2375
|
+
className: "h-9 flex items-center justify-center text-xs font-normal text-text-600",
|
|
2376
|
+
children: day
|
|
2377
|
+
},
|
|
2378
|
+
`${day}-${index}`
|
|
2379
|
+
)) }),
|
|
2380
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid grid-cols-7 gap-1", children: calendarData.map((day) => {
|
|
2381
|
+
if (!day.isCurrentMonth) {
|
|
2382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2383
|
+
"div",
|
|
2384
|
+
{
|
|
2385
|
+
className: "flex items-center justify-center",
|
|
2386
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-9 h-9" })
|
|
2387
|
+
},
|
|
2388
|
+
day.date.getTime()
|
|
2389
|
+
);
|
|
2390
|
+
}
|
|
2391
|
+
const { dayStyle, textStyle } = getDayStyles(
|
|
2392
|
+
day,
|
|
2393
|
+
variant,
|
|
2394
|
+
showActivities
|
|
2395
|
+
);
|
|
2396
|
+
let spanClass = "";
|
|
2397
|
+
if (day.isSelected && day.isToday) {
|
|
2398
|
+
spanClass = "h-6 w-6 rounded-full bg-[#1c61b2] text-text";
|
|
2399
|
+
} else if (day.isSelected) {
|
|
2400
|
+
spanClass = "h-6 w-6 rounded-full bg-primary-950 text-text";
|
|
2401
|
+
}
|
|
2402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2403
|
+
"div",
|
|
2404
|
+
{
|
|
2405
|
+
className: "flex items-center justify-center",
|
|
2406
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2407
|
+
"button",
|
|
2408
|
+
{
|
|
2409
|
+
className: `
|
|
2410
|
+
w-9 h-9
|
|
2411
|
+
flex items-center justify-center
|
|
2412
|
+
text-md font-normal
|
|
2413
|
+
cursor-pointer
|
|
2414
|
+
rounded-full
|
|
2415
|
+
${dayStyle}
|
|
2416
|
+
${textStyle}
|
|
2417
|
+
`,
|
|
2418
|
+
onClick: () => handleDateSelect(day),
|
|
2419
|
+
"aria-label": `${day.date.getDate()} de ${MONTH_NAMES[day.date.getMonth()]}`,
|
|
2420
|
+
"aria-current": day.isToday ? "date" : void 0,
|
|
2421
|
+
tabIndex: 0,
|
|
2422
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: spanClass, children: day.date.getDate() })
|
|
2423
|
+
}
|
|
2424
|
+
)
|
|
2425
|
+
},
|
|
2426
|
+
day.date.getTime()
|
|
2427
|
+
);
|
|
2428
|
+
}) })
|
|
2429
|
+
] });
|
|
2430
|
+
}
|
|
2431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `bg-background rounded-xl p-4 ${className}`, children: [
|
|
2432
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between mb-3.5", children: [
|
|
2433
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "relative", ref: monthPickerContainerRef, children: [
|
|
2434
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2435
|
+
"button",
|
|
2436
|
+
{
|
|
2437
|
+
onClick: toggleMonthPicker,
|
|
2438
|
+
className: "flex items-center gap-2 hover:bg-background-100 rounded px-2 py-1 transition-colors",
|
|
2439
|
+
children: [
|
|
2440
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("h2", { className: "text-lg font-semibold text-text-950", children: [
|
|
2441
|
+
MONTH_NAMES[currentDate.getMonth()],
|
|
2442
|
+
" ",
|
|
2443
|
+
currentDate.getFullYear()
|
|
2444
|
+
] }),
|
|
2445
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2446
|
+
"svg",
|
|
2447
|
+
{
|
|
2448
|
+
className: `w-4 h-4 text-text-400 transition-transform ${isMonthPickerOpen ? "rotate-180" : ""}`,
|
|
2449
|
+
fill: "none",
|
|
2450
|
+
stroke: "currentColor",
|
|
2451
|
+
viewBox: "0 0 24 24",
|
|
2452
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2453
|
+
"path",
|
|
2454
|
+
{
|
|
2455
|
+
strokeLinecap: "round",
|
|
2456
|
+
strokeLinejoin: "round",
|
|
2457
|
+
strokeWidth: 2,
|
|
2458
|
+
d: "M19 9l-7 7-7-7"
|
|
2459
|
+
}
|
|
2460
|
+
)
|
|
2461
|
+
}
|
|
2462
|
+
)
|
|
2463
|
+
]
|
|
2464
|
+
}
|
|
2465
|
+
),
|
|
2466
|
+
isMonthPickerOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2467
|
+
MonthYearPicker,
|
|
2468
|
+
{
|
|
2469
|
+
monthPickerRef,
|
|
2470
|
+
availableYears,
|
|
2471
|
+
currentDate,
|
|
2472
|
+
onYearChange: handleYearChange,
|
|
2473
|
+
onMonthChange: goToMonth
|
|
2474
|
+
}
|
|
2475
|
+
)
|
|
2476
|
+
] }),
|
|
2477
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2478
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2479
|
+
"button",
|
|
2480
|
+
{
|
|
2481
|
+
onClick: goToPreviousMonth,
|
|
2482
|
+
className: "p-1 rounded-md hover:bg-background-100 transition-colors",
|
|
2483
|
+
"aria-label": "M\xEAs anterior",
|
|
2484
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2485
|
+
"svg",
|
|
2486
|
+
{
|
|
2487
|
+
className: "w-6 h-6 text-primary-950",
|
|
2488
|
+
fill: "none",
|
|
2489
|
+
stroke: "currentColor",
|
|
2490
|
+
viewBox: "0 0 24 24",
|
|
2491
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2492
|
+
"path",
|
|
2493
|
+
{
|
|
2494
|
+
strokeLinecap: "round",
|
|
2495
|
+
strokeLinejoin: "round",
|
|
2496
|
+
strokeWidth: 2,
|
|
2497
|
+
d: "M15 19l-7-7 7-7"
|
|
2498
|
+
}
|
|
2499
|
+
)
|
|
2500
|
+
}
|
|
2501
|
+
)
|
|
2502
|
+
}
|
|
2503
|
+
),
|
|
2504
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2505
|
+
"button",
|
|
2506
|
+
{
|
|
2507
|
+
onClick: goToNextMonth,
|
|
2508
|
+
className: "p-1 rounded-md hover:bg-background-100 transition-colors",
|
|
2509
|
+
"aria-label": "Pr\xF3ximo m\xEAs",
|
|
2510
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2511
|
+
"svg",
|
|
2512
|
+
{
|
|
2513
|
+
className: "w-6 h-6 text-primary-950",
|
|
2514
|
+
fill: "none",
|
|
2515
|
+
stroke: "currentColor",
|
|
2516
|
+
viewBox: "0 0 24 24",
|
|
2517
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2518
|
+
"path",
|
|
2519
|
+
{
|
|
2520
|
+
strokeLinecap: "round",
|
|
2521
|
+
strokeLinejoin: "round",
|
|
2522
|
+
strokeWidth: 2,
|
|
2523
|
+
d: "M9 5l7 7-7 7"
|
|
2524
|
+
}
|
|
2525
|
+
)
|
|
2526
|
+
}
|
|
2527
|
+
)
|
|
2528
|
+
}
|
|
2529
|
+
)
|
|
2530
|
+
] })
|
|
2531
|
+
] }),
|
|
2532
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid grid-cols-7 gap-1 mb-2", children: WEEK_DAYS.map((day) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2533
|
+
"div",
|
|
2534
|
+
{
|
|
2535
|
+
className: "h-4 flex items-center justify-center text-xs font-semibold text-text-500",
|
|
2536
|
+
children: day
|
|
2537
|
+
},
|
|
2538
|
+
day
|
|
2539
|
+
)) }),
|
|
2540
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "grid grid-cols-7 gap-1", children: calendarData.map((day) => {
|
|
2541
|
+
if (!day.isCurrentMonth) {
|
|
2542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2543
|
+
"div",
|
|
2544
|
+
{
|
|
2545
|
+
className: "flex items-center justify-center",
|
|
2546
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-10 h-10" })
|
|
2547
|
+
},
|
|
2548
|
+
day.date.getTime()
|
|
2549
|
+
);
|
|
2550
|
+
}
|
|
2551
|
+
const { dayStyle, textStyle } = getDayStyles(
|
|
2552
|
+
day,
|
|
2553
|
+
variant,
|
|
2554
|
+
showActivities
|
|
2555
|
+
);
|
|
2556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2557
|
+
"div",
|
|
2558
|
+
{
|
|
2559
|
+
className: "flex items-center justify-center",
|
|
2560
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2561
|
+
"button",
|
|
2562
|
+
{
|
|
2563
|
+
className: `
|
|
2564
|
+
w-10 h-10
|
|
2565
|
+
flex items-center justify-center
|
|
2566
|
+
text-xl font-normal
|
|
2567
|
+
cursor-pointer
|
|
2568
|
+
rounded-full
|
|
2569
|
+
focus:outline-none focus:ring-2 focus:ring-primary-600 focus:ring-offset-1
|
|
2570
|
+
${dayStyle}
|
|
2571
|
+
${textStyle}
|
|
2572
|
+
`,
|
|
2573
|
+
onClick: () => handleDateSelect(day),
|
|
2574
|
+
"aria-label": `${day.date.getDate()} de ${MONTH_NAMES[day.date.getMonth()]}`,
|
|
2575
|
+
"aria-current": day.isToday ? "date" : void 0,
|
|
2576
|
+
tabIndex: 0,
|
|
2577
|
+
children: day.date.getDate()
|
|
2578
|
+
}
|
|
2579
|
+
)
|
|
2580
|
+
},
|
|
2581
|
+
day.date.getTime()
|
|
2582
|
+
);
|
|
2583
|
+
}) })
|
|
2584
|
+
] });
|
|
2585
|
+
};
|
|
2586
|
+
var Calendar_default = Calendar;
|
|
2587
|
+
|
|
1791
2588
|
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
1792
2589
|
var import_phosphor_react7 = require("phosphor-react");
|
|
1793
|
-
var
|
|
2590
|
+
var import_react10 = require("react");
|
|
1794
2591
|
var import_zustand2 = require("zustand");
|
|
1795
|
-
var
|
|
2592
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1796
2593
|
function createDropdownStore() {
|
|
1797
2594
|
return (0, import_zustand2.create)((set) => ({
|
|
1798
2595
|
open: false,
|
|
@@ -1808,8 +2605,8 @@ var useDropdownStore = (externalStore) => {
|
|
|
1808
2605
|
return externalStore;
|
|
1809
2606
|
};
|
|
1810
2607
|
var injectStore = (children, store) => {
|
|
1811
|
-
return
|
|
1812
|
-
if ((0,
|
|
2608
|
+
return import_react10.Children.map(children, (child) => {
|
|
2609
|
+
if ((0, import_react10.isValidElement)(child)) {
|
|
1813
2610
|
const typedChild = child;
|
|
1814
2611
|
const newProps = {
|
|
1815
2612
|
store
|
|
@@ -1817,13 +2614,13 @@ var injectStore = (children, store) => {
|
|
|
1817
2614
|
if (typedChild.props.children) {
|
|
1818
2615
|
newProps.children = injectStore(typedChild.props.children, store);
|
|
1819
2616
|
}
|
|
1820
|
-
return (0,
|
|
2617
|
+
return (0, import_react10.cloneElement)(typedChild, newProps);
|
|
1821
2618
|
}
|
|
1822
2619
|
return child;
|
|
1823
2620
|
});
|
|
1824
2621
|
};
|
|
1825
2622
|
var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
1826
|
-
const storeRef = (0,
|
|
2623
|
+
const storeRef = (0, import_react10.useRef)(null);
|
|
1827
2624
|
storeRef.current ??= createDropdownStore();
|
|
1828
2625
|
const store = storeRef.current;
|
|
1829
2626
|
const isControlled = open !== void 0;
|
|
@@ -1833,7 +2630,7 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
1833
2630
|
onOpenChange?.(newOpen);
|
|
1834
2631
|
if (!isControlled) store.setState({ open: newOpen });
|
|
1835
2632
|
};
|
|
1836
|
-
const menuRef = (0,
|
|
2633
|
+
const menuRef = (0, import_react10.useRef)(null);
|
|
1837
2634
|
const handleArrowDownOrArrowUp = (event) => {
|
|
1838
2635
|
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
1839
2636
|
if (menuContent) {
|
|
@@ -1867,7 +2664,7 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
1867
2664
|
setOpen(false);
|
|
1868
2665
|
}
|
|
1869
2666
|
};
|
|
1870
|
-
(0,
|
|
2667
|
+
(0, import_react10.useEffect)(() => {
|
|
1871
2668
|
onOpenChange?.(currentOpen);
|
|
1872
2669
|
if (currentOpen) {
|
|
1873
2670
|
document.addEventListener("mousedown", handleClickOutside);
|
|
@@ -1878,12 +2675,12 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
1878
2675
|
document.removeEventListener("keydown", handleDownkey);
|
|
1879
2676
|
};
|
|
1880
2677
|
}, [currentOpen]);
|
|
1881
|
-
(0,
|
|
2678
|
+
(0, import_react10.useEffect)(() => {
|
|
1882
2679
|
if (isControlled) {
|
|
1883
2680
|
store.setState({ open });
|
|
1884
2681
|
}
|
|
1885
2682
|
}, []);
|
|
1886
|
-
return /* @__PURE__ */ (0,
|
|
2683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
|
|
1887
2684
|
};
|
|
1888
2685
|
var DropdownMenuTrigger = ({
|
|
1889
2686
|
className,
|
|
@@ -1895,7 +2692,7 @@ var DropdownMenuTrigger = ({
|
|
|
1895
2692
|
const store = useDropdownStore(externalStore);
|
|
1896
2693
|
const open = (0, import_zustand2.useStore)(store, (s) => s.open);
|
|
1897
2694
|
const toggleOpen = () => store.setState({ open: !open });
|
|
1898
|
-
return /* @__PURE__ */ (0,
|
|
2695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1899
2696
|
Button_default,
|
|
1900
2697
|
{
|
|
1901
2698
|
variant: "outline",
|
|
@@ -1931,8 +2728,8 @@ var MENUCONTENT_VARIANT_CLASSES = {
|
|
|
1931
2728
|
menu: "p-1",
|
|
1932
2729
|
profile: "p-6"
|
|
1933
2730
|
};
|
|
1934
|
-
var MenuLabel = (0,
|
|
1935
|
-
return /* @__PURE__ */ (0,
|
|
2731
|
+
var MenuLabel = (0, import_react10.forwardRef)(({ className, inset, store: _store, ...props }, ref) => {
|
|
2732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1936
2733
|
"div",
|
|
1937
2734
|
{
|
|
1938
2735
|
ref,
|
|
@@ -1942,7 +2739,7 @@ var MenuLabel = (0, import_react9.forwardRef)(({ className, inset, store: _store
|
|
|
1942
2739
|
);
|
|
1943
2740
|
});
|
|
1944
2741
|
MenuLabel.displayName = "MenuLabel";
|
|
1945
|
-
var MenuContent = (0,
|
|
2742
|
+
var MenuContent = (0, import_react10.forwardRef)(
|
|
1946
2743
|
({
|
|
1947
2744
|
className,
|
|
1948
2745
|
align = "start",
|
|
@@ -1955,8 +2752,8 @@ var MenuContent = (0, import_react9.forwardRef)(
|
|
|
1955
2752
|
}, ref) => {
|
|
1956
2753
|
const store = useDropdownStore(externalStore);
|
|
1957
2754
|
const open = (0, import_zustand2.useStore)(store, (s) => s.open);
|
|
1958
|
-
const [isVisible, setIsVisible] = (0,
|
|
1959
|
-
(0,
|
|
2755
|
+
const [isVisible, setIsVisible] = (0, import_react10.useState)(open);
|
|
2756
|
+
(0, import_react10.useEffect)(() => {
|
|
1960
2757
|
if (open) {
|
|
1961
2758
|
setIsVisible(true);
|
|
1962
2759
|
} else {
|
|
@@ -1971,7 +2768,7 @@ var MenuContent = (0, import_react9.forwardRef)(
|
|
|
1971
2768
|
return `absolute ${vertical} ${horizontal}`;
|
|
1972
2769
|
};
|
|
1973
2770
|
const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
|
|
1974
|
-
return /* @__PURE__ */ (0,
|
|
2771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1975
2772
|
"div",
|
|
1976
2773
|
{
|
|
1977
2774
|
ref,
|
|
@@ -1996,7 +2793,7 @@ var MenuContent = (0, import_react9.forwardRef)(
|
|
|
1996
2793
|
}
|
|
1997
2794
|
);
|
|
1998
2795
|
MenuContent.displayName = "MenuContent";
|
|
1999
|
-
var DropdownMenuItem = (0,
|
|
2796
|
+
var DropdownMenuItem = (0, import_react10.forwardRef)(
|
|
2000
2797
|
({
|
|
2001
2798
|
className,
|
|
2002
2799
|
size = "small",
|
|
@@ -2030,7 +2827,7 @@ var DropdownMenuItem = (0, import_react9.forwardRef)(
|
|
|
2030
2827
|
const getVariantProps = () => {
|
|
2031
2828
|
return variant === "profile" ? { "data-variant": "profile" } : {};
|
|
2032
2829
|
};
|
|
2033
|
-
return /* @__PURE__ */ (0,
|
|
2830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2034
2831
|
"div",
|
|
2035
2832
|
{
|
|
2036
2833
|
ref,
|
|
@@ -2052,7 +2849,7 @@ var DropdownMenuItem = (0, import_react9.forwardRef)(
|
|
|
2052
2849
|
...props,
|
|
2053
2850
|
children: [
|
|
2054
2851
|
iconLeft,
|
|
2055
|
-
/* @__PURE__ */ (0,
|
|
2852
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "w-full text-md", children }),
|
|
2056
2853
|
iconRight
|
|
2057
2854
|
]
|
|
2058
2855
|
}
|
|
@@ -2060,7 +2857,7 @@ var DropdownMenuItem = (0, import_react9.forwardRef)(
|
|
|
2060
2857
|
}
|
|
2061
2858
|
);
|
|
2062
2859
|
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
2063
|
-
var DropdownMenuSeparator = (0,
|
|
2860
|
+
var DropdownMenuSeparator = (0, import_react10.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2064
2861
|
"div",
|
|
2065
2862
|
{
|
|
2066
2863
|
ref,
|
|
@@ -2069,11 +2866,11 @@ var DropdownMenuSeparator = (0, import_react9.forwardRef)(({ className, store: _
|
|
|
2069
2866
|
}
|
|
2070
2867
|
));
|
|
2071
2868
|
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
2072
|
-
var ProfileMenuTrigger = (0,
|
|
2869
|
+
var ProfileMenuTrigger = (0, import_react10.forwardRef)(({ className, onClick, store: externalStore, ...props }, ref) => {
|
|
2073
2870
|
const store = useDropdownStore(externalStore);
|
|
2074
2871
|
const open = (0, import_zustand2.useStore)(store, (s) => s.open);
|
|
2075
2872
|
const toggleOpen = () => store.setState({ open: !open });
|
|
2076
|
-
return /* @__PURE__ */ (0,
|
|
2873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2077
2874
|
"button",
|
|
2078
2875
|
{
|
|
2079
2876
|
ref,
|
|
@@ -2085,13 +2882,13 @@ var ProfileMenuTrigger = (0, import_react9.forwardRef)(({ className, onClick, st
|
|
|
2085
2882
|
},
|
|
2086
2883
|
"aria-expanded": open,
|
|
2087
2884
|
...props,
|
|
2088
|
-
children: /* @__PURE__ */ (0,
|
|
2885
|
+
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 }) })
|
|
2089
2886
|
}
|
|
2090
2887
|
);
|
|
2091
2888
|
});
|
|
2092
2889
|
ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
|
|
2093
|
-
var ProfileMenuHeader = (0,
|
|
2094
|
-
return /* @__PURE__ */ (0,
|
|
2890
|
+
var ProfileMenuHeader = (0, import_react10.forwardRef)(({ className, name, email, store: _store, ...props }, ref) => {
|
|
2891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2095
2892
|
"div",
|
|
2096
2893
|
{
|
|
2097
2894
|
ref,
|
|
@@ -2102,18 +2899,18 @@ var ProfileMenuHeader = (0, import_react9.forwardRef)(({ className, name, email,
|
|
|
2102
2899
|
`,
|
|
2103
2900
|
...props,
|
|
2104
2901
|
children: [
|
|
2105
|
-
/* @__PURE__ */ (0,
|
|
2106
|
-
/* @__PURE__ */ (0,
|
|
2107
|
-
/* @__PURE__ */ (0,
|
|
2108
|
-
/* @__PURE__ */ (0,
|
|
2902
|
+
/* @__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" }) }),
|
|
2903
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col ", children: [
|
|
2904
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xl font-bold text-text-950", children: name }),
|
|
2905
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-md text-text-600", children: email })
|
|
2109
2906
|
] })
|
|
2110
2907
|
]
|
|
2111
2908
|
}
|
|
2112
2909
|
);
|
|
2113
2910
|
});
|
|
2114
2911
|
ProfileMenuHeader.displayName = "ProfileMenuHeader";
|
|
2115
|
-
var ProfileMenuSection = (0,
|
|
2116
|
-
return /* @__PURE__ */ (0,
|
|
2912
|
+
var ProfileMenuSection = (0, import_react10.forwardRef)(({ className, children, store: _store, ...props }, ref) => {
|
|
2913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2117
2914
|
"div",
|
|
2118
2915
|
{
|
|
2119
2916
|
ref,
|
|
@@ -2136,7 +2933,7 @@ var ProfileMenuFooter = ({
|
|
|
2136
2933
|
}) => {
|
|
2137
2934
|
const store = useDropdownStore(externalStore);
|
|
2138
2935
|
const setOpen = (0, import_zustand2.useStore)(store, (s) => s.setOpen);
|
|
2139
|
-
return /* @__PURE__ */ (0,
|
|
2936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2140
2937
|
Button_default,
|
|
2141
2938
|
{
|
|
2142
2939
|
variant: "outline",
|
|
@@ -2148,8 +2945,8 @@ var ProfileMenuFooter = ({
|
|
|
2148
2945
|
},
|
|
2149
2946
|
...props,
|
|
2150
2947
|
children: [
|
|
2151
|
-
/* @__PURE__ */ (0,
|
|
2152
|
-
/* @__PURE__ */ (0,
|
|
2948
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_phosphor_react7.SignOut, {}) }),
|
|
2949
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: "Sair" })
|
|
2153
2950
|
]
|
|
2154
2951
|
}
|
|
2155
2952
|
);
|
|
@@ -2159,9 +2956,9 @@ var DropdownMenu_default = DropdownMenu;
|
|
|
2159
2956
|
|
|
2160
2957
|
// src/components/Select/Select.tsx
|
|
2161
2958
|
var import_zustand3 = require("zustand");
|
|
2162
|
-
var
|
|
2959
|
+
var import_react11 = require("react");
|
|
2163
2960
|
var import_phosphor_react8 = require("phosphor-react");
|
|
2164
|
-
var
|
|
2961
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2165
2962
|
var VARIANT_CLASSES4 = {
|
|
2166
2963
|
outlined: "border-2 rounded-sm focus:border-primary-950",
|
|
2167
2964
|
underlined: "border-b-2 focus:border-primary-950",
|
|
@@ -2205,13 +3002,13 @@ function getLabelAsNode(children) {
|
|
|
2205
3002
|
if (typeof children === "string" || typeof children === "number") {
|
|
2206
3003
|
return children;
|
|
2207
3004
|
}
|
|
2208
|
-
const flattened =
|
|
3005
|
+
const flattened = import_react11.Children.toArray(children);
|
|
2209
3006
|
if (flattened.length === 1) return flattened[0];
|
|
2210
|
-
return /* @__PURE__ */ (0,
|
|
3007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: flattened });
|
|
2211
3008
|
}
|
|
2212
3009
|
var injectStore2 = (children, store) => {
|
|
2213
|
-
return
|
|
2214
|
-
if ((0,
|
|
3010
|
+
return import_react11.Children.map(children, (child) => {
|
|
3011
|
+
if ((0, import_react11.isValidElement)(child)) {
|
|
2215
3012
|
const typedChild = child;
|
|
2216
3013
|
const newProps = {
|
|
2217
3014
|
store
|
|
@@ -2219,7 +3016,7 @@ var injectStore2 = (children, store) => {
|
|
|
2219
3016
|
if (typedChild.props.children) {
|
|
2220
3017
|
newProps.children = injectStore2(typedChild.props.children, store);
|
|
2221
3018
|
}
|
|
2222
|
-
return (0,
|
|
3019
|
+
return (0, import_react11.cloneElement)(typedChild, newProps);
|
|
2223
3020
|
}
|
|
2224
3021
|
return child;
|
|
2225
3022
|
});
|
|
@@ -2231,10 +3028,10 @@ var Select = ({
|
|
|
2231
3028
|
onValueChange,
|
|
2232
3029
|
size = "small"
|
|
2233
3030
|
}) => {
|
|
2234
|
-
const storeRef = (0,
|
|
3031
|
+
const storeRef = (0, import_react11.useRef)(null);
|
|
2235
3032
|
storeRef.current ??= createSelectStore();
|
|
2236
3033
|
const store = storeRef.current;
|
|
2237
|
-
const selectRef = (0,
|
|
3034
|
+
const selectRef = (0, import_react11.useRef)(null);
|
|
2238
3035
|
const { open, setOpen, setValue, value, selectedLabel } = (0, import_zustand3.useStore)(
|
|
2239
3036
|
store,
|
|
2240
3037
|
(s) => s
|
|
@@ -2244,8 +3041,8 @@ var Select = ({
|
|
|
2244
3041
|
const findLabelForValue = (children2, targetValue) => {
|
|
2245
3042
|
let found = null;
|
|
2246
3043
|
const search = (nodes) => {
|
|
2247
|
-
|
|
2248
|
-
if (!(0,
|
|
3044
|
+
import_react11.Children.forEach(nodes, (child) => {
|
|
3045
|
+
if (!(0, import_react11.isValidElement)(child)) return;
|
|
2249
3046
|
const typedChild = child;
|
|
2250
3047
|
if (typedChild.type === SelectItem && typedChild.props.value === targetValue) {
|
|
2251
3048
|
if (typeof typedChild.props.children === "string")
|
|
@@ -2258,13 +3055,13 @@ var Select = ({
|
|
|
2258
3055
|
search(children2);
|
|
2259
3056
|
return found;
|
|
2260
3057
|
};
|
|
2261
|
-
(0,
|
|
3058
|
+
(0, import_react11.useEffect)(() => {
|
|
2262
3059
|
if (!selectedLabel && defaultValue) {
|
|
2263
3060
|
const label = findLabelForValue(children, defaultValue);
|
|
2264
3061
|
if (label) store.setState({ selectedLabel: label });
|
|
2265
3062
|
}
|
|
2266
3063
|
}, [children, defaultValue, selectedLabel]);
|
|
2267
|
-
(0,
|
|
3064
|
+
(0, import_react11.useEffect)(() => {
|
|
2268
3065
|
setValue(currentValue);
|
|
2269
3066
|
const handleClickOutside = (event) => {
|
|
2270
3067
|
if (selectRef.current && !selectRef.current.contains(event.target)) {
|
|
@@ -2300,13 +3097,13 @@ var Select = ({
|
|
|
2300
3097
|
document.removeEventListener("keydown", handleArrowKeys);
|
|
2301
3098
|
};
|
|
2302
3099
|
}, [open]);
|
|
2303
|
-
(0,
|
|
3100
|
+
(0, import_react11.useEffect)(() => {
|
|
2304
3101
|
if (onValueChange) {
|
|
2305
3102
|
onValueChange(value);
|
|
2306
3103
|
}
|
|
2307
3104
|
}, [value]);
|
|
2308
3105
|
const sizeClasses = SIZE_CLASSES9[size];
|
|
2309
|
-
return /* @__PURE__ */ (0,
|
|
3106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: `relative ${sizeClasses} w-[288px]`, ref: selectRef, children: injectStore2(children, store) });
|
|
2310
3107
|
};
|
|
2311
3108
|
var SelectValue = ({
|
|
2312
3109
|
placeholder,
|
|
@@ -2315,9 +3112,9 @@ var SelectValue = ({
|
|
|
2315
3112
|
const store = useSelectStore(externalStore);
|
|
2316
3113
|
const selectedLabel = (0, import_zustand3.useStore)(store, (s) => s.selectedLabel);
|
|
2317
3114
|
const value = (0, import_zustand3.useStore)(store, (s) => s.value);
|
|
2318
|
-
return /* @__PURE__ */ (0,
|
|
3115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-inherit", children: selectedLabel || placeholder || value });
|
|
2319
3116
|
};
|
|
2320
|
-
var SelectTrigger = (0,
|
|
3117
|
+
var SelectTrigger = (0, import_react11.forwardRef)(
|
|
2321
3118
|
({
|
|
2322
3119
|
className,
|
|
2323
3120
|
invalid = false,
|
|
@@ -2330,7 +3127,7 @@ var SelectTrigger = (0, import_react10.forwardRef)(
|
|
|
2330
3127
|
const open = (0, import_zustand3.useStore)(store, (s) => s.open);
|
|
2331
3128
|
const toggleOpen = () => store.setState({ open: !open });
|
|
2332
3129
|
const variantClasses = VARIANT_CLASSES4[variant];
|
|
2333
|
-
return /* @__PURE__ */ (0,
|
|
3130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2334
3131
|
"button",
|
|
2335
3132
|
{
|
|
2336
3133
|
ref,
|
|
@@ -2349,7 +3146,7 @@ var SelectTrigger = (0, import_react10.forwardRef)(
|
|
|
2349
3146
|
...props,
|
|
2350
3147
|
children: [
|
|
2351
3148
|
props.children,
|
|
2352
|
-
/* @__PURE__ */ (0,
|
|
3149
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2353
3150
|
import_phosphor_react8.CaretDown,
|
|
2354
3151
|
{
|
|
2355
3152
|
className: `h-[1em] w-[1em] opacity-50 transition-transform ${open ? "rotate-180" : ""}`
|
|
@@ -2361,7 +3158,7 @@ var SelectTrigger = (0, import_react10.forwardRef)(
|
|
|
2361
3158
|
}
|
|
2362
3159
|
);
|
|
2363
3160
|
SelectTrigger.displayName = "SelectTrigger";
|
|
2364
|
-
var SelectContent = (0,
|
|
3161
|
+
var SelectContent = (0, import_react11.forwardRef)(
|
|
2365
3162
|
({
|
|
2366
3163
|
children,
|
|
2367
3164
|
className,
|
|
@@ -2374,7 +3171,7 @@ var SelectContent = (0, import_react10.forwardRef)(
|
|
|
2374
3171
|
const open = (0, import_zustand3.useStore)(store, (s) => s.open);
|
|
2375
3172
|
if (!open) return null;
|
|
2376
3173
|
const getPositionClasses = () => `w-full min-w-full absolute ${SIDE_CLASSES2[side]} ${ALIGN_CLASSES2[align]}`;
|
|
2377
|
-
return /* @__PURE__ */ (0,
|
|
3174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2378
3175
|
"div",
|
|
2379
3176
|
{
|
|
2380
3177
|
role: "menu",
|
|
@@ -2387,7 +3184,7 @@ var SelectContent = (0, import_react10.forwardRef)(
|
|
|
2387
3184
|
}
|
|
2388
3185
|
);
|
|
2389
3186
|
SelectContent.displayName = "SelectContent";
|
|
2390
|
-
var SelectItem = (0,
|
|
3187
|
+
var SelectItem = (0, import_react11.forwardRef)(
|
|
2391
3188
|
({
|
|
2392
3189
|
className,
|
|
2393
3190
|
children,
|
|
@@ -2408,7 +3205,7 @@ var SelectItem = (0, import_react10.forwardRef)(
|
|
|
2408
3205
|
}
|
|
2409
3206
|
props.onClick?.(e);
|
|
2410
3207
|
};
|
|
2411
|
-
return /* @__PURE__ */ (0,
|
|
3208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2412
3209
|
"div",
|
|
2413
3210
|
{
|
|
2414
3211
|
role: "menuitem",
|
|
@@ -2428,7 +3225,7 @@ var SelectItem = (0, import_react10.forwardRef)(
|
|
|
2428
3225
|
tabIndex: disabled ? -1 : 0,
|
|
2429
3226
|
...props,
|
|
2430
3227
|
children: [
|
|
2431
|
-
/* @__PURE__ */ (0,
|
|
3228
|
+
/* @__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: "" }) }),
|
|
2432
3229
|
children
|
|
2433
3230
|
]
|
|
2434
3231
|
}
|
|
@@ -2440,9 +3237,9 @@ var Select_default = Select;
|
|
|
2440
3237
|
|
|
2441
3238
|
// src/components/Menu/Menu.tsx
|
|
2442
3239
|
var import_zustand4 = require("zustand");
|
|
2443
|
-
var
|
|
3240
|
+
var import_react12 = require("react");
|
|
2444
3241
|
var import_phosphor_react9 = require("phosphor-react");
|
|
2445
|
-
var
|
|
3242
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2446
3243
|
var createMenuStore = () => (0, import_zustand4.create)((set) => ({
|
|
2447
3244
|
value: "",
|
|
2448
3245
|
setValue: (value) => set({ value })
|
|
@@ -2456,7 +3253,7 @@ var VARIANT_CLASSES5 = {
|
|
|
2456
3253
|
menu2: "overflow-x-auto scroll-smooth",
|
|
2457
3254
|
breadcrumb: ""
|
|
2458
3255
|
};
|
|
2459
|
-
var Menu = (0,
|
|
3256
|
+
var Menu = (0, import_react12.forwardRef)(
|
|
2460
3257
|
({
|
|
2461
3258
|
className,
|
|
2462
3259
|
children,
|
|
@@ -2466,19 +3263,19 @@ var Menu = (0, import_react11.forwardRef)(
|
|
|
2466
3263
|
onValueChange,
|
|
2467
3264
|
...props
|
|
2468
3265
|
}, ref) => {
|
|
2469
|
-
const storeRef = (0,
|
|
3266
|
+
const storeRef = (0, import_react12.useRef)(null);
|
|
2470
3267
|
storeRef.current ??= createMenuStore();
|
|
2471
3268
|
const store = storeRef.current;
|
|
2472
3269
|
const { setValue, value } = (0, import_zustand4.useStore)(store, (s) => s);
|
|
2473
|
-
(0,
|
|
3270
|
+
(0, import_react12.useEffect)(() => {
|
|
2474
3271
|
setValue(propValue ?? defaultValue);
|
|
2475
3272
|
}, [defaultValue, propValue, setValue]);
|
|
2476
|
-
(0,
|
|
3273
|
+
(0, import_react12.useEffect)(() => {
|
|
2477
3274
|
onValueChange?.(value);
|
|
2478
3275
|
}, [value, onValueChange]);
|
|
2479
3276
|
const baseClasses = "w-full flex flex-row items-center gap-2 py-2 px-6";
|
|
2480
3277
|
const variantClasses = VARIANT_CLASSES5[variant];
|
|
2481
|
-
return /* @__PURE__ */ (0,
|
|
3278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2482
3279
|
"ul",
|
|
2483
3280
|
{
|
|
2484
3281
|
ref,
|
|
@@ -2495,7 +3292,7 @@ var Menu = (0, import_react11.forwardRef)(
|
|
|
2495
3292
|
}
|
|
2496
3293
|
);
|
|
2497
3294
|
Menu.displayName = "Menu";
|
|
2498
|
-
var MenuItem = (0,
|
|
3295
|
+
var MenuItem = (0, import_react12.forwardRef)(
|
|
2499
3296
|
({
|
|
2500
3297
|
className,
|
|
2501
3298
|
children,
|
|
@@ -2523,7 +3320,7 @@ var MenuItem = (0, import_react11.forwardRef)(
|
|
|
2523
3320
|
...props
|
|
2524
3321
|
};
|
|
2525
3322
|
const variants = {
|
|
2526
|
-
menu: /* @__PURE__ */ (0,
|
|
3323
|
+
menu: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2527
3324
|
"li",
|
|
2528
3325
|
{
|
|
2529
3326
|
"data-variant": "menu",
|
|
@@ -2538,7 +3335,7 @@ var MenuItem = (0, import_react11.forwardRef)(
|
|
|
2538
3335
|
children
|
|
2539
3336
|
}
|
|
2540
3337
|
),
|
|
2541
|
-
menu2: /* @__PURE__ */ (0,
|
|
3338
|
+
menu2: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2542
3339
|
"li",
|
|
2543
3340
|
{
|
|
2544
3341
|
"data-variant": "menu2",
|
|
@@ -2550,7 +3347,7 @@ var MenuItem = (0, import_react11.forwardRef)(
|
|
|
2550
3347
|
children
|
|
2551
3348
|
}
|
|
2552
3349
|
),
|
|
2553
|
-
breadcrumb: /* @__PURE__ */ (0,
|
|
3350
|
+
breadcrumb: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2554
3351
|
"li",
|
|
2555
3352
|
{
|
|
2556
3353
|
"data-variant": "breadcrumb",
|
|
@@ -2561,7 +3358,7 @@ var MenuItem = (0, import_react11.forwardRef)(
|
|
|
2561
3358
|
${className ?? ""}
|
|
2562
3359
|
`,
|
|
2563
3360
|
...commonProps,
|
|
2564
|
-
children: /* @__PURE__ */ (0,
|
|
3361
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2565
3362
|
"span",
|
|
2566
3363
|
{
|
|
2567
3364
|
className: `
|
|
@@ -2578,24 +3375,24 @@ var MenuItem = (0, import_react11.forwardRef)(
|
|
|
2578
3375
|
}
|
|
2579
3376
|
);
|
|
2580
3377
|
MenuItem.displayName = "MenuItem";
|
|
2581
|
-
var MenuSeparator = (0,
|
|
2582
|
-
({ className, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3378
|
+
var MenuSeparator = (0, import_react12.forwardRef)(
|
|
3379
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2583
3380
|
"li",
|
|
2584
3381
|
{
|
|
2585
3382
|
ref,
|
|
2586
3383
|
"aria-hidden": "true",
|
|
2587
3384
|
className: `[&>svg]:w-4 [&>svg]:h-4 text-text-600 ${className ?? ""}`,
|
|
2588
3385
|
...props,
|
|
2589
|
-
children: children ?? /* @__PURE__ */ (0,
|
|
3386
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_phosphor_react9.CaretRight, {})
|
|
2590
3387
|
}
|
|
2591
3388
|
)
|
|
2592
3389
|
);
|
|
2593
3390
|
MenuSeparator.displayName = "MenuSeparator";
|
|
2594
|
-
var injectStore3 = (children, store) =>
|
|
2595
|
-
if (!(0,
|
|
3391
|
+
var injectStore3 = (children, store) => import_react12.Children.map(children, (child) => {
|
|
3392
|
+
if (!(0, import_react12.isValidElement)(child)) return child;
|
|
2596
3393
|
const typedChild = child;
|
|
2597
3394
|
const shouldInject = typedChild.type === MenuItem;
|
|
2598
|
-
return (0,
|
|
3395
|
+
return (0, import_react12.cloneElement)(typedChild, {
|
|
2599
3396
|
...shouldInject ? { store } : {},
|
|
2600
3397
|
...typedChild.props.children ? { children: injectStore3(typedChild.props.children, store) } : {}
|
|
2601
3398
|
});
|
|
@@ -2606,6 +3403,7 @@ var Menu_default = Menu;
|
|
|
2606
3403
|
Alert,
|
|
2607
3404
|
Badge,
|
|
2608
3405
|
Button,
|
|
3406
|
+
Calendar,
|
|
2609
3407
|
CheckBox,
|
|
2610
3408
|
Chips,
|
|
2611
3409
|
Divider,
|