orcs-design-system 3.3.29 → 3.3.30

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.
@@ -336,6 +336,23 @@ export const keepInViewExample = () => /*#__PURE__*/_jsxs(Flex, {
336
336
  })]
337
337
  });
338
338
  keepInViewExample.storyName = "Keep In View Example";
339
+ export const circleVariantActionsMenu = () => /*#__PURE__*/_jsxs(ActionsMenu, {
340
+ variant: "circle",
341
+ children: [/*#__PURE__*/_jsx(ActionsMenuItem, {
342
+ href: "https://orchestrated.io/",
343
+ children: "Open details page"
344
+ }), /*#__PURE__*/_jsx(BrowserRouter, {
345
+ children: /*#__PURE__*/_jsx(ActionsMenuItem, {
346
+ as: Link,
347
+ to: "/",
348
+ children: "Edit"
349
+ })
350
+ }), /*#__PURE__*/_jsx(ActionsMenuItem, {
351
+ onClick: action("clicked"),
352
+ children: "Remove"
353
+ })]
354
+ });
355
+ circleVariantActionsMenu.storyName = "Circle Variant";
339
356
  defaultActionsMenu.__docgenInfo = {
340
357
  "description": "",
341
358
  "methods": [],
@@ -365,4 +382,9 @@ keepInViewExample.__docgenInfo = {
365
382
  "description": "",
366
383
  "methods": [],
367
384
  "displayName": "keepInViewExample"
385
+ };
386
+ circleVariantActionsMenu.__docgenInfo = {
387
+ "description": "",
388
+ "methods": [],
389
+ "displayName": "circleVariantActionsMenu"
368
390
  };
@@ -8,6 +8,7 @@ import useActionMenu from "./useActionMenu";
8
8
  import { crossFadeIn, beforeDotCollapsing, beforeDotExpanding, afterDotCollapsing, afterDotExpanding, beforeCrossExpanding, beforeCrossCollapsing, afterCrossExpanding, afterCrossCollapsing } from "./ActionsMenu.animations";
9
9
  import { FloatingFocusManager, FloatingPortal, useMergeRefs } from "@floating-ui/react";
10
10
  import { getFloatingUiRootElement, getFloatingUiZIndex } from "../../utils/floatingUiHelpers";
11
+ import { variant } from "styled-system";
11
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
13
  const ActionMenuContext = /*#__PURE__*/createContext({});
13
14
  const StyledActionsMenuContainer = styled.div.withConfig({
@@ -21,15 +22,35 @@ const Wrapper = styled.div.withConfig({
21
22
  const Control = styled.button.withConfig({
22
23
  displayName: "ActionsMenu__Control",
23
24
  componentId: "sc-yvbni2-2"
24
- })(["position:relative;background-color:", ";border:solid 1px ", ";display:flex;align-items:center;justify-content:center;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;text-decoration:none;text-align:center;border-radius:", ";transition:", ";cursor:pointer;width:30px;height:30px;&:hover,&:focus{outline:0;border-color:", ";}&[data-state=\"open\"] .actionsMenu__dots{&:before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&:after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}&[data-state=\"open\"] .actionsMenu__cross{&:before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&:after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}&[data-state=\"closed\"] .actionsMenu__dots{&:before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&:after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}&[data-state=\"closed\"] .actionsMenu__cross{&:before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&:after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}"], props => themeGet("colors.white")(props), props => themeGet("colors.greyLight")(props), props => themeGet("radii.2")(props), props => themeGet("transition.transitionDefault")(props), props => themeGet("colors.primary")(props), beforeDotCollapsing, afterDotCollapsing, beforeCrossExpanding, afterCrossExpanding, beforeDotExpanding, afterDotExpanding, beforeCrossCollapsing, afterCrossCollapsing);
25
+ })(["position:relative;display:flex;align-items:center;justify-content:center;-moz-appearance:none;-webkit-appearance:none;appearance:none;box-shadow:none;text-decoration:none;text-align:center;border-radius:", ";transition:", ";cursor:pointer;width:30px;height:30px;&:hover,&:focus{outline:0;border-color:", ";}", " &[data-state=\"open\"] .actionsMenu__dots{&:before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&:after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}&[data-state=\"open\"] .actionsMenu__cross{&:before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&:after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}&[data-state=\"closed\"] .actionsMenu__dots{&:before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&:after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}&[data-state=\"closed\"] .actionsMenu__cross{&:before{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}&:after{animation:500ms ", " cubic-bezier(0.68,-0.6,0.32,1.6) forwards;}}"], props => themeGet("radii.2")(props), props => themeGet("transition.transitionDefault")(props), props => themeGet("colors.primary")(props), variant({
26
+ prop: "variant",
27
+ variants: {
28
+ default: {
29
+ backgroundColor: "white",
30
+ border: "solid 1px",
31
+ borderColor: "greyLight",
32
+ width: "30px",
33
+ height: "30px",
34
+ borderRadius: 2
35
+ },
36
+ circle: {
37
+ backgroundColor: "greyDarkest",
38
+ border: "solid 2px",
39
+ borderColor: "greyDarkest",
40
+ width: "35px",
41
+ height: "35px",
42
+ borderRadius: "50%"
43
+ }
44
+ }
45
+ }), beforeDotCollapsing, afterDotCollapsing, beforeCrossExpanding, afterCrossExpanding, beforeDotExpanding, afterDotExpanding, beforeCrossCollapsing, afterCrossCollapsing);
25
46
  const Dots = styled.div.withConfig({
26
47
  displayName: "ActionsMenu__Dots",
27
48
  componentId: "sc-yvbni2-3"
28
- })(["border-radius:2px;height:4px;width:4px;background-color:", ";&:before,&:after{content:\"\";display:block;position:absolute;border-radius:2px;height:4px;width:4px;background-color:", ";}&:before{transform:translate(0,-6px);}&:after{transform:translate(0,6px);}"], props => themeGet("colors.greyDarker")(props), props => themeGet("colors.greyDarker")(props));
49
+ })(["border-radius:2px;height:4px;width:4px;background-color:", ";&:before,&:after{content:\"\";display:block;position:absolute;border-radius:2px;height:4px;width:4px;background-color:", ";}&:before{transform:translate(0,-6px);}&:after{transform:translate(0,6px);}"], props => props.variant === "circle" ? themeGet("colors.white")(props) : themeGet("colors.greyDarker")(props), props => props.variant === "circle" ? themeGet("colors.white")(props) : themeGet("colors.greyDarker")(props));
29
50
  const Cross = styled.div.withConfig({
30
51
  displayName: "ActionsMenu__Cross",
31
52
  componentId: "sc-yvbni2-4"
32
- })(["animation:1500ms ", " ease-in-out forwards;opacity:0;position:absolute;left:calc(50% - 2px);top:calc(50% - 2px);&:before,&:after{content:\"\";display:block;position:absolute;border-radius:2px;height:4px;width:4px;background-color:", ";}&:before{transform:rotate(-45deg);}&:after{transform:rotate(45deg);}"], crossFadeIn, props => themeGet("colors.greyDarker")(props));
53
+ })(["animation:1500ms ", " ease-in-out forwards;opacity:0;position:absolute;left:calc(50% - 2px);top:calc(50% - 2px);&:before,&:after{content:\"\";display:block;position:absolute;border-radius:2px;height:4px;width:4px;background-color:", ";}&:before{transform:rotate(-45deg);}&:after{transform:rotate(45deg);}"], crossFadeIn, props => props.variant === "circle" ? themeGet("colors.white")(props) : themeGet("colors.greyDarker")(props));
33
54
  const Menu = styled.div.withConfig({
34
55
  displayName: "ActionsMenu__Menu",
35
56
  componentId: "sc-yvbni2-5"
@@ -128,6 +149,7 @@ export const ActionsMenuBody = _ref2 => {
128
149
  closeMenu,
129
150
  closeOnClick = false,
130
151
  "data-testid": dataTestId = "ActionsMenu",
152
+ variant = "default",
131
153
  ...props
132
154
  } = _ref2;
133
155
  const id = useId();
@@ -157,10 +179,13 @@ export const ActionsMenuBody = _ref2 => {
157
179
  }), [ariaLabel, onTriggerFocus, id, actionMenu, onToggle, props, triggerRef, dataTestId]);
