@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.
- package/CHANGELOG.md +28 -0
- package/cjs/core/Carousel/Carousel.d.ts +4 -4
- package/cjs/core/Carousel/CarouselNavigation.d.ts +4 -4
- package/cjs/core/Dialog/Dialog.js +19 -17
- package/cjs/core/Dialog/DialogContext.d.ts +4 -0
- package/cjs/core/Dialog/DialogMain.js +1 -1
- package/cjs/core/Dialog/DialogTitleBar.js +1 -1
- package/cjs/core/InputGroup/InputGroup.d.ts +4 -0
- package/cjs/core/InputGroup/InputGroup.js +20 -4
- package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +18 -62
- package/cjs/core/InputWithDecorations/InputWithDecorations.js +21 -6
- package/cjs/core/LabeledSelect/LabeledSelect.d.ts +376 -4
- package/cjs/core/LabeledSelect/LabeledSelect.js +1 -1
- package/cjs/core/Popover/Popover.d.ts +6 -3
- package/cjs/core/SearchBox/SearchBox.js +4 -6
- package/cjs/core/Select/Select.d.ts +194 -101
- package/cjs/core/Select/Select.js +71 -18
- package/cjs/core/Table/Table.js +2 -1
- package/cjs/core/Tabs/Tabs.js +19 -3
- package/cjs/core/Tile/Tile.d.ts +2 -2
- package/cjs/core/utils/components/InputFlexContainer.d.ts +25 -0
- package/cjs/core/utils/components/InputFlexContainer.js +19 -1
- package/cjs/core/utils/components/LineClamp.d.ts +5 -0
- package/cjs/core/utils/components/LineClamp.js +49 -0
- package/cjs/core/utils/components/index.d.ts +1 -0
- package/cjs/core/utils/components/index.js +1 -0
- package/cjs/core/utils/icons/SvgStatusError.js +1 -1
- package/esm/core/Carousel/Carousel.d.ts +4 -4
- package/esm/core/Carousel/CarouselNavigation.d.ts +4 -4
- package/esm/core/Dialog/Dialog.js +19 -17
- package/esm/core/Dialog/DialogContext.d.ts +4 -0
- package/esm/core/Dialog/DialogMain.js +1 -1
- package/esm/core/Dialog/DialogTitleBar.js +1 -1
- package/esm/core/InputGroup/InputGroup.d.ts +4 -0
- package/esm/core/InputGroup/InputGroup.js +20 -4
- package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +18 -62
- package/esm/core/InputWithDecorations/InputWithDecorations.js +22 -7
- package/esm/core/LabeledSelect/LabeledSelect.d.ts +376 -4
- package/esm/core/LabeledSelect/LabeledSelect.js +1 -1
- package/esm/core/Popover/Popover.d.ts +6 -3
- package/esm/core/SearchBox/SearchBox.js +5 -7
- package/esm/core/Select/Select.d.ts +194 -101
- package/esm/core/Select/Select.js +72 -19
- package/esm/core/Table/Table.js +2 -1
- package/esm/core/Tabs/Tabs.js +19 -3
- package/esm/core/Tile/Tile.d.ts +2 -2
- package/esm/core/utils/components/InputFlexContainer.d.ts +25 -0
- package/esm/core/utils/components/InputFlexContainer.js +18 -0
- package/esm/core/utils/components/LineClamp.d.ts +5 -0
- package/esm/core/utils/components/LineClamp.js +23 -0
- package/esm/core/utils/components/index.d.ts +1 -0
- package/esm/core/utils/components/index.js +1 -0
- package/esm/core/utils/icons/SvgStatusError.js +1 -1
- package/package.json +27 -27
- 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
|
+
`;
|
|
@@ -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: '
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
React.createElement(
|
|
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,
|
|
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
|
|
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
|
|
8
|
+
* If you are not using default `InputWithDecorations.Icon` and `InputWithDecorations.Button`, use borderless versions of other components.
|
|
9
9
|
*
|
|
10
|
-
* @
|
|
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<"
|
|
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
|
-
|
|
34
|
-
|
|
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(
|
|
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
|
|
35
|
+
* If you are not using default `InputWithDecorations.Icon` and `InputWithDecorations.Button`, use borderless versions of other components.
|
|
31
36
|
*
|
|
32
|
-
* @
|
|
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
|
});
|