@murumets-ee/ui 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,94 @@
1
+ Elastic License 2.0 (ELv2)
2
+
3
+ URL: https://www.elastic.co/licensing/elastic-license
4
+
5
+ ## Acceptance
6
+
7
+ By using the software, you agree to all of the terms and conditions below.
8
+
9
+ ## Copyright License
10
+
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
12
+ non-sublicensable, non-transferable license to use, copy, distribute, make
13
+ available, and prepare derivative works of the software, in each case subject
14
+ to the limitations and conditions below.
15
+
16
+ ## Limitations
17
+
18
+ You may not provide the software to third parties as a hosted or managed
19
+ service, where the service provides users with access to any substantial set
20
+ of the features or functionality of the software.
21
+
22
+ You may not move, change, disable, or circumvent the license key functionality
23
+ in the software, and you may not remove or obscure any functionality in the
24
+ software that is protected by the license key.
25
+
26
+ You may not alter, remove, or obscure any licensing, copyright, or other
27
+ notices of the licensor in the software. Any use of the licensor's trademarks
28
+ is subject to applicable law.
29
+
30
+ ## Patents
31
+
32
+ The licensor grants you a license, under any patent claims the licensor can
33
+ license, or becomes able to license, to make, have made, use, sell, offer for
34
+ sale, import and have imported the software, in each case subject to the
35
+ limitations and conditions in this license. This license does not cover any
36
+ patent claims that you cause to be infringed by modifications or additions to
37
+ the software. If you or your company make any written claim that the software
38
+ infringes or contributes to infringement of any patent, your patent license
39
+ for the software granted under these terms ends immediately. If your company
40
+ makes such a claim, your patent license ends immediately for work on behalf
41
+ of your company.
42
+
43
+ ## Notices
44
+
45
+ You must ensure that anyone who gets a copy of any part of the software from
46
+ you also gets a copy of these terms.
47
+
48
+ If you modify the software, you must include in any modified copies of the
49
+ software prominent notices stating that you have modified the software.
50
+
51
+ ## No Other Rights
52
+
53
+ These terms do not imply any licenses other than those expressly granted in
54
+ these terms.
55
+
56
+ ## Termination
57
+
58
+ If you use the software in violation of these terms, such use is not licensed,
59
+ and your licenses will automatically terminate. If the licensor provides you
60
+ with a notice of your violation, and you cease all violation of this license
61
+ no later than 30 days after you receive that notice, your licenses will be
62
+ reinstated retroactively. However, if you violate these terms after such
63
+ reinstatement, any additional violation of these terms will cause your
64
+ licenses to terminate automatically and permanently.
65
+
66
+ ## No Liability
67
+
68
+ As far as the law allows, the software comes as is, without any warranty or
69
+ condition, and the licensor will not be liable to you for any damages arising
70
+ out of these terms or the use or nature of the software, under any kind of
71
+ legal claim.
72
+
73
+ ## Definitions
74
+
75
+ The **licensor** is the entity offering these terms, and the **software** is
76
+ the software the licensor makes available under these terms, including any
77
+ portion of it.
78
+
79
+ **you** refers to the individual or entity agreeing to these terms.
80
+
81
+ **your company** is any legal entity, sole proprietorship, or other kind of
82
+ organization that you work for, plus all organizations that have control over,
83
+ are under the control of, or are under common control with that organization.
84
+ **control** means ownership of substantially all the assets of an entity, or
85
+ the power to direct the management and policies of an entity (for example, by
86
+ voting right, contract, or otherwise). Control can be direct or indirect.
87
+
88
+ **your licenses** are all the licenses granted to you for the software under
89
+ these terms.
90
+
91
+ **use** means anything you do with the software requiring one of your
92
+ licenses.
93
+
94
+ **trademark** means trademarks, service marks, and similar rights.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @murumets-ee/ui
2
+
3
+ Shared UI primitives — Button, Input, Dialog, DataTable, Form, and more (built on Radix + Tailwind).
4
+
5
+ Part of [Lumi CMS](https://github.com/murumets-ee/lumi-cms) — a modular, type-safe CMS toolkit for Node.js.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @murumets-ee/ui
11
+ ```
12
+
13
+ ## License
14
+
15
+ [Elastic License 2.0 (ELv2)](../../LICENSE)
@@ -0,0 +1,149 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { HTMLAttributes, ButtonHTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, TextareaHTMLAttributes } from 'react';
4
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
5
+ import { ColumnDef, Column, Table as Table$1 } from '@tanstack/react-table';
6
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
7
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
8
+ import * as _radix_ui_react_slot from '@radix-ui/react-slot';
9
+ import * as react_hook_form from 'react-hook-form';
10
+ import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
11
+ import * as LabelPrimitive from '@radix-ui/react-label';
12
+ import { ClassValue } from 'clsx';
13
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
14
+ export { toast } from 'sonner';
15
+
16
+ interface BadgeProps extends HTMLAttributes<HTMLDivElement> {
17
+ variant?: 'default' | 'secondary' | 'destructive' | 'outline';
18
+ }
19
+ declare function Badge({ className, variant, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
20
+
21
+ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
22
+ variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
23
+ size?: 'default' | 'sm' | 'lg' | 'icon';
24
+ loading?: boolean;
25
+ asChild?: boolean;
26
+ }
27
+ declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
28
+
29
+ declare const Card: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
30
+ declare const CardHeader: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
31
+ declare const CardTitle: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
32
+ declare const CardDescription: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
33
+ declare const CardContent: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
34
+ declare const CardFooter: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
35
+
36
+ declare const Checkbox: react.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & react.RefAttributes<HTMLButtonElement>, "ref"> & react.RefAttributes<HTMLButtonElement>>;
37
+
38
+ interface DataTableClassNames {
39
+ root?: string;
40
+ toolbar?: string;
41
+ table?: string;
42
+ pagination?: string;
43
+ }
44
+ interface DataTableProps<TData, TValue> {
45
+ columns: ColumnDef<TData, TValue>[];
46
+ data: TData[];
47
+ searchKey?: string;
48
+ searchPlaceholder?: string;
49
+ pageSize?: number;
50
+ emptyMessage?: string;
51
+ classNames?: DataTableClassNames;
52
+ }
53
+ declare function DataTable<TData, TValue>({ columns, data, searchKey, searchPlaceholder, pageSize, emptyMessage, classNames, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
54
+
55
+ interface DataTableColumnHeaderProps<TData, TValue> {
56
+ column: Column<TData, TValue>;
57
+ title: string;
58
+ className?: string;
59
+ }
60
+ declare function DataTableColumnHeader<TData, TValue>({ column, title, className, }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime.JSX.Element;
61
+
62
+ interface DataTablePaginationProps<TData> {
63
+ table: Table$1<TData>;
64
+ className?: string;
65
+ }
66
+ declare function DataTablePagination<TData>({ table, className }: DataTablePaginationProps<TData>): react_jsx_runtime.JSX.Element;
67
+
68
+ interface DataTableViewOptionsProps<TData> {
69
+ table: Table$1<TData>;
70
+ }
71
+ declare function DataTableViewOptions<TData>({ table }: DataTableViewOptionsProps<TData>): react_jsx_runtime.JSX.Element;
72
+
73
+ declare const Dialog: react.FC<DialogPrimitive.DialogProps>;
74
+ declare const DialogTrigger: react.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
75
+ declare const DialogClose: react.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
76
+ declare const DialogPortal: react.FC<DialogPrimitive.DialogPortalProps>;
77
+ declare const DialogOverlay: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
78
+ declare const DialogContent: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
79
+ declare function DialogHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
80
+ declare function DialogFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
81
+ declare const DialogTitle: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & react.RefAttributes<HTMLHeadingElement>, "ref"> & react.RefAttributes<HTMLHeadingElement>>;
82
+ declare const DialogDescription: react.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & react.RefAttributes<HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>>;
83
+
84
+ declare const DropdownMenu: react.FC<DropdownMenuPrimitive.DropdownMenuProps>;
85
+ declare const DropdownMenuTrigger: react.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & react.RefAttributes<HTMLButtonElement>>;
86
+ declare const DropdownMenuGroup: react.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & react.RefAttributes<HTMLDivElement>>;
87
+ declare const DropdownMenuPortal: react.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
88
+ declare const DropdownMenuSub: react.FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
89
+ declare const DropdownMenuContent: react.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
90
+ declare const DropdownMenuItem: react.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & react.RefAttributes<HTMLDivElement>, "ref"> & {
91
+ inset?: boolean;
92
+ } & react.RefAttributes<HTMLDivElement>>;
93
+ declare const DropdownMenuCheckboxItem: react.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
94
+ declare const DropdownMenuLabel: react.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuLabelProps & react.RefAttributes<HTMLDivElement>, "ref"> & {
95
+ inset?: boolean;
96
+ } & react.RefAttributes<HTMLDivElement>>;
97
+ declare const DropdownMenuSeparator: react.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
98
+ declare const DropdownMenuSubTrigger: react.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & react.RefAttributes<HTMLDivElement>, "ref"> & {
99
+ inset?: boolean;
100
+ } & react.RefAttributes<HTMLDivElement>>;
101
+ declare const DropdownMenuSubContent: react.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
102
+ declare function DropdownMenuShortcut({ className, ...props }: HTMLAttributes<HTMLSpanElement>): react_jsx_runtime.JSX.Element;
103
+
104
+ declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: react_hook_form.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
105
+ declare function FormField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(props: ControllerProps<TFieldValues, TName>): react_jsx_runtime.JSX.Element;
106
+ declare function useFormField(): {
107
+ invalid: boolean;
108
+ isDirty: boolean;
109
+ isTouched: boolean;
110
+ isValidating: boolean;
111
+ error?: react_hook_form.FieldError;
112
+ id: string;
113
+ name: string;
114
+ formItemId: string;
115
+ formDescriptionId: string;
116
+ formMessageId: string;
117
+ };
118
+ declare const FormItem: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
119
+ declare const FormLabel: react.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & react.RefAttributes<HTMLLabelElement>, "ref"> & react.RefAttributes<HTMLLabelElement>>;
120
+ declare const FormControl: react.ForwardRefExoticComponent<Omit<_radix_ui_react_slot.SlotProps & react.RefAttributes<HTMLElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
121
+ declare const FormDescription: react.ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & react.RefAttributes<HTMLParagraphElement>>;
122
+ declare const FormMessage: react.ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & react.RefAttributes<HTMLParagraphElement>>;
123
+
124
+ declare const Input: react.ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & react.RefAttributes<HTMLInputElement>>;
125
+
126
+ declare const Label: react.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & react.RefAttributes<HTMLLabelElement>, "ref"> & react.RefAttributes<HTMLLabelElement>>;
127
+
128
+ declare function cn(...inputs: ClassValue[]): string;
129
+
130
+ declare const Select: react.ForwardRefExoticComponent<SelectHTMLAttributes<HTMLSelectElement> & react.RefAttributes<HTMLSelectElement>>;
131
+
132
+ declare const Separator: react.ForwardRefExoticComponent<Omit<SeparatorPrimitive.SeparatorProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
133
+
134
+ declare function Skeleton({ className, ...props }: HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
135
+
136
+ declare function Toaster(): react_jsx_runtime.JSX.Element;
137
+
138
+ declare const Table: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTableElement> & react.RefAttributes<HTMLTableElement>>;
139
+ declare const TableHeader: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & react.RefAttributes<HTMLTableSectionElement>>;
140
+ declare const TableBody: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & react.RefAttributes<HTMLTableSectionElement>>;
141
+ declare const TableFooter: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & react.RefAttributes<HTMLTableSectionElement>>;
142
+ declare const TableRow: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTableRowElement> & react.RefAttributes<HTMLTableRowElement>>;
143
+ declare const TableHead: react.ForwardRefExoticComponent<ThHTMLAttributes<HTMLTableCellElement> & react.RefAttributes<HTMLTableCellElement>>;
144
+ declare const TableCell: react.ForwardRefExoticComponent<TdHTMLAttributes<HTMLTableCellElement> & react.RefAttributes<HTMLTableCellElement>>;
145
+ declare const TableCaption: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTableCaptionElement> & react.RefAttributes<HTMLTableCaptionElement>>;
146
+
147
+ declare const Textarea: react.ForwardRefExoticComponent<TextareaHTMLAttributes<HTMLTextAreaElement> & react.RefAttributes<HTMLTextAreaElement>>;
148
+
149
+ export { Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DataTable, type DataTableClassNames, DataTableColumnHeader, DataTablePagination, type DataTableProps, DataTableViewOptions, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, Label, Select, Separator, Skeleton, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Textarea, Toaster, cn, useFormField };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{clsx as Ue}from"clsx";import{twMerge as Xe}from"tailwind-merge";function r(...e){return Xe(Ue(e))}import{jsx as Qe}from"react/jsx-runtime";var qe={default:"border-transparent bg-primary text-primary-foreground shadow-xs",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-xs",outline:"text-foreground"};function Je({className:e,variant:t="default",...o}){return Qe("div",{className:r("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold","transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",qe[t],e),...o})}import{Slot as Ye}from"@radix-ui/react-slot";import{Loader2 as Ze}from"lucide-react";import{forwardRef as Ke}from"react";import{jsx as ne,jsxs as tt}from"react/jsx-runtime";var je={default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},et={default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"},m=Ke(({className:e,variant:t="default",size:o="default",loading:a=!1,asChild:i=!1,disabled:d,children:c,type:j="button",...A},B)=>{let z=r("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium","transition-colors cursor-pointer","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0",je[t],et[o],e);return i?ne(Ye,{ref:B,className:z,...A,children:c}):tt("button",{ref:B,disabled:d||a,className:z,type:j,...A,children:[a&&ne(Ze,{className:"h-4 w-4 animate-spin"}),c]})});m.displayName="Button";import{forwardRef as h}from"react";import{jsx as P}from"react/jsx-runtime";var ie=h(({className:e,...t},o)=>P("div",{ref:o,className:r("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));ie.displayName="Card";var se=h(({className:e,...t},o)=>P("div",{ref:o,className:r("flex flex-col space-y-1.5 p-6",e),...t}));se.displayName="CardHeader";var le=h(({className:e,...t},o)=>P("div",{ref:o,className:r("font-semibold leading-none tracking-tight",e),...t}));le.displayName="CardTitle";var de=h(({className:e,...t},o)=>P("div",{ref:o,className:r("text-sm text-muted-foreground",e),...t}));de.displayName="CardDescription";var me=h(({className:e,...t},o)=>P("div",{ref:o,className:r("p-6 pt-0",e),...t}));me.displayName="CardContent";var pe=h(({className:e,...t},o)=>P("div",{ref:o,className:r("flex items-center p-6 pt-0",e),...t}));pe.displayName="CardFooter";import*as W from"@radix-ui/react-checkbox";import{Check as ot}from"lucide-react";import{forwardRef as rt}from"react";import{jsx as ee}from"react/jsx-runtime";var ue=rt(({className:e,...t},o)=>ee(W.Root,{ref:o,className:r("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow-xs","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:ee(W.Indicator,{className:"flex items-center justify-center text-current",children:ee(ot,{className:"h-3.5 w-3.5"})})}));ue.displayName="Checkbox";import{flexRender as xe,getCoreRowModel as Tt,getFilteredRowModel as xt,getPaginationRowModel as vt,getSortedRowModel as Dt,useReactTable as Mt}from"@tanstack/react-table";import{useState as Y}from"react";import{forwardRef as at}from"react";import{jsx as nt}from"react/jsx-runtime";var O=at(({className:e,type:t,...o},a)=>nt("input",{type:t,ref:a,className:r("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs","transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",e),...o}));O.displayName="Input";import{forwardRef as v}from"react";import{jsx as b}from"react/jsx-runtime";var _=v(({className:e,...t},o)=>b("div",{className:"relative w-full overflow-auto",children:b("table",{ref:o,className:r("w-full caption-bottom text-sm",e),...t})}));_.displayName="Table";var G=v(({className:e,...t},o)=>b("thead",{ref:o,className:r("[&_tr]:border-b",e),...t}));G.displayName="TableHeader";var $=v(({className:e,...t},o)=>b("tbody",{ref:o,className:r("[&_tr:last-child]:border-0",e),...t}));$.displayName="TableBody";var ce=v(({className:e,...t},o)=>b("tfoot",{ref:o,className:r("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));ce.displayName="TableFooter";var N=v(({className:e,...t},o)=>b("tr",{ref:o,className:r("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));N.displayName="TableRow";var U=v(({className:e,...t},o)=>b("th",{ref:o,className:r("h-10 px-2 text-left align-middle font-medium text-muted-foreground","[&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));U.displayName="TableHead";var F=v(({className:e,...t},o)=>b("td",{ref:o,className:r("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));F.displayName="TableCell";var fe=v(({className:e,...t},o)=>b("caption",{ref:o,className:r("mt-4 text-sm text-muted-foreground",e),...t}));fe.displayName="TableCaption";import{ChevronLeft as it,ChevronRight as st,ChevronsLeft as lt,ChevronsRight as dt}from"lucide-react";import{jsx as f,jsxs as T}from"react/jsx-runtime";function X({table:e,className:t}){let o=e.getFilteredSelectedRowModel().rows.length,a=e.getFilteredRowModel().rows.length;return T("div",{className:r("flex items-center justify-between px-2",t),children:[f("div",{className:"flex-1 text-sm text-muted-foreground",children:o>0&&T("span",{children:[o," of ",a," row(s) selected"]})}),T("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[f("div",{className:"flex items-center space-x-2",children:T("p",{className:"text-sm font-medium",children:["Page ",e.getState().pagination.pageIndex+1," of ",e.getPageCount()]})}),T("div",{className:"flex items-center space-x-2",children:[T(m,{variant:"outline",size:"icon",className:"hidden h-8 w-8 lg:flex",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:[f("span",{className:"sr-only",children:"Go to first page"}),f(lt,{className:"h-4 w-4"})]}),T(m,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:[f("span",{className:"sr-only",children:"Go to previous page"}),f(it,{className:"h-4 w-4"})]}),T(m,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:[f("span",{className:"sr-only",children:"Go to next page"}),f(st,{className:"h-4 w-4"})]}),T(m,{variant:"outline",size:"icon",className:"hidden h-8 w-8 lg:flex",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),children:[f("span",{className:"sr-only",children:"Go to last page"}),f(dt,{className:"h-4 w-4"})]})]})]})]})}import{Settings2 as bt}from"lucide-react";import*as n from"@radix-ui/react-dropdown-menu";import{Check as mt,ChevronRight as pt}from"lucide-react";import{forwardRef as C}from"react";import{jsx as p,jsxs as Te}from"react/jsx-runtime";var R=n.Root,E=n.Trigger,ut=n.Group,ct=n.Portal,ft=n.Sub,H=C(({className:e,sideOffset:t=4,...o},a)=>p(n.Portal,{children:p(n.Content,{ref:a,sideOffset:t,className:r("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));H.displayName="DropdownMenuContent";var L=C(({className:e,inset:t,...o},a)=>p(n.Item,{ref:a,className:r("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none","transition-colors focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0",t&&"pl-8",e),...o}));L.displayName="DropdownMenuItem";var q=C(({className:e,children:t,checked:o,...a},i)=>Te(n.CheckboxItem,{ref:i,className:r("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none","transition-colors focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:o,...a,children:[p("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p(n.ItemIndicator,{children:p(mt,{className:"h-4 w-4"})})}),t]}));q.displayName="DropdownMenuCheckboxItem";var J=C(({className:e,inset:t,...o},a)=>p(n.Label,{ref:a,className:r("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...o}));J.displayName="DropdownMenuLabel";var S=C(({className:e,...t},o)=>p(n.Separator,{ref:o,className:r("-mx-1 my-1 h-px bg-muted",e),...t}));S.displayName="DropdownMenuSeparator";var ge=C(({className:e,inset:t,children:o,...a},i)=>Te(n.SubTrigger,{ref:i,className:r("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none","focus:bg-accent data-[state=open]:bg-accent","[&_svg]:pointer-events-none [&_svg]:shrink-0",t&&"pl-8",e),...a,children:[o,p(pt,{className:"ml-auto h-4 w-4"})]}));ge.displayName="DropdownMenuSubTrigger";var be=C(({className:e,...t},o)=>p(n.SubContent,{ref:o,className:r("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));be.displayName="DropdownMenuSubContent";function gt({className:e,...t}){return p("span",{className:r("ml-auto text-xs tracking-widest opacity-60",e),...t})}import{jsx as k,jsxs as te}from"react/jsx-runtime";function Q({table:e}){return te(R,{children:[k(E,{asChild:!0,children:te(m,{variant:"outline",size:"sm",className:"ml-auto hidden h-8 lg:flex",children:[k(bt,{className:"mr-2 h-4 w-4"}),"View"]})}),te(H,{align:"end",className:"w-[150px]",children:[k(J,{children:"Toggle columns"}),k(S,{}),e.getAllColumns().filter(t=>typeof t.accessorFn<"u"&&t.getCanHide()).map(t=>k(q,{className:"capitalize",checked:t.getIsVisible(),onCheckedChange:o=>t.toggleVisibility(!!o),children:t.id},t.id))]})]})}import{jsx as l,jsxs as oe}from"react/jsx-runtime";function ve({columns:e,data:t,searchKey:o,searchPlaceholder:a="Filter...",pageSize:i=10,emptyMessage:d="No results.",classNames:c}){let[j,A]=Y([]),[B,z]=Y([]),[Oe,_e]=Y({}),[Ge,$e]=Y({}),w=Mt({data:t,columns:e,state:{sorting:j,columnFilters:B,columnVisibility:Oe,rowSelection:Ge},onSortingChange:A,onColumnFiltersChange:z,onColumnVisibilityChange:_e,onRowSelectionChange:$e,getCoreRowModel:Tt(),getSortedRowModel:Dt(),getFilteredRowModel:xt(),getPaginationRowModel:vt(),initialState:{pagination:{pageSize:i}}});return oe("div",{className:r("space-y-4",c?.root),children:[oe("div",{className:r("flex items-center justify-between",c?.toolbar),children:[l("div",{className:"flex flex-1 items-center space-x-2",children:o&&l(O,{placeholder:a,value:w.getColumn(o)?.getFilterValue()??"",onChange:x=>w.getColumn(o)?.setFilterValue(x.target.value),className:"h-8 w-[150px] lg:w-[250px]"})}),l(Q,{table:w})]}),l("div",{className:r("rounded-md border",c?.table),children:oe(_,{children:[l(G,{children:w.getHeaderGroups().map(x=>l(N,{children:x.headers.map(g=>l(U,{colSpan:g.colSpan,children:g.isPlaceholder?null:xe(g.column.columnDef.header,g.getContext())},g.id))},x.id))}),l($,{children:w.getRowModel().rows.length>0?w.getRowModel().rows.map(x=>l(N,{"data-state":x.getIsSelected()&&"selected",children:x.getVisibleCells().map(g=>l(F,{children:xe(g.column.columnDef.cell,g.getContext())},g.id))},x.id)):l(N,{children:l(F,{colSpan:e.length,className:"h-24 text-center",children:d})})})]})}),l(X,{table:w,className:c?.pagination})]})}import{ArrowDown as De,ArrowUp as Me,ChevronsUpDown as wt,EyeOff as Ct}from"lucide-react";import{Fragment as yt,jsx as u,jsxs as y}from"react/jsx-runtime";function we({column:e,title:t,className:o}){return e.getCanSort()?u("div",{className:r("flex items-center space-x-2",o),children:y(R,{children:[u(E,{asChild:!0,children:y(m,{variant:"ghost",size:"sm",className:"-ml-3 h-8 data-[state=open]:bg-accent",children:[u("span",{children:t}),e.getIsSorted()==="desc"?u(De,{className:"ml-2 h-4 w-4"}):e.getIsSorted()==="asc"?u(Me,{className:"ml-2 h-4 w-4"}):u(wt,{className:"ml-2 h-4 w-4"})]})}),y(H,{align:"start",children:[y(L,{onClick:()=>e.toggleSorting(!1),children:[u(Me,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Asc"]}),y(L,{onClick:()=>e.toggleSorting(!0),children:[u(De,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Desc"]}),e.getCanHide()&&y(yt,{children:[u(S,{}),y(L,{onClick:()=>e.toggleVisibility(!1),children:[u(Ct,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70"}),"Hide"]})]})]})]})}):u("div",{className:r(o),children:t})}import*as s from"@radix-ui/react-dialog";import{X as ht}from"lucide-react";import{forwardRef as Z}from"react";import{jsx as D,jsxs as re}from"react/jsx-runtime";var Pt=s.Root,Nt=s.Trigger,Ht=s.Close,Ce=s.Portal,ae=Z(({className:e,...t},o)=>D(s.Overlay,{ref:o,className:r("fixed inset-0 z-50 bg-black/80","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));ae.displayName="DialogOverlay";var ye=Z(({className:e,children:t,...o},a)=>re(Ce,{children:[D(ae,{}),re(s.Content,{ref:a,className:r("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]","gap-4 border bg-background p-6 shadow-lg sm:rounded-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",e),...o,children:[t,re(s.Close,{className:r("absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity","hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground","cursor-pointer"),children:[D(ht,{className:"h-4 w-4"}),D("span",{className:"sr-only",children:"Close"})]})]})]}));ye.displayName="DialogContent";function Lt({className:e,...t}){return D("div",{className:r("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function St({className:e,...t}){return D("div",{className:r("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}var he=Z(({className:e,...t},o)=>D(s.Title,{ref:o,className:r("text-lg font-semibold leading-none tracking-tight",e),...t}));he.displayName="DialogTitle";var Pe=Z(({className:e,...t},o)=>D(s.Description,{ref:o,className:r("text-sm text-muted-foreground",e),...t}));Pe.displayName="DialogDescription";import{Slot as Et}from"@radix-ui/react-slot";import{createContext as Le,forwardRef as I,useContext as He,useId as kt}from"react";import{Controller as It,FormProvider as Vt,useFormContext as At}from"react-hook-form";import*as Ne from"@radix-ui/react-label";import{forwardRef as Ft}from"react";import{jsx as Rt}from"react/jsx-runtime";var K=Ft(({className:e,...t},o)=>Rt(Ne.Root,{ref:o,className:r("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));K.displayName="Label";import{jsx as M}from"react/jsx-runtime";var Bt=Vt,Se=Le({});function zt(e){return M(Se.Provider,{value:{name:e.name},children:M(It,{...e})})}var Fe=Le({});function V(){let e=He(Se),t=He(Fe),{getFieldState:o,formState:a}=At(),i=o(e.name,a),{id:d}=t;return{id:d,name:e.name,formItemId:`${d}-form-item`,formDescriptionId:`${d}-form-item-description`,formMessageId:`${d}-form-item-message`,...i}}var Re=I(({className:e,...t},o)=>{let a=kt();return M(Fe.Provider,{value:{id:a},children:M("div",{ref:o,className:r("space-y-2",e),...t})})});Re.displayName="FormItem";var Ee=I(({className:e,...t},o)=>{let{error:a,formItemId:i}=V();return M(K,{ref:o,className:r(a&&"text-destructive",e),htmlFor:i,...t})});Ee.displayName="FormLabel";var ke=I(({...e},t)=>{let{error:o,formItemId:a,formDescriptionId:i,formMessageId:d}=V();return M(Et,{ref:t,id:a,"aria-describedby":o?`${i} ${d}`:i,"aria-invalid":!!o,...e})});ke.displayName="FormControl";var Ie=I(({className:e,...t},o)=>{let{formDescriptionId:a}=V();return M("p",{ref:o,id:a,className:r("text-[0.8rem] text-muted-foreground",e),...t})});Ie.displayName="FormDescription";var Ve=I(({className:e,children:t,...o},a)=>{let{error:i,formMessageId:d}=V(),c=i?String(i.message):t;return c?M("p",{ref:a,id:d,className:r("text-[0.8rem] font-medium text-destructive",e),...o,children:c}):null});Ve.displayName="FormMessage";import{forwardRef as Wt}from"react";import{jsx as Ot}from"react/jsx-runtime";var Ae=Wt(({className:e,children:t,...o},a)=>Ot("select",{ref:a,className:r("flex h-9 w-full rounded-md border border-input bg-background text-foreground px-3 py-1 text-sm shadow-xs","transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",e),...o,children:t}));Ae.displayName="Select";import*as Be from"@radix-ui/react-separator";import{forwardRef as _t}from"react";import{jsx as Gt}from"react/jsx-runtime";var ze=_t(({className:e,orientation:t="horizontal",decorative:o=!0,...a},i)=>Gt(Be.Root,{ref:i,decorative:o,orientation:t,className:r("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...a}));ze.displayName="Separator";import{jsx as Ut}from"react/jsx-runtime";function $t({className:e,...t}){return Ut("div",{className:r("animate-pulse rounded-md bg-muted",e),...t})}import{Toaster as Xt,toast as qt}from"sonner";import{jsx as Qt}from"react/jsx-runtime";function Jt(){return Qt(Xt,{position:"bottom-right",toastOptions:{style:{background:"var(--color-background)",color:"var(--color-foreground)",border:"1px solid var(--color-border)"},classNames:{error:"sonner-error",success:"sonner-success"}}})}import{forwardRef as Yt}from"react";import{jsx as Zt}from"react/jsx-runtime";var We=Yt(({className:e,...t},o)=>Zt("textarea",{ref:o,className:r("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",e),...t}));We.displayName="Textarea";export{Je as Badge,m as Button,ie as Card,me as CardContent,de as CardDescription,pe as CardFooter,se as CardHeader,le as CardTitle,ue as Checkbox,ve as DataTable,we as DataTableColumnHeader,X as DataTablePagination,Q as DataTableViewOptions,Pt as Dialog,Ht as DialogClose,ye as DialogContent,Pe as DialogDescription,St as DialogFooter,Lt as DialogHeader,ae as DialogOverlay,Ce as DialogPortal,he as DialogTitle,Nt as DialogTrigger,R as DropdownMenu,q as DropdownMenuCheckboxItem,H as DropdownMenuContent,ut as DropdownMenuGroup,L as DropdownMenuItem,J as DropdownMenuLabel,ct as DropdownMenuPortal,S as DropdownMenuSeparator,gt as DropdownMenuShortcut,ft as DropdownMenuSub,be as DropdownMenuSubContent,ge as DropdownMenuSubTrigger,E as DropdownMenuTrigger,Bt as Form,ke as FormControl,Ie as FormDescription,zt as FormField,Re as FormItem,Ee as FormLabel,Ve as FormMessage,O as Input,K as Label,Ae as Select,ze as Separator,$t as Skeleton,_ as Table,$ as TableBody,fe as TableCaption,F as TableCell,ce as TableFooter,U as TableHead,G as TableHeader,N as TableRow,We as Textarea,Jt as Toaster,r as cn,qt as toast,V as useFormField};
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@murumets-ee/ui",
3
+ "version": "0.1.0",
4
+ "license": "Elastic-2.0",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ }
11
+ },
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "dependencies": {
16
+ "@radix-ui/react-checkbox": "^1.1.0",
17
+ "@radix-ui/react-dialog": "^1.1.0",
18
+ "@radix-ui/react-dropdown-menu": "^2.1.0",
19
+ "@radix-ui/react-label": "^2.1.0",
20
+ "@radix-ui/react-separator": "^1.1.0",
21
+ "@radix-ui/react-slot": "^1.1.0",
22
+ "@radix-ui/react-visually-hidden": "^1.1.0",
23
+ "clsx": "^2.1.0",
24
+ "sonner": "^2.0.7",
25
+ "tailwind-merge": "^2.6.0"
26
+ },
27
+ "peerDependencies": {
28
+ "@hookform/resolvers": ">=3.0.0",
29
+ "@tanstack/react-table": ">=8.0.0",
30
+ "lucide-react": ">=0.400.0",
31
+ "react": ">=19.0.0",
32
+ "react-dom": ">=19.0.0",
33
+ "react-hook-form": ">=7.50.0",
34
+ "zod": ">=3.22.0"
35
+ },
36
+ "peerDependenciesMeta": {
37
+ "@tanstack/react-table": {
38
+ "optional": true
39
+ },
40
+ "react-hook-form": {
41
+ "optional": true
42
+ },
43
+ "@hookform/resolvers": {
44
+ "optional": true
45
+ },
46
+ "zod": {
47
+ "optional": true
48
+ }
49
+ },
50
+ "devDependencies": {
51
+ "@hookform/resolvers": "^5.2.2",
52
+ "@tanstack/react-table": "^8.21.3",
53
+ "@types/react": "^19",
54
+ "@types/react-dom": "^19",
55
+ "lucide-react": "^0.563.0",
56
+ "react": "^19.0.0",
57
+ "react-dom": "^19.0.0",
58
+ "react-hook-form": "^7.71.1",
59
+ "tsup": "^8.3.5",
60
+ "typescript": "^5.7.3",
61
+ "vitest": "^2.1.8",
62
+ "zod": "^3.24.0"
63
+ },
64
+ "scripts": {
65
+ "build": "tsup",
66
+ "dev": "tsup --watch",
67
+ "test": "vitest"
68
+ }
69
+ }