@sesionario/blocks 1.15.0 → 1.16.0

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.cjs CHANGED
@@ -1673,6 +1673,53 @@ function LanguageSwitcher({
1673
1673
  }
1674
1674
  );
1675
1675
  }
1676
+ var SCROLL_EDGE_EPSILON_PX = 1;
1677
+ function measureScrollEdges(el) {
1678
+ const { scrollLeft, scrollWidth, clientWidth } = el;
1679
+ return {
1680
+ canScrollLeft: scrollLeft > SCROLL_EDGE_EPSILON_PX,
1681
+ canScrollRight: scrollLeft + clientWidth < scrollWidth - SCROLL_EDGE_EPSILON_PX
1682
+ };
1683
+ }
1684
+ function useScrollFadeXEdges(enabled = true) {
1685
+ const scrollerRef = React7.useRef(null);
1686
+ const [edges, setEdges] = React7.useState({
1687
+ canScrollLeft: false,
1688
+ canScrollRight: false
1689
+ });
1690
+ React7.useEffect(() => {
1691
+ if (!enabled) {
1692
+ setEdges({ canScrollLeft: false, canScrollRight: false });
1693
+ return;
1694
+ }
1695
+ const el = scrollerRef.current;
1696
+ if (!el) return;
1697
+ function updateEdges() {
1698
+ const scroller = scrollerRef.current;
1699
+ if (!scroller) return;
1700
+ const next = measureScrollEdges(scroller);
1701
+ setEdges(
1702
+ (prev) => prev.canScrollLeft === next.canScrollLeft && prev.canScrollRight === next.canScrollRight ? prev : next
1703
+ );
1704
+ }
1705
+ updateEdges();
1706
+ el.addEventListener("scroll", updateEdges, { passive: true });
1707
+ const resizeObserver = new ResizeObserver(updateEdges);
1708
+ resizeObserver.observe(el);
1709
+ const mutationObserver = new MutationObserver(updateEdges);
1710
+ mutationObserver.observe(el, { childList: true, subtree: true });
1711
+ return () => {
1712
+ el.removeEventListener("scroll", updateEdges);
1713
+ resizeObserver.disconnect();
1714
+ mutationObserver.disconnect();
1715
+ };
1716
+ }, [enabled]);
1717
+ const fadeStyle = {
1718
+ "--scroll-fade-left": edges.canScrollLeft ? "transparent" : "#000",
1719
+ "--scroll-fade-right": edges.canScrollRight ? "transparent" : "#000"
1720
+ };
1721
+ return { scrollerRef, fadeStyle, edges };
1722
+ }
1676
1723
  function PlatformNavbar({
1677
1724
  logo,
1678
1725
  leading,
@@ -1681,6 +1728,8 @@ function PlatformNavbar({
1681
1728
  className,
1682
1729
  innerClassName
1683
1730
  }) {
1731
+ const hasCenter = center != null && center !== false;
1732
+ const { scrollerRef, fadeStyle } = useScrollFadeXEdges(hasCenter);
1684
1733
  return /* @__PURE__ */ jsxRuntime.jsx(
1685
1734
  "header",
1686
1735
  {
@@ -1699,7 +1748,15 @@ function PlatformNavbar({
1699
1748
  children: [
1700
1749
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 items-center gap-2", children: logo }),
1701
1750
  leading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 items-center gap-2", children: leading }) : null,
1702
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 flex-1 items-center overflow-x-auto", children: center }),
1751
+ /* @__PURE__ */ jsxRuntime.jsx(
1752
+ "div",
1753
+ {
1754
+ ref: scrollerRef,
1755
+ className: "flex min-w-0 flex-1 items-center overflow-x-auto scroll-fade-x-edges scrollbar-none",
1756
+ style: fadeStyle,
1757
+ children: center
1758
+ }
1759
+ ),
1703
1760
  right ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 items-center gap-2", children: right }) : null
1704
1761
  ]
1705
1762
  }
@@ -1871,6 +1928,11 @@ function PlatformAccountMenu({
1871
1928
  labels: labelsProp,
1872
1929
  onSignOut,
1873
1930
  extraItems,
1931
+ trigger: triggerProp,
1932
+ contentSide,
1933
+ contentAlign = "end",
1934
+ contentSideOffset,
1935
+ contentClassName,
1874
1936
  className
1875
1937
  }) {
1876
1938
  const labels = { ...defaultLabels3, ...labelsProp };
@@ -1900,7 +1962,7 @@ function PlatformAccountMenu({
1900
1962
  }
1901
1963
  );
1902
1964
  }
1903
- const trigger = user ? /* @__PURE__ */ jsxRuntime.jsx(
1965
+ const defaultTrigger = user ? /* @__PURE__ */ jsxRuntime.jsx(
1904
1966
  Button,
1905
1967
  {
1906
1968
  variant: "ghost",
@@ -1920,129 +1982,129 @@ function PlatformAccountMenu({
1920
1982
  }
1921
1983
  );
1922
1984
  return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
1923
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: trigger }),
1924
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuContent, { align: "end", className: "min-w-60 rounded-lg", children: user ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1925
- /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuLabel, { className: "flex items-center gap-3 p-2 font-normal", children: [
1926
- /* @__PURE__ */ jsxRuntime.jsx(
1927
- MenuAvatar,
1928
- {
1929
- name: user.name,
1930
- image: user.image,
1931
- sizeClass: "size-9"
1932
- }
1933
- ),
1934
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
1935
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-1.5 truncate text-sm font-medium leading-tight", children: [
1936
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: user.name }),
1937
- variant === "platform" ? /* @__PURE__ */ jsxRuntime.jsx(
1938
- VerifiedProfessionalBadge,
1985
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: triggerProp ?? defaultTrigger }),
1986
+ /* @__PURE__ */ jsxRuntime.jsx(
1987
+ DropdownMenuContent,
1988
+ {
1989
+ side: contentSide,
1990
+ align: contentAlign,
1991
+ sideOffset: contentSideOffset,
1992
+ className: cn("min-w-60 rounded-lg", contentClassName),
1993
+ children: user ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1994
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuLabel, { className: "flex items-center gap-3 p-2 font-normal", children: [
1995
+ /* @__PURE__ */ jsxRuntime.jsx(
1996
+ MenuAvatar,
1939
1997
  {
1940
- status: verificationStatus,
1941
- className: "shrink-0"
1998
+ name: user.name,
1999
+ image: user.image,
2000
+ sizeClass: "size-9"
1942
2001
  }
1943
- ) : null
1944
- ] }),
1945
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs text-muted-foreground leading-tight", children: user.email })
1946
- ] })
1947
- ] }),
1948
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
1949
- variant === "platform" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1950
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: accountHref, children: [
1951
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: "size-4" }),
1952
- labels.personalProfile
1953
- ] }) }),
1954
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: activityHref, children: [
1955
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Activity, { className: "size-4" }),
1956
- labels.activity
1957
- ] }) }),
1958
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: profileHref, children: [
1959
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: "size-4" }),
1960
- labels.professionalProfile
1961
- ] }) }),
1962
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: urls.appUrl, children: [
1963
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LayoutDashboard, { className: "size-4" }),
1964
- labels.mainApp
1965
- ] }) }),
1966
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: urls.adminUrl, children: [
1967
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Building2, { className: "size-4" }),
1968
- labels.orgManagement
1969
- ] }) }),
1970
- isAdmin && urls.backofficeUrl ? /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: urls.backofficeUrl, children: [
1971
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LayoutDashboard, { className: "size-4" }),
1972
- labels.backoffice
1973
- ] }) }) : null,
1974
- memberOrgs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuSub, { children: [
1975
- /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuSubTrigger, { className: "gap-2", children: [
1976
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Users, { className: "size-4" }),
1977
- labels.memberOrgs
2002
+ ),
2003
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
2004
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-1.5 truncate text-sm font-medium leading-tight", children: [
2005
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: user.name }),
2006
+ variant === "platform" ? /* @__PURE__ */ jsxRuntime.jsx(
2007
+ VerifiedProfessionalBadge,
2008
+ {
2009
+ status: verificationStatus,
2010
+ className: "shrink-0"
2011
+ }
2012
+ ) : null
2013
+ ] }),
2014
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs text-muted-foreground leading-tight", children: user.email })
2015
+ ] })
1978
2016
  ] }),
