@itwin/itwinui-react 3.17.0 → 3.17.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.17.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2436](https://github.com/iTwin/iTwinUI/pull/2436): The **theme bridge** has been updated to handle the breaking changes introduced in `@itwin/itwinui-react@5.0.0-alpha.6`.
8
+ - [#2430](https://github.com/iTwin/iTwinUI/pull/2430): Fixed bug in `SplitButton` where the `dropdownMenuProps.middleware` prop was not respected.
9
+ - [#2430](https://github.com/iTwin/iTwinUI/pull/2430): Fixed a `SplitButton` bug where `dropdownMenuProps` was accidentally being added to the DOM.
10
+ - [#2430](https://github.com/iTwin/iTwinUI/pull/2430): Added missing `div` props in `dropdownMenuProps`'s type for `DropdownButton` and `SplitButton`.
11
+
3
12
  ## 3.17.0
4
13
 
5
14
  ### Minor Changes
@@ -29,9 +29,11 @@ const SplitButton = _react.forwardRef((props, forwardedRef) => {
29
29
  children,
30
30
  wrapperProps,
31
31
  menuButtonProps,
32
+ dropdownMenuProps,
32
33
  portal = true,
33
34
  ...rest
34
35
  } = props;
36
+ let { middleware, ...dropdownMenuPropsRest } = dropdownMenuProps || {};
35
37
  let [visible, setVisible] = _react.useState(false);
36
38
  let menuContent = _react.useMemo(() => {
37
39
  if ('function' == typeof menuItems)
@@ -43,6 +45,7 @@ const SplitButton = _react.forwardRef((props, forwardedRef) => {
43
45
  onVisibleChange: setVisible,
44
46
  placement: menuPlacement,
45
47
  matchWidth: true,
48
+ middleware,
46
49
  };
47
50
  let labelId = (0, _index.useId)();
48
51
  let trigger = _react.createElement(
@@ -96,9 +99,13 @@ const SplitButton = _react.forwardRef((props, forwardedRef) => {
96
99
  trigger: trigger,
97
100
  portal: portal,
98
101
  positionReference: positionReference,
99
- onKeyDown: ({ key }) => {
100
- if ('Tab' === key) setVisible(false);
101
- },
102
+ ...dropdownMenuPropsRest,
103
+ onKeyDown: (0, _index.mergeEventHandlers)(
104
+ dropdownMenuPropsRest?.onKeyDown,
105
+ ({ key }) => {
106
+ if ('Tab' === key) setVisible(false);
107
+ },
108
+ ),
102
109
  },
103
110
  menuContent,
104
111
  ),
package/DEV-cjs/styles.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const e = '3.17.0';
3
+ const e = '3.17.1';
4
4
  const u = new Proxy(
5
5
  {},
6
6
  {
@@ -4,6 +4,7 @@ import { Button } from './Button.js';
4
4
  import { IconButton } from './IconButton.js';
5
5
  import {
6
6
  Box,
7
+ mergeEventHandlers,
7
8
  SvgCaretDownSmall,
8
9
  SvgCaretUpSmall,
9
10
  useId,
@@ -20,9 +21,11 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
20
21
  children,
21
22
  wrapperProps,
22
23
  menuButtonProps,
24
+ dropdownMenuProps,
23
25
  portal = true,
24
26
  ...rest
25
27
  } = props;
28
+ let { middleware, ...dropdownMenuPropsRest } = dropdownMenuProps || {};
26
29
  let [visible, setVisible] = React.useState(false);
27
30
  let menuContent = React.useMemo(() => {
28
31
  if ('function' == typeof menuItems)
@@ -34,6 +37,7 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
34
37
  onVisibleChange: setVisible,
35
38
  placement: menuPlacement,
36
39
  matchWidth: true,
40
+ middleware,
37
41
  };
38
42
  let labelId = useId();
39
43
  let trigger = React.createElement(
@@ -87,9 +91,13 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
87
91
  trigger: trigger,
88
92
  portal: portal,
89
93
  positionReference: positionReference,
90
- onKeyDown: ({ key }) => {
91
- if ('Tab' === key) setVisible(false);
92
- },
94
+ ...dropdownMenuPropsRest,
95
+ onKeyDown: mergeEventHandlers(
96
+ dropdownMenuPropsRest?.onKeyDown,
97
+ ({ key }) => {
98
+ if ('Tab' === key) setVisible(false);
99
+ },
100
+ ),
93
101
  },
94
102
  menuContent,
95
103
  ),
package/DEV-esm/styles.js CHANGED
@@ -1,4 +1,4 @@
1
- const t = '3.17.0';
1
+ const t = '3.17.1';
2
2
  const u = new Proxy(
3
3
  {},
4
4
  {
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import type { ButtonProps } from './Button.js';
3
- import type { DropdownMenuProps } from '../DropdownMenu/DropdownMenu.js';
3
+ import { DropdownMenu } from '../DropdownMenu/DropdownMenu.js';
4
4
  import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
5
5
  export type DropdownButtonProps = {
6
6
  /**
@@ -16,9 +16,9 @@ export type DropdownButtonProps = {
16
16
  */
17
17
  styleType?: 'default' | 'borderless' | 'high-visibility';
18
18
  /**
19
- * Props for the `DropdownMenu` which extends `PopoverProps`.
19
+ * Props for the `DropdownMenu` which extends the props of `Popover`.
20
20
  */
21
- dropdownMenuProps?: Omit<DropdownMenuProps, 'menuItems' | 'children'>;
21
+ dropdownMenuProps?: Omit<React.ComponentProps<typeof DropdownMenu>, 'menuItems' | 'children'>;
22
22
  } & Omit<ButtonProps, 'styleType' | 'endIcon'>;
23
23
  /**
24
24
  * Button that opens a DropdownMenu.
@@ -31,7 +31,7 @@ export type SplitButtonProps = ButtonProps & {
31
31
  /**
32
32
  * Props to customize menu behavior.
33
33
  */
34
- dropdownMenuProps?: Pick<Parameters<typeof usePopover>[0], 'middleware'>;
34
+ dropdownMenuProps?: Pick<Parameters<typeof usePopover>[0], 'middleware'> & React.ComponentProps<'div'>;
35
35
  } & Pick<PortalProps, 'portal'>;
36
36
  /**
37
37
  * Split button component with a DropdownMenu.
@@ -29,9 +29,11 @@ const SplitButton = _react.forwardRef((props, forwardedRef) => {
29
29
  children,
30
30
  wrapperProps,
31
31
  menuButtonProps,
32
+ dropdownMenuProps,
32
33
  portal = true,
33
34
  ...rest
34
35
  } = props;
36
+ let { middleware, ...dropdownMenuPropsRest } = dropdownMenuProps || {};
35
37
  let [visible, setVisible] = _react.useState(false);
36
38
  let menuContent = _react.useMemo(() => {
37
39
  if ('function' == typeof menuItems)
@@ -43,6 +45,7 @@ const SplitButton = _react.forwardRef((props, forwardedRef) => {
43
45
  onVisibleChange: setVisible,
44
46
  placement: menuPlacement,
45
47
  matchWidth: true,
48
+ middleware,
46
49
  };
47
50
  let labelId = (0, _index.useId)();
48
51
  let trigger = _react.createElement(
@@ -96,9 +99,13 @@ const SplitButton = _react.forwardRef((props, forwardedRef) => {
96
99
  trigger: trigger,
97
100
  portal: portal,
98
101
  positionReference: positionReference,
99
- onKeyDown: ({ key }) => {
100
- if ('Tab' === key) setVisible(false);
101
- },
102
+ ...dropdownMenuPropsRest,
103
+ onKeyDown: (0, _index.mergeEventHandlers)(
104
+ dropdownMenuPropsRest?.onKeyDown,
105
+ ({ key }) => {
106
+ if ('Tab' === key) setVisible(false);
107
+ },
108
+ ),
102
109
  },
103
110
  menuContent,
104
111
  ),
package/cjs/styles.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const e = '3.17.0';
3
+ const e = '3.17.1';
4
4
  const u = new Proxy(
5
5
  {},
6
6
  {
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import type { ButtonProps } from './Button.js';
3
- import type { DropdownMenuProps } from '../DropdownMenu/DropdownMenu.js';
3
+ import { DropdownMenu } from '../DropdownMenu/DropdownMenu.js';
4
4
  import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
5
5
  export type DropdownButtonProps = {
6
6
  /**
@@ -16,9 +16,9 @@ export type DropdownButtonProps = {
16
16
  */
17
17
  styleType?: 'default' | 'borderless' | 'high-visibility';
18
18
  /**
19
- * Props for the `DropdownMenu` which extends `PopoverProps`.
19
+ * Props for the `DropdownMenu` which extends the props of `Popover`.
20
20
  */
21
- dropdownMenuProps?: Omit<DropdownMenuProps, 'menuItems' | 'children'>;
21
+ dropdownMenuProps?: Omit<React.ComponentProps<typeof DropdownMenu>, 'menuItems' | 'children'>;
22
22
  } & Omit<ButtonProps, 'styleType' | 'endIcon'>;
23
23
  /**
24
24
  * Button that opens a DropdownMenu.
@@ -31,7 +31,7 @@ export type SplitButtonProps = ButtonProps & {
31
31
  /**
32
32
  * Props to customize menu behavior.
33
33
  */
34
- dropdownMenuProps?: Pick<Parameters<typeof usePopover>[0], 'middleware'>;
34
+ dropdownMenuProps?: Pick<Parameters<typeof usePopover>[0], 'middleware'> & React.ComponentProps<'div'>;
35
35
  } & Pick<PortalProps, 'portal'>;
36
36
  /**
37
37
  * Split button component with a DropdownMenu.
@@ -4,6 +4,7 @@ import { Button } from './Button.js';
4
4
  import { IconButton } from './IconButton.js';
5
5
  import {
6
6
  Box,
7
+ mergeEventHandlers,
7
8
  SvgCaretDownSmall,
8
9
  SvgCaretUpSmall,
9
10
  useId,
@@ -20,9 +21,11 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
20
21
  children,
21
22
  wrapperProps,
22
23
  menuButtonProps,
24
+ dropdownMenuProps,
23
25
  portal = true,
24
26
  ...rest
25
27
  } = props;
28
+ let { middleware, ...dropdownMenuPropsRest } = dropdownMenuProps || {};
26
29
  let [visible, setVisible] = React.useState(false);
27
30
  let menuContent = React.useMemo(() => {
28
31
  if ('function' == typeof menuItems)
@@ -34,6 +37,7 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
34
37
  onVisibleChange: setVisible,
35
38
  placement: menuPlacement,
36
39
  matchWidth: true,
40
+ middleware,
37
41
  };
38
42
  let labelId = useId();
39
43
  let trigger = React.createElement(
@@ -87,9 +91,13 @@ export const SplitButton = React.forwardRef((props, forwardedRef) => {
87
91
  trigger: trigger,
88
92
  portal: portal,
89
93
  positionReference: positionReference,
90
- onKeyDown: ({ key }) => {
91
- if ('Tab' === key) setVisible(false);
92
- },
94
+ ...dropdownMenuPropsRest,
95
+ onKeyDown: mergeEventHandlers(
96
+ dropdownMenuPropsRest?.onKeyDown,
97
+ ({ key }) => {
98
+ if ('Tab' === key) setVisible(false);
99
+ },
100
+ ),
93
101
  },
94
102
  menuContent,
95
103
  ),
package/esm/styles.js CHANGED
@@ -1,4 +1,4 @@
1
- const t = '3.17.0';
1
+ const t = '3.17.1';
2
2
  const u = new Proxy(
3
3
  {},
4
4
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/itwinui-react",
3
- "version": "3.17.0",
3
+ "version": "3.17.1",
4
4
  "author": "Bentley Systems",
5
5
  "license": "MIT",
6
6
  "type": "module",