@linzjs/windows 10.1.1 → 10.2.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../index.scss';
|
|
2
2
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { CSSProperties, ReactElement, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { CSSProperties, MouseEvent, ReactElement, useEffect, useRef, useState } from 'react';
|
|
5
5
|
|
|
6
6
|
export interface CopyableTextProps {
|
|
7
7
|
dataTestId?: string;
|
|
@@ -16,8 +16,9 @@ export const CopyableText = (props: CopyableTextProps): ReactElement => {
|
|
|
16
16
|
const { dataTestId, style, className, text } = props;
|
|
17
17
|
const timeoutRefDisplay = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
18
18
|
|
|
19
|
-
const copy = () => {
|
|
20
|
-
|
|
19
|
+
const copy = (event: MouseEvent<HTMLSpanElement>) => {
|
|
20
|
+
const win = event.currentTarget.ownerDocument.defaultView ?? window;
|
|
21
|
+
win.navigator.clipboard.writeText(String(text)).then(
|
|
21
22
|
() => {
|
|
22
23
|
setCopied(true);
|
|
23
24
|
timeoutRefDisplay.current = setTimeout(() => void setCopied(false), 3000);
|
|
@@ -45,7 +46,7 @@ export const CopyableText = (props: CopyableTextProps): ReactElement => {
|
|
|
45
46
|
className={clsx('windows_tooltip', className)}
|
|
46
47
|
onClick={(event) => {
|
|
47
48
|
event.stopPropagation();
|
|
48
|
-
copy();
|
|
49
|
+
copy(event);
|
|
49
50
|
}}
|
|
50
51
|
>
|
|
51
52
|
<span className="windows_tooltiptext" style={{ width: copied ? '62px' : '47px' }}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, PropsWithChildren } from 'react';
|
|
1
|
+
import { CSSProperties, forwardRef, PropsWithChildren } from 'react';
|
|
2
2
|
|
|
3
3
|
import { PanelContext } from './PanelContext';
|
|
4
4
|
import { PanelInstanceContext } from './PanelInstanceContext';
|
|
@@ -12,7 +12,10 @@ export interface PanelInlineProps {
|
|
|
12
12
|
height?: CSSProperties['height'];
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export const PanelInline =
|
|
15
|
+
export const PanelInline = forwardRef<HTMLDivElement, PropsWithChildren<PanelInlineProps>>(function PanelInline(
|
|
16
|
+
{ title, className, width, height, children },
|
|
17
|
+
ref,
|
|
18
|
+
) {
|
|
16
19
|
return (
|
|
17
20
|
<PanelContext.Provider value={{ resizeable: false, resizePanel: () => {}, initialResizePanel: () => {} }}>
|
|
18
21
|
<PanelInstanceContext.Provider
|
|
@@ -34,10 +37,10 @@ export const PanelInline = ({ title, className, width, height, children }: Props
|
|
|
34
37
|
bounds: undefined,
|
|
35
38
|
}}
|
|
36
39
|
>
|
|
37
|
-
<div className={clsx('WindowPanel', className)} title={title} style={{ width, height }}>
|
|
40
|
+
<div ref={ref} className={clsx('WindowPanel', className)} title={title} style={{ width, height }}>
|
|
38
41
|
{children}
|
|
39
42
|
</div>
|
|
40
43
|
</PanelInstanceContext.Provider>
|
|
41
44
|
</PanelContext.Provider>
|
|
42
45
|
);
|
|
43
|
-
};
|
|
46
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import '../index.scss';
|
|
2
2
|
|
|
3
|
-
import { CSSProperties, PropsWithChildren } from 'react';
|
|
3
|
+
import { CSSProperties, PropsWithChildren, forwardRef } from 'react';
|
|
4
4
|
|
|
5
5
|
export interface RibbonContainerProps {
|
|
6
6
|
orientation?: 'horizontal' | 'vertical';
|
|
@@ -8,13 +8,12 @@ export interface RibbonContainerProps {
|
|
|
8
8
|
className?: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const RibbonContainer = (
|
|
12
|
-
orientation = 'horizontal',
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</div>
|
|
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
|
+
},
|
|
20
19
|
);
|
package/dist/ribbon/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"popout"
|
|
14
14
|
],
|
|
15
15
|
"main": "./dist/index.ts",
|
|
16
|
-
"version": "10.
|
|
16
|
+
"version": "10.2.0",
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@linzjs/lui": ">=23",
|
|
19
19
|
"react": ">=18",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=24"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "node -e \"require('fs').mkdirSync('./dist',{recursive:true})\" && npm run clean && npm run lintall && npm run bundle",
|
|
@@ -53,19 +53,19 @@
|
|
|
53
53
|
"react-rnd": "10.5.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@chromatic-com/storybook": "^
|
|
57
|
-
"@linzjs/lui": "^24.
|
|
58
|
-
"@linzjs/step-ag-grid": "^31.2.
|
|
59
|
-
"@rollup/plugin-commonjs": "^
|
|
56
|
+
"@chromatic-com/storybook": "^5.1.2",
|
|
57
|
+
"@linzjs/lui": "^24.14.0",
|
|
58
|
+
"@linzjs/step-ag-grid": "^31.2.2",
|
|
59
|
+
"@rollup/plugin-commonjs": "^29.0.2",
|
|
60
60
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
61
|
-
"@storybook/addon-docs": "
|
|
62
|
-
"@storybook/addon-links": "
|
|
63
|
-
"@storybook/react-vite": "
|
|
61
|
+
"@storybook/addon-docs": "10.3.6",
|
|
62
|
+
"@storybook/addon-links": "10.3.6",
|
|
63
|
+
"@storybook/react-vite": "10.3.6",
|
|
64
64
|
"@testing-library/dom": "^10.4.1",
|
|
65
65
|
"@testing-library/react": "^16.3.2",
|
|
66
66
|
"@testing-library/user-event": "^14.6.1",
|
|
67
67
|
"@types/lodash-es": "^4.17.12",
|
|
68
|
-
"@types/node": "^
|
|
68
|
+
"@types/node": "^24.12.3",
|
|
69
69
|
"@types/react": "^18.3.28",
|
|
70
70
|
"@types/react-dom": "^18.3.7",
|
|
71
71
|
"@vitejs/plugin-react-swc": "^4.3.0",
|
|
@@ -73,19 +73,18 @@
|
|
|
73
73
|
"ag-grid-community": "34.2.0",
|
|
74
74
|
"ag-grid-react": "34.2.0",
|
|
75
75
|
"jsdom": "^27.3.0",
|
|
76
|
-
"oxfmt": "^0.
|
|
77
|
-
"oxlint": "^1.
|
|
76
|
+
"oxfmt": "^0.48.0",
|
|
77
|
+
"oxlint": "^1.63.0",
|
|
78
78
|
"react": "^18.3.1",
|
|
79
79
|
"react-dom": "18.3.1",
|
|
80
|
-
"rollup": "^4.60.
|
|
80
|
+
"rollup": "^4.60.3",
|
|
81
81
|
"rollup-plugin-copy": "^3.5.0",
|
|
82
82
|
"sass": "^1.99.0",
|
|
83
|
-
"storybook": "
|
|
83
|
+
"storybook": "10.3.6",
|
|
84
84
|
"stylelint": "^16.26.1",
|
|
85
85
|
"stylelint-config-recommended": "^17.0.0",
|
|
86
86
|
"stylelint-config-recommended-scss": "^16.0.2",
|
|
87
87
|
"stylelint-config-standard": "^39.0.1",
|
|
88
|
-
"stylelint-prettier": "5.0.3",
|
|
89
88
|
"stylelint-scss": "6.14.0",
|
|
90
89
|
"typescript": "^5.9.3",
|
|
91
90
|
"vite": "^7.3.2",
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import '../index.scss';
|
|
2
|
-
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { PropsWithChildren, ReactElement, 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 = ({
|
|
17
|
-
alignment,
|
|
18
|
-
sliderClassName,
|
|
19
|
-
autoClose = false,
|
|
20
|
-
children,
|
|
21
|
-
onClick,
|
|
22
|
-
...buttonProps
|
|
23
|
-
}: PropsWithChildren<RibbonSliderProps>): ReactElement => {
|
|
24
|
-
const [uniqueId] = useState(v4());
|
|
25
|
-
const [menuUniqueId] = useState(`toolbarSliderMenu-${v4()}`);
|
|
26
|
-
const [positionAnchor] = useState(`--toolbarSliderAnchor-${uniqueId}`);
|
|
27
|
-
|
|
28
|
-
const defaultOnClick = () => setTimeout(focusNextRibbonButton, 0);
|
|
29
|
-
|
|
30
|
-
const alignments = ribbonSliderAlignments[alignment];
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<RibbonButtonSliderContext.Provider value={{ autoClose, positionAnchor, menuUniqueId }}>
|
|
34
|
-
<RibbonButton
|
|
35
|
-
popoverTarget={menuUniqueId}
|
|
36
|
-
popoverTargetAction={'toggle'}
|
|
37
|
-
anchorName={positionAnchor}
|
|
38
|
-
{...buttonProps}
|
|
39
|
-
onClick={onClick ?? defaultOnClick}
|
|
40
|
-
/>
|
|
41
|
-
<nav
|
|
42
|
-
id={menuUniqueId}
|
|
43
|
-
{...{ ['popover' as never]: 'auto' }}
|
|
44
|
-
role="menu"
|
|
45
|
-
aria-label="Menu"
|
|
46
|
-
className={clsx(`RibbonSliderMenu RibbonSliderMenu-${alignment}`, sliderClassName)}
|
|
47
|
-
style={{
|
|
48
|
-
positionAnchor,
|
|
49
|
-
[alignments[0]]: `anchor(${positionAnchor} ${alignments[1]})`,
|
|
50
|
-
[alignments[2]]: `anchor(${positionAnchor} ${alignments[2]})`,
|
|
51
|
-
...(alignments[3] && { transform: `translate(${alignments[3]})` }),
|
|
52
|
-
}}
|
|
53
|
-
>
|
|
54
|
-
{children}
|
|
55
|
-
</nav>
|
|
56
|
-
</RibbonButtonSliderContext.Provider>
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const focusNextRibbonButton = () => {
|
|
61
|
-
let button =
|
|
62
|
-
document.activeElement?.nextElementSibling?.querySelectorAll<HTMLButtonElement>('button.RibbonButton-selected')[0];
|
|
63
|
-
if (!button) {
|
|
64
|
-
button = document.activeElement?.nextElementSibling?.querySelectorAll('button')[0];
|
|
65
|
-
}
|
|
66
|
-
button?.focus();
|
|
67
|
-
};
|