analytica-frontend-lib 1.0.35 → 1.0.36

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
@@ -40,6 +40,7 @@ __export(src_exports, {
40
40
  ProfileMenuHeader: () => ProfileMenuHeader,
41
41
  ProfileMenuSection: () => ProfileMenuSection,
42
42
  ProfileMenuTrigger: () => ProfileMenuTrigger,
43
+ ProgressBar: () => ProgressBar_default,
43
44
  Radio: () => Radio_default,
44
45
  Select: () => Select_default,
45
46
  SelectContent: () => SelectContent,
@@ -1500,11 +1501,153 @@ var Chips = ({
1500
1501
  };
1501
1502
  var Chips_default = Chips;
1502
1503
 
1504
+ // src/components/ProgressBar/ProgressBar.tsx
1505
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1506
+ var SIZE_CLASSES7 = {
1507
+ small: {
1508
+ container: "h-1",
1509
+ // 4px height (h-1 = 4px in Tailwind)
1510
+ bar: "h-1",
1511
+ // 4px height for the fill bar
1512
+ labelSize: "xs",
1513
+ spacing: "gap-2",
1514
+ // 8px gap between label and progress bar
1515
+ layout: "flex-col",
1516
+ // vertical layout for small
1517
+ borderRadius: "rounded-full"
1518
+ // 9999px border radius
1519
+ },
1520
+ medium: {
1521
+ container: "h-2",
1522
+ // 8px height (h-2 = 8px in Tailwind)
1523
+ bar: "h-2",
1524
+ // 8px height for the fill bar
1525
+ labelSize: "xs",
1526
+ // 12px font size (xs in Tailwind)
1527
+ spacing: "gap-2",
1528
+ // 8px gap between progress bar and label
1529
+ layout: "flex-row items-center",
1530
+ // horizontal layout for medium
1531
+ borderRadius: "rounded-lg"
1532
+ // 8px border radius
1533
+ }
1534
+ };
1535
+ var VARIANT_CLASSES2 = {
1536
+ blue: {
1537
+ background: "bg-background-300",
1538
+ // Background track color (#D5D4D4)
1539
+ fill: "bg-primary-700"
1540
+ // Blue for activity progress (#2271C4)
1541
+ },
1542
+ green: {
1543
+ background: "bg-background-300",
1544
+ // Background track color (#D5D4D4)
1545
+ fill: "bg-success-200"
1546
+ // Green for performance (#84D3A2)
1547
+ }
1548
+ };
1549
+ var ProgressBar = ({
1550
+ value,
1551
+ max = 100,
1552
+ size = "medium",
1553
+ variant = "blue",
1554
+ label,
1555
+ showPercentage = false,
1556
+ className = "",
1557
+ labelClassName = "",
1558
+ percentageClassName = ""
1559
+ }) => {
1560
+ const safeValue = isNaN(value) ? 0 : value;
1561
+ const clampedValue = Math.max(0, Math.min(safeValue, max));
1562
+ const percentage = max === 0 ? 0 : clampedValue / max * 100;
1563
+ const sizeClasses = SIZE_CLASSES7[size];
1564
+ const variantClasses = VARIANT_CLASSES2[variant];
1565
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1566
+ "div",
1567
+ {
1568
+ className: `flex ${sizeClasses.layout} ${sizeClasses.spacing} ${className}`,
1569
+ children: [
1570
+ size === "small" && (label || showPercentage) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-row items-center justify-between w-full", children: [
1571
+ label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1572
+ Text_default,
1573
+ {
1574
+ as: "div",
1575
+ size: sizeClasses.labelSize,
1576
+ weight: "medium",
1577
+ className: `text-text-950 ${labelClassName}`,
1578
+ children: label
1579
+ }
1580
+ ),
1581
+ showPercentage && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1582
+ Text_default,
1583
+ {
1584
+ size: sizeClasses.labelSize,
1585
+ weight: "medium",
1586
+ className: `text-text-700 text-center ${percentageClassName}`,
1587
+ children: [
1588
+ Math.round(percentage),
1589
+ "%"
1590
+ ]
1591
+ }
1592
+ )
1593
+ ] }),
1594
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1595
+ "div",
1596
+ {
1597
+ className: `${size === "medium" ? "flex-grow" : "w-full"} ${sizeClasses.container} ${variantClasses.background} ${sizeClasses.borderRadius} overflow-hidden relative`,
1598
+ children: [
1599
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1600
+ "progress",
1601
+ {
1602
+ value: clampedValue,
1603
+ max,
1604
+ "aria-label": typeof label === "string" ? label : "Progress",
1605
+ className: "absolute inset-0 w-full h-full opacity-0"
1606
+ }
1607
+ ),
1608
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1609
+ "div",
1610
+ {
1611
+ className: `${sizeClasses.bar} ${variantClasses.fill} ${sizeClasses.borderRadius} transition-all duration-300 ease-out shadow-hard-shadow-3`,
1612
+ style: { width: `${percentage}%` }
1613
+ }
1614
+ )
1615
+ ]
1616
+ }
1617
+ ),
1618
+ size === "medium" && showPercentage && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1619
+ Text_default,
1620
+ {
1621
+ size: sizeClasses.labelSize,
1622
+ weight: "medium",
1623
+ className: `text-text-950 text-center flex-none w-[70px] ${percentageClassName}`,
1624
+ children: [
1625
+ Math.round(percentage),
1626
+ "%"
1627
+ ]
1628
+ }
1629
+ ),
1630
+ size === "medium" && label && !showPercentage && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1631
+ Text_default,
1632
+ {
1633
+ as: "div",
1634
+ size: sizeClasses.labelSize,
1635
+ weight: "medium",
1636
+ className: `text-text-950 flex-none ${labelClassName}`,
1637
+ children: label
1638
+ }
1639
+ )
1640
+ ]
1641
+ }
1642
+ );
1643
+ };
1644
+ var ProgressBar_default = ProgressBar;
1645
+
1503
1646
  // src/components/DropdownMenu/DropdownMenu.tsx
