@minutemailer/kit 1.1.0 → 1.1.2

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.
@@ -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?: "default" | "destructive" | "link" | "outline" | "secondary" | "ghost" | null | undefined;
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> & {
@@ -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-base 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", {
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',
@@ -120,7 +120,7 @@ function SidebarRail({ className, ...props }) {
120
120
  return (_jsx("button", { "data-sidebar": "rail", "data-slot": "sidebar-rail", "aria-label": "Toggle Sidebar", tabIndex: -1, onClick: toggleSidebar, title: "Toggle Sidebar", className: cn('hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex', 'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize', '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize', 'hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full', '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2', '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2', className), ...props }));
121
121
  }
122
122
  function SidebarInset({ className, ...props }) {
123
- return (_jsx("main", { "data-slot": "sidebar-inset", className: cn('bg-background relative flex w-full flex-1 flex-col', 'md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2', className), ...props }));
123
+ return (_jsx("main", { "data-slot": "sidebar-inset", className: cn('bg-accent relative flex w-full flex-1 flex-col', 'md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2', className), ...props }));
124
124
  }
125
125
  function SidebarInput({ className, ...props }) {
126
126
  return (_jsx(Input, { "data-slot": "sidebar-input", "data-sidebar": "input", className: cn('bg-background h-8 w-full shadow-none', className), ...props }));
@@ -0,0 +1 @@
1
+ export declare function useI18n(): (key: string) => string;
@@ -0,0 +1,6 @@
1
+ import { useContext } from 'react';
2
+ import { Context } from '../components/minutemailer-kit.js';
3
+ export function useI18n() {
4
+ const { t } = useContext(Context);
5
+ return t;
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minutemailer/kit",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Minutemailer UI Kit",
5
5
  "license": "MIT",
6
6
  "author": "Minutemailer",
package/styles.css CHANGED
@@ -64,7 +64,7 @@
64
64
  --chart-3: oklch(0.398 0.07 227.392);
65
65
  --chart-4: oklch(0.828 0.189 84.429);
66
66
  --chart-5: oklch(0.769 0.188 70.08);
67
- --sidebar: oklch(0.985 0 0);
67
+ --sidebar: oklch(1 0 0);
68
68
  --sidebar-foreground: oklch(0.145 0 0);
69
69
  --sidebar-primary: oklch(0.205 0 0);
70
70
  --sidebar-primary-foreground: oklch(0.985 0 0);
@@ -0,0 +1 @@
1
+ export declare function compose(...fns: any[]): any;
@@ -0,0 +1,3 @@
1
+ export function compose(...fns) {
2
+ return fns.reduce((f, g) => (...args) => f(g(...args)));
3
+ }