@worknice/whiteboard 0.55.4 → 0.57.0

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.
Files changed (72) hide show
  1. package/dist/controls/ButtonCard.stories.js +2 -2
  2. package/dist/controls/MenuButton_module.css +3 -3
  3. package/dist/hud/NavItem_module.css +13 -0
  4. package/dist/hud/NavSection.js +3 -2
  5. package/dist/hud/NavSection_module.css +21 -0
  6. package/dist/hud/ToolbarButton_module.css +7 -7
  7. package/dist/icons/ArrowTurnLeftUpIcon.d.ts +3 -0
  8. package/dist/icons/ArrowTurnLeftUpIcon.js +12 -0
  9. package/dist/icons/CalendarIcon.js +2 -2
  10. package/dist/icons/DirectoryIcon.d.ts +3 -0
  11. package/dist/icons/DirectoryIcon.js +11 -0
  12. package/dist/icons/InsightsIcon.js +6 -3
  13. package/dist/icons/LeaveIcon.js +2 -2
  14. package/dist/icons/PaperworkIcon.js +6 -3
  15. package/dist/icons/PeopleIcon.js +21 -4
  16. package/dist/icons/PositionsIcon.js +42 -6
  17. package/dist/icons/ProfileIcon.js +18 -4
  18. package/dist/icons/ReviewIcon.js +16 -4
  19. package/dist/icons/TableIcon.js +2 -2
  20. package/dist/icons/TaskIcon.js +2 -2
  21. package/dist/icons/WorkflowsIcon.js +23 -4
  22. package/dist/icons/index.d.ts +2 -0
  23. package/dist/icons/index.js +3 -1
  24. package/dist/layouts/FullLayout.d.ts +2 -2
  25. package/dist/layouts/FullLayout.js +15 -36
  26. package/dist/layouts/FullLayout.module.js +1 -2
  27. package/dist/layouts/FullLayout_module.css +7 -43
  28. package/dist/layouts/MinimalLayout.js +2 -2
  29. package/dist/presentation/Avatar.d.ts +41 -6
  30. package/dist/presentation/Avatar.js +206 -20
  31. package/dist/presentation/Avatar.module.js +10 -1
  32. package/dist/presentation/Avatar.stories.d.ts +63 -0
  33. package/dist/presentation/Avatar.stories.js +94 -0
  34. package/dist/presentation/Avatar_module.css +123 -7
  35. package/dist/presentation/Badge_module.css +10 -9
  36. package/dist/presentation/Icon.d.ts +1 -1
  37. package/dist/presentation/Icon.stories.d.ts +1 -1
  38. package/dist/presentation/Logo.d.ts +8 -0
  39. package/dist/presentation/Logo.js +27 -0
  40. package/dist/presentation/Logo.module.js +5 -0
  41. package/dist/presentation/Logo.stories.d.ts +22 -0
  42. package/dist/presentation/Logo.stories.js +24 -0
  43. package/dist/presentation/Logo_module.css +10 -0
  44. package/dist/presentation/PersonCover.d.ts +2 -2
  45. package/dist/presentation/PersonCover.js +2 -2
  46. package/dist/presentation/PersonCover.stories.d.ts +67 -0
  47. package/dist/presentation/PersonCover.stories.js +39 -0
  48. package/dist/presentation/PlainText.d.ts +1 -1
  49. package/dist/presentation/RichList/RichList.js +11 -1
  50. package/dist/presentation/RichList/RichListRow.js +16 -3
  51. package/dist/presentation/RichList/stories/ComplianceGroups.js +21 -1
  52. package/dist/presentation/RichList/stories/CustomFields.js +1 -0
  53. package/dist/presentation/RichList/stories/EmployeePeople.js +20 -18
  54. package/dist/presentation/RichList/stories/Leave.js +23 -23
  55. package/dist/presentation/RichList/stories/Paperwork.js +18 -18
  56. package/dist/presentation/RichList/stories/PaperworkApprovals.js +52 -50
  57. package/dist/presentation/RichList/stories/PeopleList.js +19 -19
  58. package/dist/presentation/RichList/stories/PeopleTags.js +1 -0
  59. package/dist/presentation/RichList/stories/Positions.js +53 -53
  60. package/dist/presentation/RichList/stories/Reviews.js +11 -11
  61. package/dist/presentation/RichList/stories/SavedQuestions.js +1 -0
  62. package/dist/presentation/RichList/stories/Tasks.js +34 -34
  63. package/dist/presentation/RichList/stories/shared.d.ts +0 -1
  64. package/dist/presentation/RichList/stories/shared.js +0 -2
  65. package/dist/presentation/RichList/types.d.ts +7 -2
  66. package/dist/presentation/Tag_module.css +10 -9
  67. package/dist/shared.css +1 -0
  68. package/dist/utils/storybook.d.ts +2 -0
  69. package/dist/utils/storybook.js +2 -1
  70. package/package.json +4 -4
  71. package/dist/presentation/PersonAvatar.d.ts +0 -18
  72. package/dist/presentation/PersonAvatar.js +0 -90
