@patternmode/stacksheet 1.4.0 → 2.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.
@@ -1 +1 @@
1
- {"version":3,"file":"sheet-panel-focus.d.ts","sourceRoot":"","sources":["../../src/SheetPanel/sheet-panel-focus.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAsClD,eAAO,MAAM,cAAc,GAAI,6CAK5B;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC3C,QAAQ,EAAE,SAAS,CAAC;CACrB,KAAG,SA2BH,CAAC"}
1
+ {"version":3,"file":"sheet-panel-focus.d.ts","sourceRoot":"","sources":["../../src/SheetPanel/sheet-panel-focus.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAkDlD,eAAO,MAAM,cAAc,GAAI,6CAK5B;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC3C,QAAQ,EAAE,SAAS,CAAC;CACrB,KAAG,SA2BH,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { SheetOptionalContentPartProps } from "./sheet-part-types";
2
- export declare const SheetBack: ({ asChild, className, style, children, }: SheetOptionalContentPartProps) => import("react").JSX.Element | null;
2
+ export declare const SheetBack: ({ render, className, style, children, }: SheetOptionalContentPartProps) => import("react").JSX.Element | null;
3
3
  //# sourceMappingURL=sheet-back.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sheet-back.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-back.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAExE,eAAO,MAAM,SAAS,GAAI,0CAKvB,6BAA6B,uCAqB/B,CAAC"}
1
+ {"version":3,"file":"sheet-back.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-back.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAExE,eAAO,MAAM,SAAS,GAAI,yCAKvB,6BAA6B,uCAsB/B,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { SheetPartProps } from "./sheet-part-types";
2
- export declare const SheetBody: ({ asChild, className, style, children }: SheetPartProps) => import("react").JSX.Element;
2
+ export declare const SheetBody: ({ render, className, style, children }: SheetPartProps) => import("react").JSX.Element;
3
3
  //# sourceMappingURL=sheet-body.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sheet-body.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-body.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,eAAO,MAAM,SAAS,GAAI,yCAAyC,cAAc,gCA2BhF,CAAC"}
1
+ {"version":3,"file":"sheet-body.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-body.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AA2BzD,eAAO,MAAM,SAAS,GAAI,wCAAwC,cAAc,gCAyB/E,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { SheetOptionalContentPartProps } from "./sheet-part-types";
2
- export declare const SheetClose: ({ asChild, className, style, children, }: SheetOptionalContentPartProps) => import("react").JSX.Element;
2
+ export declare const SheetClose: ({ render, className, style, children, }: SheetOptionalContentPartProps) => import("react").JSX.Element;
3
3
  //# sourceMappingURL=sheet-close.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sheet-close.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-close.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAExE,eAAO,MAAM,UAAU,GAAI,0CAKxB,6BAA6B,gCAkB/B,CAAC"}
1
+ {"version":3,"file":"sheet-close.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-close.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAExE,eAAO,MAAM,UAAU,GAAI,yCAKxB,6BAA6B,gCAmB/B,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { SheetPartProps } from "./sheet-part-types";
2
- export declare const SheetDescription: ({ asChild, className, style, children }: SheetPartProps) => import("react").JSX.Element;
2
+ export declare const SheetDescription: ({ render, className, style, children }: SheetPartProps) => import("react").JSX.Element;
3
3
  //# sourceMappingURL=sheet-description.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sheet-description.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-description.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,eAAO,MAAM,gBAAgB,GAAI,yCAAyC,cAAc,gCAUvF,CAAC"}
1
+ {"version":3,"file":"sheet-description.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-description.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,eAAO,MAAM,gBAAgB,GAAI,wCAAwC,cAAc,gCAUtF,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { SheetPartProps } from "./sheet-part-types";
2
- export declare const SheetFooter: ({ asChild, className, style, children }: SheetPartProps) => import("react").JSX.Element;
2
+ export declare const SheetFooter: ({ render, className, style, children }: SheetPartProps) => import("react").JSX.Element;
3
3
  //# sourceMappingURL=sheet-footer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sheet-footer.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-footer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,eAAO,MAAM,WAAW,GAAI,yCAAyC,cAAc,gCASlF,CAAC"}
1
+ {"version":3,"file":"sheet-footer.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-footer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,eAAO,MAAM,WAAW,GAAI,wCAAwC,cAAc,gCASjF,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { SheetOptionalContentPartProps } from "./sheet-part-types";
2
- export declare const SheetHandle: ({ asChild, className, style, children, }: SheetOptionalContentPartProps) => import("react").JSX.Element | null;
2
+ export declare const SheetHandle: ({ render, className, style, children, }: SheetOptionalContentPartProps) => import("react").JSX.Element | null;
3
3
  //# sourceMappingURL=sheet-handle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sheet-handle.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-handle.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAExE,eAAO,MAAM,WAAW,GAAI,0CAKzB,6BAA6B,uCA0B/B,CAAC"}
1
+ {"version":3,"file":"sheet-handle.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-handle.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAExE,eAAO,MAAM,WAAW,GAAI,yCAKzB,6BAA6B,uCA6B/B,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { SheetPartProps } from "./sheet-part-types";
2
- export declare const SheetHeader: ({ asChild, className, style, children }: SheetPartProps) => import("react").JSX.Element;
2
+ export declare const SheetHeader: ({ render, className, style, children }: SheetPartProps) => import("react").JSX.Element;
3
3
  //# sourceMappingURL=sheet-header.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sheet-header.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-header.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,eAAO,MAAM,WAAW,GAAI,yCAAyC,cAAc,gCAWlF,CAAC"}
1
+ {"version":3,"file":"sheet-header.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-header.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,eAAO,MAAM,WAAW,GAAI,wCAAwC,cAAc,gCAWjF,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { JSX } from "react";
2
+ import type { RenderProp } from "../render";
3
+ /**
4
+ * Renders a sheet part through `render` (or its default tag) via Base UI's
5
+ * `useRender`. Centralising the hook here lets each part early-return before
6
+ * constructing the element without tripping the Rules of Hooks.
7
+ */
8
+ export declare const SheetPartElement: ({ defaultTagName, props, render, }: {
9
+ defaultTagName: keyof JSX.IntrinsicElements;
10
+ props: Record<string, unknown>;
11
+ render: RenderProp | undefined;
12
+ }) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
13
+ //# sourceMappingURL=sheet-part-element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sheet-part-element.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-part-element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,oCAI9B;IACD,cAAc,EAAE,MAAM,GAAG,CAAC,iBAAiB,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;CAChC,+FAAiD,CAAC"}
@@ -1,12 +1,13 @@
1
1
  import type { CSSProperties, ReactNode } from "react";
2
+ import type { RenderProp } from "../render";
2
3
  export interface SheetPartProps {
3
- asChild?: boolean;
4
+ render?: RenderProp;
4
5
  children: ReactNode;
5
6
  className?: string;
6
7
  style?: CSSProperties;
7
8
  }
8
9
  export interface SheetOptionalContentPartProps {
9
- asChild?: boolean;
10
+ render?: RenderProp;
10
11
  children?: ReactNode;
11
12
  className?: string;
12
13
  style?: CSSProperties;
@@ -1 +1 @@
1
- {"version":3,"file":"sheet-part-types.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-part-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,6BAA6B;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,MAAM,cAAc,GAAG,6BAA6B,CAAC;AAC3D,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC;AAC5C,MAAM,MAAM,eAAe,GAAG,6BAA6B,CAAC;AAC5D,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC;AACnD,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAC9C,MAAM,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AAC7D,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAC9C,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC"}
1
+ {"version":3,"file":"sheet-part-types.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-part-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,6BAA6B;IAC5C,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,MAAM,cAAc,GAAG,6BAA6B,CAAC;AAC3D,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC;AAC5C,MAAM,MAAM,eAAe,GAAG,6BAA6B,CAAC;AAC5D,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC;AACnD,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAC9C,MAAM,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AAC7D,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAC9C,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC"}
@@ -8,13 +8,13 @@
8
8
  * `aria-labelledby` and `aria-describedby` via matching IDs.
9
9
  */
10
10
  export declare const Sheet: {
11
- readonly Back: ({ asChild, className, style, children, }: import("./sheet-part-types").SheetOptionalContentPartProps) => import("react").JSX.Element | null;
12
- readonly Body: ({ asChild, className, style, children }: import("./sheet-part-types").SheetPartProps) => import("react").JSX.Element;
13
- readonly Close: ({ asChild, className, style, children, }: import("./sheet-part-types").SheetOptionalContentPartProps) => import("react").JSX.Element;
14
- readonly Description: ({ asChild, className, style, children }: import("./sheet-part-types").SheetPartProps) => import("react").JSX.Element;
15
- readonly Footer: ({ asChild, className, style, children }: import("./sheet-part-types").SheetPartProps) => import("react").JSX.Element;
16
- readonly Handle: ({ asChild, className, style, children, }: import("./sheet-part-types").SheetOptionalContentPartProps) => import("react").JSX.Element | null;
17
- readonly Header: ({ asChild, className, style, children }: import("./sheet-part-types").SheetPartProps) => import("react").JSX.Element;
18
- readonly Title: ({ asChild, className, style, children }: import("./sheet-part-types").SheetPartProps) => import("react").JSX.Element;
11
+ readonly Back: ({ render, className, style, children, }: import("./sheet-part-types").SheetOptionalContentPartProps) => import("react").JSX.Element | null;
12
+ readonly Body: ({ render, className, style, children }: import("./sheet-part-types").SheetPartProps) => import("react").JSX.Element;
13
+ readonly Close: ({ render, className, style, children, }: import("./sheet-part-types").SheetOptionalContentPartProps) => import("react").JSX.Element;
14
+ readonly Description: ({ render, className, style, children }: import("./sheet-part-types").SheetPartProps) => import("react").JSX.Element;
15
+ readonly Footer: ({ render, className, style, children }: import("./sheet-part-types").SheetPartProps) => import("react").JSX.Element;
16
+ readonly Handle: ({ render, className, style, children, }: import("./sheet-part-types").SheetOptionalContentPartProps) => import("react").JSX.Element | null;
17
+ readonly Header: ({ render, className, style, children }: import("./sheet-part-types").SheetPartProps) => import("react").JSX.Element;
18
+ readonly Title: ({ render, className, style, children }: import("./sheet-part-types").SheetPartProps) => import("react").JSX.Element;
19
19
  };
20
20
  //# sourceMappingURL=sheet-parts.d.ts.map
@@ -1,3 +1,3 @@
1
1
  import type { SheetPartProps } from "./sheet-part-types";
2
- export declare const SheetTitle: ({ asChild, className, style, children }: SheetPartProps) => import("react").JSX.Element;
2
+ export declare const SheetTitle: ({ render, className, style, children }: SheetPartProps) => import("react").JSX.Element;
3
3
  //# sourceMappingURL=sheet-title.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sheet-title.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-title.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,eAAO,MAAM,UAAU,GAAI,yCAAyC,cAAc,gCAWjF,CAAC"}
1
+ {"version":3,"file":"sheet-title.d.ts","sourceRoot":"","sources":["../../src/SheetParts/sheet-title.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,eAAO,MAAM,UAAU,GAAI,wCAAwC,cAAc,gCAgBhF,CAAC"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  "use client";
2
- import { Portal } from "@radix-ui/react-portal";
3
2
  import { createContext, use, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
4
3
  import { createStore, useStore } from "zustand";
5
4
  import { useShallow } from "zustand/react/shallow";
@@ -9,8 +8,10 @@ import { RemoveScroll } from "react-remove-scroll";
9
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
9
  import { FocusTrap } from "focus-trap-react";
11
10
  import { joinClassNames } from "@patternmode/system";
12
- import { Slot } from "@radix-ui/react-slot";
13
- import { Root, Scrollbar, Thumb, Viewport } from "@radix-ui/react-scroll-area";
11
+ import { createPortal } from "react-dom";
12
+ import "@base-ui/react/merge-props";
13
+ import { useRender } from "@base-ui/react/use-render";
14
+ import { ScrollArea } from "@base-ui/react/scroll-area";
14
15
  //#region src/springs.ts
15
16
  /** Strips the shared token's `type: "spring"` down to Stacksheet's numeric SpringConfig. */
16
17
  const toSpringConfig = (spring) => ({
@@ -997,6 +998,10 @@ PanelInnerContent.displayName = "PanelInnerContent";
997
998
  //#endregion
998
999
  //#region src/SheetPanel/sheet-panel-focus.tsx
999
1000
  const LAYERED_MODAL_SELECTORS = [
1001
+ "[role=\"dialog\"][data-open]",
1002
+ "[role=\"alertdialog\"][data-open]",
1003
+ "[data-base-ui-focus-guard]",
1004
+ "[data-slot=\"tag-selector-content\"]",
1000
1005
  "[role=\"dialog\"][data-state=\"open\"]",
1001
1006
  "[role=\"alertdialog\"][data-state=\"open\"]",
1002
1007
  "[data-radix-popper-content-wrapper]",
@@ -1612,6 +1617,23 @@ const SheetRenderer = ({ store, config, sheets, componentMap, classNames: classN
1612
1617
  });
1613
1618
  };
1614
1619
  //#endregion
1620
+ //#region src/sheet-portal.tsx
1621
+ /**
1622
+ * Minimal client-only portal into `document.body`. Replaces
1623
+ * `@radix-ui/react-portal` — Base UI ships no standalone portal primitive, and
1624
+ * the sheet renderer only ever runs on the client. Mounting is deferred to an
1625
+ * effect so server render and first client render agree (no hydration
1626
+ * mismatch).
1627
+ */
1628
+ const SheetPortal = ({ children }) => {
1629
+ const [mounted, setMounted] = useState(false);
1630
+ useEffect(() => {
1631
+ setMounted(true);
1632
+ }, []);
1633
+ if (!mounted || typeof document === "undefined") return null;
1634
+ return createPortal(children, document.body);
1635
+ };
1636
+ //#endregion
1615
1637
  //#region src/Store/store-args.ts
1616
1638
  const isRecord = (value) => typeof value === "object" && value !== null;
1617
1639
  const toRecord = (value) => isRecord(value) ? value : {};
@@ -1933,18 +1955,15 @@ const createStacksheet = (config) => {
1933
1955
  };
1934
1956
  const StacksheetProvider = ({ sheets, children, classNames, layout, renderHeader }) => /* @__PURE__ */ jsxs(StoreContext.Provider, {
1935
1957
  value: providerValue,
1936
- children: [children, /* @__PURE__ */ jsx(Portal, {
1937
- asChild: false,
1938
- children: /* @__PURE__ */ jsx(SheetRenderer, {
1939
- classNames,
1940
- componentMap,
1941
- config: resolved,
1942
- layout,
1943
- renderHeader,
1944
- sheets,
1945
- store
1946
- })
1947
- })]
1958
+ children: [children, /* @__PURE__ */ jsx(SheetPortal, { children: /* @__PURE__ */ jsx(SheetRenderer, {
1959
+ classNames,
1960
+ componentMap,
1961
+ config: resolved,
1962
+ layout,
1963
+ renderHeader,
1964
+ sheets,
1965
+ store
1966
+ }) })]
1948
1967
  });
1949
1968
  const useSheet = () => {
1950
1969
  const { store: s } = useStoreContext();
@@ -1976,120 +1995,163 @@ const createStacksheet = (config) => {
1976
1995
  };
1977
1996
  };
1978
1997
  //#endregion
1998
+ //#region src/SheetParts/sheet-part-element.tsx
1999
+ /**
2000
+ * Renders a sheet part through `render` (or its default tag) via Base UI's
2001
+ * `useRender`. Centralising the hook here lets each part early-return before
2002
+ * constructing the element without tripping the Rules of Hooks.
2003
+ */
2004
+ const SheetPartElement = ({ defaultTagName, props, render }) => useRender({
2005
+ defaultTagName,
2006
+ props,
2007
+ render
2008
+ });
2009
+ //#endregion
1979
2010
  //#region src/SheetParts/sheet-back.tsx
1980
- const SheetBack = ({ asChild, className, style, children }) => {
2011
+ const SheetBack = ({ render, className, style, children }) => {
1981
2012
  const { back, isNested } = useSheetPanel();
1982
2013
  if (!isNested) return null;
1983
- const isAsChild = asChild === true;
1984
- return /* @__PURE__ */ jsx(isAsChild ? Slot : "button", {
1985
- "aria-label": children === void 0 || children === null ? "Back" : void 0,
1986
- className: joinClassNames(isAsChild ? void 0 : "flex min-h-11 min-w-11 shrink-0 cursor-pointer items-center justify-center rounded-md border-none bg-transparent p-0 text-inherit opacity-60 transition-opacity duration-150 hover:opacity-100", className),
1987
- onClick: back,
1988
- style,
1989
- type: isAsChild ? void 0 : "button",
1990
- children: children ?? /* @__PURE__ */ jsx(ArrowLeftIcon, {})
2014
+ return /* @__PURE__ */ jsx(SheetPartElement, {
2015
+ defaultTagName: "button",
2016
+ props: {
2017
+ "aria-label": children === void 0 || children === null ? "Back" : void 0,
2018
+ children: children ?? /* @__PURE__ */ jsx(ArrowLeftIcon, {}),
2019
+ className: joinClassNames(render ? void 0 : "flex min-h-11 min-w-11 shrink-0 cursor-pointer items-center justify-center rounded-md border-none bg-transparent p-0 text-inherit opacity-60 transition-opacity duration-150 hover:opacity-100", className),
2020
+ onClick: back,
2021
+ style,
2022
+ type: render ? void 0 : "button"
2023
+ },
2024
+ render
1991
2025
  });
1992
2026
  };
1993
2027
  //#endregion
1994
2028
  //#region src/SheetParts/sheet-body.tsx
1995
- const SheetBody = ({ asChild, className, style, children }) => {
1996
- if (asChild === true) return /* @__PURE__ */ jsx(Slot, {
2029
+ const SheetBodyRendered = ({ render, className, style, children }) => useRender({
2030
+ props: {
2031
+ children,
1997
2032
  className: joinClassNames("relative min-h-0 flex-1", className),
1998
2033
  "data-stacksheet-no-drag": "",
2034
+ style
2035
+ },
2036
+ render
2037
+ });
2038
+ const SheetBody = ({ render, className, style, children }) => {
2039
+ if (render !== void 0) return /* @__PURE__ */ jsx(SheetBodyRendered, {
2040
+ className,
2041
+ render,
1999
2042
  style,
2000
2043
  children
2001
2044
  });
2002
- return /* @__PURE__ */ jsxs(Root, {
2045
+ return /* @__PURE__ */ jsxs(ScrollArea.Root, {
2003
2046
  className: joinClassNames("relative flex min-h-0 flex-1 flex-col overflow-hidden", className),
2004
2047
  "data-stacksheet-no-drag": "",
2005
2048
  style,
2006
- children: [/* @__PURE__ */ jsx(Viewport, {
2049
+ children: [/* @__PURE__ */ jsx(ScrollArea.Viewport, {
2007
2050
  className: "min-h-0 w-full flex-1 overscroll-contain",
2008
2051
  children
2009
- }), /* @__PURE__ */ jsx(Scrollbar, {
2010
- className: "flex w-2 touch-none select-none p-0.5",
2052
+ }), /* @__PURE__ */ jsx(ScrollArea.Scrollbar, {
2053
+ className: "flex w-2 touch-none select-none p-0.5 opacity-0 transition-opacity data-[hovering]:opacity-100 data-[scrolling]:opacity-100",
2011
2054
  orientation: "vertical",
2012
- children: /* @__PURE__ */ jsx(Thumb, { className: "relative flex-1 rounded bg-current/15" })
2055
+ children: /* @__PURE__ */ jsx(ScrollArea.Thumb, { className: "relative flex-1 rounded bg-current/15" })
2013
2056
  })]
2014
2057
  });
2015
2058
  };
2016
2059
  //#endregion
2017
2060
  //#region src/SheetParts/sheet-close.tsx
2018
- const SheetClose = ({ asChild, className, style, children }) => {
2061
+ const SheetClose = ({ render, className, style, children }) => {
2019
2062
  const { close } = useSheetPanel();
2020
- const isAsChild = asChild === true;
2021
- return /* @__PURE__ */ jsx(isAsChild ? Slot : "button", {
2022
- "aria-label": children === void 0 || children === null ? "Close" : void 0,
2023
- className: joinClassNames(isAsChild ? void 0 : "absolute right-2 top-2 z-20 flex min-h-11 min-w-11 cursor-pointer items-center justify-center rounded-md border-none bg-transparent p-0 text-inherit opacity-50 transition-opacity duration-150 hover:opacity-100", className),
2024
- onClick: close,
2025
- style,
2026
- type: isAsChild ? void 0 : "button",
2027
- children: children ?? /* @__PURE__ */ jsx(XIcon, {})
2063
+ return /* @__PURE__ */ jsx(SheetPartElement, {
2064
+ defaultTagName: "button",
2065
+ props: {
2066
+ "aria-label": children === void 0 || children === null ? "Close" : void 0,
2067
+ children: children ?? /* @__PURE__ */ jsx(XIcon, {}),
2068
+ className: joinClassNames(render ? void 0 : "absolute right-2 top-2 z-20 flex min-h-11 min-w-11 cursor-pointer items-center justify-center rounded-md border-none bg-transparent p-0 text-inherit opacity-50 transition-opacity duration-150 hover:opacity-100", className),
2069
+ onClick: close,
2070
+ style,
2071
+ type: render ? void 0 : "button"
2072
+ },
2073
+ render
2028
2074
  });
2029
2075
  };
2030
2076
  //#endregion
2031
2077
  //#region src/SheetParts/sheet-description.tsx
2032
- const SheetDescription = ({ asChild, className, style, children }) => {
2078
+ const SheetDescription = ({ render, className, style, children }) => {
2033
2079
  const { panelId, registerDescription } = useSheetPanel();
2034
2080
  useEffect(() => registerDescription(), [registerDescription]);
2035
- return /* @__PURE__ */ jsx(asChild === true ? Slot : "p", {
2036
- className,
2037
- id: `${panelId}-desc`,
2038
- style,
2039
- children
2081
+ return /* @__PURE__ */ jsx(SheetPartElement, {
2082
+ defaultTagName: "p",
2083
+ props: {
2084
+ children,
2085
+ className,
2086
+ id: `${panelId}-desc`,
2087
+ style
2088
+ },
2089
+ render
2040
2090
  });
2041
2091
  };
2042
2092
  //#endregion
2043
2093
  //#region src/SheetParts/sheet-footer.tsx
2044
- const SheetFooter = ({ asChild, className, style, children }) => {
2045
- const isAsChild = asChild === true;
2046
- return /* @__PURE__ */ jsx(isAsChild ? Slot : "footer", {
2047
- className: joinClassNames(isAsChild ? "shrink-0" : "flex shrink-0 items-center gap-2 border-t px-6 py-3", className),
2048
- style,
2049
- children
2094
+ const SheetFooter = ({ render, className, style, children }) => {
2095
+ return /* @__PURE__ */ jsx(SheetPartElement, {
2096
+ defaultTagName: "footer",
2097
+ props: {
2098
+ children,
2099
+ className: joinClassNames(render ? "shrink-0" : "flex shrink-0 items-center gap-2 border-t px-6 py-3", className),
2100
+ style
2101
+ },
2102
+ render
2050
2103
  });
2051
2104
  };
2052
2105
  //#endregion
2053
2106
  //#region src/SheetParts/sheet-handle.tsx
2054
- const SheetHandle = ({ asChild, className, style, children }) => {
2107
+ const SheetHandle = ({ render, className, style, children }) => {
2055
2108
  const { close, back, isNested, side } = useSheetPanel();
2056
2109
  if (side !== "bottom") return null;
2057
2110
  const dismiss = isNested ? back : close;
2058
- const isAsChild = asChild === true;
2059
- return /* @__PURE__ */ jsx(isAsChild ? Slot : "button", {
2060
- "aria-label": "Dismiss",
2061
- className: joinClassNames(isAsChild ? void 0 : "flex shrink-0 cursor-grab touch-none items-center justify-center border-none bg-transparent pt-4 pb-1 text-inherit", className),
2062
- "data-stacksheet-handle": "",
2063
- onClick: dismiss,
2064
- style,
2065
- type: isAsChild ? void 0 : "button",
2066
- children: children ?? /* @__PURE__ */ jsx("div", {
2067
- "aria-hidden": "true",
2068
- className: "h-1 w-9 rounded-sm bg-current/25"
2069
- })
2111
+ return /* @__PURE__ */ jsx(SheetPartElement, {
2112
+ defaultTagName: "button",
2113
+ props: {
2114
+ "aria-label": "Dismiss",
2115
+ children: children ?? /* @__PURE__ */ jsx("div", {
2116
+ "aria-hidden": "true",
2117
+ className: "h-1 w-9 rounded-sm bg-current/25"
2118
+ }),
2119
+ className: joinClassNames(render ? void 0 : "flex shrink-0 cursor-grab touch-none items-center justify-center border-none bg-transparent pt-4 pb-1 text-inherit", className),
2120
+ "data-stacksheet-handle": "",
2121
+ onClick: dismiss,
2122
+ style,
2123
+ type: render ? void 0 : "button"
2124
+ },
2125
+ render
2070
2126
  });
2071
2127
  };
2072
2128
  //#endregion
2073
2129
  //#region src/SheetParts/sheet-header.tsx
2074
- const SheetHeader = ({ asChild, className, style, children }) => {
2075
- const isAsChild = asChild === true;
2076
- return /* @__PURE__ */ jsx(isAsChild ? Slot : "header", {
2077
- className: joinClassNames(isAsChild ? "shrink-0" : "flex shrink-0 items-center justify-between gap-3", className),
2078
- style,
2079
- children
2130
+ const SheetHeader = ({ render, className, style, children }) => {
2131
+ return /* @__PURE__ */ jsx(SheetPartElement, {
2132
+ defaultTagName: "header",
2133
+ props: {
2134
+ children,
2135
+ className: joinClassNames(render ? "shrink-0" : "flex shrink-0 items-center justify-between gap-3", className),
2136
+ style
2137
+ },
2138
+ render
2080
2139
  });
2081
2140
  };
2082
2141
  //#endregion
2083
2142
  //#region src/SheetParts/sheet-title.tsx
2084
- const SheetTitle = ({ asChild, className, style, children }) => {
2143
+ const SheetTitle = ({ render, className, style, children }) => {
2085
2144
  const { panelId, registerTitle } = useSheetPanel();
2086
2145
  useEffect(() => registerTitle(), [registerTitle]);
2087
- const isAsChild = asChild === true;
2088
- return /* @__PURE__ */ jsx(isAsChild ? Slot : "h2", {
2089
- className: joinClassNames(isAsChild ? void 0 : "font-semibold text-sm", className),
2090
- id: `${panelId}-title`,
2091
- style,
2092
- children
2146
+ return /* @__PURE__ */ jsx(SheetPartElement, {
2147
+ defaultTagName: "h2",
2148
+ props: {
2149
+ children,
2150
+ className: joinClassNames(render ? void 0 : "font-semibold text-sm", className),
2151
+ id: `${panelId}-title`,
2152
+ style
2153
+ },
2154
+ render
2093
2155
  });
2094
2156
  };
2095
2157
  //#endregion