@linzjs/windows 3.8.0 → 4.0.1

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.
@@ -17,7 +17,6 @@ import React, {
17
17
  } from "react";
18
18
  import { createPortal } from "react-dom";
19
19
  import { useInterval } from "usehooks-ts";
20
- import { v4 as makeUuid } from "uuid";
21
20
 
22
21
  export interface LuiModalAsyncInstance {
23
22
  uuid: string;
@@ -107,7 +106,7 @@ export const LuiModalAsyncContextProvider = ({ children }: PropsWithChildren<unk
107
106
  args: any,
108
107
  showModalProps?: ShowModalProps,
109
108
  ): PromiseWithResolve<any> => {
110
- const uuid = makeUuid();
109
+ const uuid = crypto.randomUUID();
111
110
  let extResolve: PromiseWithResolve<any>["resolve"];
112
111
  const promise = new Promise((resolve) => {
113
112
  extResolve = resolve;
@@ -1,17 +1,17 @@
1
1
  // Simple button to open panel and show panel state
2
- import { PanelsContext } from "./PanelsContext";
3
- import { ReactElement, useContext } from "react";
2
+ import { OpenPanelOptions, PanelsContext } from "./PanelsContext";
3
+ import { useContext } from "react";
4
4
 
5
- interface OpenPanelButtonProps {
5
+ interface OpenPanelButtonProps extends OpenPanelOptions {
6
+ uniqueId?: string;
6
7
  buttonText: string;
7
- component: () => ReactElement;
8
8
  }
9
9
 
10
- export const OpenPanelButton = ({ buttonText, component }: OpenPanelButtonProps) => {
10
+ export const OpenPanelButton = ({ buttonText, ...openPanelOptions }: OpenPanelButtonProps) => {
11
11
  const { openPanel, openPanels } = useContext(PanelsContext);
12
12
 
13
13
  return (
14
- <button onClick={() => openPanel({ uniqueId: buttonText, componentFn: component })}>
14
+ <button onClick={() => openPanel(openPanelOptions)}>
15
15
  Show {buttonText} {openPanels.has(buttonText) ? "(Open)" : ""}
16
16
  </button>
17
17
  );
@@ -1,9 +1,8 @@
1
1
  import "./OpenPanelIcon.scss";
2
2
 
3
- import { PanelsContext } from "./PanelsContext";
3
+ import { OpenPanelOptions, PanelsContext } from "./PanelsContext";
4
4
  import clsx from "clsx";
5
- import { ReactElement, ReactNode, useContext, useRef } from "react";
6
- import { v4 as uuid } from "uuid";
5
+ import { ReactNode, useContext, useRef } from "react";
7
6
 
8
7
  import { LuiIcon } from "@linzjs/lui";
9
8
  import { IconName } from "@linzjs/lui/dist/components/LuiIcon/LuiIcon";
@@ -22,29 +21,24 @@ export const ButtonIconVerticalGroup = ({ children }: { children: ReactNode }) =
22
21
 
23
22
  export const ButtonIconSeparator = () => <div className="OpenPanelIcon-separator">&#160;</div>;
24
23
 
25
- interface OpenPanelIconProps {
26
- uniqueId?: string;
24
+ interface OpenPanelIconProps extends OpenPanelOptions {
27
25
  iconTitle: string;
28
26
  icon: IconName;
29
- component: () => ReactElement;
30
27
  disabled?: boolean;
31
28
  className?: string;
32
29
  testId?: string;
33
- isPoppedOut?: boolean;
34
30
  }
35
31
 
36
32
  export const OpenPanelIcon = ({
37
33
  iconTitle,
38
- uniqueId,
39
34
  icon,
40
- component,
41
35
  className,
42
36
  disabled,
43
37
  testId,
44
- isPoppedOut = false,
38
+ ...openPanelOptions
45
39
  }: OpenPanelIconProps) => {
46
40
  const { openPanel, openPanels } = useContext(PanelsContext);
47
- const id = useRef(uniqueId ?? uuid());
41
+ const id = useRef(openPanelOptions.uniqueId ?? crypto.randomUUID());
48
42
 
49
43
  return (
50
44
  <button
@@ -56,13 +50,7 @@ export const OpenPanelIcon = ({
56
50
  disabled && "OpenPanelIcon-disabled",
57
51
  )}
58
52
  title={iconTitle}
59
- onClick={() =>
60
- openPanel({
61
- componentFn: component,
62
- uniqueId: id.current,
63
- isPoppedOut,
64
- })
65
- }
53
+ onClick={() => openPanel(openPanelOptions)}
66
54
  disabled={disabled}
67
55
  data-testid={testId}
68
56
  >
@@ -13,6 +13,7 @@ export interface PanelHeaderProps {
13
13
  extraRight?: ReactNode;
14
14
  helpUrl?: string;
15
15
  onHelpClick?: () => void;
16
+ onDockClick?: () => void;
16
17
  dockTo?: string;
17
18
  disableClose?: boolean;
18
19
  disablePopout?: boolean;
@@ -24,6 +25,7 @@ export const PanelHeader = ({
24
25
  extraRight,
25
26
  helpUrl,
26
27
  onHelpClick,
28
+ onDockClick,
27
29
  dockTo,
28
30
  disableClose,
29
31
  disablePopout,
@@ -58,7 +60,9 @@ export const PanelHeader = ({
58
60
  </div>
59
61
  {(dockTo || !disablePopout || !disableClose) && <div className={"WindowPanel-divider-right"} />}
60
62
  <div className={"WindowPanel-buttons"}>
61
- {dockTo &&
63
+ {onDockClick && <PanelHeaderButton aria-label={"Dock"} onClick={() => onDockClick()} icon={"ic_left_col"} />}
64
+ {!onDockClick &&
65
+ dockTo &&
62
66
  (docked ? (
63
67
  <PanelHeaderButton aria-label={"Undock"} onClick={undock} icon={"ic_close_list"} />
64
68
  ) : (
@@ -14,10 +14,9 @@ export interface PanelInstance {
14
14
  }
15
15
 
16
16
  export interface OpenPanelOptions {
17
- uniqueId: string;
17
+ uniqueId?: string;
18
18
  componentFn: () => ReactElement;
19
19
  poppedOut?: boolean;
20
- docked?: boolean;
21
20
  }
22
21
 
23
22
  export interface PanelsContextType {
@@ -54,7 +54,7 @@ export const PanelsContextProvider = ({
54
54
  );
55
55
 
56
56
  const openPanel = useCallback(
57
- ({ componentFn, poppedOut = false, uniqueId }: OpenPanelOptions): void => {
57
+ ({ componentFn, poppedOut = false, uniqueId = crypto.randomUUID() }: OpenPanelOptions): void => {
58
58
  try {
59
59
  const existingPanelInstance = panelInstances.find((pi) => pi.uniqueId === uniqueId);
60
60
  if (existingPanelInstance) {
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "popout"
14
14
  ],
15
15
  "main": "./dist/index.ts",
16
- "version": "3.8.0",
16
+ "version": "4.0.1",
17
17
  "peerDependencies": {
18
18
  "@linzjs/lui": ">=21",
19
19
  "lodash-es": ">=4",
@@ -34,7 +34,7 @@
34
34
  "build": "run-s clean stylelint lint lint-circular-deps bundle",
35
35
  "yalc": "run-s clean bundle && yalc publish",
36
36
  "clean": "rimraf dist && mkdirp ./dist",
37
- "bundle": "rollup -c",
37
+ "bundle": "tsc --noEmit && rollup -c",
38
38
  "test": "jest",
39
39
  "stylelint": "stylelint src/**/*.scss src/**/*.css --fix",
40
40
  "lint": "eslint ./src --ext .js,.ts,.tsx --fix --cache --ignore-path .gitignore",
@@ -51,8 +51,7 @@
51
51
  "@emotion/styled": "^11.13.5",
52
52
  "lodash-es": ">=4",
53
53
  "react-rnd": "^10.4.13",
54
- "usehooks-ts": "^3.1.0",
55
- "uuid": "^11.0.3"
54
+ "usehooks-ts": "^3.1.0"
56
55
  },
57
56
  "devDependencies": {
58
57
  "@chromatic-com/storybook": "^3.2.2",
@@ -63,16 +62,15 @@
63
62
  "@rollup/plugin-commonjs": "^28.0.1",
64
63
  "@rollup/plugin-json": "^6.1.0",
65
64
  "@rollup/plugin-node-resolve": "^15.3.0",
66
- "@storybook/addon-docs": "^8.4.6",
67
- "@storybook/addon-essentials": "^8.4.6",
68
- "@storybook/addon-interactions": "^8.4.6",
69
- "@storybook/addon-links": "^8.4.6",
70
- "@storybook/addon-mdx-gfm": "^8.4.6",
71
- "@storybook/blocks": "^8.4.6",
72
- "@storybook/react": "^8.4.6",
73
- "@storybook/react-vite": "^8.4.6",
74
- "@storybook/test": "^8.4.6",
75
- "@storybook/test-runner": "^0.20.0",
65
+ "@storybook/addon-docs": "^8.4.7",
66
+ "@storybook/addon-essentials": "^8.4.7",
67
+ "@storybook/addon-interactions": "^8.4.7",
68
+ "@storybook/addon-links": "^8.4.7",
69
+ "@storybook/addon-mdx-gfm": "^8.4.7",
70
+ "@storybook/blocks": "^8.4.7",
71
+ "@storybook/react": "^8.4.7",
72
+ "@storybook/react-vite": "^8.4.7",
73
+ "@storybook/test": "^8.4.7",
76
74
  "@testing-library/jest-dom": "^6.6.3",
77
75
  "@testing-library/react": "^16.0.1",
78
76
  "@testing-library/user-event": "^14.5.2",
@@ -82,7 +80,6 @@
82
80
  "@types/node": "^22.10.1",
83
81
  "@types/react": "^18.3.12",
84
82
  "@types/react-dom": "^18.3.1",
85
- "@types/uuid": "^10.0.0",
86
83
  "@typescript-eslint/eslint-plugin": "^7.17.0",
87
84
  "@typescript-eslint/parser": "^7.17.0",
88
85
  "ag-grid-community": "^32.3.3",
@@ -112,10 +109,10 @@
112
109
  "react-dom": "^18.3.1",
113
110
  "rollup": "^4.28.0",
114
111
  "rollup-plugin-copy": "^3.5.0",
115
- "sass": "^1.81.0",
116
- "sass-loader": "^14.2.1",
112
+ "sass": "^1.83.0",
113
+ "sass-loader": "^16.0.4",
117
114
  "semantic-release": "^22.0.12",
118
- "storybook": "^8.4.6",
115
+ "storybook": "^8.4.7",
119
116
  "style-loader": "^4.0.0",
120
117
  "stylelint": "^16.11.0",
121
118
  "stylelint-config-recommended": "^14.0.1",
@@ -126,6 +123,9 @@
126
123
  "typescript": "^5.7.2",
127
124
  "vite": "^5.4.11"
128
125
  },
126
+ "optionalDependencies": {
127
+ "@rollup/rollup-linux-x64-gnu": "^4.28.1"
128
+ },
129
129
  "eslintConfig": {
130
130
  "extends": [
131
131
  "react-app",