@@ -10,21 +10,18 @@ import * as __WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__ from "./F
10
10
  const FullLayout = ({ aside, asidePosition = {
11
11
  desktop: "asideLast",
12
12
  mobile: "asideFirst"
13
- }, backLink, navigation, brandTypeface, children, header, mainNavChildren, menuState, navTitle, setMenuState, summary, toolbarChildren, layoutType })=>{
14
- const { router } = (0, __WEBPACK_EXTERNAL_MODULE__utils_useNextContext_js_47529181__["default"])();
13
+ }, backLink, navigation, brandTypeface, children, header, mainNavChildren, menuState, navTitle, setMenuState, summary, toolbarChildren, padding = "default" })=>{
14
+ const { pathname } = (0, __WEBPACK_EXTERNAL_MODULE__utils_useNextContext_js_47529181__["default"])();
15
15
  const toggleRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
16
16
  const navRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
17
+ const prevPathnameRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
17
18
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
18
- if (!router) return;
19
- const routeChangeStart = ()=>{
19
+ if (null !== prevPathnameRef.current && prevPathnameRef.current !== pathname) {
20
20
  if (window.innerWidth < 1440) setMenuState("closed");
21
- };
22
- router.events.on("routeChangeStart", routeChangeStart);
23
- return ()=>{
24
- router.events.off("routeChangeStart", routeChangeStart);
25
- };
21
+ }
22
+ prevPathnameRef.current = pathname;
26
23
  }, [
27
- router,
24
+ pathname,
28
25
  setMenuState
29
26
  ]);
30
27
  (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
@@ -64,6 +61,7 @@ const FullLayout = ({ aside, asidePosition = {
64
61
  setMenuState((current)=>"open" === current ? "closed" : "open");
65
62
  },
66
63
  title: "Toggle Sidebar",
64
+ type: "ghost",
67
65
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__hud_SidebarIcon_js_fabd050a__["default"], {})
68
66
  })
69
67
  }),
@@ -91,32 +89,13 @@ const FullLayout = ({ aside, asidePosition = {
91
89
  })
92
90
  ]
93
91
  }) : null,
