@itwin/itwinui-react 3.5.0 → 3.6.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 (55) hide show
  1. package/CHANGELOG.md +34 -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 +24 -26
  55. package/styles.css +23 -23
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1909](https://github.com/iTwin/iTwinUI/pull/1909): Remove `margin-block` from `Badge`.
8
+
9
+ ## 3.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#1879](https://github.com/iTwin/iTwinUI/pull/1879): Added a new `native` prop to `Select` and `LabeledSelect`. When true, a native `<select>` element will be rendered.
14
+ - [#1886](https://github.com/iTwin/iTwinUI/pull/1886): Native `Select` (`<Select native>`) offers a new `styleType` prop that accepts the values: `default` (pre-existing) and `borderless` (new).
15
+ - [#1877](https://github.com/iTwin/iTwinUI/pull/1877): Fixed a bug in `LabeledSelect` where nested `<StatusMessage>`s were rendered when using `message={<StatusMessage>}`. As a result, non-string `message` values are no longer automatically wrapped in `<StatusMessage>`.
16
+ - If you were passing a custom `ReactNode`, you might need to wrap it with `<StatusMessage>` for proper styling of `message`.
17
+ - [#1881](https://github.com/iTwin/iTwinUI/pull/1881): Added a new subcomponent `InputWithDecorations.Icon` to replace direct usage of `Icon` inside `InputWithDecorations`.
18
+ - Visual changes:
19
+ - [#1828](https://github.com/iTwin/iTwinUI/pull/1828): Inline padding of `Icon` no longer changes with the icon size. It is now a constant of `--iui-size-xs`.
20
+ - [#1881](https://github.com/iTwin/iTwinUI/pull/1881): `Input`'s and `Textarea`'s start/end inline padding when inside `InputWithDecorations` is now collapsed when it is preceded/followed by a `InputWithDecorations.Icon` or `InputWithDecorations.Button`. This prevents unnecessary empty space in `InputWithDecorations`.
21
+ - [#1888](https://github.com/iTwin/iTwinUI/pull/1888): The expandable `SearchBox` now shows a regular-sized button in the collapsed state. Previously, it used to incorrectly be a square button.
22
+ - [#1828](https://github.com/iTwin/iTwinUI/pull/1828): `SearchBox.Icon` no longer has the same width as `SearchBox.Button`. Its width also no longer changes with the `SearchBox` size. This is because its padding behavior is now similar to `Icon`'s padding behavior, where it uses a constant padding.
23
+ - [#1897](https://github.com/iTwin/iTwinUI/pull/1897): All instances of `<SvgStatusError>` have been updated to reflect the new octagon shape from the latest version of iTwinUI-icons. Some components affected: `Icon`, `Alert`, `Toast`, `StatusMessage`.
24
+ - [#1888](https://github.com/iTwin/iTwinUI/pull/1888): The expandable `SearchBox`'s animation/transition between the expanded and the collapsed states is now removed.
25
+
26
+ ### Patch Changes
27
+
28
+ - [#1865](https://github.com/iTwin/iTwinUI/pull/1865): `Dialog`/`Modal` will no longer keep its wrapper in the DOM when `isOpen=false`.
29
+ - [#1889](https://github.com/iTwin/iTwinUI/pull/1889): `Dialog`/`Modal`'s close button will now be visually aligned based on the icon inside it, excluding the padding.
30
+ - [#1906](https://github.com/iTwin/iTwinUI/pull/1906): `Dialog`/`Modal` title will now wrap to multiple lines instead of getting clippped.
31
+ - [#1873](https://github.com/iTwin/iTwinUI/pull/1873): Fixed `Tab` stripe size and position calculation that sometimes used to cause unnecessary overflow and thus cause a horizontal scrollbar in `TabList`.
32
+ - [#1884](https://github.com/iTwin/iTwinUI/pull/1884): Fixed a bug that caused the `Tabs.Wrapper` to change size dependent on which `Tabs.Tab` was active.
33
+ - [#1901](https://github.com/iTwin/iTwinUI/pull/1901): Fixed a bug in `Table` where `initialState.columnOrder` was not being respected.
34
+ - [#1894](https://github.com/iTwin/iTwinUI/pull/1894): All instances of `box-sizing: content-box` have been reinforced with `!important` to prevent accidental overrides from application styles.
35
+ - [#1828](https://github.com/iTwin/iTwinUI/pull/1828): `InputWithDecorations` now has an inline padding of `1px` to account for the `1px` border's inline edges. This prevents content that touches the border's inline edges from being overlapped by the border by `1px`. Slightly modified expandable `SearchBox` styles to account for the new padding.
36
+
3
37
  ## 3.5.0
4
38
 
5
39
  ### Minor Changes
@@ -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?: {
@@ -40,26 +40,28 @@ const DialogContext_js_1 = require("./DialogContext.js");
40
40
  const DialogButtonBar_js_1 = require("./DialogButtonBar.js");
41
41
  const DialogMain_js_1 = require("./DialogMain.js");
42
42
  const index_js_1 = require("../utils/index.js");
43
+ const react_transition_group_1 = require("react-transition-group");
43
44
  const DialogComponent = React.forwardRef((props, ref) => {
44
45
  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;
45
46
  const dialogRootRef = React.useRef(null);
46
- return (React.createElement(DialogContext_js_1.DialogContext.Provider, { value: {
47
- isOpen,
48
- onClose,
49
- closeOnEsc,
50
- closeOnExternalClick,
51
- isDismissible,
52
- preventDocumentScroll,
53
- trapFocus,
54
- setFocus,
55
- isDraggable,
56
- isResizable,
57
- relativeTo,
58
- dialogRootRef,
59
- placement,
60
- } },
61
- React.createElement(index_js_1.Portal, { portal: portal },
62
- React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-dialog-wrapper', className), "data-iui-relative": relativeTo === 'container', ref: (0, index_js_1.useMergedRefs)(ref, dialogRootRef), ...rest }))));
47
+ return (React.createElement(react_transition_group_1.Transition, { in: isOpen, timeout: { exit: 600 }, mountOnEnter: true, unmountOnExit: true },
48
+ React.createElement(DialogContext_js_1.DialogContext.Provider, { value: {
49
+ isOpen,
50
+ onClose,
51
+ closeOnEsc,
52
+ closeOnExternalClick,
53
+ isDismissible,
54
+ preventDocumentScroll,
55
+ trapFocus,
56
+ setFocus,
57
+ isDraggable,
58
+ isResizable,
59
+ relativeTo,
60
+ dialogRootRef,
61
+ placement,
62
+ } },
63
+ React.createElement(index_js_1.Portal, { portal: portal },
64
+ React.createElement(index_js_1.Box, { className: (0, classnames_1.default)('iui-dialog-wrapper', className), "data-iui-relative": relativeTo === 'container', ref: (0, index_js_1.useMergedRefs)(ref, dialogRootRef), ...rest })))));
63
65
  });
64
66
  /**
65
67
  * 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;
@@ -149,7 +149,7 @@ exports.DialogMain = React.forwardRef((props, ref) => {
149
149
  }
150
150
  }, onResizeEnd: setResizeStyle }))),
151
151
  children));
152
- return (React.createElement(react_transition_group_1.Transition, { in: isOpen, timeout: { exit: 600 },
152
+ return (React.createElement(react_transition_group_1.Transition, { in: isOpen, appear: true, timeout: { exit: 600 },
153
153
  // Focuses dialog when opened
154
154
  onEntered: () => {
155
155
  previousFocusedElement.current = dialogRef.current?.ownerDocument
@@ -63,7 +63,7 @@ exports.DialogTitleBar = Object.assign(React.forwardRef((props, ref) => {
63
63
  'iui-dialog-title-bar-filled': isDraggable,
64
64
  }), ref: ref, onPointerDown: (0, index_js_1.mergeEventHandlers)(onPointerDownProp, onPointerDown), ...rest }, children ? (children) : (React.createElement(React.Fragment, null,
65
65
  React.createElement(DialogTitleBarTitle_js_1.DialogTitleBarTitle, null, titleText),
66
- isDismissible && (React.createElement(IconButton_js_1.IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
66
+ isDismissible && (React.createElement(IconButton_js_1.IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close', "data-iui-shift": 'right' },
67
67
  React.createElement(index_js_1.SvgClose, null)))))));
68
68
  }), {
69
69
  Title: DialogTitleBarTitle_js_1.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
  /**
@@ -53,11 +53,27 @@ const StatusMessage_js_1 = require("../StatusMessage/StatusMessage.js");
53
53
  * </InputGroup>
54
54
  */
55
55
  exports.InputGroup = React.forwardRef((props, forwardedRef) => {
56
- const { className, children, disabled = false, displayStyle = 'default', label, message, status, svgIcon, required = false, labelProps, messageProps, innerProps, ...rest } = props;
56
+ const { className, children, disabled = false, displayStyle = 'default', label, status, required = false, labelProps, innerProps, message, svgIcon, messageProps, ...rest } = props;
57
57
  return (React.createElement(InputGrid_js_1.InputGrid, { ref: forwardedRef, as: 'div', labelPlacement: displayStyle, className: (0, classnames_1.default)('iui-input-group-wrapper', className), "data-iui-status": status, ...rest },
58
58
  label && (React.createElement(Label_js_1.Label, { as: 'label', required: required, disabled: disabled, ...labelProps }, label)),
59
59
  React.createElement(index_js_1.Box, { as: 'div', ...innerProps, className: (0, classnames_1.default)('iui-input-group', innerProps?.className) }, children),
60
- (message || status || svgIcon) && (React.createElement(StatusMessage_js_1.StatusMessage, { iconProps: {
61
- 'aria-hidden': true,
62
- }, startIcon: svgIcon, status: status, ...messageProps }, displayStyle !== 'inline' && message))));
60
+ React.createElement(BottomMessage, { message: message, status: status, svgIcon: svgIcon, displayStyle: displayStyle, messageProps: messageProps })));
63
61
  });
62
+ // ------------------------------------------------------------------------------------------------
63
+ /**
64
+ * @private
65
+ * - When `typeof message !== 'string'`, `message` is returned as-is (e.g. when `message=<StatusMessage />`).
66
+ * - Else, it is wrapped in a `<StatusMessage />`.
67
+ */
68
+ const BottomMessage = (props) => {
69
+ const { message, status, svgIcon, displayStyle, messageProps } = props;
70
+ if (message && typeof message !== 'string') {
71
+ return message;
72
+ }
73
+ if (message || status || svgIcon) {
74
+ return (React.createElement(StatusMessage_js_1.StatusMessage, { iconProps: {
75
+ 'aria-hidden': true,
76
+ }, startIcon: svgIcon, status: status, ...messageProps }, displayStyle !== 'inline' && message));
77
+ }
78
+ return undefined;
79
+ };
@@ -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
  };
@@ -30,32 +30,37 @@ exports.InputWithDecorations = void 0;
30
30
  *--------------------------------------------------------------------------------------------*/
31
31
  const React = __importStar(require("react"));
32
32
  const index_js_1 = require("../utils/index.js");
33
- const IconButton_js_1 = require("../Buttons/IconButton.js");
34
33
  const InputWithDecorationsContext = React.createContext(undefined);
35
34
  const InputWithDecorationsComponent = React.forwardRef((props, ref) => {
36
35
  const { children, size, isDisabled, ...rest } = props;
37
36
  return (React.createElement(InputWithDecorationsContext.Provider, { value: { size, isDisabled } },
38
37
  React.createElement(index_js_1.InputFlexContainer, { isDisabled: isDisabled, size: size, ref: ref, ...rest }, children)));
39
38
  });
40
- //-------------------------------------------------------------------------------
39
+ // ----------------------------------------------------------------------------
41
40
  const InputWithDecorationsInput = React.forwardRef((props, ref) => {
42
41
  const { id: idProp, size, disabled: localDisabled, ...rest } = props;
43
42
  const { size: contextSize, isDisabled } = (0, index_js_1.useSafeContext)(InputWithDecorationsContext);
44
43
  return (React.createElement(index_js_1.Box, { as: 'input', ref: ref, "data-iui-size": size ?? contextSize, disabled: localDisabled ?? isDisabled, id: idProp, ...rest }));
45
44
  });
46
- //-------------------------------------------------------------------------------
45
+ InputWithDecorationsInput.displayName = 'InputWithDecorations.Input';
46
+ // ----------------------------------------------------------------------------
47
47
  const InputWithDecorationsButton = React.forwardRef((props, ref) => {
48
48
  const { children, size, disabled: localDisabled, ...rest } = props;
49
49
  const { size: contextSize, isDisabled } = (0, index_js_1.useSafeContext)(InputWithDecorationsContext);
50
- return (React.createElement(IconButton_js_1.IconButton, { ref: ref, size: size ?? contextSize, styleType: 'borderless', disabled: localDisabled ?? isDisabled, ...rest }, children));
50
+ return (React.createElement(index_js_1.InputFlexContainerButton, { ref: ref, size: size ?? contextSize, disabled: localDisabled ?? isDisabled, ...rest }, children));
51
51
  });
52
+ InputWithDecorationsButton.displayName = 'InputWithDecorations.Button';
53
+ // ----------------------------------------------------------------------------
54
+ const InputWithDecorationsIcon = index_js_1.InputFlexContainerIcon;
55
+ InputWithDecorationsIcon.displayName = 'InputWithDecorations.Icon';
56
+ // ----------------------------------------------------------------------------
52
57
  /**
53
58
  * Input component with various additional decorations.
54
59
  * You can add icons, buttons and other various subcomponents to it.
55
60
  *
56
- * If you are not using default InputWithDecorations.Icon and InputWithDecorations.Button, use borderless versions of other components.
61
+ * If you are not using default `InputWithDecorations.Icon` and `InputWithDecorations.Button`, use borderless versions of other components.
57
62
  *
58
- * @usage
63
+ * @example
59
64
  * <InputWithDecorations>
60
65
  * <InputWithDecorations.Input />
61
66
  * <InputWithDecorations.Icon>
@@ -70,6 +75,16 @@ exports.InputWithDecorations = Object.assign(InputWithDecorationsComponent, {
70
75
  Input: InputWithDecorationsInput,
71
76
  /**
72
77
  * Subcomponent to include button in your InputWithDecorations
78
+ *
79
+ * Although similar to `IconButton`, this subcomponent additionally collapses the padding between the button and the input/textarea
80
+ * in `InputWithDecorations`.
73
81
  */
74
82
  Button: InputWithDecorationsButton,
83
+ /**
84
+ * Subcomponent to include button in your InputWithDecorations.
85
+ *
86
+ * Although similar to `Icon`, this subcomponent additionally collapses the padding between the icon and the input/textarea
87
+ * in `InputWithDecorations`.
88
+ */
89
+ Icon: InputWithDecorationsIcon,
75
90
  });