@linzjs/windows 10.1.2 → 10.3.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.
@@ -150,3 +150,11 @@ dialog.LuiModalPrefab-file {
150
150
  padding-bottom: spacing.$unit-xs;
151
151
  }
152
152
  }
153
+
154
+ button.lui-button.lui-button-secondary.lui-button-secondary-error {
155
+ color: colors.$error;
156
+
157
+ span.LuiIcon svg * {
158
+ fill: colors.$error;
159
+ }
160
+ }
@@ -18,7 +18,7 @@ export type PrefabType = 'outline' | 'success' | 'info' | 'warning' | 'error' |
18
18
 
19
19
  export interface LuiModalAsyncPrefabButton<RT> {
20
20
  default?: boolean;
21
- level?: LuiButtonProps['level'];
21
+ level?: LuiButtonProps['level'] | 'secondary-error';
22
22
  title: string;
23
23
  icon?: IconName;
24
24
  value?: RT;
@@ -149,8 +149,11 @@ export const LuiModalPrefab = (props: PropsWithChildren<LuiModalAsyncPrefabProps
149
149
  {buttons.map((pf, i) => (
150
150
  <LuiButton
151
151
  key={i}
152
- level={pf.level ?? 'secondary'}
153
- className={clsx(pf.icon && 'lui-button-icon')}
152
+ level={pf.level === 'secondary-error' ? 'secondary' : (pf.level ?? 'secondary')}
153
+ className={clsx(
154
+ pf.icon && 'lui-button-icon',
155
+ pf.level === 'secondary-error' && 'lui-button-secondary-error',
156
+ )}
154
157
  onClick={() => {
155
158
  setDontShow();
156
159
  resolve(pf.value);
@@ -189,7 +192,7 @@ export const useLuiModalPrefab = () => {
189
192
  const { showModal, modalOwnerRef } = useShowAsyncModal();
190
193
 
191
194
  const showPrefabModal = useCallback(
192
- <RT = string>(props: PropsWithChildren<useLuiModalPrefabProps<RT>>): PromiseWithResolve<RT> => {
195
+ <RT = string,>(props: PropsWithChildren<useLuiModalPrefabProps<RT>>): PromiseWithResolve<RT> => {
193
196
  debugLog(`Show '${props.level}' prefab-modal '${props.title}'`, props);
194
197
  if (typeof props.children === 'string') {
195
198
  // Convert \n to <br/>
@@ -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 = ({ title, className, width, height, children }: PropsWithChildren<PanelInlineProps>) => {
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
- style,
14
- className,
15
- children,
16
- }: PropsWithChildren<RibbonContainerProps>) => (
17
- <div style={style} className={className}>
18
- <div className={`RibbonButton-${orientation}Group`}>{children}</div>
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
  );
@@ -8,4 +8,4 @@ export * from './RibbonMenu';
8
8
  export * from './RibbonMenuOption';
9
9
  export * from './RibbonMenuSeparator';
10
10
  export * from './RibbonSeparator';
11
- export * from './RibbonSliderButton';
11
+ export * from './RibbonButtonSlider';
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "popout"
14
14
  ],
15
15
  "main": "./dist/index.ts",
16
- "version": "10.1.2",
16
+ "version": "10.3.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": ">=22"
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": "^4.1.3",
57
- "@linzjs/lui": "^24.13.0",
58
- "@linzjs/step-ag-grid": "^31.2.1",
59
- "@rollup/plugin-commonjs": "^28.0.9",
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": "9.1.20",
62
- "@storybook/addon-links": "9.1.20",
63
- "@storybook/react-vite": "9.1.20",
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": "^22.19.2",
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.47.0",
77
- "oxlint": "^1.62.0",
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.2",
80
+ "rollup": "^4.60.3",
81
81
  "rollup-plugin-copy": "^3.5.0",
82
82
  "sass": "^1.99.0",
83
- "storybook": "9.1.20",
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
- };