158
180
  let triggerComponent = /*#__PURE__*/_jsxs(Control, {
159
181
  ...triggerProps,
182
+ variant: variant,
160
183
  children: [/*#__PURE__*/_jsx(Dots, {
161
- className: "actionsMenu__dots"
184
+ className: "actionsMenu__dots",
185
+ variant: variant
162
186
  }), /*#__PURE__*/_jsx(Cross, {
163
- className: "actionsMenu__cross"
187
+ className: "actionsMenu__cross",
188
+ variant: variant
164
189
  })]
165
190
  });
166
191
  if (renderTrigger) {
@@ -257,7 +282,8 @@ ActionsMenuBody.propTypes = {
257
282
  "data-testid": PropTypes.string,
258
283
  children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
259
284
  theme: PropTypes.object,
260
- ariaLabel: PropTypes.string
285
+ ariaLabel: PropTypes.string,
286
+ variant: PropTypes.oneOf(["default", "circle"])
261
287
  };
262
288
  const ActionsMenu = /*#__PURE__*/React.forwardRef((props, ref) => {
263
289
  const [toggleState, setToggle] = useState(false);
@@ -288,7 +314,9 @@ ActionsMenu.propTypes = {
288
314
  /** Specifies the colour theme */
289
315
  theme: PropTypes.object,
290
316
  /** Specifies the aria-label for the button */
291
- ariaLabel: PropTypes.string
317
+ ariaLabel: PropTypes.string,
318
+ /** Specifies the variant of the ActionsMenu */
319
+ variant: PropTypes.oneOf(["default", "circle"])
292
320
  };
293
321
  ActionsMenu.__docgenInfo = {
294
322
  "description": "",
@@ -395,6 +423,20 @@ ActionsMenu.__docgenInfo = {
395
423
  "name": "string"
396
424
  },
397
425
  "required": false
426
+ },
427
+ "variant": {
428
+ "description": "Specifies the variant of the ActionsMenu",
429
+ "type": {
430
+ "name": "enum",
431
+ "value": [{
432
+ "value": "\"default\"",
433
+ "computed": false
434
+ }, {
435
+ "value": "\"circle\"",
436
+ "computed": false
437
+ }]
438
+ },
439
+ "required": false
398
440
  }
399
441
  }
400
442
  };
@@ -448,6 +490,24 @@ ActionsMenuBody.__docgenInfo = {
448
490
  },
449
491
  "required": false
450
492
  },
