orcs-design-system 3.5.10 → 3.5.12
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.
|
@@ -76,8 +76,8 @@ export const CroppedImageWrapper = /*#__PURE__*/styled(CroppedImage).withConfig(
|
|
|
76
76
|
width: resolveCustomSize(props.customSize, props) || themeGet("avatarScale.avatarDefault")(props),
|
|
77
77
|
height: resolveCustomSize(props.customSize, props) || themeGet("avatarScale.avatarDefault")(props),
|
|
78
78
|
flex: "0 0 auto",
|
|
79
|
-
backgroundColor: themeGet("colors.
|
|
80
|
-
border: "
|
|
79
|
+
backgroundColor: themeGet("colors.white")(props),
|
|
80
|
+
border: "solid 1px " + themeGet("colors.greyLighter")(props),
|
|
81
81
|
display: "block",
|
|
82
82
|
borderRadius: "50%",
|
|
83
83
|
overflow: "hidden"
|
|
@@ -121,7 +121,7 @@ export const HeaderAvatarCroppedImage = /*#__PURE__*/styled(CroppedImage).withCo
|
|
|
121
121
|
width: $size,
|
|
122
122
|
height: $size,
|
|
123
123
|
transition: "width 200ms ease-in-out, height 200ms ease-in-out",
|
|
124
|
-
borderRadius: $shape === "circle" || !$shape ? "50%" :
|
|
124
|
+
borderRadius: $shape === "circle" || !$shape ? "50%" : "0",
|
|
125
125
|
overflow: "hidden",
|
|
126
126
|
display: "block"
|
|
127
127
|
};
|
|
@@ -90,11 +90,11 @@ const Image = /*#__PURE__*/styled("img").withConfig({
|
|
|
90
90
|
width: resolveCustomSize(props.customSize, props) || themeGet("avatarScale.avatarDefault")(props),
|
|
91
91
|
height: resolveCustomSize(props.customSize, props) || themeGet("avatarScale.avatarDefault")(props),
|
|
92
92
|
flex: "0 0 auto",
|
|
93
|
-
backgroundColor: themeGet("colors.
|
|
93
|
+
backgroundColor: themeGet("colors.white")(props),
|
|
94
94
|
objectFit: "cover",
|
|
95
95
|
objectPosition: "center",
|
|
96
96
|
objectRepeat: "no-repeat",
|
|
97
|
-
border: "
|
|
97
|
+
border: "solid 1px " + themeGet("colors.greyLighter")(props),
|
|
98
98
|
display: "block",
|
|
99
99
|
borderRadius: "50%"
|
|
100
100
|
}), props => variant({
|
|
@@ -279,48 +279,56 @@ const LocalTime = /*#__PURE__*/styled(Popover).withConfig({
|
|
|
279
279
|
componentId: "sc-1wtet2j-6"
|
|
280
280
|
})(["position:absolute;top:0;left:0;"]);
|
|
281
281
|
|
|
282
|
-
// HeaderAvatar
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
282
|
+
// HeaderAvatar: frame = white background + padding (the "border") + shadow; fixed outer size 150px (large) / 65px (small)
|
|
283
|
+
const HEADER_AVATAR_OUTER = {
|
|
284
|
+
large: "150px",
|
|
285
|
+
small: "65px"
|
|
286
|
+
};
|
|
287
|
+
const HEADER_AVATAR_PADDING = {
|
|
288
|
+
large: 6,
|
|
289
|
+
small: 4
|
|
290
|
+
};
|
|
291
|
+
const headerAvatarFrameStyles = _ref2 => {
|
|
287
292
|
let {
|
|
288
|
-
$
|
|
289
|
-
$
|
|
293
|
+
$shape,
|
|
294
|
+
$sizing
|
|
290
295
|
} = _ref2;
|
|
296
|
+
const padding = $sizing === "large" ? HEADER_AVATAR_PADDING.large : HEADER_AVATAR_PADDING.small;
|
|
291
297
|
return {
|
|
292
|
-
|
|
298
|
+
boxSizing: "border-box",
|
|
299
|
+
width: $sizing === "large" ? HEADER_AVATAR_OUTER.large : HEADER_AVATAR_OUTER.small,
|
|
300
|
+
height: $sizing === "large" ? HEADER_AVATAR_OUTER.large : HEADER_AVATAR_OUTER.small,
|
|
301
|
+
padding: "".concat(padding, "px"),
|
|
302
|
+
background: "#fff",
|
|
303
|
+
boxShadow: "0px 3px 6px rgba(0,0,0,0.15)",
|
|
304
|
+
borderRadius: $shape === "circle" || !$shape ? "50%" : $shape === "square" ? "6px" : "0",
|
|
293
305
|
display: "inline-flex",
|
|
294
306
|
alignItems: "center",
|
|
295
307
|
justifyContent: "center",
|
|
296
|
-
|
|
297
|
-
height: $size,
|
|
298
|
-
transition: "width 200ms ease-in-out, height 200ms ease-in-out",
|
|
299
|
-
boxShadow: "0px 3px 6px rgba(0,0,0,0.15)",
|
|
300
|
-
borderRadius: $shape === "circle" || !$shape ? "50%" : $shape === "square" ? "6px" : "0",
|
|
301
|
-
background: "transparent"
|
|
308
|
+
transition: "width 200ms ease-in-out, height 200ms ease-in-out"
|
|
302
309
|
};
|
|
303
|
-
}
|
|
304
|
-
const
|
|
305
|
-
displayName: "
|
|
310
|
+
};
|
|
311
|
+
const HeaderAvatarFrame = /*#__PURE__*/styled("div").withConfig({
|
|
312
|
+
displayName: "HeaderAvatarFrame",
|
|
313
|
+
componentId: "sc-1wtet2j-7"
|
|
314
|
+
})(headerAvatarFrameStyles, avatarStyles);
|
|
315
|
+
const HeaderAvatarInner = /*#__PURE__*/styled("div").withConfig({
|
|
316
|
+
displayName: "HeaderAvatarInner",
|
|
306
317
|
componentId: "sc-1wtet2j-8"
|
|
307
318
|
})(_ref3 => {
|
|
308
319
|
let {
|
|
309
320
|
$size,
|
|
310
|
-
$shape
|
|
311
|
-
$sizing
|
|
321
|
+
$shape
|
|
312
322
|
} = _ref3;
|
|
313
323
|
return {
|
|
314
324
|
width: $size,
|
|
315
325
|
height: $size,
|
|
316
|
-
transition: "width 200ms ease-in-out, height 200ms ease-in-out, border-width 200ms ease-in-out",
|
|
317
|
-
border: $sizing === "large" ? "6px solid #fff" : "4px solid #fff",
|
|
318
|
-
borderRadius: $shape === "circle" || !$shape ? "50%" : $shape === "square" ? "6px" : "0",
|
|
319
326
|
overflow: "hidden",
|
|
327
|
+
borderRadius: $shape === "circle" || !$shape ? "50%" : "0",
|
|
320
328
|
display: "flex",
|
|
321
329
|
alignItems: "center",
|
|
322
330
|
justifyContent: "center",
|
|
323
|
-
|
|
331
|
+
transition: "width 200ms ease-in-out, height 200ms ease-in-out"
|
|
324
332
|
};
|
|
325
333
|
});
|
|
326
334
|
const HeaderAvatarLoading = /*#__PURE__*/styled("div").withConfig({
|
|
@@ -352,7 +360,7 @@ const HeaderAvatarImage = /*#__PURE__*/styled("img").withConfig({
|
|
|
352
360
|
objectFit: "cover",
|
|
353
361
|
objectPosition: "center",
|
|
354
362
|
objectRepeat: "no-repeat",
|
|
355
|
-
borderRadius: $shape === "circle" || !$shape ? "50%" :
|
|
363
|
+
borderRadius: $shape === "circle" || !$shape ? "50%" : "0",
|
|
356
364
|
display: "block"
|
|
357
365
|
};
|
|
358
366
|
});
|
|
@@ -383,7 +391,7 @@ const HeaderAvatarShape = /*#__PURE__*/styled("div").withConfig({
|
|
|
383
391
|
color: "#fff",
|
|
384
392
|
fontWeight: 600,
|
|
385
393
|
fontSize: "calc(".concat($size, " / 2.5)"),
|
|
386
|
-
borderRadius: $shape === "circle" || !$shape ? "50%" :
|
|
394
|
+
borderRadius: $shape === "circle" || !$shape ? "50%" : "0"
|
|
387
395
|
}, $shape === "hexagon" && {
|
|
388
396
|
clipPath: "polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)"
|
|
389
397
|
}), $shape === "tag" && {
|
|
@@ -395,18 +403,19 @@ const HeaderAvatarAction = /*#__PURE__*/styled("button").withConfig({
|
|
|
395
403
|
componentId: "sc-1wtet2j-12"
|
|
396
404
|
})(_ref8 => {
|
|
397
405
|
let {
|
|
398
|
-
$shape
|
|
406
|
+
$shape,
|
|
407
|
+
$sizing
|
|
399
408
|
} = _ref8;
|
|
400
|
-
return _objectSpread(_objectSpread(_objectSpread({
|
|
409
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, headerAvatarFrameStyles({
|
|
410
|
+
$shape,
|
|
411
|
+
$sizing
|
|
412
|
+
})), {}, {
|
|
401
413
|
cursor: "pointer",
|
|
402
|
-
padding: "0",
|
|
403
|
-
background: "none",
|
|
404
414
|
border: "none",
|
|
405
415
|
outline: "none",
|
|
406
416
|
appearance: "none",
|
|
407
417
|
position: "relative",
|
|
408
|
-
zIndex: "5"
|
|
409
|
-
borderRadius: $shape === "circle" || !$shape ? "50%" : "6px"
|
|
418
|
+
zIndex: "5"
|
|
410
419
|
}, $shape === "hexagon" && {
|
|
411
420
|
clipPath: "polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)"
|
|
412
421
|
}), $shape === "tag" && {
|
|
@@ -418,7 +427,7 @@ const HeaderAvatarAction = /*#__PURE__*/styled("button").withConfig({
|
|
|
418
427
|
}
|
|
419
428
|
}
|
|
420
429
|
});
|
|
421
|
-
});
|
|
430
|
+
}, avatarStyles);
|
|
422
431
|
const IconContainer = /*#__PURE__*/styled("div").withConfig({
|
|
423
432
|
displayName: "IconContainer",
|
|
424
433
|
componentId: "sc-1wtet2j-13"
|
|
@@ -426,22 +435,17 @@ const IconContainer = /*#__PURE__*/styled("div").withConfig({
|
|
|
426
435
|
let {
|
|
427
436
|
$shape,
|
|
428
437
|
$sizing,
|
|
429
|
-
$
|
|
438
|
+
$size
|
|
430
439
|
} = _ref9;
|
|
431
|
-
|
|
432
|
-
const width = $sizing === "large" ? "calc(100% - 12px)" : "calc(100% - 8px)";
|
|
433
|
-
|
|
434
|
-
// Height calculation with reduction when no image
|
|
435
|
-
const heightReduction = $sizing === "large" ? $hasImage ? 17 : 12 : $hasImage ? 12 : 8;
|
|
436
|
-
const height = "calc(100% - ".concat(heightReduction, "px)");
|
|
440
|
+
const padding = $sizing === "large" ? 6 : 4;
|
|
437
441
|
return _objectSpread(_objectSpread({
|
|
438
442
|
opacity: "0",
|
|
439
443
|
transition: "opacity 0.2s ease-in-out",
|
|
440
444
|
position: "absolute",
|
|
441
|
-
top:
|
|
442
|
-
left:
|
|
443
|
-
width,
|
|
444
|
-
height,
|
|
445
|
+
top: "".concat(padding, "px"),
|
|
446
|
+
left: "".concat(padding, "px"),
|
|
447
|
+
width: $size,
|
|
448
|
+
height: $size,
|
|
445
449
|
display: "flex",
|
|
446
450
|
alignItems: "center",
|
|
447
451
|
justifyContent: "center",
|
|
@@ -496,31 +500,21 @@ const Avatar = _ref0 => {
|
|
|
496
500
|
|
|
497
501
|
// HeaderAvatar logic
|
|
498
502
|
if (headerAvatar) {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
let size = (theme === null || theme === void 0 || (_theme$avatarScale = theme.avatarScale) === null || _theme$avatarScale === void 0 ? void 0 : _theme$avatarScale.headerAvatarDefault) || "65px";
|
|
502
|
-
if (sizing === "large") {
|
|
503
|
-
var _theme$avatarScale2;
|
|
504
|
-
size = (theme === null || theme === void 0 || (_theme$avatarScale2 = theme.avatarScale) === null || _theme$avatarScale2 === void 0 ? void 0 : _theme$avatarScale2.headerAvatarLarge) || "150px";
|
|
505
|
-
}
|
|
506
|
-
if (customSize) {
|
|
507
|
-
size = resolveCustomSize(customSize, {
|
|
508
|
-
theme
|
|
509
|
-
}) || customSize;
|
|
510
|
-
}
|
|
503
|
+
// Fixed outer size 150px (large) / 65px (small); inner = outer minus padding
|
|
504
|
+
const innerSize = sizing === "large" ? "138px" : "57px";
|
|
511
505
|
const imgContent = image ? croppedAreaPercent ? /*#__PURE__*/_jsx(HeaderAvatarCroppedImage, {
|
|
512
506
|
src: image,
|
|
513
507
|
alt: alt,
|
|
514
508
|
croppedAreaPercent: croppedAreaPercent,
|
|
515
|
-
$size:
|
|
509
|
+
$size: innerSize,
|
|
516
510
|
$shape: shape
|
|
517
511
|
}) : /*#__PURE__*/_jsx(HeaderAvatarImage, {
|
|
518
512
|
src: image,
|
|
519
513
|
alt: alt,
|
|
520
|
-
$size:
|
|
514
|
+
$size: innerSize,
|
|
521
515
|
$shape: shape
|
|
522
516
|
}) : /*#__PURE__*/_jsx(HeaderAvatarShape, {
|
|
523
|
-
$size:
|
|
517
|
+
$size: innerSize,
|
|
524
518
|
$shape: shape,
|
|
525
519
|
$gradient: gradient || fallbackGradient,
|
|
526
520
|
children: initials ? initials : shape === "hexagon" ? /*#__PURE__*/_jsx(Icon, {
|
|
@@ -537,18 +531,13 @@ const Avatar = _ref0 => {
|
|
|
537
531
|
color: defaultIconColor
|
|
538
532
|
})
|
|
539
533
|
});
|
|
540
|
-
const
|
|
541
|
-
$size:
|
|
534
|
+
const innerContent = /*#__PURE__*/_jsx(HeaderAvatarInner, {
|
|
535
|
+
$size: innerSize,
|
|
542
536
|
$shape: shape,
|
|
543
|
-
children: /*#__PURE__*/_jsx(
|
|
544
|
-
$size:
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
children: loading ? /*#__PURE__*/_jsx(HeaderAvatarLoading, {
|
|
548
|
-
$size: size
|
|
549
|
-
}) : imgContent
|
|
550
|
-
})
|
|
551
|
-
}));
|
|
537
|
+
children: loading ? /*#__PURE__*/_jsx(HeaderAvatarLoading, {
|
|
538
|
+
$size: innerSize
|
|
539
|
+
}) : imgContent
|
|
540
|
+
});
|
|
552
541
|
if (onClick && !loading) {
|
|
553
542
|
return /*#__PURE__*/_jsx(Popover, {
|
|
554
543
|
direction: "right",
|
|
@@ -557,7 +546,7 @@ const Avatar = _ref0 => {
|
|
|
557
546
|
text: shape === "circle" ? "Upload profile picture" : "Change image",
|
|
558
547
|
headerAvatarSizing: sizing,
|
|
559
548
|
tabIndex: "-1",
|
|
560
|
-
children: /*#__PURE__*/_jsxs(HeaderAvatarAction, {
|
|
549
|
+
children: /*#__PURE__*/_jsxs(HeaderAvatarAction, _objectSpread(_objectSpread({}, props), {}, {
|
|
561
550
|
onClick: onClick,
|
|
562
551
|
"aria-label": "Edit avatar",
|
|
563
552
|
$shape: shape,
|
|
@@ -565,7 +554,7 @@ const Avatar = _ref0 => {
|
|
|
565
554
|
children: [/*#__PURE__*/_jsx(IconContainer, {
|
|
566
555
|
$shape: shape,
|
|
567
556
|
$sizing: sizing,
|
|
568
|
-
$
|
|
557
|
+
$size: innerSize,
|
|
569
558
|
className: "icon-container",
|
|
570
559
|
children: shape === "circle" ? /*#__PURE__*/_jsx(Icon, {
|
|
571
560
|
icon: ["fas", "camera"],
|
|
@@ -576,11 +565,15 @@ const Avatar = _ref0 => {
|
|
|
576
565
|
size: sizing === "large" ? "lg" : "1x",
|
|
577
566
|
color: defaultIconColor
|
|
578
567
|
})
|
|
579
|
-
}),
|
|
580
|
-
})
|
|
568
|
+
}), innerContent]
|
|
569
|
+
}))
|
|
581
570
|
});
|
|
582
571
|
}
|
|
583
|
-
return
|
|
572
|
+
return /*#__PURE__*/_jsx(HeaderAvatarFrame, _objectSpread(_objectSpread({}, props), {}, {
|
|
573
|
+
$shape: shape,
|
|
574
|
+
$sizing: sizing,
|
|
575
|
+
children: innerContent
|
|
576
|
+
}));
|
|
584
577
|
}
|
|
585
578
|
const component = /*#__PURE__*/_jsxs(AvatarWrapper, _objectSpread(_objectSpread({}, props), {}, {
|
|
586
579
|
type: type,
|
|
@@ -73,6 +73,7 @@ export const defaultHeader = () => /*#__PURE__*/_jsx(Header, {
|
|
|
73
73
|
searchComponent: /*#__PURE__*/_jsx(TextInput, {
|
|
74
74
|
fullWidth: true,
|
|
75
75
|
id: "search",
|
|
76
|
+
ariaLabel: "Type to search",
|
|
76
77
|
height: "100%",
|
|
77
78
|
type: "text",
|
|
78
79
|
placeholder: "Search for...",
|
|
@@ -93,6 +94,7 @@ export const headerWithExtras = () => /*#__PURE__*/_jsx(Header, {
|
|
|
93
94
|
searchComponent: /*#__PURE__*/_jsx(TextInput, {
|
|
94
95
|
fullWidth: true,
|
|
95
96
|
id: "search",
|
|
97
|
+
ariaLabel: "Type to search",
|
|
96
98
|
height: "100%",
|
|
97
99
|
type: "text",
|
|
98
100
|
placeholder: "Search for...",
|
|
@@ -123,12 +123,11 @@ export const IconContainer = /*#__PURE__*/styled(Flex).withConfig({
|
|
|
123
123
|
background: themeGet("colors.greyDark")(props),
|
|
124
124
|
transition: themeGet("transition.transitionDefault")(props)
|
|
125
125
|
}));
|
|
126
|
-
export const UserMenuContent = /*#__PURE__*/styled(
|
|
126
|
+
export const UserMenuContent = /*#__PURE__*/styled(Flex).withConfig({
|
|
127
127
|
displayName: "UserMenuContent",
|
|
128
128
|
componentId: "sc-xs8ba0-8"
|
|
129
129
|
})(props => css({
|
|
130
130
|
position: "absolute",
|
|
131
|
-
gap: "s",
|
|
132
131
|
top: "calc(100% + 8px)",
|
|
133
132
|
right: "0",
|
|
134
133
|
zIndex: themeGet("zIndices.2")(props),
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import React, { useState, useRef, useEffect } from "react";
|
|
2
5
|
import PropTypes from "prop-types";
|
|
3
6
|
import Avatar from "../Avatar";
|
|
@@ -50,13 +53,14 @@ const UserMenu = _ref => {
|
|
|
50
53
|
justifyContent: "center",
|
|
51
54
|
borderRadius: "50%",
|
|
52
55
|
p: "2px",
|
|
53
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
56
|
+
children: /*#__PURE__*/_jsx(Icon, _objectSpread({
|
|
54
57
|
icon: ["fas", "chevron-down"],
|
|
55
|
-
rotation: isOpen ? 180 : 0,
|
|
56
58
|
color: "white",
|
|
57
59
|
size: "xs",
|
|
58
60
|
mt: isOpen ? "0" : "1px"
|
|
59
|
-
}
|
|
61
|
+
}, isOpen && {
|
|
62
|
+
rotation: "180"
|
|
63
|
+
}))
|
|
60
64
|
})]
|
|
61
65
|
}), /*#__PURE__*/_jsxs(UserMenuContent, {
|
|
62
66
|
p: "s",
|
|
@@ -67,7 +71,7 @@ const UserMenu = _ref => {
|
|
|
67
71
|
maxHeight: "430px",
|
|
68
72
|
border: "solid 1px",
|
|
69
73
|
borderRadius: "2",
|
|
70
|
-
|
|
74
|
+
gap: "s",
|
|
71
75
|
flexDirection: "column",
|
|
72
76
|
alignItems: "flex-start",
|
|
73
77
|
justifyContent: "flex-start",
|