gbs-add-block 0.0.64 → 0.0.66
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/index.js +7 -57
- package/package.json +1 -1
- package/source/components/breadcrumb/index.tsx +64 -0
- package/source/components/breadcrumb/types.ts +10 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GBS Building Blocks 2.0 (v0.0.
|
|
1
|
+
# GBS Building Blocks 2.0 (v0.0.65)
|
|
2
2
|
|
|
3
3
|
Latest and upgraded version of GBS building blocks with headless UI and removed dependencies.
|
|
4
4
|
|
|
@@ -6,10 +6,10 @@ 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://blackmax-designs.gitbook.io/building-block-v2.0)
|
|
8
8
|
|
|
9
|
-
## What's New 🎉 (Ver 0.0.
|
|
9
|
+
## What's New 🎉 (Ver 0.0.65)
|
|
10
10
|
|
|
11
11
|
- Updated for bug fixes.
|
|
12
|
-
- New component "Skeleton" & "Navbar" Added.
|
|
12
|
+
- New component "Skeleton", "Breadcrumb" & "Navbar" Added.
|
|
13
13
|
- Planned Deprecation of Current Grid Component and Adding Beta version for the New Data Grid.
|
|
14
14
|
|
|
15
15
|
## Authors
|
package/index.js
CHANGED
|
@@ -27,25 +27,17 @@ const CONFIG = {
|
|
|
27
27
|
"Skeleton",
|
|
28
28
|
"Navbar",
|
|
29
29
|
"DataGrid",
|
|
30
|
+
"BreadCrumb",
|
|
30
31
|
],
|
|
31
32
|
// Define component dependencies
|
|
32
33
|
dependencies: {
|
|
33
34
|
FormRenderer: ["Select", "MultiSelect", "Input", "DatePicker"],
|
|
34
35
|
},
|
|
35
|
-
frameworks: {
|
|
36
|
-
next: {
|
|
37
|
-
name: "Next.js",
|
|
38
|
-
path: ["app", "component-lib"],
|
|
39
|
-
},
|
|
40
|
-
vite: {
|
|
41
|
-
name: "Vite",
|
|
42
|
-
path: ["src", "component-lib"],
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
36
|
docs: "https://blackmax-designs.gitbook.io/building-block-v2.0",
|
|
46
37
|
};
|
|
47
38
|
|
|
48
39
|
const SOURCE_PATH = path.join(__dirname, "source", "components");
|
|
40
|
+
const DEFAULT_DEST_PATH = path.join(process.cwd(), "component-lib");
|
|
49
41
|
|
|
50
42
|
const copyCommonFiles = async (destPath) => {
|
|
51
43
|
const commonFiles = [
|
|
@@ -79,8 +71,9 @@ const copyComponent = async (component, destPath) => {
|
|
|
79
71
|
await fs.copy(componentSrc, componentDest, { overwrite: true });
|
|
80
72
|
console.log(
|
|
81
73
|
`✓ Component ${component} installed successfully ${
|
|
82
|
-
component === "Grid"
|
|
83
|
-
|
|
74
|
+
component === "Grid"
|
|
75
|
+
? "This Version of Grid will be deprecated soon. Please Install The New Data Grid Component"
|
|
76
|
+
: ""
|
|
84
77
|
}`
|
|
85
78
|
);
|
|
86
79
|
} catch (error) {
|
|
@@ -121,24 +114,6 @@ const installComponentWithDependencies = async (component, destPath) => {
|
|
|
121
114
|
console.log(`\nFor documentation visit: ${CONFIG.docs}`);
|
|
122
115
|
};
|
|
123
116
|
|
|
124
|
-
const detectFramework = () => {
|
|
125
|
-
// Check for Next.js
|
|
126
|
-
if (
|
|
127
|
-
fs.existsSync(path.join(process.cwd(), "next.config.ts")) ||
|
|
128
|
-
fs.existsSync(path.join(process.cwd(), "next.config.js"))
|
|
129
|
-
) {
|
|
130
|
-
return "next";
|
|
131
|
-
}
|
|
132
|
-
// Check for Vite
|
|
133
|
-
if (
|
|
134
|
-
fs.existsSync(path.join(process.cwd(), "vite.config.js")) ||
|
|
135
|
-
fs.existsSync(path.join(process.cwd(), "vite.config.ts"))
|
|
136
|
-
) {
|
|
137
|
-
return "vite";
|
|
138
|
-
}
|
|
139
|
-
return null;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
117
|
const main = async () => {
|
|
143
118
|
const argv = yargs(hideBin(process.argv))
|
|
144
119
|
.option("add", {
|
|
@@ -146,11 +121,6 @@ const main = async () => {
|
|
|
146
121
|
describe: "Component to install",
|
|
147
122
|
type: "string",
|
|
148
123
|
})
|
|
149
|
-
.option("framework", {
|
|
150
|
-
alias: "f",
|
|
151
|
-
describe: "Framework to use (next or vite)",
|
|
152
|
-
type: "string",
|
|
153
|
-
})
|
|
154
124
|
.option("list", {
|
|
155
125
|
alias: "l",
|
|
156
126
|
describe: "List available components",
|
|
@@ -184,28 +154,8 @@ const main = async () => {
|
|
|
184
154
|
process.exit(1);
|
|
185
155
|
}
|
|
186
156
|
|
|
187
|
-
//
|
|
188
|
-
|
|
189
|
-
if (!framework) {
|
|
190
|
-
framework = detectFramework();
|
|
191
|
-
if (!framework) {
|
|
192
|
-
console.error(
|
|
193
|
-
"Could not detect framework. Please specify using -f or --framework"
|
|
194
|
-
);
|
|
195
|
-
process.exit(1);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (!CONFIG.frameworks[framework]) {
|
|
200
|
-
console.error(`Unsupported framework: ${framework}`);
|
|
201
|
-
process.exit(1);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Create destination directory
|
|
205
|
-
const destPath = path.join(
|
|
206
|
-
process.cwd(),
|
|
207
|
-
...CONFIG.frameworks[framework].path
|
|
208
|
-
);
|
|
157
|
+
// Create destination directory in project root
|
|
158
|
+
const destPath = DEFAULT_DEST_PATH;
|
|
209
159
|
await fs.ensureDir(destPath);
|
|
210
160
|
|
|
211
161
|
// Copy common files if they don't exist
|
package/package.json
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Grampro Business Services and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { useLocation } from "@grampro/headless-helpers";
|
|
10
|
+
import Icon from "../icon/Icon";
|
|
11
|
+
import { rightArrow } from "../icon/iconPaths";
|
|
12
|
+
import { BreadcrumbsProps } from "./types";
|
|
13
|
+
|
|
14
|
+
export const Breadcrumb = ({
|
|
15
|
+
showHome = true,
|
|
16
|
+
rootPath = "/",
|
|
17
|
+
homeLabel = "Home",
|
|
18
|
+
transformLabel,
|
|
19
|
+
className = "",
|
|
20
|
+
activeLinkClass = "font-medium text-gray-900 dark:text-white",
|
|
21
|
+
inactiveLinkClass = "text-gray-500 hover:text-gray-700",
|
|
22
|
+
}: BreadcrumbsProps) => {
|
|
23
|
+
const { pathSegments } = useLocation({
|
|
24
|
+
showHome,
|
|
25
|
+
rootPath,
|
|
26
|
+
homeLabel,
|
|
27
|
+
transformLabel,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (pathSegments.length === 0) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<nav aria-label="Breadcrumb" className={className}>
|
|
36
|
+
<ol className="flex flex-wrap items-center">
|
|
37
|
+
{pathSegments.map((segment, index) => {
|
|
38
|
+
const isLast = index === pathSegments.length - 1;
|
|
39
|
+
return (
|
|
40
|
+
<li key={index} className="flex items-center">
|
|
41
|
+
<>
|
|
42
|
+
<a
|
|
43
|
+
href={segment.path}
|
|
44
|
+
className={isLast ? activeLinkClass : inactiveLinkClass}
|
|
45
|
+
>
|
|
46
|
+
{segment.label}
|
|
47
|
+
</a>
|
|
48
|
+
<span className="mx-2 text-gray-400">
|
|
49
|
+
<Icon
|
|
50
|
+
elements={rightArrow}
|
|
51
|
+
dimensions={{ width: 14, height: 14 }}
|
|
52
|
+
svgClass={
|
|
53
|
+
"stroke-black fill-none dark:stroke-white cursor-pointer"
|
|
54
|
+
}
|
|
55
|
+
/>
|
|
56
|
+
</span>
|
|
57
|
+
</>
|
|
58
|
+
</li>
|
|
59
|
+
);
|
|
60
|
+
})}
|
|
61
|
+
</ol>
|
|
62
|
+
</nav>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type BreadcrumbsProps = {
|
|
2
|
+
homeLabel?: string;
|
|
3
|
+
showHome?: boolean;
|
|
4
|
+
transformLabel?: (segment: string) => string;
|
|
5
|
+
rootPath?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
separator?: string | React.ReactNode;
|
|
8
|
+
activeLinkClass?: string;
|
|
9
|
+
inactiveLinkClass?: string;
|
|
10
|
+
};
|