@itwin/itwinui-react 3.5.0 → 3.6.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/cjs/core/Carousel/Carousel.d.ts +4 -4
  3. package/cjs/core/Carousel/CarouselNavigation.d.ts +4 -4
  4. package/cjs/core/Dialog/Dialog.js +19 -17
  5. package/cjs/core/Dialog/DialogContext.d.ts +4 -0
  6. package/cjs/core/Dialog/DialogMain.js +1 -1
  7. package/cjs/core/Dialog/DialogTitleBar.js +1 -1
  8. package/cjs/core/InputGroup/InputGroup.d.ts +4 -0
  9. package/cjs/core/InputGroup/InputGroup.js +20 -4
  10. package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +18 -62
  11. package/cjs/core/InputWithDecorations/InputWithDecorations.js +21 -6
  12. package/cjs/core/LabeledSelect/LabeledSelect.d.ts +376 -4
  13. package/cjs/core/LabeledSelect/LabeledSelect.js +1 -1
  14. package/cjs/core/Popover/Popover.d.ts +6 -3
  15. package/cjs/core/SearchBox/SearchBox.js +4 -6
  16. package/cjs/core/Select/Select.d.ts +194 -101
  17. package/cjs/core/Select/Select.js +71 -18
  18. package/cjs/core/Table/Table.js +2 -1
  19. package/cjs/core/Tabs/Tabs.js +19 -3
  20. package/cjs/core/Tile/Tile.d.ts +2 -2
  21. package/cjs/core/utils/components/InputFlexContainer.d.ts +25 -0
  22. package/cjs/core/utils/components/InputFlexContainer.js +19 -1
  23. package/cjs/core/utils/components/LineClamp.d.ts +5 -0
  24. package/cjs/core/utils/components/LineClamp.js +49 -0
  25. package/cjs/core/utils/components/index.d.ts +1 -0
  26. package/cjs/core/utils/components/index.js +1 -0
  27. package/cjs/core/utils/icons/SvgStatusError.js +1 -1
  28. package/esm/core/Carousel/Carousel.d.ts +4 -4
  29. package/esm/core/Carousel/CarouselNavigation.d.ts +4 -4
  30. package/esm/core/Dialog/Dialog.js +19 -17
  31. package/esm/core/Dialog/DialogContext.d.ts +4 -0
  32. package/esm/core/Dialog/DialogMain.js +1 -1
  33. package/esm/core/Dialog/DialogTitleBar.js +1 -1
  34. package/esm/core/InputGroup/InputGroup.d.ts +4 -0
  35. package/esm/core/InputGroup/InputGroup.js +20 -4
  36. package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +18 -62
  37. package/esm/core/InputWithDecorations/InputWithDecorations.js +22 -7
  38. package/esm/core/LabeledSelect/LabeledSelect.d.ts +376 -4
  39. package/esm/core/LabeledSelect/LabeledSelect.js +1 -1
  40. package/esm/core/Popover/Popover.d.ts +6 -3
  41. package/esm/core/SearchBox/SearchBox.js +5 -7
  42. package/esm/core/Select/Select.d.ts +194 -101
  43. package/esm/core/Select/Select.js +72 -19
  44. package/esm/core/Table/Table.js +2 -1
  45. package/esm/core/Tabs/Tabs.js +19 -3
  46. package/esm/core/Tile/Tile.d.ts +2 -2
  47. package/esm/core/utils/components/InputFlexContainer.d.ts +25 -0
  48. package/esm/core/utils/components/InputFlexContainer.js +18 -0
  49. package/esm/core/utils/components/LineClamp.d.ts +5 -0
  50. package/esm/core/utils/components/LineClamp.js +23 -0
  51. package/esm/core/utils/components/index.d.ts +1 -0
  52. package/esm/core/utils/components/index.js +1 -0
  53. package/esm/core/utils/icons/SvgStatusError.js +1 -1
  54. package/package.json +27 -27
  55. package/styles.css +23 -23
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.LineClamp = void 0;
27
+ /*---------------------------------------------------------------------------------------------
28
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
29
+ * See LICENSE.md in the project root for license terms and full copyright notice.
30
+ *--------------------------------------------------------------------------------------------*/
31
+ const React = __importStar(require("react"));
32
+ const Box_js_1 = require("./Box.js");
33
+ const ShadowRoot_js_1 = require("./ShadowRoot.js");
34
+ /** @private */
35
+ exports.LineClamp = React.forwardRef((props, forwardedRef) => {
36
+ const { lines, children, ...rest } = props;
37
+ return (React.createElement(Box_js_1.Box, { ref: forwardedRef, ...rest, style: { '--_iui-line-clamp': lines, ...props.style } },
38
+ React.createElement(ShadowRoot_js_1.ShadowRoot, { css: css },
39
+ React.createElement("slot", null)),
40
+ children));
41
+ });
42
+ const css = /* css */ `
43
+ :host {
44
+ overflow: hidden;
45
+ display: -webkit-box;
46
+ -webkit-line-clamp: var(--_iui-line-clamp, 3);
47
+ -webkit-box-orient: vertical;
48
+ }
49
+ `;
@@ -11,3 +11,4 @@ export * from './Box.js';
11
11
  export * from './ButtonBase.js';
