orcs-design-system 3.3.21 → 3.3.23

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.
@@ -144,7 +144,6 @@ export const ActionsMenuBody = _ref2 => {
144
144
  const triggerRef = useMergeRefs([actionMenu.refs.setReference, childrenRef]);
145
145
  const ref = useMergeRefs([actionMenu.refs.setFloating]);
146
146
  const triggerProps = useMemo(() => ({
147
- ariaLabel,
148
147
  "aria-label": ariaLabel,
149
148
  onFocus: onTriggerFocus,
150
149
  id,
@@ -289,7 +288,7 @@ ActionsMenu.propTypes = {
289
288
  /** Specifies the colour theme */
290
289
  theme: PropTypes.object,
291
290
  /** Specifies the aria-label for the button */
292
- ariaLabel: PropTypes.object
291
+ ariaLabel: PropTypes.string
293
292
  };
294
293
  ActionsMenu.__docgenInfo = {
295
294
  "description": "",
@@ -393,7 +392,7 @@ ActionsMenu.__docgenInfo = {
393
392
  "ariaLabel": {
394
393
  "description": "Specifies the aria-label for the button",
395
394
  "type": {
396
- "name": "object"
395
+ "name": "string"
397
396
  },
398
397
  "required": false
399
398
  }
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import FloatingPanels from ".";
3
- import Box from "../Box";
4
3
  import { far } from "@fortawesome/free-regular-svg-icons";
5
4
  import { library } from "@fortawesome/fontawesome-svg-core";
5
+ import Box from "../Box";
6
6
  import TextInput from "../TextInput";
7
7
  import Toggle from "../Toggle";
8
8
  import Spacer from "../Spacer";
@@ -14,95 +14,263 @@ export default {
14
14
  title: "Components/FloatingPanels",
15
15
  component: FloatingPanels
16
16
  };
17
- const Properties = () => {
18
- return /*#__PURE__*/_jsxs(_Fragment, {
19
- children: [/*#__PURE__*/_jsxs(Spacer, {
20
- mb: "r",
21
- children: [/*#__PURE__*/_jsx(Badge, {
22
- variant: "secondary",
23
- children: "Blah"
24
- }), /*#__PURE__*/_jsx(P, {
25
- 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."
26
- }), /*#__PURE__*/_jsx(Toggle, {
27
- id: "toggle1",
28
- label: "Group items",
29
- small: true
30
- }), /*#__PURE__*/_jsx(Toggle, {
31
- id: "toggle2",
32
- label: "Show teams",
33
- small: true
34
- })]
35
- }), /*#__PURE__*/_jsx(TextInput, {
36
- id: "textInput1",
37
- type: "text",
38
- label: "Full name",
39
- placeholder: "E.g. John Smith",
40
- my: "20px"
41
- }, "textInput1")]
42
- });
43
- };
44
- const createPanels = function () {
45
- let shouldUseAsControl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
46
- const panels = [{
47
- id: "view-options",
48
- iconName: "eye",
49
- title: "View Options",
50
- expanded: true,
51
- content: /*#__PURE__*/_jsx(Properties, {})
52
- }, {
53
- id: "properties",
54
- iconName: "sun",
55
- title: "Properties",
56
- content: /*#__PURE__*/_jsx(Properties, {})
57
- }, {
58
- id: "person-details",
59
- iconName: "user",
60
- title: "Person Details",
61
- content: /*#__PURE__*/_jsx(Properties, {})
62
- }];
63
- if (shouldUseAsControl) {
64
- return panels;
65
- }
66
- return panels.map(panel => ({
67
- ...panel,
68
- expanded: panel.id === "person-details" ? true : false,
69
- content: null,
70
- stopToggling: panel.id === "view-options" ? false : true,
71
- noActiveState: panel.id === "view-options" ? true : false
72
- }));
73
- };
74
- export const defaultFloatingPanels = () => {
75
- return /*#__PURE__*/_jsx(Box, {
76
- minHeight: "600px",
77
- children: /*#__PURE__*/_jsx(FloatingPanels, {
78
- panels: createPanels(),
79
- containerHeight: 500,
80
- position: {
81
- right: 20,
82
- top: 20
83
- }
84
- })
85
- });
86
- };
17
+ const PanelContent = () => /*#__PURE__*/_jsxs(_Fragment, {
18
+ children: [/*#__PURE__*/_jsxs(Spacer, {
19
+ mb: "r",
20
+ children: [/*#__PURE__*/_jsx(Badge, {
21
+ variant: "secondary",
22
+ children: "Blah"
23
+ }), /*#__PURE__*/_jsx(P, {
24
+ 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."
25
+ }), /*#__PURE__*/_jsx(Toggle, {
26
+ id: "toggle1",
27
+ label: "Group items",
28
+ small: true
29
+ }), /*#__PURE__*/_jsx(Toggle, {
30
+ id: "toggle2",
31
+ label: "Show teams",
32
+ small: true
33
+ })]
34
+ }), /*#__PURE__*/_jsx(TextInput, {
35
+ id: "textInput1",
36
+ type: "text",
37
+ label: "Full name",
38
+ placeholder: "E.g. John Smith",
39
+ my: "20px"
40
+ }, "textInput1")]
41
+ });
42
+ export const defaultFloatingPanels = () => /*#__PURE__*/_jsx(Box, {
43
+ minHeight: "600px",
44
+ children: /*#__PURE__*/_jsx(FloatingPanels, {
45
+ containerHeight: "500px",
46
+ defaultSelectedPanelId: "view-options",
47
+ panels: [{
48
+ id: "view-options",
49
+ title: "View Options",
50
+ iconName: "eye",
51
+ content: /*#__PURE__*/_jsx(PanelContent, {})
52
+ }, {
53
+ id: "properties",
54
+ title: "Properties",
55
+ iconName: "sun",
56
+ content: /*#__PURE__*/_jsx(PanelContent, {})
57
+ }, {
58
+ id: "person-details",
59
+ title: "Person Details",
60
+ iconName: "user",
61
+ content: /*#__PURE__*/_jsx(PanelContent, {})
62
+ }]
63
+ })
64
+ });
87
65
  defaultFloatingPanels.storyName = "Default Floating Panels";
88
- export const floatingActionsPanel = () => {
89
- return /*#__PURE__*/_jsx(FloatingPanels, {
90
- panels: createPanels(false),
66
+ export const alignedFloatingPanels = () => /*#__PURE__*/_jsxs(Box, {
67
+ minHeight: "160px",
68
+ children: [/*#__PURE__*/_jsx(FloatingPanels, {
69
+ alignPanels: "left",
91
70
  position: {
92
- bottom: 10
71
+ top: 0,
72
+ left: 0
93
73
  },
74
+ defaultSelectedPanelId: "view-options",
75
+ panels: [{
76
+ id: "view-options",
77
+ title: "View Options",
78
+ iconName: "eye",
79
+ content: /*#__PURE__*/_jsx("p", {
80
+ children: "left"
81
+ })
82
+ }, {
83
+ id: "properties",
84
+ title: "Properties",
85
+ iconName: "sun",
86
+ content: /*#__PURE__*/_jsx("p", {
87
+ children: "center"
88
+ })
89
+ }, {
90
+ id: "person-details",
91
+ title: "Person Details",
92
+ iconName: "user",
93
+ content: /*#__PURE__*/_jsx("p", {
94
+ children: "right"
95
+ })
96
+ }]
97
+ }), /*#__PURE__*/_jsx(FloatingPanels, {
98
+ alignPanels: "center",
94
99
  centered: true,
95
- onClick: panelId => alert(`Panel ${panelId} clicked`)
96
- });
97
- };
98
- floatingActionsPanel.storyName = "Floating Panels as Controls";
100
+ defaultSelectedPanelId: "properties",
101
+ panels: [{
102
+ id: "view-options",
103
+ title: "View Options",
104
+ iconName: "eye",
105
+ content: /*#__PURE__*/_jsx("p", {
106
+ children: "left"
107
+ })
108
+ }, {
109
+ id: "properties",
110
+ title: "Properties",
111
+ iconName: "sun",
112
+ content: /*#__PURE__*/_jsx("p", {
113
+ children: "center"
114
+ })
115
+ }, {
116
+ id: "person-details",
117
+ title: "Person Details",
118
+ iconName: "user",
119
+ content: /*#__PURE__*/_jsx("p", {
120
+ children: "right"
121
+ })
122
+ }]
123
+ }), /*#__PURE__*/_jsx(FloatingPanels, {
124
+ alignPanels: "right",
125
+ position: {
126
+ top: 0,
127
+ right: 0
128
+ },
129
+ defaultSelectedPanelId: "person-details",
130
+ panels: [{
131
+ id: "view-options",
132
+ title: "View Options",
133
+ iconName: "eye",
134
+ content: /*#__PURE__*/_jsx("p", {
135
+ children: "left"
136
+ })
137
+ }, {
138
+ id: "properties",
139
+ title: "Properties",
140
+ iconName: "sun",
141
+ content: /*#__PURE__*/_jsx("p", {
142
+ children: "center"
143
+ })
144
+ }, {
145
+ id: "person-details",
146
+ title: "Person Details",
147
+ iconName: "user",
148
+ content: /*#__PURE__*/_jsx("p", {
149
+ children: "right"
150
+ })
151
+ }]
152
+ })]
153
+ });
154
+ alignedFloatingPanels.storyName = "Aligned Floating Panels";
155
+ export const buttonFloatingPanels = () => /*#__PURE__*/_jsx(Box, {
156
+ minHeight: "60px",
157
+ children: /*#__PURE__*/_jsx(FloatingPanels, {
158
+ onClick: panelId => alert(`Panel ${panelId} clicked`),
159
+ panels: [{
160
+ id: "view-options",
161
+ title: "View Options",
162
+ iconName: "eye"
163
+ }, {
164
+ id: "properties",
165
+ title: "Properties",
166
+ iconName: "sun"
167
+ }, {
168
+ id: "person-details",
169
+ title: "Person Details",
170
+ iconName: "user"
171
+ }]
172
+ })
173
+ });
174
+ buttonFloatingPanels.storyName = "Button Floating Panels";
175
+ export const unselectableFloatingPanels = () => /*#__PURE__*/_jsx(Box, {
176
+ minHeight: "160px",
177
+ children: /*#__PURE__*/_jsx(FloatingPanels, {
178
+ disablePanelSelect: true,
179
+ defaultSelectedPanelId: "selected",
180
+ panels: [{
181
+ id: "selected",
182
+ title: "Selected",
183
+ iconName: "smile",
184
+ content: /*#__PURE__*/_jsxs("span", {
185
+ children: ["You cannot change this selection due to", " ", /*#__PURE__*/_jsx("code", {
186
+ children: "disablePanelSelect"
187
+ })]
188
+ })
189
+ }, {
190
+ id: "unselectable",
191
+ title: "Unselectable",
192
+ iconName: "frown",
193
+ content: "You cannot select this panel due to disablePanelSelect"
194
+ }]
195
+ })
196
+ });
197
+ unselectableFloatingPanels.storyName = "Unselectable Floating Panels";
198
+ export const highlightedFloatingPanels = () => /*#__PURE__*/_jsx(Box, {
199
+ minHeight: "60px",
200
+ children: /*#__PURE__*/_jsx(FloatingPanels, {
201
+ panels: [{
202
+ id: "1",
203
+ title: "Smiling",
204
+ iconName: "smile",
205
+ forceHighlight: true
206
+ }, {
207
+ id: "2",
208
+ title: "Frowning",
209
+ iconName: "frown",
210
+ forceHighlight: true
211
+ }, {
212
+ id: "3",
213
+ title: "Laughing",
214
+ iconName: "laugh",
215
+ forceHighlight: true
216
+ }]
217
+ })
218
+ });
219
+ highlightedFloatingPanels.storyName = "Highlighted Floating Panels";
220
+ export const groupedFloatingPanels = () => /*#__PURE__*/_jsx(Box, {
221
+ minHeight: "60px",
222
+ children: /*#__PURE__*/_jsx(FloatingPanels, {
223
+ panels: [{
224
+ id: "1",
225
+ title: "Laughing",
226
+ iconName: "user",
227
+ grouping: undefined
228
+ }, {
229
+ id: "1",
230
+ title: "Laughing",
231
+ iconName: "laugh",
232
+ grouping: "happy"
233
+ }, {
234
+ id: "2",
235
+ title: "Smiling",
236
+ iconName: "smile",
237
+ grouping: "happy"
238
+ }, {
239
+ id: "3",
240
+ title: "Frowning",
241
+ iconName: "frown",
242
+ grouping: "sad"
243
+ }]
244
+ })
245
+ });
246
+ groupedFloatingPanels.storyName = "Grouped Floating Panels";
99
247
  defaultFloatingPanels.__docgenInfo = {
100
248
  "description": "",
101
249
  "methods": [],
102
250
  "displayName": "defaultFloatingPanels"
103
251
  };
104
- floatingActionsPanel.__docgenInfo = {
252
+ alignedFloatingPanels.__docgenInfo = {
253
+ "description": "",
254
+ "methods": [],
255
+ "displayName": "alignedFloatingPanels"
256
+ };
257
+ buttonFloatingPanels.__docgenInfo = {
258
+ "description": "",
259
+ "methods": [],
260
+ "displayName": "buttonFloatingPanels"
261
+ };
262
+ unselectableFloatingPanels.__docgenInfo = {
263
+ "description": "",
264
+ "methods": [],
265
+ "displayName": "unselectableFloatingPanels"
266
+ };
267
+ highlightedFloatingPanels.__docgenInfo = {
268
+ "description": "",
269
+ "methods": [],
270
+ "displayName": "highlightedFloatingPanels"
271
+ };
272
+ groupedFloatingPanels.__docgenInfo = {
105
273
  "description": "",
106
274
  "methods": [],
107
- "displayName": "floatingActionsPanel"
275
+ "displayName": "groupedFloatingPanels"
108
276
  };
@@ -4,31 +4,44 @@ const panelWidth = "300px";
4
4
  export const ComponentContainer = styled.div.withConfig({
5
5
  displayName: "FloatingPanelsstyles__ComponentContainer",
6
6
  componentId: "sc-1by914f-0"
7
- })(["z-index:", ";position:absolute;display:flex;flex-direction:column;align-items:flex-end;gap:8px;max-height:", ";", " ", ""], _ref => {
7
+ })(["z-index:", ";position:absolute;display:flex;flex-direction:column;align-items:", ";gap:8px;max-height:", ";", " ", ""], _ref => {
8
8
  let {
9
9
  zIndex
10
10
  } = _ref;
11
11
  return zIndex;
12
12
  }, _ref2 => {
13
13
  let {
14
- containerHeight
14
+ alignPanels
15
15
  } = _ref2;
16
- return containerHeight ? `${containerHeight}px` : "100%";
16
+ switch (alignPanels) {
17
+ case "left":
18
+ return "flex-start;";
19
+ case "center":
20
+ return "center;";
21
+ case "right":
22
+ default:
23
+ return "flex-end;";
24
+ }
17
25
  }, _ref3 => {
18
26
  let {
19
- position
27
+ containerHeight
20
28
  } = _ref3;
21
- return Object.entries(position).filter(_ref4 => {
22
- let [, value] = _ref4;
29
+ return containerHeight;
30
+ }, _ref4 => {
31
+ let {
32
+ position
33
+ } = _ref4;
34
+ return Object.entries(position).filter(_ref5 => {
35
+ let [, value] = _ref5;
23
36
  return value !== undefined;
24
- }).map(_ref5 => {
25
- let [key, value] = _ref5;
37
+ }).map(_ref6 => {
38
+ let [key, value] = _ref6;
26
39
  return `${key}: ${typeof value === "number" ? `${value}px` : value};`;
27
40
  }).join("\n");
28
- }, _ref6 => {
41
+ }, _ref7 => {
29
42
  let {
30
43
  centered
31
- } = _ref6;
44
+ } = _ref7;
32
45
  return centered ? `
33
46
  margin-left: 50%;
34
47
  transform: translateX(-50%);
@@ -38,19 +51,19 @@ export const ComponentContainer = styled.div.withConfig({
38
51
  export const PanelContainer = styled.div.withConfig({
39
52
  displayName: "FloatingPanelsstyles__PanelContainer",
40
53
  componentId: "sc-1by914f-1"
41
- })(["display:flex;flex-direction:column;align-items:flex-end;box-shadow:0 1px 3px rgba(0,0,0,0.1);gap:8px;border-radius:calc(", " + 1px);overflow:hidden;background:transparent;width:", ";max-height:", ";"], themeGet("radii.2"), panelWidth, _ref7 => {
54
+ })(["display:flex;flex-direction:column;align-items:flex-end;box-shadow:0 1px 3px rgba(0,0,0,0.1);gap:8px;border-radius:calc(", " + 1px);overflow:hidden;background:transparent;width:", ";max-height:", ";"], themeGet("radii.2"), panelWidth, _ref8 => {
42
55
  let {
43
56
  containerHeight
44
- } = _ref7;
45
- return containerHeight ? `${containerHeight}px` : "100%";
57
+ } = _ref8;
58
+ return containerHeight;
46
59
  });
47
60
  export const PanelWrapper = styled.div.withConfig({
48
61
  displayName: "FloatingPanelsstyles__PanelWrapper",
49
62
  componentId: "sc-1by914f-2"
50
- })(["display:", ";background:white;width:", ";border:1px solid ", ";border-radius:8px;border-radius:0 0 8px 8px;overflow-y:auto;padding:\"0 12px 12px 12px\";margin-top:37px;transition:max-height 0.3s ease-in-out;"], _ref8 => {
63
+ })(["display:", ";background:white;width:", ";border:1px solid ", ";border-radius:8px;border-radius:0 0 8px 8px;overflow-y:auto;padding:\"0 12px 12px 12px\";margin-top:37px;transition:max-height 0.3s ease-in-out;"], _ref9 => {
51
64
  let {
52
65
  isExpanded
53
- } = _ref8;
66
+ } = _ref9;
54
67
  return isExpanded ? "block" : "none";
55
68
  }, panelWidth, themeGet("colors.greyLighter"));
56
69
  export const PanelHeader = styled.button.withConfig({
@@ -69,31 +82,36 @@ export const PanelBar = styled.div.withConfig({
69
82
  displayName: "FloatingPanelsstyles__PanelBar",
70
83
  componentId: "sc-1by914f-6"
71
84
  })(["display:flex;background:white;border:1px solid ", ";border-radius:", ";padding:2px;gap:2px;height:fit-content;box-shadow:0 0 1px 2px rgba(255,255,255,1);"], themeGet("colors.greyLighter"), themeGet("radii.2"));
85
+ export const PanelBarDivider = styled.div.withConfig({
86
+ displayName: "FloatingPanelsstyles__PanelBarDivider",
87
+ componentId: "sc-1by914f-7"
88
+ })(["flex-grow:1;border-right:1px solid ", ";cursor:pointer;display:flex;margin:4px 2px;"], themeGet("colors.greyLighter"));
72
89
  export const IconButton = styled.button.withConfig({
73
90
  displayName: "FloatingPanelsstyles__IconButton",
74
- componentId: "sc-1by914f-7"
75
- })(["font-family:", ";appearance:none;background-color:", ";border:none;width:36px;cursor:pointer;height:36px;display:flex;border-radius:", ";align-items:center;justify-content:center;transition:", ";&:hover{background-color:", ";}"], themeGet("fonts.main"), _ref9 => {
91
+ componentId: "sc-1by914f-8"
92
+ })(["font-family:", ";appearance:none;background-color:", ";border:none;width:36px;cursor:pointer;height:36px;display:flex;border-radius:", ";align-items:center;justify-content:center;transition:", ";&:hover{background-color:", ";}"], themeGet("fonts.main"), _ref10 => {
76
93
  let {
77
- isExpanded
78
- } = _ref9;
79
- return isExpanded ? themeGet("colors.primaryLightest") : themeGet("colors.white");
94
+ isExpanded,
95
+ forceHighlight
96
+ } = _ref10;
97
+ return isExpanded || forceHighlight ? themeGet("colors.primaryLightest") : themeGet("colors.white");
80
98
  }, themeGet("radii.2"), themeGet("transition.transitionDefault"), themeGet("colors.primaryLightest"));
81
99
  export const PanelContent = styled.div.withConfig({
82
100
  displayName: "FloatingPanelsstyles__PanelContent",
83
- componentId: "sc-1by914f-8"
84
- })(["padding:8px;width:inerhit;display:", ";height:", ";opacity:", ";"], _ref10 => {
101
+ componentId: "sc-1by914f-9"
102
+ })(["padding:8px;width:inerhit;display:", ";height:", ";opacity:", ";"], _ref11 => {
85
103
  let {
86
104
  isExpanded
87
- } = _ref10;
105
+ } = _ref11;
88
106
  return isExpanded ? "block" : "none";
89
- }, _ref11 => {
107
+ }, _ref12 => {
90
108
  let {
91
109
  isExpanded
92
- } = _ref11;
110
+ } = _ref12;
93
111
  return isExpanded ? "100%" : "0";
94
- }, _ref12 => {
112
+ }, _ref13 => {
95
113
  let {
96
114
  isExpanded
97
- } = _ref12;
115
+ } = _ref13;
98
116
  return isExpanded ? "1" : "0";
99
117
  });
@@ -2,7 +2,7 @@ import React, { useState } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import Icon from "../Icon";
4
4
  import Popover from "../Popover";
5
- import { PanelWrapper, PanelHeader, HeaderContent, Title, IconButton, PanelContent } from "./FloatingPanels.styles";
5
+ import { PanelWrapper, PanelHeader, HeaderContent, Title, PanelContent, IconButton } from "./FloatingPanels.styles";
6
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
7
  export const Panel = _ref => {
8
8
  let {
@@ -51,23 +51,20 @@ export const Panel = _ref => {
51
51
  });
52
52
  };
53
53
  Panel.propTypes = {
54
- iconName: PropTypes.string.isRequired,
55
54
  title: PropTypes.string.isRequired,
55
+ iconName: PropTypes.string.isRequired,
56
56
  content: PropTypes.node.isRequired,
57
- defaultExpanded: PropTypes.bool,
58
- containerHeight: PropTypes.number,
57
+ containerHeight: PropTypes.string,
59
58
  isExpanded: PropTypes.bool.isRequired,
60
59
  toggleExpanded: PropTypes.func.isRequired
61
60
  };
62
- Panel.defaultProps = {
63
- defaultExpanded: false
64
- };
65
61
  export const PanelBarIcon = _ref2 => {
66
62
  let {
67
63
  iconName,
68
64
  title,
69
65
  toggleExpanded,
70
- isExpanded
66
+ isExpanded,
67
+ forceHighlight
71
68
  } = _ref2;
72
69
  return /*#__PURE__*/_jsx(Popover, {
73
70
  direction: "top",
@@ -77,6 +74,7 @@ export const PanelBarIcon = _ref2 => {
77
74
  "aria-label": title,
78
75
  onClick: toggleExpanded,
79
76
  isExpanded: isExpanded,
77
+ forceHighlight: forceHighlight,
80
78
  children: /*#__PURE__*/_jsx(Icon, {
81
79
  size: "s",
82
80
  color: "greyDarker",
@@ -89,32 +87,22 @@ PanelBarIcon.propTypes = {
89
87
  iconName: PropTypes.string.isRequired,
90
88
  title: PropTypes.string.isRequired,
91
89
  toggleExpanded: PropTypes.func.isRequired,
92
- isExpanded: PropTypes.bool.isRequired
90
+ isExpanded: PropTypes.bool.isRequired,
91
+ forceHighlight: PropTypes.bool.isRequired
93
92
  };
94
93
  Panel.__docgenInfo = {
95
94
  "description": "",
96
95
  "methods": [],
97
96
  "displayName": "Panel",
98
97
  "props": {
99
- "defaultExpanded": {
100
- "defaultValue": {
101
- "value": "false",
102
- "computed": false
103
- },
104
- "description": "",
105
- "type": {
106
- "name": "bool"
107
- },
108
- "required": false
109
- },
110
- "iconName": {
98
+ "title": {
111
99
  "description": "",
112
100
  "type": {
113
101
  "name": "string"
114
102
  },
115
103
  "required": true
116
104
  },
117
- "title": {
105
+ "iconName": {
118
106
  "description": "",
119
107
  "type": {
120
108
  "name": "string"
@@ -131,7 +119,7 @@ Panel.__docgenInfo = {
131
119
  "containerHeight": {
132
120
  "description": "",
133
121
  "type": {
134
- "name": "number"
122
+ "name": "string"
135
123
  },
136
124
  "required": false
137
125
  },
@@ -183,6 +171,13 @@ PanelBarIcon.__docgenInfo = {
183
171
  "name": "bool"
184
172
  },
185
173
  "required": true
174
+ },
175
+ "forceHighlight": {
176
+ "description": "",
177
+ "type": {
178
+ "name": "bool"
179
+ },
180
+ "required": true
186
181
  }
187
182
  }
188
183
  };
@@ -1,57 +1,97 @@
1
- import React, { useState, useEffect } from "react";
2
- import { ComponentContainer, PanelContainer, PanelBar } from "./FloatingPanels.styles";
1
+ import React, { useState, useEffect, useCallback, useMemo } from "react";
2
+ import { ComponentContainer, PanelBar, PanelBarDivider, PanelContainer } from "./FloatingPanels.styles";
3
3
  import { Panel, PanelBarIcon } from "./Panel";
4
4
  import PropTypes from "prop-types";
5
5
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  const FloatingPanels = _ref => {
7
7
  let {
8
8
  panels,
9
- containerHeight,
9
+ containerHeight = "100%",
10
10
  position = {
11
- right: 20,
12
- top: 20
11
+ right: 0,
12
+ top: 0
13
13
  },
14
14
  centered = false,
15
+ alignPanels = "right",
15
16
  zIndex = 2,
17
+ disablePanelSelect = false,
18
+ defaultSelectedPanelId = null,
16
19
  onClick = () => {}
17
20
  } = _ref;
18
- const [expandedPanelId, setExpandedPanelId] = useState(null);
21
+ const [selectedPanelId, setSelectedPanelId] = useState(defaultSelectedPanelId);
19
22
  useEffect(() => {
20
- const expandedPanel = panels.find(panel => panel.expanded);
21
- if (expandedPanel?.id && !expandedPanel.noActiveState) {
22
- setExpandedPanelId(expandedPanel.id);
23
+ if (disablePanelSelect) {
24
+ return;
25
+ }
26
+ const selectedPanel = panels.find(panel => panel.selected);
27
+ if (selectedPanel?.id && !selectedPanel.noActiveState) {
28
+ setSelectedPanelId(selectedPanel.id);
23
29
  }
24
- }, [panels]);
25
- const togglePanel = panelId => {
30
+ }, [disablePanelSelect, panels]);
31
+ const togglePanel = useCallback(panelId => {
26
32
  const selectedPanel = panels.find(panel => panel.id === panelId);
27
- if (selectedPanel?.stopToggling && expandedPanelId === panelId) {
33
+
34
+ // no panel?
35
+ if (!selectedPanel) {
28
36
  return;
29
37
  }
30
38
  onClick(panelId);
31
- const selectedPanelId = expandedPanelId === panelId ? null : panelId;
32
- if (!selectedPanel.noActiveState) {
33
- setExpandedPanelId(selectedPanelId);
39
+ if (!disablePanelSelect) {
40
+ // panel not already selected?
41
+ if (panelId !== selectedPanelId) {
42
+ // has content (selectable)?
43
+ if (selectedPanel.content) {
44
+ // select panel
45
+ setSelectedPanelId(panelId);
46
+ }
47
+ }
48
+ // already selected?
49
+ else {
50
+ // toggle off
51
+ setSelectedPanelId(null);
52
+ }
53
+ }
54
+ }, [selectedPanelId, disablePanelSelect, onClick, panels]);
55
+ const panelBarItems = useMemo(() => {
56
+ const items = [];
57
+ let prevPanel = null;
58
+ for (const panel of panels) {
59
+ // grouping has changed?
60
+ if (prevPanel !== null && panel.grouping !== prevPanel.grouping) {
61
+ // add divider first
62
+ items.push(/*#__PURE__*/_jsx(PanelBarDivider, {}, `${panel.grouping}_${panel.id}`));
63
+ }
64
+
65
+ // add bar item
66
+ items.push(/*#__PURE__*/_jsx(PanelBarIcon, {
67
+ iconName: panel.iconName,
68
+ title: panel.title,
69
+ isExpanded: selectedPanelId === panel.id,
70
+ forceHighlight: panel.forceHighlight ?? false,
71
+ toggleExpanded: () => togglePanel(panel.id)
72
+ }, panel?.id));
73
+
74
+ // update prevPanel
75
+ prevPanel = panel;
34
76
  }
35
- };
36
- const shouldDisplayPanelContainer = panels?.some(panel => panel?.content);
77
+ return items;
78
+ }, [panels, selectedPanelId, togglePanel]);
37
79
  return /*#__PURE__*/_jsxs(ComponentContainer, {
38
80
  centered: centered,
81
+ alignPanels: alignPanels,
39
82
  containerHeight: containerHeight,
40
83
  position: position,
41
84
  zIndex: zIndex,
42
85
  children: [/*#__PURE__*/_jsx(PanelBar, {
43
- children: panels.map(panel => /*#__PURE__*/_jsx(PanelBarIcon, {
44
- iconName: panel.iconName,
45
- title: panel.title,
46
- isExpanded: expandedPanelId === panel.id,
47
- toggleExpanded: () => togglePanel(panel.id)
48
- }, panel?.id))
49
- }), shouldDisplayPanelContainer && /*#__PURE__*/_jsx(PanelContainer, {
86
+ children: panelBarItems
87
+ }), /*#__PURE__*/_jsx(PanelContainer, {
50
88
  containerHeight: containerHeight,
51
89
  children: panels.map(panel => /*#__PURE__*/_jsx(Panel, {
52
- ...panel,
90
+ title: panel.title,
91
+ iconName: panel.iconName,
92
+ content: panel.content,
53
93
  containerHeight: containerHeight,
54
- isExpanded: expandedPanelId === panel.id,
94
+ isExpanded: selectedPanelId === panel.id,
55
95
  toggleExpanded: () => togglePanel(panel.id)
56
96
  }, panel?.id))
57
97
  })]
@@ -63,9 +103,10 @@ FloatingPanels.propTypes = {
63
103
  iconName: PropTypes.string.isRequired,
64
104
  title: PropTypes.string.isRequired,
65
105
  content: PropTypes.node.isRequired,
66
- defaultExpanded: PropTypes.bool
106
+ grouping: PropTypes.string,
107
+ forceHighlight: PropTypes.bool
67
108
  })).isRequired,
68
- containerHeight: PropTypes.number,
109
+ containerHeight: PropTypes.string,
69
110
  position: PropTypes.shape({
70
111
  top: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
71
112
  right: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -74,22 +115,30 @@ FloatingPanels.propTypes = {
74
115
  }),
75
116
  onClick: PropTypes.func,
76
117
  centered: PropTypes.bool,
77
- zIndex: PropTypes.number
78
- };
79
- FloatingPanels.defaultProps = {
80
- position: {
81
- right: 20,
82
- top: 20
83
- }
118
+ alignPanels: PropTypes.oneOf(["left", "center", "right"]),
119
+ zIndex: PropTypes.number,
120
+ defaultSelectedPanelId: PropTypes.string,
121
+ disablePanelSelect: PropTypes.bool
84
122
  };
85
123
  FloatingPanels.__docgenInfo = {
86
124
  "description": "",
87
125
  "methods": [],
88
126
  "displayName": "FloatingPanels",
89
127
  "props": {
128
+ "containerHeight": {
129
+ "defaultValue": {
130
+ "value": "\"100%\"",
131
+ "computed": false
132
+ },
133
+ "description": "",
134
+ "type": {
135
+ "name": "string"
136
+ },
137
+ "required": false
138
+ },
90
139
  "position": {
91
140
  "defaultValue": {
92
- "value": "{ right: 20, top: 20 }",
141
+ "value": "{ right: 0, top: 0 }",
93
142
  "computed": false
94
143
  },
95
144
  "description": "",
@@ -147,6 +196,27 @@ FloatingPanels.__docgenInfo = {
147
196
  },
148
197
  "required": false
149
198
  },
199
+ "alignPanels": {
200
+ "defaultValue": {
201
+ "value": "\"right\"",
202
+ "computed": false
203
+ },
204
+ "description": "",
205
+ "type": {
206
+ "name": "enum",
207
+ "value": [{
208
+ "value": "\"left\"",
209
+ "computed": false
210
+ }, {
211
+ "value": "\"center\"",
212
+ "computed": false
213
+ }, {
214
+ "value": "\"right\"",
215
+ "computed": false
216
+ }]
217
+ },
218
+ "required": false
219
+ },
150
220
  "zIndex": {
151
221
  "defaultValue": {
152
222
  "value": "2",
@@ -158,6 +228,28 @@ FloatingPanels.__docgenInfo = {
158
228
  },
159
229
  "required": false
160
230
  },
231
+ "disablePanelSelect": {
232
+ "defaultValue": {
233
+ "value": "false",
234
+ "computed": false
235
+ },
236
+ "description": "",
237
+ "type": {
238
+ "name": "bool"
239
+ },
240
+ "required": false
241
+ },
242
+ "defaultSelectedPanelId": {
243
+ "defaultValue": {
244
+ "value": "null",
245
+ "computed": false
246
+ },
247
+ "description": "",
248
+ "type": {
249
+ "name": "string"
250
+ },
251
+ "required": false
252
+ },
161
253
  "onClick": {
162
254
  "defaultValue": {
163
255
  "value": "() => {}",
@@ -192,7 +284,11 @@ FloatingPanels.__docgenInfo = {
192
284
  "name": "node",
193
285
  "required": true
194
286
  },
195
- "defaultExpanded": {
287
+ "grouping": {
288
+ "name": "string",
289
+ "required": false
290
+ },
291
+ "forceHighlight": {
196
292
  "name": "bool",
197
293
  "required": false
198
294
  }
@@ -200,13 +296,6 @@ FloatingPanels.__docgenInfo = {
200
296
  }
201
297
  },
202
298
  "required": true
203
- },
204
- "containerHeight": {
205
- "description": "",
206
- "type": {
207
- "name": "number"
208
- },
209
- "required": false
210
299
  }
211
300
  }
212
301
  };
@@ -76,7 +76,7 @@ ProgressBar.propTypes = {
76
76
  /** Specifies the system design theme. */
77
77
  theme: PropTypes.object,
78
78
  /** Specifies the aria-label for the progress bar */
79
- ariaLabel: PropTypes.object
79
+ ariaLabel: PropTypes.string
80
80
  };
81
81
  ProgressBar.__docgenInfo = {
82
82
  "description": "Progress bar is not intended to be used for loading (that's what the Loading component is for). The intended use is for indicating progress through steps or progress towards a goal.\n\nA percentage width of the container (grey background) can be specified using the containerWidth prop, in most cases this should be 100. If not set the container is rendered without a CSS width property.\n\nA percentage width of the fill (coloured element) can be specified using the fillWidth prop. On page load the fill will animate from 0 to set value, and on change of the fillWidth prop value the fill will automatically animate to the new width value.",
@@ -101,7 +101,7 @@ ProgressBar.__docgenInfo = {
101
101
  },
102
102
  "description": "Specifies the aria-label for the progress bar",
103
103
  "type": {
104
- "name": "object"
104
+ "name": "string"
105
105
  },
106
106
  "required": false
107
107
  },
@@ -20,7 +20,7 @@ const TagValue = styled.button.attrs(props => ({
20
20
  const TagValueText = styled.div.withConfig({
21
21
  displayName: "Tag__TagValueText",
22
22
  componentId: "sc-1dh2aa8-2"
23
- })(["text-decoration:", ";white-space:normal;text-align:left;line-height:", ";padding-bottom:1px;"], props => props.showStrikeThrough ? "line-through" : "none", props => props.small ? themeGet("fontSizes.0")(props) : themeGet("fontSizes.1")(props));
23
+ })(["text-decoration:", ";white-space:normal;overflow-wrap:anywhere;text-align:left;line-height:", ";padding-bottom:1px;"], props => props.showStrikeThrough ? "line-through" : "none", props => props.small ? themeGet("fontSizes.0")(props) : themeGet("fontSizes.1")(props));
24
24
  const TagActionIconWrapper = styled(TagValue).withConfig({
25
25
  displayName: "Tag__TagActionIconWrapper",
26
26
  componentId: "sc-1dh2aa8-3"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "3.3.21",
3
+ "version": "3.3.23",
4
4
  "engines": {
5
5
  "node": "20.12.2"
6
6
  },