@lax-wp/design-system 0.13.55 → 0.13.57

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.
@@ -1,24 +1,24 @@
1
1
  import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
- import { GroupsOutlined as re } from "@mui/icons-material";
3
- import ae from "@mui/icons-material/EditOutlined";
4
- import oe from "@mui/icons-material/WarningRounded";
2
+ import re from "@mui/icons-material/EditOutlined";
3
+ import ae from "@mui/icons-material/WarningRounded";
5
4
  import l from "../../_virtual/index.es.js";
6
- import { useState as B, useRef as v, useMemo as le, useEffect as F } from "react";
5
+ import { useState as B, useRef as v, useMemo as oe, useEffect as F } from "react";
7
6
  import { Typography as n } from "../data-display/typography/Typography.es.js";
8
7
  import { Tag as p } from "../data-display/tag/Tag.es.js";
9
- import { Skeleton as te } from "../data-display/skeleton/Skeleton.es.js";
10
- import { getFlagComponentRectangleMd as ne } from "../../utils/countryFlags.es.js";
11
- import { UserAvatarPopper as ie } from "./UserAvatarPopper.es.js";
8
+ import { Skeleton as le } from "../data-display/skeleton/Skeleton.es.js";
9
+ import { getFlagComponentRectangleMd as te } from "../../utils/countryFlags.es.js";
10
+ import { UserAvatarPopper as ne } from "./UserAvatarPopper.es.js";
12
11
  import { StatusInfoRow as de } from "./StatusInfoRow.es.js";
13
12
  import { sizeClasses as M, getInitials as A, initialsFontSizeClasses as $ } from "./constants.es.js";
