baaz-custom-components 3.1.17 → 3.1.18

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/dist/index.d.mts CHANGED
@@ -42,6 +42,9 @@ type BreadcrumbProps = {
42
42
  layoutName: string;
43
43
  className?: string;
44
44
  includeFrom?: number;
45
+ pathname?: string;
45
46
  };
46
47
 
47
- export { type BreadcrumbProps, Navbar, type NavbarData, type NavbarEntry, type NavbarProps, type NotificationDataTypes, type RouteTree, type RouterAdapter, type UserData };
48
+ declare const CustomBreadcrumb: ({ layoutName, includeFrom, pathname, }: BreadcrumbProps) => react.JSX.Element;
49
+
50
+ export { type BreadcrumbProps, CustomBreadcrumb, Navbar, type NavbarData, type NavbarEntry, type NavbarProps, type NotificationDataTypes, type RouteTree, type RouterAdapter, type UserData };
package/dist/index.d.ts CHANGED
@@ -42,6 +42,9 @@ type BreadcrumbProps = {
42
42
  layoutName: string;
43
43
  className?: string;
44
44
  includeFrom?: number;
45
+ pathname?: string;
45
46
  };
46
47
 
47
- export { type BreadcrumbProps, Navbar, type NavbarData, type NavbarEntry, type NavbarProps, type NotificationDataTypes, type RouteTree, type RouterAdapter, type UserData };
48
+ declare const CustomBreadcrumb: ({ layoutName, includeFrom, pathname, }: BreadcrumbProps) => react.JSX.Element;
49
+
50
+ export { type BreadcrumbProps, CustomBreadcrumb, Navbar, type NavbarData, type NavbarEntry, type NavbarProps, type NotificationDataTypes, type RouteTree, type RouterAdapter, type UserData };
package/dist/index.js CHANGED
@@ -59,6 +59,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
59
59
  // src/components/index.ts
60
60
  var index_exports = {};
61
61
  __export(index_exports, {
62
+ CustomBreadcrumb: () => breadcrumb_default,
62
63
  Navbar: () => Navbar
63
64
  });
64
65
  module.exports = __toCommonJS(index_exports);
@@ -422,6 +423,12 @@ function MenubarSubContent(_a) {
422
423
  var import_lucide_react4 = require("lucide-react");
423
424
 
424
425
  // src/utils/helper.ts
426
+ var buildUrl = (urls, index) => {
427
+ return `/${urls.slice(0, index + 1).join("/")}`;
428
+ };
429
+ var capitalizeFirstLetter = (text, splitter = "-") => {
430
+ return text.split(splitter).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
431
+ };
425
432
  var formatDateAndTime = (time) => {
426
433
  return `${new Date(time).toDateString()} . ${new Date(time).toTimeString().split(" ")[0]}`;
427
434
  };
@@ -1388,7 +1395,114 @@ function Navbar({
1388
1395
  }
1389
1396
  ) });
1390
1397
  }