1979
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSubContent, { className: "min-w-48 max-h-64 overflow-y-auto", children: memberOrgs.map((org) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: `${urls.appUrl}/o/${org.slug}`, children: org.name }) }, org.id)) })
1980
- ] }) : null,
1981
- manageableOrgs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuSub, { children: [
1982
- /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuSubTrigger, { className: "gap-2", children: [
1983
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Building2, { className: "size-4" }),
1984
- labels.managementOrgs
2017
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
2018
+ variant === "platform" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2019
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: accountHref, children: [
2020
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: "size-4" }),
2021
+ labels.personalProfile
2022
+ ] }) }),
2023
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: activityHref, children: [
2024
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Activity, { className: "size-4" }),
2025
+ labels.activity
2026
+ ] }) }),
2027
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: profileHref, children: [
2028
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: "size-4" }),
2029
+ labels.professionalProfile
2030
+ ] }) }),
2031
+ memberOrgs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuSub, { children: [
2032
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuSubTrigger, { className: "gap-2", children: [
2033
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Users, { className: "size-4" }),
2034
+ labels.memberOrgs
2035
+ ] }),
2036
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSubContent, { className: "min-w-48 max-h-64 overflow-y-auto scroll-fade-b", children: memberOrgs.map((org) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: `${urls.appUrl}/o/${org.slug}`, children: org.name }) }, org.id)) })
2037
+ ] }) : null,
2038
+ manageableOrgs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuSub, { children: [
2039
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuSubTrigger, { className: "gap-2", children: [
2040
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Building2, { className: "size-4" }),
2041
+ labels.managementOrgs
2042
+ ] }),
2043
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSubContent, { className: "min-w-48 max-h-64 overflow-y-auto scroll-fade-b", children: manageableOrgs.map((org) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
2044
+ "a",
2045
+ {
2046
+ href: `${urls.adminUrl}/api/auth/org/select?id=${encodeURIComponent(org.id)}`,
2047
+ children: org.name
2048
+ }
2049
+ ) }, org.id)) })
2050
+ ] }) : null,
2051
+ extraItems,
2052
+ isAdmin && urls.backofficeUrl ? /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: urls.backofficeUrl, children: [
2053
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LayoutDashboard, { className: "size-4" }),
2054
+ labels.backoffice
2055
+ ] }) }) : null,
2056
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {})
2057
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2058
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: accountHref, children: [
2059
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { className: "size-4" }),
2060
+ labels.accountSettings
2061
+ ] }) }),
2062
+ extraItems,
2063
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {})
1985
2064
  ] }),
