gbs-add-block 1.2.6 → 1.2.7
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 +2 -2
- package/index.cjs +1 -0
- package/package.json +1 -1
- package/source/components/button/index.tsx +2 -2
- package/source/components/card/index.tsx +1 -1
- package/source/components/checkbox/index.tsx +1 -1
- package/source/components/datagrid/context/GridContext.tsx +38 -17
- package/source/components/datagrid/createTemplate.tsx +2 -2
- package/source/components/datagrid/hooks/usePagination.ts +0 -8
- package/source/components/datagrid/hooks/useSearch.ts +3 -3
- package/source/components/datagrid/index.tsx +2 -1
- package/source/components/datagrid/layout/GridBody.tsx +7 -4
- package/source/components/datagrid/layout/GridPagination.tsx +3 -2
- package/source/components/datagrid/layout/GridToolbar.tsx +2 -1
- package/source/components/datagrid/type.ts +18 -2
- package/source/components/datepicker/index.tsx +7 -7
- package/source/components/input/index.tsx +1 -1
- package/source/components/multiselect/PortalDropDown.tsx +1 -1
- package/source/components/multiselect/index.tsx +6 -6
- package/source/components/navbar/AuthSection.tsx +5 -5
- package/source/components/navbar/NavItemComponent.tsx +2 -2
- package/source/components/select/PortalDropDown.tsx +1 -1
- package/source/components/select/index.tsx +5 -5
- package/source/components/spinner/index.tsx +2 -2
- package/source/components/tabs/index.tsx +6 -6
- package/source/components/textarea/index.tsx +9 -9
- package/source/components/toast/ToastComponent.tsx +26 -25
- package/source/components/toast/ToastIcon.tsx +8 -8
- package/source/components/uploader/ProgressAnimation.tsx +2 -2
- package/source/components/uploader/UploadedFilePreview.tsx +1 -1
- package/source/components/uploader/index.tsx +1 -1
- package/source/components/uploader/uploaderIcon.tsx +1 -1
- package/source/globalStyle.ts +29 -16
- package/source/theme.ts +7 -7
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GBS Building Blocks 2.0 (v1.2.
|
|
1
|
+
# GBS Building Blocks 2.0 (v1.2.7)
|
|
2
2
|
|
|
3
3
|
Latest and upgraded version of GBS building blocks with headless UI and removed dependencies.
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ Latest and upgraded version of GBS building blocks with headless UI and removed
|
|
|
6
6
|
|
|
7
7
|
For detailed documentation on usage and props, Please visit: [Building Block Documentation v2.0](https://gramprokit.vercel.app)
|
|
8
8
|
|
|
9
|
-
## What's New 🎉 (Ver 1.2.
|
|
9
|
+
## What's New 🎉 (Ver 1.2.7)
|
|
10
10
|
|
|
11
11
|
- UI Update (Canditate update for next major change 2.0.0)
|
|
12
12
|
|
package/index.cjs
CHANGED
|
@@ -50,6 +50,7 @@ const copyCommonFiles = async (destPath) => {
|
|
|
50
50
|
const commonFiles = [
|
|
51
51
|
{ src: ["..", "utils.ts"], dest: "utils.ts" },
|
|
52
52
|
{ src: ["..", "globalStyle.ts"], dest: "globalStyle.ts" },
|
|
53
|
+
{ src: ["..", "theme.ts"], dest: "theme.ts" },
|
|
53
54
|
{ src: ["..", "icon"], dest: "icon" },
|
|
54
55
|
];
|
|
55
56
|
|
package/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
import React, { type ButtonHTMLAttributes, type ReactNode } from "react";
|
|
9
9
|
import { twMerge } from "tailwind-merge";
|
|
10
|
-
import { buttonStyles } from "
|
|
11
|
-
import type { ComponentSize, ComponentVariant } from "
|
|
10
|
+
import { buttonStyles } from "../globalStyle";
|
|
11
|
+
import type { ComponentSize, ComponentVariant } from "../theme";
|
|
12
12
|
|
|
13
13
|
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
14
14
|
children?: ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { type HTMLAttributes, type ReactNode } from "react";
|
|
2
2
|
import { twMerge } from "tailwind-merge";
|
|
3
|
-
import { cardStyles } from "
|
|
3
|
+
import { cardStyles } from "../globalStyle";
|
|
4
4
|
|
|
5
5
|
interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
6
|
children?: ReactNode;
|
|
@@ -16,7 +16,7 @@ export const Checkbox = ({
|
|
|
16
16
|
<input
|
|
17
17
|
type="checkbox"
|
|
18
18
|
className={twMerge(
|
|
19
|
-
"h-5 w-5 cursor-pointer rounded border-
|
|
19
|
+
"h-5 w-5 cursor-pointer rounded border-zinc-300 dark:border-zinc-700 bg-white dark:bg-zinc-950 text-black dark:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black dark:focus-visible:ring-white focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-55",
|
|
20
20
|
className
|
|
21
21
|
)}
|
|
22
22
|
{...props}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { createContext, useContext } from "react";
|
|
2
2
|
import type { GridContextType, GridProps } from "../type";
|
|
3
|
+
import { gridStyles } from "../../globalStyle";
|
|
3
4
|
import {
|
|
4
5
|
useDataSource,
|
|
5
6
|
useColumns,
|
|
@@ -18,7 +19,6 @@ export const GridProvider: React.FC<{
|
|
|
18
19
|
const {
|
|
19
20
|
dataSource,
|
|
20
21
|
columns = [],
|
|
21
|
-
pageSettings,
|
|
22
22
|
enableSearch = false,
|
|
23
23
|
lazy = false,
|
|
24
24
|
enableExcelExport = false,
|
|
@@ -26,18 +26,11 @@ export const GridProvider: React.FC<{
|
|
|
26
26
|
enablePdfExport = false,
|
|
27
27
|
pdfName = "data",
|
|
28
28
|
pdfOptions = {},
|
|
29
|
-
gridButtonClass = "px-1 py-2 text-xs rounded bg-zinc-200 dark:bg-zinc-700 cursor-pointer",
|
|
30
29
|
selectAll = false,
|
|
31
30
|
onSelectRow,
|
|
32
31
|
isFetching,
|
|
33
|
-
tableHeaderStyle = "text-left px-2 py-4 bg-zinc-200 dark:bg-zinc-800",
|
|
34
|
-
gridContainerClass = "flex flex-col rounded-md overflow-hidden dark:text-white",
|
|
35
32
|
gridColumnStyleSelectAll = "px-4 text-xs",
|
|
36
33
|
gridColumnStyle = "p-2 text-xs",
|
|
37
|
-
rowChange = () => {},
|
|
38
|
-
pageStatus = () => {},
|
|
39
|
-
activeFilterArrayValue,
|
|
40
|
-
searchParamValue = () => {},
|
|
41
34
|
showTotalPages = false,
|
|
42
35
|
onSearch = () => {},
|
|
43
36
|
onToolbarButtonClick = () => {},
|
|
@@ -45,6 +38,29 @@ export const GridProvider: React.FC<{
|
|
|
45
38
|
initialSearchParam = "",
|
|
46
39
|
} = props;
|
|
47
40
|
|
|
41
|
+
// Resolve pageSize with fallbacks
|
|
42
|
+
const resolvedPageSize = props.pageSize || props.pageSettings?.pageNumber || 10;
|
|
43
|
+
const resolvedPageSettings = {
|
|
44
|
+
pageNumber: resolvedPageSize,
|
|
45
|
+
totalCount: props.pageSettings?.totalCount,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Resolve callback aliases
|
|
49
|
+
const resolvedRowChange = props.onRowClick || props.rowChange || (() => {});
|
|
50
|
+
const resolvedPageStatus = props.onPageChange || props.pageStatus || (() => {});
|
|
51
|
+
const resolvedActiveFilterArrayValue = props.onFilterChange || props.activeFilterArrayValue;
|
|
52
|
+
const resolvedSearchParamValue = props.onSearchChange || props.searchParamValue || (() => {});
|
|
53
|
+
|
|
54
|
+
// Resolve CSS classes using design tokens from theme presets
|
|
55
|
+
const gridContainerClass = props.gridContainerClass || gridStyles.container;
|
|
56
|
+
const gridButtonClass = props.gridButtonClass || gridStyles.button;
|
|
57
|
+
const tableHeaderStyle = props.tableHeaderStyle || gridStyles.tableHeader;
|
|
58
|
+
const gridToolbarClass = props.gridToolbarClass || gridStyles.toolbar;
|
|
59
|
+
const gridPaginationClass = props.gridPaginationClass || gridStyles.pagination;
|
|
60
|
+
const gridRowEvenClass = props.gridRowEvenClass || gridStyles.rowEven;
|
|
61
|
+
const gridRowOddClass = props.gridRowOddClass || gridStyles.rowOdd;
|
|
62
|
+
const gridRowSelectedClass = props.gridRowSelectedClass || gridStyles.rowSelected;
|
|
63
|
+
|
|
48
64
|
// Data source management
|
|
49
65
|
const {
|
|
50
66
|
workingDataSource,
|
|
@@ -52,7 +68,7 @@ export const GridProvider: React.FC<{
|
|
|
52
68
|
fallbackSourceData,
|
|
53
69
|
totalPages,
|
|
54
70
|
setTotalPages,
|
|
55
|
-
} = useDataSource(dataSource,
|
|
71
|
+
} = useDataSource(dataSource, resolvedPageSettings, lazy);
|
|
56
72
|
|
|
57
73
|
// Column management
|
|
58
74
|
const { workingColumns, setWorkingColumns } = useColumns(
|
|
@@ -75,8 +91,7 @@ export const GridProvider: React.FC<{
|
|
|
75
91
|
totalPages,
|
|
76
92
|
lazy,
|
|
77
93
|
workingDataSource,
|
|
78
|
-
|
|
79
|
-
pageStatus,
|
|
94
|
+
resolvedPageStatus,
|
|
80
95
|
);
|
|
81
96
|
|
|
82
97
|
// Search functionality
|
|
@@ -86,10 +101,10 @@ export const GridProvider: React.FC<{
|
|
|
86
101
|
fallbackSourceData,
|
|
87
102
|
dataSource,
|
|
88
103
|
lazy,
|
|
89
|
-
pageSettings,
|
|
104
|
+
pageSettings: resolvedPageSettings,
|
|
90
105
|
resetPage,
|
|
91
106
|
setTotalPages,
|
|
92
|
-
searchParamValue,
|
|
107
|
+
searchParamValue: resolvedSearchParamValue,
|
|
93
108
|
initialSearchParam,
|
|
94
109
|
});
|
|
95
110
|
|
|
@@ -110,8 +125,8 @@ export const GridProvider: React.FC<{
|
|
|
110
125
|
fallbackSourceData,
|
|
111
126
|
resetPage,
|
|
112
127
|
setTotalPages,
|
|
113
|
-
pageSettings,
|
|
114
|
-
activeFilterArrayValue,
|
|
128
|
+
pageSettings: resolvedPageSettings,
|
|
129
|
+
activeFilterArrayValue: resolvedActiveFilterArrayValue,
|
|
115
130
|
lazy,
|
|
116
131
|
initialFilters,
|
|
117
132
|
});
|
|
@@ -160,7 +175,8 @@ export const GridProvider: React.FC<{
|
|
|
160
175
|
|
|
161
176
|
// Grid settings
|
|
162
177
|
columns,
|
|
163
|
-
pageSettings,
|
|
178
|
+
pageSettings: resolvedPageSettings,
|
|
179
|
+
pageSize: resolvedPageSize,
|
|
164
180
|
enableSearch,
|
|
165
181
|
enableExcelExport,
|
|
166
182
|
enablePdfExport,
|
|
@@ -171,9 +187,14 @@ export const GridProvider: React.FC<{
|
|
|
171
187
|
selectAll,
|
|
172
188
|
tableHeaderStyle,
|
|
173
189
|
gridContainerClass,
|
|
190
|
+
gridToolbarClass,
|
|
191
|
+
gridPaginationClass,
|
|
192
|
+
gridRowEvenClass,
|
|
193
|
+
gridRowOddClass,
|
|
194
|
+
gridRowSelectedClass,
|
|
174
195
|
gridColumnStyleSelectAll,
|
|
175
196
|
gridColumnStyle,
|
|
176
|
-
rowChange,
|
|
197
|
+
rowChange: resolvedRowChange,
|
|
177
198
|
showTotalPages,
|
|
178
199
|
onSearch,
|
|
179
200
|
onToolbarButtonClick,
|
|
@@ -26,7 +26,7 @@ export const createTemplate = (
|
|
|
26
26
|
type={config.type || "text"}
|
|
27
27
|
className={
|
|
28
28
|
config.className ||
|
|
29
|
-
"p-1 text-xs outline-none w-full rounded focus:border-b-2 border-
|
|
29
|
+
"p-1 text-xs outline-none w-full rounded focus:border-b-2 border-black dark:border-white dark:bg-zinc-900"
|
|
30
30
|
}
|
|
31
31
|
placeholder={config.placeholder || `Enter ${field}`}
|
|
32
32
|
defaultValue={rowData[field]}
|
|
@@ -41,7 +41,7 @@ export const createTemplate = (
|
|
|
41
41
|
key={`${field}-${rowData.id}`}
|
|
42
42
|
className={
|
|
43
43
|
config.className ||
|
|
44
|
-
"p-1 w-full text-xs rounded outline-none focus:border-b-2 border-
|
|
44
|
+
"p-1 w-full text-xs rounded outline-none focus:border-b-2 border-black dark:border-white dark:bg-zinc-900"
|
|
45
45
|
}
|
|
46
46
|
defaultValue={rowData[field]}
|
|
47
47
|
onChange={handleSelectChange}
|
|
@@ -4,13 +4,11 @@ export const usePagination = (
|
|
|
4
4
|
totalPages: number,
|
|
5
5
|
lazy: boolean,
|
|
6
6
|
dataSource?: any[],
|
|
7
|
-
pageSettings?: { pageNumber: number },
|
|
8
7
|
pageStatus?: ({ currentPage }: { currentPage: number }) => void
|
|
9
8
|
) => {
|
|
10
9
|
const [currentPage, setCurrentPage] = useState(0);
|
|
11
10
|
const [pageStart, setPageStart] = useState(0);
|
|
12
11
|
const [pageEnd, setPageEnd] = useState(10);
|
|
13
|
-
const [prevDataLength, setPrevDataLength] = useState(0);
|
|
14
12
|
|
|
15
13
|
// Update page range based on current page
|
|
16
14
|
const updatePageRange = useCallback(
|
|
@@ -38,12 +36,6 @@ export const usePagination = (
|
|
|
38
36
|
}
|
|
39
37
|
}, [currentPage, pageStatus]);
|
|
40
38
|
|
|
41
|
-
// This will handle the case when dataSource changes
|
|
42
|
-
// and adjust the current page accordingly in managed workflow
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
setPrevDataLength(dataSource?.length || 0);
|
|
45
|
-
}, [dataSource?.length]);
|
|
46
|
-
|
|
47
39
|
// Defensive check: if current page is out of bounds due to totalPages shrinking, reset to 0
|
|
48
40
|
useEffect(() => {
|
|
49
41
|
if (totalPages > 0 && currentPage >= totalPages) {
|
|
@@ -60,9 +60,9 @@ export const useSearch = ({
|
|
|
60
60
|
if (!lazy) {
|
|
61
61
|
const filteredData = workingDataSource.filter((item: any) =>
|
|
62
62
|
Object.values(item).some((val: any) => {
|
|
63
|
-
const trimmedVal = val
|
|
64
|
-
const trimmedSearchParam = searchParam
|
|
65
|
-
return trimmedVal
|
|
63
|
+
const trimmedVal = val?.toString()?.toLowerCase()?.trim();
|
|
64
|
+
const trimmedSearchParam = searchParam?.toLowerCase()?.trim();
|
|
65
|
+
return trimmedVal?.includes(trimmedSearchParam);
|
|
66
66
|
})
|
|
67
67
|
);
|
|
68
68
|
setWorkingDataSource(filteredData);
|
|
@@ -17,7 +17,8 @@ const DataGrid = memo(GridComponent, (prevProps, nextProps) => {
|
|
|
17
17
|
return (
|
|
18
18
|
prevProps.dataSource === nextProps.dataSource &&
|
|
19
19
|
prevProps.columns === nextProps.columns &&
|
|
20
|
-
prevProps.
|
|
20
|
+
prevProps.pageSize === nextProps.pageSize &&
|
|
21
|
+
prevProps.pageSettings?.pageNumber === nextProps.pageSettings?.pageNumber &&
|
|
21
22
|
prevProps.enableSearch === nextProps.enableSearch &&
|
|
22
23
|
prevProps.enablePdfExport === nextProps.enablePdfExport &&
|
|
23
24
|
prevProps.enableExcelExport === nextProps.enableExcelExport
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { useGridContext } from "../context/GridContext";
|
|
3
3
|
import FilterPopup from "./FilterPopup";
|
|
4
4
|
import Icon from "../../icon/Icon";
|
|
@@ -24,6 +24,9 @@ const GridBody = () => {
|
|
|
24
24
|
handleSelectAll,
|
|
25
25
|
handleSelect,
|
|
26
26
|
isRowSelected,
|
|
27
|
+
gridRowEvenClass,
|
|
28
|
+
gridRowOddClass,
|
|
29
|
+
gridRowSelectedClass,
|
|
27
30
|
} = useGridContext();
|
|
28
31
|
|
|
29
32
|
const renderCell = (rowData: any, column: Column, rowIndex: number) => {
|
|
@@ -140,10 +143,10 @@ const GridBody = () => {
|
|
|
140
143
|
key={rowIndex}
|
|
141
144
|
className={
|
|
142
145
|
isRowSelected(rowData)
|
|
143
|
-
?
|
|
146
|
+
? gridRowSelectedClass
|
|
144
147
|
: rowIndex % 2 === 0
|
|
145
|
-
?
|
|
146
|
-
:
|
|
148
|
+
? gridRowEvenClass
|
|
149
|
+
: gridRowOddClass
|
|
147
150
|
}
|
|
148
151
|
onClick={() => rowChange(rowData)}
|
|
149
152
|
>
|
|
@@ -23,10 +23,11 @@ const Pagination = () => {
|
|
|
23
23
|
lazy,
|
|
24
24
|
pageSettings,
|
|
25
25
|
showTotalPages,
|
|
26
|
+
gridPaginationClass,
|
|
26
27
|
} = useGridContext();
|
|
27
28
|
|
|
28
29
|
return (
|
|
29
|
-
<div className=
|
|
30
|
+
<div className={gridPaginationClass}>
|
|
30
31
|
<div className="flex text-xs">
|
|
31
32
|
Showing {currentPage + 1} of {totalPages} pages
|
|
32
33
|
{showTotalPages && (
|
|
@@ -76,7 +77,7 @@ const Pagination = () => {
|
|
|
76
77
|
className={`hidden md:block px-2 py-1 text-sm rounded-md transition-colors duration-200 ease-in-out ${
|
|
77
78
|
currentPage === pageStart + i
|
|
78
79
|
? "bg-black text-white dark:bg-white dark:text-black"
|
|
79
|
-
: "bg-gray-200 dark:bg-zinc-700 hover:bg-gray-300 dark:hover:bg-zinc-600"
|
|
80
|
+
: "bg-gray-200 dark:bg-zinc-700 text-black dark:text-white hover:bg-gray-300 dark:hover:bg-zinc-600"
|
|
80
81
|
}`}
|
|
81
82
|
>
|
|
82
83
|
{pageStart + i + 1}
|
|
@@ -24,6 +24,7 @@ const GridToolbar = () => {
|
|
|
24
24
|
gridButtonClass,
|
|
25
25
|
onToolbarButtonClick,
|
|
26
26
|
lazy,
|
|
27
|
+
gridToolbarClass,
|
|
27
28
|
} = useGridContext();
|
|
28
29
|
|
|
29
30
|
if (!enableSearch && !enableExcelExport && !enablePdfExport) {
|
|
@@ -31,7 +32,7 @@ const GridToolbar = () => {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
return (
|
|
34
|
-
<div className=
|
|
35
|
+
<div className={gridToolbarClass}>
|
|
35
36
|
{/* Search input */}
|
|
36
37
|
{enableSearch && (
|
|
37
38
|
<div className="flex">
|
|
@@ -14,7 +14,8 @@ export interface ActiveFilterArrayValue {
|
|
|
14
14
|
export type GridProps = {
|
|
15
15
|
dataSource: any[] | string;
|
|
16
16
|
columns?: any[];
|
|
17
|
-
pageSettings
|
|
17
|
+
pageSettings?: PageSettingsProps;
|
|
18
|
+
pageSize?: number;
|
|
18
19
|
enableSearch?: boolean;
|
|
19
20
|
lazy?: boolean;
|
|
20
21
|
enableExcelExport?: boolean;
|
|
@@ -24,6 +25,11 @@ export type GridProps = {
|
|
|
24
25
|
gridContainerClass?: string;
|
|
25
26
|
gridButtonClass?: string;
|
|
26
27
|
gridHeaderClass?: string;
|
|
28
|
+
gridToolbarClass?: string;
|
|
29
|
+
gridPaginationClass?: string;
|
|
30
|
+
gridRowEvenClass?: string;
|
|
31
|
+
gridRowOddClass?: string;
|
|
32
|
+
gridRowSelectedClass?: string;
|
|
27
33
|
gridGlobalSearchButtonClass?: string;
|
|
28
34
|
gridPaginationButtonClass?: string;
|
|
29
35
|
pdfOptions?: any;
|
|
@@ -34,10 +40,14 @@ export type GridProps = {
|
|
|
34
40
|
tableHeaderStyle?: string;
|
|
35
41
|
gridColumnStyleSelectAll?: string;
|
|
36
42
|
gridColumnStyle?: string;
|
|
37
|
-
rowChange?: any;
|
|
43
|
+
rowChange?: (rowData: any) => void;
|
|
44
|
+
onRowClick?: (rowData: any) => void;
|
|
38
45
|
pageStatus?: ({ currentPage }: { currentPage: number }) => void;
|
|
46
|
+
onPageChange?: ({ currentPage }: { currentPage: number }) => void;
|
|
39
47
|
activeFilterArrayValue?: ActiveFilterArrayValue[] | any;
|
|
48
|
+
onFilterChange?: (filters: ActiveFilterArrayValue[]) => void;
|
|
40
49
|
searchParamValue?: (value: string) => void;
|
|
50
|
+
onSearchChange?: (value: string) => void;
|
|
41
51
|
showTotalPages?: boolean;
|
|
42
52
|
onSearch?: (value: string) => void;
|
|
43
53
|
onToolbarButtonClick?: (action: string) => void;
|
|
@@ -163,6 +173,7 @@ export interface GridContextType {
|
|
|
163
173
|
// Grid settings
|
|
164
174
|
columns: any[];
|
|
165
175
|
pageSettings: any;
|
|
176
|
+
pageSize: number;
|
|
166
177
|
enableSearch: boolean;
|
|
167
178
|
enableExcelExport: boolean;
|
|
168
179
|
enablePdfExport: boolean;
|
|
@@ -173,6 +184,11 @@ export interface GridContextType {
|
|
|
173
184
|
selectAll: boolean;
|
|
174
185
|
tableHeaderStyle: string;
|
|
175
186
|
gridContainerClass: string;
|
|
187
|
+
gridToolbarClass: string;
|
|
188
|
+
gridPaginationClass: string;
|
|
189
|
+
gridRowEvenClass: string;
|
|
190
|
+
gridRowOddClass: string;
|
|
191
|
+
gridRowSelectedClass: string;
|
|
176
192
|
gridColumnStyleSelectAll: string;
|
|
177
193
|
gridColumnStyle: string;
|
|
178
194
|
rowChange: (rowData: any) => void;
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import Icon from "../icon/Icon";
|
|
18
18
|
import { calender, down, leftArrow, rightArrow, x } from "../icon/iconPaths";
|
|
19
19
|
import type { DatePickerProps } from "./types";
|
|
20
|
-
import { iconClass, popUp, primary } from "
|
|
20
|
+
import { iconClass, popUp, primary } from "../globalStyle";
|
|
21
21
|
|
|
22
22
|
export const DatePicker = ({
|
|
23
23
|
selectedDateValue,
|
|
@@ -325,14 +325,14 @@ export const DatePicker = ({
|
|
|
325
325
|
key={index}
|
|
326
326
|
onClick={() => !isDisabled && selectDate(day)}
|
|
327
327
|
disabled={isDisabled}
|
|
328
|
-
className={`text-center text-xs p-1 w-8 h-8 cursor-pointer rounded-md
|
|
328
|
+
className={`text-center text-xs p-1 w-8 h-8 cursor-pointer rounded-md transition duration-150 ease-in-out ${
|
|
329
329
|
isSelected
|
|
330
|
-
? "bg-black text-white hover:bg-
|
|
331
|
-
: ""
|
|
330
|
+
? "bg-black text-white hover:bg-zinc-900 dark:bg-white dark:text-black dark:hover:bg-zinc-200"
|
|
331
|
+
: "hover:bg-gray-200 dark:hover:bg-zinc-800"
|
|
332
332
|
} ${
|
|
333
333
|
isDisabled
|
|
334
|
-
? "bg-gray-100 text-gray-400 cursor-not-allowed"
|
|
335
|
-
: "
|
|
334
|
+
? "bg-gray-100 text-gray-400 cursor-not-allowed dark:bg-zinc-900 dark:text-zinc-600"
|
|
335
|
+
: ""
|
|
336
336
|
}`}
|
|
337
337
|
>
|
|
338
338
|
{day.getDate()}
|
|
@@ -345,7 +345,7 @@ export const DatePicker = ({
|
|
|
345
345
|
<button
|
|
346
346
|
type="button"
|
|
347
347
|
onClick={goToToday}
|
|
348
|
-
className="text-black hover:text-
|
|
348
|
+
className="text-black hover:text-zinc-650 transition duration-150 ease-in-out dark:text-zinc-400 dark:hover:text-zinc-200 font-semibold"
|
|
349
349
|
>
|
|
350
350
|
Today
|
|
351
351
|
</button>
|
|
@@ -10,7 +10,7 @@ import { twMerge } from "tailwind-merge";
|
|
|
10
10
|
import Icon from "../icon/Icon";
|
|
11
11
|
import { eye, search } from "../icon/iconPaths";
|
|
12
12
|
import type { InputProps } from "./types";
|
|
13
|
-
import { iconClass, inputStyles, primary } from "
|
|
13
|
+
import { iconClass, inputStyles, primary } from "../globalStyle";
|
|
14
14
|
|
|
15
15
|
export const Input = ({
|
|
16
16
|
OTPField = false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
2
|
import { createPortal } from "react-dom";
|
|
3
|
-
import { popUp } from "
|
|
3
|
+
import { popUp } from "../globalStyle";
|
|
4
4
|
|
|
5
5
|
export const PortalDropdown = ({ targetRef, children, isVisible }: any) => {
|
|
6
6
|
const [position, setPosition] = useState({ top: 0, left: 0, width: 0 });
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
} from "@grampro/headless-helpers";
|
|
22
22
|
import Icon from "../icon/Icon";
|
|
23
23
|
import { check, search, upDown, x } from "../icon/iconPaths";
|
|
24
|
-
import { iconClass, primary } from "
|
|
25
|
-
import { selectStyle } from "
|
|
24
|
+
import { iconClass, primary } from "../globalStyle";
|
|
25
|
+
import { selectStyle } from "../globalStyle";
|
|
26
26
|
import { PortalDropdown } from "./PortalDropDown";
|
|
27
27
|
|
|
28
28
|
const MultiSelect = forwardRef<MultiSelectHandle, MultiSelectProps>(
|
|
@@ -153,7 +153,7 @@ const MultiSelect = forwardRef<MultiSelectHandle, MultiSelectProps>(
|
|
|
153
153
|
<Icon
|
|
154
154
|
elements={check}
|
|
155
155
|
svgClass={`h-4 w-4 fill-none ${
|
|
156
|
-
selected.includes(value) ? "stroke-
|
|
156
|
+
selected.includes(value) ? "stroke-black dark:stroke-white" : ""
|
|
157
157
|
}`}
|
|
158
158
|
/>
|
|
159
159
|
{label.length > 20 ? `${label.substring(0, 20)}...` : label}
|
|
@@ -179,7 +179,7 @@ const MultiSelect = forwardRef<MultiSelectHandle, MultiSelectProps>(
|
|
|
179
179
|
return (
|
|
180
180
|
<span
|
|
181
181
|
key={index}
|
|
182
|
-
className="bg-
|
|
182
|
+
className="bg-black text-white dark:bg-zinc-900 px-2 py-1 rounded flex items-center gap-1 text-xs whitespace-nowrap border border-transparent dark:border-zinc-800"
|
|
183
183
|
>
|
|
184
184
|
{label.length > 15 ? `${label.substring(0, 15)}...` : label}
|
|
185
185
|
<span
|
|
@@ -187,7 +187,7 @@ const MultiSelect = forwardRef<MultiSelectHandle, MultiSelectProps>(
|
|
|
187
187
|
e.stopPropagation();
|
|
188
188
|
handleSelect(value);
|
|
189
189
|
}}
|
|
190
|
-
className="cursor-pointer hover:bg-
|
|
190
|
+
className="cursor-pointer hover:bg-zinc-800 dark:hover:bg-zinc-700 rounded p-0.5"
|
|
191
191
|
>
|
|
192
192
|
<Icon elements={x} svgClass="h-3 w-3 stroke-white" />
|
|
193
193
|
</span>
|
|
@@ -195,7 +195,7 @@ const MultiSelect = forwardRef<MultiSelectHandle, MultiSelectProps>(
|
|
|
195
195
|
);
|
|
196
196
|
})}
|
|
197
197
|
{truncate && selected.length > 3 && (
|
|
198
|
-
<span className="bg-
|
|
198
|
+
<span className="bg-black text-white dark:bg-zinc-900 px-2 py-1 rounded text-xs whitespace-nowrap border border-transparent dark:border-zinc-800">
|
|
199
199
|
+{selected.length - 3} more
|
|
200
200
|
</span>
|
|
201
201
|
)}
|
|
@@ -27,7 +27,7 @@ const AuthSection: React.FC<AuthSectionProps> = ({
|
|
|
27
27
|
alt={userProfile.name}
|
|
28
28
|
/>
|
|
29
29
|
) : (
|
|
30
|
-
<div className="h-8 w-8 rounded-full bg-
|
|
30
|
+
<div className="h-8 w-8 rounded-full bg-black dark:bg-white text-white dark:text-black flex items-center justify-center font-bold">
|
|
31
31
|
{userProfile.name.charAt(0).toUpperCase()}
|
|
32
32
|
</div>
|
|
33
33
|
)}
|
|
@@ -75,11 +75,11 @@ const AuthSection: React.FC<AuthSectionProps> = ({
|
|
|
75
75
|
<button
|
|
76
76
|
onClick={onLogin}
|
|
77
77
|
className={`
|
|
78
|
-
px-4 py-2 text-sm font-medium rounded-md
|
|
78
|
+
px-4 py-2 text-sm font-medium rounded-md border border-zinc-300 dark:border-zinc-700
|
|
79
79
|
${
|
|
80
80
|
variant === "dark"
|
|
81
|
-
? "text-white hover:bg-
|
|
82
|
-
: "text-
|
|
81
|
+
? "text-white hover:bg-zinc-850"
|
|
82
|
+
: "text-black hover:bg-zinc-100 dark:text-white dark:hover:bg-zinc-900"
|
|
83
83
|
}
|
|
84
84
|
`}
|
|
85
85
|
>
|
|
@@ -87,7 +87,7 @@ const AuthSection: React.FC<AuthSectionProps> = ({
|
|
|
87
87
|
</button>
|
|
88
88
|
<button
|
|
89
89
|
onClick={onSignup}
|
|
90
|
-
className="px-4 py-2 text-sm font-medium text-white bg-
|
|
90
|
+
className="px-4 py-2 text-sm font-medium text-white bg-black dark:bg-white dark:text-black rounded-md hover:bg-zinc-900 dark:hover:bg-zinc-100 transition-colors"
|
|
91
91
|
>
|
|
92
92
|
Sign up
|
|
93
93
|
</button>
|
|
@@ -38,7 +38,7 @@ const NavItemComponent: React.FC<NavItemComponentProps> = ({
|
|
|
38
38
|
onClick={(e) => toggleSubmenu(item.id, e)}
|
|
39
39
|
className={`
|
|
40
40
|
flex items-center justify-between px-3 py-2 rounded-md
|
|
41
|
-
${item.highlight ? "font-
|
|
41
|
+
${item.highlight ? "font-bold text-black dark:text-white" : ""}
|
|
42
42
|
${
|
|
43
43
|
isMobile
|
|
44
44
|
? "w-full text-left"
|
|
@@ -92,7 +92,7 @@ const NavItemComponent: React.FC<NavItemComponentProps> = ({
|
|
|
92
92
|
href={item.href}
|
|
93
93
|
className={`
|
|
94
94
|
flex items-center px-3 py-2 rounded-md
|
|
95
|
-
${item.highlight ? "font-
|
|
95
|
+
${item.highlight ? "font-bold text-black dark:text-white" : ""}
|
|
96
96
|
${
|
|
97
97
|
isMobile
|
|
98
98
|
? "block w-full"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState, useCallback } from "react";
|
|
2
2
|
import { createPortal } from "react-dom";
|
|
3
|
-
import { popUp } from "
|
|
3
|
+
import { popUp } from "../globalStyle";
|
|
4
4
|
|
|
5
5
|
export const PortalDropdown = ({ targetRef, children, isVisible }: any) => {
|
|
6
6
|
const [position, setPosition] = useState({ top: 0, left: 0, width: 0 });
|
|
@@ -16,8 +16,8 @@ import React, {
|
|
|
16
16
|
import Icon from "../icon/Icon";
|
|
17
17
|
import { check, search, upDown, x } from "../icon/iconPaths";
|
|
18
18
|
import type { ItemsProps, SelectHandle, SelectProps } from "./types";
|
|
19
|
-
import { selectStyle } from "
|
|
20
|
-
import { iconClass, primary } from "
|
|
19
|
+
import { selectStyle } from "../globalStyle";
|
|
20
|
+
import { iconClass, primary } from "../globalStyle";
|
|
21
21
|
import {
|
|
22
22
|
useSelectState,
|
|
23
23
|
useSelectData,
|
|
@@ -40,7 +40,7 @@ const Select = forwardRef<SelectHandle, SelectProps>((props, ref) => {
|
|
|
40
40
|
error = undefined,
|
|
41
41
|
onFiltering,
|
|
42
42
|
disabled = false,
|
|
43
|
-
className = "",
|
|
43
|
+
className = "",
|
|
44
44
|
} = props;
|
|
45
45
|
|
|
46
46
|
applyScrollbarStyles();
|
|
@@ -164,7 +164,7 @@ const Select = forwardRef<SelectHandle, SelectProps>((props, ref) => {
|
|
|
164
164
|
}
|
|
165
165
|
}}
|
|
166
166
|
className={`${selectStyle["filter-button"]} ${
|
|
167
|
-
focusedIndex === index ? "bg-
|
|
167
|
+
focusedIndex === index ? "bg-zinc-100 text-black dark:bg-zinc-900 dark:text-white" : ""
|
|
168
168
|
}`}
|
|
169
169
|
onClick={() => handleSelect({ value, label })}
|
|
170
170
|
onMouseEnter={() => setFocusedIndex(index)}
|
|
@@ -172,7 +172,7 @@ const Select = forwardRef<SelectHandle, SelectProps>((props, ref) => {
|
|
|
172
172
|
<Icon
|
|
173
173
|
elements={check}
|
|
174
174
|
svgClass={`h-4 w-4 fill-none ${
|
|
175
|
-
selectedItem === value ? "stroke-
|
|
175
|
+
selectedItem === value ? "stroke-black dark:stroke-white" : ""
|
|
176
176
|
}`}
|
|
177
177
|
/>
|
|
178
178
|
{label.length > 20 ? `${label.substring(0, 20)}...` : label}
|
|
@@ -11,8 +11,8 @@ import type { SpinnerProps } from "./types";
|
|
|
11
11
|
|
|
12
12
|
export const Spinner: React.FC<SpinnerProps> = ({
|
|
13
13
|
size = "h-10 w-10",
|
|
14
|
-
color = "border-blue-
|
|
15
|
-
fullCircleColor = "border-t-
|
|
14
|
+
color = "border-blue-500",
|
|
15
|
+
fullCircleColor = "border-t-blue-400",
|
|
16
16
|
dotColor = "bg-blue-500",
|
|
17
17
|
duration = "duration-500",
|
|
18
18
|
type = "circle",
|
|
@@ -36,8 +36,8 @@ export function Tabs({
|
|
|
36
36
|
className={twMerge(
|
|
37
37
|
"flex gap-1",
|
|
38
38
|
isPills
|
|
39
|
-
? "rounded-lg bg-
|
|
40
|
-
: "border-b border-
|
|
39
|
+
? "rounded-lg bg-zinc-100 p-1 dark:bg-zinc-900"
|
|
40
|
+
: "border-b border-zinc-200 dark:border-zinc-800"
|
|
41
41
|
)}
|
|
42
42
|
>
|
|
43
43
|
{tabs.map((tab) => {
|
|
@@ -49,14 +49,14 @@ export function Tabs({
|
|
|
49
49
|
type="button"
|
|
50
50
|
disabled={tab.disabled}
|
|
51
51
|
className={twMerge(
|
|
52
|
-
"min-h-9 px-4 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-
|
|
52
|
+
"min-h-9 px-4 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black dark:focus-visible:ring-white disabled:cursor-not-allowed disabled:text-zinc-400",
|
|
53
53
|
isPills ? "rounded-md" : "-mb-px border-b-2 border-transparent",
|
|
54
54
|
isActive && isPills
|
|
55
|
-
? "bg-white text-
|
|
55
|
+
? "bg-white text-zinc-950 shadow-sm dark:bg-zinc-800 dark:text-white"
|
|
56
56
|
: "",
|
|
57
57
|
isActive && !isPills
|
|
58
|
-
? "border-
|
|
59
|
-
: "text-
|
|
58
|
+
? "border-black text-black dark:border-white dark:text-white"
|
|
59
|
+
: "text-zinc-500 hover:text-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-100"
|
|
60
60
|
)}
|
|
61
61
|
onClick={() => !tab.disabled && handleTabChange(tab.id)}
|
|
62
62
|
>
|
|
@@ -39,21 +39,21 @@ export const TextArea = ({
|
|
|
39
39
|
const variantClasses = {
|
|
40
40
|
default: {
|
|
41
41
|
textarea:
|
|
42
|
-
"border border-
|
|
43
|
-
label: "mb-2 block text-sm font-medium text-
|
|
42
|
+
"border border-zinc-300 bg-white text-zinc-900 shadow-sm hover:border-zinc-400 focus:border-black focus:ring-black/20 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-100 dark:focus:border-white dark:focus:ring-white/20",
|
|
43
|
+
label: "mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300",
|
|
44
44
|
},
|
|
45
45
|
minimal: {
|
|
46
46
|
textarea:
|
|
47
|
-
"border-0 border-b-2 border-
|
|
47
|
+
"border-0 border-b-2 border-zinc-200 bg-transparent px-0 shadow-none focus:border-black dark:border-zinc-800 dark:text-zinc-100 dark:focus:border-white",
|
|
48
48
|
label: twMerge(
|
|
49
49
|
"absolute left-0 pointer-events-none transition-all duration-200",
|
|
50
|
-
isFloating ? "-top-5 text-xs text-
|
|
50
|
+
isFloating ? "-top-5 text-xs text-black dark:text-white font-semibold" : "top-3 text-sm text-zinc-400"
|
|
51
51
|
),
|
|
52
52
|
},
|
|
53
53
|
glass: {
|
|
54
54
|
textarea:
|
|
55
|
-
"border border-white/40 bg-white/70 text-
|
|
56
|
-
label: "mb-2 block text-sm font-medium text-
|
|
55
|
+
"border border-white/40 bg-white/70 text-zinc-900 shadow-sm backdrop-blur hover:border-white/70 focus:border-black focus:ring-black/20 dark:border-white/10 dark:bg-zinc-950/70 dark:text-zinc-100 dark:focus:border-white dark:focus:ring-white/20",
|
|
56
|
+
label: "mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300",
|
|
57
57
|
},
|
|
58
58
|
}[variant];
|
|
59
59
|
|
|
@@ -79,7 +79,7 @@ export const TextArea = ({
|
|
|
79
79
|
required={required}
|
|
80
80
|
disabled={disabled}
|
|
81
81
|
className={twMerge(
|
|
82
|
-
"w-full resize-none rounded-lg px-3 py-3 text-sm outline-none transition-all duration-200 focus:ring-2 disabled:cursor-not-allowed disabled:bg-
|
|
82
|
+
"w-full resize-none rounded-lg px-3 py-3 text-sm outline-none transition-all duration-200 focus:ring-2 disabled:cursor-not-allowed disabled:bg-zinc-50 dark:disabled:bg-zinc-900 disabled:opacity-60",
|
|
83
83
|
variantClasses.textarea,
|
|
84
84
|
error ? "border-rose-500 focus:border-rose-500 focus:ring-rose-500/20" : ""
|
|
85
85
|
)}
|
|
@@ -102,14 +102,14 @@ export const TextArea = ({
|
|
|
102
102
|
{error ? (
|
|
103
103
|
<p className="text-xs font-medium text-rose-600">{error}</p>
|
|
104
104
|
) : helperText ? (
|
|
105
|
-
<p className="text-xs text-
|
|
105
|
+
<p className="text-xs text-zinc-500">{helperText}</p>
|
|
106
106
|
) : null}
|
|
107
107
|
</div>
|
|
108
108
|
|
|
109
109
|
{maxLength && (
|
|
110
110
|
<span
|
|
111
111
|
className={twMerge(
|
|
112
|
-
"shrink-0 text-xs text-
|
|
112
|
+
"shrink-0 text-xs text-zinc-400",
|
|
113
113
|
charCount > maxLength * 0.9 ? "text-amber-600" : "",
|
|
114
114
|
charCount === maxLength ? "text-rose-600" : ""
|
|
115
115
|
)}
|
|
@@ -7,35 +7,28 @@ interface ToastProps {
|
|
|
7
7
|
toast: Toast;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
default: "
|
|
12
|
-
success: "
|
|
13
|
-
error: "
|
|
14
|
-
warning: "
|
|
15
|
-
} as const;
|
|
16
|
-
|
|
17
|
-
const toastAnimation = {
|
|
18
|
-
default: "",
|
|
19
|
-
error: "animate-shake animate-once animate-duration-200",
|
|
20
|
-
success: "animate-jump-in animate-once animate-duration-200",
|
|
21
|
-
warning: "animate-jump-in animate-once animate-duration-200",
|
|
10
|
+
const leftBorderColors = {
|
|
11
|
+
default: "border-l-zinc-550 dark:border-l-zinc-600",
|
|
12
|
+
success: "border-l-emerald-500",
|
|
13
|
+
error: "border-l-rose-500",
|
|
14
|
+
warning: "border-l-amber-500",
|
|
22
15
|
} as const;
|
|
23
16
|
|
|
24
17
|
const CloseButton = ({ onDismiss }: { onDismiss: () => void }) => (
|
|
25
18
|
<button
|
|
26
19
|
onClick={onDismiss}
|
|
27
|
-
className="shrink-0 rounded-
|
|
20
|
+
className="shrink-0 rounded-md p-1 transition-colors text-zinc-400 hover:text-zinc-900 dark:hover:text-white hover:bg-zinc-100 dark:hover:bg-zinc-900 focus:outline-none"
|
|
28
21
|
>
|
|
29
22
|
<svg
|
|
30
|
-
className="h-
|
|
23
|
+
className="h-3.5 w-3.5"
|
|
31
24
|
fill="none"
|
|
32
25
|
viewBox="0 0 24 24"
|
|
33
26
|
stroke="currentColor"
|
|
27
|
+
strokeWidth={2.5}
|
|
34
28
|
>
|
|
35
29
|
<path
|
|
36
30
|
strokeLinecap="round"
|
|
37
31
|
strokeLinejoin="round"
|
|
38
|
-
strokeWidth={2}
|
|
39
32
|
d="M6 18L18 6M6 6l12 12"
|
|
40
33
|
/>
|
|
41
34
|
</svg>
|
|
@@ -58,7 +51,7 @@ export function ToastComponent({ toast }: ToastProps) {
|
|
|
58
51
|
|
|
59
52
|
if (toast.content) {
|
|
60
53
|
return (
|
|
61
|
-
<div className="relative">
|
|
54
|
+
<div className="relative pointer-events-auto rounded-lg border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 p-4 shadow-lg">
|
|
62
55
|
{toast.content}
|
|
63
56
|
<div className="absolute top-2 right-2">
|
|
64
57
|
<CloseButton onDismiss={handleDismiss} />
|
|
@@ -67,32 +60,40 @@ export function ToastComponent({ toast }: ToastProps) {
|
|
|
67
60
|
);
|
|
68
61
|
}
|
|
69
62
|
|
|
63
|
+
const borderClass = leftBorderColors[toast.type || "default"];
|
|
64
|
+
|
|
70
65
|
return (
|
|
71
66
|
<div
|
|
72
67
|
className={`
|
|
73
|
-
${bgColors[toast.type || "default"]}
|
|
74
|
-
${toastAnimation[toast.type || "default"]}
|
|
75
68
|
transform transition-all duration-300 ease-in-out
|
|
76
|
-
pointer-events-auto relative flex w-full items-
|
|
77
|
-
overflow-hidden rounded-
|
|
69
|
+
pointer-events-auto relative flex w-full items-start justify-between
|
|
70
|
+
overflow-hidden rounded-lg border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 px-4 py-3.5 shadow-lg
|
|
71
|
+
border-l-4 ${borderClass}
|
|
72
|
+
animate-fade-in
|
|
78
73
|
`}
|
|
79
74
|
role="alert"
|
|
80
75
|
>
|
|
81
76
|
<div className="flex items-start gap-3 w-full">
|
|
82
|
-
<
|
|
83
|
-
|
|
77
|
+
<div className="mt-0.5 shrink-0">
|
|
78
|
+
<ToastIcon type={toast.type} />
|
|
79
|
+
</div>
|
|
80
|
+
<div className="flex-1 min-w-0">
|
|
84
81
|
{toast.title && (
|
|
85
|
-
<div className="font-
|
|
82
|
+
<div className="font-bold text-sm text-zinc-900 dark:text-white tracking-tight leading-none">
|
|
86
83
|
{toast.title}
|
|
87
84
|
</div>
|
|
88
85
|
)}
|
|
89
86
|
{toast.description && (
|
|
90
|
-
<div className="text-
|
|
87
|
+
<div className="text-xs font-medium text-zinc-500 dark:text-zinc-400 mt-1">
|
|
91
88
|
{toast.description}
|
|
92
89
|
</div>
|
|
93
90
|
)}
|
|
94
91
|
</div>
|
|
95
|
-
{toast.action
|
|
92
|
+
{toast.action && (
|
|
93
|
+
<div className="shrink-0 flex items-center gap-2">
|
|
94
|
+
{toast.action}
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
96
97
|
<CloseButton onDismiss={handleDismiss} />
|
|
97
98
|
</div>
|
|
98
99
|
</div>
|
|
@@ -4,20 +4,20 @@ const ToastIcon = ({ type }: { type: Toast["type"] }) => {
|
|
|
4
4
|
if (!type) return null;
|
|
5
5
|
|
|
6
6
|
const iconColors = {
|
|
7
|
-
default: "text-
|
|
8
|
-
success: "text-
|
|
9
|
-
error: "text-
|
|
10
|
-
warning: "text-
|
|
7
|
+
default: "text-zinc-500",
|
|
8
|
+
success: "text-emerald-500",
|
|
9
|
+
error: "text-rose-500",
|
|
10
|
+
warning: "text-amber-500",
|
|
11
11
|
} as const;
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<div className={`h-5 w-5 ${iconColors[type]}`}>
|
|
14
|
+
<div className={`h-4.5 w-4.5 ${iconColors[type]}`}>
|
|
15
15
|
{type === "success" && (
|
|
16
16
|
<svg
|
|
17
17
|
viewBox="0 0 24 24"
|
|
18
18
|
fill="none"
|
|
19
19
|
stroke="currentColor"
|
|
20
|
-
strokeWidth="2"
|
|
20
|
+
strokeWidth="2.5"
|
|
21
21
|
>
|
|
22
22
|
<path
|
|
23
23
|
strokeLinecap="round"
|
|
@@ -31,7 +31,7 @@ const ToastIcon = ({ type }: { type: Toast["type"] }) => {
|
|
|
31
31
|
viewBox="0 0 24 24"
|
|
32
32
|
fill="none"
|
|
33
33
|
stroke="currentColor"
|
|
34
|
-
strokeWidth="2"
|
|
34
|
+
strokeWidth="2.5"
|
|
35
35
|
>
|
|
36
36
|
<path
|
|
37
37
|
strokeLinecap="round"
|
|
@@ -45,7 +45,7 @@ const ToastIcon = ({ type }: { type: Toast["type"] }) => {
|
|
|
45
45
|
viewBox="0 0 24 24"
|
|
46
46
|
fill="none"
|
|
47
47
|
stroke="currentColor"
|
|
48
|
-
strokeWidth="2"
|
|
48
|
+
strokeWidth="2.5"
|
|
49
49
|
>
|
|
50
50
|
<path
|
|
51
51
|
strokeLinecap="round"
|
|
@@ -30,7 +30,7 @@ const AestheticProcessingAnimationWithStyles = ({
|
|
|
30
30
|
progressPercentage,
|
|
31
31
|
}: AestheticProcessingAnimationProps) => (
|
|
32
32
|
<>
|
|
33
|
-
<style
|
|
33
|
+
<style dangerouslySetInnerHTML={{ __html: `
|
|
34
34
|
@keyframes processing {
|
|
35
35
|
0% {
|
|
36
36
|
transform: translateX(-100%);
|
|
@@ -42,7 +42,7 @@ const AestheticProcessingAnimationWithStyles = ({
|
|
|
42
42
|
.animate-processing {
|
|
43
43
|
animation: processing 2s ease-in-out infinite;
|
|
44
44
|
}
|
|
45
|
-
`}
|
|
45
|
+
` }} />
|
|
46
46
|
<AestheticProcessingAnimation progressPercentage={progressPercentage} />
|
|
47
47
|
</>
|
|
48
48
|
);
|
|
@@ -105,7 +105,7 @@ export default function UploadedFilePreview({
|
|
|
105
105
|
<Icon
|
|
106
106
|
dimensions={{ width: "18", height: "18" }}
|
|
107
107
|
elements={cloudDownload}
|
|
108
|
-
svgClass={"stroke-
|
|
108
|
+
svgClass={"stroke-zinc-700 dark:stroke-zinc-400 fill-none"}
|
|
109
109
|
/>
|
|
110
110
|
</button>
|
|
111
111
|
{isRemovable && (
|
|
@@ -223,7 +223,7 @@ export const FileUploader = ({
|
|
|
223
223
|
ref={dropZoneRef}
|
|
224
224
|
className={`flex flex-col items-center border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors ${
|
|
225
225
|
isDragging
|
|
226
|
-
? "border-
|
|
226
|
+
? "border-black bg-zinc-50 dark:border-white dark:bg-zinc-900"
|
|
227
227
|
: "border-gray-300 hover:border-gray-400"
|
|
228
228
|
}`}
|
|
229
229
|
onClick={() => fileInputRef.current.click()}
|
|
@@ -27,7 +27,7 @@ export const GetFileIcon = ({ file, showImagePreview, previewUrls }: any) => {
|
|
|
27
27
|
<Icon
|
|
28
28
|
dimensions={{ width: "26", height: "26" }}
|
|
29
29
|
elements={fileimage}
|
|
30
|
-
svgClass={"stroke-
|
|
30
|
+
svgClass={"stroke-zinc-500 fill-none dark:stroke-white"}
|
|
31
31
|
/>
|
|
32
32
|
);
|
|
33
33
|
if (file.type === "application/pdf" || file.type.includes("pdf"))
|
package/source/globalStyle.ts
CHANGED
|
@@ -8,10 +8,8 @@ export const primary = {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const popUp = {
|
|
11
|
-
"pop-up-style":
|
|
12
|
-
|
|
13
|
-
"pop-up-style-calender":
|
|
14
|
-
`${preset.surface.overlay} w-full absolute overflow-y-auto rounded-lg mt-1 scrollbar z-[90] h-[370px] text-slate-700 dark:text-slate-100 animate-fade-down animate-once animate-duration-200`,
|
|
11
|
+
"pop-up-style": `${preset.surface.overlay} w-full absolute overflow-y-auto rounded-lg mt-1 scrollbar z-[90] h-44 text-sm text-slate-700 dark:text-slate-100 animate-fade-down animate-once animate-duration-200`,
|
|
12
|
+
"pop-up-style-calender": `${preset.surface.overlay} w-full absolute overflow-y-auto rounded-lg mt-1 scrollbar z-[90] h-[370px] text-slate-700 dark:text-slate-100 animate-fade-down animate-once animate-duration-200`,
|
|
15
13
|
};
|
|
16
14
|
|
|
17
15
|
export const iconClass = {
|
|
@@ -28,14 +26,13 @@ export const inputStyles = {
|
|
|
28
26
|
};
|
|
29
27
|
|
|
30
28
|
export const selectStyle = {
|
|
31
|
-
"select-button":
|
|
32
|
-
`${preset.control} ${preset.radius} ${preset.focusRing} flex min-h-10 w-full items-center justify-between gap-2 px-3 py-2 text-left text-sm font-medium shadow-sm`,
|
|
29
|
+
"select-button": `${preset.control} ${preset.radius} ${preset.focusRing} flex min-h-10 w-full items-center justify-between gap-2 px-3 py-2 text-left text-sm font-medium shadow-sm`,
|
|
33
30
|
"filter-button":
|
|
34
|
-
"mt-1 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-
|
|
31
|
+
"mt-1 flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-zinc-700 transition-colors hover:bg-zinc-100 hover:text-black dark:text-zinc-300 dark:hover:bg-zinc-900 dark:hover:text-white",
|
|
35
32
|
"input-parent":
|
|
36
|
-
"sticky top-0 z-50 flex w-full items-center gap-1 border-b border-
|
|
33
|
+
"sticky top-0 z-50 flex w-full items-center gap-1 border-b border-zinc-200 bg-white px-1 py-1 text-sm dark:border-zinc-800 dark:bg-zinc-950",
|
|
37
34
|
"selectedDisplay-Button":
|
|
38
|
-
"absolute right-8 top-1/2 z-20 flex -translate-y-1/2 items-center rounded-md p-1 transition-colors hover:bg-
|
|
35
|
+
"absolute right-8 top-1/2 z-20 flex -translate-y-1/2 items-center rounded-md p-1 transition-colors hover:bg-zinc-100 dark:hover:bg-zinc-800",
|
|
39
36
|
};
|
|
40
37
|
|
|
41
38
|
export const buttonStyles = {
|
|
@@ -46,16 +43,32 @@ export const buttonStyles = {
|
|
|
46
43
|
lg: "h-11 px-5 text-base",
|
|
47
44
|
},
|
|
48
45
|
variants: {
|
|
49
|
-
primary:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
primary:
|
|
47
|
+
"bg-black text-white hover:bg-zinc-900 dark:bg-white dark:text-black dark:hover:bg-zinc-100",
|
|
48
|
+
secondary:
|
|
49
|
+
"bg-zinc-900 text-white hover:bg-zinc-850 dark:bg-zinc-100 dark:text-black dark:hover:bg-zinc-200",
|
|
50
|
+
outline:
|
|
51
|
+
"border border-zinc-300 bg-white text-zinc-900 hover:bg-zinc-50 dark:border-zinc-850 dark:bg-black dark:text-zinc-100 dark:hover:bg-zinc-900",
|
|
52
|
+
ghost:
|
|
53
|
+
"text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-900",
|
|
53
54
|
danger: "bg-rose-600 text-white hover:bg-rose-700",
|
|
54
55
|
},
|
|
55
56
|
};
|
|
56
57
|
|
|
57
58
|
export const cardStyles = {
|
|
58
59
|
base: `${preset.surface.raised} rounded-lg p-4`,
|
|
59
|
-
interactive:
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
interactive: "transition-shadow hover:shadow-md hover:shadow-zinc-950/10",
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const gridStyles = {
|
|
64
|
+
container: `${preset.surface.raised} flex flex-col rounded-md overflow-hidden dark:text-white`,
|
|
65
|
+
toolbar: `flex bg-white dark:bg-black justify-end space-x-2 px-4 py-3 border-b border-zinc-200 dark:border-zinc-900`,
|
|
66
|
+
pagination: `w-full flex flex-wrap justify-between items-center text-xs px-4 py-3 bg-white dark:bg-black gap-2 md:gap-4 border-t border-zinc-200 dark:border-zinc-900`,
|
|
67
|
+
tableHeader: `bg-zinc-50 dark:bg-zinc-950 text-zinc-900 dark:text-zinc-100 font-bold border-b border-zinc-200 dark:border-zinc-900 px-4 py-3 text-left text-xs uppercase tracking-wider`,
|
|
68
|
+
button: `border border-zinc-300 dark:border-zinc-800 bg-white dark:bg-zinc-950 text-zinc-700 dark:text-zinc-300 hover:bg-zinc-50 dark:hover:bg-zinc-900 rounded px-3 py-1.5 text-xs font-semibold cursor-pointer transition`,
|
|
69
|
+
rowEven:
|
|
70
|
+
"bg-white dark:bg-black hover:bg-zinc-50/50 dark:hover:bg-zinc-900/60 transition-colors text-black dark:text-white",
|
|
71
|
+
rowOdd:
|
|
72
|
+
"bg-zinc-50/20 dark:bg-zinc-950/20 hover:bg-zinc-50/50 dark:hover:bg-zinc-900/60 transition-colors",
|
|
73
|
+
rowSelected: "bg-zinc-100 dark:bg-zinc-900 font-semibold",
|
|
74
|
+
};
|
package/source/theme.ts
CHANGED
|
@@ -16,23 +16,23 @@ export const componentPresets = {
|
|
|
16
16
|
id: "gbs-basic",
|
|
17
17
|
radius: "rounded-lg",
|
|
18
18
|
focusRing:
|
|
19
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-
|
|
19
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black dark:focus-visible:ring-white focus-visible:ring-offset-2",
|
|
20
20
|
disabled: "disabled:cursor-not-allowed disabled:opacity-55",
|
|
21
21
|
text: {
|
|
22
|
-
label: "text-sm font-medium text-
|
|
23
|
-
helper: "text-xs text-
|
|
22
|
+
label: "text-sm font-medium text-zinc-700 dark:text-zinc-300",
|
|
23
|
+
helper: "text-xs text-zinc-500",
|
|
24
24
|
error: "text-xs font-medium text-rose-600",
|
|
25
25
|
},
|
|
26
26
|
surface: {
|
|
27
27
|
raised:
|
|
28
|
-
"border border-
|
|
28
|
+
"border border-zinc-200 bg-white shadow-sm shadow-zinc-950/5 dark:border-zinc-900 dark:bg-black",
|
|
29
29
|
subtle:
|
|
30
|
-
"border border-
|
|
30
|
+
"border border-zinc-200 bg-zinc-50 dark:border-zinc-900 dark:bg-zinc-950",
|
|
31
31
|
overlay:
|
|
32
|
-
"border border-
|
|
32
|
+
"border border-zinc-200 bg-white shadow-xl shadow-zinc-950/10 dark:border-zinc-900 dark:bg-zinc-950",
|
|
33
33
|
},
|
|
34
34
|
control:
|
|
35
|
-
"border border-
|
|
35
|
+
"border border-zinc-300 bg-white text-zinc-900 transition-colors placeholder:text-zinc-400 hover:border-zinc-400 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-100",
|
|
36
36
|
},
|
|
37
37
|
} as const;
|
|
38
38
|
|