orcs-design-system 3.3.42 → 3.3.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/assets/Colour/Colour.stories.js +60 -54
- package/es/components/ActionsMenu/ActionsMenu.stories.js +45 -0
- package/es/components/ActionsMenu/index.js +29 -26
- package/es/components/Avatar/index.js +67 -35
- package/es/components/Popover/index.js +12 -2
- package/es/components/SideNavV2/NavItem.js +58 -86
- package/es/components/SideNavV2/SideNav.js +14 -6
- package/es/components/SideNavV2/__tests__/resize.test.js +12 -3
- package/es/components/SideNavV2/__tests__/sections.test.js +302 -22
- package/es/components/SideNavV2/components/BaseSection.js +1 -1
- package/es/components/SideNavV2/components/ExpandedPanel.js +2 -1
- package/es/components/SideNavV2/components/PanelControl.js +44 -8
- package/es/components/SideNavV2/constants/sideNav.js +6 -4
- package/es/components/SideNavV2/context/SideNavStateProvider.js +5 -2
- package/es/components/SideNavV2/hooks/useResize.js +4 -3
- package/es/components/SideNavV2/hooks/useSideNavState.js +99 -2
- package/es/components/SideNavV2/sections/SideNavCurrentViewSection.js +59 -14
- package/es/components/SideNavV2/sections/SideNavPinnedSection.js +1 -0
- package/es/components/SideNavV2/styles/SideNavV2.styles.js +9 -4
- package/es/components/SideNavV2/utils/resizeUtils.js +6 -2
- package/es/components/Typography/Typography.stories.js +177 -153
- package/package.json +1 -1
|
@@ -58,60 +58,56 @@ export const WhiteOpacityScale = () => /*#__PURE__*/_jsx(Box, {
|
|
|
58
58
|
})]
|
|
59
59
|
})
|
|
60
60
|
});
|
|
61
|
-
export const PrimaryOpacityScale = {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
})]
|
|
112
|
-
}),
|
|
113
|
-
name: "Secondary Opacity Scale"
|
|
114
|
-
};
|
|
61
|
+
export const PrimaryOpacityScale = () => /*#__PURE__*/_jsxs(Flex, {
|
|
62
|
+
justifyContent: "center",
|
|
63
|
+
children: [/*#__PURE__*/_jsx(Colour, {
|
|
64
|
+
bg: "primary"
|
|
65
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
66
|
+
bg: "primary90"
|
|
67
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
68
|
+
bg: "primary80"
|
|
69
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
70
|
+
bg: "primary70"
|
|
71
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
72
|
+
bg: "primary60"
|
|
73
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
74
|
+
bg: "primary50"
|
|
75
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
76
|
+
bg: "primary40"
|
|
77
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
78
|
+
bg: "primary30"
|
|
79
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
80
|
+
bg: "primary20"
|
|
81
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
82
|
+
bg: "primary10"
|
|
83
|
+
})]
|
|
84
|
+
});
|
|
85
|
+
PrimaryOpacityScale.storyName = "Primary Opacity Scale";
|
|
86
|
+
export const SecondaryOpacityScale = () => /*#__PURE__*/_jsxs(Flex, {
|
|
87
|
+
justifyContent: "center",
|
|
88
|
+
children: [/*#__PURE__*/_jsx(Colour, {
|
|
89
|
+
bg: "secondary"
|
|
90
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
91
|
+
bg: "secondary90"
|
|
92
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
93
|
+
bg: "secondary80"
|
|
94
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
95
|
+
bg: "secondary70"
|
|
96
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
97
|
+
bg: "secondary60"
|
|
98
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
99
|
+
bg: "secondary50"
|
|
100
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
101
|
+
bg: "secondary40"
|
|
102
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
103
|
+
bg: "secondary30"
|
|
104
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
105
|
+
bg: "secondary20"
|
|
106
|
+
}), /*#__PURE__*/_jsx(Colour, {
|
|
107
|
+
bg: "secondary10"
|
|
108
|
+
})]
|
|
109
|
+
});
|
|
110
|
+
SecondaryOpacityScale.storyName = "Secondary Opacity Scale";
|
|
115
111
|
export const SuccessOpacityScale = () => /*#__PURE__*/_jsxs(Flex, {
|
|
116
112
|
justifyContent: "center",
|
|
117
113
|
children: [/*#__PURE__*/_jsx(Colour, {
|
|
@@ -194,6 +190,16 @@ WhiteOpacityScale.__docgenInfo = {
|
|
|
194
190
|
"methods": [],
|
|
195
191
|
"displayName": "WhiteOpacityScale"
|
|
196
192
|
};
|
|
193
|
+
PrimaryOpacityScale.__docgenInfo = {
|
|
194
|
+
"description": "",
|
|
195
|
+
"methods": [],
|
|
196
|
+
"displayName": "PrimaryOpacityScale"
|
|
197
|
+
};
|
|
198
|
+
SecondaryOpacityScale.__docgenInfo = {
|
|
199
|
+
"description": "",
|
|
200
|
+
"methods": [],
|
|
201
|
+
"displayName": "SecondaryOpacityScale"
|
|
202
|
+
};
|
|
197
203
|
SuccessOpacityScale.__docgenInfo = {
|
|
198
204
|
"description": "",
|
|
199
205
|
"methods": [],
|
|
@@ -353,6 +353,41 @@ export const circleVariantActionsMenu = () => /*#__PURE__*/_jsxs(ActionsMenu, {
|
|
|
353
353
|
})]
|
|
354
354
|
});
|
|
355
355
|
circleVariantActionsMenu.storyName = "Circle Variant";
|
|
356
|
+
export const disabledActionsMenu = () => /*#__PURE__*/_jsxs(ActionsMenu, {
|
|
357
|
+
disabled: true,
|
|
358
|
+
children: [/*#__PURE__*/_jsx(ActionsMenuItem, {
|
|
359
|
+
href: "https://orchestrated.io/",
|
|
360
|
+
children: "Open details page"
|
|
361
|
+
}), /*#__PURE__*/_jsx(BrowserRouter, {
|
|
362
|
+
children: /*#__PURE__*/_jsx(ActionsMenuItem, {
|
|
363
|
+
as: Link,
|
|
364
|
+
to: "/",
|
|
365
|
+
children: "Edit"
|
|
366
|
+
})
|
|
367
|
+
}), /*#__PURE__*/_jsx(ActionsMenuItem, {
|
|
368
|
+
onClick: action("clicked"),
|
|
369
|
+
children: "Remove"
|
|
370
|
+
})]
|
|
371
|
+
});
|
|
372
|
+
disabledActionsMenu.storyName = "Disabled Default";
|
|
373
|
+
export const disabledCircleVariantActionsMenu = () => /*#__PURE__*/_jsxs(ActionsMenu, {
|
|
374
|
+
variant: "circle",
|
|
375
|
+
disabled: true,
|
|
376
|
+
children: [/*#__PURE__*/_jsx(ActionsMenuItem, {
|
|
377
|
+
href: "https://orchestrated.io/",
|
|
378
|
+
children: "Open details page"
|
|
379
|
+
}), /*#__PURE__*/_jsx(BrowserRouter, {
|
|
380
|
+
children: /*#__PURE__*/_jsx(ActionsMenuItem, {
|
|
381
|
+
as: Link,
|
|
382
|
+
to: "/",
|
|
383
|
+
children: "Edit"
|
|
384
|
+
})
|
|
385
|
+
}), /*#__PURE__*/_jsx(ActionsMenuItem, {
|
|
386
|
+
onClick: action("clicked"),
|
|
387
|
+
children: "Remove"
|
|
388
|
+
})]
|
|
389
|
+
});
|
|
390
|
+
disabledCircleVariantActionsMenu.storyName = "Disabled Circle Variant";
|
|
356
391
|
defaultActionsMenu.__docgenInfo = {
|
|
357
392
|
"description": "",
|
|
358
393
|
"methods": [],
|
|
@@ -387,4 +422,14 @@ circleVariantActionsMenu.__docgenInfo = {
|
|
|
387
422
|
"description": "",
|
|
388
423
|
"methods": [],
|
|
389
424
|
"displayName": "circleVariantActionsMenu"
|
|
425
|
+
};
|
|
426
|
+
disabledActionsMenu.__docgenInfo = {
|
|
427
|
+
"description": "",
|
|
428
|
+
"methods": [],
|
|
429
|
+
"displayName": "disabledActionsMenu"
|
|
430
|
+
};
|
|
431
|
+
disabledCircleVariantActionsMenu.__docgenInfo = {
|
|
432
|
+
"description": "",
|
|
433
|
+
"methods": [],
|
|
434
|
+
"displayName": "disabledCircleVariantActionsMenu"
|
|
390
435
|
};
|
|
@@ -8,7 +8,6 @@ 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";
|
|
12
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
12
|
const ActionMenuContext = /*#__PURE__*/createContext({});
|
|
14
13
|
const StyledActionsMenuContainer = styled.div.withConfig({
|
|
@@ -22,27 +21,7 @@ const Wrapper = styled.div.withConfig({
|
|
|
22
21
|
const Control = styled.button.withConfig({
|
|
23
22
|
displayName: "ActionsMenu__Control",
|
|
24
23
|
componentId: "sc-yvbni2-2"
|
|
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:
|
|
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);
|
|
24
|
+
})(["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:", ";width:", ";height:", ";border-radius:", ";border:", ";", " ", " &: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 => props.disabled ? "not-allowed" : "pointer", props => props.variant === "circle" ? "35px" : "30px", props => props.variant === "circle" ? "35px" : "30px", props => props.variant === "circle" ? "50%" : themeGet("radii.2")(props), props => props.variant === "circle" ? "solid 2px" : "solid 1px", props => props.variant === "default" && css(["background-color:", ";border-color:", ";"], props.disabled ? themeGet("colors.greyLighter")(props) : "white", props.disabled ? themeGet("colors.greyLighter")(props) : themeGet("colors.greyLight")(props)), props => props.variant === "circle" && css(["background-color:", ";border-color:", ";"], props.disabled ? themeGet("colors.greyLighter")(props) : themeGet("colors.greyDarkest")(props), props.disabled ? themeGet("colors.greyLighter")(props) : themeGet("colors.greyDarkest")(props)), props => props.disabled ? themeGet("colors.greyLighter")(props) : themeGet("colors.primary")(props), beforeDotCollapsing, afterDotCollapsing, beforeCrossExpanding, afterCrossExpanding, beforeDotExpanding, afterDotExpanding, beforeCrossCollapsing, afterCrossCollapsing);
|
|
46
25
|
const Dots = styled.div.withConfig({
|
|
47
26
|
displayName: "ActionsMenu__Dots",
|
|
48
27
|
componentId: "sc-yvbni2-3"
|
|
@@ -150,6 +129,7 @@ export const ActionsMenuBody = _ref2 => {
|
|
|
150
129
|
closeOnClick = false,
|
|
151
130
|
"data-testid": dataTestId = "ActionsMenu",
|
|
152
131
|
variant = "default",
|
|
132
|
+
disabled = false,
|
|
153
133
|
...props
|
|
154
134
|
} = _ref2;
|
|
155
135
|
const id = useId();
|
|
@@ -169,17 +149,19 @@ export const ActionsMenuBody = _ref2 => {
|
|
|
169
149
|
"aria-label": ariaLabel,
|
|
170
150
|
onFocus: onTriggerFocus,
|
|
171
151
|
id,
|
|
152
|
+
disabled,
|
|
172
153
|
...actionMenu.getReferenceProps({
|
|
173
154
|
...props,
|
|
174
|
-
onClick: onToggle,
|
|
155
|
+
onClick: disabled ? undefined : onToggle,
|
|
175
156
|
ref: triggerRef,
|
|
176
157
|
"data-state": actionMenu.open ? "open" : "closed",
|
|
177
158
|
"data-testid": dataTestId
|
|
178
159
|
})
|
|
179
|
-
}), [ariaLabel, onTriggerFocus, id, actionMenu, onToggle, props, triggerRef, dataTestId]);
|
|
160
|
+
}), [ariaLabel, onTriggerFocus, id, actionMenu, onToggle, props, triggerRef, dataTestId, disabled]);
|
|
180
161
|
let triggerComponent = /*#__PURE__*/_jsxs(Control, {
|
|
181
162
|
...triggerProps,
|
|
182
163
|
variant: variant,
|
|
164
|
+
disabled: disabled,
|
|
183
165
|
children: [/*#__PURE__*/_jsx(Dots, {
|
|
184
166
|
className: "actionsMenu__dots",
|
|
185
167
|
variant: variant
|
|
@@ -283,7 +265,8 @@ ActionsMenuBody.propTypes = {
|
|
|
283
265
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
|
284
266
|
theme: PropTypes.object,
|
|
285
267
|
ariaLabel: PropTypes.string,
|
|
286
|
-
variant: PropTypes.oneOf(["default", "circle"])
|
|
268
|
+
variant: PropTypes.oneOf(["default", "circle"]),
|
|
269
|
+
disabled: PropTypes.bool
|
|
287
270
|
};
|
|
288
271
|
const ActionsMenu = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
289
272
|
const [toggleState, setToggle] = useState(false);
|
|
@@ -316,7 +299,9 @@ ActionsMenu.propTypes = {
|
|
|
316
299
|
/** Specifies the aria-label for the button */
|
|
317
300
|
ariaLabel: PropTypes.string,
|
|
318
301
|
/** Specifies the variant of the ActionsMenu */
|
|
319
|
-
variant: PropTypes.oneOf(["default", "circle"])
|
|
302
|
+
variant: PropTypes.oneOf(["default", "circle"]),
|
|
303
|
+
/** Specifies whether the ActionsMenu is disabled */
|
|
304
|
+
disabled: PropTypes.bool
|
|
320
305
|
};
|
|
321
306
|
ActionsMenu.__docgenInfo = {
|
|
322
307
|
"description": "",
|
|
@@ -437,6 +422,13 @@ ActionsMenu.__docgenInfo = {
|
|
|
437
422
|
}]
|
|
438
423
|
},
|
|
439
424
|
"required": false
|
|
425
|
+
},
|
|
426
|
+
"disabled": {
|
|
427
|
+
"description": "Specifies whether the ActionsMenu is disabled",
|
|
428
|
+
"type": {
|
|
429
|
+
"name": "bool"
|
|
430
|
+
},
|
|
431
|
+
"required": false
|
|
440
432
|
}
|
|
441
433
|
}
|
|
442
434
|
};
|
|
@@ -508,6 +500,17 @@ ActionsMenuBody.__docgenInfo = {
|
|
|
508
500
|
},
|
|
509
501
|
"required": false
|
|
510
502
|
},
|
|
503
|
+
"disabled": {
|
|
504
|
+
"defaultValue": {
|
|
505
|
+
"value": "false",
|
|
506
|
+
"computed": false
|
|
507
|
+
},
|
|
508
|
+
"description": "",
|
|
509
|
+
"type": {
|
|
510
|
+
"name": "bool"
|
|
511
|
+
},
|
|
512
|
+
"required": false
|
|
513
|
+
},
|
|
511
514
|
"onTriggerFocus": {
|
|
512
515
|
"description": "",
|
|
513
516
|
"type": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
|
-
import styled, { ThemeProvider } from "styled-components";
|
|
2
|
+
import styled, { ThemeProvider, keyframes } from "styled-components";
|
|
3
3
|
import { space, layout, variant, position, compose } from "styled-system";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import Header, { Text } from "../Typography";
|
|
@@ -10,6 +10,7 @@ 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
12
|
const avatarStyles = compose(space, layout, position);
|
|
13
|
+
export const COLOR_CHANGE = keyframes(["0%{background-position:-468px 0;}100%{background-position:468px 0;}"]);
|
|
13
14
|
|
|
14
15
|
// Helper function to resolve customSize values
|
|
15
16
|
const resolveCustomSize = (customSize, props) => {
|
|
@@ -313,14 +314,28 @@ const HeaderAvatarBorder = styled("div").withConfig({
|
|
|
313
314
|
background: "#fff"
|
|
314
315
|
};
|
|
315
316
|
});
|
|
317
|
+
const HeaderAvatarLoading = styled("div").withConfig({
|
|
318
|
+
displayName: "Avatar__HeaderAvatarLoading",
|
|
319
|
+
componentId: "sc-1wtet2j-9"
|
|
320
|
+
})(["width:", ";height:", ";background:linear-gradient( to right,rgba(0,0,0,0.1) 5%,rgba(0,0,0,0.05) 65%,rgba(0,0,0,0.1) 70% );background-size:200px;animation:", " 20s linear infinite;"], _ref4 => {
|
|
321
|
+
let {
|
|
322
|
+
$size
|
|
323
|
+
} = _ref4;
|
|
324
|
+
return $size;
|
|
325
|
+
}, _ref5 => {
|
|
326
|
+
let {
|
|
327
|
+
$size
|
|
328
|
+
} = _ref5;
|
|
329
|
+
return $size;
|
|
330
|
+
}, COLOR_CHANGE);
|
|
316
331
|
const HeaderAvatarImage = styled("img").withConfig({
|
|
317
332
|
displayName: "Avatar__HeaderAvatarImage",
|
|
318
|
-
componentId: "sc-1wtet2j-
|
|
319
|
-
})(
|
|
333
|
+
componentId: "sc-1wtet2j-10"
|
|
334
|
+
})(_ref6 => {
|
|
320
335
|
let {
|
|
321
336
|
$size,
|
|
322
337
|
$shape
|
|
323
|
-
} =
|
|
338
|
+
} = _ref6;
|
|
324
339
|
return {
|
|
325
340
|
width: $size,
|
|
326
341
|
height: $size,
|
|
@@ -334,12 +349,12 @@ const HeaderAvatarImage = styled("img").withConfig({
|
|
|
334
349
|
});
|
|
335
350
|
const HeaderAvatarShape = styled("div").withConfig({
|
|
336
351
|
displayName: "Avatar__HeaderAvatarShape",
|
|
337
|
-
componentId: "sc-1wtet2j-
|
|
338
|
-
})(
|
|
352
|
+
componentId: "sc-1wtet2j-11"
|
|
353
|
+
})(_ref7 => {
|
|
339
354
|
let {
|
|
340
355
|
$size,
|
|
341
356
|
$shape
|
|
342
|
-
} =
|
|
357
|
+
} = _ref7;
|
|
343
358
|
return {
|
|
344
359
|
width: $size,
|
|
345
360
|
height: $size,
|
|
@@ -362,11 +377,11 @@ const HeaderAvatarShape = styled("div").withConfig({
|
|
|
362
377
|
});
|
|
363
378
|
const HeaderAvatarAction = styled("button").withConfig({
|
|
364
379
|
displayName: "Avatar__HeaderAvatarAction",
|
|
365
|
-
componentId: "sc-1wtet2j-
|
|
366
|
-
})(
|
|
380
|
+
componentId: "sc-1wtet2j-12"
|
|
381
|
+
})(_ref8 => {
|
|
367
382
|
let {
|
|
368
383
|
$shape
|
|
369
|
-
} =
|
|
384
|
+
} = _ref8;
|
|
370
385
|
return {
|
|
371
386
|
cursor: "pointer",
|
|
372
387
|
padding: "0",
|
|
@@ -392,13 +407,13 @@ const HeaderAvatarAction = styled("button").withConfig({
|
|
|
392
407
|
});
|
|
393
408
|
const IconContainer = styled("div").withConfig({
|
|
394
409
|
displayName: "Avatar__IconContainer",
|
|
395
|
-
componentId: "sc-1wtet2j-
|
|
396
|
-
})(
|
|
410
|
+
componentId: "sc-1wtet2j-13"
|
|
411
|
+
})(_ref9 => {
|
|
397
412
|
let {
|
|
398
413
|
$shape,
|
|
399
414
|
$sizing,
|
|
400
415
|
$hasImage
|
|
401
|
-
} =
|
|
416
|
+
} = _ref9;
|
|
402
417
|
// Simplified width calculation (no change based on image presence)
|
|
403
418
|
const width = $sizing === "large" ? "calc(100% - 12px)" : "calc(100% - 8px)";
|
|
404
419
|
|
|
@@ -427,7 +442,7 @@ const IconContainer = styled("div").withConfig({
|
|
|
427
442
|
})
|
|
428
443
|
};
|
|
429
444
|
});
|
|
430
|
-
const Avatar =
|
|
445
|
+
const Avatar = _ref0 => {
|
|
431
446
|
let {
|
|
432
447
|
sizing,
|
|
433
448
|
image,
|
|
@@ -445,8 +460,9 @@ const Avatar = _ref8 => {
|
|
|
445
460
|
customSize,
|
|
446
461
|
headerAvatar = false,
|
|
447
462
|
onClick,
|
|
463
|
+
loading = false,
|
|
448
464
|
...props
|
|
449
|
-
} =
|
|
465
|
+
} = _ref0;
|
|
450
466
|
const hasTitle = !!title;
|
|
451
467
|
const hasSubtitle = !!subtitle;
|
|
452
468
|
const hasSubtitleContent = !!subtitleContent;
|
|
@@ -470,6 +486,24 @@ const Avatar = _ref8 => {
|
|
|
470
486
|
theme
|
|
471
487
|
}) || customSize;
|
|
472
488
|
}
|
|
489
|
+
const imgContent = image ? /*#__PURE__*/_jsx(HeaderAvatarImage, {
|
|
490
|
+
src: image,
|
|
491
|
+
alt: alt,
|
|
492
|
+
$size: size,
|
|
493
|
+
$shape: shape
|
|
494
|
+
}) : /*#__PURE__*/_jsx(HeaderAvatarShape, {
|
|
495
|
+
$size: size,
|
|
496
|
+
$shape: shape,
|
|
497
|
+
children: initials ? initials : shape === "hexagon" ? /*#__PURE__*/_jsx(Icon, {
|
|
498
|
+
icon: ["fas", "users"]
|
|
499
|
+
}) : shape === "tag" ? /*#__PURE__*/_jsx(Icon, {
|
|
500
|
+
icon: ["fas", "tag"]
|
|
501
|
+
}) : shape === "square" ? /*#__PURE__*/_jsx(Icon, {
|
|
502
|
+
icon: ["fas", "users"]
|
|
503
|
+
}) : /*#__PURE__*/_jsx(Icon, {
|
|
504
|
+
icon: ["fas", "user"]
|
|
505
|
+
})
|
|
506
|
+
});
|
|
473
507
|
const avatarContent = /*#__PURE__*/_jsx(HeaderAvatarWrapper, {
|
|
474
508
|
...props,
|
|
475
509
|
$size: size,
|
|
@@ -478,27 +512,12 @@ const Avatar = _ref8 => {
|
|
|
478
512
|
$size: size,
|
|
479
513
|
$shape: shape,
|
|
480
514
|
$sizing: sizing,
|
|
481
|
-
children:
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
$size: size,
|
|
485
|
-
$shape: shape
|
|
486
|
-
}) : /*#__PURE__*/_jsx(HeaderAvatarShape, {
|
|
487
|
-
$size: size,
|
|
488
|
-
$shape: shape,
|
|
489
|
-
children: initials ? initials : shape === "hexagon" ? /*#__PURE__*/_jsx(Icon, {
|
|
490
|
-
icon: ["fas", "users"]
|
|
491
|
-
}) : shape === "tag" ? /*#__PURE__*/_jsx(Icon, {
|
|
492
|
-
icon: ["fas", "tag"]
|
|
493
|
-
}) : shape === "square" ? /*#__PURE__*/_jsx(Icon, {
|
|
494
|
-
icon: ["fas", "users"]
|
|
495
|
-
}) : /*#__PURE__*/_jsx(Icon, {
|
|
496
|
-
icon: ["fas", "user"]
|
|
497
|
-
})
|
|
498
|
-
})
|
|
515
|
+
children: loading ? /*#__PURE__*/_jsx(HeaderAvatarLoading, {
|
|
516
|
+
$size: size
|
|
517
|
+
}) : imgContent
|
|
499
518
|
})
|
|
500
519
|
});
|
|
501
|
-
if (onClick) {
|
|
520
|
+
if (onClick && !loading) {
|
|
502
521
|
return /*#__PURE__*/_jsx(Popover, {
|
|
503
522
|
direction: "right",
|
|
504
523
|
width: "fit-content",
|
|
@@ -633,7 +652,9 @@ Avatar.propTypes = {
|
|
|
633
652
|
/** Specifies whether to render the avatar in headerAvatar mode */
|
|
634
653
|
headerAvatar: PropTypes.bool,
|
|
635
654
|
/** Specifies the onClick handler for the action button in headerAvatar mode */
|
|
636
|
-
onClick: PropTypes.func
|
|
655
|
+
onClick: PropTypes.func,
|
|
656
|
+
/** Specifies whether to render the avatar in loading state */
|
|
657
|
+
loading: PropTypes.bool
|
|
637
658
|
};
|
|
638
659
|
Avatar.__docgenInfo = {
|
|
639
660
|
"description": "",
|
|
@@ -716,6 +737,17 @@ Avatar.__docgenInfo = {
|
|
|
716
737
|
},
|
|
717
738
|
"required": false
|
|
718
739
|
},
|
|
740
|
+
"loading": {
|
|
741
|
+
"defaultValue": {
|
|
742
|
+
"value": "false",
|
|
743
|
+
"computed": false
|
|
744
|
+
},
|
|
745
|
+
"description": "Specifies whether to render the avatar in loading state",
|
|
746
|
+
"type": {
|
|
747
|
+
"name": "bool"
|
|
748
|
+
},
|
|
749
|
+
"required": false
|
|
750
|
+
},
|
|
719
751
|
"sizing": {
|
|
720
752
|
"description": "Changes the sizing of the Avatar component",
|
|
721
753
|
"type": {
|
|
@@ -94,6 +94,7 @@ export default function Popover(_ref) {
|
|
|
94
94
|
withFocusControl = true,
|
|
95
95
|
offset: customOffset,
|
|
96
96
|
headerAvatarSizing,
|
|
97
|
+
disabled,
|
|
97
98
|
...props
|
|
98
99
|
} = _ref;
|
|
99
100
|
const [visible, setVisible] = useState(false);
|
|
@@ -131,7 +132,7 @@ export default function Popover(_ref) {
|
|
|
131
132
|
context
|
|
132
133
|
} = useFloating({
|
|
133
134
|
open: visible,
|
|
134
|
-
onOpenChange: setVisible,
|
|
135
|
+
onOpenChange: disabled ? () => {} : setVisible,
|
|
135
136
|
placement: DIRECTIONS_MAP[direction] || direction || "right",
|
|
136
137
|
whileElementsMounted: autoUpdate,
|
|
137
138
|
middleware
|
|
@@ -271,7 +272,9 @@ Popover.propTypes = {
|
|
|
271
272
|
/** Custom offset configuration for the popover positioning. Can be an object with mainAxis and/or alignmentAxis properties, or a function that returns an offset object. */
|
|
272
273
|
offset: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
|
|
273
274
|
/** Special prop for Header Avatar to apply CSS-based positioning adjustments when sizing changes dynamically */
|
|
274
|
-
headerAvatarSizing: PropTypes.oneOf(["large", "default", "small"])
|
|
275
|
+
headerAvatarSizing: PropTypes.oneOf(["large", "default", "small"]),
|
|
276
|
+
/** Disable the popover */
|
|
277
|
+
disabled: PropTypes.bool
|
|
275
278
|
};
|
|
276
279
|
Popover.__docgenInfo = {
|
|
277
280
|
"description": "",
|
|
@@ -431,6 +434,13 @@ Popover.__docgenInfo = {
|
|
|
431
434
|
}]
|
|
432
435
|
},
|
|
433
436
|
"required": false
|
|
437
|
+
},
|
|
438
|
+
"disabled": {
|
|
439
|
+
"description": "Disable the popover",
|
|
440
|
+
"type": {
|
|
441
|
+
"name": "bool"
|
|
442
|
+
},
|
|
443
|
+
"required": false
|
|
434
444
|
}
|
|
435
445
|
}
|
|
436
446
|
};
|