@linzjs/windows 1.3.0 → 1.4.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/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "panel",
13
13
  "popout"
14
14
  ],
15
- "version": "1.3.0",
15
+ "version": "1.4.0",
16
16
  "peerDependencies": {
17
17
  "@linzjs/lui": "^17",
18
18
  "lodash-es": ">=4",
@@ -40,7 +40,7 @@
40
40
  "devDependencies": {
41
41
  "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
42
42
  "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
43
- "@linzjs/step-ag-grid": "^14.9.3",
43
+ "@linzjs/step-ag-grid": "^14.10.0",
44
44
  "@rollup/plugin-commonjs": "^25.0.2",
45
45
  "@rollup/plugin-json": "^6.0.0",
46
46
  "@rollup/plugin-node-resolve": "^15.1.0",
@@ -62,7 +62,7 @@
62
62
  "@trivago/prettier-plugin-sort-imports": "^4.1.1",
63
63
  "@types/jest": "^29.5.2",
64
64
  "@types/lodash-es": "^4.17.7",
65
- "@types/node": "^20.3.3",
65
+ "@types/node": "^20.4.2",
66
66
  "@types/react": "^18.2.14",
67
67
  "@types/react-dom": "^18.2.6",
68
68
  "@types/uuid": "^9.0.2",
@@ -82,14 +82,14 @@
82
82
  "eslint-plugin-testing-library": "^5.11.0",
83
83
  "jest": "^29.5.0",
84
84
  "jest-canvas-mock": "^2.5.2",
85
- "jest-environment-jsdom": "^29.5.0",
85
+ "jest-environment-jsdom": "^29.6.1",
86
86
  "jest-expect-message": "^1.1.3",
87
87
  "mkdirp": "^3.0.1",
88
88
  "npm-run-all": "^4.1.5",
89
89
  "prettier": "^2.8.8",
90
90
  "prop-types": "^15.8.1",
91
91
  "react-scripts": "5.0.1",
92
- "rollup": "^3.23.0",
92
+ "rollup": "^3.26.2",
93
93
  "rollup-plugin-copy": "^3.4.0",
94
94
  "sass": "^1.63.6",
95
95
  "sass-loader": "^13.3.2",
@@ -103,7 +103,7 @@
103
103
  "stylelint-prettier": "3.0.0",
104
104
  "stylelint-scss": "5.0.1",
105
105
  "typescript": "^4.9.5",
106
- "vite": "^4.3.9"
106
+ "vite": "^4.4.4"
107
107
  },
108
108
  "scripts": {
109
109
  "build": "run-s clean stylelint lint lint-circular-deps bundle",
@@ -1,40 +1,118 @@
1
+ @use "node_modules/@linzjs/lui/dist/scss/Foundation/Variables/ColorVars.scss" as colours;
2
+
1
3
  .panelDock > .panelDock-content:not(:empty) + .panelDock-empty {
2
4
  display: none;
3
5
  }
4
6
 
5
- .LuiFloatingWindow-children {
7
+ .WindowPanel-children {
6
8
  display: flex;
7
9
  overflow: hidden;
8
10
  text-overflow: ellipsis;
9
11
  flex: 1;
10
12
  }
11
13
 
12
- .WindowPanel {
13
- box-shadow: 0 1px 6px 0 #00000026, 0 6px 10px 0 #00000040;
14
- background-color: #fff;
15
- display: flex;
16
- flex-direction: column;
17
- border-radius: 9px;
18
- }
19
-
20
14
  .WindowPanel-header {
21
15
  height: 48px;
22
16
  line-height: 48px;
23
- color: #2a292c;
24
- padding: 0 8px;
17
+ color: colours.$charcoal;
18
+ padding: 0 16px;
25
19
  display: flex;
26
20
  overflow: hidden;
27
21
  justify-content: space-between;
28
- border-bottom: 2px #eaeaea solid;
22
+ border-bottom: 2px colours.$lily solid;
29
23
  font-size: 1em;
30
24
  font-weight: 600;
31
25
  flex-direction: row;
26
+ align-items: center;
27
+
28
+ .LuiTabsGroup {
29
+ margin-top: 4px;
30
+ line-height: 16px;
31
+
32
+ .LuiTab {
33
+ min-width: 0;
34
+ padding-left: 8px;
35
+ padding-right: 8px;
36
+ padding-bottom: 11px;
37
+ }
38
+
39
+ .LuiTab:not(.LuiTab--active):focus {
40
+ padding-top: 8px;
41
+ padding-bottom: 8px;
42
+ }
43
+
44
+ .LuiTab--active {
45
+ padding-left: 7px;
46
+ padding-right: 7px;
47
+ }
48
+
49
+ .LuiTab--active::after, .LuiTab--active:focus::after {
50
+ padding: 0;
51
+ }
52
+ }
53
+
54
+ .lui-button + .lui-button, a.lui-button + .lui-button {
55
+ margin-left: 0 !important;
56
+ }
57
+ }
58
+
59
+ .WindowPanel {
60
+ box-shadow: 0 1px 6px 0 #00000026, 0 6px 10px 0 #00000040;
61
+ background-color: #fff;
62
+ display: flex;
63
+ flex-direction: column;
64
+ border-radius: 9px;
65
+
66
+ .WindowPanel-header {
67
+ border-radius: 9px 9px 0 0;
68
+ }
69
+ }
70
+
71
+ %WindowPanel-divider {
72
+ border-left: 2px solid colours.$lily;
73
+ background-color: colours.$lily;
74
+ width: 0;
75
+ height: 19px;
76
+ }
77
+
78
+ .WindowPanel-divider-left {
79
+ @extend %WindowPanel-divider;
80
+ margin-right: 15px;
81
+ margin-left: 19px;
82
+ }
83
+
84
+ .WindowPanel-divider-right {
85
+ @extend %WindowPanel-divider;
86
+ margin-right: 8px;
87
+ margin-left: 8px;
88
+ }
89
+
90
+ .WindowPanel-buttons {
91
+ display: flex;
92
+ align-items: center;
93
+
94
+ button.lui-button {
95
+ display: flex;
96
+ align-items: center;
97
+
98
+ span.LuiIcon {
99
+ margin-left: auto;
100
+ margin-right: auto;
101
+ }
102
+ }
32
103
  }
33
104
 
34
105
  .WindowPanel-header-title {
106
+ display: flex;
107
+ align-items: center;
35
108
  white-space: nowrap;
36
109
  }
37
110
 
111
+ .WindowPanel-header-title-icon {
112
+ fill: colours.$fuscous !important;
113
+ margin-right: 8px;
114
+ }
115
+
38
116
  .WindowPanel-content {
39
117
  flex: 1;
40
118
  overflow: auto;
@@ -1,25 +1,31 @@
1
1
  import "./Panel.scss";
2
+ import "./PanelBlue.scss";
2
3
  import "@linzjs/lui/dist/scss/base.scss";
3
4
 
4
5
  import { PanelContext } from "./PanelContext";
5
6
  import { PanelInstanceContext, PanelSize } from "./PanelInstanceContext";
6
7
  import { PanelPosition, PanelsContext } from "./PanelsContext";
7
8
  import { PopoutWindow } from "./PopoutWindow";
8
- import { PropsWithChildren, ReactElement, ReactNode, useContext, useEffect, useState } from "react";
9
+ import clsx from "clsx";
10
+ import { ReactElement, ReactNode, useContext, useEffect, useState } from "react";
9
11
  import ReactDOM from "react-dom";
10
12
  import { Rnd } from "react-rnd";
11
13
 
12
- import { LuiButton, LuiIcon } from "@linzjs/lui";
13
- import { LuiIconName } from "@linzjs/lui/dist/assets/svg-content";
14
-
15
14
  export interface PanelProps {
16
15
  title: string;
17
16
  position?: PanelPosition;
18
17
  size?: PanelSize;
18
+ className?: string;
19
19
  children: ReactNode;
20
20
  }
21
21
 
22
- export const Panel = ({ title, position, size = { width: 320, height: 200 }, children }: PanelProps): ReactElement => {
22
+ export const Panel = ({
23
+ title,
24
+ position,
25
+ size = { width: 320, height: 200 },
26
+ className,
27
+ children,
28
+ }: PanelProps): ReactElement => {
23
29
  const { nextStackPosition, dockElements } = useContext(PanelsContext);
24
30
  const { panelPoppedOut, bounds, zIndex, bringPanelToFront, uniqueId, setTitle, dockId, docked } =
25
31
  useContext(PanelInstanceContext);
@@ -54,13 +60,14 @@ export const Panel = ({ title, position, size = { width: 320, height: 200 }, chi
54
60
  width: "100%",
55
61
  height: "100%",
56
62
  }}
63
+ className={className}
57
64
  >
58
65
  {children}
59
66
  </div>
60
67
  </PopoutWindow>
61
68
  ) : (
62
69
  <Rnd
63
- className={"WindowPanel"}
70
+ className={clsx("WindowPanel", className)}
64
71
  dragHandleClassName={"draggable-handle"}
65
72
  minWidth={100}
66
73
  minHeight={100}
@@ -96,69 +103,6 @@ export const Panel = ({ title, position, size = { width: 320, height: 200 }, chi
96
103
  );
97
104
  };
98
105
 
99
- export interface PanelHeaderButtonProps {
100
- "aria-label": string;
101
- icon: LuiIconName;
102
- onClick: () => void;
103
- }
104
-
105
- export const PanelHeaderButton = ({ "aria-label": ariaLabel, icon, onClick }: PanelHeaderButtonProps) => (
106
- <LuiButton
107
- level={"plain-text"}
108
- className={"lui-button-icon-only"}
109
- size={"sm"}
110
- onClick={onClick}
111
- buttonProps={{
112
- onTouchStart: onClick,
113
- }}
114
- >
115
- <LuiIcon name={icon} alt={ariaLabel} />
116
- </LuiButton>
106
+ export const PanelContent = ({ children }: { children: ReactNode }) => (
107
+ <div className={"WindowPanel-content"}>{children}</div>
117
108
  );
118
-
119
- export interface PanelHeaderProps {
120
- extraButtons?: ReactNode;
121
- dockTo?: string;
122
- }
123
-
124
- export const PanelHeader = ({ extraButtons, dockTo, children }: PropsWithChildren<PanelHeaderProps>) => {
125
- const { panelClose, panelTogglePopout, panelPoppedOut, title, dock, undock, docked } =
126
- useContext(PanelInstanceContext);
127
- const [cursor, setCursor] = useState<"grab" | "grabbing">("grab");
128
-
129
- const headerMouseDown = () => {
130
- !panelPoppedOut && setCursor("grabbing");
131
- };
132
-
133
- return (
134
- <div
135
- className={"WindowPanel-header draggable-handle"}
136
- onMouseDown={headerMouseDown}
137
- onMouseUp={() => !panelPoppedOut && setCursor("grab")}
138
- style={{ cursor }}
139
- >
140
- <div className={"WindowPanel-header-title"}>{title}</div>
141
- <div className={"LuiFloatingWindow-children"}>{children}</div>
142
- <div className={"LuiFloatingWindow-buttons"}>{extraButtons}</div>
143
- <div className={"LuiFloatingWindow-extra-buttons-divider"}>|</div>
144
- <div className={"LuiFloatingWindow-buttons"}>
145
- {dockTo &&
146
- (docked ? (
147
- <PanelHeaderButton aria-label={"Undock"} onClick={undock} icon={"ic_close_list"} />
148
- ) : (
149
- <PanelHeaderButton aria-label={"Undock"} onClick={() => dock(dockTo)} icon={"ic_left_col"} />
150
- ))}
151
- <PanelHeaderButton
152
- aria-label={panelPoppedOut ? "Pop-in" : "Pop-out"}
153
- onClick={panelTogglePopout}
154
- icon={panelPoppedOut ? "ic_pop_back" : "ic_launch_new window_open"}
155
- />
156
- <PanelHeaderButton aria-label={"Close"} onClick={panelClose} icon={"ic_clear"} />
157
- </div>
158
- </div>
159
- );
160
- };
161
-
162
- export const PanelContent = ({ children }: { children: ReactNode }) => {
163
- return <div className={"WindowPanel-content"}>{children}</div>;
164
- };
@@ -0,0 +1,18 @@
1
+ @use "node_modules/@linzjs/lui/dist/scss/Foundation/Variables/ColorVars.scss" as colours;
2
+
3
+ .WindowPanel-blue.WindowPanel-header, .WindowPanel-blue .WindowPanel-header {
4
+ background: linear-gradient(270deg,#007198,#00425b 100%);
5
+ color: #fff;
6
+
7
+ svg * {
8
+ fill: #fff;
9
+ }
10
+ }
11
+
12
+ .WindowPanel-blue .LuiTab {
13
+ color: colours.$iceberg
14
+ }
15
+
16
+ .WindowPanel-blue .LuiTab.LuiTab--active {
17
+ color: colours.$downy
18
+ }
@@ -0,0 +1,59 @@
1
+ import { PanelHeaderButton } from "./PanelHeaderButton";
2
+ import { PanelInstanceContext } from "./PanelInstanceContext";
3
+ import { ReactNode, useContext, useState } from "react";
4
+
5
+ import { LuiIcon } from "@linzjs/lui";
6
+ import { LuiIconName } from "@linzjs/lui/dist/assets/svg-content";
7
+
8
+ export interface PanelHeaderProps {
9
+ icon?: LuiIconName;
10
+ extraLeft?: ReactNode;
11
+ extraRight?: ReactNode;
12
+ onHelpClick?: () => void;
13
+ dockTo?: string;
14
+ }
15
+
16
+ export const PanelHeader = ({ icon, extraLeft, extraRight, onHelpClick, dockTo }: PanelHeaderProps) => {
17
+ const { panelClose, panelTogglePopout, panelPoppedOut, title, dock, undock, docked } =
18
+ useContext(PanelInstanceContext);
19
+ const [cursor, setCursor] = useState<"grab" | "grabbing">("grab");
20
+
21
+ const headerMouseDown = () => {
22
+ !panelPoppedOut && setCursor("grabbing");
23
+ };
24
+
25
+ return (
26
+ <div
27
+ className={"WindowPanel-header draggable-handle"}
28
+ onMouseDown={headerMouseDown}
29
+ onMouseUp={() => !panelPoppedOut && setCursor("grab")}
30
+ style={{ cursor }}
31
+ >
32
+ <div className={"WindowPanel-header-title"}>
33
+ {icon && <LuiIcon name={icon} alt={"icon"} size={"md"} className={"WindowPanel-header-title-icon"} />}
34
+ {title}
35
+ </div>
36
+ {extraLeft && <div className={"WindowPanel-divider-left"} />}
37
+ <div className={"WindowPanel-children"}>{extraLeft}</div>
38
+ <div className={"WindowPanel-buttons"}>
39
+ {extraRight}
40
+ {onHelpClick && <PanelHeaderButton aria-label={"Help"} onClick={onHelpClick} icon={"ic_help_outline"} />}
41
+ </div>
42
+ <div className={"WindowPanel-divider-right"} />
43
+ <div className={"WindowPanel-buttons"}>
44
+ {dockTo &&
45
+ (docked ? (
46
+ <PanelHeaderButton aria-label={"Undock"} onClick={undock} icon={"ic_close_list"} />
47
+ ) : (
48
+ <PanelHeaderButton aria-label={"Undock"} onClick={() => dock(dockTo)} icon={"ic_left_col"} />
49
+ ))}
50
+ <PanelHeaderButton
51
+ aria-label={panelPoppedOut ? "Pop-in" : "Pop-out"}
52
+ onClick={panelTogglePopout}
53
+ icon={panelPoppedOut ? "ic_pop_back" : "ic_launch_new window_open"}
54
+ />
55
+ <PanelHeaderButton aria-label={"Close"} onClick={panelClose} icon={"ic_clear"} />
56
+ </div>
57
+ </div>
58
+ );
59
+ };
@@ -0,0 +1,22 @@
1
+ import { LuiButton, LuiIcon } from "@linzjs/lui";
2
+ import { LuiIconName } from "@linzjs/lui/dist/assets/svg-content";
3
+
4
+ export interface PanelHeaderButtonProps {
5
+ "aria-label": string;
6
+ icon: LuiIconName;
7
+ onClick: () => void;
8
+ }
9
+
10
+ export const PanelHeaderButton = ({ "aria-label": ariaLabel, icon, onClick }: PanelHeaderButtonProps) => (
11
+ <LuiButton
12
+ level={"plain-text"}
13
+ className={"lui-button-icon-only"}
14
+ size={"sm"}
15
+ onClick={onClick}
16
+ buttonProps={{
17
+ onTouchStart: onClick,
18
+ }}
19
+ >
20
+ <LuiIcon name={icon} alt={ariaLabel} size={"md"} />
21
+ </LuiButton>
22
+ );
@@ -0,0 +1,9 @@
1
+ import { makePopoutId } from "./generateId";
2
+
3
+ /**
4
+ * The only valid characters for an @emotion key are lower case chars or '-'.
5
+ * We need to replace any char that is not valid with a substitute.
6
+ */
7
+ test("makePopoutId", () => {
8
+ expect(makePopoutId("Hello-59.!---&$*(--")).toBe("hello-five-nine-");
9
+ });
@@ -2,22 +2,21 @@
2
2
  * The only valid characters for an @emotion key are lower case chars or '-'.
3
3
  * We need to replace any char that is not valid with a substitute.
4
4
  */
5
- export function makePopoutId(str: string): string {
6
- return str
7
- .replace(/[/\s_]*/g, "-")
8
- .replaceAll("0", "zero")
9
- .replaceAll("1", "one")
10
- .replaceAll("2", "two")
11
- .replaceAll("3", "three")
12
- .replaceAll("4", "four")
13
- .replaceAll("5", "five")
14
- .replaceAll("6", "six")
15
- .replaceAll("7", "seven")
16
- .replaceAll("8", "eight")
17
- .replaceAll("9", "nine")
5
+ export const makePopoutId = (str: string): string =>
6
+ str
7
+ .toLowerCase()
8
+ .replaceAll(/[^a-z0-9-]/g, "-")
9
+ .replaceAll("0", "-zero-")
10
+ .replaceAll("1", "-one-")
11
+ .replaceAll("2", "-two-")
12
+ .replaceAll("3", "-three-")
13
+ .replaceAll("4", "-four-")
14
+ .replaceAll("5", "-five-")
15
+ .replaceAll("6", "-six-")
16
+ .replaceAll("7", "-seven-")
17
+ .replaceAll("8", "-eight-")
18
+ .replaceAll("9", "-nine-")
19
+ .replaceAll(/-+/g, "-")
18
20
  .toLowerCase();
19
- }
20
21
 
21
- export function popoutWindowDivId(windowTitle: string): string {
22
- return `popoutWindow-${makePopoutId(windowTitle)}`;
23
- }
22
+ export const popoutWindowDivId = (windowTitle: string): string => `popoutWindow-${makePopoutId(windowTitle)}`;
@@ -1,3 +1,4 @@
1
+ import "../story.scss";
1
2
  import "@linzjs/lui/dist/scss/base.scss";
2
3
 
3
4
  import { OpenPanelButton } from "../../../panel/OpenPanelButton";
@@ -7,7 +8,8 @@ import {
7
8
  ButtonIconVerticalGroup,
8
9
  OpenPanelIcon,
9
10
  } from "../../../panel/OpenPanelIcon";
10
- import { Panel, PanelContent, PanelHeader } from "../../../panel/Panel";
11
+ import { Panel, PanelContent } from "../../../panel/Panel";
12
+ import { PanelHeader } from "../../../panel/PanelHeader";
11
13
 
12
14
  /* exclude */
13
15
  export interface ShowPanelProps {
@@ -1,7 +1,9 @@
1
+ import "../story.scss";
1
2
  import "@linzjs/lui/dist/scss/base.scss";
2
3
 
3
4
  import { OpenPanelButton } from "../../../panel/OpenPanelButton";
4
- import { Panel, PanelContent, PanelHeader } from "../../../panel/Panel";
5
+ import { Panel, PanelContent } from "../../../panel/Panel";
6
+ import { PanelHeader } from "../../../panel/PanelHeader";
5
7
  import { PanelsContextProvider } from "../../../panel/PanelsContextProvider";
6
8
 
7
9
  // #Example: Panel Context Provider
@@ -19,7 +21,7 @@ export interface ShowPanelComponentProps {
19
21
 
20
22
  export const ShowPanelComponent = ({ data }: ShowPanelComponentProps) => (
21
23
  <Panel title={`Panel demo ${data}`} size={{ width: 640, height: 400 }}>
22
- <PanelHeader />
24
+ <PanelHeader icon={"ic_add_adopt"} />
23
25
  <PanelContent>
24
26
  <PanelContents />
25
27
  </PanelContent>
@@ -1,9 +1,10 @@
1
- import "./showPanel.scss";
1
+ import "../story.scss";
2
2
  import "@linzjs/lui/dist/scss/base.scss";
3
3
 
4
4
  import { OpenPanelButton } from "../../../panel/OpenPanelButton";
5
- import { Panel, PanelContent, PanelHeader } from "../../../panel/Panel";
5
+ import { Panel, PanelContent } from "../../../panel/Panel";
6
6
  import { PanelDock } from "../../../panel/PanelDock";
7
+ import { PanelHeader } from "../../../panel/PanelHeader";
7
8
 
8
9
  // #Example: Panel Component
9
10
  export interface ShowPanelComponentProps {
@@ -1,10 +1,12 @@
1
+ import "../story.scss";
1
2
  import "@linzjs/lui/dist/scss/base.scss";
2
3
  import "@linzjs/step-ag-grid/dist/GridTheme.scss";
3
4
  import "@linzjs/step-ag-grid/dist/index.css";
4
5
 
5
6
  import { OpenPanelButton } from "../../../panel/OpenPanelButton";
6
- import { Panel, PanelContent, PanelHeader } from "../../../panel/Panel";
7
+ import { Panel, PanelContent } from "../../../panel/Panel";
7
8
  import { PanelContext } from "../../../panel/PanelContext";
9
+ import { PanelHeader } from "../../../panel/PanelHeader";
8
10
  import { PanelsContextProvider } from "../../../panel/PanelsContextProvider";
9
11
  import { useContext, useMemo, useState } from "react";
10
12
 
@@ -35,7 +37,7 @@ export interface TestPanelProps {
35
37
 
36
38
  export const TestPanelResizing = ({ data }: TestPanelProps) => {
37
39
  return (
38
- <Panel title={`Panel resizing demo ${data}`} size={{ width: 320, height: 400 }}>
40
+ <Panel title={`Panel resizing demo ${data}`} size={{ width: 320, height: 400 }} className={"WindowPanel-blue"}>
39
41
  <PanelHeader />
40
42
  <PanelContent>
41
43
  <PanelContentsWithResize />
@@ -0,0 +1,20 @@
1
+ import {getBlocks, blockToString} from "../../support.js";
2
+ import {Meta, Source, Story} from "@storybook/blocks";
3
+ import * as ShowPanelStories from "./ShowPanel.stories.tsx"
4
+
5
+ import myModule from './ShowPanel.tsx?raw';
6
+
7
+ <Meta name="Tabbed Panel" of={ShowPanelStories}/>
8
+ # Show Tabbed Panel
9
+ ## Example
10
+ Click to show the tabbed panel:
11
+ <Story of={ShowPanelStories.ShowTabbedPanel}/>
12
+
13
+ ## Code
14
+ <br/>
15
+ {getBlocks(myModule).map(block => (
16
+ <>
17
+ <h3>{block.split("\n")[0]}</h3>
18
+ <Source code={blockToString(block)} language='typescript'/>
19
+ </>
20
+ ))}
@@ -0,0 +1,27 @@
1
+ import { PanelsContextProvider } from "../../../panel/PanelsContextProvider";
2
+ import { TestShowTabbedPanel } from "./ShowPanel";
3
+ import type { Meta, StoryObj } from "@storybook/react";
4
+
5
+ const meta: Meta<typeof TestShowTabbedPanel> = {
6
+ title: "Components/Panel",
7
+ component: TestShowTabbedPanel,
8
+ argTypes: {
9
+ backgroundColor: { control: "color" },
10
+ },
11
+ decorators: [
12
+ (Story: any) => (
13
+ <div>
14
+ <PanelsContextProvider baseZIndex={500}>
15
+ <Story />
16
+ </PanelsContextProvider>
17
+ </div>
18
+ ),
19
+ ],
20
+ };
21
+
22
+ export default meta;
23
+ type Story = StoryObj<typeof meta>;
24
+
25
+ export const ShowTabbedPanel: Story = {
26
+ args: {},
27
+ };
@@ -0,0 +1,76 @@
1
+ import "../story.scss";
2
+ import "@linzjs/lui/dist/scss/base.scss";
3
+
4
+ import { OpenPanelButton } from "../../../panel/OpenPanelButton";
5
+ import { Panel, PanelContent } from "../../../panel/Panel";
6
+ import { PanelHeader } from "../../../panel/PanelHeader";
7
+ import { PanelsContextProvider } from "../../../panel/PanelsContextProvider";
8
+
9
+ import { LuiTabs, LuiTabsGroup, LuiTabsPanel, LuiTabsPanelSwitch } from "@linzjs/lui";
10
+
11
+ // #Example: Panel Context Provider
12
+ // Don't forget to add a PanelContextProvider at the root of your project
13
+ export const App = () => (
14
+ <PanelsContextProvider baseZIndex={500}>
15
+ <div>...the rest of your app...</div>
16
+ </PanelsContextProvider>
17
+ );
18
+
19
+ // #Example: Panel Component
20
+ export interface ShowPanelComponentProps {
21
+ data: number;
22
+ }
23
+
24
+ export const ShowPanelComponent = ({ data }: ShowPanelComponentProps) => (
25
+ <LuiTabs defaultPanel="africa">
26
+ <Panel title={`Panel demo ${data}`} size={{ width: 640, height: 400 }} className={"WindowPanel-blue"}>
27
+ <PanelHeader
28
+ icon={"ic_send"}
29
+ onHelpClick={() => alert("Help!!!")}
30
+ extraLeft={
31
+ <LuiTabsGroup ariaLabel="Animals">
32
+ <LuiTabsPanelSwitch targetPanel="africa">Africa</LuiTabsPanelSwitch>
33
+ <LuiTabsPanelSwitch targetPanel="asia">Asia</LuiTabsPanelSwitch>
34
+ </LuiTabsGroup>
35
+ }
36
+ />
37
+ <PanelContent>
38
+ <PanelContents />
39
+ </PanelContent>
40
+ </Panel>
41
+ </LuiTabs>
42
+ );
43
+
44
+ /* exclude */
45
+ export const PanelContents = () => (
46
+ <div style={{ margin: "10px 16px" }}>
47
+ <LuiTabsPanel panel="africa">
48
+ <h2>African Countries</h2>
49
+ <ul className={"lui-list-bullet"}>
50
+ <li>Gabon</li>
51
+ <li>Malawi</li>
52
+ <li>Mozambique</li>
53
+ </ul>
54
+ </LuiTabsPanel>
55
+ <LuiTabsPanel panel="asia">
56
+ <h2>Asian Countries</h2>
57
+ <ul className={"lui-list-bullet"}>
58
+ <li>Laos</li>
59
+ <li>Nepal</li>
60
+ <li>Philippines</li>
61
+ </ul>
62
+ </LuiTabsPanel>
63
+ </div>
64
+ );
65
+
66
+ /* exclude */
67
+
68
+ // #Example: Panel Invocation
69
+ export const TestShowTabbedPanel = () => {
70
+ return (
71
+ <>
72
+ <OpenPanelButton buttonText={"TestPanel 1"} component={() => <ShowPanelComponent data={1} />} />{" "}
73
+ <OpenPanelButton buttonText={"TestPanel 2"} component={() => <ShowPanelComponent data={2} />} />
74
+ </>
75
+ );
76
+ };
@@ -0,0 +1,13 @@
1
+ .WindowPanel, .PopoutWindowContainer {
2
+ h1, h2, h3, h4, h5, h6, table {
3
+ margin-top: 0;
4
+ }
5
+ }
6
+
7
+ .panelDock {
8
+ margin-top: 16px;
9
+ border: 2px solid black;
10
+ .panelDock-empty {
11
+ padding: 16px;
12
+ }
13
+ }
@@ -1,9 +0,0 @@
1
- #story--components-panel--show-panel-docking-inner {
2
- .panelDock {
3
- margin-top: 16px;
4
- border: 2px solid black;
5
- .panelDock-empty {
6
- padding: 16px;
7
- }
8
- }
9
- }