orcs-design-system 2.0.85 → 2.0.87
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React, { useState } from "react";
|
|
2
3
|
import { action } from "@storybook/addon-actions";
|
|
3
4
|
import Header from "../Header";
|
|
4
5
|
import StyledLink from "../StyledLink";
|
|
@@ -6,6 +7,7 @@ import Icon from "../Icon";
|
|
|
6
7
|
import { Small } from "../Typography";
|
|
7
8
|
import TextInput from "../TextInput";
|
|
8
9
|
import mdx from "./Header.mdx";
|
|
10
|
+
import Select from "../Select";
|
|
9
11
|
export default {
|
|
10
12
|
title: "Components/Header",
|
|
11
13
|
parameters: {
|
|
@@ -38,7 +40,8 @@ export var defaultHeader = function defaultHeader() {
|
|
|
38
40
|
externalAppSwitcherContent: /*#__PURE__*/React.createElement(StyledLink, {
|
|
39
41
|
href: "#",
|
|
40
42
|
target: "_blank"
|
|
41
|
-
}, "External App Name", /*#__PURE__*/React.createElement(Small, null, "This is a description of external 3rd party app"))
|
|
43
|
+
}, "External App Name", /*#__PURE__*/React.createElement(Small, null, "This is a description of external 3rd party app")),
|
|
44
|
+
navToggleId: "defaultHeader"
|
|
42
45
|
}, /*#__PURE__*/React.createElement(StyledLink, {
|
|
43
46
|
href: "#",
|
|
44
47
|
white: true,
|
|
@@ -69,10 +72,55 @@ export var headerWithSearch = function headerWithSearch() {
|
|
|
69
72
|
type: "text",
|
|
70
73
|
placeholder: "Search for...",
|
|
71
74
|
iconRight: ["fas", "search"]
|
|
72
|
-
})
|
|
75
|
+
}),
|
|
76
|
+
navToggleId: "headerWithSearch"
|
|
73
77
|
});
|
|
74
78
|
};
|
|
75
79
|
headerWithSearch.storyName = "Alternative Header with search";
|
|
80
|
+
export var headerWithWorkspaceSwitching = function headerWithWorkspaceSwitching() {
|
|
81
|
+
var options = [{
|
|
82
|
+
label: "A"
|
|
83
|
+
}, {
|
|
84
|
+
label: "B"
|
|
85
|
+
}]; // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
86
|
+
|
|
87
|
+
var _useState = useState([{
|
|
88
|
+
label: "A"
|
|
89
|
+
}]),
|
|
90
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
91
|
+
selected = _useState2[0],
|
|
92
|
+
setSelected = _useState2[1];
|
|
93
|
+
|
|
94
|
+
var onChange = function onChange(value) {
|
|
95
|
+
setSelected(value);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
var select = /*#__PURE__*/React.createElement(Select, {
|
|
99
|
+
id: "WorkspaceSelect",
|
|
100
|
+
"data-testid": "select-workspace-dropdown",
|
|
101
|
+
placeholder: "Select a workspace",
|
|
102
|
+
options: options,
|
|
103
|
+
value: selected,
|
|
104
|
+
onChange: onChange,
|
|
105
|
+
height: "30px",
|
|
106
|
+
padding: "0 8px"
|
|
107
|
+
});
|
|
108
|
+
return /*#__PURE__*/React.createElement(Header, {
|
|
109
|
+
appName: "App Name",
|
|
110
|
+
userName: "Michael",
|
|
111
|
+
avatarSource: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png",
|
|
112
|
+
clientInfo: "Tenant: ci2153 Workspace: 20k-v5 [lb5ctx] UI_Version: 8c315c2 [4412] Backend_Version: dabc261 [3578]",
|
|
113
|
+
logoutFunction: action("clicked-logout"),
|
|
114
|
+
workspaceSwitcherContent: select,
|
|
115
|
+
navToggleId: "headerWithWorkspaceSwitching"
|
|
116
|
+
}, /*#__PURE__*/React.createElement(StyledLink, {
|
|
117
|
+
href: "#",
|
|
118
|
+
white: true,
|
|
119
|
+
bold: true,
|
|
120
|
+
active: true
|
|
121
|
+
}, "Summary"));
|
|
122
|
+
};
|
|
123
|
+
headerWithWorkspaceSwitching.storyName = "Header with workspace switching";
|
|
76
124
|
defaultHeader.__docgenInfo = {
|
|
77
125
|
"description": "",
|
|
78
126
|
"methods": [],
|
|
@@ -82,4 +130,9 @@ headerWithSearch.__docgenInfo = {
|
|
|
82
130
|
"description": "",
|
|
83
131
|
"methods": [],
|
|
84
132
|
"displayName": "headerWithSearch"
|
|
133
|
+
};
|
|
134
|
+
headerWithWorkspaceSwitching.__docgenInfo = {
|
|
135
|
+
"description": "",
|
|
136
|
+
"methods": [],
|
|
137
|
+
"displayName": "headerWithWorkspaceSwitching"
|
|
85
138
|
};
|
|
@@ -329,10 +329,13 @@ export default function Header(_ref) {
|
|
|
329
329
|
dataTestId = _ref.dataTestId,
|
|
330
330
|
theme = _ref.theme,
|
|
331
331
|
variant = _ref.variant,
|
|
332
|
-
themeSwitcherContent = _ref.themeSwitcherContent
|
|
332
|
+
themeSwitcherContent = _ref.themeSwitcherContent,
|
|
333
|
+
workspaceSwitcherContent = _ref.workspaceSwitcherContent,
|
|
334
|
+
_ref$navToggleId = _ref.navToggleId,
|
|
335
|
+
navToggleId = _ref$navToggleId === void 0 ? "mobileMenuToggle" : _ref$navToggleId;
|
|
333
336
|
var component = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MobileNavToggle, {
|
|
334
337
|
type: "checkbox",
|
|
335
|
-
id:
|
|
338
|
+
id: navToggleId
|
|
336
339
|
}), /*#__PURE__*/React.createElement(Bar, {
|
|
337
340
|
theme: theme,
|
|
338
341
|
dataTestId: dataTestId,
|
|
@@ -355,7 +358,7 @@ export default function Header(_ref) {
|
|
|
355
358
|
image: avatarSource,
|
|
356
359
|
theme: theme
|
|
357
360
|
})), /*#__PURE__*/React.createElement(MobileMenuToggle, {
|
|
358
|
-
htmlFor:
|
|
361
|
+
htmlFor: navToggleId,
|
|
359
362
|
theme: theme
|
|
360
363
|
}, /*#__PURE__*/React.createElement(Hamburger, {
|
|
361
364
|
id: "hamburger-menu-icon"
|
|
@@ -401,8 +404,13 @@ export default function Header(_ref) {
|
|
|
401
404
|
pt: "s",
|
|
402
405
|
pb: "r",
|
|
403
406
|
display: "block"
|
|
404
|
-
}, "Switch theme:"), themeSwitcherContent)
|
|
405
|
-
|
|
407
|
+
}, "Switch theme:"), themeSwitcherContent), workspaceSwitcherContent && /*#__PURE__*/React.createElement(Theme, null, /*#__PURE__*/React.createElement(Small, {
|
|
408
|
+
color: "white60",
|
|
409
|
+
pt: "s",
|
|
410
|
+
pb: "r",
|
|
411
|
+
display: "block"
|
|
412
|
+
}, "Change workspace:"), workspaceSwitcherContent))), /*#__PURE__*/React.createElement(Overlay, {
|
|
413
|
+
htmlFor: navToggleId
|
|
406
414
|
}));
|
|
407
415
|
return theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
408
416
|
theme: theme
|
|
@@ -455,13 +463,26 @@ Header.propTypes = {
|
|
|
455
463
|
dataTestId: PropTypes.string,
|
|
456
464
|
|
|
457
465
|
/** Theme related props **/
|
|
458
|
-
themeSwitcherContent: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)])
|
|
466
|
+
themeSwitcherContent: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
|
467
|
+
workspaceSwitcherContent: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
|
468
|
+
navToggleId: PropTypes.string
|
|
459
469
|
};
|
|
460
470
|
Header.__docgenInfo = {
|
|
461
471
|
"description": "Header component for global app navigation.\n\nAt screen sizes less than 1100px the links are instead moved into a mobile menu toggled by a burger icon button to play nice with smaller devices.",
|
|
462
472
|
"methods": [],
|
|
463
473
|
"displayName": "Header",
|
|
464
474
|
"props": {
|
|
475
|
+
"navToggleId": {
|
|
476
|
+
"defaultValue": {
|
|
477
|
+
"value": "\"mobileMenuToggle\"",
|
|
478
|
+
"computed": false
|
|
479
|
+
},
|
|
480
|
+
"type": {
|
|
481
|
+
"name": "string"
|
|
482
|
+
},
|
|
483
|
+
"required": false,
|
|
484
|
+
"description": ""
|
|
485
|
+
},
|
|
465
486
|
"appName": {
|
|
466
487
|
"type": {
|
|
467
488
|
"name": "node"
|
|
@@ -625,6 +646,21 @@ Header.__docgenInfo = {
|
|
|
625
646
|
},
|
|
626
647
|
"required": false,
|
|
627
648
|
"description": "Theme related props *"
|
|
649
|
+
},
|
|
650
|
+
"workspaceSwitcherContent": {
|
|
651
|
+
"type": {
|
|
652
|
+
"name": "union",
|
|
653
|
+
"value": [{
|
|
654
|
+
"name": "node"
|
|
655
|
+
}, {
|
|
656
|
+
"name": "arrayOf",
|
|
657
|
+
"value": {
|
|
658
|
+
"name": "node"
|
|
659
|
+
}
|
|
660
|
+
}]
|
|
661
|
+
},
|
|
662
|
+
"required": false,
|
|
663
|
+
"description": ""
|
|
628
664
|
}
|
|
629
665
|
}
|
|
630
666
|
};
|
|
@@ -41,9 +41,13 @@ var TagValue = styled.button.withConfig({
|
|
|
41
41
|
}, function (props) {
|
|
42
42
|
return themeGet("shadows.thinOutline")(props) + " " + themeGet("colors.primary30")(props);
|
|
43
43
|
});
|
|
44
|
+
var TagValueText = styled.div.withConfig({
|
|
45
|
+
displayName: "Tag__TagValueText",
|
|
46
|
+
componentId: "sc-1dh2aa8-2"
|
|
47
|
+
})(["max-width:40ch;overflow:hidden;text-overflow:ellipsis;"]);
|
|
44
48
|
var TagEdit = styled(TagValue).withConfig({
|
|
45
49
|
displayName: "Tag__TagEdit",
|
|
46
|
-
componentId: "sc-1dh2aa8-
|
|
50
|
+
componentId: "sc-1dh2aa8-3"
|
|
47
51
|
})(["border-radius:", ";padding:", ";&:focus{z-index:2;box-shadow:-0.5px 0 0 3.5px ", ";}", ""], function (props) {
|
|
48
52
|
return props.showRemove ? "0" : "0 15px 15px 0";
|
|
49
53
|
}, function (props) {
|
|
@@ -57,7 +61,7 @@ var TagEdit = styled(TagValue).withConfig({
|
|
|
57
61
|
});
|
|
58
62
|
var TagRemove = styled(TagValue).withConfig({
|
|
59
63
|
displayName: "Tag__TagRemove",
|
|
60
|
-
componentId: "sc-1dh2aa8-
|
|
64
|
+
componentId: "sc-1dh2aa8-4"
|
|
61
65
|
})(["border-radius:0 15px 15px 0;padding:2px 10px 5px 9px;&:focus{z-index:2;box-shadow:-0.5px 0 0 3.5px ", ";}", ""], function (props) {
|
|
62
66
|
return themeGet("colors.primary30")(props);
|
|
63
67
|
}, function (props) {
|
|
@@ -65,7 +69,7 @@ var TagRemove = styled(TagValue).withConfig({
|
|
|
65
69
|
});
|
|
66
70
|
var TagType = styled.div.withConfig({
|
|
67
71
|
displayName: "Tag__TagType",
|
|
68
|
-
componentId: "sc-1dh2aa8-
|
|
72
|
+
componentId: "sc-1dh2aa8-5"
|
|
69
73
|
})(["text-transform:uppercase;margin-left:", ";padding:3px;line-height:1;border-radius:", ";font-size:", ";background-color:", ";color:", ";"], function (props) {
|
|
70
74
|
return themeGet("space.s")(props);
|
|
71
75
|
}, function (props) {
|
|
@@ -102,7 +106,7 @@ export default function Tag(_ref) {
|
|
|
102
106
|
showEdit: showEdit,
|
|
103
107
|
showRemove: showRemove,
|
|
104
108
|
onClick: onSelect
|
|
105
|
-
}, children, tagType ? /*#__PURE__*/React.createElement(TagType, {
|
|
109
|
+
}, /*#__PURE__*/React.createElement(TagValueText, null, children), tagType ? /*#__PURE__*/React.createElement(TagType, {
|
|
106
110
|
selected: selected,
|
|
107
111
|
disabled: disabled
|
|
108
112
|
}, tagType) : null), showEdit ? /*#__PURE__*/React.createElement(TagEdit, {
|