@linzjs/windows 4.1.0 → 4.1.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.
|
@@ -7,11 +7,11 @@ interface OpenPanelButtonProps extends OpenPanelOptions {
|
|
|
7
7
|
buttonText: string;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const OpenPanelButton = ({ buttonText, ...openPanelOptions }: OpenPanelButtonProps) => {
|
|
10
|
+
export const OpenPanelButton = ({ buttonText, uniqueId = buttonText, ...openPanelOptions }: OpenPanelButtonProps) => {
|
|
11
11
|
const { openPanel, openPanels } = useContext(PanelsContext);
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<button onClick={() => openPanel(openPanelOptions)}>
|
|
14
|
+
<button onClick={() => openPanel({ uniqueId, ...openPanelOptions })}>
|
|
15
15
|
Show {buttonText} {openPanels.has(buttonText) ? "(Open)" : ""}
|
|
16
16
|
</button>
|
|
17
17
|
);
|
|
@@ -2,7 +2,7 @@ import "./OpenPanelIcon.scss";
|
|
|
2
2
|
|
|
3
3
|
import { OpenPanelOptions, PanelsContext } from "./PanelsContext";
|
|
4
4
|
import clsx from "clsx";
|
|
5
|
-
import { ReactNode, useContext
|
|
5
|
+
import { ReactNode, useContext } from "react";
|
|
6
6
|
|
|
7
7
|
import { LuiIcon } from "@linzjs/lui";
|
|
8
8
|
import { IconName } from "@linzjs/lui/dist/components/LuiIcon/LuiIcon";
|
|
@@ -35,10 +35,10 @@ export const OpenPanelIcon = ({
|
|
|
35
35
|
className,
|
|
36
36
|
disabled,
|
|
37
37
|
testId,
|
|
38
|
+
uniqueId = iconTitle,
|
|
38
39
|
...openPanelOptions
|
|
39
40
|
}: OpenPanelIconProps) => {
|
|
40
41
|
const { openPanel, openPanels } = useContext(PanelsContext);
|
|
41
|
-
const id = useRef(openPanelOptions.uniqueId ?? crypto.randomUUID());
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
44
|
<button
|
|
@@ -46,11 +46,11 @@ export const OpenPanelIcon = ({
|
|
|
46
46
|
className={clsx(
|
|
47
47
|
className,
|
|
48
48
|
"lui-button lui-button-secondary lui-button-toolbar panel-button",
|
|
49
|
-
openPanels.has(
|
|
49
|
+
openPanels.has(uniqueId) && "OpenPanelIcon-selected",
|
|
50
50
|
disabled && "OpenPanelIcon-disabled",
|
|
51
51
|
)}
|
|
52
52
|
title={iconTitle}
|
|
53
|
-
onClick={() => openPanel(openPanelOptions)}
|
|
53
|
+
onClick={() => openPanel({ uniqueId, ...openPanelOptions })}
|
|
54
54
|
disabled={disabled}
|
|
55
55
|
data-testid={testId}
|
|
56
56
|
>
|