94
- "centered" === layoutType ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
95
- className: __WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].centerLayoutContent,
96
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("main", {
97
- children: children
98
- })
99
- }) : "narrow" === layoutType ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
100
- className: __WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].narrowLayoutContent,
101
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("main", {
102
- className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])([
103
- __WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].main,
104
- __WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].full
105
- ]),
106
- children: [
107
- header ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
108
- className: __WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].header,
109
- children: header
110
- }) : null,
111
- summary ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("aside", {
112
- className: __WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].summary,
113
- children: summary
114
- }) : null,
115
- children
116
- ]
117
- })
118
- }) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
119
- className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].content, "asideFirst" === asidePosition.desktop ? __WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].contentAsideFirstDesktop : __WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].contentAsideLastDesktop, "asideFirst" === asidePosition.mobile ? __WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].contentAsideFirstMobile : __WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].contentAsideLastMobile),
92
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
93
+ className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].content, "default" === padding && __WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].padded, aside && {
94
+ [__WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].contentAsideFirstDesktop]: "asideFirst" === asidePosition.desktop,
95
+ [__WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].contentAsideLastDesktop]: "asideLast" === asidePosition.desktop,
96
+ [__WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].contentAsideFirstMobile]: "asideFirst" === asidePosition.mobile,
97
+ [__WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].contentAsideLastMobile]: "asideLast" === asidePosition.mobile
98
+ }),
120
99
  children: [
121
100
  header ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
122
101
  className: __WEBPACK_EXTERNAL_MODULE__FullLayout_module_js_d92e323f__["default"].header,
@@ -17,9 +17,8 @@ const FullLayout_module_rslib_entry_ = {
17
17
  contentAsideLastMobile: "contentAsideLastMobile-nY6jcb",
18
18
  main: "main-bb8i9x",
19
19
  full: "full-BIhVlq",
20
- centerLayoutContent: "centerLayoutContent-OXDuxB",
21
- narrowLayoutContent: "narrowLayoutContent-v6PtTH",
22
20
  content: "content-kaxfp0",
21
+ padded: "padded-L3X4Ui",
23
22
  contentAsideFirstDesktop: "contentAsideFirstDesktop-bKnZtC"
24
23
  };
25
24
  export { FullLayout_module_rslib_entry_ as default };
@@ -38,6 +38,7 @@
38
38
  .closed-iSkj26 .toggle-GcG0Tq {
39
39
  -webkit-backdrop-filter: blur(20px);
40
40
  backdrop-filter: blur(20px);
41
+ color: var(--tone-default);
41
42
  background: #ffffffb3;
42
43
  box-shadow: 0 0 0 .5px #3c3c435c;
43
44
  }
@@ -71,7 +72,6 @@
71
72
  font-family: var(--typeface-system);
72
73
  bottom: 0;
73
74
  left: calc(-1 * var(--nav-width) - 1px);
74
- letter-spacing: -.5px;
75
75
  -webkit-user-select: none;
76
76
  user-select: none;
77
77
  width: var(--nav-width);
@@ -165,57 +165,21 @@
165
165
  grid-column: 1 / -1;
166
166
  }
167
167
 
