UNPKG

@spark-ui/components

Version:

Spark (Leboncoin design system) components.

177 lines (162 loc) 6.5 kB
import { Dialog } from "../chunk-IAR55N4Y.mjs"; import "../chunk-QLOIAU3C.mjs"; import "../chunk-USSL4UZ5.mjs"; import "../chunk-MUNDKRAE.mjs"; import "../chunk-AESXFMCC.mjs"; import "../chunk-NBZKMCHF.mjs"; import "../chunk-4F5DOL57.mjs"; // src/alert-dialog/AlertDialog.tsx import { jsx } from "react/jsx-runtime"; var AlertDialog = (props) => { return /* @__PURE__ */ jsx(Dialog, { "data-spark-component": "alert-dialog", ...props, modal: true }); }; AlertDialog.displayName = "AlertDialog"; // src/alert-dialog/AlertDialogAction.tsx import { jsx as jsx2 } from "react/jsx-runtime"; var AlertDialogAction = (props) => { return /* @__PURE__ */ jsx2(Dialog.Close, { "data-spark-component": "alert-dialog-action", ...props }); }; AlertDialogAction.displayName = "AlertDialog.Action"; // src/alert-dialog/AlertDialogBody.tsx import { jsx as jsx3 } from "react/jsx-runtime"; var AlertDialogBody = (props) => { return /* @__PURE__ */ jsx3(Dialog.Body, { "data-spark-component": "alert-dialog-body", ...props }); }; AlertDialogBody.displayName = "AlertDialog.Body"; // src/alert-dialog/AlertDialogCancel.tsx import { useMergeRefs } from "@spark-ui/hooks/use-merge-refs"; // src/alert-dialog/AlertDialogContext.ts import { createContext, useContext } from "react"; var AlertDialogContext = createContext(null); var useAlertDialog = () => { const context = useContext(AlertDialogContext); if (!context) { throw Error("useAlertDialog must be used within a RadioGroup provider"); } return context; }; // src/alert-dialog/AlertDialogCancel.tsx import { jsx as jsx4 } from "react/jsx-runtime"; var AlertDialogCancel = ({ ref: forwardedRef, ...props }) => { const { cancelRef } = useAlertDialog(); const ref = useMergeRefs(forwardedRef, cancelRef); return /* @__PURE__ */ jsx4(Dialog.Close, { ref, "data-spark-component": "alert-dialog-cancel", ...props }); }; AlertDialogCancel.displayName = "AlertDialog.Cancel"; // src/alert-dialog/AlertDialogContent.tsx import { cx } from "class-variance-authority"; import { composeEventHandlers } from "radix-ui/internal"; import { useMemo, useRef } from "react"; import { jsx as jsx5 } from "react/jsx-runtime"; var AlertDialogContent = ({ className, onOpenAutoFocus, ref, ...others }) => { const cancelRef = useRef(null); const value = useMemo(() => { return { cancelRef }; }, []); const handleOpenAutoFocus = (event) => { event.preventDefault(); cancelRef.current?.focus({ preventScroll: true }); }; const handlePointerDownOutside = (event) => { event.preventDefault(); }; const handleInteractOutside = (event) => { event.preventDefault(); }; return /* @__PURE__ */ jsx5(AlertDialogContext.Provider, { value, children: /* @__PURE__ */ jsx5( Dialog.Content, { ref, "data-spark-component": "alert-dialog-content", ...others, className: cx(className, "min-w-sz-288"), role: "alertdialog", size: "md", onOpenAutoFocus: composeEventHandlers(onOpenAutoFocus, handleOpenAutoFocus), onPointerDownOutside: handlePointerDownOutside, onInteractOutside: handleInteractOutside, isNarrow: true } ) }); }; AlertDialogContent.displayName = "AlertDialog.Content"; // src/alert-dialog/AlertDialogDescription.tsx import { jsx as jsx6 } from "react/jsx-runtime"; var AlertDialogDescription = (props) => { return /* @__PURE__ */ jsx6(Dialog.Description, { "data-spark-component": "alert-dialog-description", ...props }); }; AlertDialogDescription.displayName = "AlertDialog.Description"; // src/alert-dialog/AlertDialogFooter.tsx import { jsx as jsx7 } from "react/jsx-runtime"; var AlertDialogFooter = (props) => { return /* @__PURE__ */ jsx7(Dialog.Footer, { "data-spark-component": "alert-dialog-footer", ...props }); }; AlertDialogFooter.displayName = "AlertDialog.Footer"; // src/alert-dialog/AlertDialogHeader.tsx import { jsx as jsx8 } from "react/jsx-runtime"; var AlertDialogHeader = (props) => { return /* @__PURE__ */ jsx8(Dialog.Header, { "data-spark-component": "alert-dialog-header", ...props }); }; AlertDialogHeader.displayName = "AlertDialog.Header"; // src/alert-dialog/AlertDialogOverlay.tsx import { jsx as jsx9 } from "react/jsx-runtime"; var AlertDialogOverlay = (props) => { return /* @__PURE__ */ jsx9(Dialog.Overlay, { "data-spark-component": "alert-dialog-overlay", ...props }); }; AlertDialogOverlay.displayName = "AlertDialog.Overlay"; // src/alert-dialog/AlertDialogPortal.tsx import { jsx as jsx10 } from "react/jsx-runtime"; var AlertDialogPortal = (props) => { return /* @__PURE__ */ jsx10(Dialog.Portal, { "data-spark-component": "alert-dialog-portal", ...props }); }; AlertDialogPortal.displayName = "AlertDialog.Portal"; // src/alert-dialog/AlertDialogTitle.tsx import { jsx as jsx11 } from "react/jsx-runtime"; var AlertDialogTitle = (props) => { return /* @__PURE__ */ jsx11(Dialog.Title, { "data-spark-component": "alert-dialog-title", ...props }); }; AlertDialogTitle.displayName = "AlertDialog.Title"; // src/alert-dialog/AlertDialogTrigger.tsx import { jsx as jsx12 } from "react/jsx-runtime"; var AlertDialogTrigger = (props) => { return /* @__PURE__ */ jsx12(Dialog.Trigger, { "data-spark-component": "alert-dialog-title", ...props }); }; AlertDialogTrigger.displayName = "AlertDialog.Trigger"; // src/alert-dialog/index.ts var AlertDialog2 = Object.assign(AlertDialog, { Action: AlertDialogAction, Body: AlertDialogBody, Cancel: AlertDialogCancel, Content: AlertDialogContent, Description: AlertDialogDescription, Footer: AlertDialogFooter, Header: AlertDialogHeader, Overlay: AlertDialogOverlay, Portal: AlertDialogPortal, Title: AlertDialogTitle, Trigger: AlertDialogTrigger }); AlertDialog2.displayName = "AlertDialog"; AlertDialog2.Action.displayName = "AlertDialog.Action"; AlertDialog2.Body.displayName = "AlertDialog.Body"; AlertDialog2.Cancel.displayName = "AlertDialog.Cancel"; AlertDialog2.Content.displayName = "AlertDialog.Content"; AlertDialog2.Description.displayName = "AlertDialog.Description"; AlertDialog2.Footer.displayName = "AlertDialog.Footer"; AlertDialog2.Header.displayName = "AlertDialog.Header"; AlertDialog2.Overlay.displayName = "AlertDialog.Overlay"; AlertDialog2.Portal.displayName = "AlertDialog.Portal"; AlertDialog2.Title.displayName = "AlertDialog.Title"; AlertDialog2.Trigger.displayName = "AlertDialog.Trigger"; export { AlertDialog2 as AlertDialog, useAlertDialog }; //# sourceMappingURL=index.mjs.map