@sesionario/blocks 1.41.0-rc.3 → 1.41.0-rc.5

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);
@@ -5204,6 +5247,24 @@ function Command({
5204
5247
  }
5205
5248
  );
5206
5249
  }
5250
+ function useCommandDialogScrollLock(open) {
5251
+ React2__namespace.useEffect(() => {
5252
+ if (!open) return;
5253
+ const onTouchMove = (event) => {
5254
+ const target = event.target;
5255
+ if (!(target instanceof Element)) {
5256
+ event.preventDefault();
5257
+ return;
5258
+ }
5259
+ if (target.closest('[data-slot="command-list"]')) return;
5260
+ event.preventDefault();
5261
+ };
5262
+ document.addEventListener("touchmove", onTouchMove, { passive: false });
5263
+ return () => {
5264
+ document.removeEventListener("touchmove", onTouchMove);
5265
+ };
5266
+ }, [open]);
5267
+ }
5207
5268
  function CommandDialog({
5208
5269
  title = "Command Palette",
5209
5270
  description = "Search for a command to run...",
@@ -5213,6 +5274,9 @@ function CommandDialog({
5213
5274
  commandProps,
5214
5275
  ...props
5215
5276
  }) {
5277
+ const { height: viewportHeight } = useVisualViewportMetrics();
5278
+ useCommandDialogScrollLock(props.open);
5279
+ const mobileMaxHeight = viewportHeight > 0 ? Math.max(280, viewportHeight - 16) : void 0;
5216
5280
  return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { ...props, children: [
5217
5281
  /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: "sr-only", children: [
5218
5282
  /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: title }),
@@ -5221,12 +5285,22 @@ function CommandDialog({
5221
5285
  /* @__PURE__ */ jsxRuntime.jsx(
5222
5286
  DialogContent,
5223
5287
  {
5224
- className: cn("overflow-hidden p-0", className),
5288
+ className: cn(
5289
+ "flex flex-col gap-0 overflow-hidden p-0",
5290
+ // iOS: top-pin in the visual viewport, near full-bleed width,
5291
+ // fill available height so the list (not the page) scrolls.
5292
+ "max-sm:top-[max(0.5rem,env(safe-area-inset-top))] max-sm:right-2 max-sm:left-2 max-sm:w-auto max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0",
5293
+ "max-sm:h-[var(--command-dialog-max-height,calc(100dvh-1rem))] max-sm:max-h-[var(--command-dialog-max-height,calc(100dvh-1rem))]",
5294
+ className
5295
+ ),
5296
+ style: mobileMaxHeight ? {
5297
+ ["--command-dialog-max-height"]: `${mobileMaxHeight}px`
5298
+ } : void 0,
5225
5299
  showCloseButton,
5226
5300
  children: /* @__PURE__ */ jsxRuntime.jsx(
5227
5301
  Command,
5228
5302
  {
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",
5303
+ className: "flex h-full min-h-0 flex-col **:data-[slot=command-input-wrapper]:h-12 **:data-[slot=command-list]:max-sm:max-h-none **:data-[slot=command-list]:max-sm:min-h-0 **:data-[slot=command-list]:max-sm:flex-1 [&_[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
5304
  ...commandProps,
5231
5305
  children
5232
5306
  }
@@ -5243,7 +5317,7 @@ function CommandInput({
5243
5317
  "div",
5244
5318
  {
5245
5319
  "data-slot": "command-input-wrapper",
5246
- className: "flex h-9 items-center gap-2 border-b px-3",
5320
+ className: "flex h-9 shrink-0 items-center gap-2 border-b px-3",
5247
5321
  children: [
5248
5322
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "size-4 shrink-0 opacity-50" }),
5249
5323
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -5251,7 +5325,8 @@ function CommandInput({
5251
5325
  {
5252
5326
  "data-slot": "command-input",
5253
5327
  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",
5328
+ // text-base (≥16px) on mobile prevents iOS Safari focus zoom
5329
+ "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
5330
  className
5256
5331
  ),
5257
5332
  ...props
@@ -5270,7 +5345,7 @@ function CommandList({
5270
5345
  {
5271
5346
  "data-slot": "command-list",
5272
5347
  className: cn(
5273
- "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
5348
+ "max-h-[min(300px,calc(100dvh-12rem))] scroll-py-1 overflow-x-hidden overflow-y-auto overscroll-contain touch-pan-y",
5274
5349
  className
5275
5350
  ),
5276
5351
  ...props
@@ -7725,7 +7800,7 @@ function ListPanel({
7725
7800
  value: query,
7726
7801
  onChange: (e) => setQuery(e.target.value),
7727
7802
  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"
7803
+ 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
7804
  }
7730
7805
  )
7731
7806
  ] }) }) : null,
@@ -7783,10 +7858,13 @@ function SupportMessengerProvider({
7783
7858
  className
7784
7859
  }) {
7785
7860
  const isMobile = useMediaQuery2("(max-width: 767px)");
7861
+ const { height: viewportHeight, keyboardInset } = useVisualViewportMetrics();
7786
7862
  const dockRef = React2.useRef(null);
7787
7863
  const [listOpen, setListOpen] = React2.useState(false);
7788
7864
  const [threads, setThreads] = React2.useState([]);
7789
7865
  const [mobileThreadKey, setMobileThreadKey] = React2.useState(null);
7866
+ const mobileSheetOpen = listOpen || Boolean(mobileThreadKey);
7867
+ const mobileSheetHeight = viewportHeight > 0 ? Math.max(240, Math.min(viewportHeight * 0.85, viewportHeight)) : void 0;
7790
7868
  const totalUnread = React2.useMemo(
7791
7869
  () => items.reduce((sum, item) => sum + (item.unreadCount ?? 0), 0),
7792
7870
  [items]
@@ -7930,48 +8008,61 @@ function SupportMessengerProvider({
7930
8008
  isMobile ? /* @__PURE__ */ jsxRuntime.jsx(
7931
8009
  Drawer,
7932
8010
  {
7933
- open: listOpen || Boolean(activeMobileThread),
8011
+ open: mobileSheetOpen,
7934
8012
  onOpenChange: (open) => {
7935
8013
  if (!open) closeAll();
7936
8014
  },
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
- ] }) })
8015
+ children: /* @__PURE__ */ jsxRuntime.jsx(
8016
+ DrawerContent,
8017
+ {
8018
+ className: "pointer-events-auto mx-auto flex max-h-[85dvh] max-w-lg flex-col",
8019
+ style: {
8020
+ // Lift above the software keyboard without Vaul's
8021
+ // repositionInputs focus hack (see drawer.tsx).
8022
+ bottom: keyboardInset,
8023
+ height: mobileSheetHeight ?? "85dvh",
8024
+ maxHeight: viewportHeight > 0 ? viewportHeight : "85dvh"
8025
+ },
8026
+ children: activeMobileThread ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8027
+ /* @__PURE__ */ jsxRuntime.jsx(DrawerHeader, { className: "sr-only", children: /* @__PURE__ */ jsxRuntime.jsx(DrawerTitle, { children: activeMobileThread.title }) }),
8028
+ /* @__PURE__ */ jsxRuntime.jsx(
8029
+ ThreadPanel,
8030
+ {
8031
+ thread: activeMobileThread,
8032
+ client,
8033
+ getWsUrl,
8034
+ currentUserId,
8035
+ labels,
8036
+ emojiLocale,
8037
+ showBack: true,
8038
+ onBack: () => {
8039
+ closeThread(activeMobileThread.key);
8040
+ setListOpen(true);
8041
+ },
8042
+ onClose: closeAll,
8043
+ onConversationReady: () => void onRefreshItems?.(),
8044
+ className: "h-full rounded-none border-0 shadow-none"
8045
+ }
8046
+ )
8047
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8048
+ /* @__PURE__ */ jsxRuntime.jsx(DrawerHeader, { className: "sr-only", children: /* @__PURE__ */ jsxRuntime.jsx(DrawerTitle, { children: labels.listTitle }) }),
8049
+ /* @__PURE__ */ jsxRuntime.jsx(
8050
+ ListPanel,
8051
+ {
8052
+ items,
8053
+ labels,
8054
+ tabs,
8055
+ activeTab,
8056
+ onTabChange,
8057
+ onSelect: handleSelectItem,
8058
+ onClose: closeAll,
8059
+ searchThreshold,
8060
+ className: "h-full rounded-none border-0 shadow-none"
8061
+ }
8062
+ )
8063
+ ] })
8064
+ }
8065
+ )
7975
8066
  }
7976
8067
  ) : null,
7977
8068
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -9016,6 +9107,7 @@ exports.useSearchHotkey = useSearchHotkey;
9016
9107
  exports.useSupportConversation = useSupportConversation;
9017
9108
  exports.useSupportMessenger = useSupportMessenger;
9018
9109
  exports.useSupportMessengerOptional = useSupportMessengerOptional;
9110
+ exports.useVisualViewportMetrics = useVisualViewportMetrics;
9019
9111
  exports.useZoomPanGestures = useZoomPanGestures;
9020
9112
  exports.zoomToward = zoomToward;
9021
9113
  //# sourceMappingURL=index.cjs.map