@sesionario/blocks 1.41.0-rc.4 → 1.41.0-rc.6

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
@@ -5247,6 +5247,24 @@ function Command({
5247
5247
  }
5248
5248
  );
5249
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
+ }
5250
5268
  function CommandDialog({
5251
5269
  title = "Command Palette",
5252
5270
  description = "Search for a command to run...",
@@ -5256,8 +5274,9 @@ function CommandDialog({
5256
5274
  commandProps,
5257
5275
  ...props
5258
5276
  }) {
5259
- const { height: viewportHeight, keyboardInset } = useVisualViewportMetrics();
5260
- const mobileMaxHeight = viewportHeight > 0 ? Math.max(240, viewportHeight - Math.max(keyboardInset, 16) - 16) : void 0;
5277
+ const { height: viewportHeight } = useVisualViewportMetrics();
5278
+ useCommandDialogScrollLock(props.open);
5279
+ const mobileMaxHeight = viewportHeight > 0 ? Math.max(280, viewportHeight - 16) : void 0;
5261
5280
  return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { ...props, children: [
5262
5281
  /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: "sr-only", children: [
5263
5282
  /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: title }),
@@ -5267,10 +5286,11 @@ function CommandDialog({
5267
5286
  DialogContent,
5268
5287
  {
5269
5288
  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))]",
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))]",
5274
5294
  className
5275
5295
  ),
5276
5296
  style: mobileMaxHeight ? {
@@ -5280,7 +5300,7 @@ function CommandDialog({
5280
5300
  children: /* @__PURE__ */ jsxRuntime.jsx(
5281
5301
  Command,
5282
5302
  {
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",
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",
5284
5304
  ...commandProps,
5285
5305
  children
5286
5306
  }
@@ -5297,7 +5317,7 @@ function CommandInput({
5297
5317
  "div",
5298
5318
  {
5299
5319
  "data-slot": "command-input-wrapper",
5300
- 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",
5301
5321
  children: [
5302
5322
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "size-4 shrink-0 opacity-50" }),
5303
5323
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -5325,7 +5345,7 @@ function CommandList({
5325
5345
  {
5326
5346
  "data-slot": "command-list",
5327
5347
  className: cn(
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))]",
5348
+ "max-h-[min(300px,calc(100dvh-12rem))] scroll-py-1 overflow-x-hidden overflow-y-auto overscroll-contain touch-pan-y",
5329
5349
  className
5330
5350
  ),
5331
5351
  ...props
@@ -7378,6 +7398,9 @@ var MessageComposer = React2__namespace.forwardRef(function MessageComposer2({
7378
7398
  event.preventDefault();
7379
7399
  if (!canSubmit) return;
7380
7400
  onSubmit(event);
7401
+ requestAnimationFrame(() => {
7402
+ fieldRef.current?.focus({ preventScroll: true });
7403
+ });
7381
7404
  },
7382
7405
  [canSubmit, onSubmit]
7383
7406
  );
@@ -7452,6 +7475,10 @@ var MessageComposer = React2__namespace.forwardRef(function MessageComposer2({
7452
7475
  size: sendButtonSize,
7453
7476
  disabled: !canSubmit,
7454
7477
  className: sendButtonClassName,
7478
+ onPointerDown: (event) => {
7479
+ if (event.button !== 0) return;
7480
+ event.preventDefault();
7481
+ },
7455
7482
  children: sendLabel
7456
7483
  }
7457
7484
  )
@@ -7709,7 +7736,7 @@ function ThreadPanel({
7709
7736
  sendLabel: labels.send,
7710
7737
  placeholder: labels.placeholder,
7711
7738
  "aria-label": labels.placeholder,
7712
- disabled: loading || sending,
7739
+ disabled: loading,
7713
7740
  sendDisabled: loading || sending,
7714
7741
  maxLength: 2e3,
7715
7742
  rows: 2