493
+ "variant": {
494
+ "defaultValue": {
495
+ "value": "\"default\"",
496
+ "computed": false
497
+ },
498
+ "description": "",
499
+ "type": {
500
+ "name": "enum",
501
+ "value": [{
502
+ "value": "\"default\"",
503
+ "computed": false
504
+ }, {
505
+ "value": "\"circle\"",
506
+ "computed": false
507
+ }]
508
+ },
509
+ "required": false
510
+ },
451
511
  "onTriggerFocus": {
452
512
  "description": "",
453
513
  "type": {
@@ -5,6 +5,7 @@ import Box from "../Box";
5
5
  import Spacer from "../Spacer";
6
6
  import StyledLink from "../StyledLink";
7
7
  import Avatar from ".";
8
+ import { action } from "@storybook/addon-actions";
8
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
10
  export default {
10
11
  title: "Components/Avatar",
@@ -368,6 +369,41 @@ export const alternateShapes = () => /*#__PURE__*/_jsxs(Spacer, {
368
369
  })]
369
370
  });
370
371
  alternateShapes.storyName = "Alternate Shapes";
372
+ export const headerAvatarVariants = () => {
373
+ const handleClick = action("Button action triggered");
374
+ return /*#__PURE__*/_jsxs(Flex, {
375
+ gap: "xxl",
376
+ alignItems: "center",
377
+ p: "xxl",
378
+ bg: "greyDarkest",
379
+ children: [/*#__PURE__*/_jsx(Avatar, {
380
+ headerAvatar: true,
381
+ sizing: "large",
382
+ image: "https://randomuser.me/api/portraits/men/32.jpg",
383
+ imageAlt: "Avatar for John Doe",
384
+ onClick: handleClick
385
+ }), /*#__PURE__*/_jsx(Avatar, {
386
+ headerAvatar: true,
387
+ sizing: "small",
388
+ image: "https://randomuser.me/api/portraits/men/32.jpg",
389
+ imageAlt: "Avatar for John Doe"
390
+ }), /*#__PURE__*/_jsx(Avatar, {
391
+ headerAvatar: true,
392
+ sizing: "large",
393
+ shape: "square",
394
+ image: "https://images.unsplash.com/photo-1464802686167-b939a6910659?q=80&w=3500&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
395
+ imageAlt: "Avatar for Nebula UI",
396
+ onClick: handleClick
397
+ }), /*#__PURE__*/_jsx(Avatar, {
398
+ headerAvatar: true,
399
+ sizing: "small",
400
+ shape: "square",
401
+ image: "https://images.unsplash.com/photo-1464802686167-b939a6910659?q=80&w=3500&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
402
+ imageAlt: "Avatar for Nebula UI"
403
+ })]
404
+ });
405
+ };
406
+ headerAvatarVariants.storyName = "Header Avatar Variants";
371
407
  defaultAvatar.__docgenInfo = {
372
408
  "description": "",
373
409
  "methods": [],
@@ -432,4 +468,9 @@ alternateShapes.__docgenInfo = {
432
468
  "description": "",
433
469
  "methods": [],
434
470
  "displayName": "alternateShapes"
471
+ };
472
+ headerAvatarVariants.__docgenInfo = {
473
+ "description": "",
474
+ "methods": [],
475
+ "displayName": "headerAvatarVariants"
435
476
  };
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo } from "react";
2
2
  import styled, { ThemeProvider } from "styled-components";