1986
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSubContent, { className: "min-w-48 max-h-64 overflow-y-auto", children: manageableOrgs.map((org) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1987
- "a",
2065
+ /* @__PURE__ */ jsxRuntime.jsx(
2066
+ LanguageThemeSubs,
1988
2067
  {
1989
- href: `${urls.adminUrl}/api/auth/org/select?id=${encodeURIComponent(org.id)}`,
1990
- children: org.name
2068
+ languages,
2069
+ currentLanguage,
2070
+ onLanguageChange,
2071
+ labels
1991
2072
  }
1992
- ) }, org.id)) })
1993
- ] }) : null,
1994
- extraItems,
1995
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {})
1996
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1997
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: accountHref, children: [
1998
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { className: "size-4" }),
1999
- labels.accountSettings
2000
- ] }) }),
2001
- extraItems,
2002
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {})
2003
- ] }),
2004
- /* @__PURE__ */ jsxRuntime.jsx(
2005
- LanguageThemeSubs,
2006
- {
2007
- languages,
2008
- currentLanguage,
2009
- onLanguageChange,
2010
- labels
2011
- }
2012
- ),
2013
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
2014
- /* @__PURE__ */ jsxRuntime.jsxs(
2015
- DropdownMenuItem,
2016
- {
2017
- variant: "destructive",
2018
- className: "gap-2",
2019
- disabled: signingOut || !onSignOut,
2020
- onSelect: (event) => {
2021
- event.preventDefault();
2022
- void handleSignOut();
2023
- },
2024
- children: [
2025
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { className: "size-4" }),
2026
- signingOut ? labels.signingOut : labels.signOut
2027
- ]
2028
- }
2029
- )
2030
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2031
- /* @__PURE__ */ jsxRuntime.jsx(
2032
- LanguageThemeSubs,
2033
- {
2034
- languages,
2035
- currentLanguage,
2036
- onLanguageChange,
2037
- labels
2038
- }
2039
- ),
2040
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
2041
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: loginHref, children: [
2042
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogIn, { className: "size-4" }),
2043
- labels.signIn
2044
- ] }) })
2045
- ] }) })
2073
+ ),
2074
+ /* @__PURE__ */ jsxRuntime.jsxs(
2075
+ DropdownMenuItem,
2076
+ {
2077
+ variant: "destructive",
2078
+ className: "gap-2",
2079
+ disabled: signingOut || !onSignOut,
2080
+ onSelect: (event) => {
2081
+ event.preventDefault();
2082
+ void handleSignOut();
2083
+ },
2084
+ children: [
2085
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { className: "size-4" }),
2086
+ signingOut ? labels.signingOut : labels.signOut
2087
+ ]
2088
+ }
2089
+ )
2090
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2091
+ /* @__PURE__ */ jsxRuntime.jsx(
2092
+ LanguageThemeSubs,
2093
+ {
2094
+ languages,
2095
+ currentLanguage,
2096
+ onLanguageChange,
2097
+ labels
2098
+ }
2099
+ ),
2100
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
2101
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { asChild: true, className: "gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: loginHref, children: [
2102
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogIn, { className: "size-4" }),
2103
+ labels.signIn
2104
+ ] }) })
2105
+ ] })
2106
+ }
2107
+ )
2046
2108
  ] });
