@minutemailer/kit 1.1.0 → 1.1.1
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/components/confirm.d.ts +12 -0
- package/components/confirm.js +11 -0
- package/components/minutemailer-kit.d.ts +10 -0
- package/components/minutemailer-kit.js +8 -0
- package/components/ui/button.d.ts +1 -1
- package/components/ui/button.js +1 -1
- package/hooks/use-i18n.d.ts +1 -0
- package/hooks/use-i18n.js +6 -0
- package/package.json +1 -1
- package/utils/compose/index.d.ts +1 -0
- package/utils/compose/index.js +3 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type ConfirmProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
content: ReactNode;
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
onConfirm: () => void;
|
|
7
|
+
action?: string;
|
|
8
|
+
cancel?: string;
|
|
9
|
+
destructive?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function Confirm({ children, content, title, onConfirm, action, cancel, destructive, }: ConfirmProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from '../components/ui/dialog.js';
|
|
4
|
+
import { Button } from '../components/ui/button.js';
|
|
5
|
+
import { useI18n } from '../hooks/use-i18n.js';
|
|
6
|
+
import { compose } from '../utils/compose/index.js';
|
|
7
|
+
export function Confirm({ children, content, title, onConfirm, action, cancel, destructive = false, }) {
|
|
8
|
+
const t = useI18n();
|
|
9
|
+
const [open, setOpen] = useState(false);
|
|
10
|
+
return (_jsxs(Dialog, { onOpenChange: setOpen, open: open, children: [_jsx(DialogTrigger, { asChild: true, children: children }), _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: title }), _jsx(DialogDescription, { children: content })] }), _jsxs(DialogFooter, { className: "sm:justify-between", children: [_jsx(DialogClose, { asChild: true, children: _jsx(Button, { variant: "outline", children: cancel || t('dialogCancel') }) }), _jsx(Button, { variant: destructive ? 'destructive' : 'default', onClick: compose(onConfirm, () => setOpen(false)), children: action || t('dialogConfirm') })] })] })] }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export declare const Context: import("react").Context<{
|
|
3
|
+
t: (key: string) => string;
|
|
4
|
+
}>;
|
|
5
|
+
type MinutemailerKitProps = {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
t: (key: string) => string;
|
|
8
|
+
};
|
|
9
|
+
export declare function MinutemailerKit({ children, t }: MinutemailerKitProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext } from 'react';
|
|
3
|
+
export const Context = createContext({
|
|
4
|
+
t: (key) => key,
|
|
5
|
+
});
|
|
6
|
+
export function MinutemailerKit({ children, t }) {
|
|
7
|
+
return _jsx(Context.Provider, { value: { t }, children: children });
|
|
8
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
4
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
5
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
package/components/ui/button.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Slot } from '@radix-ui/react-slot';
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
4
|
import { cn } from '../../utils/utils.js';
|
|
5
|
-
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-
|
|
5
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-semibold transition-all cursor-pointer disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
8
8
|
default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useI18n(): (key: string) => string;
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function compose(...fns: any[]): any;
|