@designa8/vibedesign-linear-internal-v1-b737 0.12.1 → 0.12.2

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @designa8/vibedesign-linear-internal-v1-b737
2
2
 
3
- Complete design system generated by Atoms Design, version **0.12.1**.
3
+ Complete design system generated by Atoms Design, version **0.12.2**.
4
4
  Tokens, atoms, molecules, organisms, and templates — import from the package root;
5
5
  never hardcode visual values in consumer code.
6
6
 
package/dist/index.cjs CHANGED
@@ -5700,6 +5700,7 @@ var React46 = __toESM(require("react"));
5700
5700
  var import_react_dom5 = require("react-dom");
5701
5701
  var import_jsx_runtime46 = require("react/jsx-runtime");
5702
5702
  var cn35 = (...parts) => parts.filter(Boolean).join(" ");
5703
+ var DISMISS_THRESHOLD = 0.3;
5703
5704
  var Drawer = React46.forwardRef(
5704
5705
  ({
5705
5706
  open,
@@ -5714,6 +5715,7 @@ var Drawer = React46.forwardRef(
5714
5715
  "aria-label": ariaLabel,
5715
5716
  closeOnScrimClick = true,
5716
5717
  bodyClassName,
5718
+ showHandle = true,
5717
5719
  className,
5718
5720
  children,
5719
5721
  ...rest
@@ -5722,6 +5724,20 @@ var Drawer = React46.forwardRef(
5722
5724
  const panelRef = React46.useRef(null);
5723
5725
  const [mounted, setMounted] = React46.useState(false);
5724
5726
  React46.useEffect(() => setMounted(true), []);
5727
+ const isBottom = side === "bottom";
5728
+ const [dragging, setDragging] = React46.useState(false);
5729
+ const [dragOffset, setDragOffset] = React46.useState(0);
5730
+ const dragStartY = React46.useRef(0);
5731
+ const dragHeight = React46.useRef(0);
5732
+ const endDrag = React46.useCallback(
5733
+ (close) => {
5734
+ const passed = dragOffset > (dragHeight.current || 0) * DISMISS_THRESHOLD;
5735
+ setDragging(false);
5736
+ setDragOffset(0);
5737
+ if (close && passed) onOpenChange(false);
5738
+ },
5739
+ [dragOffset, onOpenChange]
5740
+ );
5725
5741
  React46.useEffect(() => {
5726
5742
  if (!open) return;
5727
5743
  const onKey = (e) => {
@@ -5748,13 +5764,40 @@ var Drawer = React46.forwardRef(
5748
5764
  window.clearTimeout(t);
5749
5765
  };
5750
5766
  }, [open, onOpenChange, closeOnScrimClick]);
5767
+ const onHandlePointerDown = (e) => {
5768
+ if (!isBottom) return;
5769
+ dragStartY.current = e.clientY;
5770
+ dragHeight.current = panelRef.current?.getBoundingClientRect().height ?? 0;
5771
+ setDragging(true);
5772
+ setDragOffset(0);
5773
+ e.currentTarget.setPointerCapture?.(e.pointerId);
5774
+ };
5775
+ const onHandlePointerMove = (e) => {
5776
+ if (!dragging) return;
5777
+ const next = Math.max(0, e.clientY - dragStartY.current);
5778
+ setDragOffset(Math.min(next, dragHeight.current || next));
5779
+ };
5780
+ const onHandlePointerUp = (e) => {
5781
+ if (!dragging) return;
5782
+ try {
5783
+ e.currentTarget.releasePointerCapture?.(e.pointerId);
5784
+ } catch {
5785
+ }
5786
+ endDrag(true);
5787
+ };
5788
+ const onHandlePointerCancel = () => {
5789
+ if (!dragging) return;
5790
+ endDrag(false);
5791
+ };
5751
5792
  const state = open ? "open" : "closed";
5752
5793
  const hasTitle = title !== void 0 && title !== null;
5794
+ const sideClasses = isBottom ? "inset-x-0 bottom-0 w-full rounded-t-xl border-t border-hairline shadow-card data-[state=open]:translate-y-0 data-[state=closed]:translate-y-full" : side === "right" ? "inset-y-0 right-0 w-full border-l border-hairline shadow-modal sm:w-[var(--container-drawer,448px)] data-[state=open]:translate-x-0 data-[state=closed]:translate-x-full" : "inset-y-0 left-0 w-full border-r border-hairline shadow-modal sm:w-[var(--container-drawer,448px)] data-[state=open]:translate-x-0 data-[state=closed]:-translate-x-full";
5795
+ const scrimDragOpacity = dragging ? Math.max(0, 1 - dragOffset / Math.max(dragHeight.current, 1)) : void 0;
5753
5796
  const node = /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
5754
5797
  "div",
5755
5798
  {
5756
5799
  "data-state": state,
5757
- className: "fixed inset-0 data-[state=closed]:pointer-events-none",
5800
+ className: "fixed inset-0 overflow-hidden data-[state=closed]:pointer-events-none",
5758
5801
  style: { zIndex: "var(--z-modal, 1200)" },
5759
5802
  "aria-hidden": open ? void 0 : true,
5760
5803
  children: [
@@ -5763,7 +5806,11 @@ var Drawer = React46.forwardRef(
5763
5806
  {
5764
5807
  "data-state": state,
5765
5808
  "aria-hidden": "true",
5766
- className: "fixed inset-0 bg-scrim/40 transition-opacity duration-200 ease-out data-[state=open]:opacity-100 data-[state=closed]:opacity-0"
5809
+ className: cn35(
5810
+ dragging ? "transition-none" : "transition-opacity duration-200 ease-out",
5811
+ "fixed inset-0 bg-scrim/40 data-[state=open]:opacity-100 data-[state=closed]:opacity-0"
5812
+ ),
5813
+ style: scrimDragOpacity === void 0 ? void 0 : { opacity: scrimDragOpacity }
5767
5814
  }
5768
5815
  ),
5769
5816
  /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
@@ -5782,29 +5829,55 @@ var Drawer = React46.forwardRef(
5782
5829
  "data-side": side,
5783
5830
  "data-drawer": "",
5784
5831
  className: cn35(
5785
- "fixed inset-y-0 flex w-full flex-col overflow-hidden bg-canvas text-ink shadow-modal transition duration-200 ease-out sm:w-[var(--container-drawer,448px)]",
5786
- side === "right" ? "right-0 border-l border-hairline data-[state=closed]:translate-x-full" : "left-0 border-r border-hairline data-[state=closed]:-translate-x-full",
5787
- "data-[state=open]:translate-x-0 data-[state=closed]:invisible",
5832
+ "fixed flex flex-col overflow-hidden bg-canvas text-ink transition ease-out data-[state=closed]:invisible",
5833
+ sideClasses,
5788
5834
  className
5789
5835
  ),
5836
+ style: {
5837
+ maxHeight: isBottom ? "90dvh" : void 0,
5838
+ paddingBottom: isBottom ? "env(safe-area-inset-bottom, 0px)" : void 0,
5839
+ transform: isBottom && dragging && dragOffset > 0 ? `translateY(${dragOffset}px)` : void 0,
5840
+ transitionDuration: dragging ? "0ms" : "240ms"
5841
+ },
5790
5842
  ...rest,
5791
5843
  children: [
5792
- !hideHeader && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex shrink-0 items-center justify-between gap-sm px-base pb-sm pt-base", children: [
5793
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
5794
- headerStart,
5795
- hasTitle && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("h2", { id: titleId, className: "truncate text-heading-sm text-ink", children: title })
5796
- ] }),
5797
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5798
- IconButton,
5799
- {
5800
- icon: closeIcon,
5801
- variant: closeIcon === "x" ? "ghost" : "secondary",
5802
- size: "md",
5803
- "aria-label": closeLabel,
5804
- onClick: () => onOpenChange(false)
5805
- }
5806
- )
5807
- ] }),
5844
+ isBottom && showHandle && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5845
+ "div",
5846
+ {
5847
+ "aria-hidden": "true",
5848
+ onPointerDown: onHandlePointerDown,
5849
+ onPointerMove: onHandlePointerMove,
5850
+ onPointerUp: onHandlePointerUp,
5851
+ onPointerCancel: onHandlePointerCancel,
5852
+ className: "flex shrink-0 cursor-grab touch-none select-none items-center justify-center pb-xs pt-sm active:cursor-grabbing",
5853
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "h-1 w-10 rounded-full bg-hairline-strong" })
5854
+ }
5855
+ ),
5856
+ !hideHeader && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
5857
+ "div",
5858
+ {
5859
+ className: cn35(
5860
+ "flex shrink-0 items-center justify-between gap-sm px-base pb-sm",
5861
+ isBottom ? "pt-xs" : "pt-base"
5862
+ ),
5863
+ children: [
5864
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
5865
+ headerStart,
5866
+ hasTitle && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("h2", { id: titleId, className: "truncate text-heading-sm text-ink", children: title })
5867
+ ] }),
5868
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5869
+ IconButton,
5870
+ {
5871
+ icon: closeIcon,
5872
+ variant: closeIcon === "x" ? "ghost" : "secondary",
5873
+ size: "md",
5874
+ "aria-label": closeLabel,
5875
+ onClick: () => onOpenChange(false)
5876
+ }
5877
+ )
5878
+ ]
5879
+ }
5880
+ ),
5808
5881
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5809
5882
  "div",
