{"version":3,"names":["dynamic","createMemo","omit","Show","useDialogRootContext","composeRefs","userRef","mergeRootProps","resolveClassStyle","DrawerPopupCssVars","DrawerBackdropCssVars","DrawerBackdrop","props","root","state","open","transitionStatus","setBackdropRef","el","backdropRef","current","enabled","Boolean","forceRender","nested","internal","role","hidden","mounted","style","undefined","swipeProgress","swipeStrength","data-open","data-closed","data-starting-style","data-ending-style","userClassStyle","userProps","merged","Tag","as"],"sources":["drawer-backdrop.tsx"],"sourcesContent":["import type { JSX, ValidComponent } from \"@solidjs/web\";\n/**\n * `<Drawer.Backdrop>` — overlay displayed beneath the drawer popup.\n */\n\nimport { dynamic } from \"@solidjs/web\";\nimport { createMemo, omit, Show } from \"solid-js\";\nimport { useDialogRootContext } from \"../../dialog/dialog-root-context\";\nimport { composeRefs, userRef } from \"../../internals/compose-refs\";\nimport { mergeRootProps } from \"../../internals/merge-root-props\";\nimport { resolveClassStyle } from \"../../internals/resolve-class-style\";\nimport type { BaseUIComponentProps } from \"../../internals/types\";\nimport type { TransitionStatus } from \"../../internals/use-transition-status/use-transition-status\";\nimport { DrawerPopupCssVars } from \"../popup/drawer-popup-css-vars\";\nimport { DrawerBackdropCssVars } from \"./drawer-backdrop-css-vars\";\n\nexport interface DrawerBackdropState {\n\topen: boolean;\n\ttransitionStatus: TransitionStatus;\n}\n\nexport interface DrawerBackdropProps\n\textends BaseUIComponentProps<\"div\", DrawerBackdropState> {\n\t/**\n\t * Tag/component to render. Defaults to `\"div\"`. Replaces the\n\t * pre-spike `render` prop (axis G).\n\t */\n\tas?: ValidComponent;\n\t/** Force-render even when nested. @default false */\n\tforceRender?: boolean | undefined;\n}\n\n/**\n * An overlay displayed beneath the drawer popup.\n */\nexport function DrawerBackdrop(props: DrawerBackdropProps): JSX.Element {\n\tconst root = useDialogRootContext();\n\n\tconst state = createMemo<DrawerBackdropState>(() => ({\n\t\topen: root.open(),\n\t\ttransitionStatus: root.transitionStatus(),\n\t}));\n\n\tconst setBackdropRef = (el: HTMLDivElement | null): void => {\n\t\troot.backdropRef.current = el;\n\t};\n\n\tconst enabled = (): boolean => Boolean(props.forceRender) || !root.nested();\n\n\tconst internal = {\n\t\trole: \"presentation\",\n\t\tget hidden() {\n\t\t\treturn !root.mounted();\n\t\t},\n\t\tget style(): JSX.CSSProperties {\n\t\t\treturn {\n\t\t\t\t\"pointer-events\": !root.open() ? \"none\" : undefined,\n\t\t\t\t\"user-select\": \"none\",\n\t\t\t\t\"-webkit-user-select\": \"none\",\n\t\t\t\t[DrawerBackdropCssVars.swipeProgress]: \"0\",\n\t\t\t\t[DrawerPopupCssVars.swipeStrength]: \"1\",\n\t\t\t} as JSX.CSSProperties;\n\t\t},\n\t\tget \"data-open\"() {\n\t\t\treturn state().open ? \"\" : undefined;\n\t\t},\n\t\tget \"data-closed\"() {\n\t\t\treturn state().open ? undefined : \"\";\n\t\t},\n\t\tget \"data-starting-style\"() {\n\t\t\treturn state().transitionStatus === \"starting\" ? \"\" : undefined;\n\t\t},\n\t\tget \"data-ending-style\"() {\n\t\t\treturn state().transitionStatus === \"ending\" ? \"\" : undefined;\n\t\t},\n\t};\n\n\tconst userClassStyle = resolveClassStyle(props, () => state());\n\n\tconst userProps = omit(\n\t\tprops,\n\t\t\"as\",\n\t\t\"class\",\n\t\t\"style\",\n\t\t\"attrs\",\n\n\t\t\"forceRender\",\n\t);\n\n\tlet merged: Record<string, unknown> = mergeRootProps(\n\t\tinternal,\n\t\tuserClassStyle,\n\t);\n\tmerged = mergeRootProps(merged, userProps);\n\n\tconst Tag = dynamic(() => props.as ?? \"div\");\n\treturn (\n\t\t<Show when={enabled()}>\n\t\t\t<Tag {...merged} ref={composeRefs(setBackdropRef, userRef(props))} />\n\t\t</Show>\n\t);\n}\n"],"mappings":"AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,cAAc;AACtC,SAASC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,UAAU;AACjD,SAASC,oBAAoB,QAAQ,kCAAkC;AACvE,SAAS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