168
- .centerLayoutContent-OXDuxB {
169
- min-height: 100vh;
170
- padding: var(--size-00) var(--size-00);
171
- justify-content: center;
172
- align-items: center;
173
- display: flex;
174
- }
175
-
176
- @media (min-width: 768px) {
177
- .centerLayoutContent-OXDuxB {
178
- padding: var(--size-p3) var(--size-p3);
179
- }
180
- }
181
-
182
- @media (min-width: 1440px) {
183
- .centerLayoutContent-OXDuxB {
184
- padding: var(--size-p4) var(--size-p4);
185
- }
186
- }
187
-
188
- .narrowLayoutContent-v6PtTH {
189
- padding: 60px var(--size-00) var(--size-00);
190
- grid-template-columns: minmax(0, 720px);
191
- justify-content: center;
168
+ .content-kaxfp0 {
169
+ column-gap: var(--size-p1);
170
+ row-gap: var(--size-p1);
192
171
  display: grid;
193
172
  }
194
173
 
195
- @media (min-width: 768px) {
196
- .narrowLayoutContent-v6PtTH {
197
- padding: 60px var(--size-p3) var(--size-p3);
198
- }
199
- }
200
-
201
- @media (min-width: 1440px) {
202
- .narrowLayoutContent-v6PtTH {
203
- padding: 60px var(--size-p4) var(--size-p4);
204
- }
205
- }
206
-
207
- .content-kaxfp0 {
174
+ .content-kaxfp0.padded-L3X4Ui {
208
175
  padding-top: 60px;
209
176
  padding-bottom: var(--size-00);
210
177
  padding-left: var(--size-00);
211
178
  padding-right: var(--size-00);
212
- column-gap: var(--size-p1);
213
- row-gap: var(--size-p1);
214
- display: grid;
215
179
  }
216
180
 
217
181
  @media (min-width: 768px) {
218
- .content-kaxfp0 {
182
+ .content-kaxfp0.padded-L3X4Ui {
219
183
  padding: 60px var(--size-p3) var(--size-p3);
220
184
  }
221
185
  }
@@ -231,7 +195,7 @@
231
195
  }
232
196
 
233
197
  @media (min-width: 1440px) {
234
- .content-kaxfp0 {
198
+ .content-kaxfp0.padded-L3X4Ui {
235
199
  padding-bottom: var(--size-p4);
236
200
  padding-left: var(--size-p4);
237
201
  padding-right: var(--size-p4);
@@ -4,7 +4,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__MinimalLayout_module_js_ad0496a2__ from "
4
4
  const MinimalLayout = ({ backLink, brandTypeface, children, toolbarItems })=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE__BaseLayout_js_b37d1475__["default"], {
5
5
  brandTypeface: brandTypeface,
6
6
  children: [
7
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
7
+ toolbarItems || backLink ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
8
8
  className: __WEBPACK_EXTERNAL_MODULE__MinimalLayout_module_js_ad0496a2__["default"].toolbar,
9
9
  children: [
10
10
  toolbarItems ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
@@ -23,7 +23,7 @@ const MinimalLayout = ({ backLink, brandTypeface, children, toolbarItems })=>/*#
23
23
  children: backLink
24
24
  }) : null
25
25
  ]
26
- }),
26
+ }) : null,
27
27
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("main", {
28
28
  className: __WEBPACK_EXTERNAL_MODULE__MinimalLayout_module_js_ad0496a2__["default"].main,
29
29
  children: children
@@ -1,8 +1,43 @@
1
- type Props = {
2
- alt?: string;
3
- height?: number;
4
- src?: string;
5
- width?: number;
1
+ import type { ComponentProps, MouseEvent, ReactNode } from "react";
2
+ import Icon from "./Icon";
3
+ export type IconSymbol = ComponentProps<typeof Icon>["symbol"];
4
+ type AvatarBaseProps = {
5
+ id: string;
6
+ size?: keyof typeof SIZES;
7
+ name?: string;
8
+ imageUrl?: string | null;
9
+ /**
10
+ * The background hue of the avatar when only name is provided.
11
+ * @default "280" (blue)
12
+ */
13
+ hue?: string;
14
+ /**
15
+ * Small icon displayed on the bottom right of the avatar.
16
+ */
17
+ badgeIcon?: IconSymbol;
18
+ /**
19
+ * Icon displayed on over the avatar when hovered.
20
+ * Useful for indicating an action.
21
+ */
22
+ hoverIcon?: IconSymbol;
23
+ onClick?: (event: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;
6
24
  };
7
- declare const Avatar: ({ src, width, height, alt }: Props) => import("react/jsx-runtime").JSX.Element;
25
+ type Props = (AvatarBaseProps & {
26
+ href: string;
27
+ children?: never;
28
+ }) | (AvatarBaseProps & {
29
+ href?: never;
30
+ children: (onClose: () => void) => ReactNode;
31
+ }) | (AvatarBaseProps & {
32
+ href?: never;
33
+ children?: never;
34
+ });
35
+ declare const SIZES: {
36
+ readonly xtiny: 16;
37
+ readonly tiny: 24;
38
+ readonly small: 48;
39
+ readonly large: 96;
40
+ readonly xlarge: 192;
41
+ };
42
+ declare const Avatar: ({ id, size, name, imageUrl, hue, badgeIcon, hoverIcon, href, onClick, children, }: Props) => import("react/jsx-runtime").JSX.Element;
8
43
  export default Avatar;
@@ -1,26 +1,212 @@
1
+ "use client";
1
2
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
- import * as __WEBPACK_EXTERNAL_MODULE__utils_customProperties_js_aeb40bdf__ from "../utils/customProperties.js";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_clsx__ from "clsx";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
3
5
  import * as __WEBPACK_EXTERNAL_MODULE__utils_useNextContext_js_47529181__ from "../utils/useNextContext.js";
4
6
  import * as __WEBPACK_EXTERNAL_MODULE__Avatar_module_js_f95d762b__ from "./Avatar.module.js";
5
- const Avatar = ({ src, width = 48, height = 48, alt })=>{
6
- const { Image } = (0, __WEBPACK_EXTERNAL_MODULE__utils_useNextContext_js_47529181__["default"])();
7
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
8
- className: __WEBPACK_EXTERNAL_MODULE__Avatar_module_js_f95d762b__["default"].container,
9
- style: (0, __WEBPACK_EXTERNAL_MODULE__utils_customProperties_js_aeb40bdf__["default"])({
10
- "--height": `${height}px`,
11
- "--width": `${width}px`
12
- }),
13
- children: src ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Image, {
14
- alt: alt ?? "",
15
- height: height,
16
- quality: 100,
17
- src: src,
18
- style: {
19
- width,
20
- height
21
- },
22
- width: width
23
- }) : null
7
+ import * as __WEBPACK_EXTERNAL_MODULE__Icon_js_0d271bb6__ from "./Icon.js";
8
+ const DEFAULT_HUE = "280";
9
+ const SIZES = {
10
+ xtiny: 16,
11
+ tiny: 24,
12
+ small: 48,
13
+ large: 96,
14
+ xlarge: 192
15
+ };
16
+ const getInitials = (name)=>{
17
+ const names = name.trim().split(/[\s-]+/);
18
+ return names.length <= 3 ? names.map((name)=>[
19
+ ...name
20
+ ][0]).join("") : [
21
+ ...names[0]
22
+ ][0] + [
23
+ ...names[names.length - 1]
24
+ ][0];
25
+ };
26
+ const hoverIconLayout = (avatarPx)=>{
27
+ if (avatarPx >= 160) return {
28
+ size: "xlarge"
29
+ };
30
+ if (avatarPx >= 88) return {
31
+ size: "large",
32
+ scaled: true
33
+ };
34
+ if (avatarPx >= 56) return {
35
+ size: "large"
36
+ };
37
+ if (avatarPx < 28) return {
38
+ size: "xsmall"
39
+ };
40
+ if (avatarPx < 40) return {
41
+ size: "small"
42
+ };
43
+ return {
44
+ size: "default"
45
+ };
46
+ };
47
+ const placeholderIconSize = (px)=>{
48
+ if (px <= 24) return "xsmall";
49
+ if (px <= 48) return "large";
50
+ return "xlarge";
51
+ };
52
+ const badgeIconSize = (avatarPx)=>{
53
+ const badgePx = Math.max(14, 0.31 * avatarPx);
54
+ if (badgePx < 17) return "xsmall";
55
+ if (badgePx < 22) return "small";
56
+ if (badgePx < 32) return "default";
57
+ if (badgePx < 46) return "large";
58
+ return "xlarge";
59
+ };
60
+ const Avatar = ({ id, size = "large", name, imageUrl, hue = DEFAULT_HUE, badgeIcon, hoverIcon, href, onClick, children })=>{
61
+ const { Link } = (0, __WEBPACK_EXTERNAL_MODULE__utils_useNextContext_js_47529181__["default"])();
62
+ const [showChildren, setShowChildren] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
63
+ const px = SIZES[size];
64
+ const trimmedName = name?.trim() ?? "";
65
+ const hasPhoto = Boolean(imageUrl);
66
+ const hasInitials = !hasPhoto && trimmedName.length > 0;
67
+ const isPlaceholder = !hasPhoto && !hasInitials;
68
+ const rootStyle = {
69
+ "--avatar-size": `${px}px`
70
+ };
71
+ const iconLayout = hoverIconLayout(px);
72
+ const interactive = null != href || null != children;
73
+ const mediaClass = (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__Avatar_module_js_f95d762b__["default"].media, interactive && __WEBPACK_EXTERNAL_MODULE__Avatar_module_js_f95d762b__["default"].mediaInteractive);
74
+ const svg = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("svg", {
75
+ className: __WEBPACK_EXTERNAL_MODULE__Avatar_module_js_f95d762b__["default"].svg,
76
+ height: px,
77
+ viewBox: "0 0 96 96",
78
+ width: px,
79
+ children: hasPhoto ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
80
+ children: [
81
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("defs", {
82
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("pattern", {
83
+ id: `${id}-pattern`,
84
+ height: "96",
85
+ patternUnits: "userSpaceOnUse",
86
+ width: "96",
87
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("image", {
88
+ height: "96",
89
+ href: imageUrl ?? void 0,
90
+ preserveAspectRatio: "xMidYMid slice",
91
+ width: "96"
92
+ })
93
+ })
94
+ }),
95
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("circle", {
96
+ cx: "48",
97
+ cy: "48",
98
+ fill: "none",
99
+ r: "48"
100
+ }),
101
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("circle", {
102
+ cx: "48",
103
+ cy: "48",
104
+ fill: `url(#${id}-pattern)`,
105
+ r: "48"
106
+ })
107
+ ]
108
+ }) : hasInitials ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
109
+ children: [
110
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("circle", {
111
+ cx: "48",
112
+ cy: "48",
113
+ fill: `oklch(67.4% 0.1215 ${hue})`,
114
+ r: "48"
115
+ }),
116
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("text", {
117
+ fill: "#fff",
118
+ fontSize: 36,
119
+ textAnchor: "middle",
120
+ x: 48,
121
+ y: 62,
122
+ children: getInitials(trimmedName)
123
+ })
124
+ ]
125
+ }) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
126
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("circle", {
127
+ cx: "48",
128
+ cy: "48",
129
+ fill: "var(--color-grey-t10)",
130
+ r: "48",
131
+ stroke: "var(--color-grey-t08)",
132
+ strokeWidth: 1
133
+ })
134
+ })
135
+ });
136
+ const inner = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("span", {
137
+ className: __WEBPACK_EXTERNAL_MODULE__Avatar_module_js_f95d762b__["default"].avatarInner,
138
+ children: [
139
+ svg,
140
+ isPlaceholder ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
141
+ className: __WEBPACK_EXTERNAL_MODULE__Avatar_module_js_f95d762b__["default"].placeholderIconWrap,
142
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__Icon_js_0d271bb6__["default"], {
143
+ symbol: "Profile",
144
+ size: placeholderIconSize(px),
145
+ tone: "muted"
146
+ })
147
+ }) : null
148
+ ]
149
+ });
150
+ const labelledBy = trimmedName || "Profile";
151
+ const media = null != href ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Link, {
152
+ "aria-label": labelledBy,
153
+ className: mediaClass,
154
+ href: href,
155
+ onClick: onClick,
156
+ children: inner
157
+ }) : null != children ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("button", {
158
+ "aria-expanded": showChildren,
159
+ "aria-label": labelledBy,
160
+ className: mediaClass,
161
+ type: "button",
162
+ onClick: (event)=>{
163
+ if (onClick) onClick(event);
164
+ else setShowChildren(true);
165
+ },
166
+ children: inner
167
+ }) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
168
+ className: mediaClass,
169
+ children: inner
170
+ });
171
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.Fragment, {
172
+ children: [
173
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("span", {
174
+ className: __WEBPACK_EXTERNAL_MODULE__Avatar_module_js_f95d762b__["default"].root,
175
+ style: rootStyle,
176
+ children: [
177
+ media,
178
+ badgeIcon ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
179
+ "aria-hidden": true,
180
+ className: __WEBPACK_EXTERNAL_MODULE__Avatar_module_js_f95d762b__["default"].badge,
181
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
182
+ className: __WEBPACK_EXTERNAL_MODULE__Avatar_module_js_f95d762b__["default"].badgeGlyph,
183
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__Icon_js_0d271bb6__["default"], {
184
+ symbol: badgeIcon,
185
+ size: badgeIconSize(px),
186
+ tone: "default"
187
+ })
188
+ })
189
+ }) : null,
190
+ hoverIcon && interactive ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
191
+ "aria-hidden": true,
192
+ className: __WEBPACK_EXTERNAL_MODULE__Avatar_module_js_f95d762b__["default"].hoverIconOverlay,
193
+ children: iconLayout.scaled ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
194
+ className: __WEBPACK_EXTERNAL_MODULE__Avatar_module_js_f95d762b__["default"].hoverIconScaled,
195
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__Icon_js_0d271bb6__["default"], {
196
+ symbol: hoverIcon,
197
+ size: iconLayout.size
198
+ })
199
+ }) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__Icon_js_0d271bb6__["default"], {
200
+ symbol: hoverIcon,
201
+ size: iconLayout.size
202
+ })
203
+ }) : null
204
+ ]
205
+ }),
206
+ showChildren && children ? children(()=>{
207
+ setShowChildren(false);
208
+ }) : null
209
+ ]
24
210
  });