1398
+
1399
+ // src/components/custom/breadcrumb/index.tsx
1400
+ var import_lucide_react10 = require("lucide-react");
1401
+
1402
+ // src/components/ui/breadcrumb.tsx
1403
+ var import_react_slot3 = require("@radix-ui/react-slot");
1404
+ var import_lucide_react9 = require("lucide-react");
1405
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1406
+ function Breadcrumb(_a) {
1407
+ var props = __objRest(_a, []);
1408
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("nav", __spreadValues({ "aria-label": "breadcrumb", "data-slot": "breadcrumb" }, props));
1409
+ }
1410
+ function BreadcrumbList(_a) {
1411
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1412
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1413
+ "ol",
1414
+ __spreadValues({
1415
+ "data-slot": "breadcrumb-list",
1416
+ className: cn(
1417
+ "text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
1418
+ className
1419
+ )
1420
+ }, props)
1421
+ );
1422
+ }
1423
+ function BreadcrumbItem(_a) {
1424
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1425
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1426
+ "li",
1427
+ __spreadValues({
1428
+ "data-slot": "breadcrumb-item",
1429
+ className: cn("inline-flex items-center gap-1.5", className)
1430
+ }, props)
1431
+ );
1432
+ }
1433
+ function BreadcrumbLink(_a) {
1434
+ var _b = _a, {
1435
+ asChild,
1436
+ className
1437
+ } = _b, props = __objRest(_b, [
1438
+ "asChild",
1439
+ "className"
1440
+ ]);
1441
+ const Comp = asChild ? import_react_slot3.Slot : "a";
1442
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1443
+ Comp,
1444
+ __spreadValues({
1445
+ "data-slot": "breadcrumb-link",
1446
+ className: cn("hover:text-foreground transition-colors", className)
1447
+ }, props)
1448
+ );
1449
+ }
1450
+ function BreadcrumbSeparator(_a) {
1451
+ var _b = _a, {
1452
+ children,
1453
+ className
1454
+ } = _b, props = __objRest(_b, [
1455
+ "children",
1456
+ "className"
1457
+ ]);
1458
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1459
+ "li",
1460
+ __spreadProps(__spreadValues({
1461
+ "data-slot": "breadcrumb-separator",
1462
+ role: "presentation",
1463
+ "aria-hidden": "true",
1464
+ className: cn("[&>svg]:size-3.5", className)
1465
+ }, props), {
1466
+ children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react9.ChevronRight, {})
1467
+ })
1468
+ );
1469
+ }
1470
+
1471
+ // src/components/custom/breadcrumb/index.tsx
1472
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1473
+ var CustomBreadcrumb = ({
1474
+ layoutName,
1475
+ includeFrom = 0,
1476
+ pathname = ""
1477
+ }) => {
1478
+ const completeUrl = pathname.split("/").filter(Boolean);
1479
+ const urls = pathname.split("/").filter(Boolean).slice(includeFrom);
1480
+ const activeClassName = "text-primary";
1481
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Breadcrumb, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(BreadcrumbList, { children: [
1482
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BreadcrumbItem, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { className: "text-base", children: capitalizeFirstLetter(layoutName) }) }),
1483
+ urls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BreadcrumbSeparator, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Slash, { className: "!h-md !w-md" }) }),
1484
+ urls.map((url, index) => {
1485
+ const href = buildUrl(
1486
+ completeUrl,
1487
+ index + includeFrom
1488
+ );
1489
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(BreadcrumbItem, { children: [
1490
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1491
+ BreadcrumbLink,
1492
+ {
1493
+ href,
1494
+ className: `!font-light !text-md !text-off-white ${index >= urls.length - 1 && activeClassName}`,
1495
+ children: capitalizeFirstLetter(url)
1496
+ }
1497
+ ),
1498
+ index < urls.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BreadcrumbSeparator, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react10.Slash, { className: "!h-md !w-md" }) })
1499
+ ] }, index);
1500
+ })
1501
+ ] }) });
1502
+ };
1503
+ var breadcrumb_default = CustomBreadcrumb;
1391
1504
  // Annotate the CommonJS export names for ESM import in node:
1392
1505
  0 && (module.exports = {
1506
+ CustomBreadcrumb,
1393
1507
  Navbar
1394
1508
  });
package/dist/index.mjs CHANGED
@@ -389,6 +389,12 @@ function MenubarSubContent(_a) {
389
389
  import { ChevronDown, ChevronUp } from "lucide-react";
390
390
 
391
391
  // src/utils/helper.ts
392
+ var buildUrl = (urls, index) => {
393
+ return `/${urls.slice(0, index + 1).join("/")}`;
394
+ };
395
+ var capitalizeFirstLetter = (text, splitter = "-") => {
396
+ return text.split(splitter).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
397
+ };
392
398
  var formatDateAndTime = (time) => {
393
399
  return `${new Date(time).toDateString()} . ${new Date(time).toTimeString().split(" ")[0]}`;
394
400
  };
@@ -1355,6 +1361,113 @@ function Navbar({
1355
1361
  }
1356
1362
  ) });
1357
1363
  }
