@tutti-os/ui-system 0.0.3 → 0.0.4

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.
@@ -15,7 +15,7 @@ import {
15
15
  SuccessFilledIcon,
16
16
  WarningFilledIcon,
17
17
  WarningLinedIcon
18
- } from "./chunk-7Z4754GM.js";
18
+ } from "./chunk-FVHI3UMS.js";
19
19
  import {
20
20
  cn
21
21
  } from "./chunk-DGPY4WP3.js";
@@ -1603,11 +1603,18 @@ function ResizableHandle({
1603
1603
 
1604
1604
  // src/components/scroll-area/scroll-area.tsx
1605
1605
  import * as React4 from "react";
1606
- import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
1607
1606
  import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
1607
+ var MIN_THUMB_SIZE_PX = 24;
1608
1608
  function ScrollArea({
1609
1609
  className,
1610
1610
  children,
1611
+ onBlur,
1612
+ onFocus,
1613
+ onMouseEnter,
1614
+ onMouseLeave,
1615
+ scrollbarMode = "custom",
1616
+ scrollHideDelay: _scrollHideDelay,
1617
+ type,
1611
1618
  viewportClassName,
1612
1619
  viewportContentStyle,
1613
1620
  viewportProps,
@@ -1615,103 +1622,546 @@ function ScrollArea({
1615
1622
  viewportTestId,
1616
1623
  ...props
1617
1624
  }) {
1625
+ const implementationProps = {
1626
+ className,
1627
+ onBlur,
1628
+ onFocus,
1629
+ onMouseEnter,
1630
+ onMouseLeave,
1631
+ scrollbarMode,
1632
+ type,
1633
+ viewportClassName,
1634
+ viewportContentStyle,
1635
+ viewportProps,
1636
+ viewportRef,
1637
+ viewportTestId,
1638
+ ...props
1639
+ };
1640
+ if (scrollbarMode === "native") {
1641
+ return /* @__PURE__ */ jsx16(NativeScrollArea, { ...implementationProps, children });
1642
+ }
1643
+ return /* @__PURE__ */ jsx16(CustomScrollArea, { ...implementationProps, children });
1644
+ }
1645
+ function NativeScrollArea({
1646
+ className,
1647
+ children,
1648
+ onBlur,
1649
+ onFocus,
1650
+ onMouseEnter,
1651
+ onMouseLeave,
1652
+ scrollbarMode,
1653
+ type,
1654
+ viewportClassName,
1655
+ viewportContentStyle,
1656
+ viewportProps,
1657
+ viewportRef,
1658
+ viewportTestId,
1659
+ ...props
1660
+ }) {
1661
+ const alwaysVisible = type === "always" || type === "scroll" || hasAlwaysVisibleScrollbarSelector(className);
1662
+ return /* @__PURE__ */ jsx16(
1663
+ ScrollAreaFrame,
1664
+ {
1665
+ ...props,
1666
+ className,
1667
+ "data-scrollbar-mode": scrollbarMode,
1668
+ onBlur,
1669
+ onFocus,
1670
+ onMouseEnter,
1671
+ onMouseLeave,
1672
+ alwaysVisible: false,
1673
+ viewportClassName: cn(
1674
+ nativeScrollbarClassName(alwaysVisible),
1675
+ viewportClassName
1676
+ ),
1677
+ viewportContentStyle,
1678
+ viewportProps,
1679
+ viewportRef,
1680
+ viewportTestId,
1681
+ children
1682
+ }
1683
+ );
1684
+ }
1685
+ function CustomScrollArea({
1686
+ className,
1687
+ children,
1688
+ onBlur,
1689
+ onFocus,
1690
+ onMouseEnter,
1691
+ onMouseLeave,
1692
+ scrollbarMode,
1693
+ type,
1694
+ viewportClassName,
1695
+ viewportContentStyle,
1696
+ viewportProps,
1697
+ viewportRef,
1698
+ viewportTestId,
1699
+ ...props
1700
+ }) {
1701
+ const localViewportRef = React4.useRef(null);
1702
+ const contentRef = React4.useRef(null);
1703
+ const [active, setActive] = React4.useState(false);
1704
+ const alwaysVisible = type === "always" || type === "scroll" || hasAlwaysVisibleScrollbarSelector(className);
1618
1705
  return /* @__PURE__ */ jsxs7(
1619
- ScrollAreaPrimitive.Root,
1706
+ ScrollAreaFrame,
1620
1707
  {
1621
- "data-slot": "scroll-area",
1622
- className: cn("group/scroll-area relative", className),
1623
1708
  ...props,
1709
+ className,
1710
+ contentRef,
1711
+ "data-scrollbar-mode": scrollbarMode,
1712
+ onBlur: (event) => {
1713
+ onBlur?.(event);
1714
+ if (!event.currentTarget.contains(event.relatedTarget)) {
1715
+ setActive(false);
1716
+ }
1717
+ },
1718
+ onFocus: (event) => {
1719
+ onFocus?.(event);
1720
+ setActive(true);
1721
+ },
1722
+ onMouseEnter: (event) => {
1723
+ onMouseEnter?.(event);
1724
+ setActive(true);
1725
+ },
1726
+ onMouseLeave: (event) => {
1727
+ onMouseLeave?.(event);
1728
+ setActive(false);
1729
+ },
1730
+ alwaysVisible,
1731
+ viewportClassName: cn(
1732
+ "[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
1733
+ viewportClassName
1734
+ ),
1735
+ viewportContentStyle,
1736
+ viewportProps,
1737
+ viewportRef: setRefs(localViewportRef, viewportRef),
1738
+ viewportTestId,
1624
1739
  children: [
1625
- /* @__PURE__ */ jsxs7(
1626
- ScrollAreaPrimitive.Viewport,
1740
+ children,
1741
+ /* @__PURE__ */ jsx16(
1742
+ ScrollAreaScrollbar,
1627
1743
  {
1628
- ...viewportProps,
1629
- "data-slot": "scroll-area-viewport",
1630
- "data-testid": viewportTestId,
1631
- ref: viewportRef,
1632
- className: cn(
1633
- "size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",
1634
- viewportClassName
1635
- ),
1636
- children: [
1637
- viewportContentStyle ? /* @__PURE__ */ jsx16(ScrollAreaViewportContentStyleBridge, { style: viewportContentStyle }) : null,
1638
- children
1639
- ]
1744
+ active: active || alwaysVisible,
1745
+ contentRef,
1746
+ orientation: "vertical",
1747
+ viewportRef: localViewportRef
1640
1748
  }
1641
- ),
1642
- /* @__PURE__ */ jsx16(ScrollBar, {}),
1643
- /* @__PURE__ */ jsx16(ScrollAreaPrimitive.Corner, {})
1749
+ )
1644
1750
  ]
1645
1751
  }
1646
1752
  );
1647
1753
  }
1648
- function ScrollAreaViewportContentStyleBridge({
1649
- style
1754
+ function ScrollAreaFrame({
1755
+ alwaysVisible,
1756
+ children,
1757
+ className,
1758
+ contentRef,
1759
+ viewportClassName,
1760
+ viewportContentStyle,
1761
+ viewportProps,
1762
+ viewportRef,
1763
+ viewportTestId,
1764
+ ...props
1650
1765
  }) {
1651
- const markerRef = React4.useRef(null);
1652
- React4.useLayoutEffect(() => {
1653
- const contentElement = markerRef.current?.parentElement;
1654
- if (!contentElement) {
1766
+ return /* @__PURE__ */ jsx16(
1767
+ "div",
1768
+ {
1769
+ "data-slot": "scroll-area",
1770
+ className: cn(
1771
+ "group/scroll-area relative",
1772
+ alwaysVisible ? "[&_[data-slot=scroll-area-scrollbar]]:opacity-100" : null,
1773
+ className
1774
+ ),
1775
+ ...props,
1776
+ children: /* @__PURE__ */ jsx16(
1777
+ "div",
1778
+ {
1779
+ ...viewportProps,
1780
+ "data-slot": "scroll-area-viewport",
1781
+ "data-testid": viewportTestId,
1782
+ ref: viewportRef,
1783
+ className: cn(
1784
+ "size-full overflow-auto rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",
1785
+ viewportClassName
1786
+ ),
1787
+ children: /* @__PURE__ */ jsx16(
1788
+ "div",
1789
+ {
1790
+ ref: contentRef,
1791
+ "data-slot": "scroll-area-content",
1792
+ style: {
1793
+ minWidth: "100%",
1794
+ display: "table",
1795
+ ...viewportContentStyle
1796
+ },
1797
+ children
1798
+ }
1799
+ )
1800
+ }
1801
+ )
1802
+ }
1803
+ );
1804
+ }
1805
+ function ScrollAreaScrollbar({
1806
+ active,
1807
+ contentRef,
1808
+ orientation,
1809
+ viewportRef
1810
+ }) {
1811
+ const trackRef = React4.useRef(null);
1812
+ const thumbRef = React4.useRef(null);
1813
+ const dragStateRef = React4.useRef(null);
1814
+ const frameRef = React4.useRef(null);
1815
+ const scrollableRef = React4.useRef(false);
1816
+ const [dragging, setDragging] = React4.useState(false);
1817
+ const [scrollable, setScrollable] = React4.useState(false);
1818
+ const [trackActive, setTrackActive] = React4.useState(false);
1819
+ const syncScrollbarState = React4.useCallback(() => {
1820
+ const viewport = viewportRef.current;
1821
+ const track = trackRef.current;
1822
+ const thumb = thumbRef.current;
1823
+ if (!viewport || !track || !thumb) {
1824
+ updateScrollable(false, scrollableRef, setScrollable);
1655
1825
  return;
1656
1826
  }
1657
- const previousValues = /* @__PURE__ */ new Map();
1658
- for (const [property, value] of Object.entries(style)) {
1659
- const cssProperty = toCssPropertyName(property);
1660
- previousValues.set(cssProperty, {
1661
- value: contentElement.style.getPropertyValue(cssProperty),
1662
- priority: contentElement.style.getPropertyPriority(cssProperty)
1663
- });
1664
- if (value === void 0 || value === null) {
1665
- contentElement.style.removeProperty(cssProperty);
1827
+ const viewportSize = orientation === "vertical" ? viewport.clientHeight : viewport.clientWidth;
1828
+ const scrollSize = orientation === "vertical" ? viewport.scrollHeight : viewport.scrollWidth;
1829
+ const scrollOffset = orientation === "vertical" ? viewport.scrollTop : viewport.scrollLeft;
1830
+ const trackSize = orientation === "vertical" ? track.clientHeight : track.clientWidth;
1831
+ const maxScrollOffset = Math.max(0, scrollSize - viewportSize);
1832
+ if (viewportSize <= 0 || trackSize <= 0 || maxScrollOffset <= 0) {
1833
+ updateScrollable(false, scrollableRef, setScrollable);
1834
+ return;
1835
+ }
1836
+ const thumbSize = Math.min(
1837
+ trackSize,
1838
+ Math.max(
1839
+ MIN_THUMB_SIZE_PX,
1840
+ Math.round(viewportSize / scrollSize * trackSize)
1841
+ )
1842
+ );
1843
+ const maxThumbOffset = Math.max(0, trackSize - thumbSize);
1844
+ const thumbOffset = Math.round(
1845
+ scrollOffset / maxScrollOffset * maxThumbOffset
1846
+ );
1847
+ if (orientation === "vertical") {
1848
+ thumb.style.height = `${thumbSize}px`;
1849
+ thumb.style.width = "";
1850
+ thumb.style.transform = `translateY(${thumbOffset}px)`;
1851
+ } else {
1852
+ thumb.style.width = `${thumbSize}px`;
1853
+ thumb.style.height = "";
1854
+ thumb.style.transform = `translateX(${thumbOffset}px)`;
1855
+ }
1856
+ updateScrollable(true, scrollableRef, setScrollable);
1857
+ }, [orientation, viewportRef]);
1858
+ const scheduleSync = React4.useCallback(() => {
1859
+ if (frameRef.current !== null) {
1860
+ return;
1861
+ }
1862
+ frameRef.current = requestAnimationFrameSafely(() => {
1863
+ frameRef.current = null;
1864
+ syncScrollbarState();
1865
+ });
1866
+ }, [syncScrollbarState]);
1867
+ const scrollViewportToThumbOffset = React4.useCallback(
1868
+ (thumbOffset) => {
1869
+ const viewport = viewportRef.current;
1870
+ const track = trackRef.current;
1871
+ const thumb = thumbRef.current;
1872
+ if (!viewport || !track || !thumb) {
1873
+ return;
1874
+ }
1875
+ const viewportSize = orientation === "vertical" ? viewport.clientHeight : viewport.clientWidth;
1876
+ const scrollSize = orientation === "vertical" ? viewport.scrollHeight : viewport.scrollWidth;
1877
+ const trackSize = orientation === "vertical" ? track.clientHeight : track.clientWidth;
1878
+ const thumbSize = orientation === "vertical" ? thumb.offsetHeight : thumb.offsetWidth;
1879
+ const maxScrollOffset = Math.max(0, scrollSize - viewportSize);
1880
+ const maxThumbOffset = Math.max(0, trackSize - thumbSize);
1881
+ if (maxScrollOffset <= 0 || maxThumbOffset <= 0) {
1882
+ return;
1883
+ }
1884
+ const nextScrollOffset = clamp(thumbOffset, 0, maxThumbOffset) / maxThumbOffset * maxScrollOffset;
1885
+ if (orientation === "vertical") {
1886
+ viewport.scrollTop = nextScrollOffset;
1666
1887
  } else {
1667
- contentElement.style.setProperty(cssProperty, String(value));
1888
+ viewport.scrollLeft = nextScrollOffset;
1889
+ }
1890
+ syncScrollbarState();
1891
+ },
1892
+ [orientation, syncScrollbarState, viewportRef]
1893
+ );
1894
+ const handleTrackPointerDown = React4.useCallback(
1895
+ (event) => {
1896
+ if (event.button !== 0 || !scrollableRef.current) {
1897
+ return;
1668
1898
  }
1899
+ const track = trackRef.current;
1900
+ const thumb = thumbRef.current;
1901
+ if (!track || !thumb || event.target === thumb) {
1902
+ return;
1903
+ }
1904
+ event.preventDefault();
1905
+ event.stopPropagation();
1906
+ const trackRect = track.getBoundingClientRect();
1907
+ const clientOffset = orientation === "vertical" ? event.clientY : event.clientX;
1908
+ const trackStart = orientation === "vertical" ? trackRect.top : trackRect.left;
1909
+ const thumbSize = orientation === "vertical" ? thumb.offsetHeight : thumb.offsetWidth;
1910
+ scrollViewportToThumbOffset(clientOffset - trackStart - thumbSize / 2);
1911
+ },
1912
+ [orientation, scrollViewportToThumbOffset]
1913
+ );
1914
+ const handleThumbPointerDown = React4.useCallback(
1915
+ (event) => {
1916
+ if (event.button !== 0 || !scrollableRef.current) {
1917
+ return;
1918
+ }
1919
+ const viewport = viewportRef.current;
1920
+ const track = trackRef.current;
1921
+ const thumb = thumbRef.current;
1922
+ if (!viewport || !track || !thumb) {
1923
+ return;
1924
+ }
1925
+ const viewportSize = orientation === "vertical" ? viewport.clientHeight : viewport.clientWidth;
1926
+ const scrollSize = orientation === "vertical" ? viewport.scrollHeight : viewport.scrollWidth;
1927
+ const trackSize = orientation === "vertical" ? track.clientHeight : track.clientWidth;
1928
+ const thumbSize = orientation === "vertical" ? thumb.offsetHeight : thumb.offsetWidth;
1929
+ const maxScrollOffset = Math.max(0, scrollSize - viewportSize);
1930
+ const maxThumbOffset = Math.max(0, trackSize - thumbSize);
1931
+ if (maxScrollOffset <= 0 || maxThumbOffset <= 0) {
1932
+ return;
1933
+ }
1934
+ event.preventDefault();
1935
+ event.stopPropagation();
1936
+ dragStateRef.current = {
1937
+ maxScrollOffset,
1938
+ maxThumbOffset,
1939
+ startClientOffset: orientation === "vertical" ? event.clientY : event.clientX,
1940
+ startScrollOffset: orientation === "vertical" ? viewport.scrollTop : viewport.scrollLeft
1941
+ };
1942
+ setDragging(true);
1943
+ },
1944
+ [orientation, viewportRef]
1945
+ );
1946
+ React4.useEffect(() => {
1947
+ if (!dragging) {
1948
+ return;
1669
1949
  }
1950
+ const handlePointerMove = (event) => {
1951
+ const dragState = dragStateRef.current;
1952
+ const viewport = viewportRef.current;
1953
+ if (!dragState || !viewport) {
1954
+ return;
1955
+ }
1956
+ const clientOffset = orientation === "vertical" ? event.clientY : event.clientX;
1957
+ const nextThumbOffset = dragState.startScrollOffset / dragState.maxScrollOffset * dragState.maxThumbOffset + (clientOffset - dragState.startClientOffset);
1958
+ const nextScrollOffset = clamp(nextThumbOffset, 0, dragState.maxThumbOffset) / dragState.maxThumbOffset * dragState.maxScrollOffset;
1959
+ if (orientation === "vertical") {
1960
+ viewport.scrollTop = nextScrollOffset;
1961
+ } else {
1962
+ viewport.scrollLeft = nextScrollOffset;
1963
+ }
1964
+ syncScrollbarState();
1965
+ };
1966
+ const handlePointerUp = () => {
1967
+ dragStateRef.current = null;
1968
+ setDragging(false);
1969
+ };
1970
+ window.addEventListener("pointermove", handlePointerMove);
1971
+ window.addEventListener("pointerup", handlePointerUp);
1670
1972
  return () => {
1671
- for (const [cssProperty, previous] of previousValues) {
1672
- if (previous.value) {
1673
- contentElement.style.setProperty(
1674
- cssProperty,
1675
- previous.value,
1676
- previous.priority
1677
- );
1678
- } else {
1679
- contentElement.style.removeProperty(cssProperty);
1680
- }
1973
+ window.removeEventListener("pointermove", handlePointerMove);
1974
+ window.removeEventListener("pointerup", handlePointerUp);
1975
+ };
1976
+ }, [dragging, orientation, syncScrollbarState, viewportRef]);
1977
+ React4.useEffect(() => {
1978
+ const viewport = viewportRef.current;
1979
+ if (!viewport) {
1980
+ updateScrollable(false, scrollableRef, setScrollable);
1981
+ return;
1982
+ }
1983
+ syncScrollbarState();
1984
+ viewport.addEventListener("scroll", scheduleSync, { passive: true });
1985
+ const resizeObserver = typeof ResizeObserver !== "undefined" ? new ResizeObserver(scheduleSync) : null;
1986
+ resizeObserver?.observe(viewport);
1987
+ if (contentRef.current) {
1988
+ resizeObserver?.observe(contentRef.current);
1989
+ }
1990
+ return () => {
1991
+ if (frameRef.current !== null) {
1992
+ cancelAnimationFrameSafely(frameRef.current);
1993
+ frameRef.current = null;
1681
1994
  }
1995
+ viewport.removeEventListener("scroll", scheduleSync);
1996
+ resizeObserver?.disconnect();
1682
1997
  };
1683
- }, [style]);
1684
- return /* @__PURE__ */ jsx16("span", { ref: markerRef, "data-slot": "scroll-area-content-style-bridge", hidden: true });
1685
- }
1686
- function toCssPropertyName(property) {
1687
- return property.startsWith("--") ? property : property.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
1998
+ }, [contentRef, scheduleSync, syncScrollbarState, viewportRef]);
1999
+ React4.useEffect(() => {
2000
+ scheduleSync();
2001
+ });
2002
+ return /* @__PURE__ */ jsx16(
2003
+ "div",
2004
+ {
2005
+ ref: trackRef,
2006
+ "data-dragging": dragging ? "true" : "false",
2007
+ "data-orientation": orientation,
2008
+ "data-scrollable": scrollable ? "true" : "false",
2009
+ "data-slot": "scroll-area-scrollbar",
2010
+ "aria-hidden": "true",
2011
+ className: scrollbarClassName(orientation),
2012
+ style: scrollbarStyle({
2013
+ active: active || dragging,
2014
+ orientation,
2015
+ scrollable
2016
+ }),
2017
+ onPointerEnter: () => setTrackActive(true),
2018
+ onPointerLeave: () => setTrackActive(false),
2019
+ onPointerDown: handleTrackPointerDown,
2020
+ children: /* @__PURE__ */ jsx16(
2021
+ "div",
2022
+ {
2023
+ ref: thumbRef,
2024
+ "data-slot": "scroll-area-thumb",
2025
+ className: thumbClassName(orientation),
2026
+ style: thumbStyle({ active: trackActive || dragging, orientation }),
2027
+ onPointerDown: handleThumbPointerDown
2028
+ }
2029
+ )
2030
+ }
2031
+ );
1688
2032
  }
1689
2033
  function ScrollBar({
1690
2034
  className,
2035
+ forceMount: _forceMount,
1691
2036
  orientation = "vertical",
1692
2037
  ...props
1693
2038
  }) {
1694
2039
  return /* @__PURE__ */ jsx16(
1695
- ScrollAreaPrimitive.ScrollAreaScrollbar,
2040
+ "div",
1696
2041
  {
1697
2042
  "data-slot": "scroll-area-scrollbar",
1698
2043
  "data-orientation": orientation,
1699
- orientation,
1700
- className: cn(
1701
- "group/scrollbar absolute z-10 flex touch-none p-[2px] opacity-0 transition-opacity duration-150 select-none group-hover/scroll-area:opacity-100 group-focus-within/scroll-area:opacity-100 data-[orientation=horizontal]:right-0 data-[orientation=horizontal]:bottom-0 data-[orientation=horizontal]:left-0 data-[orientation=horizontal]:h-2 data-[orientation=horizontal]:flex-col data-[orientation=vertical]:top-0 data-[orientation=vertical]:right-0 data-[orientation=vertical]:bottom-0 data-[orientation=vertical]:w-2",
1702
- className
1703
- ),
2044
+ className: cn(scrollbarClassName(orientation), className),
2045
+ style: scrollbarStyle({ active: false, orientation, scrollable: true }),
1704
2046
  ...props,
1705
2047
  children: /* @__PURE__ */ jsx16(
1706
- ScrollAreaPrimitive.ScrollAreaThumb,
2048
+ "div",
1707
2049
  {
1708
2050
  "data-slot": "scroll-area-thumb",
1709
- className: "relative flex-1 rounded-full bg-[var(--transparency-block)] transition-colors duration-150 group-hover/scrollbar:bg-[var(--transparency-hover)]"
2051
+ className: thumbClassName(orientation),
2052
+ style: thumbStyle({ active: false, orientation })
1710
2053
  }
1711
2054
  )
1712
2055
  }
1713
2056
  );
1714
2057
  }
2058
+ function scrollbarClassName(orientation) {
2059
+ return cn(
2060
+ orientation === "horizontal" ? "data-[orientation=horizontal]:h-2" : "data-[orientation=vertical]:w-2"
2061
+ );
2062
+ }
2063
+ function thumbClassName(orientation) {
2064
+ return cn(
2065
+ "rounded-full",
2066
+ orientation === "horizontal" ? "top-[2px] bottom-[2px]" : "right-[2px] left-[2px]"
2067
+ );
2068
+ }
2069
+ function nativeScrollbarClassName(alwaysVisible) {
2070
+ return cn(
2071
+ "[scrollbar-width:thin] [scrollbar-color:transparent_transparent]",
2072
+ "[&::-webkit-scrollbar]:block [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2",
2073
+ "[&::-webkit-scrollbar-corner]:bg-transparent [&::-webkit-scrollbar-track]:bg-transparent",
2074
+ "[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:border-2 [&::-webkit-scrollbar-thumb]:border-solid [&::-webkit-scrollbar-thumb]:border-transparent [&::-webkit-scrollbar-thumb]:bg-clip-content",
2075
+ alwaysVisible ? "[scrollbar-color:var(--transparency-block)_transparent] [&::-webkit-scrollbar-thumb]:bg-[var(--transparency-block)] hover:[&::-webkit-scrollbar-thumb]:bg-[var(--transparency-hover)]" : "hover:[scrollbar-color:var(--transparency-block)_transparent] focus-within:[scrollbar-color:var(--transparency-block)_transparent] hover:[&::-webkit-scrollbar-thumb]:bg-[var(--transparency-block)] focus-within:[&::-webkit-scrollbar-thumb]:bg-[var(--transparency-block)]"
2076
+ );
2077
+ }
2078
+ function scrollbarStyle({
2079
+ active,
2080
+ orientation,
2081
+ scrollable
2082
+ }) {
2083
+ return {
2084
+ position: "absolute",
2085
+ zIndex: 10,
2086
+ display: "flex",
2087
+ touchAction: "none",
2088
+ padding: 2,
2089
+ opacity: active && scrollable ? 1 : 0,
2090
+ pointerEvents: scrollable ? "auto" : "none",
2091
+ userSelect: "none",
2092
+ transition: "opacity 150ms ease-in-out",
2093
+ cursor: "pointer",
2094
+ ...orientation === "horizontal" ? {
2095
+ right: 0,
2096
+ bottom: 0,
2097
+ left: 0,
2098
+ height: 8,
2099
+ flexDirection: "column"
2100
+ } : {
2101
+ top: 0,
2102
+ right: 0,
2103
+ bottom: 0,
2104
+ width: 8
2105
+ }
2106
+ };
2107
+ }
2108
+ function thumbStyle({
2109
+ active,
2110
+ orientation
2111
+ }) {
2112
+ return {
2113
+ position: "absolute",
2114
+ minHeight: orientation === "vertical" ? MIN_THUMB_SIZE_PX : void 0,
2115
+ minWidth: orientation === "horizontal" ? MIN_THUMB_SIZE_PX : void 0,
2116
+ borderRadius: 999,
2117
+ background: active ? "var(--transparency-hover)" : "var(--transparency-block)",
2118
+ cursor: active ? "grabbing" : "grab",
2119
+ transition: "background-color 150ms ease-in-out",
2120
+ ...orientation === "horizontal" ? {
2121
+ top: 2,
2122
+ bottom: 2
2123
+ } : {
2124
+ right: 2,
2125
+ left: 2
2126
+ }
2127
+ };
2128
+ }
2129
+ function hasAlwaysVisibleScrollbarSelector(className) {
2130
+ return typeof className === "string" && className.includes("scroll-area-scrollbar") && className.includes("opacity-100");
2131
+ }
2132
+ function setRefs(localRef, forwardedRef) {
2133
+ return (node) => {
2134
+ localRef.current = node;
2135
+ if (typeof forwardedRef === "function") {
2136
+ forwardedRef(node);
2137
+ } else if (forwardedRef) {
2138
+ forwardedRef.current = node;
2139
+ }
2140
+ };
2141
+ }
2142
+ function updateScrollable(nextScrollable, scrollableRef, setScrollable) {
2143
+ if (scrollableRef.current === nextScrollable) {
2144
+ return;
2145
+ }
2146
+ scrollableRef.current = nextScrollable;
2147
+ setScrollable(nextScrollable);
2148
+ }
2149
+ function requestAnimationFrameSafely(callback) {
2150
+ if (typeof window.requestAnimationFrame === "function") {
2151
+ return window.requestAnimationFrame(callback);
2152
+ }
2153
+ return window.setTimeout(() => callback(performance.now()), 16);
2154
+ }
2155
+ function cancelAnimationFrameSafely(frameId) {
2156
+ if (typeof window.cancelAnimationFrame === "function") {
2157
+ window.cancelAnimationFrame(frameId);
2158
+ return;
2159
+ }
2160
+ window.clearTimeout(frameId);
2161
+ }
2162
+ function clamp(value, min, max) {
2163
+ return Math.min(max, Math.max(min, value));
2164
+ }
1715
2165
 
1716
2166
  // src/components/select/select.tsx
1717
2167
  import { Select as SelectPrimitive } from "radix-ui";
@@ -2472,7 +2922,7 @@ function TooltipContent({
2472
2922
  }
2473
2923
 
2474
2924
  // src/components/underline-tabs/underline-tabs.tsx
2475
- import { useEffect as useEffect3, useLayoutEffect as useLayoutEffect3, useRef as useRef3, useState as useState3 } from "react";
2925
+ import { useEffect as useEffect4, useLayoutEffect as useLayoutEffect2, useRef as useRef3, useState as useState4 } from "react";
2476
2926
  import { jsx as jsx28, jsxs as jsxs11 } from "react/jsx-runtime";
2477
2927
  function UnderlineTabs({
2478
2928
  tabs,
@@ -2491,12 +2941,12 @@ function UnderlineTabs({
2491
2941
  const viewportRef = useRef3(null);
2492
2942
  const rowRef = useRef3(null);
2493
2943
  const buttonRefs = useRef3({});
2494
- const [indicatorStyle, setIndicatorStyle] = useState3({ left: 0, width: 0 });
2495
- const [overflow, setOverflow] = useState3({
2944
+ const [indicatorStyle, setIndicatorStyle] = useState4({ left: 0, width: 0 });
2945
+ const [overflow, setOverflow] = useState4({
2496
2946
  canScrollLeft: false,
2497
2947
  canScrollRight: false
2498
2948
  });
2499
- useLayoutEffect3(() => {
2949
+ useLayoutEffect2(() => {
2500
2950
  const row = rowRef.current;
2501
2951
  const button = buttonRefs.current[value];
2502
2952
  if (!row || !button) {
@@ -2513,7 +2963,7 @@ function UnderlineTabs({
2513
2963
  (current) => current.left === nextStyle.left && current.width === nextStyle.width ? current : nextStyle
2514
2964
  );
2515
2965
  }, [tabs, value]);
2516
- useEffect3(() => {
2966
+ useEffect4(() => {
2517
2967
  const viewport = viewportRef.current;
2518
2968
  if (!viewport) {
2519
2969
  return;
@@ -2803,7 +3253,7 @@ var ViewportMenuSurface = React6.forwardRef(function ViewportMenuSurface2({
2803
3253
  }, forwardedRef) {
2804
3254
  const surfaceRef = React6.useRef(null);
2805
3255
  const [measuredSize, setMeasuredSize] = React6.useState(null);
2806
- const setRefs = React6.useCallback(
3256
+ const setRefs2 = React6.useCallback(
2807
3257
  (node) => {
2808
3258
  surfaceRef.current = node;
2809
3259
  assignRef(forwardedRef, node);
@@ -2940,7 +3390,7 @@ var ViewportMenuSurface = React6.forwardRef(function ViewportMenuSurface2({
2940
3390
  MenuSurface,
2941
3391
  {
2942
3392
  ...rest,
2943
- ref: setRefs,
3393
+ ref: setRefs2,
2944
3394
  className,
2945
3395
  "data-slot": "viewport-menu-surface",
2946
3396
  style: {
@@ -3078,4 +3528,4 @@ export {
3078
3528
  UnderlineTabs,
3079
3529
  ViewportMenuSurface
3080
3530
  };
3081
- //# sourceMappingURL=chunk-XXE3UZ55.js.map
3531
+ //# sourceMappingURL=chunk-HJ43LQHW.js.map