h2o-library 1.0.0 → 1.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/README.md +28 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/src/button.d.ts +1 -1
- package/dist/components/src/pagination.d.ts +14 -0
- package/dist/components/src/table.d.ts +27 -0
- package/dist/components/src/toast.d.ts +20 -0
- package/dist/css/index.css +1 -1
- package/dist/css/src/button.css +34 -0
- package/dist/css/src/index.css +7 -4
- package/dist/css/src/pagination.css +80 -0
- package/dist/css/src/table.css +104 -0
- package/dist/css/src/toast.css +97 -0
- package/dist/esm/components/index.d.ts +3 -0
- package/dist/esm/components/src/button.d.ts +1 -1
- package/dist/esm/components/src/pagination.d.ts +14 -0
- package/dist/esm/components/src/table.d.ts +27 -0
- package/dist/esm/components/src/toast.d.ts +20 -0
- package/dist/esm/css/index.css +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,4 +6,32 @@ A set of components for H2O App development.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install h2o-library
|
|
9
|
+
|
|
10
|
+
# or
|
|
11
|
+
|
|
12
|
+
yarn add h2o-library
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
import css files into your project
|
|
18
|
+
|
|
19
|
+
trough css file
|
|
20
|
+
|
|
21
|
+
```css
|
|
22
|
+
@import "h2o-library/dist/styles/index.css";
|
|
9
23
|
```
|
|
24
|
+
|
|
25
|
+
trough js/ts file
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import "h2o-library/dist/styles/index.css";
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
and use components like so
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { Button } from "h2o-library";
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
refer to the [docs](https://h2o-library.vercel.app) for more information
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IconType, TooltipPosition } from "../../types";
|
|
2
2
|
import React from "react";
|
|
3
3
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
-
variant?: "primary" | "secondary" | "ghost" | "danger";
|
|
4
|
+
variant?: "primary" | "secondary" | "ghost" | "danger" | "warning" | "success";
|
|
5
5
|
size?: "sm" | "md" | "lg";
|
|
6
6
|
label?: string;
|
|
7
7
|
icon?: IconType;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface PaginationProps {
|
|
3
|
+
currentPage: number;
|
|
4
|
+
totalPages: number;
|
|
5
|
+
perPage: number;
|
|
6
|
+
perPageOptions?: {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}[];
|
|
10
|
+
onPageChange: (page: number) => void;
|
|
11
|
+
onPerPageChange: (perPage: string) => void;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const Pagination: React.FC<PaginationProps>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type SortDirection = "asc" | "desc" | null;
|
|
3
|
+
export interface TableColumn<T> {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
sortable?: boolean;
|
|
7
|
+
render?: (value: any, row: T) => React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface TableProps<T extends Record<string, any>> {
|
|
10
|
+
columns: TableColumn<T>[];
|
|
11
|
+
data: T[];
|
|
12
|
+
isLoading?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
sortKey?: string;
|
|
15
|
+
sortDirection?: SortDirection;
|
|
16
|
+
onSort?: (key: string, direction: SortDirection) => void;
|
|
17
|
+
currentPage?: number;
|
|
18
|
+
totalPages?: number;
|
|
19
|
+
perPage?: number;
|
|
20
|
+
perPageOptions?: {
|
|
21
|
+
label: string;
|
|
22
|
+
value: string;
|
|
23
|
+
}[];
|
|
24
|
+
onPageChange?: (page: number) => void;
|
|
25
|
+
onPerPageChange?: (perPage: string) => void;
|
|
26
|
+
}
|
|
27
|
+
export declare function Table<T extends Record<string, any>>({ columns, data, isLoading, className, sortKey, sortDirection, onSort, currentPage, totalPages, perPage, perPageOptions, onPageChange, onPerPageChange, }: TableProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type ToastVariant = "info" | "error" | "warning" | "success";
|
|
3
|
+
interface ToastAction {
|
|
4
|
+
label: string;
|
|
5
|
+
action: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface ToastProps {
|
|
8
|
+
id: string;
|
|
9
|
+
variant: ToastVariant;
|
|
10
|
+
title: string;
|
|
11
|
+
description: string;
|
|
12
|
+
primaryAction?: ToastAction;
|
|
13
|
+
secondaryAction?: ToastAction;
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const ToastProvider: React.FC<{
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const useToast: () => (props: Omit<ToastProps, "id" | "onClose">) => void;
|
|
20
|
+
export {};
|
package/dist/css/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--background:0 0% 100%;--foreground:160 10% 10%;--primary-disabled:225 100% 88%;--primary-muted:221 100% 95%;--primary:225 91% 59%;--primary-200:225 100% 43%;--primary-300:225 91% 40%;--primary-400:225 91% 18%;--success-bg:143 26% 86%;--success:130 35% 46%;--success-200:130 76% 26%;--success-300:130 100% 18%;--
|
|
1
|
+
:root{--background:0 0% 100%;--foreground:160 10% 10%;--primary-disabled:225 100% 88%;--primary-muted:221 100% 95%;--primary:225 91% 59%;--primary-200:225 100% 43%;--primary-300:225 91% 40%;--primary-400:225 91% 18%;--success-bg:143 26% 86%;--success:130 35% 46%;--success-200:130 76% 26%;--success-300:130 100% 18%;--warning-bg:45 100% 84%;--warning:45 100% 61%;--warning-200:45 100% 45%;--warning-300:45 100% 32%;--destructive-bg:357 100% 92%;--destructive:0 83% 60%;--destructive-200:0 100% 42%;--destructive-300:0 100% 29%;--muted-25:0 0 98%;--muted-50:0 0 96%;--muted:0 0 80%;--muted-200:0 0 67%;--radius-sm:0.25rem;--radius-md:0.375rem;--radius-lg:0.5rem;--radius-full:9999px}@import "./src/accordion.css";@import "./src/button.css";@import "./src/calendar.css";@import "./src/checkbox.css";@import "./src/content-switch.css";@import "./src/dropdown.css";@import "./src/input.css";@import "./src/modal.css";@import "./src/multi-select.css";@import "./src/popover.css";@import "./src/radio.css";@import "./src/search.css";@import "./src/side-panel.css";@import "./src/status.css";@import "./src/tabs.css";@import "./src/tag.css";@import "./src/textarea.css";@import "./src/toggle.css";@import "./src/tooltip.css";@import "./src/pagination.css";@import "./src/table.css";@import "./src/toast.css";
|
package/dist/css/src/button.css
CHANGED
|
@@ -90,6 +90,40 @@
|
|
|
90
90
|
opacity: 0.5;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
.button--warning {
|
|
94
|
+
background-color: hsl(var(--warning));
|
|
95
|
+
color: white;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.button--warning:hover:not(:disabled) {
|
|
99
|
+
background-color: hsl(var(--warning-200));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.button--warning:active:not(:disabled) {
|
|
103
|
+
background-color: hsl(var(--warning-300));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.button--warning:disabled {
|
|
107
|
+
opacity: 0.5;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.button--success {
|
|
111
|
+
background-color: hsl(var(--success));
|
|
112
|
+
color: white;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.button--success:hover:not(:disabled) {
|
|
116
|
+
background-color: hsl(var(--success-200));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.button--success:active:not(:disabled) {
|
|
120
|
+
background-color: hsl(var(--success-300));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.button--success:disabled {
|
|
124
|
+
opacity: 0.5;
|
|
125
|
+
}
|
|
126
|
+
|
|
93
127
|
/* Sizes */
|
|
94
128
|
.button--sm {
|
|
95
129
|
font-size: 0.875rem;
|
package/dist/css/src/index.css
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
--success-200: 130 76% 26%;
|
|
15
15
|
--success-300: 130 100% 18%;
|
|
16
16
|
|
|
17
|
-
--
|
|
18
|
-
--
|
|
19
|
-
--
|
|
20
|
-
--
|
|
17
|
+
--warning-bg: 45 100% 84%;
|
|
18
|
+
--warning: 45 100% 61%;
|
|
19
|
+
--warning-200: 45 100% 45%;
|
|
20
|
+
--warning-300: 45 100% 32%;
|
|
21
21
|
|
|
22
22
|
--destructive-bg: 357 100% 92%;
|
|
23
23
|
--destructive: 0 83% 60%;
|
|
@@ -54,3 +54,6 @@
|
|
|
54
54
|
@import "./src/textarea.css";
|
|
55
55
|
@import "./src/toggle.css";
|
|
56
56
|
@import "./src/tooltip.css";
|
|
57
|
+
@import "./src/pagination.css";
|
|
58
|
+
@import "./src/table.css";
|
|
59
|
+
@import "./src/toast.css";
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
.pagination {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
gap: 1rem;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.pagination-per-page {
|
|
9
|
+
min-width: 140px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.pagination-controls {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 0.25rem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.pagination-arrow {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
padding: 0.5rem;
|
|
23
|
+
border: none;
|
|
24
|
+
background: none;
|
|
25
|
+
color: hsl(var(--foreground));
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
border-radius: var(--radius-md);
|
|
28
|
+
position: relative;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.pagination-arrow:hover:not(:disabled) {
|
|
32
|
+
background-color: hsl(var(--muted-25));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.pagination-arrow:disabled {
|
|
36
|
+
color: hsl(var(--muted));
|
|
37
|
+
cursor: not-allowed;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.pagination-arrow .second-chevron {
|
|
41
|
+
position: absolute;
|
|
42
|
+
left: 8px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.pagination-pages {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: 0.25rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.pagination-page {
|
|
52
|
+
min-width: 2rem;
|
|
53
|
+
height: 2rem;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
border: none;
|
|
58
|
+
background: none;
|
|
59
|
+
border-radius: var(--radius-md);
|
|
60
|
+
color: hsl(var(--foreground));
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
font-size: 0.875rem;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.pagination-page:hover:not(:disabled) {
|
|
66
|
+
background-color: hsl(var(--muted-25));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.pagination-page:disabled {
|
|
70
|
+
cursor: default;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.pagination-page-active {
|
|
74
|
+
background-color: hsl(var(--primary));
|
|
75
|
+
color: white;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.pagination-page-active:hover {
|
|
79
|
+
background-color: hsl(var(--primary-200)) !important;
|
|
80
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
.table-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: 1rem;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.table-wrapper {
|
|
9
|
+
width: 100%;
|
|
10
|
+
overflow-x: auto;
|
|
11
|
+
border: 1px solid hsl(var(--muted-50));
|
|
12
|
+
border-radius: var(--radius-md);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.table {
|
|
16
|
+
width: 100%;
|
|
17
|
+
border-collapse: collapse;
|
|
18
|
+
text-align: left;
|
|
19
|
+
font-size: 0.875rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.table th {
|
|
23
|
+
background-color: hsl(var(--muted-25));
|
|
24
|
+
font-weight: 600;
|
|
25
|
+
padding: 0.75rem 1rem;
|
|
26
|
+
color: hsl(var(--foreground));
|
|
27
|
+
border-bottom: 1px solid hsl(var(--muted-50));
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.table th.sortable {
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.table th.sortable:hover {
|
|
36
|
+
background-color: hsl(var(--muted-50));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.table-header-content {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 0.5rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.table-sort-icon {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
color: hsl(var(--muted));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.table-sort-icon.active {
|
|
52
|
+
color: hsl(var(--foreground));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.table-sort-icon .default {
|
|
56
|
+
opacity: 0.5;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.table td {
|
|
60
|
+
padding: 0.75rem 1rem;
|
|
61
|
+
border-bottom: 1px solid hsl(var(--muted-50));
|
|
62
|
+
color: hsl(var(--foreground));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.table tr:last-child td {
|
|
66
|
+
border-bottom: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.table tbody tr:hover {
|
|
70
|
+
background-color: hsl(var(--muted-25));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.table-loading,
|
|
74
|
+
.table-empty {
|
|
75
|
+
text-align: center;
|
|
76
|
+
color: hsl(var(--muted));
|
|
77
|
+
padding: 2rem !important;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.table-loading {
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
gap: 0.5rem;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.table-loader {
|
|
88
|
+
width: 1rem;
|
|
89
|
+
height: 1rem;
|
|
90
|
+
border: 2px solid hsl(var(--muted-50));
|
|
91
|
+
border-top-color: hsl(var(--primary));
|
|
92
|
+
border-radius: 50%;
|
|
93
|
+
animation: spin 1s linear infinite;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@keyframes spin {
|
|
97
|
+
to {
|
|
98
|
+
transform: rotate(360deg);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.table-pagination {
|
|
103
|
+
padding: 0 0.5rem;
|
|
104
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
.toast-container {
|
|
2
|
+
position: fixed;
|
|
3
|
+
bottom: 1rem;
|
|
4
|
+
right: 1rem;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 0.5rem;
|
|
8
|
+
z-index: 50;
|
|
9
|
+
max-width: 420px;
|
|
10
|
+
width: calc(100% - 2rem);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.toast {
|
|
14
|
+
display: flex;
|
|
15
|
+
gap: 0.75rem;
|
|
16
|
+
padding: 1rem;
|
|
17
|
+
border-radius: var(--radius-md);
|
|
18
|
+
background: white;
|
|
19
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
20
|
+
animation: slideIn 0.2s ease-out;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes slideIn {
|
|
24
|
+
from {
|
|
25
|
+
transform: translateX(100%);
|
|
26
|
+
opacity: 0;
|
|
27
|
+
}
|
|
28
|
+
to {
|
|
29
|
+
transform: translateX(0);
|
|
30
|
+
opacity: 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.toast-content {
|
|
35
|
+
flex: 1;
|
|
36
|
+
min-width: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.toast-header {
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
align-items: flex-start;
|
|
43
|
+
gap: 0.5rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.toast-title {
|
|
47
|
+
margin: 0;
|
|
48
|
+
font-size: 0.875rem;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
color: hsl(var(--foreground));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.toast-description {
|
|
54
|
+
margin: 0.25rem 0 0;
|
|
55
|
+
font-size: 0.875rem;
|
|
56
|
+
color: hsl(var(--muted-200));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.toast-close {
|
|
60
|
+
padding: 0;
|
|
61
|
+
background: none;
|
|
62
|
+
border: none;
|
|
63
|
+
color: hsl(var(--muted));
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.toast-close:hover {
|
|
71
|
+
color: hsl(var(--foreground));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.toast-actions {
|
|
75
|
+
display: flex;
|
|
76
|
+
justify-content: flex-end;
|
|
77
|
+
gap: 0.5rem;
|
|
78
|
+
margin-top: 0.75rem;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Variant styles */
|
|
82
|
+
|
|
83
|
+
.toast-info .toast-icon {
|
|
84
|
+
color: hsl(var(--primary));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.toast-error .toast-icon {
|
|
88
|
+
color: hsl(var(--destructive));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.toast-warning .toast-icon {
|
|
92
|
+
color: hsl(var(--warning));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.toast-success .toast-icon {
|
|
96
|
+
color: hsl(var(--success));
|
|
97
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IconType, TooltipPosition } from "../../types";
|
|
2
2
|
import React from "react";
|
|
3
3
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
-
variant?: "primary" | "secondary" | "ghost" | "danger";
|
|
4
|
+
variant?: "primary" | "secondary" | "ghost" | "danger" | "warning" | "success";
|
|
5
5
|
size?: "sm" | "md" | "lg";
|
|
6
6
|
label?: string;
|
|
7
7
|
icon?: IconType;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface PaginationProps {
|
|
3
|
+
currentPage: number;
|
|
4
|
+
totalPages: number;
|
|
5
|
+
perPage: number;
|
|
6
|
+
perPageOptions?: {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}[];
|
|
10
|
+
onPageChange: (page: number) => void;
|
|
11
|
+
onPerPageChange: (perPage: string) => void;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const Pagination: React.FC<PaginationProps>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type SortDirection = "asc" | "desc" | null;
|
|
3
|
+
export interface TableColumn<T> {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
sortable?: boolean;
|
|
7
|
+
render?: (value: any, row: T) => React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface TableProps<T extends Record<string, any>> {
|
|
10
|
+
columns: TableColumn<T>[];
|
|
11
|
+
data: T[];
|
|
12
|
+
isLoading?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
sortKey?: string;
|
|
15
|
+
sortDirection?: SortDirection;
|
|
16
|
+
onSort?: (key: string, direction: SortDirection) => void;
|
|
17
|
+
currentPage?: number;
|
|
18
|
+
totalPages?: number;
|
|
19
|
+
perPage?: number;
|
|
20
|
+
perPageOptions?: {
|
|
21
|
+
label: string;
|
|
22
|
+
value: string;
|
|
23
|
+
}[];
|
|
24
|
+
onPageChange?: (page: number) => void;
|
|
25
|
+
onPerPageChange?: (perPage: string) => void;
|
|
26
|
+
}
|
|
27
|
+
export declare function Table<T extends Record<string, any>>({ columns, data, isLoading, className, sortKey, sortDirection, onSort, currentPage, totalPages, perPage, perPageOptions, onPageChange, onPerPageChange, }: TableProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type ToastVariant = "info" | "error" | "warning" | "success";
|
|
3
|
+
interface ToastAction {
|
|
4
|
+
label: string;
|
|
5
|
+
action: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface ToastProps {
|
|
8
|
+
id: string;
|
|
9
|
+
variant: ToastVariant;
|
|
10
|
+
title: string;
|
|
11
|
+
description: string;
|
|
12
|
+
primaryAction?: ToastAction;
|
|
13
|
+
secondaryAction?: ToastAction;
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const ToastProvider: React.FC<{
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const useToast: () => (props: Omit<ToastProps, "id" | "onClose">) => void;
|
|
20
|
+
export {};
|
package/dist/esm/css/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--background:0 0% 100%;--foreground:160 10% 10%;--primary-disabled:225 100% 88%;--primary-muted:221 100% 95%;--primary:225 91% 59%;--primary-200:225 100% 43%;--primary-300:225 91% 40%;--primary-400:225 91% 18%;--success-bg:143 26% 86%;--success:130 35% 46%;--success-200:130 76% 26%;--success-300:130 100% 18%;--
|
|
1
|
+
:root{--background:0 0% 100%;--foreground:160 10% 10%;--primary-disabled:225 100% 88%;--primary-muted:221 100% 95%;--primary:225 91% 59%;--primary-200:225 100% 43%;--primary-300:225 91% 40%;--primary-400:225 91% 18%;--success-bg:143 26% 86%;--success:130 35% 46%;--success-200:130 76% 26%;--success-300:130 100% 18%;--warning-bg:45 100% 84%;--warning:45 100% 61%;--warning-200:45 100% 45%;--warning-300:45 100% 32%;--destructive-bg:357 100% 92%;--destructive:0 83% 60%;--destructive-200:0 100% 42%;--destructive-300:0 100% 29%;--muted-25:0 0 98%;--muted-50:0 0 96%;--muted:0 0 80%;--muted-200:0 0 67%;--radius-sm:0.25rem;--radius-md:0.375rem;--radius-lg:0.5rem;--radius-full:9999px}@import "./src/accordion.css";@import "./src/button.css";@import "./src/calendar.css";@import "./src/checkbox.css";@import "./src/content-switch.css";@import "./src/dropdown.css";@import "./src/input.css";@import "./src/modal.css";@import "./src/multi-select.css";@import "./src/popover.css";@import "./src/radio.css";@import "./src/search.css";@import "./src/side-panel.css";@import "./src/status.css";@import "./src/tabs.css";@import "./src/tag.css";@import "./src/textarea.css";@import "./src/toggle.css";@import "./src/tooltip.css";@import "./src/pagination.css";@import "./src/table.css";@import "./src/toast.css";
|