@brett_lamy/ui 3.1.0 → 4.0.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/README.md CHANGED
@@ -68,13 +68,13 @@ If `items` is omitted or empty, the component retains its A-Z form:
68
68
 
69
69
  ## Exports
70
70
 
71
- - Containers: `NavigationStack`, `SplitView`, `Credenza`, `SideDrawer`, `EdgeDrawer`, `AdaptivePane`, `Sidebar`
71
+ - Containers: `NavigationStack`, `SplitView`, `Credenza`, `SideDrawer`, `AdaptivePane`, `Sidebar`
72
72
  - Lists and navigation: `List`, `List.Section`, `List.Row`, `IndexBar`, `TabBar`, `TabView`, `EditBar`
73
73
  - Inputs and feedback: `SearchField`, `Switch`, `Segmented`, plus shadcn-style primitives (`Button`, `Dialog`, `Sheet`, `Select`, `ComboBox`, `Tabs`, …)
74
74
  - Motion: `springs`, `springCss`, `TextMorph`, `NumberMorph`, `AnimatedHeight`, `ContentSwap`, `Celebrate`
75
75
  - Foundations: `BLProvider`, `ThemeScope`, `AppearanceProvider`, `Icon`, `Avatar`, `Spinner`
76
76
  - Team chat: `ChatShell` and its regions (`ChatShellNav`, `ChatShellSidebar`, `ChatShellMain`, `ChatShellHeader`, `ChatShellAside`, `ChatShellPanel`…), `FloatingSheet`, `FloatingChat`, `ChatColumn`, `ArtifactChatContainer` (the Discord parts — channels, messages, threads, members — live in the `discord-clone` registry block)
77
- - Workbench: `WorkbenchShell` and its parts (`WorkbenchSidebar`, `WorkbenchMain`, `WorkbenchHeader`, `WorkbenchDock`, `WorkbenchPanel`, `WorkbenchTabBar`, …), conversation parts (`Conversation`, `UserMessage`, `AssistantMessage`, `WorkLog`, `ToolCall`, …), `TerminalHeader` / `TerminalBody`, surfaces (`SurfacePicker`, `SurfaceBrowser`, `SurfaceFiles`, `SurfaceDiff`, `SurfaceAgents`), `Composer` and its parts, `ModelPicker`, `MessageScroller`, `SnapSheet`, `MarkdownView`
77
+ - Workbench: `WorkbenchShell` and its parts (`WorkbenchSidebar`, `WorkbenchMain`, `WorkbenchHeader`, `WorkbenchDock`, `WorkbenchPanel`, `WorkbenchTabBar`, …), conversation parts (`Conversation`, `UserMessage`, `AssistantMessage`, `WorkLog`, `ToolCall`, …), `TerminalHeader` / `TerminalBody`, surfaces (`SurfacePicker`, `SurfaceBrowser`, `SurfaceFiles`, `SurfaceDiff`, `SurfaceAgents`), `Composer` and its parts, `ModelPicker`, `MessageScroller`, `MarkdownView`
78
78
  - Demo apps: `MapChatDemo`, `DeliveryTrackingDemo`, `SidebarDemo` (full apps — Discord, T3 Code, GitHub — are registry blocks)
79
79
 
80
80
  Every component exports its props type from the package root. See the Storybook catalog for interaction and responsive examples.
