@eintrek/erp-shell 0.1.39 → 0.1.40

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.esm.js CHANGED
@@ -764,13 +764,27 @@ function AppBreadcrumb({ labels = {}, homeLabel = "แดชบอร์ด", ro
764
764
  if (segments.length === 0) {
765
765
  return jsx("h1", { className: "text-xl font-semibold", children: homeLabel });
766
766
  }
767
- return (jsx(Breadcrumb, { children: jsxs(BreadcrumbList, { children: [jsx(BreadcrumbItem, { className: "hidden md:block", children: jsx(BreadcrumbLink, { asChild: true, children: jsx(Link, { href: "/", className: "font-thai text-[14px] font-normal text-white/80 hover:text-white transition-colors", children: rootLabel }) }) }), segments.map((segment, index) => {
767
+ return (jsx(Breadcrumb, { children: jsxs(BreadcrumbList, { children: [jsx(BreadcrumbItem, { children: jsx(BreadcrumbLink, { asChild: true, children: jsx(Link, { href: "/", className: "font-thai text-[14px] font-normal text-white/80 hover:text-white transition-colors", children: rootLabel }) }) }), segments.map((segment, index) => {
768
768
  const href = "/" + segments.slice(0, index + 1).join("/");
769
769
  const isLast = index === segments.length - 1;
770
- const label = labels[segment] || segment;
771
- return (jsxs(Fragment, { children: [jsx(BreadcrumbSeparator, { className: "hidden md:block text-white/80", children: jsx(ChevronRight, { strokeWidth: 2, className: "h-4 w-4" }) }), jsx(BreadcrumbItem, { children: isLast ? (jsx(BreadcrumbPage, { className: "font-thai text-[14px] font-normal text-white/95 leading-none", children: decodeURIComponent(label) })) : (jsx(BreadcrumbLink, { asChild: true, children: jsx(Link, { href: href, className: "font-thai text-[14px] font-normal text-white/80 hover:text-white transition-colors leading-none", children: decodeURIComponent(label) }) })) })] }, `${segment}-${index}`));
770
+ // A record id is not a place. Falling back to the raw segment put a
771
+ // 36-character uuid in the trail, which pushed everything before it
772
+ // off a phone and told the reader nothing they could use.
773
+ const label = labels[segment] ?? (isRecordID(segment) ? "รายละเอียด" : segment);
774
+ return (jsxs(Fragment, { children: [jsx(BreadcrumbSeparator, { className: "text-white/80", children: jsx(ChevronRight, { strokeWidth: 2, className: "h-4 w-4" }) }), jsx(BreadcrumbItem, { children: isLast ? (jsx(BreadcrumbPage, { className: "font-thai text-[14px] font-normal text-white/95 leading-none", children: decodeURIComponent(label) })) : (jsx(BreadcrumbLink, { asChild: true, children: jsx(Link, { href: href, className: "font-thai text-[14px] font-normal text-white/80 hover:text-white transition-colors leading-none", children: decodeURIComponent(label) }) })) })] }, `${segment}-${index}`));
772
775
  })] }) }));
773
776
  }
777
+ /**
778
+ * Whether a path segment is a record identifier rather than a page.
779
+ *
780
+ * Covers the uuid the APIs issue and the long opaque ids that show up in
781
+ * document routes. Deliberately narrow: a real page called "settings" must
782
+ * never be mistaken for one of these.
783
+ */
784
+ function isRecordID(segment) {
785
+ return (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(segment) ||
786
+ /^[0-9a-f]{24,}$/i.test(segment));
787
+ }
774
788
 
775
789
  function isExternalHref(href) {
776
790
  return /^https?:\/\//i.test(href) || href.startsWith("//");