14
- import { PersonIcon as ce } from "./PersonIcon.es.js";
15
- import { useDynamicPosition as se } from "./useDynamicPosition.es.js";
16
- const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "flex justify-between items-center", children: [
17
- /* @__PURE__ */ e(n, { size: "small", variant: "medium", className: "mr-5", appearance: "body", children: i }),
18
- d
13
+ import { PersonIcon as ie } from "./PersonIcon.es.js";
14
+ import { useDynamicPosition as ce } from "./useDynamicPosition.es.js";
15
+ import { GroupsIcon as se } from "../icon/icons.generated.es.js";
16
+ const k = ({ label: d, content: i }) => /* @__PURE__ */ o("div", { className: "flex justify-between items-center", children: [
17
+ /* @__PURE__ */ e(n, { size: "small", variant: "medium", className: "mr-5", appearance: "body", children: d }),
18
+ i
19
19
  ] }), me = ({
20
- firstName: i,
21
- lastName: d,
20
+ firstName: d,
21
+ lastName: i,
22
22
  email: G,
23
23
  profilePic: c,
24
24
  size: y = "md",
@@ -36,16 +36,16 @@ const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "f
36
36
  onHover: Q,
37
37
  currentlyEditing: L
38
38
  }) => {
39
- if (i === "All" && d === "Users")
40
- return /* @__PURE__ */ e("div", { className: "p-1 rounded-full bg-primary-100 dark:bg-black-600 flex items-center justify-center", children: /* @__PURE__ */ e(re, { sx: { fontSize: 16 }, className: "text-primary-600 dark:text-primary-600" }) });
41
- const [X, N] = B(!1), [S, s] = B(!1), Y = M[y], {
39
+ if (d === "All" && i === "Users")
40
+ return /* @__PURE__ */ e("div", { className: "p-1 rounded-full bg-primary-100 dark:bg-black-600 flex items-center justify-center", children: /* @__PURE__ */ e(se, { className: "text-primary-600 dark:text-primary-600 w-xs h-xs" }) });
41
+ const [X, N] = B(!1), [T, s] = B(!1), Y = M[y], {
42
42
  triggerRef: Z,
43
43
  dropdownRef: _,
44
44
  position: g,
45
45
  isVisible: O,
46
- show: T,
47
- hide: I
48
- } = se(), C = v({}), E = le(() => {
46
+ show: I,
47
+ hide: S
48
+ } = ce(), C = v({}), E = oe(() => {
49
49
  if (u || !m) return !1;
50
50
  const a = new Date(m);
51
51
  return ((/* @__PURE__ */ new Date()).getTime() - a.getTime()) / (1e3 * 60 * 60) < 24;
@@ -76,7 +76,7 @@ const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "f
76
76
  t.current && clearTimeout(t.current);
77
77
  }, []);
78
78
  const x = c ? C.current[c] : void 0, t = v(null), z = v(null), D = () => {
79
- Q?.(), i && d && W && (t.current && clearTimeout(t.current), t.current = setTimeout(() => {
79
+ Q?.(), d && i && W && (t.current && clearTimeout(t.current), t.current = setTimeout(() => {
80
80
  N(!0);
81
81
  }, 300));
82
82
  }, H = (a) => {
@@ -95,7 +95,7 @@ const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "f
95
95
  children: [
96
96
  /* @__PURE__ */ o("div", { className: "flex flex-col gap-1 items-center p-5", children: [
97
97
  /* @__PURE__ */ o("div", { className: l("relative", M[w]), children: [
98
- x && S ? /* @__PURE__ */ e(
98
+ x && T ? /* @__PURE__ */ e(
99
99
  "img",
100
100
  {
101
101
  src: x,
@@ -117,7 +117,7 @@ const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "f
117
117
  variant: "semibold",
118
118
  appearance: "custom",
119
119
  className: l("text-primary-600", $[w]),
120
- children: A((i || "") + " " + (d || ""))
120
+ children: A((d || "") + " " + (i || ""))
121
121
  }
122
122
  )
123
123
  }
@@ -135,16 +135,16 @@ const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "f
135
135
  ] }),
136
136
  /* @__PURE__ */ o("div", { className: "flex flex-row gap-1 items-center justify-center", children: [
137
137
  /* @__PURE__ */ o(n, { size: "medium", variant: "semibold", className: "w-full text-center", children: [
138
- i || "",
138
+ d || "",
139
139
  " ",
140
- d || ""
140
+ i || ""
141
141
  ] }),
142
- r?.region && /* @__PURE__ */ e("span", { children: ne(r?.region) })
142
+ r?.region && /* @__PURE__ */ e("span", { children: te(r?.region) })
143
143
  ] }),
144
144
  /* @__PURE__ */ e(n, { size: "small", variant: "medium", appearance: "body", children: G || r?.email || "" })
145
145
  ] }),
146
146
  L ? /* @__PURE__ */ e("div", { className: "px-5 pb-3", children: /* @__PURE__ */ o("div", { className: "flex items-center gap-3 rounded-lg border border-primary-100 dark:border-primary-900 bg-[rgba(230,241,252,0.60)] dark:bg-primary-950/40 px-[13px] py-[7px]", children: [
147
- /* @__PURE__ */ e("div", { className: "flex items-center justify-center shrink-0 w-7 h-7 rounded-[5px] border-[0.4px] border-primary-100 dark:border-primary-900 bg-primary-50 dark:bg-primary-950", children: /* @__PURE__ */ e(ae, { sx: { width: 13, height: 13 }, className: "text-primary-600 dark:text-primary-500" }) }),
147
+ /* @__PURE__ */ e("div", { className: "flex items-center justify-center shrink-0 w-7 h-7 rounded-[5px] border-[0.4px] border-primary-100 dark:border-primary-900 bg-primary-50 dark:bg-primary-950", children: /* @__PURE__ */ e(re, { sx: { width: 13, height: 13 }, className: "text-primary-600 dark:text-primary-500" }) }),
148
148
  /* @__PURE__ */ o("div", { className: "flex flex-col min-w-0", children: [
149
149
  /* @__PURE__ */ e(
150
150
  n,
@@ -159,7 +159,7 @@ const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "f
159
159
  /* @__PURE__ */ e(n, { size: "extra-small", variant: "semibold", className: "truncate", children: L })
160
160
  ] })
161
161
  ] }) }) : null,
162
- R && (K ? /* @__PURE__ */ e("div", { className: "p-5", children: /* @__PURE__ */ e(te, {}) }) : R && (r?.teams || r?.clearanceLevel || r?.group) ? /* @__PURE__ */ o("div", { className: "flex flex-col gap-4 bg-neutral-50 border-t border-neutral-200 dark:bg-black-700 dark:border-none p-5 rounded-b-lg", children: [
162
+ R && (K ? /* @__PURE__ */ e("div", { className: "p-5", children: /* @__PURE__ */ e(le, {}) }) : R && (r?.teams || r?.clearanceLevel || r?.group) ? /* @__PURE__ */ o("div", { className: "flex flex-col gap-4 bg-neutral-50 border-t border-neutral-200 dark:bg-black-700 dark:border-none p-5 rounded-b-lg", children: [
163
163
  /* @__PURE__ */ e(de, { isActive: u, lastViewedOn: m }),
164
164
  r.username && /* @__PURE__ */ e(
165
165
  k,
@@ -188,8 +188,8 @@ const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "f
188
188
  {
189
189
  ref: Z,
190
190
  className: "relative cursor-pointer",
191
- onMouseEnter: T,
192
- onMouseLeave: I,
191
+ onMouseEnter: I,
192
+ onMouseLeave: S,
193
193
  onClick: (a) => a.stopPropagation(),
194
194
  children: [
195
195
  /* @__PURE__ */ e(p, { label: `+ ${r?.teams?.length - 1} More`, color: "#004f08", size: "md", isHashColor: !0 }, 1),
@@ -206,8 +206,8 @@ const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "f
206
206
  "right-0": g.horizontal === "right"
207
207
  }
208
208
  ),
209
- onMouseEnter: T,
210
- onMouseLeave: I,
209
+ onMouseEnter: I,
210
+ onMouseLeave: S,
211
211
  children: r?.teams?.slice(1)?.map((a, f) => /* @__PURE__ */ e("div", { className: "my-2", children: /* @__PURE__ */ e(p, { label: a?.name, color: a?.color || "#4A5568", size: "md", isHashColor: !0, className: "w-fit" }, a?.id) }, a?.id || f))
212
212
  }
213
213
  )
@@ -242,7 +242,7 @@ const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "f
242
242
  )
243
243
  ] }) : /* @__PURE__ */ e("div", { className: "flex items-center justify-center bg-neutral-50 dark:bg-black-700 border-t border-neutral-200 dark:border-black-700 p-5 rounded-b-lg", children: /* @__PURE__ */ o(n, { className: "flex items-center justify-center gap-1", size: "extra-small", variant: "medium", appearance: "body", children: [
244
244
  /* @__PURE__ */ e(
245
- oe,
245
+ ae,
246
246
  {
247
247
  sx: {
248
248
  height: "16px",
@@ -265,7 +265,7 @@ const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "f
265
265
  ref: U,
266
266
  children: [
267
267
  /* @__PURE__ */ o("div", { className: l("relative", P || Y), children: [
268
- x && S ? /* @__PURE__ */ e(
268
+ x && T ? /* @__PURE__ */ e(
269
269
  "img",
270
270
  {
271
271
  src: x,
@@ -273,7 +273,7 @@ const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "f
273
273
  className: l("rounded-full border object-cover w-full h-full", b),
274
274
  onError: () => s(!1)
275
275
  }
276
- ) : i && d ? /* @__PURE__ */ e(
276
+ ) : d && i ? /* @__PURE__ */ e(
277
277
  "div",
278
278
  {
279
279
  className: l(
@@ -288,11 +288,11 @@ const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "f
288
288
  variant: "semibold",
289
289
  appearance: "custom",
290
290
  className: l("text-primary-600", $[y]),
291
- children: A((i || "") + " " + (d || ""))
291
+ children: A((d || "") + " " + (i || ""))
292
292
  }
293
293
  )
294
294
  }
295
- ) : /* @__PURE__ */ e("div", { className: l(b, "p-1 rounded-full bg-neutral-200 dark:bg-black-600 flex items-center justify-center border w-full h-full"), children: /* @__PURE__ */ e(ce, { fill: "#98A2B3" }) }),
295
+ ) : /* @__PURE__ */ e("div", { className: l(b, "p-1 rounded-full bg-neutral-200 dark:bg-black-600 flex items-center justify-center border w-full h-full"), children: /* @__PURE__ */ e(ie, { fill: "#98A2B3" }) }),
296
296
  J && h && /* @__PURE__ */ e(
297
297
  "div",
298
298
  {
@@ -304,7 +304,7 @@ const k = ({ label: i, content: d }) => /* @__PURE__ */ o("div", { className: "f
304
304
  )
305
305
  ] }),
306
306
  /* @__PURE__ */ e(
307
- ie,
307
+ ne,
308
308
  {
309
309
  isOpen: X,
310
310
  onClose: () => N(!1),
@@ -1 +1 @@
1
- {"version":3,"file":"UserAvatar.es.js","sources":["../../../src/components/user-avatar/UserAvatar.tsx"],"sourcesContent":["import { GroupsOutlined } from '@mui/icons-material';\nimport EditOutlinedIcon from '@mui/icons-material/EditOutlined';\nimport WarningRoundedIcon from '@mui/icons-material/WarningRounded';\nimport cn from 'classnames';\nimport { type FC, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Typography } from '../data-display/typography/Typography';\nimport { Tag } from '../data-display/tag/Tag';\nimport { Skeleton } from '../data-display/skeleton/Skeleton';\nimport { getFlagComponentRectangleMd } from '../../utils/countryFlags';\nimport { UserAvatarPopper } from './UserAvatarPopper';\nimport { StatusInfoRow } from './StatusInfoRow';\nimport { sizeClasses, getInitials, initialsFontSizeClasses } from './constants';\nimport { PersonIcon } from './PersonIcon';\nimport { useDynamicPosition } from './useDynamicPosition';\n\nexport type UserAvatarSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\nexport type UserDetailsTeam = {\n id?: string;\n name: string;\n color?: string;\n};\n\nexport type UserDetails = {\n email?: string;\n username?: string;\n teams?: UserDetailsTeam[];\n group?: string;\n clearanceLevel?: number | string;\n region?: string;\n};\n\nexport type UserAvatarProps = {\n firstName?: string;\n lastName?: string;\n email?: string;\n enablePopper?: boolean;\n profilePic?: string;\n size?: UserAvatarSize;\n hoverSize?: UserAvatarSize;\n containerClassName?: string;\n className?: string;\n userId?: string;\n lastViewedOn?: string;\n isActive?: boolean;\n statusIndicator?: boolean;\n /** User details to display in the popper - replaces the useTeamMemberFilter hook */\n userDetails?: UserDetails | null;\n /** Whether user details are being fetched */\n isFetchingUserDetails?: boolean;\n /** Optional token for authenticated image loading */\n authToken?: string;\n /** Callback triggered when mouse enters the avatar */\n onHover?: () => void;\n /** Name of the clause / line item the user is currently editing. When set, a highlighted \"Currently editing\" card is shown in the popper. */\n currentlyEditing?: string;\n};\n\nconst InfoRow = ({ label, content }: { label: string; content: React.ReactNode }) => (\n <div className='flex justify-between items-center'>\n <Typography size='small' variant='medium' className='mr-5' appearance='body'>\n {label}\n </Typography>\n {content}\n </div>\n);\n\n/**\n * UserAvatar component for displaying user profile pictures with hover popper\n *\n * @example\n * ```tsx\n * <UserAvatar\n * firstName=\"John\"\n * lastName=\"Doe\"\n * email=\"john@example.com\"\n * profilePic=\"/avatar.jpg\"\n * userDetails={{ teams: [{ name: 'Engineering', color: '#0066cc' }], group: 'Admin' }}\n * />\n * ```\n */\nexport const UserAvatar: FC<UserAvatarProps> = ({\n firstName,\n lastName,\n email,\n profilePic,\n size = 'md',\n hoverSize = 'lg',\n containerClassName = '',\n enablePopper = true,\n className,\n userId,\n lastViewedOn,\n isActive,\n statusIndicator = false,\n userDetails,\n isFetchingUserDetails = false,\n authToken,\n onHover,\n currentlyEditing,\n}) => {\n if (firstName === 'All' && lastName === 'Users') {\n return (\n <div className='p-1 rounded-full bg-primary-100 dark:bg-black-600 flex items-center justify-center'>\n <GroupsOutlined sx={{ fontSize: 16 }} className='text-primary-600 dark:text-primary-600' />\n </div>\n );\n }\n\n const [visible, setVisible] = useState<boolean>(false);\n const [imageLoaded, setImageLoaded] = useState<boolean>(false);\n\n const avatarSizeClass = sizeClasses[size];\n\n const {\n triggerRef: moreTagRef,\n dropdownRef,\n position: dropdownPosition,\n isVisible: showMore,\n show: handleShowMore,\n hide: handleHideMore,\n } = useDynamicPosition();\n\n const imageCacheRef = useRef<{ [key: string]: string }>({});\n\n const isRecent = useMemo(() => {\n if (isActive || !lastViewedOn) return false;\n const date = new Date(lastViewedOn);\n const now = new Date();\n const diffInHours = (now.getTime() - date.getTime()) / (1000 * 60 * 60);\n return diffInHours < 24;\n }, [isActive, lastViewedOn]);\n\n const getStatusColor = () => {\n if (isActive) return 'bg-primary-600 dark:bg-primary-600';\n if (isRecent) return 'bg-primary-300 dark:bg-primary-300';\n if (lastViewedOn) return 'bg-neutral-400 dark:bg-neutral-400';\n return null;\n };\n\n const statusColor = getStatusColor();\n\n const getBorderColor = () => {\n if (isActive) return 'border-primary-600 dark:border-primary-600';\n if (isRecent) return 'border-primary-300 dark:border-primary-300';\n if (lastViewedOn) return 'border-neutral-400 dark:border-neutral-400';\n return 'border-primary-200 dark:border-neutral-800';\n };\n\n const borderColor = getBorderColor();\n\n const indicatorSizes = {\n '2xs': 'w-1.5 h-1.5',\n xs: 'w-2 h-2',\n sm: 'w-2.5 h-2.5',\n md: 'w-3 h-3',\n lg: 'w-3.5 h-3.5',\n xl: 'w-4 h-4',\n };\n\n useEffect(() => {\n if (profilePic) {\n if (imageCacheRef.current[profilePic]) {\n setImageLoaded(true);\n } else {\n setImageLoaded(false);\n const img = new Image();\n const token = authToken || (typeof localStorage !== 'undefined' ? localStorage.getItem('token') : null);\n img.src = profilePic + (token ? '?token=' + token : '');\n img.onload = () => {\n imageCacheRef.current[profilePic] = img.src;\n setImageLoaded(true);\n };\n img.onerror = () => {\n setImageLoaded(false);\n };\n }\n } else {\n setImageLoaded(false);\n }\n }, [profilePic, authToken]);\n\n useEffect(() => {\n return () => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n };\n }, []);\n\n const cachedSrc = profilePic ? imageCacheRef.current[profilePic] : undefined;\n\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const popperRef = useRef<HTMLDivElement | null>(null);\n\n const handleMouseEnter = () => {\n onHover?.();\n if (firstName && lastName && enablePopper) {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n timerRef.current = setTimeout(() => {\n setVisible(true);\n }, 300);\n }\n };\n\n const handleMouseLeave = (event: React.MouseEvent) => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n timerRef.current = setTimeout(() => {\n if (popperRef.current && !popperRef.current.contains(event.relatedTarget as Node)) {\n setVisible(false);\n }\n }, 200);\n };\n\n const popperContent = (\n <div\n ref={popperRef}\n className='bg-white dark:bg-black-800 shadow rounded-lg border border-neutral-200 dark:border-black-700 min-w-[280px]'\n onMouseEnter={() => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n }}\n onMouseLeave={(event) => handleMouseLeave(event)}\n >\n <div className='flex flex-col gap-1 items-center p-5'>\n <div className={cn('relative', sizeClasses[hoverSize])}>\n {cachedSrc && imageLoaded ? (\n <img\n src={cachedSrc}\n alt='Profile'\n className={cn('rounded-full border-2 object-cover w-full h-full', borderColor)}\n onError={() => setImageLoaded(false)}\n />\n ) : (\n <div\n className={cn(\n 'bg-primary-100 dark:bg-primary-950 border-2 flex items-center justify-center rounded-full w-full h-full',\n borderColor,\n )}\n >\n <Typography\n size='extra-small'\n variant='semibold'\n appearance='custom'\n className={cn('text-primary-600', initialsFontSizeClasses[hoverSize])}\n >\n {getInitials((firstName || '') + ' ' + (lastName || ''))}\n </Typography>\n </div>\n )}\n\n {statusColor && (\n <div\n className={cn(\n 'absolute bottom-0 right-0 rounded-full border-2 border-white dark:border-black-800',\n indicatorSizes[hoverSize],\n statusColor,\n )}\n />\n )}\n </div>\n <div className='flex flex-row gap-1 items-center justify-center'>\n <Typography size='medium' variant='semibold' className='w-full text-center'>\n {firstName || ''} {lastName || ''}\n </Typography>\n {userDetails?.region && <span>{getFlagComponentRectangleMd(userDetails?.region)}</span>}\n </div>\n\n <Typography size='small' variant='medium' appearance='body'>\n {email || userDetails?.email || ''}\n </Typography>\n </div>\n\n {currentlyEditing ? (\n <div className='px-5 pb-3'>\n <div className='flex items-center gap-3 rounded-lg border border-primary-100 dark:border-primary-900 bg-[rgba(230,241,252,0.60)] dark:bg-primary-950/40 px-[13px] py-[7px]'>\n <div className='flex items-center justify-center shrink-0 w-7 h-7 rounded-[5px] border-[0.4px] border-primary-100 dark:border-primary-900 bg-primary-50 dark:bg-primary-950'>\n <EditOutlinedIcon sx={{ width: 13, height: 13 }} className='text-primary-600 dark:text-primary-500' />\n </div>\n <div className='flex flex-col min-w-0'>\n <Typography\n size='extra-small'\n variant='semibold'\n appearance='custom'\n className='text-2xs leading-4 uppercase tracking-[0.2px] text-primary-600 dark:text-primary-500'\n >\n Currently editing\n </Typography>\n <Typography size='extra-small' variant='semibold' className='truncate'>\n {currentlyEditing}\n </Typography>\n </div>\n </div>\n </div>\n ) : null}\n\n {userId &&\n (isFetchingUserDetails ? (\n <div className='p-5'>\n <Skeleton />\n </div>\n ) : userId && (userDetails?.teams || userDetails?.clearanceLevel || userDetails?.group) ? (\n <div className='flex flex-col gap-4 bg-neutral-50 border-t border-neutral-200 dark:bg-black-700 dark:border-none p-5 rounded-b-lg'>\n <StatusInfoRow isActive={isActive} lastViewedOn={lastViewedOn} />\n {userDetails.username && (\n <InfoRow\n label='Username'\n content={\n <div className='flex gap-2'>\n <Typography size='small' variant='medium' appearance='body'>\n {userDetails.username}\n </Typography>\n </div>\n }\n />\n )}\n\n {userDetails?.teams && userDetails?.teams?.length > 0 && (\n <InfoRow\n label='Team'\n content={\n <div className='flex gap-2'>\n {userDetails?.teams?.length > 0 && (\n <Tag\n key={userDetails?.teams[0]?.id}\n label={userDetails?.teams[0]?.name}\n color={userDetails?.teams[0]?.color || '#e38715'}\n size='md'\n isHashColor\n />\n )}\n {userDetails?.teams?.length >= 2 && (\n <div\n ref={moreTagRef}\n className='relative cursor-pointer'\n onMouseEnter={handleShowMore}\n onMouseLeave={handleHideMore}\n onClick={(e) => e.stopPropagation()}\n >\n <Tag key={1} label={`+ ${userDetails?.teams?.length - 1} More`} color='#004f08' size='md' isHashColor />\n\n {showMore && (\n <div\n ref={dropdownRef}\n className={cn(\n 'absolute w-max bg-white dark:text-black-200 dark:bg-black-800 shadow-md border border-neutral-200 dark:border-black-800 rounded-md px-2 z-10 overflow-y-auto max-h-60',\n {\n 'top-full': dropdownPosition.vertical === 'bottom',\n 'bottom-full': dropdownPosition.vertical === 'top',\n 'left-0': dropdownPosition.horizontal === 'left',\n 'right-0': dropdownPosition.horizontal === 'right',\n },\n )}\n onMouseEnter={handleShowMore}\n onMouseLeave={handleHideMore}\n >\n {userDetails?.teams?.slice(1)?.map((team, index) => (\n <div key={team?.id || index} className='my-2'>\n <Tag key={team?.id} label={team?.name} color={team?.color || '#4A5568'} size='md' isHashColor className='w-fit' />\n </div>\n ))}\n </div>\n )}\n </div>\n )}\n </div>\n }\n />\n )}\n\n {userDetails?.group && (\n <InfoRow\n label='Role'\n content={<Tag key={userDetails?.group} label={userDetails?.group} color='#004094' size='md' isHashColor />}\n />\n )}\n\n {userDetails?.clearanceLevel && (\n <InfoRow\n label='Clearance Level'\n content={\n <Tag\n key={String(userDetails?.clearanceLevel)}\n label={`Level ${userDetails?.clearanceLevel}`}\n color='#b30000'\n size='md'\n isHashColor\n />\n }\n />\n )}\n </div>\n ) : (\n <div className='flex items-center justify-center bg-neutral-50 dark:bg-black-700 border-t border-neutral-200 dark:border-black-700 p-5 rounded-b-lg'>\n <Typography className='flex items-center justify-center gap-1' size='extra-small' variant='medium' appearance='body'>\n <WarningRoundedIcon\n sx={{\n height: '16px',\n width: '16px',\n color: '#F04438',\n }}\n />\n No other information found!\n </Typography>\n </div>\n ))}\n </div>\n );\n const containerRef = useRef<HTMLDivElement>(null);\n return (\n <div\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n className={cn('inline-block relative cursor-pointer', className)}\n ref={containerRef}\n >\n <div className={cn('relative', containerClassName || avatarSizeClass)}>\n {cachedSrc && imageLoaded ? (\n <img\n src={cachedSrc}\n alt='Profile'\n className={cn('rounded-full border object-cover w-full h-full', borderColor)}\n onError={() => setImageLoaded(false)}\n />\n ) : firstName && lastName ? (\n <div\n className={cn(\n 'bg-primary-100 flex items-center justify-center rounded-full border dark:bg-black-700',\n sizeClasses[size],\n borderColor,\n )}\n >\n <Typography\n size='extra-small'\n variant='semibold'\n appearance='custom'\n className={cn('text-primary-600', initialsFontSizeClasses[size])}\n >\n {getInitials((firstName || '') + ' ' + (lastName || ''))}\n </Typography>\n </div>\n ) : (\n <div className={cn(borderColor, 'p-1 rounded-full bg-neutral-200 dark:bg-black-600 flex items-center justify-center border w-full h-full')}>\n <PersonIcon fill='#98A2B3' />\n </div>\n )}\n\n {statusIndicator && statusColor && (\n <div\n className={cn(\n 'absolute bottom-0 right-0 rounded-full border border-white dark:border-black-800 w-2 h-2',\n\n statusColor,\n )}\n />\n )}\n </div>\n <UserAvatarPopper\n isOpen={visible}\n onClose={() => setVisible(false)}\n anchorEl={containerRef.current}\n className='bg-white dark:bg-black-700 shadow rounded-lg border border-neutral-200 dark:border-black-600'\n >\n {popperContent}\n </UserAvatarPopper>\n </div>\n );\n};\n\nUserAvatar.displayName = 'UserAvatar';\n\n"],"names":["InfoRow","label","content","jsxs","jsx","Typography","UserAvatar","firstName","lastName","email","profilePic","size","hoverSize","containerClassName","enablePopper","className","userId","lastViewedOn","isActive","statusIndicator","userDetails","isFetchingUserDetails","authToken","onHover","currentlyEditing","GroupsOutlined","visible","setVisible","useState","imageLoaded","setImageLoaded","avatarSizeClass","sizeClasses","moreTagRef","dropdownRef","dropdownPosition","showMore","handleShowMore","handleHideMore","useDynamicPosition","imageCacheRef","useRef","isRecent","useMemo","date","statusColor","borderColor","indicatorSizes","useEffect","img","token","timerRef","cachedSrc","popperRef","handleMouseEnter","handleMouseLeave","event","popperContent","cn","initialsFontSizeClasses","getInitials","getFlagComponentRectangleMd","EditOutlinedIcon","Skeleton","StatusInfoRow","Tag","e","team","index","WarningRoundedIcon","containerRef","PersonIcon","UserAvatarPopper"],"mappings":";;;;;;;;;;;;;;;AA2DA,MAAMA,IAAU,CAAC,EAAE,OAAAC,GAAO,SAAAC,QACxB,gBAAAC,EAAC,OAAA,EAAI,WAAU,qCACb,UAAA;AAAA,EAAA,gBAAAC,EAACC,GAAA,EAAW,MAAK,SAAQ,SAAQ,UAAS,WAAU,QAAO,YAAW,QACnE,UAAAJ,EAAA,CACH;AAAA,EACCC;AAAA,GACH,GAiBWI,KAAkC,CAAC;AAAA,EAC9C,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC,IAAY;AAAA,EACZ,oBAAAC,IAAqB;AAAA,EACrB,cAAAC,IAAe;AAAA,EACf,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,aAAAC;AAAA,EACA,uBAAAC,IAAwB;AAAA,EACxB,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,kBAAAC;AACF,MAAM;AACJ,MAAIjB,MAAc,SAASC,MAAa;AACtC,WACE,gBAAAJ,EAAC,OAAA,EAAI,WAAU,sFACb,UAAA,gBAAAA,EAACqB,IAAA,EAAe,IAAI,EAAE,UAAU,GAAA,GAAM,WAAU,0CAAyC,GAC3F;AAIJ,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAkB,EAAK,GAC/C,CAACC,GAAaC,CAAc,IAAIF,EAAkB,EAAK,GAEvDG,IAAkBC,EAAYrB,CAAI,GAElC;AAAA,IACJ,YAAYsB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DZ,CAAW;AAAA,cAC3E,SAAS,MAAMhB,EAAe,EAAK;AAAA,YAAA;AAAA,UAAA,IAEnCvB,KAAaC,IACf,gBAAAJ;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWsD;AAAA,gBACT;AAAA,gBACA1B,EAAYrB,CAAI;AAAA,gBAChBmC;AAAA,cAAA;AAAA,cAGF,UAAA,gBAAA1C;AAAA,gBAACC;AAAA,gBAAA;AAAA,kBACC,MAAK;AAAA,kBACL,SAAQ;AAAA,kBACR,YAAW;AAAA,kBACX,WAAWqD,EAAG,oBAAoBC,EAAwBhD,CAAI,CAAC;AAAA,kBAE9D,UAAAiD,GAAarD,KAAa,MAAM,OAAOC,KAAY,GAAG;AAAA,gBAAA;AAAA,cAAA;AAAA,YACzD;AAAA,UAAA,IAGF,gBAAAJ,EAAC,OAAA,EAAI,WAAWsD,EAAGZ,GAAa,yGAAyG,GACvI,UAAA,gBAAA1C,EAACmE,IAAA,EAAW,MAAK,UAAA,CAAU,EAAA,CAC7B;AAAA,UAGDpD,KAAmB0B,KAClB,gBAAAzC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWsD;AAAA,gBACT;AAAA,gBAEAb;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QACF,GAEJ;AAAA,QACA,gBAAAzC;AAAA,UAACoE;AAAA,UAAA;AAAA,YACC,QAAQ9C;AAAA,YACR,SAAS,MAAMC,EAAW,EAAK;AAAA,YAC/B,UAAU2C,EAAa;AAAA,YACvB,WAAU;AAAA,YAET,UAAAb;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAGN;AAEAnD,GAAW,cAAc;"}
1
+ {"version":3,"file":"UserAvatar.es.js","sources":["../../../src/components/user-avatar/UserAvatar.tsx"],"sourcesContent":["import EditOutlinedIcon from '@mui/icons-material/EditOutlined';\nimport WarningRoundedIcon from '@mui/icons-material/WarningRounded';\nimport cn from 'classnames';\nimport { type FC, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Typography } from '../data-display/typography/Typography';\nimport { Tag } from '../data-display/tag/Tag';\nimport { Skeleton } from '../data-display/skeleton/Skeleton';\nimport { getFlagComponentRectangleMd } from '../../utils/countryFlags';\nimport { UserAvatarPopper } from './UserAvatarPopper';\nimport { StatusInfoRow } from './StatusInfoRow';\nimport { sizeClasses, getInitials, initialsFontSizeClasses } from './constants';\nimport { PersonIcon } from './PersonIcon';\nimport { useDynamicPosition } from './useDynamicPosition';\nimport { GroupsIcon } from '../icon';\n\nexport type UserAvatarSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\nexport type UserDetailsTeam = {\n id?: string;\n name: string;\n color?: string;\n};\n\nexport type UserDetails = {\n email?: string;\n username?: string;\n teams?: UserDetailsTeam[];\n group?: string;\n clearanceLevel?: number | string;\n region?: string;\n};\n\nexport type UserAvatarProps = {\n firstName?: string;\n lastName?: string;\n email?: string;\n enablePopper?: boolean;\n profilePic?: string;\n size?: UserAvatarSize;\n hoverSize?: UserAvatarSize;\n containerClassName?: string;\n className?: string;\n userId?: string;\n lastViewedOn?: string;\n isActive?: boolean;\n statusIndicator?: boolean;\n /** User details to display in the popper - replaces the useTeamMemberFilter hook */\n userDetails?: UserDetails | null;\n /** Whether user details are being fetched */\n isFetchingUserDetails?: boolean;\n /** Optional token for authenticated image loading */\n authToken?: string;\n /** Callback triggered when mouse enters the avatar */\n onHover?: () => void;\n /** Name of the clause / line item the user is currently editing. When set, a highlighted \"Currently editing\" card is shown in the popper. */\n currentlyEditing?: string;\n};\n\nconst InfoRow = ({ label, content }: { label: string; content: React.ReactNode }) => (\n <div className='flex justify-between items-center'>\n <Typography size='small' variant='medium' className='mr-5' appearance='body'>\n {label}\n </Typography>\n {content}\n </div>\n);\n\n/**\n * UserAvatar component for displaying user profile pictures with hover popper\n *\n * @example\n * ```tsx\n * <UserAvatar\n * firstName=\"John\"\n * lastName=\"Doe\"\n * email=\"john@example.com\"\n * profilePic=\"/avatar.jpg\"\n * userDetails={{ teams: [{ name: 'Engineering', color: '#0066cc' }], group: 'Admin' }}\n * />\n * ```\n */\nexport const UserAvatar: FC<UserAvatarProps> = ({\n firstName,\n lastName,\n email,\n profilePic,\n size = 'md',\n hoverSize = 'lg',\n containerClassName = '',\n enablePopper = true,\n className,\n userId,\n lastViewedOn,\n isActive,\n statusIndicator = false,\n userDetails,\n isFetchingUserDetails = false,\n authToken,\n onHover,\n currentlyEditing,\n}) => {\n if (firstName === 'All' && lastName === 'Users') {\n return (\n <div className='p-1 rounded-full bg-primary-100 dark:bg-black-600 flex items-center justify-center'>\n <GroupsIcon className='text-primary-600 dark:text-primary-600 w-xs h-xs' />\n </div>\n );\n }\n\n const [visible, setVisible] = useState<boolean>(false);\n const [imageLoaded, setImageLoaded] = useState<boolean>(false);\n\n const avatarSizeClass = sizeClasses[size];\n\n const {\n triggerRef: moreTagRef,\n dropdownRef,\n position: dropdownPosition,\n isVisible: showMore,\n show: handleShowMore,\n hide: handleHideMore,\n } = useDynamicPosition();\n\n const imageCacheRef = useRef<{ [key: string]: string }>({});\n\n const isRecent = useMemo(() => {\n if (isActive || !lastViewedOn) return false;\n const date = new Date(lastViewedOn);\n const now = new Date();\n const diffInHours = (now.getTime() - date.getTime()) / (1000 * 60 * 60);\n return diffInHours < 24;\n }, [isActive, lastViewedOn]);\n\n const getStatusColor = () => {\n if (isActive) return 'bg-primary-600 dark:bg-primary-600';\n if (isRecent) return 'bg-primary-300 dark:bg-primary-300';\n if (lastViewedOn) return 'bg-neutral-400 dark:bg-neutral-400';\n return null;\n };\n\n const statusColor = getStatusColor();\n\n const getBorderColor = () => {\n if (isActive) return 'border-primary-600 dark:border-primary-600';\n if (isRecent) return 'border-primary-300 dark:border-primary-300';\n if (lastViewedOn) return 'border-neutral-400 dark:border-neutral-400';\n return 'border-primary-200 dark:border-neutral-800';\n };\n\n const borderColor = getBorderColor();\n\n const indicatorSizes = {\n '2xs': 'w-1.5 h-1.5',\n xs: 'w-2 h-2',\n sm: 'w-2.5 h-2.5',\n md: 'w-3 h-3',\n lg: 'w-3.5 h-3.5',\n xl: 'w-4 h-4',\n };\n\n useEffect(() => {\n if (profilePic) {\n if (imageCacheRef.current[profilePic]) {\n setImageLoaded(true);\n } else {\n setImageLoaded(false);\n const img = new Image();\n const token = authToken || (typeof localStorage !== 'undefined' ? localStorage.getItem('token') : null);\n img.src = profilePic + (token ? '?token=' + token : '');\n img.onload = () => {\n imageCacheRef.current[profilePic] = img.src;\n setImageLoaded(true);\n };\n img.onerror = () => {\n setImageLoaded(false);\n };\n }\n } else {\n setImageLoaded(false);\n }\n }, [profilePic, authToken]);\n\n useEffect(() => {\n return () => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n };\n }, []);\n\n const cachedSrc = profilePic ? imageCacheRef.current[profilePic] : undefined;\n\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const popperRef = useRef<HTMLDivElement | null>(null);\n\n const handleMouseEnter = () => {\n onHover?.();\n if (firstName && lastName && enablePopper) {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n timerRef.current = setTimeout(() => {\n setVisible(true);\n }, 300);\n }\n };\n\n const handleMouseLeave = (event: React.MouseEvent) => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n timerRef.current = setTimeout(() => {\n if (popperRef.current && !popperRef.current.contains(event.relatedTarget as Node)) {\n setVisible(false);\n }\n }, 200);\n };\n\n const popperContent = (\n <div\n ref={popperRef}\n className='bg-white dark:bg-black-800 shadow rounded-lg border border-neutral-200 dark:border-black-700 min-w-[280px]'\n onMouseEnter={() => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n }}\n onMouseLeave={(event) => handleMouseLeave(event)}\n >\n <div className='flex flex-col gap-1 items-center p-5'>\n <div className={cn('relative', sizeClasses[hoverSize])}>\n {cachedSrc && imageLoaded ? (\n <img\n src={cachedSrc}\n alt='Profile'\n className={cn('rounded-full border-2 object-cover w-full h-full', borderColor)}\n onError={() => setImageLoaded(false)}\n />\n ) : (\n <div\n className={cn(\n 'bg-primary-100 dark:bg-primary-950 border-2 flex items-center justify-center rounded-full w-full h-full',\n borderColor,\n )}\n >\n <Typography\n size='extra-small'\n variant='semibold'\n appearance='custom'\n className={cn('text-primary-600', initialsFontSizeClasses[hoverSize])}\n >\n {getInitials((firstName || '') + ' ' + (lastName || ''))}\n </Typography>\n </div>\n )}\n\n {statusColor && (\n <div\n className={cn(\n 'absolute bottom-0 right-0 rounded-full border-2 border-white dark:border-black-800',\n indicatorSizes[hoverSize],\n statusColor,\n )}\n />\n )}\n </div>\n <div className='flex flex-row gap-1 items-center justify-center'>\n <Typography size='medium' variant='semibold' className='w-full text-center'>\n {firstName || ''} {lastName || ''}\n </Typography>\n {userDetails?.region && <span>{getFlagComponentRectangleMd(userDetails?.region)}</span>}\n </div>\n\n <Typography size='small' variant='medium' appearance='body'>\n {email || userDetails?.email || ''}\n </Typography>\n </div>\n\n {currentlyEditing ? (\n <div className='px-5 pb-3'>\n <div className='flex items-center gap-3 rounded-lg border border-primary-100 dark:border-primary-900 bg-[rgba(230,241,252,0.60)] dark:bg-primary-950/40 px-[13px] py-[7px]'>\n <div className='flex items-center justify-center shrink-0 w-7 h-7 rounded-[5px] border-[0.4px] border-primary-100 dark:border-primary-900 bg-primary-50 dark:bg-primary-950'>\n <EditOutlinedIcon sx={{ width: 13, height: 13 }} className='text-primary-600 dark:text-primary-500' />\n </div>\n <div className='flex flex-col min-w-0'>\n <Typography\n size='extra-small'\n variant='semibold'\n appearance='custom'\n className='text-2xs leading-4 uppercase tracking-[0.2px] text-primary-600 dark:text-primary-500'\n >\n Currently editing\n </Typography>\n <Typography size='extra-small' variant='semibold' className='truncate'>\n {currentlyEditing}\n </Typography>\n </div>\n </div>\n </div>\n ) : null}\n\n {userId &&\n (isFetchingUserDetails ? (\n <div className='p-5'>\n <Skeleton />\n </div>\n ) : userId && (userDetails?.teams || userDetails?.clearanceLevel || userDetails?.group) ? (\n <div className='flex flex-col gap-4 bg-neutral-50 border-t border-neutral-200 dark:bg-black-700 dark:border-none p-5 rounded-b-lg'>\n <StatusInfoRow isActive={isActive} lastViewedOn={lastViewedOn} />\n {userDetails.username && (\n <InfoRow\n label='Username'\n content={\n <div className='flex gap-2'>\n <Typography size='small' variant='medium' appearance='body'>\n {userDetails.username}\n </Typography>\n </div>\n }\n />\n )}\n\n {userDetails?.teams && userDetails?.teams?.length > 0 && (\n <InfoRow\n label='Team'\n content={\n <div className='flex gap-2'>\n {userDetails?.teams?.length > 0 && (\n <Tag\n key={userDetails?.teams[0]?.id}\n label={userDetails?.teams[0]?.name}\n color={userDetails?.teams[0]?.color || '#e38715'}\n size='md'\n isHashColor\n />\n )}\n {userDetails?.teams?.length >= 2 && (\n <div\n ref={moreTagRef}\n className='relative cursor-pointer'\n onMouseEnter={handleShowMore}\n onMouseLeave={handleHideMore}\n onClick={(e) => e.stopPropagation()}\n >\n <Tag key={1} label={`+ ${userDetails?.teams?.length - 1} More`} color='#004f08' size='md' isHashColor />\n\n {showMore && (\n <div\n ref={dropdownRef}\n className={cn(\n 'absolute w-max bg-white dark:text-black-200 dark:bg-black-800 shadow-md border border-neutral-200 dark:border-black-800 rounded-md px-2 z-10 overflow-y-auto max-h-60',\n {\n 'top-full': dropdownPosition.vertical === 'bottom',\n 'bottom-full': dropdownPosition.vertical === 'top',\n 'left-0': dropdownPosition.horizontal === 'left',\n 'right-0': dropdownPosition.horizontal === 'right',\n },\n )}\n onMouseEnter={handleShowMore}\n onMouseLeave={handleHideMore}\n >\n {userDetails?.teams?.slice(1)?.map((team, index) => (\n <div key={team?.id || index} className='my-2'>\n <Tag key={team?.id} label={team?.name} color={team?.color || '#4A5568'} size='md' isHashColor className='w-fit' />\n </div>\n ))}\n </div>\n )}\n </div>\n )}\n </div>\n }\n />\n )}\n\n {userDetails?.group && (\n <InfoRow\n label='Role'\n content={<Tag key={userDetails?.group} label={userDetails?.group} color='#004094' size='md' isHashColor />}\n />\n )}\n\n {userDetails?.clearanceLevel && (\n <InfoRow\n label='Clearance Level'\n content={\n <Tag\n key={String(userDetails?.clearanceLevel)}\n label={`Level ${userDetails?.clearanceLevel}`}\n color='#b30000'\n size='md'\n isHashColor\n />\n }\n />\n )}\n </div>\n ) : (\n <div className='flex items-center justify-center bg-neutral-50 dark:bg-black-700 border-t border-neutral-200 dark:border-black-700 p-5 rounded-b-lg'>\n <Typography className='flex items-center justify-center gap-1' size='extra-small' variant='medium' appearance='body'>\n <WarningRoundedIcon\n sx={{\n height: '16px',\n width: '16px',\n color: '#F04438',\n }}\n />\n No other information found!\n </Typography>\n </div>\n ))}\n </div>\n );\n const containerRef = useRef<HTMLDivElement>(null);\n return (\n <div\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n className={cn('inline-block relative cursor-pointer', className)}\n ref={containerRef}\n >\n <div className={cn('relative', containerClassName || avatarSizeClass)}>\n {cachedSrc && imageLoaded ? (\n <img\n src={cachedSrc}\n alt='Profile'\n className={cn('rounded-full border object-cover w-full h-full', borderColor)}\n onError={() => setImageLoaded(false)}\n />\n ) : firstName && lastName ? (\n <div\n className={cn(\n 'bg-primary-100 flex items-center justify-center rounded-full border dark:bg-black-700',\n sizeClasses[size],\n borderColor,\n )}\n >\n <Typography\n size='extra-small'\n variant='semibold'\n appearance='custom'\n className={cn('text-primary-600', initialsFontSizeClasses[size])}\n >\n {getInitials((firstName || '') + ' ' + (lastName || ''))}\n </Typography>\n </div>\n ) : (\n <div className={cn(borderColor, 'p-1 rounded-full bg-neutral-200 dark:bg-black-600 flex items-center justify-center border w-full h-full')}>\n <PersonIcon fill='#98A2B3' />\n </div>\n )}\n\n {statusIndicator && statusColor && (\n <div\n className={cn(\n 'absolute bottom-0 right-0 rounded-full border border-white dark:border-black-800 w-2 h-2',\n\n statusColor,\n )}\n />\n )}\n </div>\n <UserAvatarPopper\n isOpen={visible}\n onClose={() => setVisible(false)}\n anchorEl={containerRef.current}\n className='bg-white dark:bg-black-700 shadow rounded-lg border border-neutral-200 dark:border-black-600'\n >\n {popperContent}\n </UserAvatarPopper>\n </div>\n );\n};\n\nUserAvatar.displayName = 'UserAvatar';\n\n"],"names":["InfoRow","label","content","jsxs","jsx","Typography","UserAvatar","firstName","lastName","email","profilePic","size","hoverSize","containerClassName","enablePopper","className","userId","lastViewedOn","isActive","statusIndicator","userDetails","isFetchingUserDetails","authToken","onHover","currentlyEditing","GroupsIcon","visible","setVisible","useState","imageLoaded","setImageLoaded","avatarSizeClass","sizeClasses","moreTagRef","dropdownRef","dropdownPosition","showMore","handleShowMore","handleHideMore","useDynamicPosition","imageCacheRef","useRef","isRecent","useMemo","date","statusColor","borderColor","indicatorSizes","useEffect","img","token","timerRef","cachedSrc","popperRef","handleMouseEnter","handleMouseLeave","event","popperContent","cn","initialsFontSizeClasses","getInitials","getFlagComponentRectangleMd","EditOutlinedIcon","Skeleton","StatusInfoRow","Tag","e","team","index","WarningRoundedIcon","containerRef","PersonIcon","UserAvatarPopper"],"mappings":";;;;;;;;;;;;;;;AA2DA,MAAMA,IAAU,CAAC,EAAE,OAAAC,GAAO,SAAAC,QACxB,gBAAAC,EAAC,OAAA,EAAI,WAAU,qCACb,UAAA;AAAA,EAAA,gBAAAC,EAACC,GAAA,EAAW,MAAK,SAAQ,SAAQ,UAAS,WAAU,QAAO,YAAW,QACnE,UAAAJ,EAAA,CACH;AAAA,EACCC;AAAA,GACH,GAiBWI,KAAkC,CAAC;AAAA,EAC9C,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC,IAAY;AAAA,EACZ,oBAAAC,IAAqB;AAAA,EACrB,cAAAC,IAAe;AAAA,EACf,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,aAAAC;AAAA,EACA,uBAAAC,IAAwB;AAAA,EACxB,WAA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AA,YAC/B,UAAU2C,EAAa;AAAA,YACvB,WAAU;AAAA,YAET,UAAAb;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAGN;AAEAnD,GAAW,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={"2xs":"w-3 h-3 text-5xs font-semibold",xs:"w-4 h-4 text-4xs font-semibold",sm:"w-6 h-6 text-2xs font-semibold",md:"w-9 h-9 text-sm font-semibold",lg:"w-12 h-12 text-lg font-semibold",xl:"w-16 h-16 text-2xl font-semibold"},i={"2xs":"text-5xs",xs:"text-4xs",sm:"text-2xs",md:"text-sm",lg:"text-lg",xl:"text-2xl"},l=s=>{if(!s)return"";const t=s?.split(" ");return t?.length===1?t[0]?.charAt(0)?.toUpperCase():t[0]?.charAt(0)?.toUpperCase()+t[t?.length-1]?.charAt(0)?.toUpperCase()};exports.getInitials=l;exports.initialsFontSizeClasses=i;exports.sizeClasses=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={"2xs":"w-3 h-3 text-5xs font-semibold",xs:"w-5 h-5 text-4xs font-semibold",sm:"w-6 h-6 text-2xs font-semibold",md:"w-9 h-9 text-sm font-semibold",lg:"w-12 h-12 text-lg font-semibold",xl:"w-16 h-16 text-2xl font-semibold"},i={"2xs":"text-5xs",xs:"text-4xs",sm:"text-2xs",md:"text-sm",lg:"text-lg",xl:"text-2xl"},l=s=>{if(!s)return"";const t=s?.split(" ");return t?.length===1?t[0]?.charAt(0)?.toUpperCase():t[0]?.charAt(0)?.toUpperCase()+t[t?.length-1]?.charAt(0)?.toUpperCase()};exports.getInitials=l;exports.initialsFontSizeClasses=i;exports.sizeClasses=e;
2
2
  //# sourceMappingURL=constants.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.cjs.js","sources":["../../../src/components/user-avatar/constants.ts"],"sourcesContent":["export const sizeClasses = {\n '2xs': 'w-3 h-3 text-5xs font-semibold',\n xs: 'w-4 h-4 text-4xs font-semibold',\n sm: 'w-6 h-6 text-2xs font-semibold',\n md: 'w-9 h-9 text-sm font-semibold',\n lg: 'w-12 h-12 text-lg font-semibold',\n xl: 'w-16 h-16 text-2xl font-semibold',\n};\n\n// Font size only (no width/height), for the Typography wrapping the avatar initials.\nexport const initialsFontSizeClasses: Record<keyof typeof sizeClasses, string> = {\n '2xs': 'text-5xs',\n xs: 'text-4xs',\n sm: 'text-2xs',\n md: 'text-sm',\n lg: 'text-lg',\n xl: 'text-2xl',\n};\n\nexport const getInitials = (name: string) => {\n if (!name) return '';\n const nameArray = name?.split(' ');\n const initials =\n nameArray?.length === 1\n ? nameArray[0]?.charAt(0)?.toUpperCase()\n : nameArray[0]?.charAt(0)?.toUpperCase() +\n nameArray[nameArray?.length - 1]?.charAt(0)?.toUpperCase();\n return initials;\n};\n\n\n\n"],"names":["sizeClasses","initialsFontSizeClasses","getInitials","name","nameArray"],"mappings":"gFAAO,MAAMA,EAAc,CACzB,MAAO,iCACP,GAAI,iCACJ,GAAI,iCACJ,GAAI,gCACJ,GAAI,kCACJ,GAAI,kCACN,EAGaC,EAAoE,CAC/E,MAAO,WACP,GAAI,WACJ,GAAI,WACJ,GAAI,UACJ,GAAI,UACJ,GAAI,UACN,EAEaC,EAAeC,GAAiB,CAC3C,GAAI,CAACA,EAAM,MAAO,GAClB,MAAMC,EAAYD,GAAM,MAAM,GAAG,EAMjC,OAJEC,GAAW,SAAW,EAClBA,EAAU,CAAC,GAAG,OAAO,CAAC,GAAG,YAAA,EACzBA,EAAU,CAAC,GAAG,OAAO,CAAC,GAAG,YAAA,EACzBA,EAAUA,GAAW,OAAS,CAAC,GAAG,OAAO,CAAC,GAAG,YAAA,CAErD"}
1
+ {"version":3,"file":"constants.cjs.js","sources":["../../../src/components/user-avatar/constants.ts"],"sourcesContent":["export const sizeClasses = {\n '2xs': 'w-3 h-3 text-5xs font-semibold',\n xs: 'w-5 h-5 text-4xs font-semibold',\n sm: 'w-6 h-6 text-2xs font-semibold',\n md: 'w-9 h-9 text-sm font-semibold',\n lg: 'w-12 h-12 text-lg font-semibold',\n xl: 'w-16 h-16 text-2xl font-semibold',\n};\n\n// Font size only (no width/height), for the Typography wrapping the avatar initials.\nexport const initialsFontSizeClasses: Record<keyof typeof sizeClasses, string> = {\n '2xs': 'text-5xs',\n xs: 'text-4xs',\n sm: 'text-2xs',\n md: 'text-sm',\n lg: 'text-lg',\n xl: 'text-2xl',\n};\n\nexport const getInitials = (name: string) => {\n if (!name) return '';\n const nameArray = name?.split(' ');\n const initials =\n nameArray?.length === 1\n ? nameArray[0]?.charAt(0)?.toUpperCase()\n : nameArray[0]?.charAt(0)?.toUpperCase() +\n nameArray[nameArray?.length - 1]?.charAt(0)?.toUpperCase();\n return initials;\n};\n\n\n\n"],"names":["sizeClasses","initialsFontSizeClasses","getInitials","name","nameArray"],"mappings":"gFAAO,MAAMA,EAAc,CACzB,MAAO,iCACP,GAAI,iCACJ,GAAI,iCACJ,GAAI,gCACJ,GAAI,kCACJ,GAAI,kCACN,EAGaC,EAAoE,CAC/E,MAAO,WACP,GAAI,WACJ,GAAI,WACJ,GAAI,UACJ,GAAI,UACJ,GAAI,UACN,EAEaC,EAAeC,GAAiB,CAC3C,GAAI,CAACA,EAAM,MAAO,GAClB,MAAMC,EAAYD,GAAM,MAAM,GAAG,EAMjC,OAJEC,GAAW,SAAW,EAClBA,EAAU,CAAC,GAAG,OAAO,CAAC,GAAG,YAAA,EACzBA,EAAU,CAAC,GAAG,OAAO,CAAC,GAAG,YAAA,EACzBA,EAAUA,GAAW,OAAS,CAAC,GAAG,OAAO,CAAC,GAAG,YAAA,CAErD"}
@@ -1,6 +1,6 @@
1
1
  const x = {
2
2
  "2xs": "w-3 h-3 text-5xs font-semibold",
3
- xs: "w-4 h-4 text-4xs font-semibold",
3
+ xs: "w-5 h-5 text-4xs font-semibold",
4
4
  sm: "w-6 h-6 text-2xs font-semibold",
5
5
  md: "w-9 h-9 text-sm font-semibold",
6
6
  lg: "w-12 h-12 text-lg font-semibold",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.es.js","sources":["../../../src/components/user-avatar/constants.ts"],"sourcesContent":["export const sizeClasses = {\n '2xs': 'w-3 h-3 text-5xs font-semibold',\n xs: 'w-4 h-4 text-4xs font-semibold',\n sm: 'w-6 h-6 text-2xs font-semibold',\n md: 'w-9 h-9 text-sm font-semibold',\n lg: 'w-12 h-12 text-lg font-semibold',\n xl: 'w-16 h-16 text-2xl font-semibold',\n};\n\n// Font size only (no width/height), for the Typography wrapping the avatar initials.\nexport const initialsFontSizeClasses: Record<keyof typeof sizeClasses, string> = {\n '2xs': 'text-5xs',\n xs: 'text-4xs',\n sm: 'text-2xs',\n md: 'text-sm',\n lg: 'text-lg',\n xl: 'text-2xl',\n};\n\nexport const getInitials = (name: string) => {\n if (!name) return '';\n const nameArray = name?.split(' ');\n const initials =\n nameArray?.length === 1\n ? nameArray[0]?.charAt(0)?.toUpperCase()\n : nameArray[0]?.charAt(0)?.toUpperCase() +\n nameArray[nameArray?.length - 1]?.charAt(0)?.toUpperCase();\n return initials;\n};\n\n\n\n"],"names":["sizeClasses","initialsFontSizeClasses","getInitials","name","nameArray"],"mappings":"AAAO,MAAMA,IAAc;AAAA,EACzB,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAGaC,IAAoE;AAAA,EAC/E,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEaC,IAAc,CAACC,MAAiB;AAC3C,MAAI,CAACA,EAAM,QAAO;AAClB,QAAMC,IAAYD,GAAM,MAAM,GAAG;AAMjC,SAJEC,GAAW,WAAW,IAClBA,EAAU,CAAC,GAAG,OAAO,CAAC,GAAG,YAAA,IACzBA,EAAU,CAAC,GAAG,OAAO,CAAC,GAAG,YAAA,IACzBA,EAAUA,GAAW,SAAS,CAAC,GAAG,OAAO,CAAC,GAAG,YAAA;AAErD;"}
1
+ {"version":3,"file":"constants.es.js","sources":["../../../src/components/user-avatar/constants.ts"],"sourcesContent":["export const sizeClasses = {\n '2xs': 'w-3 h-3 text-5xs font-semibold',\n xs: 'w-5 h-5 text-4xs font-semibold',\n sm: 'w-6 h-6 text-2xs font-semibold',\n md: 'w-9 h-9 text-sm font-semibold',\n lg: 'w-12 h-12 text-lg font-semibold',\n xl: 'w-16 h-16 text-2xl font-semibold',\n};\n\n// Font size only (no width/height), for the Typography wrapping the avatar initials.\nexport const initialsFontSizeClasses: Record<keyof typeof sizeClasses, string> = {\n '2xs': 'text-5xs',\n xs: 'text-4xs',\n sm: 'text-2xs',\n md: 'text-sm',\n lg: 'text-lg',\n xl: 'text-2xl',\n};\n\nexport const getInitials = (name: string) => {\n if (!name) return '';\n const nameArray = name?.split(' ');\n const initials =\n nameArray?.length === 1\n ? nameArray[0]?.charAt(0)?.toUpperCase()\n : nameArray[0]?.charAt(0)?.toUpperCase() +\n nameArray[nameArray?.length - 1]?.charAt(0)?.toUpperCase();\n return initials;\n};\n\n\n\n"],"names":["sizeClasses","initialsFontSizeClasses","getInitials","name","nameArray"],"mappings":"AAAO,MAAMA,IAAc;AAAA,EACzB,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAGaC,IAAoE;AAAA,EAC/E,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEaC,IAAc,CAACC,MAAiB;AAC3C,MAAI,CAACA,EAAM,QAAO;AAClB,QAAMC,IAAYD,GAAM,MAAM,GAAG;AAMjC,SAJEC,GAAW,WAAW,IAClBA,EAAU,CAAC,GAAG,OAAO,CAAC,GAAG,YAAA,IACzBA,EAAU,CAAC,GAAG,OAAO,CAAC,GAAG,YAAA,IACzBA,EAAUA,GAAW,SAAS,CAAC,GAAG,OAAO,CAAC,GAAG,YAAA;AAErD;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lax-wp/design-system",
3
3
  "private": false,
4
- "version": "0.13.55",
4
+ "version": "0.13.57",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.es.js",