@linzjs/windows 10.3.1 → 11.0.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/dist/LuiModalAsync/LuiModalAsync.d.ts +14 -0
- package/dist/LuiModalAsync/LuiModalAsync.js +45 -0
- package/dist/LuiModalAsync/LuiModalAsync.js.map +1 -0
- package/dist/LuiModalAsync/LuiModalAsync.scss +1 -2
- package/dist/LuiModalAsync/LuiModalAsyncButtonGroup.d.ts +19 -0
- package/dist/LuiModalAsync/LuiModalAsyncButtonGroup.js +27 -0
- package/dist/LuiModalAsync/LuiModalAsyncButtonGroup.js.map +1 -0
- package/dist/LuiModalAsync/LuiModalAsyncContent.d.ts +6 -0
- package/dist/LuiModalAsync/LuiModalAsyncContent.js +7 -0
- package/dist/LuiModalAsync/LuiModalAsyncContent.js.map +1 -0
- package/dist/LuiModalAsync/LuiModalAsyncContext.d.ts +28 -0
- package/dist/LuiModalAsync/LuiModalAsyncContext.js +9 -0
- package/dist/LuiModalAsync/LuiModalAsyncContext.js.map +1 -0
- package/dist/LuiModalAsync/LuiModalAsyncContextProvider.d.ts +54 -0
- package/dist/LuiModalAsync/LuiModalAsyncContextProvider.js +160 -0
- package/dist/LuiModalAsync/LuiModalAsyncContextProvider.js.map +1 -0
- package/dist/LuiModalAsync/LuiModalAsyncHeader.d.ts +15 -0
- package/dist/LuiModalAsync/LuiModalAsyncHeader.js +23 -0
- package/dist/LuiModalAsync/LuiModalAsyncHeader.js.map +1 -0
- package/dist/LuiModalAsync/LuiModalAsyncInstanceContext.d.ts +13 -0
- package/dist/LuiModalAsync/LuiModalAsyncInstanceContext.js +13 -0
- package/dist/LuiModalAsync/LuiModalAsyncInstanceContext.js.map +1 -0
- package/dist/LuiModalAsync/LuiModalAsyncMain.d.ts +5 -0
- package/dist/LuiModalAsync/LuiModalAsyncMain.js +6 -0
- package/dist/LuiModalAsync/LuiModalAsyncMain.js.map +1 -0
- package/dist/LuiModalAsync/index.js +12 -0
- package/dist/LuiModalAsync/index.js.map +1 -0
- package/dist/LuiModalAsync/useLuiModalPrefab.d.ts +56 -0
- package/dist/LuiModalAsync/useLuiModalPrefab.js +118 -0
- package/dist/LuiModalAsync/useLuiModalPrefab.js.map +1 -0
- package/dist/LuiModalAsync/useLuiModalUpload.d.ts +16 -0
- package/dist/LuiModalAsync/useLuiModalUpload.js +34 -0
- package/dist/LuiModalAsync/useLuiModalUpload.js.map +1 -0
- package/dist/LuiModalAsync/useShowAsyncModal.d.ts +6 -0
- package/dist/LuiModalAsync/useShowAsyncModal.js +13 -0
- package/dist/LuiModalAsync/useShowAsyncModal.js.map +1 -0
- package/dist/common/debug.d.ts +1 -0
- package/dist/common/debug.js +11 -0
- package/dist/common/debug.js.map +1 -0
- package/dist/common/index.js +3 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/useConstFunction.d.ts +5 -0
- package/dist/common/useConstFunction.js +17 -0
- package/dist/common/useConstFunction.js.map +1 -0
- package/dist/common/useInterval.d.ts +17 -0
- package/dist/common/{useInterval.ts → useInterval.js} +21 -25
- package/dist/common/useInterval.js.map +1 -0
- package/dist/common/useIsomorphicLayoutEffect.d.ts +17 -0
- package/dist/common/{useIsomorphicLayoutEffect.ts → useIsomorphicLayoutEffect.js} +1 -1
- package/dist/common/useIsomorphicLayoutEffect.js.map +1 -0
- package/dist/common/util.d.ts +3 -0
- package/dist/common/util.js +25 -0
- package/dist/common/util.js.map +1 -0
- package/dist/common/uuid.d.ts +1 -0
- package/dist/common/{uuid.ts → uuid.js} +1 -1
- package/dist/common/uuid.js.map +1 -0
- package/dist/components/CopyableText.d.ts +9 -0
- package/dist/components/CopyableText.js +29 -0
- package/dist/components/CopyableText.js.map +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/panel/OpenPanelButton.d.ts +8 -0
- package/dist/panel/OpenPanelButton.js +11 -0
- package/dist/panel/OpenPanelButton.js.map +1 -0
- package/dist/panel/Panel.d.ts +10 -0
- package/dist/panel/Panel.js +122 -0
- package/dist/panel/Panel.js.map +1 -0
- package/dist/panel/PanelContext.d.ts +10 -0
- package/dist/panel/PanelContext.js +13 -0
- package/dist/panel/PanelContext.js.map +1 -0
- package/dist/panel/PanelDock.d.ts +5 -0
- package/dist/panel/PanelDock.js +9 -0
- package/dist/panel/PanelDock.js.map +1 -0
- package/dist/panel/PanelHeader.d.ts +15 -0
- package/dist/panel/PanelHeader.js +33 -0
- package/dist/panel/PanelHeader.js.map +1 -0
- package/dist/panel/PanelHeaderButton.d.ts +8 -0
- package/dist/panel/PanelHeaderButton.js +16 -0
- package/dist/panel/PanelHeaderButton.js.map +1 -0
- package/dist/panel/PanelInline.d.ts +10 -0
- package/dist/panel/PanelInline.js +26 -0
- package/dist/panel/PanelInline.js.map +1 -0
- package/dist/panel/PanelInstanceContext.d.ts +21 -0
- package/dist/panel/PanelInstanceContext.js +25 -0
- package/dist/panel/PanelInstanceContext.js.map +1 -0
- package/dist/panel/PanelInstanceContextProvider.d.ts +11 -0
- package/dist/panel/PanelInstanceContextProvider.js +50 -0
- package/dist/panel/PanelInstanceContextProvider.js.map +1 -0
- package/dist/panel/PanelsContext.d.ts +33 -0
- package/dist/panel/PanelsContext.js +19 -0
- package/dist/panel/PanelsContext.js.map +1 -0
- package/dist/panel/PanelsContextProvider.d.ts +12 -0
- package/dist/panel/PanelsContextProvider.js +145 -0
- package/dist/panel/PanelsContextProvider.js.map +1 -0
- package/dist/panel/PopinWIndow.d.ts +11 -0
- package/dist/panel/PopinWIndow.js +74 -0
- package/dist/panel/PopinWIndow.js.map +1 -0
- package/dist/panel/PopoutWindow.d.ts +17 -0
- package/dist/panel/PopoutWindow.js +72 -0
- package/dist/panel/PopoutWindow.js.map +1 -0
- package/dist/panel/generateId.d.ts +6 -0
- package/dist/panel/{generateId.ts → generateId.js} +3 -4
- package/dist/panel/generateId.js.map +1 -0
- package/dist/panel/handleStyleSheetsChanges.d.ts +9 -0
- package/dist/panel/handleStyleSheetsChanges.js +65 -0
- package/dist/panel/handleStyleSheetsChanges.js.map +1 -0
- package/dist/panel/index.js +13 -0
- package/dist/panel/index.js.map +1 -0
- package/dist/panel/openExternalWindow.d.ts +23 -0
- package/dist/panel/openExternalWindow.js +62 -0
- package/dist/panel/openExternalWindow.js.map +1 -0
- package/dist/panel/types/{PanelPosition.ts → PanelPosition.d.ts} +2 -2
- package/dist/panel/types/PanelPosition.js +2 -0
- package/dist/panel/types/PanelPosition.js.map +1 -0
- package/dist/panel/types/PanelProps.d.ts +19 -0
- package/dist/panel/types/PanelProps.js +2 -0
- package/dist/panel/types/PanelProps.js.map +1 -0
- package/dist/panel/types/{PanelRestoredState.ts → PanelRestoredState.d.ts} +3 -4
- package/dist/panel/types/PanelRestoredState.js +2 -0
- package/dist/panel/types/PanelRestoredState.js.map +1 -0
- package/dist/panel/types/PanelSize.d.ts +8 -0
- package/dist/panel/types/PanelSize.js +2 -0
- package/dist/panel/types/PanelSize.js.map +1 -0
- package/dist/panel/types/{PanelState.ts → PanelState.d.ts} +5 -8
- package/dist/panel/types/PanelState.js +2 -0
- package/dist/panel/types/PanelState.js.map +1 -0
- package/dist/panel/types/{PanelStateOptions.ts → PanelStateOptions.d.ts} +4 -6
- package/dist/panel/types/PanelStateOptions.js +2 -0
- package/dist/panel/types/PanelStateOptions.js.map +1 -0
- package/dist/panel/types/index.js +7 -0
- package/dist/panel/types/index.js.map +1 -0
- package/dist/panel/usePanelStateHandler.d.ts +8 -0
- package/dist/panel/usePanelStateHandler.js +81 -0
- package/dist/panel/usePanelStateHandler.js.map +1 -0
- package/dist/ribbon/RibbonButton.d.ts +21 -0
- package/dist/ribbon/RibbonButton.js +28 -0
- package/dist/ribbon/RibbonButton.js.map +1 -0
- package/dist/ribbon/RibbonButtonLink.d.ts +12 -0
- package/dist/ribbon/RibbonButtonLink.js +11 -0
- package/dist/ribbon/RibbonButtonLink.js.map +1 -0
- package/dist/ribbon/RibbonButtonOpenPanel.d.ts +5 -0
- package/dist/ribbon/RibbonButtonOpenPanel.js +11 -0
- package/dist/ribbon/RibbonButtonOpenPanel.js.map +1 -0
- package/dist/ribbon/RibbonButtonSlider.d.ts +11 -0
- package/dist/ribbon/RibbonButtonSlider.js +28 -0
- package/dist/ribbon/RibbonButtonSlider.js.map +1 -0
- package/dist/ribbon/RibbonButtonSliderContext.d.ts +25 -0
- package/dist/ribbon/RibbonButtonSliderContext.js +25 -0
- package/dist/ribbon/RibbonButtonSliderContext.js.map +1 -0
- package/dist/ribbon/RibbonContainer.d.ts +10 -0
- package/dist/ribbon/RibbonContainer.js +7 -0
- package/dist/ribbon/RibbonContainer.js.map +1 -0
- package/dist/ribbon/RibbonDeprecated.d.ts +10 -0
- package/dist/ribbon/RibbonDeprecated.js +13 -0
- package/dist/ribbon/RibbonDeprecated.js.map +1 -0
- package/dist/ribbon/RibbonMenu.d.ts +7 -0
- package/dist/ribbon/RibbonMenu.js +12 -0
- package/dist/ribbon/RibbonMenu.js.map +1 -0
- package/dist/ribbon/RibbonMenuOption.d.ts +17 -0
- package/dist/ribbon/RibbonMenuOption.js +26 -0
- package/dist/ribbon/RibbonMenuOption.js.map +1 -0
- package/dist/ribbon/RibbonMenuSeparator.d.ts +2 -0
- package/dist/ribbon/RibbonMenuSeparator.js +6 -0
- package/dist/ribbon/RibbonMenuSeparator.js.map +1 -0
- package/dist/ribbon/RibbonSeparator.d.ts +2 -0
- package/dist/ribbon/RibbonSeparator.js +4 -0
- package/dist/ribbon/RibbonSeparator.js.map +1 -0
- package/dist/ribbon/index.js +12 -0
- package/dist/ribbon/index.js.map +1 -0
- package/package.json +14 -8
- package/dist/LuiModalAsync/LuiModalAsync.tsx +0 -82
- package/dist/LuiModalAsync/LuiModalAsyncButtonGroup.tsx +0 -55
- package/dist/LuiModalAsync/LuiModalAsyncContent.tsx +0 -9
- package/dist/LuiModalAsync/LuiModalAsyncContext.tsx +0 -52
- package/dist/LuiModalAsync/LuiModalAsyncContextProvider.tsx +0 -223
- package/dist/LuiModalAsync/LuiModalAsyncHeader.tsx +0 -67
- package/dist/LuiModalAsync/LuiModalAsyncInstanceContext.ts +0 -24
- package/dist/LuiModalAsync/LuiModalAsyncMain.tsx +0 -8
- package/dist/LuiModalAsync/useLuiModalPrefab.tsx +0 -227
- package/dist/LuiModalAsync/useLuiModalUpload.tsx +0 -79
- package/dist/LuiModalAsync/useShowAsyncModal.ts +0 -34
- package/dist/common/debug.ts +0 -9
- package/dist/common/useConstFunction.ts +0 -22
- package/dist/common/util.ts +0 -31
- package/dist/components/CopyableText.tsx +0 -58
- package/dist/panel/OpenPanelButton.tsx +0 -52
- package/dist/panel/Panel.tsx +0 -211
- package/dist/panel/PanelContext.ts +0 -22
- package/dist/panel/PanelDock.tsx +0 -20
- package/dist/panel/PanelHeader.tsx +0 -105
- package/dist/panel/PanelHeaderButton.tsx +0 -26
- package/dist/panel/PanelInline.tsx +0 -46
- package/dist/panel/PanelInstanceContext.ts +0 -44
- package/dist/panel/PanelInstanceContextProvider.tsx +0 -75
- package/dist/panel/PanelsContext.tsx +0 -56
- package/dist/panel/PanelsContextProvider.tsx +0 -220
- package/dist/panel/PopinWIndow.tsx +0 -147
- package/dist/panel/PopoutWindow.tsx +0 -117
- package/dist/panel/handleStyleSheetsChanges.ts +0 -71
- package/dist/panel/openExternalWindow.ts +0 -98
- package/dist/panel/types/PanelProps.ts +0 -22
- package/dist/panel/types/PanelSize.ts +0 -9
- package/dist/panel/usePanelStateHandler.tsx +0 -102
- package/dist/ribbon/RibbonButton.tsx +0 -112
- package/dist/ribbon/RibbonButtonLink.tsx +0 -27
- package/dist/ribbon/RibbonButtonOpenPanel.tsx +0 -23
- package/dist/ribbon/RibbonButtonSlider.tsx +0 -66
- package/dist/ribbon/RibbonButtonSliderContext.tsx +0 -34
- package/dist/ribbon/RibbonContainer.tsx +0 -19
- package/dist/ribbon/RibbonDeprecated.tsx +0 -27
- package/dist/ribbon/RibbonMenu.tsx +0 -25
- package/dist/ribbon/RibbonMenuOption.tsx +0 -67
- package/dist/ribbon/RibbonMenuSeparator.tsx +0 -5
- package/dist/ribbon/RibbonSeparator.tsx +0 -3
- /package/dist/LuiModalAsync/{index.ts → index.d.ts} +0 -0
- /package/dist/common/{index.ts → index.d.ts} +0 -0
- /package/dist/components/{index.ts → index.d.ts} +0 -0
- /package/dist/{index.ts → index.d.ts} +0 -0
- /package/dist/panel/{index.ts → index.d.ts} +0 -0
- /package/dist/panel/types/{index.ts → index.d.ts} +0 -0
- /package/dist/ribbon/{index.ts → index.d.ts} +0 -0
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { useContext, useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
import { PanelsContext } from './PanelsContext';
|
|
4
|
-
import { PanelLayout, PanelMode, PanelRestoredState, PanelState } from './types';
|
|
5
|
-
|
|
6
|
-
type HookArgs = {
|
|
7
|
-
panelPoppedOut?: boolean;
|
|
8
|
-
uniqueId: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const useRestoreStateFrom = ({ panelPoppedOut, uniqueId }: HookArgs) => {
|
|
12
|
-
const { panelStateOptions } = useContext(PanelsContext);
|
|
13
|
-
|
|
14
|
-
return useMemo((): PanelRestoredState | null | undefined => {
|
|
15
|
-
if (!panelStateOptions) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (panelStateOptions.saveStateIn === 'external') {
|
|
20
|
-
return panelStateOptions.onRestoreState?.();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const uniqueKey = createUniqueKey({
|
|
24
|
-
saveStateKey: panelStateOptions.saveStateKey,
|
|
25
|
-
uniqueId,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
const storedState = localStorage.getItem(uniqueKey);
|
|
30
|
-
if (storedState) {
|
|
31
|
-
const { mode, ...state } = JSON.parse(storedState) as PanelState;
|
|
32
|
-
|
|
33
|
-
const currentMode: PanelMode = panelPoppedOut === undefined ? mode : panelPoppedOut ? 'poppedOut' : 'poppedIn';
|
|
34
|
-
const panelLayout = state[currentMode];
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
panelPoppedOut: currentMode === 'poppedOut',
|
|
38
|
-
...panelLayout,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
} catch (e) {
|
|
42
|
-
console.error('Failed to read stored panel state!', e);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return null;
|
|
46
|
-
}, [panelPoppedOut, panelStateOptions, uniqueId]);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const useSaveStateIn = ({ panelPoppedOut = false, uniqueId }: HookArgs) => {
|
|
50
|
-
const { panelStateOptions } = useContext(PanelsContext);
|
|
51
|
-
return (panelLayout: PanelLayout) => {
|
|
52
|
-
if (!panelStateOptions) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const uniqueKey = createUniqueKey({
|
|
57
|
-
saveStateKey: panelStateOptions.saveStateKey,
|
|
58
|
-
uniqueId,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const mode: PanelMode = panelPoppedOut ? 'poppedOut' : 'poppedIn';
|
|
62
|
-
|
|
63
|
-
if (panelStateOptions.saveStateIn === 'external') {
|
|
64
|
-
panelStateOptions.onSaveState?.({
|
|
65
|
-
mode,
|
|
66
|
-
[mode]: panelLayout,
|
|
67
|
-
});
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const storedState = localStorage.getItem(uniqueKey);
|
|
72
|
-
|
|
73
|
-
let panelState: PanelState = {
|
|
74
|
-
mode,
|
|
75
|
-
[mode]: panelLayout,
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
if (storedState) {
|
|
79
|
-
try {
|
|
80
|
-
panelState = JSON.parse(storedState) as PanelState;
|
|
81
|
-
|
|
82
|
-
panelState.mode = mode;
|
|
83
|
-
panelState[mode] = {
|
|
84
|
-
...panelState[mode],
|
|
85
|
-
...panelLayout,
|
|
86
|
-
};
|
|
87
|
-
} catch (e) {
|
|
88
|
-
console.error('Failed to read existing panel state!', e);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
try {
|
|
93
|
-
localStorage.setItem(uniqueKey, JSON.stringify(panelState));
|
|
94
|
-
} catch (e) {
|
|
95
|
-
console.error('Failed to save panel state!', e);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
function createUniqueKey({ saveStateKey, uniqueId }: { saveStateKey: string; uniqueId: string }): string {
|
|
101
|
-
return `panel-${saveStateKey}-${uniqueId}`;
|
|
102
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import '../index.scss';
|
|
2
|
-
|
|
3
|
-
import { LuiIcon, LuiMiniSpinner } from '@linzjs/lui';
|
|
4
|
-
import { IconName } from '@linzjs/lui/dist/components/LuiIcon/LuiIcon';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
|
-
import { forwardRef, ReactElement, useContext } from 'react';
|
|
7
|
-
import Skeleton from 'react-loading-skeleton';
|
|
8
|
-
|
|
9
|
-
import { tabToNextSiblingElement, tabToPreviousSiblingElement } from '../common';
|
|
10
|
-
import { RibbonButtonSliderContext } from './RibbonButtonSliderContext';
|
|
11
|
-
|
|
12
|
-
export interface RibbonButtonProps {
|
|
13
|
-
id?: string;
|
|
14
|
-
popoverTarget?: string;
|
|
15
|
-
popoverTargetAction?: 'toggle' | 'show' | 'hide' | undefined;
|
|
16
|
-
anchorName?: string;
|
|
17
|
-
title?: string;
|
|
18
|
-
icon?: IconName;
|
|
19
|
-
content?: ReactElement;
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
selected?: boolean;
|
|
22
|
-
loading?: boolean;
|
|
23
|
-
processing?: boolean;
|
|
24
|
-
processingMessage?: string;
|
|
25
|
-
className?: string;
|
|
26
|
-
testId?: string;
|
|
27
|
-
onClick?: () => void;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const RibbonButton = forwardRef<HTMLButtonElement, RibbonButtonProps>(function RibbonButton(
|
|
31
|
-
{
|
|
32
|
-
id,
|
|
33
|
-
popoverTarget,
|
|
34
|
-
popoverTargetAction,
|
|
35
|
-
anchorName,
|
|
36
|
-
title,
|
|
37
|
-
icon,
|
|
38
|
-
content,
|
|
39
|
-
className,
|
|
40
|
-
selected,
|
|
41
|
-
loading,
|
|
42
|
-
processing,
|
|
43
|
-
processingMessage = `Loading ${title}`,
|
|
44
|
-
disabled,
|
|
45
|
-
testId,
|
|
46
|
-
onClick,
|
|
47
|
-
},
|
|
48
|
-
ref,
|
|
49
|
-
) {
|
|
50
|
-
const { menuUniqueId, autoClose } = useContext(RibbonButtonSliderContext);
|
|
51
|
-
|
|
52
|
-
if (loading) {
|
|
53
|
-
return (
|
|
54
|
-
<div className={'RibbonButtonSkeleton'}>
|
|
55
|
-
<Skeleton
|
|
56
|
-
className={clsx(
|
|
57
|
-
disabled && 'disabled', // disabled to style cursor
|
|
58
|
-
)}
|
|
59
|
-
height={36}
|
|
60
|
-
width={36}
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (processing) {
|
|
67
|
-
return (
|
|
68
|
-
<div
|
|
69
|
-
className={'RibbonButtonProcessing'}
|
|
70
|
-
role={'status'}
|
|
71
|
-
title={processingMessage}
|
|
72
|
-
aria-label={processingMessage}
|
|
73
|
-
>
|
|
74
|
-
<LuiMiniSpinner size={20} />
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<button
|
|
81
|
-
ref={ref}
|
|
82
|
-
id={id}
|
|
83
|
-
style={{ anchorName }}
|
|
84
|
-
{...((popoverTarget || menuUniqueId) && { ['popovertarget' as never]: popoverTarget ?? menuUniqueId })}
|
|
85
|
-
{...((popoverTargetAction || autoClose != null) && {
|
|
86
|
-
['popovertargetaction' as never]: popoverTargetAction ?? (autoClose ? 'toggle' : 'show'),
|
|
87
|
-
})}
|
|
88
|
-
type="button"
|
|
89
|
-
title={title}
|
|
90
|
-
data-testid={testId}
|
|
91
|
-
disabled={disabled}
|
|
92
|
-
onClick={onClick}
|
|
93
|
-
className={clsx(
|
|
94
|
-
className,
|
|
95
|
-
'RibbonButton',
|
|
96
|
-
selected && 'RibbonButton-selected',
|
|
97
|
-
disabled && 'RibbonButton-disabled',
|
|
98
|
-
)}
|
|
99
|
-
onKeyDown={({ code }) => {
|
|
100
|
-
if (code === 'ArrowDown' || code === 'ArrowRight') {
|
|
101
|
-
tabToNextSiblingElement();
|
|
102
|
-
}
|
|
103
|
-
if (code === 'ArrowUp' || code === 'ArrowLeft') {
|
|
104
|
-
tabToPreviousSiblingElement();
|
|
105
|
-
}
|
|
106
|
-
}}
|
|
107
|
-
>
|
|
108
|
-
{icon && <LuiIcon name={icon} alt={title ?? ''} size={'md'} />}
|
|
109
|
-
{content}
|
|
110
|
-
</button>
|
|
111
|
-
);
|
|
112
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import '../index.scss';
|
|
2
|
-
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
|
|
5
|
-
import { RibbonButton, RibbonButtonProps } from './RibbonButton';
|
|
6
|
-
|
|
7
|
-
export type RibbonButtonLinkProps = RibbonButtonProps & {
|
|
8
|
-
href: string;
|
|
9
|
-
target?: string;
|
|
10
|
-
rel?: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const RibbonButtonLink = forwardRef<HTMLButtonElement, RibbonButtonLinkProps>(function RibbonButtonLink(
|
|
14
|
-
{ onClick, href, rel = 'noreferrer', target = '_blank', ...props },
|
|
15
|
-
ref,
|
|
16
|
-
) {
|
|
17
|
-
return (
|
|
18
|
-
<RibbonButton
|
|
19
|
-
ref={ref}
|
|
20
|
-
{...props}
|
|
21
|
-
onClick={() => {
|
|
22
|
-
onClick?.();
|
|
23
|
-
void window.open(href, target, rel);
|
|
24
|
-
}}
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
27
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import '../index.scss';
|
|
2
|
-
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { forwardRef, useContext } from 'react';
|
|
5
|
-
|
|
6
|
-
import { OpenPanelOptions, PanelsContext } from '../panel/PanelsContext';
|
|
7
|
-
import { RibbonButton, RibbonButtonProps } from './RibbonButton';
|
|
8
|
-
|
|
9
|
-
export type RibbonButtonOpenPanelProps = Omit<RibbonButtonProps, 'onClick'> & OpenPanelOptions;
|
|
10
|
-
export const RibbonButtonOpenPanel = forwardRef<HTMLButtonElement, RibbonButtonOpenPanelProps>(
|
|
11
|
-
function RibbonButtonOpenPanel({ uniqueId, componentFn, poppedOut, onClose, className, ...buttonProps }, ref) {
|
|
12
|
-
const { openPanel, openPanels } = useContext(PanelsContext);
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<RibbonButton
|
|
16
|
-
ref={ref}
|
|
17
|
-
{...buttonProps}
|
|
18
|
-
onClick={() => openPanel({ uniqueId: uniqueId || buttonProps.title, componentFn, poppedOut, onClose })}
|
|
19
|
-
className={clsx(openPanels.has(uniqueId ?? '') && 'RibbonButton-selected', className)}
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
},
|
|
23
|
-
);
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import '../index.scss';
|
|
2
|
-
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { forwardRef, PropsWithChildren, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
import { RibbonButton, RibbonButtonProps } from './RibbonButton';
|
|
7
|
-
import { RibbonButtonSliderContext, RibbonSliderAlignment, ribbonSliderAlignments } from './RibbonButtonSliderContext';
|
|
8
|
-
import { v4 } from '../common/uuid';
|
|
9
|
-
|
|
10
|
-
export interface RibbonSliderProps extends RibbonButtonProps {
|
|
11
|
-
autoClose?: boolean;
|
|
12
|
-
alignment: RibbonSliderAlignment;
|
|
13
|
-
sliderClassName?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const RibbonButtonSlider = forwardRef<HTMLButtonElement, PropsWithChildren<RibbonSliderProps>>(
|
|
17
|
-
function RibbonButtonSlider(
|
|
18
|
-
{ alignment, sliderClassName, autoClose = false, children, onClick, ...buttonProps },
|
|
19
|
-
ref,
|
|
20
|
-
) {
|
|
21
|
-
const [uniqueId] = useState(v4());
|
|
22
|
-
const [menuUniqueId] = useState(`toolbarSliderMenu-${v4()}`);
|
|
23
|
-
const [positionAnchor] = useState(`--toolbarSliderAnchor-${uniqueId}`);
|
|
24
|
-
|
|
25
|
-
const defaultOnClick = () => setTimeout(focusNextRibbonButton, 0);
|
|
26
|
-
|
|
27
|
-
const alignments = ribbonSliderAlignments[alignment];
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<RibbonButtonSliderContext.Provider value={{ autoClose, positionAnchor, menuUniqueId }}>
|
|
31
|
-
<RibbonButton
|
|
32
|
-
ref={ref}
|
|
33
|
-
popoverTarget={menuUniqueId}
|
|
34
|
-
popoverTargetAction={'toggle'}
|
|
35
|
-
anchorName={positionAnchor}
|
|
36
|
-
{...buttonProps}
|
|
37
|
-
onClick={onClick ?? defaultOnClick}
|
|
38
|
-
/>
|
|
39
|
-
<nav
|
|
40
|
-
id={menuUniqueId}
|
|
41
|
-
{...{ ['popover' as never]: 'auto' }}
|
|
42
|
-
role="menu"
|
|
43
|
-
aria-label="Menu"
|
|
44
|
-
className={clsx(`RibbonSliderMenu RibbonSliderMenu-${alignment}`, sliderClassName)}
|
|
45
|
-
style={{
|
|
46
|
-
positionAnchor,
|
|
47
|
-
[alignments[0]]: `anchor(${positionAnchor} ${alignments[1]})`,
|
|
48
|
-
[alignments[2]]: `anchor(${positionAnchor} ${alignments[2]})`,
|
|
49
|
-
...(alignments[3] && { transform: `translate(${alignments[3]})` }),
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
{children}
|
|
53
|
-
</nav>
|
|
54
|
-
</RibbonButtonSliderContext.Provider>
|
|
55
|
-
);
|
|
56
|
-
},
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
const focusNextRibbonButton = () => {
|
|
60
|
-
let button =
|
|
61
|
-
document.activeElement?.nextElementSibling?.querySelectorAll<HTMLButtonElement>('button.RibbonButton-selected')[0];
|
|
62
|
-
if (!button) {
|
|
63
|
-
button = document.activeElement?.nextElementSibling?.querySelectorAll('button')[0];
|
|
64
|
-
}
|
|
65
|
-
button?.focus();
|
|
66
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { createContext } from 'react';
|
|
2
|
-
|
|
3
|
-
export const ribbonSliderAlignments = {
|
|
4
|
-
right: ['left', 'right', 'top'],
|
|
5
|
-
'right-down': ['left', 'right', 'top'],
|
|
6
|
-
'right-center': ['left', 'right', 'top', '0%, -50%'],
|
|
7
|
-
'right-up': ['left', 'right', 'bottom'],
|
|
8
|
-
left: ['right', 'left', 'top'],
|
|
9
|
-
'left-down': ['right', 'left', 'top'],
|
|
10
|
-
'left-center': ['right', 'left', 'top', '0%, -50%'],
|
|
11
|
-
'left-up': ['right', 'left', 'bottom'],
|
|
12
|
-
'down-left': ['top', 'bottom', 'right'],
|
|
13
|
-
'down-center': ['top', 'bottom', 'right', '50%, 0%'],
|
|
14
|
-
'down-right': ['top', 'bottom', 'left'],
|
|
15
|
-
down: ['top', 'bottom', 'left'],
|
|
16
|
-
'up-left': ['bottom', 'top', 'right'],
|
|
17
|
-
'up-center': ['bottom', 'top', 'right', '50%, 0%'],
|
|
18
|
-
'up-right': ['bottom', 'top', 'left'],
|
|
19
|
-
up: ['bottom', 'top', 'left'],
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type RibbonSliderAlignment = keyof typeof ribbonSliderAlignments;
|
|
23
|
-
|
|
24
|
-
export interface RibbonButtonSliderContextType {
|
|
25
|
-
autoClose: boolean | undefined;
|
|
26
|
-
menuUniqueId: string;
|
|
27
|
-
positionAnchor: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const RibbonButtonSliderContext = createContext<RibbonButtonSliderContextType>({
|
|
31
|
-
autoClose: undefined,
|
|
32
|
-
menuUniqueId: '',
|
|
33
|
-
positionAnchor: '',
|
|
34
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import '../index.scss';
|
|
2
|
-
|
|
3
|
-
import { CSSProperties, PropsWithChildren, forwardRef } from 'react';
|
|
4
|
-
|
|
5
|
-
export interface RibbonContainerProps {
|
|
6
|
-
orientation?: 'horizontal' | 'vertical';
|
|
7
|
-
style?: CSSProperties;
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const RibbonContainer = forwardRef<HTMLDivElement, PropsWithChildren<RibbonContainerProps>>(
|
|
12
|
-
function RibbonContainer({ orientation = 'horizontal', style, className, children }, ref) {
|
|
13
|
-
return (
|
|
14
|
-
<div ref={ref} style={style} className={className}>
|
|
15
|
-
<div className={`RibbonButton-${orientation}Group`}>{children}</div>
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
},
|
|
19
|
-
);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
|
-
import { RibbonButtonProps } from './RibbonButton';
|
|
4
|
-
import { RibbonButtonOpenPanel, RibbonButtonOpenPanelProps } from './RibbonButtonOpenPanel';
|
|
5
|
-
import { RibbonContainer } from './RibbonContainer';
|
|
6
|
-
import { RibbonSeparator } from './RibbonSeparator';
|
|
7
|
-
|
|
8
|
-
// @Deprecated use RibbonPanelButton
|
|
9
|
-
export type OpenPanelIconProps = RibbonButtonProps;
|
|
10
|
-
|
|
11
|
-
// @Deprecated use RibbonPanelButton
|
|
12
|
-
export const OpenPanelIcon = ({ iconTitle, ...props }: RibbonButtonOpenPanelProps & { iconTitle?: string }) => (
|
|
13
|
-
<RibbonButtonOpenPanel title={iconTitle} {...props} />
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
// @Deprecated use RibbonContainer
|
|
17
|
-
export const ButtonIconHorizontalGroup = (props: PropsWithChildren) => (
|
|
18
|
-
<RibbonContainer orientation={'horizontal'} {...props} />
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
// @Deprecated use RibbonContainer
|
|
22
|
-
export const ButtonIconVerticalGroup = (props: PropsWithChildren) => (
|
|
23
|
-
<RibbonContainer orientation={'vertical'} {...props} />
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
// @Deprecated use ButtonIconSeparator
|
|
27
|
-
export const ButtonIconSeparator = RibbonSeparator;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createContext, PropsWithChildren, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { RibbonContainer } from './RibbonContainer';
|
|
4
|
-
|
|
5
|
-
export interface RibbonMenuContext {
|
|
6
|
-
hasIcon: boolean;
|
|
7
|
-
setHasIcon: (hasIcon: boolean) => void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const RibbonMenuContext = createContext<RibbonMenuContext>({
|
|
11
|
-
hasIcon: false,
|
|
12
|
-
setHasIcon: () => {},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const RibbonMenu = ({ children }: PropsWithChildren) => {
|
|
16
|
-
const [hasIcon, setHasIcon] = useState(false);
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<RibbonMenuContext.Provider value={{ hasIcon, setHasIcon }}>
|
|
20
|
-
<RibbonContainer orientation={'vertical'}>
|
|
21
|
-
<div style={{ padding: '4px 0' }}>{children}</div>
|
|
22
|
-
</RibbonContainer>
|
|
23
|
-
</RibbonMenuContext.Provider>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import '../index.scss';
|
|
2
|
-
|
|
3
|
-
import { LuiIcon } from '@linzjs/lui';
|
|
4
|
-
import { IconName } from '@linzjs/lui/dist/components/LuiIcon/LuiIcon';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
|
-
import { forwardRef, PropsWithChildren, useContext, useEffect } from 'react';
|
|
7
|
-
|
|
8
|
-
import { tabToNextSiblingElement, tabToPreviousSiblingElement } from '../common/util';
|
|
9
|
-
import { RibbonButtonSliderContext } from './RibbonButtonSliderContext';
|
|
10
|
-
import { RibbonMenuContext } from './RibbonMenu';
|
|
11
|
-
|
|
12
|
-
export interface RibbonMenuOption {
|
|
13
|
-
id?: string;
|
|
14
|
-
popoverTarget?: string;
|
|
15
|
-
popoverTargetAction?: 'toggle' | 'show' | 'hide' | undefined;
|
|
16
|
-
anchorName?: string;
|
|
17
|
-
title?: string;
|
|
18
|
-
icon?: IconName;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
className?: string;
|
|
21
|
-
testId?: string;
|
|
22
|
-
onClick?: () => void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const RibbonMenuOption = forwardRef<HTMLButtonElement, PropsWithChildren<RibbonMenuOption>>(
|
|
26
|
-
function RibbonButton(
|
|
27
|
-
{ id, popoverTarget, popoverTargetAction, anchorName, title, icon, children, className, disabled, testId, onClick },
|
|
28
|
-
ref,
|
|
29
|
-
) {
|
|
30
|
-
const { menuUniqueId, autoClose } = useContext(RibbonButtonSliderContext);
|
|
31
|
-
const { hasIcon, setHasIcon } = useContext(RibbonMenuContext);
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
setHasIcon(!!icon);
|
|
35
|
-
}, [icon, setHasIcon]);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<button
|
|
39
|
-
ref={ref}
|
|
40
|
-
id={id}
|
|
41
|
-
style={{ anchorName }}
|
|
42
|
-
{...{ ['popovertarget' as never]: popoverTarget ?? menuUniqueId }}
|
|
43
|
-
{...{ ['popovertargetaction' as never]: popoverTargetAction ?? (autoClose ? 'toggle' : 'show') }}
|
|
44
|
-
type="button"
|
|
45
|
-
title={title}
|
|
46
|
-
data-testid={testId}
|
|
47
|
-
disabled={disabled}
|
|
48
|
-
onKeyDown={({ code }) => {
|
|
49
|
-
if (code === 'ArrowDown') {
|
|
50
|
-
tabToNextSiblingElement();
|
|
51
|
-
}
|
|
52
|
-
if (code === 'ArrowUp') {
|
|
53
|
-
tabToPreviousSiblingElement();
|
|
54
|
-
}
|
|
55
|
-
}}
|
|
56
|
-
onMouseMove={({ currentTarget }) => {
|
|
57
|
-
currentTarget?.focus?.();
|
|
58
|
-
}}
|
|
59
|
-
onClick={onClick}
|
|
60
|
-
className={clsx(className, 'RibbonMenuOption', disabled && 'RibbonMenuOption-disabled')}
|
|
61
|
-
>
|
|
62
|
-
<div style={{ display: 'flex' }}>{icon && <LuiIcon name={icon} alt={title ?? ''} size={'md'} />}</div>
|
|
63
|
-
<div style={hasIcon && !icon ? { paddingLeft: 24 } : {}}>{children}</div>
|
|
64
|
-
</button>
|
|
65
|
-
);
|
|
66
|
-
},
|
|
67
|
-
);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|