@eintrek/erp-theme 1.0.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.
Files changed (34) hide show
  1. package/README.md +135 -0
  2. package/dist/components/ui/Form.d.ts +25 -0
  3. package/dist/components/ui/Form.stories.d.ts +8 -0
  4. package/dist/components/ui/Input.d.ts +17 -0
  5. package/dist/components/ui/Input.stories.d.ts +10 -0
  6. package/dist/components/ui/InputDropdown.d.ts +19 -0
  7. package/dist/components/ui/InputDropdown.stories.d.ts +9 -0
  8. package/dist/components/ui/Label.d.ts +8 -0
  9. package/dist/components/ui/Label.stories.d.ts +8 -0
  10. package/dist/components/ui/Modal.d.ts +12 -0
  11. package/dist/components/ui/Modal.stories.d.ts +13 -0
  12. package/dist/components/ui/badge/Badge.d.ts +6 -0
  13. package/dist/components/ui/button/Button.d.ts +7 -0
  14. package/dist/components/ui/button.d.ts +14 -0
  15. package/dist/components/ui/button.stories.d.ts +25 -0
  16. package/dist/components/ui/card.d.ts +8 -0
  17. package/dist/components/ui/card.stories.d.ts +8 -0
  18. package/dist/components/ui/table/Table.d.ts +5 -0
  19. package/dist/components/ui/table/Table.stories.d.ts +6 -0
  20. package/dist/components/ui/table/TableBody.d.ts +3 -0
  21. package/dist/components/ui/table/TableBody.stories.d.ts +7 -0
  22. package/dist/components/ui/table/TableFilter.d.ts +3 -0
  23. package/dist/components/ui/table/TableFilter.stories.d.ts +6 -0
  24. package/dist/components/ui/table/TablePagination.d.ts +10 -0
  25. package/dist/components/ui/table/TablePagination.stories.d.ts +6 -0
  26. package/dist/components/ui/table/index.d.ts +13 -0
  27. package/dist/components/ui/table/types.d.ts +54 -0
  28. package/dist/components/ui/tabs/Tabs.d.ts +11 -0
  29. package/dist/index.css +1 -0
  30. package/dist/index.d.ts +11 -0
  31. package/dist/index.js +11297 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/lib/utils.d.ts +2 -0
  34. package/package.json +106 -0