3
- import { space, layout, variant } from "styled-system";
3
+ import { space, layout, variant, position, compose } from "styled-system";
4
4
  import PropTypes from "prop-types";
5
5
  import Header, { Text } from "../Typography";
6
6
  import Icon from "../Icon";
@@ -9,14 +9,28 @@ import StatusDot from "../StatusDot";
9
9
  import css from "@styled-system/css";
10
10
  import { themeGet } from "@styled-system/theme-get";
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ const avatarStyles = compose(space, layout, position);
13
+
14
+ // Helper function to resolve customSize values
15
+ const resolveCustomSize = (customSize, props) => {
16
+ if (!customSize) return null;
17
+
18
+ // Check if customSize is a pixel value or a theme value
19
+ if (customSize.includes("px") || customSize.includes("rem") || customSize.includes("em") || customSize.includes("%")) {
20
+ return customSize;
21
+ } else {
22
+ // It's a theme value, resolve it using themeGet
23
+ return themeGet(`avatarScale.${customSize}`)(props) || customSize;
24
+ }
25
+ };
12
26
  const AvatarWrapper = styled("div").withConfig({
13
27
  displayName: "Avatar__AvatarWrapper",
14
28
  componentId: "sc-1wtet2j-0"
15
- })(layout, space, css({
29
+ })(css({
16
30
  boxSizing: "border-box",
17
- position: "relative",
18
31
  display: "flex",
19
- alignItems: "center"
32
+ alignItems: "center",
33
+ position: "relative"
20
34
  }), props => variant({
21
35
  prop: "sizing",
22
36
  variants: {
@@ -33,7 +47,7 @@ const AvatarWrapper = styled("div").withConfig({
33
47
  variants: {
34
48
  inverted: {}
35
49
  }
36
- }));
50
+ }), avatarStyles);
37
51
  const TextContent = styled("div").withConfig({
38
52
  displayName: "Avatar__TextContent",
39
53
  componentId: "sc-1wtet2j-1"
@@ -63,10 +77,13 @@ const Image = styled("img").withConfig({
63
77
  displayName: "Avatar__Image",
64
78
  componentId: "sc-1wtet2j-2"
65
79
  })(props => css({
66
- width: themeGet(`appScale.${props.customSize || "avatarDefault"}`)(props) || props.customSize,
67
- height: themeGet(`appScale.${props.customSize || "avatarDefault"}`)(props) || props.customSize,
80
+ width: resolveCustomSize(props.customSize, props) || themeGet("avatarScale.avatarDefault")(props),
81
+ height: resolveCustomSize(props.customSize, props) || themeGet("avatarScale.avatarDefault")(props),
68
82
  flex: "0 0 auto",
69
83
  backgroundColor: themeGet("colors.greyLighter")(props),
84
+ objectFit: "cover",
85
+ objectPosition: "center",
86
+ objectRepeat: "no-repeat",
70
87
  border: "0",
71
88
  display: "block",
72
89
  borderRadius: "50%"
@@ -74,12 +91,12 @@ const Image = styled("img").withConfig({
74
91
  prop: "sizing",
75
92
  variants: {
76
93
  small: {
77
- width: themeGet("appScale.avatarSmall")(props),
78
- height: themeGet("appScale.avatarSmall")(props)
94
+ width: themeGet("avatarScale.avatarSmall")(props),
95
+ height: themeGet("avatarScale.avatarSmall")(props)
79
96
  },
80
97
  large: {
81
- width: themeGet("appScale.avatarLarge")(props),
82
- height: themeGet("appScale.avatarLarge")(props)
98
+ width: themeGet("avatarScale.avatarLarge")(props),
99
+ height: themeGet("avatarScale.avatarLarge")(props)
83
100
  }
84
101
  }
85
102
  }), props => variant({
@@ -102,8 +119,8 @@ const Shape = styled("div").withConfig({
102
119
  displayName: "Avatar__Shape",
103
120
  componentId: "sc-1wtet2j-3"
104
121
  })(props => css({
105
- width: themeGet(`appScale.${props.customSize || "avatarDefault"}`)(props) || props.customSize,
106
- height: themeGet(`appScale.${props.customSize || "avatarDefault"}`)(props) || props.customSize,
122
+ width: resolveCustomSize(props.customSize, props) || themeGet("avatarScale.avatarDefault")(props),
123
+ height: resolveCustomSize(props.customSize, props) || themeGet("avatarScale.avatarDefault")(props),
107
124
  fontWeight: themeGet("fontWeights.2")(props),
108
125
  flex: "0 0 auto",
109
126
  background: `linear-gradient(135deg, ${themeGet("colors.primaryLightest")(props)}, ${themeGet("colors.primaryLight")(props)})`,
@@ -125,12 +142,12 @@ const Shape = styled("div").withConfig({
125
142
  prop: "sizing",
126
143
  variants: {
127
144
  small: {
128
- width: themeGet("appScale.avatarSmall")(props),
129
- height: themeGet("appScale.avatarSmall")(props)
145
+ width: themeGet("avatarScale.avatarSmall")(props),
146
+ height: themeGet("avatarScale.avatarSmall")(props)
130
147
  },
131
148
  large: {
132
- width: themeGet("appScale.avatarLarge")(props),
133
- height: themeGet("appScale.avatarLarge")(props)
149
+ width: themeGet("avatarScale.avatarLarge")(props),
150
+ height: themeGet("avatarScale.avatarLarge")(props)
134
151
  },
135
152
  default: {}
136
153
  }
@@ -251,7 +268,126 @@ const LocalTime = styled(Popover).withConfig({
251
268
  displayName: "Avatar__LocalTime",
252
269
  componentId: "sc-1wtet2j-6"
253
270
  })(["position:absolute;top:0;left:0;"]);
254
- const Avatar = _ref2 => {
271
+
272
+ // HeaderAvatar specific styles
273
+ const HeaderAvatarWrapper = styled("div").withConfig({
274
+ displayName: "Avatar__HeaderAvatarWrapper",
275
+ componentId: "sc-1wtet2j-7"
276
+ })(_ref2 => {
277
+ let {
278
+ $size,
279
+ $shape
280
+ } = _ref2;
281
+ return {
282
+ position: "relative",
283
+ display: "inline-flex",
284
+ alignItems: "center",
285
+ justifyContent: "center",
286
+ width: $size,
287
+ height: $size,
288
+ boxShadow: "0px 3px 6px rgba(0,0,0,0.15)",
289
+ borderRadius: $shape === "circle" || !$shape ? "50%" : $shape === "square" ? "6px" : "0",
290
+ background: "transparent"
291
+ };
292
+ }, avatarStyles);
293
+ const HeaderAvatarBorder = styled("div").withConfig({
294
+ displayName: "Avatar__HeaderAvatarBorder",
295
+ componentId: "sc-1wtet2j-8"
296
+ })(_ref3 => {
297
+ let {
298
+ $size,
299
+ $shape,
300
+ $sizing
301
+ } = _ref3;
302
+ return {
303
+ width: $size,
304
+ height: $size,
305
+ border: $sizing === "large" ? "6px solid #fff" : "4px solid #fff",
306
+ borderRadius: $shape === "circle" || !$shape ? "50%" : $shape === "square" ? "6px" : "0",
307
+ overflow: "hidden",
308
+ display: "flex",
309
+ alignItems: "center",
310
+ justifyContent: "center",
311
+ background: "#fff"
312
+ };
313
+ });
314
+ const HeaderAvatarImage = styled("img").withConfig({
315
+ displayName: "Avatar__HeaderAvatarImage",
316
+ componentId: "sc-1wtet2j-9"
317
+ })(_ref4 => {
318
+ let {
319
+ $size,
320
+ $shape
321
+ } = _ref4;
322
+ return {
323
+ width: $size,
324
+ height: $size,
325
+ objectFit: "cover",
326
+ objectPosition: "center",
327
+ objectRepeat: "no-repeat",
328
+ borderRadius: $shape === "circle" || !$shape ? "50%" : $shape === "square" ? "6px" : "0",
329
+ display: "block"
330
+ };
331
+ });
332
+ const HeaderAvatarShape = styled("div").withConfig({
333
+ displayName: "Avatar__HeaderAvatarShape",
334
+ componentId: "sc-1wtet2j-10"
335
+ })(_ref5 => {
336
+ let {
337
+ $size,
338
+ $shape
339
+ } = _ref5;
340
+ return {
341
+ width: $size,
342
+ height: $size,
343
+ display: "flex",
344
+ alignItems: "center",
345
+ justifyContent: "center",
346
+ background: "#e6e6e6",
347
+ color: "#222",
348
+ fontWeight: 600,
349
+ fontSize: `calc(${$size} / 2.5)`,
350
+ borderRadius: $shape === "circle" || !$shape ? "50%" : $shape === "square" ? "6px" : "0",
351
+ ...($shape === "hexagon" && {
352
+ clipPath: "polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)"
353
+ }),
354
+ ...($shape === "tag" && {
355
+ clipPath: "polygon(6% 0, 95% 0, 95% 65%, 50% 100%, 6% 65%)"
356
+ })
357
+ };
358
+ });
359
+ const HeaderAvatarAction = styled("button").withConfig({
360
+ displayName: "Avatar__HeaderAvatarAction",
361
+ componentId: "sc-1wtet2j-11"
362
+ })(_ref6 => {
363
+ let {
364
+ $shape,
365
+ ...props
366
+ } = _ref6;
367
+ return {
368
+ position: "absolute",
369
+ top: 0,
370
+ right: 0,
371
+ transform: $shape === "circle" ? "translate(-5%, 5%)" : "translate(20%, -20%)",
372
+ width: "36px",
373
+ height: "36px",
374
+ borderRadius: "50%",
375
+ background: "#e6e6e6",
376
+ border: "solid 2px #fff",
377
+ boxShadow: "0 2px 8px 0 rgba(0,0,0,0.10)",
378
+ display: "flex",
379
+ alignItems: "center",
380
+ justifyContent: "center",
381
+ cursor: "pointer",
382
+ zIndex: 2,
383
+ padding: 0,
384
+ transition: "background 0.2s ease-in-out",
385
+ "&:hover, &:focus": {
386
+ background: themeGet("colors.primaryLighter")(props)
387
+ }
388
+ };
389
+ });
390
+ const Avatar = _ref7 => {
255
391
  let {
256
392
  sizing,
257
393
  image,
@@ -263,12 +399,14 @@ const Avatar = _ref2 => {
263
399
  subtitleContent,
264
400
  type,
265
401
  theme,
266
- shape,
402
+ shape = "circle",
267
403
  localTime,
268
404
  uppercase = true,
269
405
  customSize,
406
+ headerAvatar = false,
407
+ onClick,
270
408
  ...props
271
- } = _ref2;
409
+ } = _ref7;
272
410
  const hasTitle = !!title;
273
411
  const hasSubtitle = !!subtitle;
274
412
  const hasSubtitleContent = !!subtitleContent;
@@ -279,6 +417,63 @@ const Avatar = _ref2 => {
279
417
  return `Avatar for ${title}`;
280
418
  }
281
419
  }, [imageAlt, title]);
420
+
421
+ // HeaderAvatar logic
422
+ if (headerAvatar) {
423
+ // Sizing logic
424
+ let size = theme?.avatarScale?.headerAvatarDefault || "65px";
425
+ if (sizing === "large") {
426
+ size = theme?.avatarScale?.headerAvatarLarge || "150px";
427
+ }
428
+ if (customSize) {
429
+ size = resolveCustomSize(customSize, {
430
+ theme
431
+ }) || customSize;
432
+ }
433
+ return /*#__PURE__*/_jsxs(HeaderAvatarWrapper, {
434
+ ...props,
435
+ $size: size,
436
+ $shape: shape,
437
+ children: [/*#__PURE__*/_jsx(HeaderAvatarBorder, {
438
+ $size: size,
439
+ $shape: shape,
440
+ $sizing: sizing,
441
+ children: image ? /*#__PURE__*/_jsx(HeaderAvatarImage, {
442
+ src: image,
443
+ alt: alt,
444
+ $size: size,
445
+ $shape: shape
446
+ }) : /*#__PURE__*/_jsx(HeaderAvatarShape, {
447
+ $size: size,
448
+ $shape: shape,
449
+ children: initials ? initials : shape === "hexagon" ? /*#__PURE__*/_jsx(Icon, {
450
+ icon: ["fas", "users"]
451
+ }) : shape === "tag" ? /*#__PURE__*/_jsx(Icon, {
452
+ icon: ["fas", "tag"]
453
+ }) : shape === "square" ? /*#__PURE__*/_jsx(Icon, {
454
+ icon: ["fas", "users"]
455
+ }) : /*#__PURE__*/_jsx(Icon, {
456
+ icon: ["fas", "user"]
457
+ })
458
+ })
459
+ }), onClick && sizing === "large" && /*#__PURE__*/_jsx(HeaderAvatarAction, {
460
+ $size: size,
461
+ $shape: shape,
462
+ onClick: onClick,
463
+ "aria-label": "Edit avatar",
464
+ children: shape === "circle" ? /*#__PURE__*/_jsx(Icon, {
465
+ icon: ["fas", "camera"],
466
+ size: "lg",
467
+ color: "greyDarker"
468
+ }) : /*#__PURE__*/_jsx(Icon, {
469
+ icon: ["fas", "edit"],
470
+ size: "lg",
471
+ color: "greyDarker",
472
+ transform: "right-1"
473
+ })
474
+ })]
475
+ });
476
+ }
282
477
  const component = /*#__PURE__*/_jsxs(AvatarWrapper, {
283
478
  ...props,
284
479
  type: type,
@@ -343,10 +538,11 @@ const Avatar = _ref2 => {
343
538
  Avatar.propTypes = {
344
539
  /** Changes the sizing of the Avatar component */
345
540
  sizing: PropTypes.oneOf(["small", "large", "default"]),
346
- /* If specifying custom sizing, provide a string with the size in pixels */
541
+ /* If specifying custom sizing, provide a string with the size including units (e.g. "65px") */
347
542
  customSize: PropTypes.string,
348
543
  /** Changes the shape of the Avatar component */
349
- shape: PropTypes.oneOf(["square", "hexagon", "tag", "default"]),
544
+ shape: PropTypes.oneOf(["circle", "square", "hexagon", "tag"]),
545
+ // circle is the default so doesn't explicitly need to be specified
350
546
  /** Specifies the inverted type for dark backgrounds */
351
547
  type: PropTypes.oneOf(["inverted", "default"]),
352
548
  /** Specifies a source path for an image */
@@ -376,7 +572,11 @@ Avatar.propTypes = {
376
572
  /** Specifies local time */
377
573
  localTime: PropTypes.string,
378
574
  /** Specifies the colour theme */
379
- theme: PropTypes.object
575
+ theme: PropTypes.object,
576
+ /** Specifies whether to render the avatar in headerAvatar mode */
577
+ headerAvatar: PropTypes.bool,
578
+ /** Specifies the onClick handler for the action button in headerAvatar mode */
579
+ onClick: PropTypes.func
380
580
  };
381
581
  Avatar.__docgenInfo = {
382
582
  "description": "",
@@ -413,6 +613,30 @@ Avatar.__docgenInfo = {
413
613
  },
414
614
  "required": false
415
615
  },
616
+ "shape": {
617
+ "defaultValue": {
618
+ "value": "\"circle\"",
619
+ "computed": false
620
+ },
621
+ "description": "Changes the shape of the Avatar component",
622
+ "type": {
623
+ "name": "enum",
624
+ "value": [{
625
+ "value": "\"circle\"",
626
+ "computed": false
627
+ }, {
628
+ "value": "\"square\"",
629
+ "computed": false
630
+ }, {
631
+ "value": "\"hexagon\"",
632
+ "computed": false
633
+ }, {
634
+ "value": "\"tag\"",
635
+ "computed": false
636
+ }]
637
+ },
638
+ "required": false
639
+ },
416
640
  "uppercase": {
417
641
  "defaultValue": {
418
642
  "value": "true",
@@ -424,6 +648,17 @@ Avatar.__docgenInfo = {
424
648
  },
425
649
  "required": false
426
650
  },
651
+ "headerAvatar": {
652
+ "defaultValue": {
653
+ "value": "false",
654
+ "computed": false
655
+ },
656
+ "description": "Specifies whether to render the avatar in headerAvatar mode",
657
+ "type": {
658
+ "name": "bool"
659
+ },
660
+ "required": false
661
+ },
427
662
  "sizing": {
428
663
  "description": "Changes the sizing of the Avatar component",
429
664
  "type": {
@@ -448,26 +683,6 @@ Avatar.__docgenInfo = {
448
683
  },
449
684
  "required": false
450
685
  },
451
- "shape": {
452
- "description": "Changes the shape of the Avatar component",
453
- "type": {
454
- "name": "enum",
455
- "value": [{
456
- "value": "\"square\"",
457
- "computed": false
458
- }, {
459
- "value": "\"hexagon\"",
460
- "computed": false
461
- }, {
462
- "value": "\"tag\"",
463
- "computed": false
464
- }, {
465
- "value": "\"default\"",
466
- "computed": false
467
- }]
468
- },
469
- "required": false
470
- },
471
686
  "type": {
472
687
  "description": "Specifies the inverted type for dark backgrounds",
473
688
  "type": {
@@ -553,6 +768,13 @@ Avatar.__docgenInfo = {
553
768
  "name": "object"
554
769
  },
555
770
  "required": false
771
+ },
772
+ "onClick": {
773
+ "description": "Specifies the onClick handler for the action button in headerAvatar mode",
774
+ "type": {
775
+ "name": "func"
776
+ },
777
+ "required": false
556
778
  }
557
779
  }
558
780
  };
@@ -1,12 +1,12 @@
1
1
  import React, { forwardRef } from "react";
2
2
  import styled, { ThemeProvider } from "styled-components";
3
- import { space, layout, flexbox, color, border, position, variant, compose } from "styled-system";
3
+ import { space, layout, flexbox, color, border, position, variant, background, compose } from "styled-system";
4
4
  import shouldForwardProp from "@styled-system/should-forward-prop";
5
5
  import { css } from "@styled-system/css";
6
6
  import PropTypes from "prop-types";
7
7
  import { themeGet } from "@styled-system/theme-get";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
- const boxStyles = compose(space, layout, flexbox, color, border, position);
9
+ const boxStyles = compose(space, layout, flexbox, color, border, position, background);
10
10
  const BoxWrapper = styled("div").withConfig({
11
11
  shouldForwardProp,
12
12
  displayName: "Box__BoxWrapper",