gbs-add-block 1.0.29 → 1.0.31
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 +3 -3
- package/package.json +1 -1
- package/source/components/bargraph/index.tsx +1 -1
- package/source/components/breadcrumb/index.tsx +1 -1
- package/source/components/button/index.tsx +1 -1
- package/source/components/card/index.tsx +1 -1
- package/source/components/checkbox/index.tsx +1 -1
- package/source/components/contextmenu/ContextMenu.tsx +1 -1
- package/source/components/contextmenu/ContextMenuItem.tsx +1 -1
- package/source/components/contextmenu/types.ts +1 -1
- package/source/components/datagrid/context/GridContext.tsx +7 -5
- package/source/components/datagrid/hooks/usePagination.ts +11 -1
- package/source/components/datagrid/type.ts +1 -1
- package/source/components/formrenderer/componentHandles/CheckBoxHandles.tsx +1 -1
- package/source/components/formrenderer/componentHandles/DatePickerHandles.tsx +1 -1
- package/source/components/formrenderer/componentHandles/InputHandles.tsx +1 -1
- package/source/components/formrenderer/componentHandles/MultiHandles.tsx +1 -1
- package/source/components/formrenderer/componentHandles/SelectHandles.tsx +1 -1
- package/source/components/formrenderer/helperFunctions.ts +1 -1
- package/source/components/formrenderer/index.tsx +1 -1
- package/source/components/input/types.ts +1 -1
- package/source/components/materialInput/index.tsx +1 -1
- package/source/components/materialInput/types.ts +1 -1
- package/source/components/modal/index.tsx +1 -1
- package/source/components/navbar/AuthSection.tsx +1 -1
- package/source/components/navbar/MobileToggle.tsx +1 -1
- package/source/components/navbar/NavItemComponent.tsx +1 -1
- package/source/components/navbar/SearchBar.tsx +1 -1
- package/source/components/navbar/index.tsx +1 -1
- package/source/components/sidebar/components/MenuItem.tsx +1 -1
- package/source/components/sidebar/components/MenuSection.tsx +1 -1
- package/source/components/sidebar/components/SidebarFooter.tsx +1 -1
- package/source/components/sidebar/components/SidebarLogo.tsx +1 -1
- package/source/components/sidebar/components/SidebarMenu.tsx +1 -1
- package/source/components/sidebar/components/UserProfile.tsx +1 -1
- package/source/components/sidebar/hooks/useSidebarState.ts +1 -1
- package/source/components/sidebar/index.tsx +1 -1
- package/source/components/tabs/index.tsx +1 -1
- package/source/components/tabs/types.ts +1 -1
- package/source/components/toast/ToastComponent.tsx +1 -1
- package/source/components/toast/ToastIcon.tsx +1 -1
- package/source/components/toast/index.tsx +1 -1
- package/source/components/toast/toastStore.ts +1 -1
- package/source/components/toast/useToast.ts +1 -1
- package/source/icon/iconPaths.ts +21 -0
- package/source/components/datagrid/hooks/usePageStatus.ts +0 -13
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GBS Building Blocks 2.0 (v1.0.
|
|
1
|
+
# GBS Building Blocks 2.0 (v1.0.30)
|
|
2
2
|
|
|
3
3
|
Latest and upgraded version of GBS building blocks with headless UI and removed dependencies.
|
|
4
4
|
|
|
@@ -6,9 +6,9 @@ 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.0.
|
|
9
|
+
## What's New 🎉 (Ver 1.0.30)
|
|
10
10
|
|
|
11
|
-
-
|
|
11
|
+
- Type Import Update
|
|
12
12
|
|
|
13
13
|
## Authors
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ import React from "react";
|
|
|
9
9
|
import { useLocation } from "@grampro/headless-helpers";
|
|
10
10
|
import Icon from "../icon/Icon";
|
|
11
11
|
import { rightArrow } from "../icon/iconPaths";
|
|
12
|
-
import { BreadcrumbsProps } from "./types";
|
|
12
|
+
import type { BreadcrumbsProps } from "./types";
|
|
13
13
|
|
|
14
14
|
export const Breadcrumb = ({
|
|
15
15
|
showHome = true,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import React, { ButtonHTMLAttributes, ReactNode } from "react";
|
|
8
|
+
import React, { type ButtonHTMLAttributes, type ReactNode } from "react";
|
|
9
9
|
|
|
10
10
|
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
11
11
|
children?: ReactNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect, useCallback, MouseEvent } from "react";
|
|
2
|
-
import { ContextMenuProps, Position } from "./types";
|
|
2
|
+
import type { ContextMenuProps, Position } from "./types";
|
|
3
3
|
|
|
4
4
|
export const ContextMenu: React.FC<ContextMenuProps> = ({ children }) => {
|
|
5
5
|
const [isVisible, setIsVisible] = useState<boolean>(false);
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
useSearch,
|
|
8
8
|
useFiltering,
|
|
9
9
|
useRowSelection,
|
|
10
|
-
usePageStatus,
|
|
11
10
|
} from "../hooks";
|
|
12
11
|
|
|
13
12
|
const GridContext = createContext<GridContextType | undefined>(undefined);
|
|
@@ -70,7 +69,13 @@ export const GridProvider: React.FC<{
|
|
|
70
69
|
goToFirstPage,
|
|
71
70
|
goToPage,
|
|
72
71
|
resetPage,
|
|
73
|
-
} = usePagination(
|
|
72
|
+
} = usePagination(
|
|
73
|
+
totalPages,
|
|
74
|
+
lazy,
|
|
75
|
+
workingDataSource,
|
|
76
|
+
pageSettings,
|
|
77
|
+
pageStatus
|
|
78
|
+
);
|
|
74
79
|
|
|
75
80
|
// Search functionality
|
|
76
81
|
const { searchParam, handleSearchInput, handleSearch } = useSearch({
|
|
@@ -110,9 +115,6 @@ export const GridProvider: React.FC<{
|
|
|
110
115
|
const { selectedRows, handleSelectAll, handleSelect, isRowSelected } =
|
|
111
116
|
useRowSelection(workingDataSource, onSelectRow);
|
|
112
117
|
|
|
113
|
-
// Page status reporting - Bug Report - causes re-rendering when currentPage or totalPages change
|
|
114
|
-
// usePageStatus(currentPage, totalPages, pageStatus);
|
|
115
|
-
|
|
116
118
|
// Context value
|
|
117
119
|
const contextValue: GridContextType = {
|
|
118
120
|
// State
|
|
@@ -4,13 +4,15 @@ export const usePagination = (
|
|
|
4
4
|
totalPages: number,
|
|
5
5
|
lazy: boolean,
|
|
6
6
|
dataSource?: any[],
|
|
7
|
-
pageSettings?: { pageNumber: number }
|
|
7
|
+
pageSettings?: { pageNumber: number },
|
|
8
|
+
pageStatus?: ({ currentPage }: { currentPage: number }) => void
|
|
8
9
|
) => {
|
|
9
10
|
const [currentPage, setCurrentPage] = useState(0);
|
|
10
11
|
const [pageStart, setPageStart] = useState(0);
|
|
11
12
|
const [pageEnd, setPageEnd] = useState(10);
|
|
12
13
|
const [prevDataLength, setPrevDataLength] = useState(0);
|
|
13
14
|
|
|
15
|
+
// Update page range based on current page
|
|
14
16
|
const updatePageRange = useCallback(
|
|
15
17
|
(page: number) => {
|
|
16
18
|
const start = Math.floor(page / 10) * 10;
|
|
@@ -20,6 +22,7 @@ export const usePagination = (
|
|
|
20
22
|
[totalPages]
|
|
21
23
|
);
|
|
22
24
|
|
|
25
|
+
// Initialize page range based on total pages
|
|
23
26
|
useEffect(() => {
|
|
24
27
|
if (!lazy) {
|
|
25
28
|
setPageEnd(Math.min(10, totalPages));
|
|
@@ -28,6 +31,13 @@ export const usePagination = (
|
|
|
28
31
|
}
|
|
29
32
|
}, [totalPages, lazy, pageStart]);
|
|
30
33
|
|
|
34
|
+
// Update page status if provided
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (pageStatus) {
|
|
37
|
+
pageStatus({ currentPage });
|
|
38
|
+
}
|
|
39
|
+
}, [currentPage, pageStatus]);
|
|
40
|
+
|
|
31
41
|
// This will handle the case when dataSource changes
|
|
32
42
|
// and adjust the current page accordingly in managed workflow
|
|
33
43
|
useEffect(() => {
|
|
@@ -35,7 +35,7 @@ export type GridProps = {
|
|
|
35
35
|
gridColumnStyleSelectAll?: string;
|
|
36
36
|
gridColumnStyle?: string;
|
|
37
37
|
rowChange?: any;
|
|
38
|
-
pageStatus?:
|
|
38
|
+
pageStatus?: ({ currentPage }: { currentPage: number }) => void;
|
|
39
39
|
activeFilterArrayValue?: ActiveFilterArrayValue[] | any;
|
|
40
40
|
searchParamValue?: (value: string) => void;
|
|
41
41
|
showTotalPages?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from "react";
|
|
2
2
|
import { DatePicker } from "../../datepicker";
|
|
3
|
-
import { DatePickerHandlesProps } from "../types";
|
|
3
|
+
import type { DatePickerHandlesProps } from "../types";
|
|
4
4
|
import { evaluateExpression } from "@grampro/headless-helpers";
|
|
5
5
|
|
|
6
6
|
export default function DatePickerHandles({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState, useCallback } from "react";
|
|
2
2
|
import { validateInput } from "../helperFunctions";
|
|
3
3
|
import { Input } from "../../input";
|
|
4
|
-
import { InputHandlesProps } from "../types";
|
|
4
|
+
import type { InputHandlesProps } from "../types";
|
|
5
5
|
import { evaluateExpression } from "@grampro/headless-helpers";
|
|
6
6
|
import { twMerge } from "tailwind-merge";
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import { MultiSelectHandlesProps } from "../types";
|
|
2
|
+
import type { MultiSelectHandlesProps } from "../types";
|
|
3
3
|
import { MultiSelect } from "../../multiselect";
|
|
4
4
|
import { evaluateExpression } from "@grampro/headless-helpers";
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from "react";
|
|
2
2
|
import { Select } from "../../select";
|
|
3
|
-
import { Option, SelectHandlesProps } from "../types";
|
|
3
|
+
import type { Option, SelectHandlesProps } from "../types";
|
|
4
4
|
import { evaluateExpression } from "@grampro/headless-helpers";
|
|
5
5
|
|
|
6
6
|
export default function SelectHandles({
|
|
@@ -3,7 +3,7 @@ import SelectHandles from "./componentHandles/SelectHandles";
|
|
|
3
3
|
import MultiHandles from "./componentHandles/MultiHandles";
|
|
4
4
|
import DatePickerHandles from "./componentHandles/DatePickerHandles";
|
|
5
5
|
import CheckboxHandles from "./componentHandles/CheckBoxHandles";
|
|
6
|
-
import { FormItem } from "./types";
|
|
6
|
+
import type { FormItem } from "./types";
|
|
7
7
|
|
|
8
8
|
// Component Map
|
|
9
9
|
export const COMPONENT_MAP = {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import React, { useRef, useState, FormEvent } from "react";
|
|
9
9
|
import { useFormContext } from "@grampro/headless-helpers";
|
|
10
|
-
import { FormItem, FormRendererProps } from "./types";
|
|
10
|
+
import type { FormItem, FormRendererProps } from "./types";
|
|
11
11
|
import { COMPONENT_MAP, validateField } from "./helperFunctions";
|
|
12
12
|
|
|
13
13
|
const FormRenderer: React.FC<FormRendererProps> = ({
|
|
@@ -9,7 +9,7 @@ import React, { useEffect, useCallback, memo, useRef } from "react";
|
|
|
9
9
|
import { twMerge } from "tailwind-merge";
|
|
10
10
|
import Icon from "../icon/Icon";
|
|
11
11
|
import { x } from "../icon/iconPaths";
|
|
12
|
-
import { ModalProps } from "./types";
|
|
12
|
+
import type { ModalProps } from "./types";
|
|
13
13
|
|
|
14
14
|
const defaultClasses = {
|
|
15
15
|
modal:
|
|
@@ -10,7 +10,7 @@ import NavItemComponent from "./NavItemComponent";
|
|
|
10
10
|
import SearchBar from "./SearchBar";
|
|
11
11
|
import AuthSection from "./AuthSection";
|
|
12
12
|
import MobileToggle from "./MobileToggle";
|
|
13
|
-
import { NavbarProps } from "./types";
|
|
13
|
+
import type { NavbarProps } from "./types";
|
|
14
14
|
import {
|
|
15
15
|
getContainerClasses,
|
|
16
16
|
getPositionClasses,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useEffect } from "react";
|
|
4
4
|
import { createPortal } from "react-dom";
|
|
5
|
-
import { ToastPosition } from "./types";
|
|
5
|
+
import type { ToastPosition } from "./types";
|
|
6
6
|
import { useToastStore } from "./toastStore";
|
|
7
7
|
import { ToastComponent } from "./ToastComponent";
|
|
8
8
|
|
package/source/icon/iconPaths.ts
CHANGED
|
@@ -177,3 +177,24 @@ export const cloudDownload: any = [
|
|
|
177
177
|
key: "ui1hmy",
|
|
178
178
|
},
|
|
179
179
|
];
|
|
180
|
+
|
|
181
|
+
export const plus: any = [
|
|
182
|
+
{ type: "path", d: "M12 5v14", key: "vertical" },
|
|
183
|
+
{ type: "path", d: "M5 12h14", key: "horizontal" },
|
|
184
|
+
];
|
|
185
|
+
|
|
186
|
+
export const trash: any = [
|
|
187
|
+
{
|
|
188
|
+
type: "path",
|
|
189
|
+
d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",
|
|
190
|
+
key: "bin",
|
|
191
|
+
fill: "none",
|
|
192
|
+
},
|
|
193
|
+
{ type: "path", d: "M3 6h18", key: "lid", fill: "none" },
|
|
194
|
+
{
|
|
195
|
+
type: "path",
|
|
196
|
+
d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",
|
|
197
|
+
key: "handle",
|
|
198
|
+
fill: "none",
|
|
199
|
+
},
|
|
200
|
+
];
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
|
|
3
|
-
export const usePageStatus = (
|
|
4
|
-
currentPage: number,
|
|
5
|
-
totalPages: number,
|
|
6
|
-
pageStatus?: (status: any) => void
|
|
7
|
-
) => {
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
if (pageStatus) {
|
|
10
|
-
pageStatus({ currentPage, totalPages });
|
|
11
|
-
}
|
|
12
|
-
}, [pageStatus, currentPage, totalPages]);
|
|
13
|
-
};
|