@@ -140,7 +140,7 @@ export function Chat() {
140
140
 
141
141
  ## Workbench
142
142
 
143
- An adaptive IDE scaffold built from parts: a thin `WorkbenchShell` root that measures itself and owns region state, and parts you place yourself. Each part picks its presentation from the shell's width class — desktop columns (1120px and wider), a right-edge panel drawer (760–1119px), or a hamburger sidebar, compact panel page, bottom tab bar, and snap-sheet dock below that — measured from the shell's own container, not the viewport. The full T3 Code-style app is the `t3-clone` registry block.
143
+ An adaptive IDE scaffold built from parts: a thin `WorkbenchShell` root that measures itself and owns region state, and parts you place yourself. Each part picks its presentation from the shell's width class — desktop columns (1120px and wider), a right-edge panel drawer (760–1119px), or a hamburger sidebar, compact panel page, bottom tab bar, and dismissible-sheet dock below that — measured from the shell's own container, not the viewport. The full T3 Code-style app is the `t3-clone` registry block.
144
144
 
145
145
  ```tsx
146
146
  import {
@@ -1 +1 @@
1
- {"version":3,"file":"edge-drawer.d.ts","sourceRoot":"","sources":["../../src/components/edge-drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAOlE,4GAA4G;AAC5G,eAAO,MAAM,kBAAkB;;;;8EAgB9B,C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GAAG,OAAO,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;oCACgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAID,wBAAgB,UAAU,CAAC,EACzB,IAAa,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAW,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EACzF,QAAQ,EAAE,SAAS,EAAE,KAAK,GAC3B,EAAE,eAAe,2CAuCjB"}
@@ -37,6 +37,8 @@ export declare function sheetToneProps(tone: FloatingSheetTone): {
37
37
  'data-theme-scope'?: 'sheet';
38
38
  className?: string;
39
39
  };
40
+ /** A size as pixels, or (`'52%'`) a share of the host's height. */
41
+ export type FloatingSheetSize = number | `${number}%`;
40
42
  export interface FloatingSheetProps {
41
43
  /** Controlled state for the fully grown sheet. */
42
44
  open?: boolean;
@@ -44,9 +46,20 @@ export interface FloatingSheetProps {
44
46
  onOpenChange?: (open: boolean) => void;
45
47
  /**
46
48
  * Height of body kept visible above the foot while closed, so a summary (the newest chat
47
- * reply, an order status) peeks out. `0` rests on the foot alone.
49
+ * reply, an order status) peeks out. `0` rests on the foot alone. `'52%'` sizes the whole resting sheet
50
+ * (cap and foot included) as a share of the host instead.
48
51
  */
49
- peek?: number;
52
+ peek?: FloatingSheetSize;
53
+ /** Space left above the sheet when fully grown, so the page behind still shows (and the top corners stay round). */
54
+ topGap?: FloatingSheetSize;
55
+ /**
56
+ * Make it a bottom sheet that can be put away: dragging below the resting height slides it off the edge
57
+ * (and calls `onDismiss`) instead of folding it into a FAB. Show it again with `visible`.
58
+ */
59
+ dismissible?: boolean;
60
+ /** Whether a `dismissible` sheet is on screen. Controlled: set it to `false` in `onDismiss`. */
61
+ visible?: boolean;
62
+ onDismiss?: () => void;
50
63
  /** Inset from the host edges while closed. `0` docks the sheet edge to edge like a system sheet. */
51
64
  gutter?: number;
52
65
  /** Corner radius while closed. Grows square as the sheet fills the host. */
@@ -65,9 +78,10 @@ export interface FloatingSheetProps {
65
78
  bodyAlign?: 'start' | 'end';
66
79
  /**
67
80
  * Extra resting heights between the peek and full, as fractions (0–1) of the fully grown body — e.g.
68
- * `[0.5]` for a half-height detent. A drag releases to whichever stop its velocity carries it nearest.
81
+ * `[0.5]` for a half-height detent — or (`'70%'`) as a share of the host. A drag releases to whichever stop its
82
+ * velocity carries it nearest.
69
83
  */
70
- detents?: number[];
84
+ detents?: (number | `${number}%`)[];
71
85
  /** Allow dragging below the resting height to fold the sheet into a FAB. */
72
86
  minimizable?: boolean;
73
87
  /** Resting position of the FAB. */
@@ -84,6 +98,8 @@ export interface FloatingSheetProps {
84
98
  label?: string;
85
99
  children?: ReactNode;
86
100
  className?: string;
101
+ /** Classes for the sheet surface itself (the card), merged last — e.g. `bg-background`. */
102
+ surfaceClassName?: string;
87
103
  style?: CSSProperties;
88
104
  }
89
105
  /**
@@ -92,7 +108,7 @@ export interface FloatingSheetProps {
92
108
  * resting height to fold it into a FAB. The `Body` slot is the growing region and the `Foot`
93
109
  * slot stays pinned at the bottom (a composer, actions, nothing at all).
94
110
  */
95
- export declare function FloatingSheet({ open: controlledOpen, defaultOpen, onOpenChange, peek: requestedPeek, gutter, radius, appearance, tone: toneProp, bodyAlign, detents, minimizable, fabPosition, fabIcon, hideOnScroll, scrollRef, scrim, label, children, className, style, }: FloatingSheetProps): import("react/jsx-runtime").JSX.Element;
111
+ export declare function FloatingSheet({ open: controlledOpen, defaultOpen, onOpenChange, peek: requestedPeek, topGap, dismissible, visible, onDismiss, gutter, radius, appearance, tone: toneProp, bodyAlign, detents, minimizable, fabPosition, fabIcon, hideOnScroll, scrollRef, scrim, label, children, className, surfaceClassName, style, }: FloatingSheetProps): import("react/jsx-runtime").JSX.Element;
96
112
  export declare namespace FloatingSheet {
97
113
  var Body: import("@/lib/container").SlotComponent;
98
114
  var Foot: import("@/lib/container").SlotComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"floating-sheet.d.ts","sourceRoot":"","sources":["../../src/components/floating-sheet.tsx"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AASf,MAAM,MAAM,wBAAwB,GAChC,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,CAAC;AAEnB,kFAAkF;AAClF,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,OAAO,CAAC;AACxD;4EAC4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1D,MAAM,WAAW,yBAAyB;IACxC,sDAAsD;IACtD,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAID,wBAAgB,gBAAgB,IAAI,yBAAyB,CAM5D;AA0BD;;gHAEgH;AAChH,eAAO,MAAM,4BAA4B;;;;8EAwBvC,CAA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C,EAAE,aAAa,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EAAE,cAAc,EACpB,WAAmB,EACnB,YAAY,EACZ,IAAI,EAAE,aAAiB,EACvB,MAAW,EACX,MAAW,EACX,UAAoB,EACpB,IAAI,EAAE,QAAQ,EACd,SAAmB,EACnB,OAAO,EACP,WAAkB,EAClB,WAA6B,EAC7B,OAAO,EACP,YAAmB,EACnB,SAAS,EACT,KAAY,EACZ,KAAe,EACf,QAAQ,EACR,SAAS,EACT,KAAK,GACN,EAAE,kBAAkB,2CAuRpB;yBA5Se,aAAa"}
1
+ {"version":3,"file":"floating-sheet.d.ts","sourceRoot":"","sources":["../../src/components/floating-sheet.tsx"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AASf,MAAM,MAAM,wBAAwB,GAChC,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,CAAC;AAEnB,kFAAkF;AAClF,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,OAAO,CAAC;AACxD;4EAC4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1D,MAAM,WAAW,yBAAyB;IACxC,sDAAsD;IACtD,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAID,wBAAgB,gBAAgB,IAAI,yBAAyB,CAM5D;AA2BD;;gHAEgH;A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D;IAC3D,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,0FAA0F;IAC1F,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC1C,iDAAiD;IACjD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2FAA2F;IAC3F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAMD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EAAE,cAAc,EACpB,WAAmB,EACnB,YAAY,EACZ,IAAI,EAAE,aAAiB,EACvB,MAAU,EACV,WAAmB,EACnB,OAAc,EACd,SAAS,EACT,MAAW,EACX,MAAW,EACX,UAAoB,EACpB,IAAI,EAAE,QAAQ,EACd,SAAmB,EACnB,OAAO,EACP,WAAkB,EAClB,WAA6B,EAC7B,OAAO,EACP,YAAmB,EACnB,SAAS,EACT,KAAY,EACZ,KAAe,EACf,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,KAAK,GACN,EAAE,kBAAkB,2CA8SpB;yBAxUe,aAAa"}
@@ -5,38 +5,38 @@ import { themeScopeClass as n, useAppearance as r, useChromeHidden as ee } from
5
5
  import { collectSlots as te, defineSlot as i } from "../lib/container.js";
6
6
  import { useSheetDrag as ne } from "../lib/sheet-drag.js";
7
7
  import { createContext as a, useContext as o, useEffect as s, useId as re, useRef as c, useState as l } from "react";
8
- import { jsx as u, jsxs as ie } from "react/jsx-runtime";
9
- import { Button as ae } from "react-aria-components";
10
- import { cva as d } from "class-variance-authority";
8
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
+ import { Button as ie } from "react-aria-components";
10
+ import { cva as f } from "class-variance-authority";
11
11
  //#region src/components/floating-sheet.tsx
12
- var f = a(null);
13
- function p() {
14
- let e = o(f);
12
+ var p = a(null);
13
+ function m() {
14
+ let e = o(p);
15
15
  if (!e) throw Error("useFloatingSheet must be used within <FloatingSheet>");
16
16
  return e;
17
17
  }
18
- var oe = 18, m = 2, h = 52, g = "ck-floating-sheet__surface pointer-events-auto absolute bottom-[var(--ck-sheet-bottom-gutter,20px)] left-1/2 z-2 box-border flex h-[var(--ck-sheet-height,auto)] w-[var(--ck-sheet-width,calc(100%_-_40px))] min-w-0 flex-col overflow-hidden rounded-t-[var(--ck-sheet-radius,28px)] rounded-b-[var(--ck-sheet-radius-bottom,28px)] border motion-reduce:animate-none motion-reduce:[transition:none]!", _ = [
18
+ var ae = 18, h = 2, g = 52, _ = "ck-floating-sheet__surface pointer-events-auto absolute bottom-[var(--ck-sheet-bottom-gutter,20px)] left-1/2 z-2 box-border flex h-[var(--ck-sheet-height,auto)] w-[var(--ck-sheet-width,calc(100%_-_40px))] min-w-0 flex-col overflow-hidden rounded-t-[var(--ck-sheet-radius,28px)] rounded-b-[var(--ck-sheet-radius-bottom,28px)] border motion-reduce:animate-none motion-reduce:[transition:none]!", v = [
19
19
  "width",
20
20
  "height",
21
21
  "bottom",
22
22
  "border-radius"
23
- ], v = [
23
+ ], y = [
24
24
  "left",
25
25
  "right",
26
26
  "top",
27
27
  "transform"
28
- ], se = [
28
+ ], b = [
29
29
  "background-color",
30
30
  "border-color",
31
31
  "box-shadow",
32
32
  "backdrop-filter",
33
33
  "color"
34
- ], ce = (e) => [
35
- t(v, "smooth"),
36
- t(se, "smooth"),
34
+ ], oe = (e, n) => [
35
+ t(n ? y.filter((e) => e !== "transform") : y, "smooth"),
36
+ t(b, "smooth"),
37
37
  t("opacity", "snappy"),
38
- e ? "" : t(_, "tray")
39
- ].filter(Boolean).join(", "), y = d(g, {
38
+ e ? "" : t(v, "tray")
39
+ ].filter(Boolean).join(", "), se = f(_, {
40
40
  variants: {
41
41
  appearance: {
42
42
  glass: "border-[color:rgba(var(--ck-sheet-line),var(--ck-sheet-border-alpha,.12))] bg-[color:rgba(var(--ck-sheet-surface),var(--ck-sheet-bg-alpha,.28))] bg-[linear-gradient(180deg,color-mix(in_srgb,var(--color-white)_8%,transparent),color-mix(in_srgb,var(--color-white)_1.8%,transparent)_34%,color-mix(in_srgb,var(--color-white)_2.6%,transparent))] [box-shadow:inset_0_1px_0_color-mix(in_srgb,var(--color-white)_14%,transparent),inset_0_-1px_0_color-mix(in_srgb,var(--color-white)_3%,transparent),0_2px_10px_color-mix(in_srgb,var(--color-black)_12%,transparent),0_var(--ck-sheet-shadow-y,14px)_var(--ck-sheet-shadow-blur,34px)_-12px_rgba(0,0,0,var(--ck-sheet-shadow-alpha,.22))]",
@@ -64,7 +64,7 @@ var oe = 18, m = 2, h = 52, g = "ck-floating-sheet__surface pointer-events-auto
64
64
  placement: "resting",
65
65
  hidden: !1
66
66
  }
67
- }), b = d("ck-floating-sheet pointer-events-none absolute inset-0 z-40 text-foreground [font-family:var(--bl-font,-apple-system,BlinkMacSystemFont,\"SF_Pro_Text\",sans-serif)]", {
67
+ }), x = f("ck-floating-sheet pointer-events-none absolute inset-0 z-40 text-foreground [font-family:var(--bl-font,-apple-system,BlinkMacSystemFont,\"SF_Pro_Text\",sans-serif)]", {
68
68
  variants: { tone: {
69
69
  auto: "[--ck-sheet-line:255,255,255] [--ck-sheet-surface:18,18,22]",
70
70
  dark: "[--ck-sheet-line:255,255,255] [--ck-sheet-surface:18,18,22]",
@@ -72,27 +72,28 @@ var oe = 18, m = 2, h = 52, g = "ck-floating-sheet__surface pointer-events-auto
72
72
  } },
73
73
  defaultVariants: { tone: "auto" }
74
74
  });
75
- function x(e) {
75
+ function S(e) {
76
76
  return e === "auto" ? {} : {
77
77
  "data-theme-scope": "sheet",
78
78
  className: n(e)
79
79
  };
80
80
  }
81
- function S({ open: n, defaultOpen: i = !1, onOpenChange: a, peek: o = 0, gutter: d = 20, radius: p = 28, appearance: g = "glass", tone: _, bodyAlign: v = "start", detents: se, minimizable: S = !0, fabPosition: C = "bottom-center", fabIcon: le, hideOnScroll: w = !0, scrollRef: T, scrim: ue = !0, label: de = "Sheet", children: fe, className: pe, style: me }) {
82
- let he = r(), E = _ ?? he ?? "auto", D = x(E), O = c(null), k = c(null), [A, ge] = l(430), [_e, ve] = l(800), [ye, be] = l(0), [xe, Se] = l(i), [j, M] = l(!1), [Ce, N] = l(!1), we = ee(), P = n ?? xe, F = re(), I = (e) => {
83
- n ?? Se(e), a?.(e);
81
+ var ce = (e, t, n) => Math.max(0, t * Number.parseFloat(e) / 100 - n);
82
+ function C({ open: n, defaultOpen: i = !1, onOpenChange: a, peek: o = 0, topGap: f = 0, dismissible: m = !1, visible: _ = !0, onDismiss: v, gutter: y = 20, radius: b = 28, appearance: C = "glass", tone: le, bodyAlign: ue = "start", detents: de, minimizable: fe = !0, fabPosition: pe = "bottom-center", fabIcon: me, hideOnScroll: w = !0, scrollRef: he, scrim: ge = !0, label: _e = "Sheet", children: ve, className: ye, surfaceClassName: be, style: xe }) {
83
+ let Se = r(), T = le ?? Se ?? "auto", E = S(T), D = c(null), O = c(null), [k, Ce] = l(430), [A, we] = l(800), [Te, Ee] = l(0), [De, Oe] = l(i), [j, M] = l(!1), [ke, N] = l(!1), Ae = ee(), P = n ?? De, F = re(), I = (e) => {
84
+ n ?? Oe(e), a?.(e);
84
85
  };
85
86
  s(() => {
86
- let e = O.current, t = k.current;
87
+ let e = D.current, t = O.current;
87
88
  if (!e) return;
88
89
  let n = () => {
89
- ge(e.offsetWidth), ve(e.offsetHeight), be(t?.offsetHeight ?? 0);
90
+ Ce(e.offsetWidth), we(e.offsetHeight), Ee(t?.offsetHeight ?? 0);
90
91
  };
91
92
  if (n(), typeof ResizeObserver > "u") return;
92
93
  let r = new ResizeObserver(n);
93
94
  return r.observe(e), t && r.observe(t), () => r.disconnect();
94
95
  }, []), s(() => {
95
- let e = T?.current;
96
+ let e = he?.current;
96
97
  if (!e || !w) {
97
98
  N(!1);
98
99
  return;
@@ -102,70 +103,75 @@ function S({ open: n, defaultOpen: i = !1, onOpenChange: a, peek: o = 0, gutter:
102
103
  t = n, n < 4 ? N(!1) : r > 3 ? N(!0) : r < -3 && N(!1);
103
104
  };
104
105
  return e.addEventListener("scroll", n, { passive: !0 }), () => e.removeEventListener("scroll", n);
105
- }, [T, w]);
106
- let L = ye + oe, R = Math.max(0, _e - L - m), z = Math.max(0, Math.min(o, R * .75)), B = ne({
106
+ }, [he, w]);
107
+ let L = Te + ae, R = L + h, z = typeof f == "string" ? A * Number.parseFloat(f) / 100 : f, B = Math.max(0, A - R - z), je = typeof o == "string" ? ce(o, A, R) : o, V = Math.max(0, Math.min(je, B * .75)), H = R + V + y + 48, U = ne({
107
108
  open: P,
108
109
  onOpenChange: I,
109
- peek: z,
110
- maxReveal: R,
111
- detents: se?.map((e) => Math.round(Math.max(0, Math.min(1, e)) * R)),
112
- minimizable: S,
113
- minimized: j,
114
- onMinimizedChange: M
115
- }), { reveal: V, dragging: H, settling: Te } = B, U = H || Te, W = V > 0, G = R > z ? Math.max(0, (V - z) / (R - z)) : 0, K = B.minimize, q = Math.max(h, A - d * 2), J = q + (A - q) * G, Ee = J + (h - J) * K, Y = L + V + m, De = Y + (h - Y) * K, X = p * (1 - G), Z = X + (h / 2 - X) * K, Oe = d > 0 ? Z : h / 2 * K, ke = c(() => I(!1));
116
- ke.current = () => I(!1), s(() => {
110
+ peek: V,
111
+ maxReveal: B,
112
+ detents: de?.map((e) => typeof e == "string" ? ce(e, A, R) : Math.round(Math.max(0, Math.min(1, e)) * B)),
113
+ minimizable: fe || m,
114
+ minimized: m ? !_ : j,
115
+ onMinimizedChange: m ? (e) => e && v?.() : M,
116
+ fold: m ? "dismiss" : "fab",
117
+ foldTravel: m ? H : void 0
118
+ }), { reveal: W, dragging: G, settling: Me } = U, Ne = G || Me, K = W > 0, q = B > V ? Math.max(0, (W - V) / (B - V)) : 0, J = m ? 0 : U.minimize, Pe = m ? U.minimize : 0, Y = m && !_, Fe = Math.max(g, k - y * 2), Ie = Fe + (k - Fe) * q, Le = Ie + (g - Ie) * J, Re = L + W + h, ze = Re + (g - Re) * J, Be = z > 0 ? b : b * (1 - q), Ve = Be + (g / 2 - Be) * J, He = y > 0 ? Ve : g / 2 * J, X = c(() => I(!1));
119
+ X.current = () => I(!1), s(() => {
117
120
  if (!P) return;
118
121
  let e = (e) => {
119
- e.key === "Escape" && ke.current();
122
+ e.key === "Escape" && X.current();
120
123
  };
121
124
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
122
125
  }, [P]), s(() => {
123
126
  P && M(!1);
124
- }, [P]);
125
- let Q = te(fe), Ae = Q.foot != null && Q.foot !== !1, je = () => {
127
+ }, [P]), s(() => {
128
+ Y && P && X.current();
129
+ }, [Y, P]);
130
+ let Z = te(ve), Ue = Z.foot != null && Z.foot !== !1, We = () => {
126
131
  I(!1), M(!1);
127
- }, Me = {
132
+ }, Ge = {
128
133
  open: P,
129
134
  setOpen: I,
130
- progress: G,
131
- peek: z,
135
+ progress: q,
136
+ peek: V,
132
137
  minimized: j,
133
138
  setMinimized: M
134
- }, $ = w && (we || Ce) && !W, Ne = z > 0 ? .5 : .28, Pe = g === "glass";
135
- return /* @__PURE__ */ u(f.Provider, {
136
- value: Me,
137
- children: /* @__PURE__ */ ie("div", {
138
- ref: O,
139
+ }, Q = w && (Ae || ke) && !K, $ = V > 0 ? .5 : .28, Ke = C === "glass";
140
+ return /* @__PURE__ */ u(p.Provider, {
141
+ value: Ge,
142
+ children: /* @__PURE__ */ d("div", {
143
+ ref: D,
139
144
  "data-slot": "floating-sheet",
140
- "data-appearance": g,
141
- "data-tone": E === "auto" ? void 0 : E,
142
- "data-theme-scope": D["data-theme-scope"],
143
- "data-body-align": v,
145
+ "data-appearance": C,
146
+ "data-tone": T === "auto" ? void 0 : T,
147
+ "data-theme-scope": E["data-theme-scope"],
148
+ "data-body-align": ue,
144
149
  "data-open": P || void 0,
145
- "data-expanded": W || void 0,
146
- "data-dragging": H || void 0,
150
+ "data-expanded": K || void 0,
151
+ "data-dragging": G || void 0,
147
152
  "data-minimized": j || void 0,
148
- className: e(b({ tone: E }), D.className, pe),
153
+ "data-dismissed": Y || void 0,
154
+ className: e(x({ tone: T }), E.className, ye),
149
155
  style: {
150
156
  "--ck-sheet-dock-height": `${L}px`,
151
- "--ck-sheet-reveal": `${V}px`,
152
- "--ck-sheet-body-height": `${R}px`,
153
- "--ck-sheet-width": `${Ee}px`,
154
- "--ck-sheet-height": `${De}px`,
155
- "--ck-sheet-minimize": `${K}`,
156
- "--ck-sheet-grown": `${G}`,
157
- "--ck-sheet-gutter": `${d}px`,
158
- "--ck-sheet-bottom-gutter": `${d * (1 - G)}px`,
159
- "--ck-sheet-radius": `${Z}px`,
160
- "--ck-sheet-radius-bottom": `${Oe}px`,
161
- "--ck-sheet-scrim-opacity": `${ue ? .16 * G : 0}`,
162
- "--ck-sheet-border-alpha": `${.12 + .04 * G}`,
163
- "--ck-sheet-bg-alpha": `${Ne + (.58 - Ne) * G}`,
164
- "--ck-sheet-shadow-y": `${14 + 20 * G}px`,
165
- "--ck-sheet-shadow-blur": `${34 + 30 * G}px`,
166
- "--ck-sheet-shadow-alpha": `${.22 + .18 * G}`,
167
- "--ck-sheet-divider-alpha": `${.09 * G}`,
168
- ...me
157
+ "--ck-sheet-reveal": `${W}px`,
158
+ "--ck-sheet-body-height": `${B}px`,
159
+ "--ck-sheet-width": `${Le}px`,
160
+ "--ck-sheet-height": `${ze}px`,
161
+ "--ck-sheet-minimize": `${J}`,
162
+ "--ck-sheet-grown": `${q}`,
163
+ "--ck-sheet-gutter": `${y}px`,
164
+ "--ck-sheet-bottom-gutter": `${y * (1 - q)}px`,
165
+ "--ck-sheet-radius": `${Ve}px`,
166
+ "--ck-sheet-radius-bottom": `${He}px`,
167
+ "--ck-sheet-scrim-opacity": `${ge ? .16 * q : 0}`,
168
+ "--ck-sheet-border-alpha": `${.12 + .04 * q}`,
169
+ "--ck-sheet-bg-alpha": `${$ + (.58 - $) * q}`,
170
+ "--ck-sheet-shadow-y": `${14 + 20 * q}px`,
171
+ "--ck-sheet-shadow-blur": `${34 + 30 * q}px`,
172
+ "--ck-sheet-shadow-alpha": `${.22 + .18 * q}`,
173
+ "--ck-sheet-divider-alpha": `${.09 * q}`,
174
+ ...xe
169
175
  },
170
176
  children: [/* @__PURE__ */ u("button", {
171
177
  type: "button",
@@ -174,41 +180,43 @@ function S({ open: n, defaultOpen: i = !1, onOpenChange: a, peek: o = 0, gutter:
174
180
  tabIndex: P ? 0 : -1,
175
181
  "data-slot": "floating-sheet-scrim",
176
182
  className: e("absolute inset-0 z-0 block border-0 bg-black p-0 opacity-[var(--ck-sheet-scrim-opacity,0)] motion-reduce:[transition:none]", P ? "pointer-events-auto" : "pointer-events-none"),
177
- style: { transition: U ? "none" : t("opacity", "smooth") },
183
+ style: { transition: Ne ? "none" : t("opacity", "smooth") },
178
184
  "data-open": P || void 0,
179
185
  onClick: () => I(!1)
180
- }), /* @__PURE__ */ ie("div", {
186
+ }), /* @__PURE__ */ d("div", {
181
187
  "data-slot": "floating-sheet-surface",
182
- className: y({
183
- appearance: g,
184
- placement: j ? C : $ ? "hidden" : "resting",
185
- hidden: $
186
- }),
188
+ className: e(se({
189
+ appearance: C,
190
+ placement: j ? pe : Q ? "hidden" : "resting",
191
+ hidden: Q
192
+ }), Y && "pointer-events-none", be),
193
+ inert: Y,
187
194
  style: {
188
- transition: H ? "none" : ce(U),
189
- ...Pe ? {
195
+ transition: G ? "none" : oe(Ne, m),
196
+ ...m && !Q ? { transform: `translate(-50%, ${Pe * H}px)` } : null,
197
+ ...Ke ? {
190
198
  backdropFilter: "blur(16px)",
191
199
  WebkitBackdropFilter: "blur(16px)"
192
200
  } : null
193
201
  },
194
202
  "data-open": P || void 0,
195
- "data-expanded": W || void 0,
196
- "data-peeking": z > 0 && !P || void 0,
197
- "data-dragging": H || void 0,
198
- "data-hidden": $ || void 0,
203
+ "data-expanded": K || void 0,
204
+ "data-peeking": V > 0 && !P || void 0,
205
+ "data-dragging": G || void 0,
206
+ "data-hidden": Q || void 0,
199
207
  "data-minimized": j || void 0,
200
- "data-fab-position": C,
208
+ "data-fab-position": pe,
201
209
  children: [
202
210
  /* @__PURE__ */ u("button", {
203
211
  type: "button",
204
212
  "data-slot": "floating-sheet-cap",
205
- className: e("group/cap box-border grid h-[18px] w-full shrink-0 touch-none place-items-center border-0 bg-transparent p-0 text-inherit opacity-[calc(1_-_var(--ck-sheet-minimize,0))] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary", H ? "cursor-grabbing" : "cursor-grab"),
213
+ className: e("group/cap box-border grid h-[18px] w-full shrink-0 touch-none place-items-center border-0 bg-transparent p-0 text-inherit opacity-[calc(1_-_var(--ck-sheet-minimize,0))] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary", G ? "cursor-grabbing" : "cursor-grab"),
206
214
  "data-open": P || void 0,
207
215
  "aria-label": P ? "Collapse" : "Expand",
208
216
  "aria-expanded": P,
209
217
  "aria-controls": F,
210
- onClick: B.toggle,
211
- ...B.handlers,
218
+ onClick: U.toggle,
219
+ ...U.handlers,
212
220
  children: /* @__PURE__ */ u("span", {
213
221
  "data-slot": "floating-sheet-grip",
214
222
  className: e("block h-[4px] rounded-[999px] [transition:width_var(--duration-spring-bouncy)_var(--ease-spring-bouncy),background-color_var(--duration-spring-snappy)_var(--ease-spring-snappy)] motion-reduce:[transition:none]", P ? "w-[40px] bg-muted-foreground" : "w-[32px] bg-tertiary-foreground group-focus-visible/cap:w-[40px] group-focus-visible/cap:bg-muted-foreground group-[:hover]/cap:w-[40px] group-[:hover]/cap:bg-muted-foreground")
@@ -217,36 +225,36 @@ function S({ open: n, defaultOpen: i = !1, onOpenChange: a, peek: o = 0, gutter:
217
225
  /* @__PURE__ */ u("div", {
218
226
  id: F,
219
227
  role: "region",
220
- "aria-label": de,
221
- "aria-hidden": !W,
222
- inert: !W,
228
+ "aria-label": _e,
229
+ "aria-hidden": !K,
230
+ inert: !K,
223
231
  "data-slot": "floating-sheet-reveal",
224
- className: e("ck-floating-sheet__reveal relative h-[var(--ck-sheet-reveal,0px)] w-full shrink-0 overflow-hidden opacity-[calc(1_-_var(--ck-sheet-minimize,0))]", W ? "visible" : "invisible"),
232
+ className: e("ck-floating-sheet__reveal relative h-[var(--ck-sheet-reveal,0px)] w-full shrink-0 overflow-hidden opacity-[calc(1_-_var(--ck-sheet-minimize,0))]", K ? "visible" : "invisible"),
225
233
  children: /* @__PURE__ */ u("div", {
226
234
  "data-slot": "floating-sheet-body",
227
- className: e("ck-floating-sheet__body absolute right-0 left-0 flex h-(--ck-sheet-body-height) min-w-0 flex-col overflow-hidden", v === "end" ? "bottom-0 justify-end" : "top-0"),
228
- children: Q.body
235
+ className: e("ck-floating-sheet__body absolute right-0 left-0 flex h-(--ck-sheet-body-height) min-w-0 flex-col overflow-hidden", ue === "end" ? "bottom-0 justify-end" : "top-0"),
236
+ children: Z.body
229
237
  })
230
238
  }),
231
239
  /* @__PURE__ */ u("div", {
232
- ref: k,
240
+ ref: O,
233
241
  "data-slot": "floating-sheet-foot",
234
- className: e("relative min-w-0 shrink-0 opacity-[calc(1_-_var(--ck-sheet-minimize,0))]", Ae ? "border-t border-[color:rgba(var(--ck-sheet-line),var(--ck-sheet-divider-alpha,0))]" : "border-t-0"),
235
- "data-empty": !Ae || void 0,
236
- children: Q.foot
242
+ className: e("relative min-w-0 shrink-0 opacity-[calc(1_-_var(--ck-sheet-minimize,0))]", Ue ? "border-t border-[color:rgba(var(--ck-sheet-line),var(--ck-sheet-divider-alpha,0))]" : "border-t-0"),
243
+ "data-empty": !Ue || void 0,
244
+ children: Z.foot
237
245
  }),
238
- /* @__PURE__ */ u(ae, {
246
+ /* @__PURE__ */ u(ie, {
239
247
  "data-slot": "floating-sheet-fab",
240
248
  className: e("absolute inset-0 grid h-full w-full cursor-pointer place-items-center rounded-[50%] border-0 bg-transparent p-0 text-foreground opacity-[var(--ck-sheet-minimize,0)]", j ? "pointer-events-auto" : "pointer-events-none"),
241
249
  "aria-label": "Open",
242
- onPress: je,
243
- children: le ?? Q.fab ?? /* @__PURE__ */ u("span", { className: "block size-[10px] rounded-[50%] bg-primary" })
250
+ onPress: We,
251
+ children: me ?? Z.fab ?? /* @__PURE__ */ u("span", { className: "block size-[10px] rounded-[50%] bg-primary" })
244
252
  })
245
253
  ]
246
254
  })]
247
255
  })
248
256
  });
249
257
  }
250
- S.Body = i("body"), S.Foot = i("foot"), S.Fab = i("fab"), S.Context = f, S.useFloatingSheet = p;
258
+ C.Body = i("body"), C.Foot = i("foot"), C.Fab = i("fab"), C.Context = p, C.useFloatingSheet = m;
251
259
  //#endregion
252
- export { S as FloatingSheet, y as floatingSheetSurfaceVariants, b as floatingSheetVariants, x as sheetToneProps, p as useFloatingSheet };
260
+ export { C as FloatingSheet, se as floatingSheetSurfaceVariants, x as floatingSheetVariants, S as sheetToneProps, m as useFloatingSheet };