12
12
  export * from './Portal.js';
13
13
  export * from './ShadowRoot.js';
14
+ export * from './LineClamp.js';
@@ -31,3 +31,4 @@ __exportStar(require("./Box.js"), exports);
31
31
  __exportStar(require("./ButtonBase.js"), exports);
32
32
  __exportStar(require("./Portal.js"), exports);
33
33
  __exportStar(require("./ShadowRoot.js"), exports);
34
+ __exportStar(require("./LineClamp.js"), exports);
@@ -32,6 +32,6 @@ const React = __importStar(require("react"));
32
32
  const Svg_js_1 = require("./Svg.js");
33
33
  const SvgStatusError = (props) => {
34
34
  return (React.createElement(Svg_js_1.Svg, { ...props },
35
- React.createElement("path", { d: 'm8 0a8 8 0 1 0 8 8 8 8 0 0 0 -8-8zm1 12h-2v-2h2zm0-3h-2v-5h2z' })));
35
+ React.createElement("path", { d: 'M9 12H7v-2h2v2Zm0-3H7V4h2v5Zm2.314-9H4.686L0 4.686v6.628L4.686 16h6.628L16 11.314V4.686L11.314 0Z' })));
36
36
  };
37
37
  exports.SvgStatusError = SvgStatusError;
@@ -48,7 +48,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
48
48
  labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
49
49
  ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
