orcs-design-system 3.2.47 → 3.3.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.
- package/es/components/Avatar/Avatar.stories.js +29 -0
- package/es/components/Avatar/index.js +19 -18
- package/es/components/Box/index.js +2 -2
- package/es/components/Flex/index.js +2 -2
- package/es/components/FloatingPanels/FloatingPanels.stories.js +80 -0
- package/es/components/FloatingPanels/FloatingPanels.styles.js +107 -0
- package/es/components/FloatingPanels/Panel.js +115 -0
- package/es/components/FloatingPanels/index.js +141 -0
- package/es/components/Header/Header.stories.js +61 -164
- package/es/components/Header/Header.styles.js +116 -0
- package/es/components/Header/UserMenu.js +142 -0
- package/es/components/Header/index.js +59 -822
- package/es/components/HeaderComplex/HeaderComplex.stories.js +186 -0
- package/es/components/HeaderComplex/index.js +928 -0
- package/es/components/SideNav/NavItem.js +1 -1
- package/es/components/SideNav/index.js +3 -3
- package/es/components/Tag/Tag.stories.js +16 -5
- package/es/components/Tag/index.js +5 -5
- package/es/components.test.js +2 -0
- package/es/index.js +2 -0
- package/es/systemThemeCollapsed.js +2 -1
- package/es/systemtheme.js +2 -1
- package/package.json +1 -1
|
@@ -110,6 +110,30 @@ export const large = () => /*#__PURE__*/_jsxs(Spacer, {
|
|
|
110
110
|
})]
|
|
111
111
|
});
|
|
112
112
|
large.storyName = "Large";
|
|
113
|
+
export const customSize = () => /*#__PURE__*/_jsxs(Flex, {
|
|
114
|
+
gap: "r",
|
|
115
|
+
children: [/*#__PURE__*/_jsx(Avatar, {
|
|
116
|
+
image: "https://api.dicebear.com/7.x/personas/svg?seed=aydos",
|
|
117
|
+
imageAlt: "Avatar for Ayden Lundgre",
|
|
118
|
+
customSize: "28px"
|
|
119
|
+
}), /*#__PURE__*/_jsx(Avatar, {
|
|
120
|
+
image: "https://images.unsplash.com/photo-1582213782179-e0d53f98f2ca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2370&q=80",
|
|
121
|
+
imageAlt: "Avatar for Innovation Lab",
|
|
122
|
+
customSize: "28px",
|
|
123
|
+
shape: "square"
|
|
124
|
+
}), /*#__PURE__*/_jsx(Avatar, {
|
|
125
|
+
image: "https://images.unsplash.com/photo-1582213782179-e0d53f98f2ca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2370&q=80",
|
|
126
|
+
imageAlt: "Avatar for Innovation Lab",
|
|
127
|
+
customSize: "28px",
|
|
128
|
+
shape: "hexagon"
|
|
129
|
+
}), /*#__PURE__*/_jsx(Avatar, {
|
|
130
|
+
image: "https://images.unsplash.com/photo-1627398242454-45a1465c2479?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2148&q=80",
|
|
131
|
+
imageAlt: "Avatar for Tag",
|
|
132
|
+
customSize: "28px",
|
|
133
|
+
shape: "tag"
|
|
134
|
+
})]
|
|
135
|
+
});
|
|
136
|
+
large.storyName = "customSize";
|
|
113
137
|
export const titleLevel = () => /*#__PURE__*/_jsx(Spacer, {
|
|
114
138
|
my: 4,
|
|
115
139
|
children: /*#__PURE__*/_jsx(Avatar, {
|
|
@@ -379,6 +403,11 @@ large.__docgenInfo = {
|
|
|
379
403
|
"methods": [],
|
|
380
404
|
"displayName": "large"
|
|
381
405
|
};
|
|
406
|
+
customSize.__docgenInfo = {
|
|
407
|
+
"description": "",
|
|
408
|
+
"methods": [],
|
|
409
|
+
"displayName": "customSize"
|
|
410
|
+
};
|
|
382
411
|
titleLevel.__docgenInfo = {
|
|
383
412
|
"description": "",
|
|
384
413
|
"methods": [],
|
|
@@ -63,8 +63,8 @@ const Image = styled("img").withConfig({
|
|
|
63
63
|
displayName: "Avatar__Image",
|
|
64
64
|
componentId: "sc-1wtet2j-2"
|
|
65
65
|
})(props => css({
|
|
66
|
-
width: themeGet("appScale.avatarDefault")(props),
|
|
67
|
-
height: themeGet("appScale.avatarDefault")(props),
|
|
66
|
+
width: props.customSize ? props.customSize : themeGet("appScale.avatarDefault")(props),
|
|
67
|
+
height: props.customSize ? props.customSize : themeGet("appScale.avatarDefault")(props),
|
|
68
68
|
flex: "0 0 auto",
|
|
69
69
|
backgroundColor: themeGet("colors.greyLighter")(props),
|
|
70
70
|
border: "0",
|
|
@@ -102,12 +102,12 @@ const Shape = styled("div").withConfig({
|
|
|
102
102
|
displayName: "Avatar__Shape",
|
|
103
103
|
componentId: "sc-1wtet2j-3"
|
|
104
104
|
})(props => css({
|
|
105
|
-
width: themeGet("appScale.avatarDefault")(props),
|
|
106
|
-
height: themeGet("appScale.avatarDefault")(props),
|
|
105
|
+
width: props.customSize ? props.customSize : themeGet("appScale.avatarDefault")(props),
|
|
106
|
+
height: props.customSize ? props.customSize : themeGet("appScale.avatarDefault")(props),
|
|
107
107
|
fontWeight: themeGet("fontWeights.2")(props),
|
|
108
108
|
flex: "0 0 auto",
|
|
109
|
-
|
|
110
|
-
color:
|
|
109
|
+
background: `linear-gradient(135deg, ${themeGet("colors.primaryLightest")(props)}, ${themeGet("colors.primaryLight")(props)})`,
|
|
110
|
+
color: themeGet("colors.white")(props),
|
|
111
111
|
border: "0",
|
|
112
112
|
display: "flex",
|
|
113
113
|
borderRadius: "50%",
|
|
@@ -266,7 +266,7 @@ const Avatar = _ref2 => {
|
|
|
266
266
|
shape,
|
|
267
267
|
localTime,
|
|
268
268
|
uppercase = true,
|
|
269
|
-
|
|
269
|
+
customSize,
|
|
270
270
|
...props
|
|
271
271
|
} = _ref2;
|
|
272
272
|
const hasTitle = !!title;
|
|
@@ -287,13 +287,14 @@ const Avatar = _ref2 => {
|
|
|
287
287
|
src: image,
|
|
288
288
|
sizing: sizing,
|
|
289
289
|
shape: shape,
|
|
290
|
-
alt: alt
|
|
290
|
+
alt: alt,
|
|
291
|
+
customSize: customSize
|
|
291
292
|
}) : /*#__PURE__*/_jsx(Shape, {
|
|
292
293
|
shape: shape,
|
|
293
294
|
sizing: sizing,
|
|
295
|
+
customSize: customSize,
|
|
294
296
|
type: type,
|
|
295
297
|
className: type == "inverted" ? "inverted" : "",
|
|
296
|
-
whiteInitials: whiteInitials,
|
|
297
298
|
uppercase: uppercase,
|
|
298
299
|
children: initials ? initials : shape === "hexagon" ? /*#__PURE__*/_jsx(Icon, {
|
|
299
300
|
icon: ["fas", "users"]
|
|
@@ -342,6 +343,8 @@ const Avatar = _ref2 => {
|
|
|
342
343
|
Avatar.propTypes = {
|
|
343
344
|
/** Changes the sizing of the Avatar component */
|
|
344
345
|
sizing: PropTypes.oneOf(["small", "large", "default"]),
|
|
346
|
+
/* If specifying custom sizing, provide a string with the size in pixels */
|
|
347
|
+
customSize: PropTypes.string,
|
|
345
348
|
/** Changes the shape of the Avatar component */
|
|
346
349
|
shape: PropTypes.oneOf(["square", "hexagon", "tag", "default"]),
|
|
347
350
|
/** Specifies the inverted type for dark backgrounds */
|
|
@@ -362,8 +365,6 @@ Avatar.propTypes = {
|
|
|
362
365
|
initials: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
363
366
|
/** Specifies custom content for avatar subtitle */
|
|
364
367
|
subtitleContent: PropTypes.oneOfType([PropTypes.element, PropTypes.node]),
|
|
365
|
-
/** Turns white initials on for custom `Circle` backgrounds */
|
|
366
|
-
whiteInitials: PropTypes.bool,
|
|
367
368
|
/** Specifies whether to use uppercase for initials */
|
|
368
369
|
uppercase: PropTypes.bool,
|
|
369
370
|
/** Specifies title / name as just plain text, or an element like a hyperlink or react router link */
|
|
@@ -440,6 +441,13 @@ Avatar.__docgenInfo = {
|
|
|
440
441
|
},
|
|
441
442
|
"required": false
|
|
442
443
|
},
|
|
444
|
+
"customSize": {
|
|
445
|
+
"description": "",
|
|
446
|
+
"type": {
|
|
447
|
+
"name": "string"
|
|
448
|
+
},
|
|
449
|
+
"required": false
|
|
450
|
+
},
|
|
443
451
|
"shape": {
|
|
444
452
|
"description": "Changes the shape of the Avatar component",
|
|
445
453
|
"type": {
|
|
@@ -513,13 +521,6 @@ Avatar.__docgenInfo = {
|
|
|
513
521
|
},
|
|
514
522
|
"required": false
|
|
515
523
|
},
|
|
516
|
-
"whiteInitials": {
|
|
517
|
-
"description": "Turns white initials on for custom `Circle` backgrounds",
|
|
518
|
-
"type": {
|
|
519
|
-
"name": "bool"
|
|
520
|
-
},
|
|
521
|
-
"required": false
|
|
522
|
-
},
|
|
523
524
|
"title": {
|
|
524
525
|
"description": "Specifies title / name as just plain text, or an element like a hyperlink or react router link",
|
|
525
526
|
"type": {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import styled, { ThemeProvider } from "styled-components";
|
|
3
|
-
import { space, layout, color, border, variant, compose } from "styled-system";
|
|
3
|
+
import { space, layout, flexbox, color, border, variant, 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, color, border);
|
|
9
|
+
const boxStyles = compose(space, layout, flexbox, color, border);
|
|
10
10
|
const BoxWrapper = styled("div").withConfig({
|
|
11
11
|
shouldForwardProp,
|
|
12
12
|
displayName: "Box__BoxWrapper",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import styled, { ThemeProvider } from "styled-components";
|
|
4
|
-
import { space, layout, flexbox, compose } from "styled-system";
|
|
4
|
+
import { space, layout, flexbox, color, border, compose } from "styled-system";
|
|
5
5
|
import { css } from "@styled-system/css";
|
|
6
6
|
import shouldForwardProp from "@styled-system/should-forward-prop";
|
|
7
7
|
import styledPropTypes from "@styled-system/prop-types";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const FlexStyles = compose(space, layout, flexbox);
|
|
9
|
+
const FlexStyles = compose(space, layout, flexbox, color, border);
|
|
10
10
|
const FlexWrapper = styled("div").withConfig({
|
|
11
11
|
shouldForwardProp,
|
|
12
12
|
displayName: "Flex__FlexWrapper",
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import FloatingPanels from ".";
|
|
3
|
+
import Box from "../Box";
|
|
4
|
+
import { far } from "@fortawesome/free-regular-svg-icons";
|
|
5
|
+
import { library } from "@fortawesome/fontawesome-svg-core";
|
|
6
|
+
import TextInput from "../TextInput";
|
|
7
|
+
import Toggle from "../Toggle";
|
|
8
|
+
import Spacer from "../Spacer";
|
|
9
|
+
import Badge from "../Badge";
|
|
10
|
+
import { P } from "../Typography";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
|
+
library.add(far);
|
|
13
|
+
export default {
|
|
14
|
+
title: "Components/FloatingPanels",
|
|
15
|
+
decorators: [storyFn => /*#__PURE__*/_jsx(Box, {
|
|
16
|
+
minHeight: "600px",
|
|
17
|
+
children: storyFn()
|
|
18
|
+
})],
|
|
19
|
+
component: FloatingPanels
|
|
20
|
+
};
|
|
21
|
+
const Properties = () => {
|
|
22
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
23
|
+
children: [/*#__PURE__*/_jsxs(Spacer, {
|
|
24
|
+
mb: "r",
|
|
25
|
+
children: [/*#__PURE__*/_jsx(Badge, {
|
|
26
|
+
variant: "secondary",
|
|
27
|
+
children: "Blah"
|
|
28
|
+
}), /*#__PURE__*/_jsx(P, {
|
|
29
|
+
children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
|
30
|
+
}), /*#__PURE__*/_jsx(Toggle, {
|
|
31
|
+
id: "toggle1",
|
|
32
|
+
label: "Group items",
|
|
33
|
+
small: true
|
|
34
|
+
}), /*#__PURE__*/_jsx(Toggle, {
|
|
35
|
+
id: "toggle2",
|
|
36
|
+
label: "Show teams",
|
|
37
|
+
small: true
|
|
38
|
+
})]
|
|
39
|
+
}), /*#__PURE__*/_jsx(TextInput, {
|
|
40
|
+
id: "textInput1",
|
|
41
|
+
type: "text",
|
|
42
|
+
label: "Full name",
|
|
43
|
+
placeholder: "E.g. John Smith",
|
|
44
|
+
my: "20px"
|
|
45
|
+
}, "textInput1")]
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
const panels = [{
|
|
49
|
+
id: "view-options",
|
|
50
|
+
iconName: "eye",
|
|
51
|
+
title: "View Options",
|
|
52
|
+
defaultExpanded: true,
|
|
53
|
+
content: /*#__PURE__*/_jsx(Properties, {})
|
|
54
|
+
}, {
|
|
55
|
+
id: "properties",
|
|
56
|
+
iconName: "sun",
|
|
57
|
+
title: "Properties",
|
|
58
|
+
content: /*#__PURE__*/_jsx(Properties, {})
|
|
59
|
+
}, {
|
|
60
|
+
id: "person-details",
|
|
61
|
+
iconName: "user",
|
|
62
|
+
title: "Person Details",
|
|
63
|
+
content: /*#__PURE__*/_jsx(Properties, {})
|
|
64
|
+
}];
|
|
65
|
+
export const defaultFloatingPanels = () => {
|
|
66
|
+
return /*#__PURE__*/_jsx(FloatingPanels, {
|
|
67
|
+
panels: panels,
|
|
68
|
+
containerHeight: 500,
|
|
69
|
+
position: {
|
|
70
|
+
right: 20,
|
|
71
|
+
top: 20
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
defaultFloatingPanels.storyName = "Default Floating Panels";
|
|
76
|
+
defaultFloatingPanels.__docgenInfo = {
|
|
77
|
+
"description": "",
|
|
78
|
+
"methods": [],
|
|
79
|
+
"displayName": "defaultFloatingPanels"
|
|
80
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { themeGet } from "@styled-system/theme-get";
|
|
3
|
+
export const Container = styled.div.withConfig({
|
|
4
|
+
displayName: "FloatingPanelsstyles__Container",
|
|
5
|
+
componentId: "sc-1by914f-0"
|
|
6
|
+
})(["z-index:2;position:absolute;display:flex;flex-direction:column;gap:8px;width:300px;max-height:", ";", ""], _ref => {
|
|
7
|
+
let {
|
|
8
|
+
containerHeight
|
|
9
|
+
} = _ref;
|
|
10
|
+
return containerHeight ? `${containerHeight}px` : "100%";
|
|
11
|
+
}, _ref2 => {
|
|
12
|
+
let {
|
|
13
|
+
position
|
|
14
|
+
} = _ref2;
|
|
15
|
+
return Object.entries(position).filter(_ref3 => {
|
|
16
|
+
let [, value] = _ref3;
|
|
17
|
+
return value !== undefined;
|
|
18
|
+
}).map(_ref4 => {
|
|
19
|
+
let [key, value] = _ref4;
|
|
20
|
+
return `${key}: ${typeof value === "number" ? `${value}px` : value};`;
|
|
21
|
+
}).join("\n");
|
|
22
|
+
});
|
|
23
|
+
export const PanelWrapper = styled.div.withConfig({
|
|
24
|
+
displayName: "FloatingPanelsstyles__PanelWrapper",
|
|
25
|
+
componentId: "sc-1by914f-1"
|
|
26
|
+
})(["background:white;border:", ";border-radius:8px;border-radius:0 0 8px 8px;box-shadow:", ";overflow-y:", ";padding:", ";margin-top:46px;max-height:", ";transition:max-height 0.3s ease-in-out;"], _ref5 => {
|
|
27
|
+
let {
|
|
28
|
+
isExpanded,
|
|
29
|
+
theme
|
|
30
|
+
} = _ref5;
|
|
31
|
+
return isExpanded ? `1px solid ${theme.colors.greyLighter}` : "1px solid white";
|
|
32
|
+
}, _ref6 => {
|
|
33
|
+
let {
|
|
34
|
+
isExpanded
|
|
35
|
+
} = _ref6;
|
|
36
|
+
return isExpanded ? "0 1px 3px rgba(0, 0, 0, 0.1)" : "none";
|
|
37
|
+
}, _ref7 => {
|
|
38
|
+
let {
|
|
39
|
+
isExpanded
|
|
40
|
+
} = _ref7;
|
|
41
|
+
return isExpanded ? "auto" : "hidden";
|
|
42
|
+
}, _ref8 => {
|
|
43
|
+
let {
|
|
44
|
+
isExpanded
|
|
45
|
+
} = _ref8;
|
|
46
|
+
return isExpanded ? "0 12px 12px 12px" : "0 12px";
|
|
47
|
+
}, _ref9 => {
|
|
48
|
+
let {
|
|
49
|
+
isExpanded
|
|
50
|
+
} = _ref9;
|
|
51
|
+
return isExpanded ? "none" : "0";
|
|
52
|
+
});
|
|
53
|
+
export const PanelHeader = styled.button.withConfig({
|
|
54
|
+
displayName: "FloatingPanelsstyles__PanelHeader",
|
|
55
|
+
componentId: "sc-1by914f-2"
|
|
56
|
+
})(["font-family:", ";box-shadow:0 0 4px rgba(0,0,0,0.1);color:", ";width:100%;margin-left:-13px;margin-top:-46px;border-radius:", ";appearance:none;background-color:white;display:flex;align-items:center;justify-content:space-between;padding:12px 12px 12px 12px;height:46px;position:absolute;width:300px;border-bottom:", ";border:solid 1px ", ";z-index:1;cursor:pointer;user-select:none;transition:padding 0.3s ease-in-out;&:focus{outline:none;}"], themeGet("fonts.main"), themeGet("colors.greyDarkest"), _ref10 => {
|
|
57
|
+
let {
|
|
58
|
+
isExpanded
|
|
59
|
+
} = _ref10;
|
|
60
|
+
return isExpanded ? "8px 8px 0 0" : "8px";
|
|
61
|
+
}, _ref11 => {
|
|
62
|
+
let {
|
|
63
|
+
isExpanded,
|
|
64
|
+
theme
|
|
65
|
+
} = _ref11;
|
|
66
|
+
return isExpanded ? `1px solid ${theme.colors.greyLighter}` : "none";
|
|
67
|
+
}, themeGet("colors.greyLighter"));
|
|
68
|
+
export const HeaderContent = styled.div.withConfig({
|
|
69
|
+
displayName: "FloatingPanelsstyles__HeaderContent",
|
|
70
|
+
componentId: "sc-1by914f-3"
|
|
71
|
+
})(["display:flex;align-items:center;gap:12px;"]);
|
|
72
|
+
export const Title = styled.span.withConfig({
|
|
73
|
+
displayName: "FloatingPanelsstyles__Title",
|
|
74
|
+
componentId: "sc-1by914f-4"
|
|
75
|
+
})(["font-size:14px;font-weight:500;"]);
|
|
76
|
+
export const IconWrapper = styled.div.withConfig({
|
|
77
|
+
displayName: "FloatingPanelsstyles__IconWrapper",
|
|
78
|
+
componentId: "sc-1by914f-5"
|
|
79
|
+
})(["background-color:", ";width:22px;height:22px;border-radius:50%;display:flex;align-items:center;justify-content:center;"], themeGet("colors.primary"));
|
|
80
|
+
export const ChevronWrapper = styled(IconWrapper).withConfig({
|
|
81
|
+
displayName: "FloatingPanelsstyles__ChevronWrapper",
|
|
82
|
+
componentId: "sc-1by914f-6"
|
|
83
|
+
})(["transition:background-color 0.3s ease-in-out;background-color:", ";"], _ref12 => {
|
|
84
|
+
let {
|
|
85
|
+
isHovered
|
|
86
|
+
} = _ref12;
|
|
87
|
+
return isHovered ? themeGet("colors.greyLighter") : "white";
|
|
88
|
+
});
|
|
89
|
+
export const PanelContent = styled.div.withConfig({
|
|
90
|
+
displayName: "FloatingPanelsstyles__PanelContent",
|
|
91
|
+
componentId: "sc-1by914f-7"
|
|
92
|
+
})(["padding-top:12px;display:", ";height:", ";opacity:", ";"], _ref13 => {
|
|
93
|
+
let {
|
|
94
|
+
isExpanded
|
|
95
|
+
} = _ref13;
|
|
96
|
+
return isExpanded ? "block" : "none";
|
|
97
|
+
}, _ref14 => {
|
|
98
|
+
let {
|
|
99
|
+
isExpanded
|
|
100
|
+
} = _ref14;
|
|
101
|
+
return isExpanded ? "100%" : "0";
|
|
102
|
+
}, _ref15 => {
|
|
103
|
+
let {
|
|
104
|
+
isExpanded
|
|
105
|
+
} = _ref15;
|
|
106
|
+
return isExpanded ? "1" : "0";
|
|
107
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import Icon from "../Icon";
|
|
4
|
+
import { PanelWrapper, PanelHeader, HeaderContent, Title, IconWrapper, ChevronWrapper, PanelContent } from "./FloatingPanels.styles";
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
const Panel = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
iconName,
|
|
9
|
+
title,
|
|
10
|
+
containerHeight,
|
|
11
|
+
content,
|
|
12
|
+
defaultExpanded = false
|
|
13
|
+
} = _ref;
|
|
14
|
+
const [isExpanded, setIsExpanded] = useState(defaultExpanded);
|
|
15
|
+
const arrowIcon = isExpanded ? "chevron-up" : "chevron-down";
|
|
16
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
17
|
+
return /*#__PURE__*/_jsxs(PanelWrapper, {
|
|
18
|
+
containerHeight: containerHeight,
|
|
19
|
+
isExpanded: isExpanded,
|
|
20
|
+
children: [/*#__PURE__*/_jsxs(PanelHeader, {
|
|
21
|
+
onClick: () => setIsExpanded(!isExpanded),
|
|
22
|
+
isExpanded: isExpanded,
|
|
23
|
+
onMouseEnter: () => setIsHovered(true),
|
|
24
|
+
onMouseLeave: () => setIsHovered(false),
|
|
25
|
+
onFocus: () => setIsHovered(true),
|
|
26
|
+
onBlur: () => setIsHovered(false),
|
|
27
|
+
children: [/*#__PURE__*/_jsxs(HeaderContent, {
|
|
28
|
+
children: [/*#__PURE__*/_jsx(IconWrapper, {
|
|
29
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
30
|
+
size: "xs",
|
|
31
|
+
color: "white",
|
|
32
|
+
icon: ["far", iconName]
|
|
33
|
+
})
|
|
34
|
+
}), /*#__PURE__*/_jsx(Title, {
|
|
35
|
+
children: title
|
|
36
|
+
})]
|
|
37
|
+
}), /*#__PURE__*/_jsx(ChevronWrapper, {
|
|
38
|
+
isHovered: isHovered,
|
|
39
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
40
|
+
size: "sm",
|
|
41
|
+
icon: ["fas", arrowIcon],
|
|
42
|
+
color: "greyDarker"
|
|
43
|
+
})
|
|
44
|
+
})]
|
|
45
|
+
}), /*#__PURE__*/_jsx(PanelContent, {
|
|
46
|
+
isExpanded: isExpanded,
|
|
47
|
+
children: content
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
Panel.propTypes = {
|
|
52
|
+
iconName: PropTypes.string.isRequired,
|
|
53
|
+
title: PropTypes.string.isRequired,
|
|
54
|
+
content: PropTypes.node.isRequired,
|
|
55
|
+
defaultExpanded: PropTypes.bool,
|
|
56
|
+
containerHeight: PropTypes.number,
|
|
57
|
+
isExpanded: PropTypes.bool.isRequired
|
|
58
|
+
};
|
|
59
|
+
Panel.defaultProps = {
|
|
60
|
+
defaultExpanded: false
|
|
61
|
+
};
|
|
62
|
+
Panel.__docgenInfo = {
|
|
63
|
+
"description": "",
|
|
64
|
+
"methods": [],
|
|
65
|
+
"displayName": "Panel",
|
|
66
|
+
"props": {
|
|
67
|
+
"defaultExpanded": {
|
|
68
|
+
"defaultValue": {
|
|
69
|
+
"value": "false",
|
|
70
|
+
"computed": false
|
|
71
|
+
},
|
|
72
|
+
"description": "",
|
|
73
|
+
"type": {
|
|
74
|
+
"name": "bool"
|
|
75
|
+
},
|
|
76
|
+
"required": false
|
|
77
|
+
},
|
|
78
|
+
"iconName": {
|
|
79
|
+
"description": "",
|
|
80
|
+
"type": {
|
|
81
|
+
"name": "string"
|
|
82
|
+
},
|
|
83
|
+
"required": true
|
|
84
|
+
},
|
|
85
|
+
"title": {
|
|
86
|
+
"description": "",
|
|
87
|
+
"type": {
|
|
88
|
+
"name": "string"
|
|
89
|
+
},
|
|
90
|
+
"required": true
|
|
91
|
+
},
|
|
92
|
+
"content": {
|
|
93
|
+
"description": "",
|
|
94
|
+
"type": {
|
|
95
|
+
"name": "node"
|
|
96
|
+
},
|
|
97
|
+
"required": true
|
|
98
|
+
},
|
|
99
|
+
"containerHeight": {
|
|
100
|
+
"description": "",
|
|
101
|
+
"type": {
|
|
102
|
+
"name": "number"
|
|
103
|
+
},
|
|
104
|
+
"required": false
|
|
105
|
+
},
|
|
106
|
+
"isExpanded": {
|
|
107
|
+
"description": "",
|
|
108
|
+
"type": {
|
|
109
|
+
"name": "bool"
|
|
110
|
+
},
|
|
111
|
+
"required": true
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
export default Panel;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Container } from "./FloatingPanels.styles";
|
|
3
|
+
import Panel from "./Panel";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const FloatingPanels = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
panels,
|
|
9
|
+
containerHeight,
|
|
10
|
+
position = {
|
|
11
|
+
right: 20,
|
|
12
|
+
top: 20
|
|
13
|
+
}
|
|
14
|
+
} = _ref;
|
|
15
|
+
return /*#__PURE__*/_jsx(Container, {
|
|
16
|
+
containerHeight: containerHeight,
|
|
17
|
+
position: position,
|
|
18
|
+
children: panels.map(panel => /*#__PURE__*/_jsx(Panel, {
|
|
19
|
+
...panel,
|
|
20
|
+
containerHeight: containerHeight
|
|
21
|
+
}, panel?.id))
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
FloatingPanels.propTypes = {
|
|
25
|
+
panels: PropTypes.arrayOf(PropTypes.shape({
|
|
26
|
+
id: PropTypes.string.isRequired,
|
|
27
|
+
iconName: PropTypes.string.isRequired,
|
|
28
|
+
title: PropTypes.string.isRequired,
|
|
29
|
+
content: PropTypes.node.isRequired,
|
|
30
|
+
defaultExpanded: PropTypes.bool
|
|
31
|
+
})).isRequired,
|
|
32
|
+
containerHeight: PropTypes.number,
|
|
33
|
+
position: PropTypes.shape({
|
|
34
|
+
top: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
35
|
+
right: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
36
|
+
bottom: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
37
|
+
left: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
FloatingPanels.defaultProps = {
|
|
41
|
+
position: {
|
|
42
|
+
right: 20,
|
|
43
|
+
top: 20
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
FloatingPanels.__docgenInfo = {
|
|
47
|
+
"description": "",
|
|
48
|
+
"methods": [],
|
|
49
|
+
"displayName": "FloatingPanels",
|
|
50
|
+
"props": {
|
|
51
|
+
"position": {
|
|
52
|
+
"defaultValue": {
|
|
53
|
+
"value": "{ right: 20, top: 20 }",
|
|
54
|
+
"computed": false
|
|
55
|
+
},
|
|
56
|
+
"description": "",
|
|
57
|
+
"type": {
|
|
58
|
+
"name": "shape",
|
|
59
|
+
"value": {
|
|
60
|
+
"top": {
|
|
61
|
+
"name": "union",
|
|
62
|
+
"value": [{
|
|
63
|
+
"name": "number"
|
|
64
|
+
}, {
|
|
65
|
+
"name": "string"
|
|
66
|
+
}],
|
|
67
|
+
"required": false
|
|
68
|
+
},
|
|
69
|
+
"right": {
|
|
70
|
+
"name": "union",
|
|
71
|
+
"value": [{
|
|
72
|
+
"name": "number"
|
|
73
|
+
}, {
|
|
74
|
+
"name": "string"
|
|
75
|
+
}],
|
|
76
|
+
"required": false
|
|
77
|
+
},
|
|
78
|
+
"bottom": {
|
|
79
|
+
"name": "union",
|
|
80
|
+
"value": [{
|
|
81
|
+
"name": "number"
|
|
82
|
+
}, {
|
|
83
|
+
"name": "string"
|
|
84
|
+
}],
|
|
85
|
+
"required": false
|
|
86
|
+
},
|
|
87
|
+
"left": {
|
|
88
|
+
"name": "union",
|
|
89
|
+
"value": [{
|
|
90
|
+
"name": "number"
|
|
91
|
+
}, {
|
|
92
|
+
"name": "string"
|
|
93
|
+
}],
|
|
94
|
+
"required": false
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"required": false
|
|
99
|
+
},
|
|
100
|
+
"panels": {
|
|
101
|
+
"description": "",
|
|
102
|
+
"type": {
|
|
103
|
+
"name": "arrayOf",
|
|
104
|
+
"value": {
|
|
105
|
+
"name": "shape",
|
|
106
|
+
"value": {
|
|
107
|
+
"id": {
|
|
108
|
+
"name": "string",
|
|
109
|
+
"required": true
|
|
110
|
+
},
|
|
111
|
+
"iconName": {
|
|
112
|
+
"name": "string",
|
|
113
|
+
"required": true
|
|
114
|
+
},
|
|
115
|
+
"title": {
|
|
116
|
+
"name": "string",
|
|
117
|
+
"required": true
|
|
118
|
+
},
|
|
119
|
+
"content": {
|
|
120
|
+
"name": "node",
|
|
121
|
+
"required": true
|
|
122
|
+
},
|
|
123
|
+
"defaultExpanded": {
|
|
124
|
+
"name": "bool",
|
|
125
|
+
"required": false
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"required": true
|
|
131
|
+
},
|
|
132
|
+
"containerHeight": {
|
|
133
|
+
"description": "",
|
|
134
|
+
"type": {
|
|
135
|
+
"name": "number"
|
|
136
|
+
},
|
|
137
|
+
"required": false
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
export default FloatingPanels;
|