@itwin/itwinui-react 3.10.1 → 3.11.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/cjs/core/Alert/Alert.d.ts +1 -1
  3. package/cjs/core/Breadcrumbs/Breadcrumbs.js +13 -3
  4. package/cjs/core/Buttons/Button.d.ts +4 -0
  5. package/cjs/core/Buttons/Button.js +6 -4
  6. package/cjs/core/Carousel/Carousel.d.ts +2 -2
  7. package/cjs/core/Carousel/CarouselNavigation.d.ts +2 -2
  8. package/cjs/core/ComboBox/ComboBox.js +2 -2
  9. package/cjs/core/ComboBox/ComboBoxInput.js +2 -4
  10. package/cjs/core/ComboBox/ComboBoxMenu.js +7 -3
  11. package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +1 -1
  12. package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +1 -1
  13. package/cjs/core/LabeledSelect/LabeledSelect.d.ts +9 -9
  14. package/cjs/core/Select/Select.js +28 -2
  15. package/cjs/core/Surface/Surface.js +2 -2
  16. package/cjs/core/Table/Table.js +4 -7
  17. package/cjs/core/Table/cells/EditableCell.js +6 -2
  18. package/cjs/core/Tabs/Tabs.d.ts +1 -1
  19. package/cjs/core/Tile/Tile.d.ts +17 -1
  20. package/cjs/core/Tooltip/Tooltip.js +28 -6
  21. package/cjs/core/Tree/TreeNode.d.ts +39 -0
  22. package/cjs/core/Tree/TreeNode.js +11 -11
  23. package/cjs/core/Tree/TreeNodeExpander.d.ts +2 -0
  24. package/cjs/core/Tree/TreeNodeExpander.js +2 -2
  25. package/esm/core/Alert/Alert.d.ts +1 -1
  26. package/esm/core/Breadcrumbs/Breadcrumbs.js +13 -3
  27. package/esm/core/Buttons/Button.d.ts +4 -0
  28. package/esm/core/Buttons/Button.js +6 -4
  29. package/esm/core/Carousel/Carousel.d.ts +2 -2
  30. package/esm/core/Carousel/CarouselNavigation.d.ts +2 -2
  31. package/esm/core/ComboBox/ComboBox.js +2 -2
  32. package/esm/core/ComboBox/ComboBoxInput.js +3 -5
  33. package/esm/core/ComboBox/ComboBoxMenu.js +4 -2
  34. package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +1 -1
  35. package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +1 -1
  36. package/esm/core/LabeledSelect/LabeledSelect.d.ts +9 -9
  37. package/esm/core/Select/Select.js +28 -2
  38. package/esm/core/Surface/Surface.js +2 -2
  39. package/esm/core/Table/Table.js +5 -8
  40. package/esm/core/Table/cells/EditableCell.js +3 -2
  41. package/esm/core/Tabs/Tabs.d.ts +1 -1
  42. package/esm/core/Tile/Tile.d.ts +17 -1
  43. package/esm/core/Tooltip/Tooltip.js +28 -6
  44. package/esm/core/Tree/TreeNode.d.ts +39 -0
  45. package/esm/core/Tree/TreeNode.js +11 -11
  46. package/esm/core/Tree/TreeNodeExpander.d.ts +2 -0
  47. package/esm/core/Tree/TreeNodeExpander.js +2 -2
  48. package/package.json +7 -1
  49. package/styles.css +21 -21
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.11.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2074](https://github.com/iTwin/iTwinUI/pull/2074): Fixed indentation of `Tree` nodes to be aligned regardless of the presence of expander button.
8
+ - [#2064](https://github.com/iTwin/iTwinUI/pull/2064): Adjusted `Dialog` and `ExpandableBlock` to round some CSS `transform` values. This helps avoid blurry text on Windows in some cases.
9
+ - [#2055](https://github.com/iTwin/iTwinUI/pull/2055): Fixed an issue in `Breadcrumbs.Item` where using a custom link component (e.g. `as={Link}` for client side routing) would break the CSS styling.
10
+ - [#2071](https://github.com/iTwin/iTwinUI/pull/2071): Fixed a minor issue in `ComboBox` where a `label` attribute was accidentally being added to options in the DOM.
11
+ - [#2068](https://github.com/iTwin/iTwinUI/pull/2068): Fixed `EditableCell` so that it correctly merges `className` and `style` props with the corresponding internal props.
12
+ - [#2073](https://github.com/iTwin/iTwinUI/pull/2073): Fixed CommonJS types exports for the `/react-table` entrypoint.
13
+ - [#2055](https://github.com/iTwin/iTwinUI/pull/2055): Fixed a regression from `v3.10.0` where non-button and non-link `Breadcrumbs.Item`s were getting a hover styling as if it were a button.
14
+
15
+ ## 3.11.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#2058](https://github.com/iTwin/iTwinUI/pull/2058): Added new `loading` prop to `Button`. This is useful when you want to display a brief loading state after the user clicks the button.
20
+
21
+ ```jsx
22
+ <Button loading={isProcessing}>Click me</Button>
23
+ ```
24
+
25
+ - [#2057](https://github.com/iTwin/iTwinUI/pull/2057): Updated warning and negative background colors to better match the rest of the color palette.
26
+ - [#2060](https://github.com/iTwin/iTwinUI/pull/2060): Updated `Tooltip` to automatically use the [`popover` API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) in supported browsers. This ensures that tooltips appear in the top layer, avoiding stacking context issues.
27
+ - [#2022](https://github.com/iTwin/iTwinUI/pull/2022): Added optional props to `TreeNode` for customization: `nodeProps`, `contentProps`, `labelProps`, `titleProps`, `sublabelProps`, `checkboxProps`, `iconProps`, `expanderProps` and `subTreeProps`.
28
+
29
+ ### Patch Changes
30
+
31
+ - [#2042](https://github.com/iTwin/iTwinUI/pull/2042): Fixed `Table` empty state horizontal alignment when table is very narrow.
32
+ - [#2054](https://github.com/iTwin/iTwinUI/pull/2054): Removed unnecessary gap below the inline `<InputGrid>` when no secondary line (`StatusMessage`) is present. Some other affected components: `LabeledInput`, `LabeledSelect`, `LabeledTextarea`.
33
+ - [#2049](https://github.com/iTwin/iTwinUI/pull/2049): Adjusted disabled controls' borders to slightly increase color contrast.
34
+ - [#2043](https://github.com/iTwin/iTwinUI/pull/2043): Adjusted the behavior of buttons so that double tapping them doesn't zoom the viewport on iOS.
35
+ - [#2044](https://github.com/iTwin/iTwinUI/pull/2044): Fixed a rare hydration error in `Surface` caused by using an empty string inside the `style` attribute.
36
+
3
37
  ## 3.10.1
4
38
 
5
39
  ### Patch Changes
@@ -60,7 +60,7 @@ export declare const Alert: PolymorphicForwardRefComponent<"div", AlertOwnProps
60
60
  * Type of the alert.
61
61
  * @default 'informational'
62
62
  */
63
- fill?: "default" | import("../../utils/types.js").AnyString | "informational" | "negative" | "positive" | "warning" | undefined;
63
+ fill?: "default" | "positive" | "negative" | "warning" | import("../../utils/types.js").AnyString | "informational" | undefined;
64
64
  padded?: boolean | undefined;
65
65
  } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
66
66
  as?: "span" | undefined;
@@ -102,9 +102,19 @@ const ListItem = ({ item, isActive, }) => {
102
102
  const Separator = ({ separator }) => (React.createElement(index_js_1.Box, { as: 'li', className: 'iui-breadcrumbs-separator', "aria-hidden": true }, separator ?? React.createElement(index_js_1.SvgChevronRight, null)));
103
103
  // ----------------------------------------------------------------------------
104
104
  const BreadcrumbsItem = React.forwardRef((props, forwardedRef) => {
105
- const { children, className, ...rest } = props;
106
- const defaultAs = !!props.href ? Anchor_js_1.Anchor : !!props.onClick ? 'button' : 'span';
107
- return (React.createElement(Button_js_1.Button, { as: defaultAs, className: (0, classnames_1.default)('iui-breadcrumbs-content', className), styleType: 'borderless', ref: forwardedRef, ...rest }, children));
105
+ const { as: asProp, ...rest } = props;
106
+ const commonProps = {
107
+ ...rest,
108
+ className: (0, classnames_1.default)('iui-breadcrumbs-content', props.className),
109
+ ref: forwardedRef,
110
+ };
111
+ if (String(asProp) === 'span' ||
112
+ (props.href == null && props.onClick == null && asProp == null)) {
113
+ return React.createElement(index_js_1.Box, { as: 'span', ...commonProps });
114
+ }
115
+ return (React.createElement(Button_js_1.Button, { as: (asProp === 'a' || (asProp == null && !!props.href)
116
+ ? Anchor_js_1.Anchor
117
+ : asProp), styleType: 'borderless', ...commonProps }));
108
118
  });
109
119
  BreadcrumbsItem.displayName = 'Breadcrumbs.Item';
110
120
  // ----------------------------------------------------------------------------
@@ -38,6 +38,10 @@ export type ButtonProps = {
38
38
  * This is useful on narrow containers and mobile views.
39
39
  */
40
40
  stretched?: boolean;
41
+ /**
42
+ * Specify a loading state for the button.
43
+ */
44
+ loading?: boolean;
41
45
  } & Pick<React.ComponentProps<typeof ButtonBase>, 'htmlDisabled'>;
42
46
  /**
43
47
  * Generic button component
@@ -34,6 +34,7 @@ exports.Button = void 0;
34
34
  const classnames_1 = __importDefault(require("classnames"));
35
35
  const React = __importStar(require("react"));
36
36
  const index_js_1 = require("../../utils/index.js");
37
+ const ProgressRadial_js_1 = require("../ProgressIndicators/ProgressRadial.js");
37
38
  /**
38
39
  * Generic button component
39
40
  * @example
@@ -44,12 +45,13 @@ const index_js_1 = require("../../utils/index.js");
44
45
  * <Button startIcon={<SvgAdd />}>New</Button>
45
46
  */
46
47
  exports.Button = React.forwardRef((props, ref) => {
47
- const { children, className, size, styleType = 'default', startIcon, endIcon, labelProps, startIconProps, endIconProps, stretched, ...rest } = props;
48
- return (React.createElement(index_js_1.ButtonBase, { ref: ref, className: (0, classnames_1.default)('iui-button', 'iui-field', className), "data-iui-variant": styleType !== 'default' ? styleType : undefined, "data-iui-size": size, ...rest, style: {
48
+ const { children, className, size, styleType = 'default', startIcon, endIcon, labelProps, startIconProps, endIconProps, stretched, loading: loading, disabled: disabledProp, ...rest } = props;
49
+ return (React.createElement(index_js_1.ButtonBase, { ref: ref, className: (0, classnames_1.default)('iui-button', 'iui-field', className), "data-iui-variant": styleType !== 'default' ? styleType : undefined, "data-iui-size": size, "data-iui-loading": loading ? 'true' : undefined, disabled: disabledProp || loading, ...rest, style: {
49
50
  '--_iui-width': stretched ? '100%' : undefined,
50
51
  ...props.style,
51
52
  } },
52
53
  startIcon && (React.createElement(index_js_1.Box, { as: 'span', "aria-hidden": true, ...startIconProps, className: (0, classnames_1.default)('iui-button-icon', startIconProps?.className) }, startIcon)),
53
- children && React.createElement("span", { ...labelProps }, children),
54
- endIcon && (React.createElement(index_js_1.Box, { as: 'span', "aria-hidden": true, ...endIconProps, className: (0, classnames_1.default)('iui-button-icon', endIconProps?.className) }, endIcon))));
54
+ children && (React.createElement(index_js_1.Box, { as: 'span', ...labelProps, className: (0, classnames_1.default)('iui-button-label', labelProps?.className) }, children)),
55
+ endIcon && (React.createElement(index_js_1.Box, { as: 'span', "aria-hidden": true, ...endIconProps, className: (0, classnames_1.default)('iui-button-icon', endIconProps?.className) }, endIcon)),
56
+ loading && (React.createElement(ProgressRadial_js_1.ProgressRadial, { size: size === 'small' ? 'x-small' : 'small', className: 'iui-button-spinner', "aria-hidden": true }))));
55
57
  });
@@ -42,7 +42,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
42
42
  Navigation: PolymorphicForwardRefComponent<"div", {}> & {
43
43
  PreviousButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
44
44
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
45
- }, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
45
+ }, "label" | "as" | "loading" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
46
46
  isActive?: boolean | undefined;
47
47
  label?: React.ReactNode;
48
48
  labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
@@ -105,7 +105,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
105
105
  }>;
106
106
  NextButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
107
107
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
108
- }, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
108
+ }, "label" | "as" | "loading" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
109
109
  isActive?: boolean | undefined;
110
110
  label?: React.ReactNode;
111
111
  labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
@@ -9,7 +9,7 @@ import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
9
9
  export declare const CarouselNavigation: PolymorphicForwardRefComponent<"div", {}> & {
10
10
  PreviousButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
11
11
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
12
- }, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
12
+ }, "label" | "as" | "loading" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
13
13
  isActive?: boolean | undefined;
14
14
  label?: React.ReactNode;
15
15
  labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
@@ -72,7 +72,7 @@ export declare const CarouselNavigation: PolymorphicForwardRefComponent<"div", {
72
72
  }>;
73
73
  NextButton: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
74
74
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
75
- }, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
75
+ }, "label" | "as" | "loading" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
76
76
  isActive?: boolean | undefined;
77
77
  label?: React.ReactNode;
78
78
  labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
@@ -264,7 +264,7 @@ exports.ComboBox = React.forwardRef((props, forwardedRef) => {
264
264
  const getMenuItem = React.useCallback((option, filteredIndex) => {
265
265
  const optionId = getOptionId(option, id);
266
266
  const { __originalIndex } = optionsExtraInfoRef.current[optionId];
267
- const { icon, startIcon: startIconProp, ...restOptions } = option;
267
+ const { icon, startIcon: startIconProp, label, ...restOptions } = option;
268
268
  const startIcon = startIconProp ?? icon;
269
269
  const customItem = itemRenderer
270
270
  ? itemRenderer(option, {
@@ -291,7 +291,7 @@ exports.ComboBox = React.forwardRef((props, forwardedRef) => {
291
291
  }),
292
292
  })) : (React.createElement(ComboBoxMenuItem_js_1.ComboBoxMenuItem, { key: optionId, id: optionId, startIcon: startIcon, ...restOptions, isSelected: isMenuItemSelected(__originalIndex), onClick: () => {
293
293
  onClickHandler(__originalIndex);
294
- }, index: __originalIndex, "data-iui-filtered-index": filteredIndex }, option.label));
294
+ }, index: __originalIndex, "data-iui-filtered-index": filteredIndex }, label));
295
295
  }, [
296
296
  enableVirtualization,
297
297
  focusedIndex,
@@ -39,10 +39,7 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
39
39
  const dispatch = (0, index_js_1.useSafeContext)(helpers_js_1.ComboBoxActionContext);
40
40
  const { inputRef, menuRef, optionsExtraInfoRef } = (0, index_js_1.useSafeContext)(helpers_js_1.ComboBoxRefsContext);
41
41
  const refs = (0, index_js_1.useMergedRefs)(inputRef, popover.refs.setReference, forwardedRef);
42
- const focusedIndexRef = React.useRef(focusedIndex ?? -1);
43
- React.useEffect(() => {
44
- focusedIndexRef.current = focusedIndex ?? -1;
45
- }, [focusedIndex]);
42
+ const focusedIndexRef = (0, index_js_1.useLatestRef)(focusedIndex ?? -1);
46
43
  const getIdFromIndex = (index) => {
47
44
  return (menuRef.current?.querySelector(`[data-iui-index="${index}"]`)?.id ?? '');
48
45
  };
@@ -140,6 +137,7 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
140
137
  }, [
141
138
  dispatch,
142
139
  enableVirtualization,
140
+ focusedIndexRef,
143
141
  isOpen,
144
142
  menuRef,
145
143
  onClickHandler,
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.ComboBoxMenu = void 0;
27
30
  /*---------------------------------------------------------------------------------------------
@@ -29,9 +32,10 @@ exports.ComboBoxMenu = void 0;
29
32
  * See LICENSE.md in the project root for license terms and full copyright notice.
30
33
  *--------------------------------------------------------------------------------------------*/
31
34
  const React = __importStar(require("react"));
32
- const Menu_js_1 = require("../Menu/Menu.js");
35
+ const classnames_1 = __importDefault(require("classnames"));
33
36
  const index_js_1 = require("../../utils/index.js");
34
37
  const helpers_js_1 = require("./helpers.js");
38
+ const List_js_1 = require("../List/List.js");
35
39
  const VirtualizedComboBoxMenu = (props) => {
36
40
  const { children, ...rest } = props;
37
41
  const { filteredOptions, getMenuItem, focusedIndex } = (0, index_js_1.useSafeContext)(helpers_js_1.ComboBoxStateContext);
@@ -58,12 +62,12 @@ const VirtualizedComboBoxMenu = (props) => {
58
62
  React.createElement("div", { ...innerProps, ref: innerProps.ref }, visibleChildren)));
59
63
  };
60
64
  exports.ComboBoxMenu = React.forwardRef((props, forwardedRef) => {
61
- const { children, style, ...rest } = props;
65
+ const { className, children, style, ...rest } = props;
62
66
  const { id, enableVirtualization, popover } = (0, index_js_1.useSafeContext)(helpers_js_1.ComboBoxStateContext);
63
67
  const { menuRef } = (0, index_js_1.useSafeContext)(helpers_js_1.ComboBoxRefsContext);
64
68
  const refs = (0, index_js_1.useMergedRefs)(popover.refs.setFloating, forwardedRef, menuRef);
65
69
  return (popover.open && (React.createElement(index_js_1.Portal, { portal: true },
66
- React.createElement(Menu_js_1.Menu, { id: `${id}-list`, setFocus: false, role: 'listbox', ref: refs, ...popover.getFloatingProps({
70
+ React.createElement(List_js_1.List, { as: 'div', className: (0, classnames_1.default)('iui-menu', className), id: `${id}-list`, role: 'listbox', ref: refs, ...popover.getFloatingProps({
67
71
  style: !enableVirtualization
68
72
  ? style
69
73
  : {
@@ -107,7 +107,7 @@ export declare const ExpandableBlock: PolymorphicForwardRefComponent<"div", Expa
107
107
  ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
108
108
  }, "fill" | "as" | "key" | "size" | keyof React.HTMLAttributes<HTMLSpanElement> | "padded"> & {
109
109
  size?: "small" | "auto" | "medium" | "large" | import("../../utils/types.js").AnyString | undefined;
110
- fill?: "default" | import("../../utils/types.js").AnyString | "informational" | "negative" | "positive" | "warning" | undefined;
110
+ fill?: "default" | "positive" | "negative" | "warning" | import("../../utils/types.js").AnyString | "informational" | undefined;
111
111
  padded?: boolean | undefined;
112
112
  } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
113
113
  as?: "span" | undefined;
@@ -32,7 +32,7 @@ export declare const InputWithDecorations: PolymorphicForwardRefComponent<"div",
32
32
  */
33
33
  Button: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
34
34
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
35
- }, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & Omit<import("../Buttons/IconButton.js").IconButtonProps, "styleType"> & {
35
+ }, "label" | "as" | "loading" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & Omit<import("../Buttons/IconButton.js").IconButtonProps, "styleType"> & {
36
36
  styleType?: "default" | "cta" | "high-visibility" | "borderless" | undefined;
37
37
  } & {
38
38
  as?: "button" | undefined;
@@ -131,7 +131,7 @@ export declare const LabeledSelect: <T>(props: ({
131
131
  * Status of the select.
132
132
  * @default ''
133
133
  */
134
- status?: "negative" | "positive" | "warning" | undefined;
134
+ status?: "positive" | "negative" | "warning" | undefined;
135
135
  /**
136
136
  * @deprecated Pass a `<StatusMessage startIcon={svgIcon} />` to the `message` prop instead.
137
137
  *
@@ -173,7 +173,7 @@ export declare const LabeledSelect: <T>(props: ({
173
173
  ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
174
174
  }, "fill" | "as" | "key" | "size" | keyof React.HTMLAttributes<HTMLSpanElement> | "padded"> & {
175
175
  size?: "small" | "auto" | "medium" | "large" | import("../../utils/types.js").AnyString | undefined;
176
- fill?: "default" | import("../../utils/types.js").AnyString | "informational" | "negative" | "positive" | "warning" | undefined;
176
+ fill?: "default" | "positive" | "negative" | "warning" | import("../../utils/types.js").AnyString | "informational" | undefined;
177
177
  padded?: boolean | undefined;
178
178
  } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
179
179
  as?: "span" | undefined;
@@ -183,7 +183,7 @@ export declare const LabeledSelect: <T>(props: ({
183
183
  } & {
184
184
  disabled?: boolean | undefined;
185
185
  size?: "small" | "large" | undefined;
186
- status?: "negative" | "positive" | "warning" | undefined;
186
+ status?: "positive" | "negative" | "warning" | undefined;
187
187
  } & {
188
188
  value?: string | null | undefined;
189
189
  onChange?: ((value: string, event: React.ChangeEvent<HTMLSelectElement>) => void) | undefined;
@@ -237,7 +237,7 @@ export declare const LabeledSelect: <T>(props: ({
237
237
  * Status of the select.
238
238
  * @default ''
239
239
  */
240
- status?: "negative" | "positive" | "warning" | undefined;
240
+ status?: "positive" | "negative" | "warning" | undefined;
241
241
  /**
242
242
  * @deprecated Pass a `<StatusMessage startIcon={svgIcon} />` to the `message` prop instead.
243
243
  *
@@ -279,7 +279,7 @@ export declare const LabeledSelect: <T>(props: ({
279
279
  ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
280
280
  }, "fill" | "as" | "key" | "size" | keyof React.HTMLAttributes<HTMLSpanElement> | "padded"> & {
281
281
  size?: "small" | "auto" | "medium" | "large" | import("../../utils/types.js").AnyString | undefined;
282
- fill?: "default" | import("../../utils/types.js").AnyString | "informational" | "negative" | "positive" | "warning" | undefined;
282
+ fill?: "default" | "positive" | "negative" | "warning" | import("../../utils/types.js").AnyString | "informational" | undefined;
283
283
  padded?: boolean | undefined;
284
284
  } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
285
285
  as?: "span" | undefined;
@@ -289,7 +289,7 @@ export declare const LabeledSelect: <T>(props: ({
289
289
  } & {
290
290
  disabled?: boolean | undefined;
291
291
  size?: "small" | "large" | undefined;
292
- status?: "negative" | "positive" | "warning" | undefined;
292
+ status?: "positive" | "negative" | "warning" | undefined;
293
293
  } & {
294
294
  placeholder?: React.ReactNode;
295
295
  options: import("../Select/Select.js").SelectOption<T>[];
@@ -378,7 +378,7 @@ export declare const LabeledSelect: <T>(props: ({
378
378
  * Status of the select.
379
379
  * @default ''
380
380
  */
381
- status?: "negative" | "positive" | "warning" | undefined;
381
+ status?: "positive" | "negative" | "warning" | undefined;
382
382
  /**
383
383
  * @deprecated Pass a `<StatusMessage startIcon={svgIcon} />` to the `message` prop instead.
384
384
  *
@@ -420,7 +420,7 @@ export declare const LabeledSelect: <T>(props: ({
420
420
  ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
421
421
  }, "fill" | "as" | "key" | "size" | keyof React.HTMLAttributes<HTMLSpanElement> | "padded"> & {
422
422
  size?: "small" | "auto" | "medium" | "large" | import("../../utils/types.js").AnyString | undefined;
423
- fill?: "default" | import("../../utils/types.js").AnyString | "informational" | "negative" | "positive" | "warning" | undefined;
423
+ fill?: "default" | "positive" | "negative" | "warning" | import("../../utils/types.js").AnyString | "informational" | undefined;
424
424
  padded?: boolean | undefined;
425
425
  } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
426
426
  as?: "span" | undefined;
@@ -430,7 +430,7 @@ export declare const LabeledSelect: <T>(props: ({
430
430
  } & {
431
431
  disabled?: boolean | undefined;
432
432
  size?: "small" | "large" | undefined;
433
- status?: "negative" | "positive" | "warning" | undefined;
433
+ status?: "positive" | "negative" | "warning" | undefined;
434
434
  } & {
435
435
  placeholder?: React.ReactNode;
436
436
  options: import("../Select/Select.js").SelectOption<T>[];
@@ -33,13 +33,14 @@ exports.Select = void 0;
33
33
  *--------------------------------------------------------------------------------------------*/
34
34
  const React = __importStar(require("react"));
35
35
  const classnames_1 = __importDefault(require("classnames"));
36
- const Menu_js_1 = require("../Menu/Menu.js");
37
36
  const MenuItem_js_1 = require("../Menu/MenuItem.js");
38
37
  const index_js_1 = require("../../utils/index.js");
39
38
  const SelectTag_js_1 = require("./SelectTag.js");
40
39
  const SelectTagContainer_js_1 = require("./SelectTagContainer.js");
41
40
  const Icon_js_1 = require("../Icon/Icon.js");
42
41
  const Popover_js_1 = require("../Popover/Popover.js");
42
+ const List_js_1 = require("../List/List.js");
43
+ const react_1 = require("@floating-ui/react");
43
44
  // ----------------------------------------------------------------------------
44
45
  /**
45
46
  * Select component to select value from options.
@@ -216,6 +217,16 @@ const CustomSelect = React.forwardRef((props, forwardedRef) => {
216
217
  ? options.filter((option) => value.some((val) => val === option.value))
217
218
  : options.find((option) => option.value === value);
218
219
  }, [multiple, options, value]);
220
+ const defaultFocusedIndex = React.useMemo(() => {
221
+ let index = 0;
222
+ if (Array.isArray(value) && value.length > 0) {
223
+ index = options.findIndex((option) => option.value === value[0]);
224
+ }
225
+ else if (value) {
226
+ index = options.findIndex((option) => option.value === value);
227
+ }
228
+ return index >= 0 ? index : 0;
229
+ }, [options, value]);
219
230
  const tagRenderer = React.useCallback((item) => {
220
231
  return React.createElement(SelectTag_js_1.SelectTag, { key: item.label, label: item.label });
221
232
  }, []);
@@ -236,7 +247,7 @@ const CustomSelect = React.forwardRef((props, forwardedRef) => {
236
247
  React.createElement(SelectEndIcon, { disabled: disabled, isOpen: isOpen }),
237
248
  multiple ? (React.createElement(index_js_1.AutoclearingHiddenLiveRegion, { text: liveRegionSelection })) : null),
238
249
  popover.open && (React.createElement(index_js_1.Portal, null,
239
- React.createElement(Menu_js_1.Menu, { role: 'listbox', className: menuClassName, id: `${uid}-menu`, key: `${uid}-menu`, ...popover.getFloatingProps({
250
+ React.createElement(SelectListbox, { defaultFocusedIndex: defaultFocusedIndex, className: menuClassName, id: `${uid}-menu`, key: `${uid}-menu`, ...popover.getFloatingProps({
240
251
  style: menuStyle,
241
252
  onKeyDown: ({ key }) => {
242
253
  if (key === 'Tab') {
@@ -291,3 +302,18 @@ const MultipleSelectButton = ({ selectedItems, selectedItemsRenderer, tagRendere
291
302
  selectedItems && !selectedItemsRenderer && (React.createElement(index_js_1.Box, { as: 'span', className: 'iui-content' },
292
303
  React.createElement(SelectTagContainer_js_1.SelectTagContainer, { tags: selectedItemsElements })))));
293
304
  };
305
+ // ----------------------------------------------------------------------------
306
+ const SelectListbox = React.forwardRef((props, forwardedRef) => {
307
+ const { defaultFocusedIndex = 0, autoFocus = true, children: childrenProp, className, ...rest } = props;
308
+ const [focusedIndex, setFocusedIndex] = React.useState(defaultFocusedIndex);
309
+ const autoFocusRef = React.useCallback((element) => {
310
+ queueMicrotask(() => {
311
+ const firstFocusable = element?.querySelector('[tabindex="0"]');
312
+ firstFocusable?.focus();
313
+ });
314
+ }, []);
315
+ const children = React.useMemo(() => {
316
+ return React.Children.map(childrenProp, (child, index) => React.isValidElement(child) ? (React.createElement(react_1.CompositeItem, { key: index, render: child, ref: child.props.ref || child.ref })) : (child));
317
+ }, [childrenProp]);
318
+ return (React.createElement(react_1.Composite, { render: React.createElement(List_js_1.List, { as: 'div', className: (0, classnames_1.default)('iui-menu', className) }), orientation: 'vertical', role: 'listbox', activeIndex: focusedIndex, onNavigate: setFocusedIndex, ref: (0, index_js_1.useMergedRefs)(forwardedRef, autoFocus ? autoFocusRef : undefined), ...rest }, children));
319
+ });
@@ -52,7 +52,7 @@ const getSurfaceElevationValue = (elevation) => {
52
52
  case 5:
53
53
  return 'var(--iui-shadow-5)';
54
54
  default:
55
- return '';
55
+ return undefined;
56
56
  }
57
57
  };
58
58
  /** Returns correct border value based on prop */
@@ -63,7 +63,7 @@ const getBorderValue = (border) => {
63
63
  if (border === false) {
64
64
  return 'none';
65
65
  }
66
- return '';
66
+ return undefined;
67
67
  };
68
68
  // ----------------------------------------------------------------------------
69
69
  // Surface.Header component
@@ -110,13 +110,8 @@ const Table = (props) => {
110
110
  minWidth: 0,
111
111
  width: 0,
112
112
  }), []);
113
- // useRef prevents from rerendering when one of these callbacks changes
114
- const onBottomReachedRef = React.useRef(onBottomReached);
115
- const onRowInViewportRef = React.useRef(onRowInViewport);
116
- React.useEffect(() => {
117
- onBottomReachedRef.current = onBottomReached;
118
- onRowInViewportRef.current = onRowInViewport;
119
- }, [onBottomReached, onRowInViewport]);
113
+ const onBottomReachedRef = (0, index_js_1.useLatestRef)(onBottomReached);
114
+ const onRowInViewportRef = (0, index_js_1.useLatestRef)(onRowInViewport);
120
115
  const hasManualSelectionColumn = React.useMemo(() => {
121
116
  const flatColumns = flattenColumns(columns);
122
117
  return flatColumns.some((column) => column.id === index_js_5.SELECTION_CELL_ID);
@@ -386,6 +381,8 @@ const Table = (props) => {
386
381
  enableVirtualization,
387
382
  tableRowRef,
388
383
  density,
384
+ onBottomReachedRef,
385
+ onRowInViewportRef,
389
386
  ]);
390
387
  const virtualizedItemRenderer = React.useCallback((index) => getPreparedRow(index), [getPreparedRow]);
391
388
  const updateStickyState = () => {
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.EditableCell = void 0;
27
30
  /*---------------------------------------------------------------------------------------------
@@ -30,6 +33,7 @@ exports.EditableCell = void 0;
30
33
  *--------------------------------------------------------------------------------------------*/
31
34
  const React = __importStar(require("react"));
32
35
  const index_js_1 = require("../../../utils/index.js");
36
+ const classnames_1 = __importDefault(require("classnames"));
33
37
  /**
34
38
  * Editable cell.
35
39
  * It should be passed to `cellRenderer`.
@@ -41,7 +45,7 @@ const index_js_1 = require("../../../utils/index.js");
41
45
  * }
42
46
  */
43
47
  const EditableCell = (props) => {
44
- const { cellElementProps, cellProps, onCellEdit, children, isDisabled, ...rest } = props;
48
+ const { cellElementProps: { className: cellElementClassName, style: cellElementStyle, ...cellElementProps }, cellProps, onCellEdit, children, isDisabled, className, style, ...rest } = props;
45
49
  isDisabled; // To omit and prevent eslint error.
46
50
  const sanitizeString = (text) => {
47
51
  return text.replace(/(\r\n|\n|\r)+/gm, ' ');
@@ -52,7 +56,7 @@ const EditableCell = (props) => {
52
56
  }, [cellProps.value]);
53
57
  const [key, setKey] = React.useState((0, index_js_1.getRandomValue)(10));
54
58
  const [isDirty, setIsDirty] = React.useState(false);
55
- return (React.createElement(index_js_1.Box, { ...cellElementProps, contentEditable: true, suppressContentEditableWarning: true, key: key, ...rest, onInput: (e) => {
59
+ return (React.createElement(index_js_1.Box, { ...cellElementProps, contentEditable: true, suppressContentEditableWarning: true, key: key, ...rest, className: (0, classnames_1.default)(cellElementClassName, className), style: { ...cellElementStyle, ...style }, onInput: (e) => {
56
60
  setValue(sanitizeString(e.target.innerText));
57
61
  setIsDirty(true);
58
62
  props.onInput?.(e);
@@ -269,7 +269,7 @@ export declare const Tabs: PolymorphicForwardRefComponent<"div", TabsLegacyProps
269
269
  ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
270
270
  }, "fill" | "as" | "key" | "size" | keyof React.HTMLAttributes<HTMLSpanElement> | "padded"> & {
271
271
  size?: "small" | "auto" | "medium" | "large" | import("../../utils/types.js").AnyString | undefined;
272
- fill?: "default" | import("../../utils/types.js").AnyString | "informational" | "negative" | "positive" | "warning" | undefined;
272
+ fill?: "default" | "positive" | "negative" | "warning" | import("../../utils/types.js").AnyString | "informational" | undefined;
273
273
  padded?: boolean | undefined;
274
274
  } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
275
275
  as?: "span" | undefined;
@@ -249,7 +249,7 @@ export declare const Tile: PolymorphicForwardRefComponent<"div", TileLegacyProps
249
249
  */
250
250
  IconButton: PolymorphicForwardRefComponent<"button", Omit<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
251
251
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
252
- }, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
252
+ }, "label" | "as" | "loading" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "stretched" | "isActive" | "iconProps"> & {
253
253
  isActive?: boolean | undefined;
254
254
  label?: React.ReactNode;
255
255
  labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
@@ -262,6 +262,14 @@ export declare const Tile: PolymorphicForwardRefComponent<"div", TileLegacyProps
262
262
  ancestorScroll?: boolean | undefined;
263
263
  ancestorResize?: boolean | undefined;
264
264
  elementResize?: boolean | undefined;
265
+ /**
266
+ * Flag whether the tile is disabled.
267
+ *
268
+ * Note: This only affects the tile. You need to manually disable
269
+ * the buttons and other interactive elements inside the tile.
270
+ *
271
+ * @default false
272
+ */
265
273
  animationFrame?: boolean | undefined;
266
274
  layoutShift?: boolean | undefined;
267
275
  } | undefined;
@@ -288,6 +296,14 @@ export declare const Tile: PolymorphicForwardRefComponent<"div", TileLegacyProps
288
296
  ancestorScroll?: boolean | undefined;
289
297
  ancestorResize?: boolean | undefined;
290
298
  elementResize?: boolean | undefined;
299
+ /**
300
+ * Flag whether the tile is disabled.
301
+ *
302
+ * Note: This only affects the tile. You need to manually disable
303
+ * the buttons and other interactive elements inside the tile.
304
+ *
305
+ * @default false
306
+ */
291
307
  animationFrame?: boolean | undefined;
292
308
  layoutShift?: boolean | undefined;
293
309
  } | undefined;
@@ -35,10 +35,22 @@ const React = __importStar(require("react"));
35
35
  const classnames_1 = __importDefault(require("classnames"));
36
36
  const react_1 = require("@floating-ui/react");
37
37
  const index_js_1 = require("../../utils/index.js");
38
+ // ----------------------------------------------------------------------------
38
39
  const useTooltip = (options = {}) => {
39
40
  const uniqueId = (0, index_js_1.useId)();
40
41
  const { placement = 'top', visible, onVisibleChange, middleware = { flip: true, shift: true }, autoUpdateOptions = {}, reference, ariaStrategy = 'description', id = uniqueId, ...props } = options;
41
42
  const [open, onOpenChange] = (0, index_js_1.useControlledState)(false, visible, onVisibleChange);
43
+ const syncWithControlledState = React.useCallback((element) => {
44
+ // Using a microtask ensures that the popover is mounted before calling togglePopover
45
+ queueMicrotask(() => {
46
+ try {
47
+ element?.togglePopover?.(open);
48
+ }
49
+ catch {
50
+ // Fail silently, to avoid crashing the page
51
+ }
52
+ });
53
+ }, [open]);
42
54
  const floating = (0, react_1.useFloating)({
43
55
  placement,
44
56
  open,
@@ -121,19 +133,29 @@ const useTooltip = (options = {}) => {
121
133
  const getReferenceProps = React.useCallback((userProps) => {
122
134
  return interactions.getReferenceProps({ ...userProps, ...ariaProps });
123
135
  }, [interactions, ariaProps]);
124
- const floatingProps = React.useMemo(() => interactions.getFloatingProps({
125
- hidden: !open,
126
- 'aria-hidden': 'true',
127
- ...props,
128
- id,
136
+ const floatingProps = React.useMemo(() => ({
137
+ ...interactions.getFloatingProps({
138
+ hidden: !open,
139
+ 'aria-hidden': 'true',
140
+ ...props,
141
+ id,
142
+ }),
143
+ popover: 'manual',
129
144
  }), [interactions, props, id, open]);
130
145
  return React.useMemo(() => ({
131
146
  getReferenceProps,
132
147
  floatingProps,
133
148
  ...floating,
149
+ refs: {
150
+ ...floating.refs,
151
+ setFloating: (element) => {
152
+ floating.refs.setFloating(element);
153
+ syncWithControlledState(element);
154
+ },
155
+ },
134
156
  // styles are not relevant when tooltip is not open
135
157
  floatingStyles: floating.context.open ? floating.floatingStyles : {},
136
- }), [getReferenceProps, floatingProps, floating]);
158
+ }), [getReferenceProps, floatingProps, floating, syncWithControlledState]);
137
159
  };
138
160
  /**
139
161
  * Basic tooltip component to display informative content when an element is hovered or focused.