gov-layout 1.3.0 → 1.3.1

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 CHANGED
@@ -222,7 +222,6 @@ const menuItems: MenuItem[] = [
222
222
  - ✅ Default ตั้งค่าระบบ + ช่วยเหลือ (override ได้)
223
223
  - ✅ โปรไฟล์ + ออกจากระบบ ล่างสุดเสมอ
224
224
  - ✅ `dividerAfter` เส้นคั่นระหว่างกลุ่ม
225
- - ✅ แสดง Avatar Icon อัตโนมัติกรณีผู้ใช้ไม่มีรูปโปรไฟล์ (v1.2.28+) 🆕
226
225
 
227
226
  ---
228
227
 
package/dist/index.js CHANGED
@@ -625,18 +625,6 @@ function ProfileIcon() {
625
625
  }
626
626
  );
627
627
  }
628
- function AvatarIcon({ size = 20 }) {
629
- return /* @__PURE__ */ jsxRuntime.jsx(
630
- "svg",
631
- {
632
- width: size,
633
- height: size,
634
- viewBox: "0 0 24 24",
635
- fill: "currentColor",
636
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" })
637
- }
638
- );
639
- }
640
628
  function SidebarUserProfile({
641
629
  user,
642
630
  roleLabel,
@@ -652,6 +640,9 @@ function SidebarUserProfile({
652
640
  }
653
641
  return user.firstName || user.lastName || "\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49";
654
642
  };
643
+ const getInitial = () => {
644
+ return user.firstName?.charAt(0) || user.lastName?.charAt(0) || "?";
645
+ };
655
646
  if (collapsed) {
656
647
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
657
648
  padding: "12px 8px",
@@ -694,7 +685,7 @@ function SidebarUserProfile({
694
685
  fontWeight: 700,
695
686
  fontSize: "14px"
696
687
  },
697
- children: /* @__PURE__ */ jsxRuntime.jsx(AvatarIcon, { size: 20 })
688
+ children: getInitial()
698
689
  }
699
690
  )
700
691
  }
@@ -815,7 +806,7 @@ function SidebarUserProfile({
815
806
  fontSize: "16px",
816
807
  flexShrink: 0
817
808
  },
818
- children: /* @__PURE__ */ jsxRuntime.jsx(AvatarIcon, { size: 24 })
809
+ children: getInitial()
819
810
  }
820
811
  ),
821
812
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
@@ -1109,9 +1100,6 @@ function HamburgerIcon() {
1109
1100
  function MessageOutlinedIcon(props) {
1110
1101
  return /* @__PURE__ */ jsxRuntime.jsx("svg", { focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", fill: "currentColor", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 4h16v12H5.17L4 17.17zm0-2c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm2 10h12v2H6zm0-3h12v2H6zm0-3h12v2H6z" }) });
1111
1102
  }
1112
- function AvatarIcon2({ size = 20 }) {
1113
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" }) });
1114
- }
1115
1103
  function getNotifBg(type) {
1116
1104
  const map = {
1117
1105
  success: "#dcfce7",
@@ -1143,7 +1131,7 @@ function UserHeader({
1143
1131
  className
1144
1132
  }) {
1145
1133
  const displayName = `${user?.firstName || ""} ${user?.lastName || ""}`.trim() || "\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49";
1146
- user?.firstName?.charAt(0) || "\u0E1C";
1134
+ const firstChar = user?.firstName?.charAt(0) || "\u0E1C";
1147
1135
  const [isNotifOpen, setIsNotifOpen] = react.useState(false);
1148
1136
  const [activeFilter, setActiveFilter] = react.useState("all");
1149
1137
  const notifRef = react.useRef(null);
@@ -1237,7 +1225,13 @@ function UserHeader({
1237
1225
  justifyContent: "center",
1238
1226
  boxShadow: "0 1px 3px rgba(0,0,0,0.1)"
1239
1227
  },
1240
- children: /* @__PURE__ */ jsxRuntime.jsx(AvatarIcon2, { size: 24 })
1228
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1229
+ "span",
1230
+ {
1231
+ style: { color: "#fff", fontSize: "18px", fontWeight: 600 },
1232
+ children: firstChar
1233
+ }
1234
+ )
1241
1235
  }
1242
1236
  ),
1243
1237
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
@@ -1631,9 +1625,6 @@ function ProfileIcon2() {
1631
1625
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "7", r: "4" })
1632
1626
  ] });
1633
1627
  }
1634
- function AvatarIcon3({ size = 20 }) {
1635
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" }) });
1636
- }
1637
1628
  function UserSidebar({
1638
1629
  user,
1639
1630
  roleLabel,
@@ -1661,6 +1652,10 @@ function UserSidebar({
1661
1652
  if (user.firstName && user.lastName) return `${user.firstName} ${user.lastName}`;
1662
1653
  return user.firstName || user.lastName || "\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49";
1663
1654
  };
1655
+ const getInitial = () => {
1656
+ if (!user) return "?";
1657
+ return user.firstName?.charAt(0) || user.lastName?.charAt(0) || "?";
1658
+ };
1664
1659
  const handleMenuClick = (path) => {
1665
1660
  onNavigate(path);
1666
1661
  onClose();
@@ -1749,7 +1744,7 @@ function UserSidebar({
1749
1744
  fontSize: "20px",
1750
1745
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
1751
1746
  },
1752
- children: /* @__PURE__ */ jsxRuntime.jsx(AvatarIcon3, { size: 32 })
1747
+ children: getInitial()
1753
1748
  }
1754
1749
  ),
1755
1750
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [