@sarunyu/system-one 4.9.28 → 4.9.31

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.js CHANGED
@@ -1565,21 +1565,37 @@ function Header({
1565
1565
  rightIcon,
1566
1566
  onActionClick
1567
1567
  }) {
1568
- return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3", rightSide === "action" ? "pr-2" : void 0), children: [
1569
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
1570
- /* @__PURE__ */ jsx(Leading, { headerType, imageSrc, leftIcon }),
1571
- /* @__PURE__ */ jsx("p", { className: "truncate text-base leading-6 font-bold text-foreground", children: title })
1572
- ] }),
1573
- /* @__PURE__ */ jsx(
1574
- Trailing,
1575
- {
1576
- rightSide,
1577
- actionLabel,
1578
- rightIcon,
1579
- onActionClick
1580
- }
1581
- )
1582
- ] });
1568
+ return /* @__PURE__ */ jsxs(
1569
+ "div",
1570
+ {
1571
+ className: cn(
1572
+ "flex items-center gap-3",
1573
+ rightSide === "action" ? "pr-2" : void 0
1574
+ ),
1575
+ children: [
1576
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
1577
+ /* @__PURE__ */ jsx(
1578
+ Leading,
1579
+ {
1580
+ headerType,
1581
+ imageSrc,
1582
+ leftIcon
1583
+ }
1584
+ ),
1585
+ /* @__PURE__ */ jsx("p", { className: "truncate text-base leading-6 font-bold text-foreground", children: title })
1586
+ ] }),
1587
+ /* @__PURE__ */ jsx(
1588
+ Trailing,
1589
+ {
1590
+ rightSide,
1591
+ actionLabel,
1592
+ rightIcon,
1593
+ onActionClick
1594
+ }
1595
+ )
1596
+ ]
1597
+ }
1598
+ );
1583
1599
  }
1584
1600
  function Leading({
1585
1601
  headerType,
@@ -1587,7 +1603,14 @@ function Leading({
1587
1603
  leftIcon
1588
1604
  }) {
1589
1605
  if (headerType === "image") {
1590
- return imageSrc ? /* @__PURE__ */ jsx("img", { alt: "", className: "size-8 shrink-0 rounded-md object-cover", src: imageSrc }) : /* @__PURE__ */ jsx("div", { className: "size-8 shrink-0 rounded-md bg-muted" });
1606
+ return imageSrc ? /* @__PURE__ */ jsx(
1607
+ "img",
1608
+ {
1609
+ alt: "",
1610
+ className: "size-8 shrink-0 rounded-md object-cover",
1611
+ src: imageSrc
1612
+ }
1613
+ ) : /* @__PURE__ */ jsx("div", { className: "size-8 shrink-0 rounded-md bg-muted" });
1591
1614
  }
1592
1615
  if (headerType === "icon") {
1593
1616
  return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-foreground", children: leftIcon ?? /* @__PURE__ */ jsx(Circle, { size: 22 }) });
@@ -1604,7 +1627,7 @@ function Trailing({
1604
1627
  return /* @__PURE__ */ jsx(
1605
1628
  Button,
1606
1629
  {
1607
- className: "px-0 py-0 text-base leading-6 font-bold",
1630
+ className: "text-base leading-6 font-bold",
1608
1631
  onClick: onActionClick,
1609
1632
  size: "md",
1610
1633
  variant: "plain",
@@ -5947,6 +5970,157 @@ const TimeInput = forwardRef(
5947
5970
  }
5948
5971
  );
5949
5972
  TimeInput.displayName = "TimeInput";
5973
+ const avatarPlaceholder = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAACYhJREFUeAHVW+tSW9cV/vY+uhyJm7gjGcUitpPJ9EftJzA/6xBPQ+P+Nn4C6BMUnqDmCYxfILjTZtx/pf87YzxJajeJjTAgBQJB5qbbOWdnrS1MAAujc5FMPo2QBh3ts9dlr/2ttbYEmoxcLndZCDGqlLquIDMKTgZCJKCQOXGhQBZKFQRkFkItwnEW6XuLqVRqGU2EQBOQz+dvksCfO0J8/pagrqG0IiQwl0wm/4OAEZgClpaWEhHTnFTAhH+h64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B/gSXEdoETW/YmE3tr6GaVKWU/YEDLwNpleCGR9VmaUPKO3pwt93d3o7OxCtdJ4cfT0mcITX2vkSIw8LEFsUy9w46dNrG9uIsJH3lpcFmMDcD7QQwoYGuxHNymDd5fz2uanj9GdUMC7vIAH5iZEab+ElfwaNrcLui4nW9QQPQtK02JBTLEDqaEh9BJdrtpW3Z1D1DlR+tZVVCufdCCOzgaxQjlKV+0KtdA2kKWubJRJjXi/gtcDt+gG+vuRTqXQRimzpU6dM3TsidPniutKsZrP/5tPVPB7ZnRlWmN87qdI+zg1FnGRwUlTOBLGJ9euoqOznSpVtaLp8ch/HHWlqZZK9yi8FiTxeWZw/33ylIoe5QsvPIPnyARq8Ztv8ez/PxwuUVFg1697fb1/joyMZENhOb2+sUH8YJ2KEOJ9dL98gXco3pmyr1Zp+VanzzpJfqZJhwYGZl8uZ++HtNUv3npvBBy08/n1mZF0evasa86VbP6rrx4oJSfwGwTRpId3Pvt04l3XNGTaL//5rydeO8jvC7Rkn35x+9a5c24oqv3psz/cEMKZw28EbPlGhGc0HNbHx8buKeHt4HQr4Qg1e57bH4erfe2LsVsz5AlTQVWSg4UoUIY5dWfsU1dpvafwPj8/n3FC5oLXg1VNwEJUOBNjY2PLbr/oa3/78vHju8rCzPtTBFvdnr5ze2wWHuF7g9feEDHvUuS51zpFiALVAe7LSml2fHzc13IMjOGwIpRp3mymR+hfjFLhJgjBj40ZPOb/8XgU0rmrFB+/88cfWGhI9ciy7b//+fbtBQSMpnNc9gw7Gr1uKP7VmbpOrJJq8SqhTtUf9c9gOWkR1KoTZGklnsoKFsbHb2XRRPwCfO0pk0kAcsMAAAAASUVORK5CYII=";
5974
+ const TEXT_GRADIENT = "linear-gradient(to top right, #B5D3F8, #E6F6FB)";
5975
+ const TEXT_COLOR = "#00A2D9";
5976
+ const SIZE_CONFIG = {
5977
+ xxs: { container: "size-4", fontSize: "text-[11px]", dotSize: "size-[5px]", dotRing: "ring-[1.5px]" },
5978
+ xs: { container: "size-5", fontSize: "text-sm", dotSize: "size-[5px]", dotRing: "ring-[1.5px]" },
5979
+ s: { container: "size-6", fontSize: "text-base", dotSize: "size-[6px]", dotRing: "ring-[1.5px]" },
5980
+ m: { container: "size-8", fontSize: "text-xl", dotSize: "size-[7px]", dotRing: "ring-2" },
5981
+ l: { container: "size-10", fontSize: "text-[26px]", dotSize: "size-[9px]", dotRing: "ring-2" },
5982
+ xl: { container: "size-12", fontSize: "text-[32px]", dotSize: "size-[11px]", dotRing: "ring-2" },
5983
+ xxl: { container: "size-13", fontSize: "text-[37px]", dotSize: "size-[13px]", dotRing: "ring-2" }
5984
+ };
5985
+ function Avatar({
5986
+ type = "photo",
5987
+ size = "m",
5988
+ status = false,
5989
+ src,
5990
+ alt = "",
5991
+ initials,
5992
+ className
5993
+ }) {
5994
+ const { container, fontSize, dotSize, dotRing } = SIZE_CONFIG[size];
5995
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative inline-flex shrink-0", container, className), children: [
5996
+ type === "photo" && /* @__PURE__ */ jsx(
5997
+ "img",
5998
+ {
5999
+ src,
6000
+ alt,
6001
+ className: "size-full rounded-full object-cover bg-bg-default-tertiary"
6002
+ }
6003
+ ),
6004
+ type === "placeholder" && /* @__PURE__ */ jsx(
6005
+ "img",
6006
+ {
6007
+ src: avatarPlaceholder,
6008
+ alt: "",
6009
+ className: "size-full rounded-full object-cover",
6010
+ "aria-hidden": "true"
6011
+ }
6012
+ ),
6013
+ type === "text" && /* @__PURE__ */ jsx(
6014
+ "div",
6015
+ {
6016
+ className: "relative size-full rounded-full overflow-hidden",
6017
+ style: { background: TEXT_GRADIENT },
6018
+ children: /* @__PURE__ */ jsx(
6019
+ "span",
6020
+ {
6021
+ className: cn(
6022
+ "absolute left-1/2 top-1/2 font-bold leading-none select-none whitespace-nowrap",
6023
+ fontSize
6024
+ ),
6025
+ style: {
6026
+ color: TEXT_COLOR,
6027
+ transform: "translate(-50%, calc(-50% + 0.07em))"
6028
+ },
6029
+ children: (initials ?? "").slice(0, 2).toUpperCase()
6030
+ }
6031
+ )
6032
+ }
6033
+ ),
6034
+ status && type === "photo" && /* @__PURE__ */ jsx(
6035
+ "span",
6036
+ {
6037
+ "aria-label": "Online",
6038
+ className: cn(
6039
+ "absolute bottom-0 right-0 block rounded-full bg-bg-success",
6040
+ dotSize,
6041
+ dotRing,
6042
+ "ring-white"
6043
+ )
6044
+ }
6045
+ )
6046
+ ] });
6047
+ }
6048
+ const STACK_CONFIG = {
6049
+ small: { avatarSize: "xxs", avatarPx: 16, overlapPx: 4 },
6050
+ medium: { avatarSize: "xs", avatarPx: 20, overlapPx: 5 },
6051
+ large: { avatarSize: "s", avatarPx: 24, overlapPx: 5 }
6052
+ };
6053
+ function subtractMask(avatarPx, overlapPx) {
6054
+ const r = avatarPx / 2;
6055
+ const spacingPx = avatarPx - overlapPx;
6056
+ const biteX = spacingPx + r;
6057
+ const biteY = r;
6058
+ const biteR = r + 1;
6059
+ const self = `radial-gradient(circle at ${r}px ${r}px, white ${r}px, transparent ${r}px)`;
6060
+ const bite = `radial-gradient(circle at ${biteX}px ${biteY}px, white ${biteR}px, transparent ${biteR}px)`;
6061
+ return {
6062
+ maskImage: `${self}, ${bite}`,
6063
+ maskComposite: "subtract",
6064
+ WebkitMaskImage: `${bite}, ${self}`,
6065
+ WebkitMaskComposite: "destination-out"
6066
+ };
6067
+ }
6068
+ function AvatarStack({
6069
+ items,
6070
+ size = "small",
6071
+ max = 5,
6072
+ className
6073
+ }) {
6074
+ const { avatarSize, avatarPx, overlapPx } = STACK_CONFIG[size];
6075
+ const visible = items.slice(0, max);
6076
+ return /* @__PURE__ */ jsx("div", { className: cn("flex shrink-0", className), children: visible.map((item, i) => {
6077
+ const isLast = i === visible.length - 1;
6078
+ return /* @__PURE__ */ jsx(
6079
+ "div",
6080
+ {
6081
+ className: "relative flex shrink-0",
6082
+ style: {
6083
+ width: avatarPx,
6084
+ height: avatarPx,
6085
+ marginLeft: i > 0 ? -overlapPx : 0,
6086
+ // Leftmost = highest z-index: its transparent bite reveals the avatar below.
6087
+ zIndex: visible.length - i,
6088
+ ...isLast ? {} : subtractMask(avatarPx, overlapPx)
6089
+ },
6090
+ children: /* @__PURE__ */ jsx(
6091
+ Avatar,
6092
+ {
6093
+ type: item.type ?? "photo",
6094
+ size: avatarSize,
6095
+ src: item.src,
6096
+ alt: item.alt,
6097
+ initials: item.initials
6098
+ }
6099
+ )
6100
+ },
6101
+ i
6102
+ );
6103
+ }) });
6104
+ }
6105
+ function BreadcrumbLabel({ item, isLast }) {
6106
+ const base = "shrink-0 text-sm leading-5";
6107
+ if (isLast) {
6108
+ return /* @__PURE__ */ jsx("span", { "aria-current": "page", className: `${base} text-text-brand-secondary`, children: item.label });
6109
+ }
6110
+ if (item.href) {
6111
+ return /* @__PURE__ */ jsx("a", { href: item.href, className: `${base} text-text-default-secondary hover:text-foreground transition-colors`, children: item.label });
6112
+ }
6113
+ return /* @__PURE__ */ jsx("span", { className: `${base} text-text-default-secondary`, children: item.label });
6114
+ }
6115
+ function Breadcrumb({ items, className }) {
6116
+ return /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: cn("flex items-center gap-1", className), children: items.map((item, index2) => {
6117
+ const isLast = index2 === items.length - 1;
6118
+ return /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
6119
+ /* @__PURE__ */ jsx(BreadcrumbLabel, { item, isLast }),
6120
+ !isLast && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "shrink-0 text-sm leading-5 text-text-default-placeholder select-none", children: "/" })
6121
+ ] }, index2);
6122
+ }) });
6123
+ }
5950
6124
  const index = {
5951
6125
  Button,
5952
6126
  Badge,
@@ -5980,13 +6154,19 @@ const index = {
5980
6154
  TableCell,
5981
6155
  TextArea,
5982
6156
  TimeInput,
6157
+ Avatar,
6158
+ AvatarStack,
6159
+ Breadcrumb,
5983
6160
  cn,
5984
6161
  useIsMobile
5985
6162
  };
5986
6163
  export {
5987
6164
  Alert,
6165
+ Avatar,
6166
+ AvatarStack,
5988
6167
  Badge,
5989
6168
  BottomSheet,
6169
+ Breadcrumb,
5990
6170
  Button,
5991
6171
  Card,
5992
6172
  Checkbox,