@sesionario/blocks 1.41.0-rc.2 → 1.41.0-rc.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.
package/dist/index.cjs CHANGED
@@ -311,7 +311,7 @@ function AlertDialogOverlay({
311
311
  {
312
312
  "data-slot": "alert-dialog-overlay",
313
313
  className: cn(
314
- "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
314
+ "fixed inset-0 z-50 bg-black/50 dark:bg-black/80 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
315
315
  className
316
316
  ),
317
317
  ...props
@@ -1575,7 +1575,7 @@ function DialogOverlay({
1575
1575
  {
1576
1576
  "data-slot": "dialog-overlay",
1577
1577
  className: cn(
1578
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
1578
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 dark:bg-black/80",
1579
1579
  className
1580
1580
  ),
1581
1581
  ...props
@@ -3626,9 +3626,17 @@ function AvatarEditor({
3626
3626
  );
3627
3627
  }
3628
3628
  function Drawer({
3629
+ repositionInputs = false,
3629
3630
  ...props
3630
3631
  }) {
3631
- return /* @__PURE__ */ jsxRuntime.jsx(vaul.Drawer.Root, { "data-slot": "drawer", ...props });
3632
+ return /* @__PURE__ */ jsxRuntime.jsx(
3633
+ vaul.Drawer.Root,
3634
+ {
3635
+ "data-slot": "drawer",
3636
+ repositionInputs,
3637
+ ...props
3638
+ }
3639
+ );
3632
3640
  }
3633
3641
  function DrawerPortal({
3634
3642
  ...props
@@ -3649,7 +3657,7 @@ function DrawerOverlay({
3649
3657
  {
3650
3658
  "data-slot": "drawer-overlay",
3651
3659
  className: cn(
3652
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
3660
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 dark:bg-black/80",
3653
3661
  className
3654
3662
  ),
3655
3663
  ...props
@@ -4225,7 +4233,7 @@ function EmojiPicker({
4225
4233
  onKeyDown: handleSearchKeyDown,
4226
4234
  placeholder: strings.searchPlaceholder,
4227
4235
  "aria-label": strings.searchAriaLabel,
4228
- className: "border-input bg-background focus-visible:border-ring focus-visible:ring-ring/50 h-9 w-full rounded-md border py-2 pr-3 pl-8 text-sm outline-none focus-visible:ring-[3px]"
4236
+ className: "border-input bg-background focus-visible:border-ring focus-visible:ring-ring/50 h-9 w-full rounded-md border py-2 pr-3 pl-8 text-base outline-none focus-visible:ring-[3px] md:text-sm"
4229
4237
  }
4230
4238
  )
4231
4239
  ] }),
@@ -4713,6 +4721,41 @@ function useMediaQuery2(query) {
4713
4721
  }, [query]);
4714
4722
  return matches;
4715
4723
  }
4724
+ function readMetrics() {
4725
+ if (typeof window === "undefined") {
4726
+ return { height: 0, offsetTop: 0, keyboardInset: 0 };
4727
+ }
4728
+ const vv = window.visualViewport;
4729
+ if (!vv) {
4730
+ return {
4731
+ height: window.innerHeight,
4732
+ offsetTop: 0,
4733
+ keyboardInset: 0
4734
+ };
4735
+ }
4736
+ return {
4737
+ height: vv.height,
4738
+ offsetTop: vv.offsetTop,
4739
+ keyboardInset: Math.max(0, window.innerHeight - vv.height - vv.offsetTop)
4740
+ };
4741
+ }
4742
+ function useVisualViewportMetrics() {
4743
+ const [metrics, setMetrics] = React2.useState(readMetrics);
4744
+ React2.useEffect(() => {
4745
+ const vv = window.visualViewport;
4746
+ const update = () => setMetrics(readMetrics());
4747
+ update();
4748
+ vv?.addEventListener("resize", update);
4749
+ vv?.addEventListener("scroll", update);
4750
+ window.addEventListener("resize", update);
4751
+ return () => {
4752
+ vv?.removeEventListener("resize", update);
4753
+ vv?.removeEventListener("scroll", update);
4754
+ window.removeEventListener("resize", update);
4755
+ };
4756
+ }, []);
4757
+ return metrics;
4758
+ }
4716
4759
  function useSearchHotkey(options = {}) {
4717
4760
  const { defaultOpen = false, disabled = false } = options;
4718
4761
  const [open, setOpen] = React2.useState(defaultOpen);
@@ -5213,6 +5256,8 @@ function CommandDialog({
5213
5256
  commandProps,
5214
5257
  ...props
5215
5258
  }) {
5259
+ const { height: viewportHeight, keyboardInset } = useVisualViewportMetrics();
5260
+ const mobileMaxHeight = viewportHeight > 0 ? Math.max(240, viewportHeight - Math.max(keyboardInset, 16) - 16) : void 0;
5216
5261
  return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { ...props, children: [
5217
5262
  /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: "sr-only", children: [
5218
5263
  /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: title }),
@@ -5221,12 +5266,21 @@ function CommandDialog({
5221
5266
  /* @__PURE__ */ jsxRuntime.jsx(
5222
5267
  DialogContent,
5223
5268
  {
5224
- className: cn("overflow-hidden p-0", className),
5269
+ className: cn(
5270
+ "overflow-hidden p-0",
5271
+ // iOS: keep the palette in the visual viewport above the keyboard
5272
+ // instead of vertically centering into the obscured half.
5273
+ "max-sm:top-[max(0.75rem,env(safe-area-inset-top))] max-sm:translate-y-0 max-sm:max-h-[var(--command-dialog-max-height,calc(100dvh-1.5rem))]",
5274
+ className
5275
+ ),
5276
+ style: mobileMaxHeight ? {
5277
+ ["--command-dialog-max-height"]: `${mobileMaxHeight}px`
5278
+ } : void 0,
5225
5279
  showCloseButton,
5226
5280
  children: /* @__PURE__ */ jsxRuntime.jsx(
5227
5281
  Command,
5228
5282
  {
5229
- className: "**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",
5283
+ className: "max-sm:max-h-full **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",
5230
5284
  ...commandProps,
5231
5285
  children
5232
5286
  }
@@ -5251,7 +5305,8 @@ function CommandInput({
5251
5305
  {
5252
5306
  "data-slot": "command-input",
5253
5307
  className: cn(
5254
- "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
5308
+ // text-base (≥16px) on mobile prevents iOS Safari focus zoom
5309
+ "flex h-10 w-full rounded-md bg-transparent py-3 text-base outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
5255
5310
  className
5256
5311
  ),
5257
5312
  ...props
@@ -5270,7 +5325,7 @@ function CommandList({
5270
5325
  {
5271
5326
  "data-slot": "command-list",
5272
5327
  className: cn(
5273
- "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
5328
+ "max-h-[min(300px,calc(100dvh-12rem))] scroll-py-1 overflow-x-hidden overflow-y-auto max-sm:max-h-[min(50dvh,calc(var(--command-dialog-max-height,100dvh)-6rem))]",
5274
5329
  className
5275
5330
  ),
5276
5331
  ...props
@@ -7725,7 +7780,7 @@ function ListPanel({
7725
7780
  value: query,
7726
7781
  onChange: (e) => setQuery(e.target.value),
7727
7782
  placeholder: labels.searchPlaceholder ?? "Buscar\u2026",
7728
- className: "h-8 w-full rounded-md border bg-transparent pr-2 pl-8 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring"
7783
+ className: "h-9 w-full rounded-md border bg-transparent pr-2 pl-8 text-base outline-none focus-visible:ring-2 focus-visible:ring-ring md:h-8 md:text-sm"
7729
7784
  }
7730
7785
  )
7731
7786
  ] }) }) : null,
@@ -7783,10 +7838,13 @@ function SupportMessengerProvider({
7783
7838
  className
7784
7839
  }) {
7785
7840
  const isMobile = useMediaQuery2("(max-width: 767px)");
7841
+ const { height: viewportHeight, keyboardInset } = useVisualViewportMetrics();
7786
7842
  const dockRef = React2.useRef(null);
7787
7843
  const [listOpen, setListOpen] = React2.useState(false);
7788
7844
  const [threads, setThreads] = React2.useState([]);
7789
7845
  const [mobileThreadKey, setMobileThreadKey] = React2.useState(null);
7846
+ const mobileSheetOpen = listOpen || Boolean(mobileThreadKey);
7847
+ const mobileSheetHeight = viewportHeight > 0 ? Math.max(240, Math.min(viewportHeight * 0.85, viewportHeight)) : void 0;
7790
7848
  const totalUnread = React2.useMemo(
7791
7849
  () => items.reduce((sum, item) => sum + (item.unreadCount ?? 0), 0),
7792
7850
  [items]
@@ -7930,48 +7988,61 @@ function SupportMessengerProvider({
7930
7988
  isMobile ? /* @__PURE__ */ jsxRuntime.jsx(
7931
7989
  Drawer,
7932
7990
  {
7933
- open: listOpen || Boolean(activeMobileThread),
7991
+ open: mobileSheetOpen,
7934
7992
  onOpenChange: (open) => {
7935
7993
  if (!open) closeAll();
7936
7994
  },
7937
- children: /* @__PURE__ */ jsxRuntime.jsx(DrawerContent, { className: "pointer-events-auto mx-auto flex h-[85vh] max-w-lg flex-col", children: activeMobileThread ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7938
- /* @__PURE__ */ jsxRuntime.jsx(DrawerHeader, { className: "sr-only", children: /* @__PURE__ */ jsxRuntime.jsx(DrawerTitle, { children: activeMobileThread.title }) }),
7939
- /* @__PURE__ */ jsxRuntime.jsx(
7940
- ThreadPanel,
7941
- {
7942
- thread: activeMobileThread,
7943
- client,
7944
- getWsUrl,
7945
- currentUserId,
7946
- labels,
7947
- emojiLocale,
7948
- showBack: true,
7949
- onBack: () => {
7950
- closeThread(activeMobileThread.key);
7951
- setListOpen(true);
7952
- },
7953
- onClose: closeAll,
7954
- onConversationReady: () => void onRefreshItems?.(),
7955
- className: "h-full rounded-none border-0 shadow-none"
7956
- }
7957
- )
7958
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7959
- /* @__PURE__ */ jsxRuntime.jsx(DrawerHeader, { className: "sr-only", children: /* @__PURE__ */ jsxRuntime.jsx(DrawerTitle, { children: labels.listTitle }) }),
7960
- /* @__PURE__ */ jsxRuntime.jsx(
7961
- ListPanel,
7962
- {
7963
- items,
7964
- labels,
7965
- tabs,
7966
- activeTab,
7967
- onTabChange,
7968
- onSelect: handleSelectItem,
7969
- onClose: closeAll,
7970
- searchThreshold,
7971
- className: "h-full rounded-none border-0 shadow-none"
7972
- }
7973
- )
7974
- ] }) })
7995
+ children: /* @__PURE__ */ jsxRuntime.jsx(
7996
+ DrawerContent,
7997
+ {
7998
+ className: "pointer-events-auto mx-auto flex max-h-[85dvh] max-w-lg flex-col",
7999
+ style: {
8000
+ // Lift above the software keyboard without Vaul's
8001
+ // repositionInputs focus hack (see drawer.tsx).
8002
+ bottom: keyboardInset,
8003
+ height: mobileSheetHeight ?? "85dvh",
8004
+ maxHeight: viewportHeight > 0 ? viewportHeight : "85dvh"
8005
+ },
8006
+ children: activeMobileThread ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8007
+ /* @__PURE__ */ jsxRuntime.jsx(DrawerHeader, { className: "sr-only", children: /* @__PURE__ */ jsxRuntime.jsx(DrawerTitle, { children: activeMobileThread.title }) }),
8008
+ /* @__PURE__ */ jsxRuntime.jsx(
8009
+ ThreadPanel,
8010
+ {
8011
+ thread: activeMobileThread,
8012
+ client,
8013
+ getWsUrl,
8014
+ currentUserId,
8015
+ labels,
8016
+ emojiLocale,
8017
+ showBack: true,
8018
+ onBack: () => {
8019
+ closeThread(activeMobileThread.key);
8020
+ setListOpen(true);
8021
+ },
8022
+ onClose: closeAll,
8023
+ onConversationReady: () => void onRefreshItems?.(),
8024
+ className: "h-full rounded-none border-0 shadow-none"
8025
+ }
8026
+ )
8027
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8028
+ /* @__PURE__ */ jsxRuntime.jsx(DrawerHeader, { className: "sr-only", children: /* @__PURE__ */ jsxRuntime.jsx(DrawerTitle, { children: labels.listTitle }) }),
8029
+ /* @__PURE__ */ jsxRuntime.jsx(
8030
+ ListPanel,
8031
+ {
8032
+ items,
8033
+ labels,
8034
+ tabs,
8035
+ activeTab,
8036
+ onTabChange,
8037
+ onSelect: handleSelectItem,
8038
+ onClose: closeAll,
8039
+ searchThreshold,
8040
+ className: "h-full rounded-none border-0 shadow-none"
8041
+ }
8042
+ )
8043
+ ] })
8044
+ }
8045
+ )
7975
8046
  }
7976
8047
  ) : null,
7977
8048
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -9016,6 +9087,7 @@ exports.useSearchHotkey = useSearchHotkey;
9016
9087
  exports.useSupportConversation = useSupportConversation;
9017
9088
  exports.useSupportMessenger = useSupportMessenger;
9018
9089
  exports.useSupportMessengerOptional = useSupportMessengerOptional;
9090
+ exports.useVisualViewportMetrics = useVisualViewportMetrics;
9019
9091
  exports.useZoomPanGestures = useZoomPanGestures;
9020
9092
  exports.zoomToward = zoomToward;
9021
9093
  //# sourceMappingURL=index.cjs.map