orcs-design-system 2.0.84 → 2.0.86

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 React from "react";
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
  };
@@ -269,16 +269,32 @@ var ExternalAppSwitcher = styled("div").withConfig({
269
269
  }
270
270
  });
271
271
  });
272
+ var Theme = styled("div").withConfig({
273
+ displayName: "Header__Theme",
274
+ componentId: "yf04b-9"
275
+ })(function (props) {
276
+ return css({
277
+ borderTop: "solid 1px rgba(255,255,255,0.3)",
278
+ padding: "r",
279
+ paddingTop: "s",
280
+ marginTop: "s",
281
+ "[class^='Small'], [class*=' Small']": {
282
+ display: "block",
283
+ fontWeight: themeGet("fontWeights.1")(props),
284
+ marginTop: "xs"
285
+ }
286
+ });
287
+ });
272
288
  var RightAligned = styled("div").withConfig({
273
289
  displayName: "Header__RightAligned",
274
- componentId: "yf04b-9"
290
+ componentId: "yf04b-10"
275
291
  })(css({
276
292
  marginLeft: "auto",
277
293
  marginRight: "r"
278
294
  }));
279
295
  var Overlay = styled("label").withConfig({
280
296
  displayName: "Header__Overlay",
281
- componentId: "yf04b-10"
297
+ componentId: "yf04b-11"
282
298
  })(function (props) {
283
299
  return css({
284
300
  position: "fixed",
@@ -312,10 +328,14 @@ export default function Header(_ref) {
312
328
  searchComponent = _ref.searchComponent,
313
329
  dataTestId = _ref.dataTestId,
314
330
  theme = _ref.theme,
315
- variant = _ref.variant;
331
+ variant = _ref.variant,
332
+ themeSwitcherContent = _ref.themeSwitcherContent,
333
+ workspaceSwitcherContent = _ref.workspaceSwitcherContent,
334
+ _ref$navToggleId = _ref.navToggleId,
335
+ navToggleId = _ref$navToggleId === void 0 ? "mobileMenuToggle" : _ref$navToggleId;
316
336
  var component = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MobileNavToggle, {
317
337
  type: "checkbox",
318
- id: "mobileMenuToggle"
338
+ id: navToggleId
319
339
  }), /*#__PURE__*/React.createElement(Bar, {
320
340
  theme: theme,
321
341
  dataTestId: dataTestId,
@@ -338,7 +358,7 @@ export default function Header(_ref) {
338
358
  image: avatarSource,
339
359
  theme: theme
340
360
  })), /*#__PURE__*/React.createElement(MobileMenuToggle, {
341
- htmlFor: "mobileMenuToggle",
361
+ htmlFor: navToggleId,
342
362
  theme: theme
343
363
  }, /*#__PURE__*/React.createElement(Hamburger, {
344
364
  id: "hamburger-menu-icon"
@@ -379,8 +399,18 @@ export default function Header(_ref) {
379
399
  px: "r",
380
400
  py: "s",
381
401
  display: "block"
382
- }, "External apps:"), externalAppSwitcherContent))), /*#__PURE__*/React.createElement(Overlay, {
383
- htmlFor: "mobileMenuToggle"
402
+ }, "External apps:"), externalAppSwitcherContent), themeSwitcherContent && /*#__PURE__*/React.createElement(Theme, null, /*#__PURE__*/React.createElement(Small, {
403
+ color: "white60",
404
+ pt: "s",
405
+ pb: "r",
406
+ display: "block"
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
384
414
  }));
385
415
  return theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
386
416
  theme: theme
@@ -430,13 +460,29 @@ Header.propTypes = {
430
460
  variant: PropTypes.oneOf(["search"]),
431
461
 
432
462
  /** Allows for use of the `data-testid` attribute for testing. */
433
- dataTestId: PropTypes.string
463
+ dataTestId: PropTypes.string,
464
+
465
+ /** Theme related props **/
466
+ themeSwitcherContent: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
467
+ workspaceSwitcherContent: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
468
+ navToggleId: PropTypes.string
434
469
  };
435
470
  Header.__docgenInfo = {
436
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.",
437
472
  "methods": [],
438
473
  "displayName": "Header",
439
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
+ },
440
486
  "appName": {
441
487
  "type": {
442
488
  "name": "node"
@@ -585,6 +631,36 @@ Header.__docgenInfo = {
585
631
  },
586
632
  "required": false,
587
633
  "description": "Allows for use of the `data-testid` attribute for testing."
634
+ },
635
+ "themeSwitcherContent": {
636
+ "type": {
637
+ "name": "union",
638
+ "value": [{
639
+ "name": "node"
640
+ }, {
641
+ "name": "arrayOf",
642
+ "value": {
643
+ "name": "node"
644
+ }
645
+ }]
646
+ },
647
+ "required": false,
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": ""
588
664
  }
589
665
  }
590
666
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "2.0.84",
3
+ "version": "2.0.86",
4
4
  "description": "Orchestrated's Design System, aka: ORCS",
5
5
  "keywords": [
6
6
  "design",