baaz-custom-components 3.2.0 → 3.2.2

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
@@ -20,7 +20,6 @@ interface UserData {
20
20
  role: string;
21
21
  email: string;
22
22
  phone: string;
23
- hubDetails: hubDetail[];
24
23
  currentHubId: number;
25
24
  }
26
25
  interface NotificationDataTypes {
@@ -41,10 +40,11 @@ interface NavbarProps {
41
40
  onLogout: () => void;
42
41
  notificationData: NotificationDataTypes[];
43
42
  router: RouterAdapter;
43
+ hubDetails: hubDetail[];
44
44
  hubIdChangeHandler: (value: string) => void;
45
45
  }
46
46
 
47
- declare function Navbar({ navbarData, userData, onLogout, notificationData, router, hubIdChangeHandler, }: NavbarProps): react.JSX.Element | null;
47
+ declare function Navbar({ navbarData, userData, onLogout, notificationData, router, hubDetails, hubIdChangeHandler, }: NavbarProps): react.JSX.Element | null;
48
48
 
49
49
  type BreadcrumbProps = {
50
50
  layoutName: string;
package/dist/index.d.ts CHANGED
@@ -20,7 +20,6 @@ interface UserData {
20
20
  role: string;
21
21
  email: string;
22
22
  phone: string;
23
- hubDetails: hubDetail[];
24
23
  currentHubId: number;
25
24
  }
26
25
  interface NotificationDataTypes {
@@ -41,10 +40,11 @@ interface NavbarProps {
41
40
  onLogout: () => void;
42
41
  notificationData: NotificationDataTypes[];
43
42
  router: RouterAdapter;
43
+ hubDetails: hubDetail[];
44
44
  hubIdChangeHandler: (value: string) => void;
45
45
  }
46
46
 
47
- declare function Navbar({ navbarData, userData, onLogout, notificationData, router, hubIdChangeHandler, }: NavbarProps): react.JSX.Element | null;
47
+ declare function Navbar({ navbarData, userData, onLogout, notificationData, router, hubDetails, hubIdChangeHandler, }: NavbarProps): react.JSX.Element | null;
48
48
 
49
49
  type BreadcrumbProps = {
50
50
  layoutName: string;
package/dist/index.js CHANGED
@@ -431,7 +431,8 @@ function SrpDropDown({
431
431
  hubIds,
432
432
  onChange
433
433
  }) {
434
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Select, { onValueChange: onChange, children: [
434
+ const defaultValue = (hubIds == null ? void 0 : hubIds.length) > 0 ? hubIds[0].toString() : void 0;
435
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Select, { onValueChange: onChange, defaultValue, children: [
435
436
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectTrigger, { className: "w-[100px] cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectValue, { placeholder: "Hub Id" }) }),
436
437
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectContent, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ScrollArea, { className: "h-40 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectGroup, { className: "cursor-pointer", children: hubIds == null ? void 0 : hubIds.map((hubId, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
437
438
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -452,22 +453,22 @@ var import_jsx_runtime7 = require("react/jsx-runtime");
452
453
  var User = ({
453
454
  userData,
454
455
  onLogout,
456
+ hubDetails,
455
457
  hubIdChangeHandler
456
458
  }) => {
457
- var _a, _b, _c, _d;
459
+ var _a, _b, _c;
458
460
  const safeUserData = userData || {
459
461
  name: "User",
460
462
  role: "User",
461
463
  email: "No email provided",
462
464
  phone: "No phone provided",
463
- hubDetails: [],
464
465
  currentHubId: 9
465
466
  };
466
467
  const [selectedHubId, setSelectedHubId] = (0, import_react.useState)(
467
468
  safeUserData.currentHubId
468
469
  );
469
- const hubIds = (_b = (_a = safeUserData.hubDetails) == null ? void 0 : _a.map((h) => h.id)) != null ? _b : [];
470
- const selectedZone = ((_c = safeUserData.hubDetails.find((hub) => hub.id === selectedHubId)) == null ? void 0 : _c.zone) || "No location provided";
470
+ const hubIds = (_a = hubDetails == null ? void 0 : hubDetails.map((h) => h.id)) != null ? _a : [];
471
+ const selectedZone = ((_b = hubDetails.find((hub) => hub.id === selectedHubId)) == null ? void 0 : _b.zone) || "No location provided";
471
472
  const handleLogout = (e) => {
472
473
  e.preventDefault();
473
474
  if (onLogout) {
@@ -498,11 +499,11 @@ var User = ({
498
499
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { className: "font-semibold", children: safeUserData.name }),
499
500
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { className: "text-primary text-sm", children: safeUserData.role }),
500
501
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Separator2, { className: "my-4" }),
501
- (_d = [
502
+ (_c = [
502
503
  { icon: import_lucide_react3.Mail, text: safeUserData.email },
503
504
  { icon: import_lucide_react3.Phone, text: safeUserData.phone },
504
505
  { icon: import_lucide_react3.MapPin, text: selectedZone }
505
- ]) == null ? void 0 : _d.map(({ icon: Icon2, text }, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
506
+ ]) == null ? void 0 : _c.map(({ icon: Icon2, text }, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
506
507
  "p",
507
508
  {
508
509
  className: "flex items-center gap-4 text-sm py-1",
@@ -852,6 +853,7 @@ function DesktopNavbar({
852
853
  onLogout,
853
854
  notificationData,
854
855
  router,
856
+ hubDetails,
855
857
  hubIdChangeHandler
856
858
  }) {
857
859
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("nav", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex justify-between px-10 py-2 bg-card items-center border-b-1", children: [
@@ -876,7 +878,7 @@ function DesktopNavbar({
876
878
  ] }),
877
879
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex gap-4 items-center", children: [
878
880
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(notifications_default, { notificationData }),
879
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(user_default2, { userData, onLogout, hubIdChangeHandler })
881
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(user_default2, { userData, onLogout, hubIdChangeHandler, hubDetails })
880
882
  ] })
881
883
  ] }) });
882
884
  }
@@ -1592,6 +1594,7 @@ function MobileNavbar({
1592
1594
  onLogout,
1593
1595
  notificationData,
1594
1596
  router,
1597
+ hubDetails,
1595
1598
  hubIdChangeHandler
1596
1599
  }) {
1597
1600
  var _a;
@@ -1610,7 +1613,7 @@ function MobileNavbar({
1610
1613
  ),
1611
1614
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-4 items-center", children: [
1612
1615
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(notifications_default, { notificationData }),
1613
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(user_default2, { userData, onLogout, hubIdChangeHandler })
1616
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(user_default2, { userData, onLogout, hubIdChangeHandler, hubDetails })
1614
1617
  ] })
1615
1618
  ] }),
1616
1619
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SidebarInset, { className: "pt-12", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AppSidebar, { data: safeData, router }) })
@@ -1625,6 +1628,7 @@ function Navbar({
1625
1628
  onLogout,
1626
1629
  notificationData,
1627
1630
  router,
1631
+ hubDetails,
1628
1632
  hubIdChangeHandler
1629
1633
  }) {
1630
1634
  const isMobile = useIsMobile();
@@ -1641,6 +1645,7 @@ function Navbar({
1641
1645
  onLogout,
1642
1646
  notificationData,
1643
1647
  router,
1648
+ hubDetails,
1644
1649
  hubIdChangeHandler
1645
1650
  }
1646
1651
  ) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
@@ -1651,6 +1656,7 @@ function Navbar({
1651
1656
  onLogout,
1652
1657
  notificationData,
1653
1658
  router,
1659
+ hubDetails,
1654
1660
  hubIdChangeHandler
1655
1661
  }
1656
1662
  ) });
package/dist/index.mjs CHANGED
@@ -397,7 +397,8 @@ function SrpDropDown({
397
397
  hubIds,
398
398
  onChange
399
399
  }) {
400
- return /* @__PURE__ */ jsxs4(Select, { onValueChange: onChange, children: [
400
+ const defaultValue = (hubIds == null ? void 0 : hubIds.length) > 0 ? hubIds[0].toString() : void 0;
401
+ return /* @__PURE__ */ jsxs4(Select, { onValueChange: onChange, defaultValue, children: [
401
402
  /* @__PURE__ */ jsx6(SelectTrigger, { className: "w-[100px] cursor-pointer", children: /* @__PURE__ */ jsx6(SelectValue, { placeholder: "Hub Id" }) }),
402
403
  /* @__PURE__ */ jsx6(SelectContent, { children: /* @__PURE__ */ jsx6(ScrollArea, { className: "h-40 w-full", children: /* @__PURE__ */ jsx6(SelectGroup, { className: "cursor-pointer", children: hubIds == null ? void 0 : hubIds.map((hubId, index) => /* @__PURE__ */ jsxs4("div", { children: [
403
404
  /* @__PURE__ */ jsx6(
@@ -418,22 +419,22 @@ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
418
419
  var User = ({
419
420
  userData,
420
421
  onLogout,
422
+ hubDetails,
421
423
  hubIdChangeHandler
422
424
  }) => {
423
- var _a, _b, _c, _d;
425
+ var _a, _b, _c;
424
426
  const safeUserData = userData || {
425
427
  name: "User",
426
428
  role: "User",
427
429
  email: "No email provided",
428
430
  phone: "No phone provided",
429
- hubDetails: [],
430
431
  currentHubId: 9
431
432
  };
432
433
  const [selectedHubId, setSelectedHubId] = useState2(
433
434
  safeUserData.currentHubId
434
435
  );
435
- const hubIds = (_b = (_a = safeUserData.hubDetails) == null ? void 0 : _a.map((h) => h.id)) != null ? _b : [];
436
- const selectedZone = ((_c = safeUserData.hubDetails.find((hub) => hub.id === selectedHubId)) == null ? void 0 : _c.zone) || "No location provided";
436
+ const hubIds = (_a = hubDetails == null ? void 0 : hubDetails.map((h) => h.id)) != null ? _a : [];
437
+ const selectedZone = ((_b = hubDetails.find((hub) => hub.id === selectedHubId)) == null ? void 0 : _b.zone) || "No location provided";
437
438
  const handleLogout = (e) => {
438
439
  e.preventDefault();
439
440
  if (onLogout) {
@@ -464,11 +465,11 @@ var User = ({
464
465
  /* @__PURE__ */ jsx7("h1", { className: "font-semibold", children: safeUserData.name }),
465
466
  /* @__PURE__ */ jsx7("h3", { className: "text-primary text-sm", children: safeUserData.role }),
466
467
  /* @__PURE__ */ jsx7(Separator2, { className: "my-4" }),
467
- (_d = [
468
+ (_c = [
468
469
  { icon: Mail, text: safeUserData.email },
469
470
  { icon: Phone, text: safeUserData.phone },
470
471
  { icon: MapPin, text: selectedZone }
471
- ]) == null ? void 0 : _d.map(({ icon: Icon2, text }, i) => /* @__PURE__ */ jsxs5(
472
+ ]) == null ? void 0 : _c.map(({ icon: Icon2, text }, i) => /* @__PURE__ */ jsxs5(
472
473
  "p",
473
474
  {
474
475
  className: "flex items-center gap-4 text-sm py-1",
@@ -818,6 +819,7 @@ function DesktopNavbar({
818
819
  onLogout,
819
820
  notificationData,
820
821
  router,
822
+ hubDetails,
821
823
  hubIdChangeHandler
822
824
  }) {
823
825
  return /* @__PURE__ */ jsx11("nav", { children: /* @__PURE__ */ jsxs9("div", { className: "flex justify-between px-10 py-2 bg-card items-center border-b-1", children: [
@@ -842,7 +844,7 @@ function DesktopNavbar({
842
844
  ] }),
843
845
  /* @__PURE__ */ jsxs9("div", { className: "flex gap-4 items-center", children: [
844
846
  /* @__PURE__ */ jsx11(notifications_default, { notificationData }),
845
- /* @__PURE__ */ jsx11(user_default2, { userData, onLogout, hubIdChangeHandler })
847
+ /* @__PURE__ */ jsx11(user_default2, { userData, onLogout, hubIdChangeHandler, hubDetails })
846
848
  ] })
847
849
  ] }) });
848
850
  }
@@ -1558,6 +1560,7 @@ function MobileNavbar({
1558
1560
  onLogout,
1559
1561
  notificationData,
1560
1562
  router,
1563
+ hubDetails,
1561
1564
  hubIdChangeHandler
1562
1565
  }) {
1563
1566
  var _a;
@@ -1576,7 +1579,7 @@ function MobileNavbar({
1576
1579
  ),
1577
1580
  /* @__PURE__ */ jsxs14("div", { className: "flex gap-4 items-center", children: [
1578
1581
  /* @__PURE__ */ jsx18(notifications_default, { notificationData }),
1579
- /* @__PURE__ */ jsx18(user_default2, { userData, onLogout, hubIdChangeHandler })
1582
+ /* @__PURE__ */ jsx18(user_default2, { userData, onLogout, hubIdChangeHandler, hubDetails })
1580
1583
  ] })
1581
1584
  ] }),
1582
1585
  /* @__PURE__ */ jsx18(SidebarInset, { className: "pt-12", children: /* @__PURE__ */ jsx18(AppSidebar, { data: safeData, router }) })
@@ -1591,6 +1594,7 @@ function Navbar({
1591
1594
  onLogout,
1592
1595
  notificationData,
1593
1596
  router,
1597
+ hubDetails,
1594
1598
  hubIdChangeHandler
1595
1599
  }) {
1596
1600
  const isMobile = useIsMobile();
@@ -1607,6 +1611,7 @@ function Navbar({
1607
1611
  onLogout,
1608
1612
  notificationData,
1609
1613
  router,
1614
+ hubDetails,
1610
1615
  hubIdChangeHandler
1611
1616
  }
1612
1617
  ) : /* @__PURE__ */ jsx19(
@@ -1617,6 +1622,7 @@ function Navbar({
1617
1622
  onLogout,
1618
1623
  notificationData,
1619
1624
  router,
1625
+ hubDetails,
1620
1626
  hubIdChangeHandler
1621
1627
  }
1622
1628
  ) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baaz-custom-components",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.js",