50
50
  }, "as" | "children" | "content" | "portal" | keyof {
51
- placement?: import("@floating-ui/utils").Placement | undefined;
51
+ placement?: import("@floating-ui/core").Placement | undefined;
52
52
  visible?: boolean | undefined;
53
53
  onVisibleChange?: ((visible: boolean) => void) | undefined;
54
54
  autoUpdateOptions?: {
@@ -92,7 +92,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
92
92
  */
93
93
  children?: React.ReactNode;
94
94
  } & import("../utils/index.js").PortalProps & {
95
- placement?: import("@floating-ui/utils").Placement | undefined;
95
+ placement?: import("@floating-ui/core").Placement | undefined;
96
96
  visible?: boolean | undefined;
97
97
  onVisibleChange?: ((visible: boolean) => void) | undefined;
98
98
  autoUpdateOptions?: {
@@ -129,7 +129,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
129
129
  labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
130
130
  ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
131
131
  }, "as" | "children" | "content" | "portal" | keyof {
132
- placement?: import("@floating-ui/utils").Placement | undefined;
132
+ placement?: import("@floating-ui/core").Placement | undefined;
133
133
  visible?: boolean | undefined;
134
134
  onVisibleChange?: ((visible: boolean) => void) | undefined;
135
135
  autoUpdateOptions?: {
@@ -173,7 +173,7 @@ export declare const Carousel: PolymorphicForwardRefComponent<"section", Carouse
173
173
  */
174
174
  children?: React.ReactNode;
175
175
  } & import("../utils/index.js").PortalProps & {
176
- placement?: import("@floating-ui/utils").Placement | undefined;
176
+ placement?: import("@floating-ui/core").Placement | undefined;
177
177
  visible?: boolean | undefined;
178
178
  onVisibleChange?: ((visible: boolean) => void) | undefined;
179
179
  autoUpdateOptions?: {
@@ -15,7 +15,7 @@ export declare const CarouselNavigation: PolymorphicForwardRefComponent<"div", {
15
15
  labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
16
16
  ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
17
17
  }, "as" | "children" | "content" | "portal" | keyof {
18
- placement?: import("@floating-ui/utils").Placement | undefined;
18
+ placement?: import("@floating-ui/core").Placement | undefined;
19
19
  visible?: boolean | undefined;
20
20
  onVisibleChange?: ((visible: boolean) => void) | undefined;
21
21
  autoUpdateOptions?: {
@@ -41,7 +41,7 @@ export declare const CarouselNavigation: PolymorphicForwardRefComponent<"div", {
41
41
  content: React.ReactNode;
42
42
  children?: React.ReactNode;
43
43
  } & import("../utils/index.js").PortalProps & {
44
- placement?: import("@floating-ui/utils").Placement | undefined;
44
+ placement?: import("@floating-ui/core").Placement | undefined;
45
45
  visible?: boolean | undefined;
46
46
  onVisibleChange?: ((visible: boolean) => void) | undefined;
47
47
  autoUpdateOptions?: {
@@ -78,7 +78,7 @@ export declare const CarouselNavigation: PolymorphicForwardRefComponent<"div", {
78
78
  labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
79
79
  ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
80
80
  }, "as" | "children" | "content" | "portal" | keyof {
81
- placement?: import("@floating-ui/utils").Placement | undefined;
81
+ placement?: import("@floating-ui/core").Placement | undefined;
82
82
  visible?: boolean | undefined;
83
83
  onVisibleChange?: ((visible: boolean) => void) | undefined;
84
84
  autoUpdateOptions?: {
@@ -104,7 +104,7 @@ export declare const CarouselNavigation: PolymorphicForwardRefComponent<"div", {
104
104
  content: React.ReactNode;
105
105
  children?: React.ReactNode;
106
106
  } & import("../utils/index.js").PortalProps & {
107
- placement?: import("@floating-ui/utils").Placement | undefined;
107
+ placement?: import("@floating-ui/core").Placement | undefined;
108
108
  visible?: boolean | undefined;
109
109
  onVisibleChange?: ((visible: boolean) => void) | undefined;
110
110
  autoUpdateOptions?: {
@@ -11,26 +11,28 @@ import { DialogContext } from './DialogContext.js';
11
11
  import { DialogButtonBar } from './DialogButtonBar.js';
12
12
  import { DialogMain } from './DialogMain.js';
13
13
  import { useMergedRefs, Box, Portal } from '../utils/index.js';
14
+ import { Transition } from 'react-transition-group';
14
15
  const DialogComponent = React.forwardRef((props, ref) => {
15
16
  const { trapFocus = false, setFocus = false, preventDocumentScroll = false, isOpen = false, isDismissible = true, closeOnEsc = true, closeOnExternalClick = false, onClose, isDraggable = false, isResizable = false, relativeTo = 'viewport', placement, className, portal = false, ...rest } = props;
16
17
  const dialogRootRef = React.useRef(null);
17
- return (React.createElement(DialogContext.Provider, { value: {
18
- isOpen,
19
- onClose,
20
- closeOnEsc,
21
- closeOnExternalClick,
22
- isDismissible,
23
- preventDocumentScroll,
24
- trapFocus,
25
- setFocus,
26
- isDraggable,
27
- isResizable,
28
- relativeTo,
29
- dialogRootRef,
30
- placement,
31
- } },
32
- React.createElement(Portal, { portal: portal },
33
- React.createElement(Box, { className: cx('iui-dialog-wrapper', className), "data-iui-relative": relativeTo === 'container', ref: useMergedRefs(ref, dialogRootRef), ...rest }))));
18
+ return (React.createElement(Transition, { in: isOpen, timeout: { exit: 600 }, mountOnEnter: true, unmountOnExit: true },
19
+ React.createElement(DialogContext.Provider, { value: {
20
+ isOpen,
21
+ onClose,
22
+ closeOnEsc,
23
+ closeOnExternalClick,
24
+ isDismissible,
25
+ preventDocumentScroll,
26
+ trapFocus,
27
+ setFocus,
28
+ isDraggable,
29
+ isResizable,
30
+ relativeTo,
31
+ dialogRootRef,
32
+ placement,
33
+ } },
34
+ React.createElement(Portal, { portal: portal },
35
+ React.createElement(Box, { className: cx('iui-dialog-wrapper', className), "data-iui-relative": relativeTo === 'container', ref: useMergedRefs(ref, dialogRootRef), ...rest })))));
34
36
  });
35
37
  /**
36
38
  * Dialog component.
@@ -3,6 +3,10 @@ import type { PortalProps } from '../utils/index.js';
3
3
  export type DialogContextProps = {
4
4
  /**
5
5
  * Flag whether dialog should be shown.
6
+ *
7
+ * It is recommended to directly pass the boolean condition to this prop instead of rendering the `Dialog`
8
+ * conditionally with `isOpen` hard-coded to `true`. One benefit of this is getting an exit animation.
9
+ *
6
10
  * @default false
7
11
  */
8
12
  isOpen?: boolean;
@@ -120,7 +120,7 @@ export const DialogMain = React.forwardRef((props, ref) => {
120
120
  }
121
121
  }, onResizeEnd: setResizeStyle }))),
122
122
  children));
123
- return (React.createElement(Transition, { in: isOpen, timeout: { exit: 600 },
123
+ return (React.createElement(Transition, { in: isOpen, appear: true, timeout: { exit: 600 },
124
124
  // Focuses dialog when opened
125
125
  onEntered: () => {
126
126
  previousFocusedElement.current = dialogRef.current?.ownerDocument
@@ -34,7 +34,7 @@ export const DialogTitleBar = Object.assign(React.forwardRef((props, ref) => {
34
34
  'iui-dialog-title-bar-filled': isDraggable,
35
35
  }), ref: ref, onPointerDown: mergeEventHandlers(onPointerDownProp, onPointerDown), ...rest }, children ? (children) : (React.createElement(React.Fragment, null,
36
36
  React.createElement(DialogTitleBarTitle, null, titleText),
37
- isDismissible && (React.createElement(IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
37
+ isDismissible && (React.createElement(IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close', "data-iui-shift": 'right' },
38
38
  React.createElement(SvgClose, null)))))));
39
39
  }), {
40
40
  Title: DialogTitleBarTitle,
@@ -12,6 +12,10 @@ type InputGroupProps = {
12
12
  status?: 'positive' | 'warning' | 'negative';
13
13
  /**
14
14
  * Message below the group. Does not apply to 'inline' group.
15
+ *
16
+ * When `typeof message === "string"`, it is automatically wrapped with {@link StatusMessage}.
17
+ * If you are passing a non-string message that is not `<StatusMessage>`, you may need to wrap it with
18
+ * `<StatusMessage>` yourself for proper styling of `message`.
15
19
  */
16
20
  message?: React.ReactNode;
17
21
  /**
@@ -24,11 +24,27 @@ import { StatusMessage } from '../StatusMessage/StatusMessage.js';
24
24
  * </InputGroup>
25
25
  */
26
26
  export const InputGroup = React.forwardRef((props, forwardedRef) => {
27
- const { className, children, disabled = false, displayStyle = 'default', label, message, status, svgIcon, required = false, labelProps, messageProps, innerProps, ...rest } = props;
27
+ const { className, children, disabled = false, displayStyle = 'default', label, status, required = false, labelProps, innerProps, message, svgIcon, messageProps, ...rest } = props;
28
28
  return (React.createElement(InputGrid, { ref: forwardedRef, as: 'div', labelPlacement: displayStyle, className: cx('iui-input-group-wrapper', className), "data-iui-status": status, ...rest },
29
29
  label && (React.createElement(Label, { as: 'label', required: required, disabled: disabled, ...labelProps }, label)),
30
30
  React.createElement(Box, { as: 'div', ...innerProps, className: cx('iui-input-group', innerProps?.className) }, children),
31
- (message || status || svgIcon) && (React.createElement(StatusMessage, { iconProps: {
32
- 'aria-hidden': true,
33
- }, startIcon: svgIcon, status: status, ...messageProps }, displayStyle !== 'inline' && message))));
31
+ React.createElement(BottomMessage, { message: message, status: status, svgIcon: svgIcon, displayStyle: displayStyle, messageProps: messageProps })));
34
32
  });
33
+ // ------------------------------------------------------------------------------------------------
34
+ /**
35
+ * @private
36
+ * - When `typeof message !== 'string'`, `message` is returned as-is (e.g. when `message=<StatusMessage />`).
37
+ * - Else, it is wrapped in a `<StatusMessage />`.
38
+ */
39
+ const BottomMessage = (props) => {
40
+ const { message, status, svgIcon, displayStyle, messageProps } = props;
41
+ if (message && typeof message !== 'string') {
42
+ return message;
43
+ }
44
+ if (message || status || svgIcon) {
45
+ return (React.createElement(StatusMessage, { iconProps: {
46
+ 'aria-hidden': true,
47
+ }, startIcon: svgIcon, status: status, ...messageProps }, displayStyle !== 'inline' && message));
48
+ }
49
+ return undefined;
50
+ };
@@ -5,9 +5,9 @@ import type { InputProps } from '../Input/Input.js';
5
5
  * Input component with various additional decorations.
6
6
  * You can add icons, buttons and other various subcomponents to it.
7
7
  *
8
- * If you are not using default InputWithDecorations.Icon and InputWithDecorations.Button, use borderless versions of other components.
8
+ * If you are not using default `InputWithDecorations.Icon` and `InputWithDecorations.Button`, use borderless versions of other components.
9
9
  *
10
- * @usage
10
+ * @example
11
11
  * <InputWithDecorations>
12
12
  * <InputWithDecorations.Input />
13
13
  * <InputWithDecorations.Icon>
@@ -26,68 +26,24 @@ export declare const InputWithDecorations: PolymorphicForwardRefComponent<"div",
26
26
  Input: PolymorphicForwardRefComponent<"input", InputProps>;
27
27
  /**
28
28
  * Subcomponent to include button in your InputWithDecorations
29
+ *
30
+ * Although similar to `IconButton`, this subcomponent additionally collapses the padding between the button and the input/textarea
31
+ * in `InputWithDecorations`.
29
32
  */
30
- Button: PolymorphicForwardRefComponent<"span", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
33
+ Button: PolymorphicForwardRefComponent<"button", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
31
34
  ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
32
- }, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "isActive" | "iconProps"> & {
33
- isActive?: boolean | undefined;
34
- label?: React.ReactNode;
35
- labelProps?: Omit<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
36
- ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
37
- }, "as" | "children" | "content" | "portal" | keyof {
38
- placement?: import("@floating-ui/utils").Placement | undefined;
39
- visible?: boolean | undefined;
40
- onVisibleChange?: ((visible: boolean) => void) | undefined;
41
- autoUpdateOptions?: {
42
- ancestorScroll?: boolean | undefined;
43
- ancestorResize?: boolean | undefined;
44
- elementResize?: boolean | undefined;
45
- animationFrame?: boolean | undefined;
46
- layoutShift?: boolean | undefined;
47
- } | undefined;
48
- middleware?: {
49
- offset?: number | undefined;
50
- flip?: boolean | undefined;
51
- shift?: boolean | undefined;
52
- size?: boolean | undefined;
53
- autoPlacement?: boolean | undefined;
54
- hide?: boolean | undefined;
55
- inline?: boolean | undefined;
56
- } | undefined;
57
- reference?: HTMLElement | null | undefined;
58
- ariaStrategy?: "label" | "description" | "none" | undefined;
59
- id?: string | undefined;
60
- }> & {
61
- content: React.ReactNode;
62
- children?: React.ReactNode;
63
- } & import("../utils/index.js").PortalProps & {
64
- placement?: import("@floating-ui/utils").Placement | undefined;
65
- visible?: boolean | undefined;
66
- onVisibleChange?: ((visible: boolean) => void) | undefined;
67
- autoUpdateOptions?: {
68
- ancestorScroll?: boolean | undefined;
69
- ancestorResize?: boolean | undefined;
70
- elementResize?: boolean | undefined;
71
- animationFrame?: boolean | undefined;
72
- layoutShift?: boolean | undefined;
73
- } | undefined;
74
- middleware?: {
75
- offset?: number | undefined;
76
- flip?: boolean | undefined;
77
- shift?: boolean | undefined;
78
- size?: boolean | undefined;
79
- autoPlacement?: boolean | undefined;
80
- hide?: boolean | undefined;
81
- inline?: boolean | undefined;
82
- } | undefined;
83
- reference?: HTMLElement | null | undefined;
84
- ariaStrategy?: "label" | "description" | "none" | undefined;
85
- id?: string | undefined;
86
- } & {
87
- as?: "div" | undefined;
88
- }, "ref">, "children" | "content" | "reference" | "ariaStrategy"> | undefined;
89
- iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
90
- } & Omit<import("../Buttons/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
35
+ }, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "labelProps" | "isActive" | "iconProps"> & Omit<import("../Buttons/IconButton.js").IconButtonProps, "styleType"> & {
36
+ styleType?: "default" | "cta" | "high-visibility" | "borderless" | undefined;
37
+ } & {
91
38
  as?: "button" | undefined;
92
39
  }>;
40
+ /**
41
+ * Subcomponent to include button in your InputWithDecorations.
42
+ *
43
+ * Although similar to `Icon`, this subcomponent additionally collapses the padding between the icon and the input/textarea
44
+ * in `InputWithDecorations`.
45
+ */
46
+ Icon: PolymorphicForwardRefComponent<"span", Omit<import("../Icon/Icon.js").IconProps, "padded"> & {
47
+ padded?: boolean | undefined;
48
+ }>;
93
49
  };
@@ -3,33 +3,38 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import * as React from 'react';
6
- import { Box, InputFlexContainer, useSafeContext } from '../utils/index.js';
7
- import { IconButton } from '../Buttons/IconButton.js';
6
+ import { Box, InputFlexContainer, InputFlexContainerButton, InputFlexContainerIcon, useSafeContext, } from '../utils/index.js';
8
7
  const InputWithDecorationsContext = React.createContext(undefined);
9
8
  const InputWithDecorationsComponent = React.forwardRef((props, ref) => {
10
9
  const { children, size, isDisabled, ...rest } = props;
11
10
  return (React.createElement(InputWithDecorationsContext.Provider, { value: { size, isDisabled } },
12
11
  React.createElement(InputFlexContainer, { isDisabled: isDisabled, size: size, ref: ref, ...rest }, children)));
13
12
  });
14
- //-------------------------------------------------------------------------------
13
+ // ----------------------------------------------------------------------------
15
14
  const InputWithDecorationsInput = React.forwardRef((props, ref) => {
16
15
  const { id: idProp, size, disabled: localDisabled, ...rest } = props;
17
16
  const { size: contextSize, isDisabled } = useSafeContext(InputWithDecorationsContext);
18
17
  return (React.createElement(Box, { as: 'input', ref: ref, "data-iui-size": size ?? contextSize, disabled: localDisabled ?? isDisabled, id: idProp, ...rest }));
19
18
  });
20
- //-------------------------------------------------------------------------------
19
+ InputWithDecorationsInput.displayName = 'InputWithDecorations.Input';
20
+ // ----------------------------------------------------------------------------
21
21
  const InputWithDecorationsButton = React.forwardRef((props, ref) => {
22
22
  const { children, size, disabled: localDisabled, ...rest } = props;
23
23
  const { size: contextSize, isDisabled } = useSafeContext(InputWithDecorationsContext);
24
- return (React.createElement(IconButton, { ref: ref, size: size ?? contextSize, styleType: 'borderless', disabled: localDisabled ?? isDisabled, ...rest }, children));
24
+ return (React.createElement(InputFlexContainerButton, { ref: ref, size: size ?? contextSize, disabled: localDisabled ?? isDisabled, ...rest }, children));
25
25
  });
26
+ InputWithDecorationsButton.displayName = 'InputWithDecorations.Button';
27
+ // ----------------------------------------------------------------------------
28
+ const InputWithDecorationsIcon = InputFlexContainerIcon;
29
+ InputWithDecorationsIcon.displayName = 'InputWithDecorations.Icon';
30
+ // ----------------------------------------------------------------------------
26
31
  /**
27
32
  * Input component with various additional decorations.
28
33
  * You can add icons, buttons and other various subcomponents to it.
29
34
  *
30
- * If you are not using default InputWithDecorations.Icon and InputWithDecorations.Button, use borderless versions of other components.
35
+ * If you are not using default `InputWithDecorations.Icon` and `InputWithDecorations.Button`, use borderless versions of other components.
31
36
  *
32
- * @usage
37
+ * @example
33
38
  * <InputWithDecorations>
34
39
  * <InputWithDecorations.Input />
35
40
  * <InputWithDecorations.Icon>
@@ -44,6 +49,16 @@ export const InputWithDecorations = Object.assign(InputWithDecorationsComponent,
44
49
  Input: InputWithDecorationsInput,
45
50
  /**
46
51
  * Subcomponent to include button in your InputWithDecorations
52
+ *
53
+ * Although similar to `IconButton`, this subcomponent additionally collapses the padding between the button and the input/textarea
54
+ * in `InputWithDecorations`.
47
55
  */
48
56
  Button: InputWithDecorationsButton,
57
+ /**
58
+ * Subcomponent to include button in your InputWithDecorations.
59
+ *
60
+ * Although similar to `Icon`, this subcomponent additionally collapses the padding between the icon and the input/textarea
61
+ * in `InputWithDecorations`.
62
+ */
63
+ Icon: InputWithDecorationsIcon,
49
64
  });