UNPKG

@nayan-ui/react-native

Version:

React Native Component Library for smooth and faster mobile application development.

56 lines (55 loc) 1.88 kB
"use strict"; import React from 'react'; import { NText } from "./NText.js"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "./ui/alert-dialog.js"; import { cn } from "../lib/utils.js"; import { jsx as _jsx, jsxs as _jsxs } from "react-native-css-interop/jsx-runtime"; export const NConfirm = /*#__PURE__*/React.memo(({ title, description, children, onResult, confirmText = 'Ok', cancelText = 'Cancel', className = '', titleClassName = '', descriptionClassName = '', confirmClassName = '', cancelClassName = '' }) => { return _jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { asChild: true, children: children }), _jsxs(AlertDialogContent, { className: cn('bg-card p-3 min-w-[320px]', className), children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { className: cn('text-text', titleClassName), children: title }), _jsx(AlertDialogDescription, { className: cn('text-text', descriptionClassName), children: description })] }), _jsxs(AlertDialogFooter, { className: "flex-row", children: [_jsx(AlertDialogAction, { onPress: () => onResult(true), children: _jsx(NText, { className: cn('text-white', confirmClassName), children: confirmText }) }), _jsx(AlertDialogCancel, { className: "border-muted bg-border", onPress: () => onResult(false), children: _jsx(NText, { className: cn('text-text', cancelClassName), children: cancelText }) })] })] })] }); }); NConfirm.displayName = 'NConfirm'; //# sourceMappingURL=NConfirm.js.map