25
211
  };
26
212
  const Avatar_rslib_entry_ = Avatar;
@@ -1,5 +1,14 @@
1
1
  import "./Avatar_module.css";
2
2
  const Avatar_module_rslib_entry_ = {
3
- container: "container-PMPxkh"
3
+ root: "root-EiaKry",
4
+ media: "media-wRrTVs",
5
+ mediaInteractive: "mediaInteractive-dZHNzy",
6
+ avatarInner: "avatarInner-IL2fkD",
7
+ svg: "svg-ffgue0",
8
+ placeholderIconWrap: "placeholderIconWrap-i2HHwu",
9
+ badge: "badge-f6Iksi",
10
+ badgeGlyph: "badgeGlyph-hnwtyd",
11
+ hoverIconOverlay: "hoverIconOverlay-VNqOuN",
12
+ hoverIconScaled: "hoverIconScaled-hPDNBn"
4
13
  };
5
14
  export { Avatar_module_rslib_entry_ as default };
@@ -0,0 +1,63 @@
1
+ import type { StoryObj } from "@storybook/nextjs-vite";
2
+ declare const meta: {
3
+ component: ({ id, size, name, imageUrl, hue, badgeIcon, hoverIcon, href, onClick, children, }: ({
4
+ id: string;
5
+ size?: "small" | "large" | "xlarge" | "tiny" | "xtiny";
6
+ name?: string;
7
+ imageUrl?: string | null;
8
+ hue?: string;
9
+ badgeIcon?: import("./Avatar").IconSymbol;
10
+ hoverIcon?: import("./Avatar").IconSymbol;
11
+ onClick?: (event: import("react").MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;
12
+ } & {
13
+ href: string;
14
+ children?: never;
15
+ }) | ({
16
+ id: string;
17
+ size?: "small" | "large" | "xlarge" | "tiny" | "xtiny";
18
+ name?: string;
19
+ imageUrl?: string | null;
20
+ hue?: string;
21
+ badgeIcon?: import("./Avatar").IconSymbol;
22
+ hoverIcon?: import("./Avatar").IconSymbol;
23
+ onClick?: (event: import("react").MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;
24
+ } & {
25
+ href?: never;
26
+ children: (onClose: () => void) => import("react").ReactNode;
27
+ }) | ({
28
+ id: string;
29
+ size?: "small" | "large" | "xlarge" | "tiny" | "xtiny";
30
+ name?: string;
31
+ imageUrl?: string | null;
32
+ hue?: string;
33
+ badgeIcon?: import("./Avatar").IconSymbol;
34
+ hoverIcon?: import("./Avatar").IconSymbol;
35
+ onClick?: (event: import("react").MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;
36
+ } & {
37
+ href?: never;
38
+ children?: never;
39
+ })) => import("react/jsx-runtime").JSX.Element;
40
+ args: {
41
+ hue: string;
42
+ id: string;
43
+ imageUrl: string;
44
+ name: string;
45
+ size: "small";
46
+ };
47
+ };
48
+ export default meta;
49
+ type Story = StoryObj<typeof meta>;
50
+ /** Photo clipped to a circle via SVG pattern. */
51
+ export declare const WithPhoto: Story;
52
+ /** Initials on a hue-matched fill when there is no photo. */
53
+ export declare const Initials: Story;
54
+ /** Implicit placeholder when there is no photo and no name. */
55
+ export declare const Placeholder: Story;
56
+ export declare const WithBadgeIcon: Story;
57
+ export declare const WithHref: Story;
58
+ export declare const WithHoverIcon: Story;
59
+ /** Placeholder plus hover affordance and navigation. */
60
+ export declare const PlaceholderAddAction: Story;
61
+ export declare const Small: Story;
62
+ export declare const Xlarge: Story;
63
+ export declare const WithOnClickModal: Story;
@@ -0,0 +1,94 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE__controls_Button_js_f591ba2e__ from "../controls/Button.js";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__utils_storybook_js_3cc1ba9c__ from "../utils/storybook.js";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__Avatar_js_7e0bab6d__ from "./Avatar.js";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__Card_js_d67c086a__ from "./Card.js";
6
+ import * as __WEBPACK_EXTERNAL_MODULE__CardContent_js_20e3f6de__ from "./CardContent.js";
7
+ import * as __WEBPACK_EXTERNAL_MODULE__Modal_js_50f53bdf__ from "./Modal.js";
8
+ import * as __WEBPACK_EXTERNAL_MODULE__PlainText_js_cd0b6798__ from "./PlainText.js";
9
+ const meta = {
10
+ component: __WEBPACK_EXTERNAL_MODULE__Avatar_js_7e0bab6d__["default"],
11
+ args: {
12
+ hue: "280",
13
+ id: "person-avatar-story",
14
+ imageUrl: (0, __WEBPACK_EXTERNAL_MODULE__utils_storybook_js_3cc1ba9c__.avatarUrl)(12),
15
+ name: "Alex Morgan",
16
+ size: "small"
17
+ }
18
+ };
19
+ const Avatar_stories_rslib_entry_ = meta;
20
+ const WithPhoto = {};
21
+ const Initials = {
22
+ args: {
23
+ imageUrl: void 0,
24
+ name: "Alex Morgan"
25
+ }
26
+ };
27
+ const Placeholder = {
28
+ args: {
29
+ imageUrl: void 0,
30
+ name: void 0,
31
+ hue: void 0
32
+ }
33
+ };
34
+ const WithBadgeIcon = {
35
+ args: {
36
+ badgeIcon: "ArrowTurnLeftUp"
37
+ }
38
+ };
39
+ const WithHref = {
40
+ args: {
41
+ href: "#profile"
42
+ }
43
+ };
44
+ const WithHoverIcon = {
45
+ args: {
46
+ hoverIcon: "Edit",
47
+ href: "#edit-profile"
48
+ }
49
+ };
50
+ const PlaceholderAddAction = {
51
+ args: {
52
+ hoverIcon: "Plus",
53
+ href: "#add-person",
54
+ imageUrl: void 0,
55
+ name: void 0,
56
+ hue: void 0
57
+ }
58
+ };
59
+ const Small = {
60
+ args: {
61
+ size: "small"
62
+ }
63
+ };
64
+ const Xlarge = {
65
+ args: {
66
+ size: "xlarge"
67
+ }
68
+ };
69
+ const WithOnClickModal = {
70
+ args: {
71
+ hoverIcon: "Edit",
72
+ children: (onClose)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__Modal_js_50f53bdf__["default"], {
73
+ onClose: onClose,
74
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__Card_js_d67c086a__["default"], {
75
+ footer: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__controls_Button_js_f591ba2e__["default"], {
76
+ type: "secondary",
77
+ onClick: onClose,
78
+ children: "Close"
79
+ }),
80
+ header: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__PlainText_js_cd0b6798__["default"], {
81
+ font: "h6",
82
+ tagName: "h6",
83
+ children: "Profile"
84
+ }),
85
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__CardContent_js_20e3f6de__["default"], {
86
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__PlainText_js_cd0b6798__["default"], {
87
+ children: "Alex Morgan"
88
+ })
89
+ })
90
+ })
91
+ })
92
+ }
93
+ };
94
+ export { Initials, Placeholder, PlaceholderAddAction, Small, WithBadgeIcon, WithHoverIcon, WithHref, WithOnClickModal, WithPhoto, Xlarge, Avatar_stories_rslib_entry_ as default };