orcs-design-system 3.2.47 → 3.2.48

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.
@@ -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:fixed;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;
@@ -21,6 +21,7 @@ test("all components exported", () => {
21
21
  "Expandable",
22
22
  "Flex",
23
23
  "FlexItem",
24
+ "FloatingPanels",
24
25
  "GlobalStyles",
25
26
  "Grid",
26
27
  "GridItem",
package/es/index.js CHANGED
@@ -20,6 +20,7 @@ export { default as Divider } from "./components/Divider";
20
20
  export { default as Expandable } from "./components/Expandable";
21
21
  export { default as Flex, FlexItem } from "./components/Flex";
22
22
  export { default as Grid, GridItem } from "./components/Grid";
23
+ export { default as FloatingPanels } from "./components/FloatingPanels";
23
24
  export { default as Header } from "./components/Header";
24
25
  export { default as HeaderSimple } from "./components/HeaderSimple";
25
26
  export { default as Icon } from "./components/Icon";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "3.2.47",
3
+ "version": "3.2.48",
4
4
  "engines": {
5
5
  "node": "20.12.2"
6
6
  },