package/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # ERP Theme - shadcn/ui Component Library
2
+
3
+ A beautiful and reusable component library built with shadcn/ui, TypeScript, TailwindCSS, and Storybook.
4
+
5
+ ## Features
6
+
7
+ - 🎨 Beautiful components based on shadcn/ui
8
+ - 📚 Storybook for component documentation and testing
9
+ - 🔧 TypeScript support
10
+ - 🎯 TailwindCSS for styling
11
+ - 📦 Ready to be packaged and used in Next.js projects
12
+ - 🌙 Dark mode support
13
+ - ♿ Accessibility-first design
14
+
15
+ ## Getting Started
16
+
17
+ ### Installation
18
+
19
+ ```bash
20
+ npm install
21
+ ```
22
+
23
+ ### Development
24
+
25
+ Start Storybook development server:
26
+
27
+ ```bash
28
+ npm run storybook
29
+ ```
30
+
31
+ Build the library:
32
+
33
+ ```bash
34
+ npm run build
35
+ ```
36
+
37
+ Build Storybook for production:
38
+
39
+ ```bash
40
+ npm run build-storybook
41
+ ```
42
+
43
+ ## Usage in Next.js Project
44
+
45
+ 1. Install the package in your Next.js project:
46
+
47
+ ```bash
48
+ npm install erp-theme
49
+ ```
50
+
51
+ 2. Import TailwindCSS configuration in your `tailwind.config.js`:
52
+
53
+ ```javascript
54
+ import type { Config } from "tailwindcss";
55
+ import erpThemeConfig from "erp-theme/tailwind.config";
56
+
57
+ const config: Config = {
58
+ ...erpThemeConfig,
59
+ content: [
60
+ // your existing content paths
61
+ "./node_modules/erp-theme/dist/**/*.{js,ts,jsx,tsx}",
62
+ ...erpThemeConfig.content,
63
+ ],
64
+ };
65
+
66
+ export default config;
67
+ ```
68
+
69
+ 3. Import the CSS variables in your global CSS:
70
+
71
+ ```css
72
+ @import "erp-theme/dist/globals.css";
73
+ ```
74
+
75
+ 4. Use the components:
76
+
77
+ ```tsx
78
+ import { Button, Card, CardContent, CardHeader, CardTitle } from "erp-theme";
79
+
80
+ export default function MyPage() {
81
+ return (
82
+ <Card>
83
+ <CardHeader>
84
+ <CardTitle>Hello World</CardTitle>
85
+ </CardHeader>
86
+ <CardContent>
87
+ <Button>Click me</Button>
88
+ </CardContent>
89
+ </Card>
90
+ );
91
+ }
92
+ ```
93
+
94
+ ## Components
95
+
96
+ - **Button** - Versatile button component with multiple variants
97
+ - **Card** - Card container with header, content, and footer sections
98
+
99
+ More components coming soon!
100
+
101
+ ## Development
102
+
103
+ ### Project Structure
104
+
105
+ ```
106
+ src/
107
+ ├── components/
108
+ │ └── ui/
109
+ │ ├── button.tsx
110
+ │ ├── button.stories.tsx
111
+ │ ├── card.tsx
112
+ │ └── card.stories.tsx
113
+ ├── lib/
114
+ │ └── utils.ts
115
+ └── index.ts
116
+ ```
117
+
118
+ ### Adding New Components
119
+
120
+ 1. Create the component in `src/components/ui/`
121
+ 2. Create corresponding stories in the same directory
122
+ 3. Export the component from `src/index.ts`
123
+ 4. Update this README
124
+
125
+ ## Contributing
126
+
127
+ 1. Fork the repository
128
+ 2. Create your feature branch
129
+ 3. Commit your changes
130
+ 4. Push to the branch
131
+ 5. Create a Pull Request
132
+
133
+ ## License
134
+
135
+ MIT
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ export interface FormField {
3
+ name: string;
4
+ label: string;
5
+ type: string;
6
+ placeholder: string;
7
+ required: boolean;
8
+ component?: 'input' | 'dropdown';
9
+ options?: {
10
+ label: string;
11
+ value: string;
12
+ }[];
13
+ }
14
+ export interface FormProps {
15
+ onSubmit: (data: any) => void;
16
+ children: (props: {
17
+ control: any;
18
+ errors: any;
19
+ handleSubmit: any;
20
+ }) => React.ReactNode;
21
+ defaultValues?: Record<string, any>;
22
+ formRef?: React.Ref<HTMLFormElement>;
23
+ }
24
+ declare const Form: React.FC<FormProps>;
25
+ export default Form;
@@ -0,0 +1,8 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import Form from './Form';
3
+ declare const meta: Meta<typeof Form>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Form>;
6
+ export declare const Basic: Story;
7
+ export declare const WithValidation: Story;
8
+ export declare const WithDefaultValues: Story;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ export interface InputProps {
3
+ label: string;
4
+ type?: string;
5
+ value?: string;
6
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
7
+ placeholder?: string;
8
+ required?: boolean;
9
+ error?: string;
10
+ name?: string;
11
+ icon?: string;
12
+ suffix?: string;
13
+ disabled?: boolean;
14
+ inputClassName?: string;
15
+ }
16
+ declare const Input: React.FC<InputProps>;
17
+ export default Input;
@@ -0,0 +1,10 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import Input from './Input';
3
+ declare const meta: Meta<typeof Input>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Input>;
6
+ export declare const Basic: Story;
7
+ export declare const Disabled: Story;
8
+ export declare const WithIcon: Story;
9
+ export declare const SuffixText: Story;
10
+ export declare const SuffixIcon: Story;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ export interface InputDropdownOption {
3
+ label: string;
4
+ value: string;
5
+ }
6
+ export interface InputDropdownProps {
7
+ label: string;
8
+ options: InputDropdownOption[];
9
+ value?: string;
10
+ onChange?: (e: React.ChangeEvent<HTMLSelectElement>) => void;
11
+ placeholder?: string;
12
+ required?: boolean;
13
+ error?: string;
14
+ name?: string;
15
+ disabled?: boolean;
16
+ inputClassName?: string;
17
+ }
18
+ declare const InputDropdown: React.FC<InputDropdownProps>;
19
+ export default InputDropdown;
@@ -0,0 +1,9 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import InputDropdown from './InputDropdown';
3
+ declare const meta: Meta<typeof InputDropdown>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof InputDropdown>;
6
+ export declare const Basic: Story;
7
+ export declare const Disabled: Story;
8
+ export declare const CustomBackground: Story;
9
+ export declare const InputClassNameStringExample: Story;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface LabelProps {
3
+ label: string;
4
+ required?: boolean;
5
+ className?: string;
6
+ }
7
+ declare const Label: React.FC<LabelProps>;
8
+ export default Label;
@@ -0,0 +1,8 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import Label from './Label';
3
+ declare const meta: Meta<typeof Label>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Label>;
6
+ export declare const Basic: Story;
7
+ export declare const Required: Story;
8
+ export declare const CustomClass: Story;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export interface ModalProps {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ children: React.ReactNode;
6
+ actions?: React.ReactNode;
7
+ header?: React.ReactNode;
8
+ footer?: React.ReactNode;
9
+ size?: 'sm' | 'md' | 'lg' | 'full';
10
+ }
11
+ declare const Modal: React.FC<ModalProps>;
12
+ export default Modal;
@@ -0,0 +1,13 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import Modal from './Modal';
3
+ declare const meta: Meta<typeof Modal>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Modal>;
6
+ export declare const Basic: Story;
7
+ export declare const WithForm: Story;
8
+ export declare const WithFormFooterSubmit: Story;
9
+ export declare const WithHeaderAndFooter: Story;
10
+ export declare const Sizes: Story;
11
+ export declare const SuccessModal: Story;
12
+ export declare const WarningModal: Story;
13
+ export declare const InfoModal: Story;
@@ -0,0 +1,6 @@
1
+ import { HTMLAttributes } from 'react';
2
+ export interface BadgeProps extends HTMLAttributes<HTMLDivElement> {
3
+ variant?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'destructive';
4
+ }
5
+ declare const Badge: import("react").ForwardRefExoticComponent<BadgeProps & import("react").RefAttributes<HTMLDivElement>>;
6
+ export { Badge };
@@ -0,0 +1,7 @@
1
+ import { ButtonHTMLAttributes } from 'react';
2
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
3
+ variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
4
+ size?: 'default' | 'sm' | 'lg' | 'icon';
5
+ }
6
+ declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
7
+ export { Button };
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
5
+ size?: "default" | "sm" | "lg" | "icon" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
+ asChild?: boolean;
9
+ children?: React.ReactNode;
10
+ prefix?: string;
11
+ suffix?: string;
12
+ }
13
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
14
+ export { Button, buttonVariants };
@@ -0,0 +1,25 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Button } from './button';
3
+ declare const meta: Meta<typeof Button>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Button>;
6
+ export declare const Default: Story;
7
+ export declare const Secondary: Story;
8
+ export declare const Destructive: Story;
9
+ export declare const Outline: Story;
10
+ export declare const Ghost: Story;
11
+ export declare const Link: Story;
12
+ export declare const Small: Story;
13
+ export declare const Large: Story;
14
+ export declare const Blue: Story;
15
+ export declare const Green: Story;
16
+ export declare const Red: Story;
17
+ export declare const Yellow: Story;
18
+ export declare const Purple: Story;
19
+ export declare const Pink: Story;
20
+ export declare const Gray: Story;
21
+ export declare const Basic: Story;
22
+ export declare const Disabled: Story;
23
+ export declare const WithPrefixIcon: Story;
24
+ export declare const WithSuffixIcon: Story;
25
+ export declare const WithBothIcons: Story;
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
3
+ declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
4
+ declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
5
+ declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
6
+ declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
7
+ declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
8
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent, };
@@ -0,0 +1,8 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Card } from './card';
3
+ declare const meta: Meta<typeof Card>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Card>;
6
+ export declare const Default: Story;
7
+ export declare const WithImage: Story;
8
+ export declare const Simple: Story;
@@ -0,0 +1,5 @@
1
+ import { ColumnDef } from '@tanstack/react-table';
2
+ import { TableProps } from './types';
3
+ export declare function Table<T extends Record<string, any> = any>({ data, columns, className, height, enableRowSelection, enableMultiRowSelection, enableSorting, enableFiltering, enablePagination, enableDateFilter, dateColumn, onRowClick, onSelectionChange, onSortingChange, onFilteringChange, onDateFilterChange, headerLeftSection, headerRightSection, }: TableProps<T> & {
4
+ columns: ColumnDef<T>[];
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Table } from './Table';
3
+ declare const meta: Meta<typeof Table>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Table>;
6
+ export declare const Basic: Story;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { TableBodyProps } from './types';
3
+ export declare const TableBody: React.FC<TableBodyProps>;
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { TableBody } from './TableBody';
3
+ declare const meta: Meta<typeof TableBody>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof TableBody>;
6
+ export declare const Default: Story;
7
+ export declare const Basic: Story;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { TableFilterProps } from './types';
3
+ export declare const TableFilter: React.FC<TableFilterProps>;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { TableFilter } from './TableFilter';
3
+ declare const meta: Meta<typeof TableFilter>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof TableFilter>;
6
+ export declare const Default: Story;
@@ -0,0 +1,10 @@
1
+ export interface TablePaginationProps {
2
+ pageIndex: number;
3
+ pageCount: number;
4
+ pageSize: number;
5
+ pageSizeOptions?: number[];
6
+ onPageChange: (page: number) => void;
7
+ onPageSizeChange: (size: number) => void;
8
+ className?: string;
9
+ }
10
+ export declare function TablePagination({ pageIndex, pageCount, pageSize, pageSizeOptions, onPageChange, onPageSizeChange, className, }: TablePaginationProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { TablePagination } from './TablePagination';
3
+ declare const meta: Meta<typeof TablePagination>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof TablePagination>;
6
+ export declare const FullyFeatured: Story;
@@ -0,0 +1,13 @@
1
+ export * from './types';
2
+ export * from './TableFilter';
3
+ export * from './TableBody';
4
+ export interface AccountingRecord {
5
+ id: number;
6
+ date: string;
7
+ description: string;
8
+ debit: number;
9
+ credit: number;
10
+ balance: number;
11
+ created_at: string;
12
+ }
13
+ export declare const mockAccountingData: AccountingRecord[];
@@ -0,0 +1,54 @@
1
+ import { Table as TableInstance, Row } from '@tanstack/react-table';
2
+ import { DateValueType } from 'react-tailwindcss-datepicker';
3
+ import { ReactNode } from 'react';
4
+ export interface TableData {
5
+ [key: string]: any;
6
+ }
7
+ export interface TableProps<T = any> {
8
+ data: T[];
9
+ columns: any[];
10
+ className?: string;
11
+ height?: string;
12
+ enableRowSelection?: boolean;
13
+ enableMultiRowSelection?: boolean;
14
+ enableSorting?: boolean;
15
+ enableFiltering?: boolean;
16
+ enablePagination?: boolean;
17
+ enableDateFilter?: boolean;
18
+ dateColumn?: string;
19
+ headerLeftSection?: ReactNode;
20
+ headerRightSection?: ReactNode;
21
+ onRowClick?: (row: Row<T>) => void;
22
+ onSelectionChange?: (selectedRows: Row<T>[]) => void;
23
+ onSortingChange?: (sorting: any) => void;
24
+ onFilteringChange?: (filters: any) => void;
25
+ onPaginationChange?: (pagination: any) => void;
26
+ onDateFilterChange?: (dateRange: DateValueType) => void;
27
+ }
28
+ export interface TableHeaderProps {
29
+ title?: string;
30
+ description?: string;
31
+ className?: string;
32
+ leftSection?: ReactNode;
33
+ rightSection?: ReactNode;
34
+ tabsSection?: ReactNode;
35
+ }
36
+ export interface TableFilterProps {
37
+ globalFilter: string;
38
+ setGlobalFilter: (value: string) => void;
39
+ showFilterPanel: boolean;
40
+ setShowFilterPanel: (value: boolean) => void;
41
+ enableDateFilter: boolean;
42
+ dateRange: DateValueType;
43
+ setDateRange: (value: DateValueType) => void;
44
+ isDatePickerOpen: boolean;
45
+ setIsDatePickerOpen: (value: boolean) => void;
46
+ table: any;
47
+ }
48
+ export interface TableBodyProps {
49
+ table: TableInstance<any>;
50
+ onRowClick?: (row: Row<any>) => void;
51
+ }
52
+ export interface TablePaginationProps {
53
+ table: TableInstance<any>;
54
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export interface TabItem {
3
+ label: string;
4
+ }
5
+ export interface TabsProps {
6
+ tabs: TabItem[];
7
+ activeIndex: number;
8
+ onTabChange: (index: number) => void;
9
+ className?: string;
10
+ }
11
+ export declare const Tabs: React.FC<TabsProps>;
package/dist/index.css ADDED
@@ -0,0 +1 @@
1
+ .container{margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem;width:100%}@media (min-width:1400px){.container{max-width:1400px}}.\!table,.table{caption-side:bottom;font-size:.875rem;line-height:1.25rem;width:100%}@media (max-width:640px){.\!table{min-width:640px}.table-container{margin-left:-1rem;margin-right:-1rem}.table{min-width:640px}}
@@ -0,0 +1,11 @@
1
+ import "./styles/globals.css";
2
+ export { Button } from "./components/ui/button";
3
+ export { default as Input } from "./components/ui/Input";
4
+ export { default as InputDropdown } from "./components/ui/InputDropdown";
5
+ export { default as Form } from "./components/ui/Form";
6
+ export { default as Modal } from "./components/ui/Modal";
7
+ export { default as Label } from "./components/ui/Label";
8
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from "./components/ui/card";
9
+ export { Table } from "./components/ui/table/Table";
10
+ export * from "./components/ui/table";
11
+ export * from "./lib/utils";