1504
1647
  var import_phosphor_react7 = require("phosphor-react");
1505
1648
  var import_react9 = require("react");
1506
1649
  var import_zustand2 = require("zustand");
1507
- var import_jsx_runtime18 = require("react/jsx-runtime");
1650
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1508
1651
  function createDropdownStore() {
1509
1652
  return (0, import_zustand2.create)((set) => ({
1510
1653
  open: false,
@@ -1595,13 +1738,13 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
1595
1738
  store.setState({ open });
1596
1739
  }
1597
1740
  }, []);
1598
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
1741
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
1599
1742
  };
1600
1743
  var DropdownMenuTrigger = (0, import_react9.forwardRef)(({ className, children, onClick, store: externalStore, ...props }, ref) => {
1601
1744
  const store = useDropdownStore(externalStore);
1602
1745
  const open = (0, import_zustand2.useStore)(store, (s) => s.open);
1603
1746
  const toggleOpen = () => store.setState({ open: !open });
1604
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1747
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1605
1748
  "button",
1606
1749
  {
1607
1750
  ref,
@@ -1634,7 +1777,7 @@ var ALIGN_CLASSES = {
1634
1777
  end: "right-0"
1635
1778
  };
1636
1779
  var MenuLabel = (0, import_react9.forwardRef)(({ className, inset, store: _store, ...props }, ref) => {
1637
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1780
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1638
1781
  "div",
1639
1782
  {
1640
1783
  ref,
@@ -1671,7 +1814,7 @@ var MenuContent = (0, import_react9.forwardRef)(
1671
1814
  const horizontal = ALIGN_CLASSES[align];
1672
1815
  return `absolute ${vertical} ${horizontal}`;
1673
1816
  };
1674
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1817
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1675
1818
  "div",
1676
1819
  {
1677
1820
  ref,
@@ -1729,7 +1872,7 @@ var MenuItem = (0, import_react9.forwardRef)(
1729
1872
  const getVariantProps = () => {
1730
1873
  return variant === "profile" ? { "data-variant": "profile" } : {};
1731
1874
  };
1732
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1875
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1733
1876
  "div",
1734
1877
  {
1735
1878
  ref,
@@ -1759,7 +1902,7 @@ var MenuItem = (0, import_react9.forwardRef)(
1759
1902
  }
1760
1903
  );
1761
1904
  MenuItem.displayName = "MenuItem";
1762
- var MenuSeparator = (0, import_react9.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1905
+ var MenuSeparator = (0, import_react9.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1763
1906
  "div",
1764
1907
  {
1765
1908
  ref,
@@ -1772,7 +1915,7 @@ var ProfileMenuTrigger = (0, import_react9.forwardRef)(({ className, onClick, st
1772
1915
  const store = useDropdownStore(externalStore);
1773
1916
  const open = (0, import_zustand2.useStore)(store, (s) => s.open);
1774
1917
  const toggleOpen = () => store.setState({ open: !open });
1775
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1918
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1776
1919
  "button",
1777
1920
  {
1778
1921
  ref,
@@ -1784,13 +1927,13 @@ var ProfileMenuTrigger = (0, import_react9.forwardRef)(({ className, onClick, st
1784
1927
  },
1785
1928
  "aria-expanded": open,
1786
1929
  ...props,
1787
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "size-6 rounded-full bg-background-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.User, { className: "text-background-950", size: 18 }) })
1930
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "size-6 rounded-full bg-background-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_phosphor_react7.User, { className: "text-background-950", size: 18 }) })
1788
1931
  }
1789
1932
  );
1790
1933
  });
1791
1934
  ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
1792
1935
  var ProfileMenuHeader = (0, import_react9.forwardRef)(({ className, name, email, store: _store, ...props }, ref) => {
1793
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1936
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1794
1937
  "div",
1795
1938
  {
1796
1939
  ref,
@@ -1801,10 +1944,10 @@ var ProfileMenuHeader = (0, import_react9.forwardRef)(({ className, name, email,
1801
1944
  `,
1802
1945
  ...props,
1803
1946
  children: [
1804
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "size-16 bg-background-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.User, { size: 34, className: "text-background-950" }) }),
1805
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col ", children: [
1806
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-xl font-bold text-text-950", children: name }),
1807
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-md text-text-600", children: email })
1947
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "size-16 bg-background-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_phosphor_react7.User, { size: 34, className: "text-background-950" }) }),
1948
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col ", children: [
1949
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xl font-bold text-text-950", children: name }),
1950
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-md text-text-600", children: email })
1808
1951
  ] })
1809
1952
  ]
1810
1953
  }
@@ -1812,7 +1955,7 @@ var ProfileMenuHeader = (0, import_react9.forwardRef)(({ className, name, email,
1812
1955
  });
1813
1956
  ProfileMenuHeader.displayName = "ProfileMenuHeader";
1814
1957
  var ProfileMenuSection = (0, import_react9.forwardRef)(({ className, children, store: _store, ...props }, ref) => {
1815
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1958
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1816
1959
  "div",
1817
1960
  {
1818
1961
  ref,
@@ -1830,7 +1973,7 @@ var ProfileMenuFooter = (0, import_react9.forwardRef)(
1830
1973
  ({ className, disabled = false, onClick, store: externalStore, ...props }, ref) => {
1831
1974
  const store = useDropdownStore(externalStore);
1832
1975
  const setOpen = (0, import_zustand2.useStore)(store, (s) => s.setOpen);
1833
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1976
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1834
1977
  "button",
1835
1978
  {
1836
1979
  ref,
@@ -1842,8 +1985,8 @@ var ProfileMenuFooter = (0, import_react9.forwardRef)(
1842
1985
  },
1843
1986
  ...props,
1844
1987
  children: [
1845
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_phosphor_react7.SignOut, {}) }),
1846
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Sair" })
1988
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_phosphor_react7.SignOut, {}) }),
1989
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Sair" })
1847
1990
  ]
1848
1991
  }
1849
1992
  );
@@ -1856,13 +1999,13 @@ var DropdownMenu_default = DropdownMenu;
1856
1999
  var import_zustand3 = require("zustand");
1857
2000
  var import_react10 = require("react");
1858
2001
  var import_phosphor_react8 = require("phosphor-react");
1859
- var import_jsx_runtime19 = require("react/jsx-runtime");
1860
- var VARIANT_CLASSES2 = {
2002
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2003
+ var VARIANT_CLASSES3 = {
1861
2004
  outlined: "border-2 rounded-sm focus:border-primary-950",
1862
2005
  underlined: "border-b-2 focus:border-primary-950",
1863
2006
  rounded: "border-2 rounded-4xl focus:border-primary-950"
1864
2007
  };
1865
- var SIZE_CLASSES7 = {
2008
+ var SIZE_CLASSES8 = {
1866
2009
  small: "text-sm",
1867
2010
  medium: "text-md",
1868
2011
  large: "text-lg"
@@ -1902,7 +2045,7 @@ function getLabelAsNode(children) {
1902
2045
  }
1903
2046
  const flattened = import_react10.Children.toArray(children);
1904
2047
  if (flattened.length === 1) return flattened[0];
1905
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: flattened });
2048
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: flattened });
1906
2049
  }
1907
2050
  var injectStore2 = (children, store) => {
1908
2051
  return import_react10.Children.map(children, (child) => {
@@ -2000,8 +2143,8 @@ var Select = ({
2000
2143
  onValueChange(value);
2001
2144
  }
2002
2145
  }, [value]);
2003
- const sizeClasses = SIZE_CLASSES7[size];
2004
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: `relative ${sizeClasses} w-[288px]`, ref: selectRef, children: injectStore2(children, store) });
2146
+ const sizeClasses = SIZE_CLASSES8[size];
2147
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: `relative ${sizeClasses} w-[288px]`, ref: selectRef, children: injectStore2(children, store) });
2005
2148
  };
2006
2149
  var SelectValue = ({
2007
2150
  placeholder,
@@ -2010,7 +2153,7 @@ var SelectValue = ({
2010
2153
  const store = useSelectStore(externalStore);
2011
2154
  const selectedLabel = (0, import_zustand3.useStore)(store, (s) => s.selectedLabel);
2012
2155
  const value = (0, import_zustand3.useStore)(store, (s) => s.value);
2013
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-inherit", children: selectedLabel || placeholder || value });
2156
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-inherit", children: selectedLabel || placeholder || value });
2014
2157
  };
2015
2158
  var SelectTrigger = (0, import_react10.forwardRef)(
2016
2159
  ({
@@ -2024,8 +2167,8 @@ var SelectTrigger = (0, import_react10.forwardRef)(
2024
2167
  const store = useSelectStore(externalStore);
2025
2168
  const open = (0, import_zustand3.useStore)(store, (s) => s.open);
2026
2169
  const toggleOpen = () => store.setState({ open: !open });
2027
- const variantClasses = VARIANT_CLASSES2[variant];
2028
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2170
+ const variantClasses = VARIANT_CLASSES3[variant];
2171
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2029
2172
  "button",
2030
2173
  {
2031
2174
  ref,
@@ -2043,7 +2186,7 @@ var SelectTrigger = (0, import_react10.forwardRef)(
2043
2186
  ...props,
2044
2187
  children: [
2045
2188
  props.children,
2046
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2189
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2047
2190
  import_phosphor_react8.CaretDown,
2048
2191
  {
2049
2192
  className: `h-[1em] w-[1em] opacity-50 transition-transform ${open ? "rotate-180" : ""}`
@@ -2068,7 +2211,7 @@ var SelectContent = (0, import_react10.forwardRef)(
2068
2211
  const open = (0, import_zustand3.useStore)(store, (s) => s.open);
2069
2212
  if (!open) return null;
2070
2213
  const getPositionClasses = () => `absolute ${SIDE_CLASSES2[side]} ${ALIGN_CLASSES2[align]}`;
2071
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2214
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2072
2215
  "div",
2073
2216
  {
2074
2217
  role: "menu",
@@ -2102,7 +2245,7 @@ var SelectItem = (0, import_react10.forwardRef)(
2102
2245
  }
2103
2246
  props.onClick?.(e);
2104
2247
  };
2105
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2248
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2106
2249
  "div",
2107
2250
  {
2108
2251
  role: "menuitem",
@@ -2122,7 +2265,7 @@ var SelectItem = (0, import_react10.forwardRef)(
2122
2265
  tabIndex: disabled ? -1 : 0,
2123
2266
  ...props,
2124
2267
  children: [
2125
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: selectedValue === value && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_phosphor_react8.Check, { className: "" }) }),
2268
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: selectedValue === value && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_phosphor_react8.Check, { className: "" }) }),
2126
2269
  children
2127
2270
  ]
2128
2271
  }
@@ -2153,6 +2296,7 @@ var Select_default = Select;
2153
2296
  ProfileMenuHeader,
2154
2297
  ProfileMenuSection,
2155
2298
  ProfileMenuTrigger,
2299
+ ProgressBar,
2156
2300
  Radio,
2157
2301
  Select,
2158
2302
  SelectContent,