5810
5883
  {
package/dist/index.js CHANGED
@@ -5555,6 +5555,7 @@ import * as React46 from "react";
5555
5555
  import { createPortal as createPortal5 } from "react-dom";
5556
5556
  import { jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
5557
5557
  var cn35 = (...parts) => parts.filter(Boolean).join(" ");
5558
+ var DISMISS_THRESHOLD = 0.3;
5558
5559
  var Drawer = React46.forwardRef(
5559
5560
  ({
5560
5561
  open,
@@ -5569,6 +5570,7 @@ var Drawer = React46.forwardRef(
5569
5570
  "aria-label": ariaLabel,
5570
5571
  closeOnScrimClick = true,
5571
5572
  bodyClassName,
5573
+ showHandle = true,
5572
5574
  className,
5573
5575
  children,
5574
5576
  ...rest
@@ -5577,6 +5579,20 @@ var Drawer = React46.forwardRef(
5577
5579
  const panelRef = React46.useRef(null);
5578
5580
  const [mounted, setMounted] = React46.useState(false);
5579
5581
  React46.useEffect(() => setMounted(true), []);
5582
+ const isBottom = side === "bottom";
5583
+ const [dragging, setDragging] = React46.useState(false);
5584
+ const [dragOffset, setDragOffset] = React46.useState(0);
5585
+ const dragStartY = React46.useRef(0);
5586
+ const dragHeight = React46.useRef(0);
5587
+ const endDrag = React46.useCallback(
5588
+ (close) => {
5589
+ const passed = dragOffset > (dragHeight.current || 0) * DISMISS_THRESHOLD;
5590
+ setDragging(false);
5591
+ setDragOffset(0);
5592
+ if (close && passed) onOpenChange(false);
5593
+ },
5594
+ [dragOffset, onOpenChange]
5595
+ );
5580
5596
  React46.useEffect(() => {
5581
5597
  if (!open) return;
5582
5598
  const onKey = (e) => {
@@ -5603,13 +5619,40 @@ var Drawer = React46.forwardRef(
5603
5619
  window.clearTimeout(t);
5604
5620
  };
5605
5621
  }, [open, onOpenChange, closeOnScrimClick]);
5622
+ const onHandlePointerDown = (e) => {
5623
+ if (!isBottom) return;
5624
+ dragStartY.current = e.clientY;
5625
+ dragHeight.current = panelRef.current?.getBoundingClientRect().height ?? 0;
5626
+ setDragging(true);
5627
+ setDragOffset(0);
5628
+ e.currentTarget.setPointerCapture?.(e.pointerId);
5629
+ };
5630
+ const onHandlePointerMove = (e) => {
5631
+ if (!dragging) return;
5632
+ const next = Math.max(0, e.clientY - dragStartY.current);
5633
+ setDragOffset(Math.min(next, dragHeight.current || next));
5634
+ };
5635
+ const onHandlePointerUp = (e) => {
5636
+ if (!dragging) return;
5637
+ try {
5638
+ e.currentTarget.releasePointerCapture?.(e.pointerId);
5639
+ } catch {
5640
+ }
5641
+ endDrag(true);
5642
+ };
5643
+ const onHandlePointerCancel = () => {
5644
+ if (!dragging) return;
5645
+ endDrag(false);
5646
+ };
5606
5647
  const state = open ? "open" : "closed";
5607
5648
  const hasTitle = title !== void 0 && title !== null;
5649
+ const sideClasses = isBottom ? "inset-x-0 bottom-0 w-full rounded-t-xl border-t border-hairline shadow-card data-[state=open]:translate-y-0 data-[state=closed]:translate-y-full" : side === "right" ? "inset-y-0 right-0 w-full border-l border-hairline shadow-modal sm:w-[var(--container-drawer,448px)] data-[state=open]:translate-x-0 data-[state=closed]:translate-x-full" : "inset-y-0 left-0 w-full border-r border-hairline shadow-modal sm:w-[var(--container-drawer,448px)] data-[state=open]:translate-x-0 data-[state=closed]:-translate-x-full";
5650
+ const scrimDragOpacity = dragging ? Math.max(0, 1 - dragOffset / Math.max(dragHeight.current, 1)) : void 0;
5608
5651
  const node = /* @__PURE__ */ jsxs40(
5609
5652
  "div",
5610
5653
  {
5611
5654
  "data-state": state,
5612
- className: "fixed inset-0 data-[state=closed]:pointer-events-none",
5655
+ className: "fixed inset-0 overflow-hidden data-[state=closed]:pointer-events-none",
5613
5656
  style: { zIndex: "var(--z-modal, 1200)" },
5614
5657
  "aria-hidden": open ? void 0 : true,
5615
5658
  children: [
@@ -5618,7 +5661,11 @@ var Drawer = React46.forwardRef(
5618
5661
  {
5619
5662
  "data-state": state,
5620
5663
  "aria-hidden": "true",
5621
- className: "fixed inset-0 bg-scrim/40 transition-opacity duration-200 ease-out data-[state=open]:opacity-100 data-[state=closed]:opacity-0"
5664
+ className: cn35(
5665
+ dragging ? "transition-none" : "transition-opacity duration-200 ease-out",
5666
+ "fixed inset-0 bg-scrim/40 data-[state=open]:opacity-100 data-[state=closed]:opacity-0"
5667
+ ),
5668
+ style: scrimDragOpacity === void 0 ? void 0 : { opacity: scrimDragOpacity }
5622
5669
  }
5623
5670
  ),
5624
5671
  /* @__PURE__ */ jsxs40(
@@ -5637,29 +5684,55 @@ var Drawer = React46.forwardRef(
5637
5684
  "data-side": side,
5638
5685
  "data-drawer": "",
5639
5686
  className: cn35(
5640
- "fixed inset-y-0 flex w-full flex-col overflow-hidden bg-canvas text-ink shadow-modal transition duration-200 ease-out sm:w-[var(--container-drawer,448px)]",
5641
- side === "right" ? "right-0 border-l border-hairline data-[state=closed]:translate-x-full" : "left-0 border-r border-hairline data-[state=closed]:-translate-x-full",
5642
- "data-[state=open]:translate-x-0 data-[state=closed]:invisible",
5687
+ "fixed flex flex-col overflow-hidden bg-canvas text-ink transition ease-out data-[state=closed]:invisible",
5688
+ sideClasses,
5643
5689
  className
5644
5690
  ),
5691
+ style: {
5692
+ maxHeight: isBottom ? "90dvh" : void 0,
5693
+ paddingBottom: isBottom ? "env(safe-area-inset-bottom, 0px)" : void 0,
5694
+ transform: isBottom && dragging && dragOffset > 0 ? `translateY(${dragOffset}px)` : void 0,
5695
+ transitionDuration: dragging ? "0ms" : "240ms"
5696
+ },
5645
5697
  ...rest,
5646
5698
  children: [
5647
- !hideHeader && /* @__PURE__ */ jsxs40("div", { className: "flex shrink-0 items-center justify-between gap-sm px-base pb-sm pt-base", children: [
5648
- /* @__PURE__ */ jsxs40("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
5649
- headerStart,
5650
- hasTitle && /* @__PURE__ */ jsx46("h2", { id: titleId, className: "truncate text-heading-sm text-ink", children: title })
5651
- ] }),
5652
- /* @__PURE__ */ jsx46(
5653
- IconButton,
5654
- {
5655
- icon: closeIcon,
5656
- variant: closeIcon === "x" ? "ghost" : "secondary",
5657
- size: "md",
5658
- "aria-label": closeLabel,
5659
- onClick: () => onOpenChange(false)
5660
- }
5661
- )
5662
- ] }),
5699
+ isBottom && showHandle && /* @__PURE__ */ jsx46(
5700
+ "div",
5701
+ {
5702
+ "aria-hidden": "true",
5703
+ onPointerDown: onHandlePointerDown,
5704
+ onPointerMove: onHandlePointerMove,
5705
+ onPointerUp: onHandlePointerUp,
5706
+ onPointerCancel: onHandlePointerCancel,
5707
+ className: "flex shrink-0 cursor-grab touch-none select-none items-center justify-center pb-xs pt-sm active:cursor-grabbing",
5708
+ children: /* @__PURE__ */ jsx46("span", { className: "h-1 w-10 rounded-full bg-hairline-strong" })
5709
+ }
5710
+ ),
5711
+ !hideHeader && /* @__PURE__ */ jsxs40(
5712
+ "div",
5713
+ {
5714
+ className: cn35(
5715
+ "flex shrink-0 items-center justify-between gap-sm px-base pb-sm",
5716
+ isBottom ? "pt-xs" : "pt-base"
5717
+ ),
5718
+ children: [
5719
+ /* @__PURE__ */ jsxs40("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
5720
+ headerStart,
5721
+ hasTitle && /* @__PURE__ */ jsx46("h2", { id: titleId, className: "truncate text-heading-sm text-ink", children: title })
5722
+ ] }),
5723
+ /* @__PURE__ */ jsx46(
5724
+ IconButton,
5725
+ {
5726
+ icon: closeIcon,
5727
+ variant: closeIcon === "x" ? "ghost" : "secondary",
5728
+ size: "md",
5729
+ "aria-label": closeLabel,
5730
+ onClick: () => onOpenChange(false)
5731
+ }
5732
+ )
5733
+ ]
5734
+ }
5735
+ ),
5663
5736
  /* @__PURE__ */ jsx46(
5664
5737
  "div",
5665
5738
  {
package/dist/styles.css CHANGED
@@ -1062,6 +1062,9 @@
1062
1062
  .cursor-default {
1063
1063
  cursor: default;
1064
1064
  }
1065
+ .cursor-grab {
1066
+ cursor: grab;
1067
+ }
1065
1068
  .cursor-not-allowed {
1066
1069
  cursor: not-allowed;
1067
1070
  }
@@ -1321,6 +1324,10 @@
1321
1324
  border-top-left-radius: var(--radius-lg);
1322
1325
  border-top-right-radius: var(--radius-lg);
1323
1326
  }
1327
+ .rounded-t-xl {
1328
+ border-top-left-radius: var(--radius-xl);
1329
+ border-top-right-radius: var(--radius-xl);
1330
+ }
1324
1331
  .rounded-t-xs {
1325
1332
  border-top-left-radius: var(--radius-xs);
1326
1333
  border-top-right-radius: var(--radius-xs);
@@ -1657,6 +1664,9 @@
1657
1664
  .py-xxs {
1658
1665
  padding-block: var(--spacing-xxs);
1659
1666
  }
1667
+ .pt-0 {
1668
+ padding-top: 0;
1669
+ }
1660
1670
  .pt-base {
1661
1671
  padding-top: var(--spacing-base);
1662
1672
  }
@@ -2024,6 +2034,9 @@
2024
2034
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
2025
2035
  transition-duration: var(--tw-duration, var(--default-transition-duration));
2026
2036
  }
2037
+ .transition-none {
2038
+ transition-property: none;
2039
+ }
2027
2040
  .duration-150 {
2028
2041
  --tw-duration: 150ms;
2029
2042
  transition-duration: 150ms;
@@ -2476,6 +2489,11 @@
2476
2489
  }
2477
2490
  }
2478
2491
  }
2492
+ .active\:cursor-grabbing {
2493
+ &:active {
2494
+ cursor: grabbing;
2495
+ }
2496
+ }
2479
2497
  .active\:bg-surface-strong {
2480
2498
  &:active {
2481
2499
  background-color: var(--color-surface-strong);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designa8/vibedesign-linear-internal-v1-b737",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "description": "Complete design system \"My Project linear-internal-v1\" generated by Atoms Design.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -3,14 +3,17 @@ import { createPortal } from "react-dom";
3
3
  import { IconButton } from "../IconButton";
4
4
  import type { IconName } from "../Icon";
5
5
 
6
- export type DrawerSide = "left" | "right";
6
+ export type DrawerSide = "left" | "right" | "bottom";
7
7
 
8
8
  export interface DrawerProps
9
9
  extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
10
10
  /** Controlled open state. */
11
11
  open: boolean;
12
12
  onOpenChange: (open: boolean) => void;
13
- /** Edge the panel is pinned to and slides in from. */
13
+ /**
14
+ * Edge the panel is pinned to and slides in from. `"bottom"` renders a
15
+ * content-sized sheet pinned to the bottom edge (mobile action sheet).
16
+ */
14
17
  side?: DrawerSide;
15
18
  /** Title shown in the default header row; also the dialog's accessible name. */
16
19
  title?: React.ReactNode;
@@ -29,11 +32,19 @@ export interface DrawerProps
29
32
  closeOnScrimClick?: boolean;
30
33
  /** Class for the scrolling body. */
31
34
  bodyClassName?: string;
35
+ /**
36
+ * Show the drag handle above the header. Defaults to true for
37
+ * `side="bottom"`; ignored for `left` / `right`.
38
+ */
39
+ showHandle?: boolean;
32
40
  }
33
41
 
34
42
  const cn = (...parts: Array<string | false | null | undefined>) =>
35
43
  parts.filter(Boolean).join(" ");
36
44
 
45
+ /** Fraction of the sheet height a downward drag must pass to dismiss. */
46
+ const DISMISS_THRESHOLD = 0.3;
47
+
37
48
  export const Drawer = React.forwardRef<HTMLDivElement, DrawerProps>(
38
49
  (
39
50
  {
@@ -49,6 +60,7 @@ export const Drawer = React.forwardRef<HTMLDivElement, DrawerProps>(
49
60
  "aria-label": ariaLabel,
50
61
  closeOnScrimClick = true,
51
62
  bodyClassName,
63
+ showHandle = true,
52
64
  className,
53
65
  children,
54
66
  ...rest
@@ -60,6 +72,25 @@ export const Drawer = React.forwardRef<HTMLDivElement, DrawerProps>(
60
72
  const [mounted, setMounted] = React.useState(false);
61
73
  React.useEffect(() => setMounted(true), []);
62
74
 
75
+ const isBottom = side === "bottom";
76
+
77
+ /** Drag-to-dismiss state (bottom sheet only). */
78
+ const [dragging, setDragging] = React.useState(false);
79
+ const [dragOffset, setDragOffset] = React.useState(0);
80
+ const dragStartY = React.useRef(0);
81
+ const dragHeight = React.useRef(0);
82
+
83
+ const endDrag = React.useCallback(
84
+ (close: boolean) => {
85
+ const passed =
86
+ dragOffset > (dragHeight.current || 0) * DISMISS_THRESHOLD;
87
+ setDragging(false);
88
+ setDragOffset(0);
89
+ if (close && passed) onOpenChange(false);
90
+ },
91
+ [dragOffset, onOpenChange],
92
+ );
93
+
63
94
  React.useEffect(() => {
64
95
  if (!open) return;
65
96
  const onKey = (e: KeyboardEvent) => {
@@ -88,20 +119,65 @@ export const Drawer = React.forwardRef<HTMLDivElement, DrawerProps>(
88
119
  };
89
120
  }, [open, onOpenChange, closeOnScrimClick]);
90
121
 
122
+ const onHandlePointerDown = (e: React.PointerEvent<HTMLDivElement>) => {
123
+ if (!isBottom) return;
124
+ dragStartY.current = e.clientY;
125
+ dragHeight.current = panelRef.current?.getBoundingClientRect().height ?? 0;
126
+ setDragging(true);
127
+ setDragOffset(0);
128
+ e.currentTarget.setPointerCapture?.(e.pointerId);
129
+ };
130
+
131
+ const onHandlePointerMove = (e: React.PointerEvent<HTMLDivElement>) => {
132
+ if (!dragging) return;
133
+ const next = Math.max(0, e.clientY - dragStartY.current);
134
+ setDragOffset(Math.min(next, dragHeight.current || next));
135
+ };
136
+
137
+ const onHandlePointerUp = (e: React.PointerEvent<HTMLDivElement>) => {
138
+ if (!dragging) return;
139
+ try {
140
+ e.currentTarget.releasePointerCapture?.(e.pointerId);
141
+ } catch {
142
+ /* pointer already released */
143
+ }
144
+ endDrag(true);
145
+ };
146
+
147
+ const onHandlePointerCancel = () => {
148
+ if (!dragging) return;
149
+ endDrag(false);
150
+ };
151
+
91
152
  const state = open ? "open" : "closed";
92
153
  const hasTitle = title !== undefined && title !== null;
93
154
 
155
+ const sideClasses = isBottom
156
+ ? "inset-x-0 bottom-0 w-full rounded-t-xl border-t border-hairline shadow-card data-[state=open]:translate-y-0 data-[state=closed]:translate-y-full"
157
+ : side === "right"
158
+ ? "inset-y-0 right-0 w-full border-l border-hairline shadow-modal sm:w-[var(--container-drawer,448px)] data-[state=open]:translate-x-0 data-[state=closed]:translate-x-full"
159
+ : "inset-y-0 left-0 w-full border-r border-hairline shadow-modal sm:w-[var(--container-drawer,448px)] data-[state=open]:translate-x-0 data-[state=closed]:-translate-x-full";
160
+
161
+ /** Scrim opacity tracks the drag one-to-one, then hands back to the state fade. */
162
+ const scrimDragOpacity = dragging
163
+ ? Math.max(0, 1 - dragOffset / Math.max(dragHeight.current, 1))
164
+ : undefined;
165
+
94
166
  const node = (
95
167
  <div
96
168
  data-state={state}
97
- className="fixed inset-0 data-[state=closed]:pointer-events-none"
169
+ className="fixed inset-0 overflow-hidden data-[state=closed]:pointer-events-none"
98
170
  style={{ zIndex: "var(--z-modal, 1200)" }}
99
171
  aria-hidden={open ? undefined : true}
100
172
  >
101
173
  <div
102
174
  data-state={state}
103
175
  aria-hidden="true"
104
- className="fixed inset-0 bg-scrim/40 transition-opacity duration-200 ease-out data-[state=open]:opacity-100 data-[state=closed]:opacity-0"
176
+ className={cn(
177
+ dragging ? "transition-none" : "transition-opacity duration-200 ease-out",
178
+ "fixed inset-0 bg-scrim/40 data-[state=open]:opacity-100 data-[state=closed]:opacity-0",
179
+ )}
180
+ style={scrimDragOpacity === undefined ? undefined : { opacity: scrimDragOpacity }}
105
181
  />
106
182
  <div
107
183
  ref={(el) => {
@@ -117,17 +193,40 @@ export const Drawer = React.forwardRef<HTMLDivElement, DrawerProps>(
117
193
  data-side={side}
118
194
  data-drawer=""
119
195
  className={cn(
120
- "fixed inset-y-0 flex w-full flex-col overflow-hidden bg-canvas text-ink shadow-modal transition duration-200 ease-out sm:w-[var(--container-drawer,448px)]",
121
- side === "right"
122
- ? "right-0 border-l border-hairline data-[state=closed]:translate-x-full"
123
- : "left-0 border-r border-hairline data-[state=closed]:-translate-x-full",
124
- "data-[state=open]:translate-x-0 data-[state=closed]:invisible",
196
+ "fixed flex flex-col overflow-hidden bg-canvas text-ink transition ease-out data-[state=closed]:invisible",
197
+ sideClasses,
125
198
  className,
126
199
  )}
200
+ style={{
201
+ maxHeight: isBottom ? "90dvh" : undefined,
202
+ paddingBottom: isBottom ? "env(safe-area-inset-bottom, 0px)" : undefined,
203
+ transform:
204
+ isBottom && dragging && dragOffset > 0
205
+ ? `translateY(${dragOffset}px)`
206
+ : undefined,
207
+ transitionDuration: dragging ? "0ms" : "240ms",
208
+ }}
127
209
  {...rest}
128
210
  >
211
+ {isBottom && showHandle && (
212
+ <div
213
+ aria-hidden="true"
214
+ onPointerDown={onHandlePointerDown}
215
+ onPointerMove={onHandlePointerMove}
216
+ onPointerUp={onHandlePointerUp}
217
+ onPointerCancel={onHandlePointerCancel}
218
+ className="flex shrink-0 cursor-grab touch-none select-none items-center justify-center pb-xs pt-sm active:cursor-grabbing"
219
+ >
220
+ <span className="h-1 w-10 rounded-full bg-hairline-strong" />
221
+ </div>
222
+ )}
129
223
  {!hideHeader && (
130
- <div className="flex shrink-0 items-center justify-between gap-sm px-base pb-sm pt-base">
224
+ <div
225
+ className={cn(
226
+ "flex shrink-0 items-center justify-between gap-sm px-base pb-sm",
227
+ isBottom ? "pt-xs" : "pt-base",
228
+ )}
229
+ >
131
230
  <div className="flex min-w-0 flex-1 items-center gap-sm">
132
231
  {headerStart}
133
232
  {hasTitle && (
@@ -8,6 +8,7 @@ import { Avatar } from "../Avatar";
8
8
  import { Input } from "../Input";
9
9
  import { Dropdown } from "../Dropdown";
10
10
  import { DatePickerInput } from "../DatePickerInput";
11
+ import { MenuItem } from "../MenuItem";
11
12
 
12
13
  const NAV: Array<{ label: string; icon: IconName }> = [
13
14
  { label: "Inbox", icon: "inbox" },
@@ -16,14 +17,23 @@ const NAV: Array<{ label: string; icon: IconName }> = [
16
17
  { label: "Views", icon: "layers" },
17
18
  ];
18
19
 
20
+ const PROJECT_ACTIONS: Array<{ label: string; icon: IconName }> = [
21
+ { label: "Open project", icon: "box" },
22
+ { label: "Project settings", icon: "settings" },
23
+ { label: "Share project", icon: "users" },
24
+ { label: "Archive project", icon: "archive" },
25
+ ];
26
+
19
27
  export default function DrawerPreview() {
20
28
  const [navOpen, setNavOpen] = React.useState(false);
21
29
  const [issueOpen, setIssueOpen] = React.useState(false);
30
+ const [sheetOpen, setSheetOpen] = React.useState(false);
22
31
  const [active, setActive] = React.useState("Inbox");
23
32
  const [title, setTitle] = React.useState("Create a habit tracker");
24
33
  const [assignee, setAssignee] = React.useState<string | null>("me");
25
34
  const [status, setStatus] = React.useState<string | null>("backlog");
26
35
  const [due, setDue] = React.useState<Date | null>(new Date(2026, 2, 30));
36
+ const [lastAction, setLastAction] = React.useState<string | null>(null);
27
37
 
28
38
  return (
29
39
  <div className="w-full max-w-3xl mx-auto p-lg">
@@ -47,6 +57,23 @@ export default function DrawerPreview() {
47
57
  </Button>
48
58
  </div>
49
59
 
60
+ <div className="mt-md flex flex-wrap items-center justify-between gap-md rounded-xl border border-hairline bg-surface p-base">
61
+ <div className="min-w-0">
62
+ <p className="text-body-md text-ink">Habit tracker</p>
63
+ <p className="text-body-sm text-muted">
64
+ {lastAction ? `Last action: ${lastAction}` : "Bottom sheet project menu, drag the handle to dismiss"}
65
+ </p>
66
+ </div>
67
+ <Button
68
+ variant="secondary"
69
+ leadingIcon={<Icon name="ellipsis" size={16} />}
70
+ aria-expanded={sheetOpen}
71
+ onClick={() => setSheetOpen(true)}
72
+ >
73
+ Project actions
74
+ </Button>
75
+ </div>
76
+
50
77
  <Drawer
51
78
  open={navOpen}
52
79
  onOpenChange={setNavOpen}
@@ -134,6 +161,41 @@ export default function DrawerPreview() {
134
161
  <DatePickerInput aria-label="Due date" value={due} onValueChange={setDue} />
135
162
  </div>
136
163
  </Drawer>
164
+
165
+ <Drawer
166
+ open={sheetOpen}
167
+ onOpenChange={setSheetOpen}
168
+ side="bottom"
169
+ aria-label="Project actions"
170
+ closeLabel="Dismiss project actions"
171
+ headerStart={
172
+ <div className="flex min-w-0 flex-col">
173
+ <span className="truncate text-body-md text-ink">Habit tracker</span>
174
+ <span className="truncate text-body-sm text-muted">4 actions available</span>
175
+ </div>
176
+ }
177
+ bodyClassName="px-xs pb-xs pt-0"
178
+ >
179
+ <div
180
+ role="menu"
181
+ aria-label="Project actions"
182
+ className="flex flex-col gap-xxs"
183
+ >
184
+ {PROJECT_ACTIONS.map((action) => (
185
+ <MenuItem
186
+ key={action.label}
187
+ icon={action.icon}
188
+ className="h-11"
189
+ onClick={() => {
190
+ setLastAction(action.label);
191
+ setSheetOpen(false);
192
+ }}
193
+ >
194
+ {action.label}
195
+ </MenuItem>
196
+ ))}
197
+ </div>
198
+ </Drawer>
137
199
  </div>
138
200
  );
139
201
  }