1364
+
1365
+ // src/components/custom/breadcrumb/index.tsx
1366
+ import { Slash } from "lucide-react";
1367
+
1368
+ // src/components/ui/breadcrumb.tsx
1369
+ import { Slot as Slot3 } from "@radix-ui/react-slot";
1370
+ import { ChevronRight as ChevronRight2, MoreHorizontal } from "lucide-react";
1371
+ import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
1372
+ function Breadcrumb(_a) {
1373
+ var props = __objRest(_a, []);
1374
+ return /* @__PURE__ */ jsx18("nav", __spreadValues({ "aria-label": "breadcrumb", "data-slot": "breadcrumb" }, props));
1375
+ }
1376
+ function BreadcrumbList(_a) {
1377
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1378
+ return /* @__PURE__ */ jsx18(
1379
+ "ol",
1380
+ __spreadValues({
1381
+ "data-slot": "breadcrumb-list",
1382
+ className: cn(
1383
+ "text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
1384
+ className
1385
+ )
1386
+ }, props)
1387
+ );
1388
+ }
1389
+ function BreadcrumbItem(_a) {
1390
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1391
+ return /* @__PURE__ */ jsx18(
1392
+ "li",
1393
+ __spreadValues({
1394
+ "data-slot": "breadcrumb-item",
1395
+ className: cn("inline-flex items-center gap-1.5", className)
1396
+ }, props)
1397
+ );
1398
+ }
1399
+ function BreadcrumbLink(_a) {
1400
+ var _b = _a, {
1401
+ asChild,
1402
+ className
1403
+ } = _b, props = __objRest(_b, [
1404
+ "asChild",
1405
+ "className"
1406
+ ]);
1407
+ const Comp = asChild ? Slot3 : "a";
1408
+ return /* @__PURE__ */ jsx18(
1409
+ Comp,
1410
+ __spreadValues({
1411
+ "data-slot": "breadcrumb-link",
1412
+ className: cn("hover:text-foreground transition-colors", className)
1413
+ }, props)
1414
+ );
1415
+ }
1416
+ function BreadcrumbSeparator(_a) {
1417
+ var _b = _a, {
1418
+ children,
1419
+ className
1420
+ } = _b, props = __objRest(_b, [
1421
+ "children",
1422
+ "className"
1423
+ ]);
1424
+ return /* @__PURE__ */ jsx18(
1425
+ "li",
1426
+ __spreadProps(__spreadValues({
1427
+ "data-slot": "breadcrumb-separator",
1428
+ role: "presentation",
1429
+ "aria-hidden": "true",
1430
+ className: cn("[&>svg]:size-3.5", className)
1431
+ }, props), {
1432
+ children: children != null ? children : /* @__PURE__ */ jsx18(ChevronRight2, {})
1433
+ })
1434
+ );
1435
+ }
1436
+
1437
+ // src/components/custom/breadcrumb/index.tsx
1438
+ import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
1439
+ var CustomBreadcrumb = ({
1440
+ layoutName,
1441
+ includeFrom = 0,
1442
+ pathname = ""
1443
+ }) => {
1444
+ const completeUrl = pathname.split("/").filter(Boolean);
1445
+ const urls = pathname.split("/").filter(Boolean).slice(includeFrom);
1446
+ const activeClassName = "text-primary";
1447
+ return /* @__PURE__ */ jsx19(Breadcrumb, { children: /* @__PURE__ */ jsxs14(BreadcrumbList, { children: [
1448
+ /* @__PURE__ */ jsx19(BreadcrumbItem, { children: /* @__PURE__ */ jsx19("h2", { className: "text-base", children: capitalizeFirstLetter(layoutName) }) }),
1449
+ urls.length > 0 && /* @__PURE__ */ jsx19(BreadcrumbSeparator, { children: /* @__PURE__ */ jsx19(Slash, { className: "!h-md !w-md" }) }),
1450
+ urls.map((url, index) => {
1451
+ const href = buildUrl(
1452
+ completeUrl,
1453
+ index + includeFrom
1454
+ );
1455
+ return /* @__PURE__ */ jsxs14(BreadcrumbItem, { children: [
1456
+ /* @__PURE__ */ jsx19(
1457
+ BreadcrumbLink,
1458
+ {
1459
+ href,
1460
+ className: `!font-light !text-md !text-off-white ${index >= urls.length - 1 && activeClassName}`,
1461
+ children: capitalizeFirstLetter(url)
1462
+ }
1463
+ ),
1464
+ index < urls.length - 1 && /* @__PURE__ */ jsx19(BreadcrumbSeparator, { children: /* @__PURE__ */ jsx19(Slash, { className: "!h-md !w-md" }) })
1465
+ ] }, index);
1466
+ })
1467
+ ] }) });
1468
+ };
1469
+ var breadcrumb_default = CustomBreadcrumb;
1358
1470
  export {
1471
+ breadcrumb_default as CustomBreadcrumb,
1359
1472
  Navbar
1360
1473
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baaz-custom-components",
3
- "version": "3.1.17",
3
+ "version": "3.1.18",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.js",