2047
2109
  }
2048
2110
  function Slider({
@@ -7585,6 +7647,8 @@ exports.BubbleGroup = BubbleGroup;
7585
7647
  exports.BubbleReactions = BubbleReactions;
7586
7648
  exports.ChatMessageList = ChatMessageList;
7587
7649
  exports.ConfirmDestructiveDialog = ConfirmDestructiveDialog;
7650
+ exports.DropdownMenuItem = DropdownMenuItem;
7651
+ exports.DropdownMenuSeparator = DropdownMenuSeparator;
7588
7652
  exports.EmojiInput = EmojiInput;
7589
7653
  exports.EmojiPicker = EmojiPicker;
7590
7654
  exports.EmojiPickerPopover = EmojiPickerPopover;
@@ -7654,6 +7718,7 @@ exports.useLanguageContext = useLanguageContext;
7654
7718
  exports.useMediaQuery = useMediaQuery2;
7655
7719
  exports.usePlaybackStats = usePlaybackStats;
7656
7720
  exports.useRealtimeChannel = useRealtimeChannel;
7721
+ exports.useScrollFadeXEdges = useScrollFadeXEdges;
7657
7722
  exports.useSearchHotkey = useSearchHotkey;
7658
7723
  exports.useSupportConversation = useSupportConversation;
7659
7724
  exports.useSupportMessenger = useSupportMessenger;