@itwin/itwinui-react 3.0.0-dev.7 → 3.0.0-dev.8
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 +56 -0
- package/cjs/core/Alert/Alert.d.ts +20 -9
- package/cjs/core/Alert/Alert.js +48 -10
- package/cjs/core/ButtonGroup/ButtonGroup.js +41 -36
- package/cjs/core/Buttons/IconButton/IconButton.js +27 -44
- package/cjs/core/Buttons/SplitButton/SplitButton.js +3 -0
- package/cjs/core/ColorPicker/ColorInputPanel.js +172 -231
- package/cjs/core/ComboBox/ComboBox.js +3 -3
- package/cjs/core/ComboBox/ComboBoxDropdown.js +4 -9
- package/cjs/core/ComboBox/ComboBoxEndIcon.js +3 -22
- package/cjs/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/cjs/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBoxMenuItem.js +8 -6
- package/cjs/core/ComboBox/helpers.d.ts +1 -2
- package/cjs/core/DatePicker/DatePicker.d.ts +30 -8
- package/cjs/core/DatePicker/DatePicker.js +40 -5
- package/cjs/core/Dialog/Dialog.js +10 -16
- package/cjs/core/Dialog/DialogContext.d.ts +3 -4
- package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +38 -15
- package/cjs/core/Header/HeaderSplitButton.js +1 -0
- package/cjs/core/Input/Input.d.ts +4 -0
- package/cjs/core/Input/Input.js +2 -1
- package/cjs/core/InputGrid/InputGrid.d.ts +25 -0
- package/cjs/core/InputGrid/InputGrid.js +39 -0
- package/cjs/core/InputGrid/index.d.ts +3 -0
- package/cjs/core/InputGrid/index.js +15 -0
- package/cjs/core/InputGroup/InputGroup.d.ts +13 -0
- package/cjs/core/InputGroup/InputGroup.js +35 -9
- package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
- package/cjs/core/InputWithDecorations/InputWithDecorations.js +81 -0
- package/cjs/core/InputWithDecorations/index.d.ts +3 -0
- package/cjs/core/InputWithDecorations/index.js +15 -0
- package/cjs/core/Label/Label.d.ts +5 -0
- package/cjs/core/Label/Label.js +2 -0
- package/cjs/core/LabeledInput/LabeledInput.d.ts +22 -16
- package/cjs/core/LabeledInput/LabeledInput.js +52 -29
- package/cjs/core/LabeledSelect/LabeledSelect.d.ts +17 -7
- package/cjs/core/LabeledSelect/LabeledSelect.js +36 -17
- package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
- package/cjs/core/LabeledTextarea/LabeledTextarea.js +12 -45
- package/cjs/core/Menu/Menu.d.ts +1 -1
- package/cjs/core/Menu/Menu.js +1 -1
- package/cjs/core/Menu/MenuDivider.d.ts +2 -1
- package/cjs/core/Menu/MenuDivider.js +1 -1
- package/cjs/core/Menu/MenuItem.d.ts +1 -1
- package/cjs/core/Menu/MenuItem.js +1 -0
- package/cjs/core/Menu/MenuItemSkeleton.d.ts +1 -1
- package/cjs/core/Menu/MenuItemSkeleton.js +0 -1
- package/cjs/core/SearchBox/SearchBox.js +1 -1
- package/cjs/core/Select/Select.d.ts +4 -0
- package/cjs/core/Select/Select.js +10 -9
- package/cjs/core/SideNavigation/SideNavigation.js +2 -0
- package/cjs/core/Slider/Thumb.js +1 -0
- package/cjs/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/cjs/core/StatusMessage/StatusMessage.js +23 -9
- package/cjs/core/Table/SubRowExpander.js +2 -0
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
- package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +46 -18
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
- package/cjs/core/Textarea/Textarea.d.ts +7 -1
- package/cjs/core/Textarea/Textarea.js +6 -11
- package/cjs/core/ThemeProvider/ThemeProvider.js +1 -1
- package/cjs/core/Tile/Tile.d.ts +139 -15
- package/cjs/core/Tile/Tile.js +107 -16
- package/cjs/core/Toast/Toast.d.ts +12 -4
- package/cjs/core/Toast/Toast.js +20 -4
- package/cjs/core/Tooltip/Tooltip.d.ts +35 -28
- package/cjs/core/Tooltip/Tooltip.js +116 -117
- package/cjs/core/TransferList/TransferList.js +4 -12
- package/cjs/core/index.d.ts +2 -0
- package/cjs/core/index.js +20 -4
- package/cjs/core/utils/components/Icon.d.ts +5 -0
- package/cjs/core/utils/components/Icon.js +8 -1
- package/cjs/core/utils/components/InputContainer.d.ts +0 -1
- package/cjs/core/utils/components/InputContainer.js +14 -34
- package/cjs/core/utils/components/InputFlexContainer.d.ts +1 -0
- package/cjs/core/utils/components/InputFlexContainer.js +3 -1
- package/cjs/core/utils/components/Portal.d.ts +27 -0
- package/cjs/core/utils/components/Portal.js +43 -0
- package/cjs/core/utils/components/index.d.ts +1 -0
- package/cjs/core/utils/components/index.js +1 -0
- package/cjs/core/utils/functions/index.d.ts +1 -0
- package/cjs/core/utils/functions/index.js +1 -0
- package/cjs/core/utils/functions/react.d.ts +8 -0
- package/cjs/core/utils/functions/react.js +40 -0
- package/cjs/core/utils/hooks/index.d.ts +1 -1
- package/cjs/core/utils/hooks/index.js +1 -1
- package/cjs/core/utils/hooks/useControlledState.d.ts +13 -0
- package/cjs/core/utils/hooks/useControlledState.js +39 -0
- package/cjs/styles.js +10 -28
- package/esm/core/Alert/Alert.d.ts +20 -9
- package/esm/core/Alert/Alert.js +49 -10
- package/esm/core/ButtonGroup/ButtonGroup.js +41 -36
- package/esm/core/Buttons/IconButton/IconButton.js +25 -40
- package/esm/core/Buttons/SplitButton/SplitButton.js +9 -1
- package/esm/core/ColorPicker/ColorInputPanel.js +173 -232
- package/esm/core/ComboBox/ComboBox.js +3 -3
- package/esm/core/ComboBox/ComboBoxDropdown.js +4 -9
- package/esm/core/ComboBox/ComboBoxEndIcon.js +4 -25
- package/esm/core/ComboBox/ComboBoxMenu.d.ts +2 -2
- package/esm/core/ComboBox/ComboBoxMenuItem.d.ts +1 -1
- package/esm/core/ComboBox/ComboBoxMenuItem.js +9 -7
- package/esm/core/ComboBox/helpers.d.ts +1 -2
- package/esm/core/DatePicker/DatePicker.d.ts +30 -8
- package/esm/core/DatePicker/DatePicker.js +25 -5
- package/esm/core/Dialog/Dialog.js +11 -23
- package/esm/core/Dialog/DialogContext.d.ts +3 -4
- package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +20 -14
- package/esm/core/ExpandableBlock/ExpandableBlock.js +39 -17
- package/esm/core/Header/HeaderSplitButton.js +1 -0
- package/esm/core/Input/Input.d.ts +4 -0
- package/esm/core/Input/Input.js +2 -1
- package/esm/core/InputGrid/InputGrid.d.ts +25 -0
- package/esm/core/InputGrid/InputGrid.js +35 -0
- package/esm/core/InputGrid/index.d.ts +3 -0
- package/esm/core/InputGrid/index.js +6 -0
- package/esm/core/InputGroup/InputGroup.d.ts +13 -0
- package/esm/core/InputGroup/InputGroup.js +34 -10
- package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +39 -0
- package/esm/core/InputWithDecorations/InputWithDecorations.js +80 -0
- package/esm/core/InputWithDecorations/index.d.ts +3 -0
- package/esm/core/InputWithDecorations/index.js +6 -0
- package/esm/core/Label/Label.d.ts +5 -0
- package/esm/core/Label/Label.js +2 -0
- package/esm/core/LabeledInput/LabeledInput.d.ts +22 -16
- package/esm/core/LabeledInput/LabeledInput.js +53 -29
- package/esm/core/LabeledSelect/LabeledSelect.d.ts +17 -7
- package/esm/core/LabeledSelect/LabeledSelect.js +37 -18
- package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +15 -5
- package/esm/core/LabeledTextarea/LabeledTextarea.js +14 -45
- package/esm/core/Menu/Menu.d.ts +1 -1
- package/esm/core/Menu/Menu.js +1 -1
- package/esm/core/Menu/MenuDivider.d.ts +2 -1
- package/esm/core/Menu/MenuDivider.js +1 -1
- package/esm/core/Menu/MenuItem.d.ts +1 -1
- package/esm/core/Menu/MenuItem.js +1 -0
- package/esm/core/Menu/MenuItemSkeleton.d.ts +1 -1
- package/esm/core/Menu/MenuItemSkeleton.js +0 -1
- package/esm/core/SearchBox/SearchBox.js +1 -1
- package/esm/core/Select/Select.d.ts +4 -0
- package/esm/core/Select/Select.js +10 -9
- package/esm/core/SideNavigation/SideNavigation.js +2 -0
- package/esm/core/Slider/Thumb.js +1 -0
- package/esm/core/StatusMessage/StatusMessage.d.ts +12 -2
- package/esm/core/StatusMessage/StatusMessage.js +23 -16
- package/esm/core/Table/SubRowExpander.js +2 -0
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.d.ts +6 -1
- package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +45 -17
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.d.ts +2 -0
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +2 -0
- package/esm/core/Textarea/Textarea.d.ts +7 -1
- package/esm/core/Textarea/Textarea.js +6 -11
- package/esm/core/ThemeProvider/ThemeProvider.js +4 -3
- package/esm/core/Tile/Tile.d.ts +139 -15
- package/esm/core/Tile/Tile.js +107 -16
- package/esm/core/Toast/Toast.d.ts +12 -4
- package/esm/core/Toast/Toast.js +21 -4
- package/esm/core/Tooltip/Tooltip.d.ts +35 -28
- package/esm/core/Tooltip/Tooltip.js +119 -116
- package/esm/core/TransferList/TransferList.js +4 -9
- package/esm/core/index.d.ts +2 -0
- package/esm/core/index.js +2 -0
- package/esm/core/utils/components/Icon.d.ts +5 -0
- package/esm/core/utils/components/Icon.js +8 -1
- package/esm/core/utils/components/InputContainer.d.ts +0 -1
- package/esm/core/utils/components/InputContainer.js +14 -30
- package/esm/core/utils/components/InputFlexContainer.d.ts +1 -0
- package/esm/core/utils/components/InputFlexContainer.js +3 -1
- package/esm/core/utils/components/Portal.d.ts +27 -0
- package/esm/core/utils/components/Portal.js +36 -0
- package/esm/core/utils/components/index.d.ts +1 -0
- package/esm/core/utils/components/index.js +1 -0
- package/esm/core/utils/functions/index.d.ts +1 -0
- package/esm/core/utils/functions/index.js +1 -0
- package/esm/core/utils/functions/react.d.ts +8 -0
- package/esm/core/utils/functions/react.js +35 -0
- package/esm/core/utils/hooks/index.d.ts +1 -1
- package/esm/core/utils/hooks/index.js +1 -1
- package/esm/core/utils/hooks/useControlledState.d.ts +13 -0
- package/esm/core/utils/hooks/useControlledState.js +34 -0
- package/esm/styles.js +10 -28
- package/package.json +3 -3
- package/styles.css +22 -19
- package/cjs/core/utils/hooks/useUncontrolledState.d.ts +0 -6
- package/cjs/core/utils/hooks/useUncontrolledState.js +0 -18
- package/esm/core/utils/hooks/useUncontrolledState.d.ts +0 -6
- package/esm/core/utils/hooks/useUncontrolledState.js +0 -13
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
|
+
import type { InputProps } from '../Input/Input.js';
|
|
4
|
+
/**
|
|
5
|
+
* Input component with various additional decorations.
|
|
6
|
+
* You can add icons, buttons and other various subcomponents to it.
|
|
7
|
+
*
|
|
8
|
+
* If you are not using default InputWithDecorations.Icon and InputWithDecorations.Button, use borderless versions of other components.
|
|
9
|
+
*
|
|
10
|
+
* @usage
|
|
11
|
+
* <InputWithDecorations>
|
|
12
|
+
* <InputWithDecorations.Input />
|
|
13
|
+
* <InputWithDecorations.Icon>
|
|
14
|
+
* <SvgAdd />
|
|
15
|
+
* </InputWithDecorations.Icon>
|
|
16
|
+
* </InputWithDecorations>
|
|
17
|
+
*/
|
|
18
|
+
export declare const InputWithDecorations: PolymorphicForwardRefComponent<"div", Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
19
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
20
|
+
}, "as" | keyof import("../utils/index.js").InputFlexContainerProps> & import("../utils/index.js").InputFlexContainerProps & {
|
|
21
|
+
as?: "div" | undefined;
|
|
22
|
+
}> & {
|
|
23
|
+
/**
|
|
24
|
+
* Subcomponent to include input in your InputWithDecorations
|
|
25
|
+
*/
|
|
26
|
+
Input: PolymorphicForwardRefComponent<"input", InputProps>;
|
|
27
|
+
/**
|
|
28
|
+
* Subcomponent to include button in your InputWithDecorations
|
|
29
|
+
*/
|
|
30
|
+
Button: PolymorphicForwardRefComponent<"span", Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
31
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
32
|
+
}, "label" | "as" | "size" | "htmlDisabled" | "styleType" | "isActive" | "iconProps"> & {
|
|
33
|
+
isActive?: boolean | undefined;
|
|
34
|
+
label?: React.ReactNode;
|
|
35
|
+
iconProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> | undefined;
|
|
36
|
+
} & Omit<import("../Buttons/Button/Button.js").ButtonProps, "startIcon" | "endIcon" | "labelProps" | "startIconProps" | "endIconProps"> & {
|
|
37
|
+
as?: "button" | undefined;
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
exports.InputWithDecorations = void 0;
|
|
4
|
+
const tslib_1 = require('tslib');
|
|
5
|
+
/*---------------------------------------------------------------------------------------------
|
|
6
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
|
+
*--------------------------------------------------------------------------------------------*/
|
|
9
|
+
const React = tslib_1.__importStar(require('react'));
|
|
10
|
+
const index_js_1 = require('../utils/index.js');
|
|
11
|
+
const index_js_2 = require('../Buttons/index.js');
|
|
12
|
+
const InputWithDecorationsContext = React.createContext(undefined);
|
|
13
|
+
const InputWithDecorationsComponent = React.forwardRef((props, ref) => {
|
|
14
|
+
const { children, size, isDisabled, ...rest } = props;
|
|
15
|
+
return React.createElement(
|
|
16
|
+
InputWithDecorationsContext.Provider,
|
|
17
|
+
{ value: { size, isDisabled } },
|
|
18
|
+
React.createElement(
|
|
19
|
+
index_js_1.InputFlexContainer,
|
|
20
|
+
{ isDisabled: isDisabled, size: size, ref: ref, ...rest },
|
|
21
|
+
children,
|
|
22
|
+
),
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
//-------------------------------------------------------------------------------
|
|
26
|
+
const InputWithDecorationsInput = React.forwardRef((props, ref) => {
|
|
27
|
+
const { id: idProp, size, disabled: localDisabled, ...rest } = props;
|
|
28
|
+
const { size: contextSize, isDisabled } = (0, index_js_1.useSafeContext)(
|
|
29
|
+
InputWithDecorationsContext,
|
|
30
|
+
);
|
|
31
|
+
return React.createElement(index_js_1.Box, {
|
|
32
|
+
as: 'input',
|
|
33
|
+
ref: ref,
|
|
34
|
+
'data-iui-size': size ?? contextSize,
|
|
35
|
+
disabled: localDisabled ?? isDisabled,
|
|
36
|
+
id: idProp,
|
|
37
|
+
...rest,
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
//-------------------------------------------------------------------------------
|
|
41
|
+
const InputWithDecorationsButton = React.forwardRef((props, ref) => {
|
|
42
|
+
const { children, size, disabled: localDisabled, ...rest } = props;
|
|
43
|
+
const { size: contextSize, isDisabled } = (0, index_js_1.useSafeContext)(
|
|
44
|
+
InputWithDecorationsContext,
|
|
45
|
+
);
|
|
46
|
+
return React.createElement(
|
|
47
|
+
index_js_2.IconButton,
|
|
48
|
+
{
|
|
49
|
+
ref: ref,
|
|
50
|
+
size: size ?? contextSize,
|
|
51
|
+
styleType: 'borderless',
|
|
52
|
+
disabled: localDisabled ?? isDisabled,
|
|
53
|
+
...rest,
|
|
54
|
+
},
|
|
55
|
+
children,
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* Input component with various additional decorations.
|
|
60
|
+
* You can add icons, buttons and other various subcomponents to it.
|
|
61
|
+
*
|
|
62
|
+
* If you are not using default InputWithDecorations.Icon and InputWithDecorations.Button, use borderless versions of other components.
|
|
63
|
+
*
|
|
64
|
+
* @usage
|
|
65
|
+
* <InputWithDecorations>
|
|
66
|
+
* <InputWithDecorations.Input />
|
|
67
|
+
* <InputWithDecorations.Icon>
|
|
68
|
+
* <SvgAdd />
|
|
69
|
+
* </InputWithDecorations.Icon>
|
|
70
|
+
* </InputWithDecorations>
|
|
71
|
+
*/
|
|
72
|
+
exports.InputWithDecorations = Object.assign(InputWithDecorationsComponent, {
|
|
73
|
+
/**
|
|
74
|
+
* Subcomponent to include input in your InputWithDecorations
|
|
75
|
+
*/
|
|
76
|
+
Input: InputWithDecorationsInput,
|
|
77
|
+
/**
|
|
78
|
+
* Subcomponent to include button in your InputWithDecorations
|
|
79
|
+
*/
|
|
80
|
+
Button: InputWithDecorationsButton,
|
|
81
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
exports.InputWithDecorations = void 0;
|
|
4
|
+
/*---------------------------------------------------------------------------------------------
|
|
5
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
6
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
7
|
+
*--------------------------------------------------------------------------------------------*/
|
|
8
|
+
var InputWithDecorations_js_1 = require('./InputWithDecorations.js');
|
|
9
|
+
Object.defineProperty(exports, 'InputWithDecorations', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return InputWithDecorations_js_1.InputWithDecorations;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
exports.default = './Input';
|
|
@@ -12,6 +12,11 @@ type LabelOwnProps = {
|
|
|
12
12
|
* This adds an asterisk next to the label text.
|
|
13
13
|
*/
|
|
14
14
|
required?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Adds disabled styling to a label.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
15
20
|
};
|
|
16
21
|
/**
|
|
17
22
|
* A standalone label to be used with input components (using `htmlFor`).
|
package/cjs/core/Label/Label.js
CHANGED
|
@@ -20,6 +20,7 @@ exports.Label = React.forwardRef((props, forwardedRef) => {
|
|
|
20
20
|
const {
|
|
21
21
|
displayStyle = 'block',
|
|
22
22
|
required,
|
|
23
|
+
disabled,
|
|
23
24
|
className,
|
|
24
25
|
children,
|
|
25
26
|
...rest
|
|
@@ -36,6 +37,7 @@ exports.Label = React.forwardRef((props, forwardedRef) => {
|
|
|
36
37
|
},
|
|
37
38
|
className,
|
|
38
39
|
),
|
|
40
|
+
'data-iui-disabled': disabled ? true : undefined,
|
|
39
41
|
ref: forwardedRef,
|
|
40
42
|
...rest,
|
|
41
43
|
},
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { Input } from '../Input/Input.js';
|
|
3
|
+
import { Icon } from '../utils/index.js';
|
|
3
4
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
5
|
+
import { InputGrid } from '../InputGrid/index.js';
|
|
6
|
+
import { InputWithDecorations } from '../InputWithDecorations/index.js';
|
|
4
7
|
export type LabeledInputProps = {
|
|
5
8
|
/**
|
|
6
9
|
* Label of the input.
|
|
@@ -17,15 +20,11 @@ export type LabeledInputProps = {
|
|
|
17
20
|
/**
|
|
18
21
|
* Custom svg icon. Will override status icon if specified.
|
|
19
22
|
*/
|
|
20
|
-
svgIcon?: JSX.Element;
|
|
23
|
+
svgIcon?: JSX.Element | null;
|
|
21
24
|
/**
|
|
22
|
-
*
|
|
25
|
+
* Pass props to wrapper element.
|
|
23
26
|
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Custom CSS Style for the input element.
|
|
27
|
-
*/
|
|
28
|
-
inputStyle?: React.CSSProperties;
|
|
27
|
+
wrapperProps?: React.ComponentProps<typeof InputGrid>;
|
|
29
28
|
/**
|
|
30
29
|
* Set display style of label.
|
|
31
30
|
* Supported values:
|
|
@@ -35,15 +34,22 @@ export type LabeledInputProps = {
|
|
|
35
34
|
*/
|
|
36
35
|
displayStyle?: 'default' | 'inline';
|
|
37
36
|
/**
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*
|
|
43
|
-
|
|
37
|
+
* Passes properties for message content.
|
|
38
|
+
*/
|
|
39
|
+
messageContentProps?: React.ComponentPropsWithRef<'div'>;
|
|
40
|
+
/**
|
|
41
|
+
* Passes properties for icon.
|
|
42
|
+
*/
|
|
43
|
+
iconProps?: React.ComponentProps<typeof Icon>;
|
|
44
|
+
/**
|
|
45
|
+
* Passes properties for label.
|
|
46
|
+
*/
|
|
47
|
+
labelProps?: React.ComponentProps<'label'>;
|
|
48
|
+
/**
|
|
49
|
+
* Passes properties for input wrapper.
|
|
44
50
|
*/
|
|
45
|
-
|
|
46
|
-
} &
|
|
51
|
+
inputWrapperProps?: React.ComponentProps<typeof InputWithDecorations>;
|
|
52
|
+
} & React.ComponentProps<typeof Input>;
|
|
47
53
|
/**
|
|
48
54
|
* Basic labeled input component
|
|
49
55
|
* @example
|
|
@@ -7,8 +7,11 @@ const tslib_1 = require('tslib');
|
|
|
7
7
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
8
|
*--------------------------------------------------------------------------------------------*/
|
|
9
9
|
const React = tslib_1.__importStar(require('react'));
|
|
10
|
-
const Input_js_1 = require('../Input/Input.js');
|
|
11
10
|
const index_js_1 = require('../utils/index.js');
|
|
11
|
+
const index_js_2 = require('../InputGrid/index.js');
|
|
12
|
+
const index_js_3 = require('../InputWithDecorations/index.js');
|
|
13
|
+
const StatusMessage_js_1 = require('../StatusMessage/StatusMessage.js');
|
|
14
|
+
const Label_js_1 = require('../Label/Label.js');
|
|
12
15
|
/**
|
|
13
16
|
* Basic labeled input component
|
|
14
17
|
* @example
|
|
@@ -20,46 +23,66 @@ const index_js_1 = require('../utils/index.js');
|
|
|
20
23
|
exports.LabeledInput = React.forwardRef((props, ref) => {
|
|
21
24
|
const uid = (0, index_js_1.useId)();
|
|
22
25
|
const {
|
|
23
|
-
className,
|
|
24
26
|
disabled = false,
|
|
25
27
|
label,
|
|
26
28
|
message,
|
|
27
29
|
status,
|
|
28
30
|
svgIcon,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
wrapperProps,
|
|
32
|
+
labelProps,
|
|
33
|
+
messageContentProps,
|
|
34
|
+
iconProps,
|
|
35
|
+
inputWrapperProps,
|
|
32
36
|
displayStyle = 'default',
|
|
33
|
-
iconDisplayStyle = displayStyle === 'default' ? 'block' : 'inline',
|
|
34
37
|
required = false,
|
|
35
38
|
id = uid,
|
|
36
39
|
...rest
|
|
37
40
|
} = props;
|
|
38
41
|
const icon = svgIcon ?? (status && index_js_1.StatusIconMap[status]());
|
|
42
|
+
const shouldShowIcon = svgIcon !== null && (svgIcon || (status && !message));
|
|
39
43
|
return React.createElement(
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
React.createElement(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
44
|
+
index_js_2.InputGrid,
|
|
45
|
+
{ labelPlacement: displayStyle, ...wrapperProps },
|
|
46
|
+
label &&
|
|
47
|
+
React.createElement(
|
|
48
|
+
Label_js_1.Label,
|
|
49
|
+
{
|
|
50
|
+
as: 'label',
|
|
51
|
+
required: required,
|
|
52
|
+
disabled: disabled,
|
|
53
|
+
htmlFor: id,
|
|
54
|
+
...labelProps,
|
|
55
|
+
},
|
|
56
|
+
label,
|
|
57
|
+
),
|
|
58
|
+
React.createElement(
|
|
59
|
+
index_js_3.InputWithDecorations,
|
|
60
|
+
{ status: status, isDisabled: disabled, ...inputWrapperProps },
|
|
61
|
+
React.createElement(index_js_3.InputWithDecorations.Input, {
|
|
62
|
+
disabled: disabled,
|
|
63
|
+
required: required,
|
|
64
|
+
id: id,
|
|
65
|
+
ref: ref,
|
|
66
|
+
...rest,
|
|
67
|
+
}),
|
|
68
|
+
shouldShowIcon &&
|
|
69
|
+
React.createElement(
|
|
70
|
+
index_js_1.Icon,
|
|
71
|
+
{ fill: !svgIcon ? status : undefined, padded: true, ...iconProps },
|
|
72
|
+
icon,
|
|
73
|
+
),
|
|
74
|
+
),
|
|
75
|
+
typeof message === 'string'
|
|
76
|
+
? React.createElement(
|
|
77
|
+
StatusMessage_js_1.StatusMessage,
|
|
78
|
+
{
|
|
79
|
+
status: status,
|
|
80
|
+
iconProps: iconProps,
|
|
81
|
+
contentProps: messageContentProps,
|
|
82
|
+
},
|
|
83
|
+
message,
|
|
84
|
+
)
|
|
85
|
+
: message,
|
|
63
86
|
);
|
|
64
87
|
});
|
|
65
88
|
exports.default = exports.LabeledInput;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { SelectProps } from '../Select/Select.js';
|
|
3
|
+
import { Icon } from '../utils/index.js';
|
|
3
4
|
import type { LabeledInputProps } from '../LabeledInput/LabeledInput.js';
|
|
5
|
+
import { InputGrid } from '../InputGrid/InputGrid.js';
|
|
4
6
|
export type LabeledSelectProps<T> = {
|
|
5
7
|
/**
|
|
6
8
|
* Label of the select.
|
|
@@ -20,18 +22,26 @@ export type LabeledSelectProps<T> = {
|
|
|
20
22
|
*/
|
|
21
23
|
svgIcon?: JSX.Element;
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
25
|
+
* If true, shows a red asterisk but does not prevent form submission.
|
|
26
|
+
* @default false
|
|
24
27
|
*/
|
|
25
|
-
|
|
28
|
+
required?: boolean;
|
|
26
29
|
/**
|
|
27
|
-
*
|
|
30
|
+
* Pass props to wrapper element.
|
|
28
31
|
*/
|
|
29
|
-
|
|
32
|
+
wrapperProps?: React.ComponentProps<typeof InputGrid>;
|
|
30
33
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @default false
|
|
34
|
+
* Passes properties for label.
|
|
33
35
|
*/
|
|
34
|
-
|
|
36
|
+
labelProps?: React.ComponentProps<'div'>;
|
|
37
|
+
/**
|
|
38
|
+
* Passes properties for message content.
|
|
39
|
+
*/
|
|
40
|
+
messageContentProps?: React.ComponentPropsWithRef<'div'>;
|
|
41
|
+
/**
|
|
42
|
+
* Passes properties for message icon.
|
|
43
|
+
*/
|
|
44
|
+
messageIconProps?: React.ComponentProps<typeof Icon>;
|
|
35
45
|
} & Pick<LabeledInputProps, 'displayStyle'> & SelectProps<T>;
|
|
36
46
|
/**
|
|
37
47
|
* Labeled select component to select value from options.
|
|
@@ -9,6 +9,9 @@ const tslib_1 = require('tslib');
|
|
|
9
9
|
const React = tslib_1.__importStar(require('react'));
|
|
10
10
|
const index_js_1 = require('../Select/index.js');
|
|
11
11
|
const index_js_2 = require('../utils/index.js');
|
|
12
|
+
const StatusMessage_js_1 = require('../StatusMessage/StatusMessage.js');
|
|
13
|
+
const InputGrid_js_1 = require('../InputGrid/InputGrid.js');
|
|
14
|
+
const Label_js_1 = require('../Label/Label.js');
|
|
12
15
|
/**
|
|
13
16
|
* Labeled select component to select value from options.
|
|
14
17
|
* @example
|
|
@@ -52,16 +55,18 @@ const LabeledSelect = (props) => {
|
|
|
52
55
|
svgIcon,
|
|
53
56
|
displayStyle = 'default',
|
|
54
57
|
style,
|
|
55
|
-
selectClassName,
|
|
56
|
-
selectStyle,
|
|
57
58
|
required = false,
|
|
58
59
|
triggerProps,
|
|
60
|
+
wrapperProps,
|
|
61
|
+
labelProps,
|
|
62
|
+
messageContentProps,
|
|
63
|
+
messageIconProps,
|
|
59
64
|
...rest
|
|
60
65
|
} = props;
|
|
61
66
|
const labelId = `${(0, index_js_2.useId)()}-label`;
|
|
62
67
|
const icon = () => {
|
|
63
68
|
if (svgIcon) {
|
|
64
|
-
return React.
|
|
69
|
+
return React.createElement(index_js_2.Icon, null, svgIcon);
|
|
65
70
|
}
|
|
66
71
|
if (status && message) {
|
|
67
72
|
return index_js_2.StatusIconMap[status]();
|
|
@@ -69,29 +74,43 @@ const LabeledSelect = (props) => {
|
|
|
69
74
|
return undefined;
|
|
70
75
|
};
|
|
71
76
|
return React.createElement(
|
|
72
|
-
|
|
73
|
-
{
|
|
74
|
-
|
|
77
|
+
InputGrid_js_1.InputGrid,
|
|
78
|
+
{ labelPlacement: displayStyle, ...wrapperProps },
|
|
79
|
+
label &&
|
|
80
|
+
React.createElement(
|
|
81
|
+
Label_js_1.Label,
|
|
82
|
+
{
|
|
83
|
+
as: 'div',
|
|
84
|
+
required: required,
|
|
85
|
+
disabled: disabled,
|
|
86
|
+
id: labelId,
|
|
87
|
+
...labelProps,
|
|
88
|
+
},
|
|
89
|
+
label,
|
|
90
|
+
),
|
|
91
|
+
React.createElement(index_js_1.Select, {
|
|
75
92
|
disabled: disabled,
|
|
76
|
-
required: required,
|
|
77
|
-
status: status,
|
|
78
|
-
message: message,
|
|
79
|
-
icon: displayStyle === 'default' ? icon() : undefined,
|
|
80
|
-
isLabelInline: displayStyle === 'inline',
|
|
81
93
|
className: className,
|
|
82
94
|
style: style,
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
React.createElement(index_js_1.Select, {
|
|
86
|
-
disabled: disabled,
|
|
87
|
-
className: selectClassName,
|
|
88
|
-
style: selectStyle,
|
|
95
|
+
status: status,
|
|
89
96
|
...rest,
|
|
90
97
|
triggerProps: {
|
|
91
98
|
'aria-labelledby': labelId,
|
|
92
99
|
...triggerProps,
|
|
93
100
|
},
|
|
94
101
|
}),
|
|
102
|
+
typeof message === 'string'
|
|
103
|
+
? React.createElement(
|
|
104
|
+
StatusMessage_js_1.StatusMessage,
|
|
105
|
+
{
|
|
106
|
+
status: status,
|
|
107
|
+
startIcon: displayStyle === 'default' ? icon() : undefined,
|
|
108
|
+
iconProps: messageIconProps,
|
|
109
|
+
contentProps: messageContentProps,
|
|
110
|
+
},
|
|
111
|
+
message,
|
|
112
|
+
)
|
|
113
|
+
: message,
|
|
95
114
|
);
|
|
96
115
|
};
|
|
97
116
|
exports.LabeledSelect = LabeledSelect;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { Icon } from '../utils/index.js';
|
|
2
3
|
import type { PolymorphicForwardRefComponent } from '../utils/index.js';
|
|
3
4
|
import type { LabeledInputProps } from '../LabeledInput/LabeledInput.js';
|
|
5
|
+
import { InputGrid } from '../InputGrid/InputGrid.js';
|
|
4
6
|
type LabeledTextareaProps = {
|
|
5
7
|
/**
|
|
6
8
|
* Label for the textarea.
|
|
@@ -15,14 +17,22 @@ type LabeledTextareaProps = {
|
|
|
15
17
|
*/
|
|
16
18
|
status?: 'positive' | 'warning' | 'negative';
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
20
|
+
* Pass props to wrapper element.
|
|
19
21
|
*/
|
|
20
|
-
|
|
22
|
+
wrapperProps?: React.ComponentProps<typeof InputGrid>;
|
|
21
23
|
/**
|
|
22
|
-
*
|
|
24
|
+
* Passes properties for label.
|
|
23
25
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
labelProps?: React.ComponentProps<'label'>;
|
|
27
|
+
/**
|
|
28
|
+
* Passes properties for message content.
|
|
29
|
+
*/
|
|
30
|
+
messageContentProps?: React.ComponentPropsWithRef<'div'>;
|
|
31
|
+
/**
|
|
32
|
+
* Passes properties for svgIcon.
|
|
33
|
+
*/
|
|
34
|
+
iconProps?: React.ComponentProps<typeof Icon>;
|
|
35
|
+
} & Pick<LabeledInputProps, 'svgIcon' | 'displayStyle'>;
|
|
26
36
|
/**
|
|
27
37
|
* Textarea wrapper that allows for additional styling and labelling
|
|
28
38
|
* @example
|
|
@@ -7,8 +7,7 @@ const tslib_1 = require('tslib');
|
|
|
7
7
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
8
|
*--------------------------------------------------------------------------------------------*/
|
|
9
9
|
const React = tslib_1.__importStar(require('react'));
|
|
10
|
-
const index_js_1 = require('../
|
|
11
|
-
const index_js_2 = require('../Textarea/index.js');
|
|
10
|
+
const index_js_1 = require('../LabeledInput/index.js');
|
|
12
11
|
/**
|
|
13
12
|
* Textarea wrapper that allows for additional styling and labelling
|
|
14
13
|
* @example
|
|
@@ -30,49 +29,17 @@ const index_js_2 = require('../Textarea/index.js');
|
|
|
30
29
|
* status='negative'
|
|
31
30
|
* />
|
|
32
31
|
*/
|
|
33
|
-
exports.LabeledTextarea = React.forwardRef((props,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
displayStyle = 'default',
|
|
45
|
-
iconDisplayStyle = displayStyle === 'default' ? 'block' : 'inline',
|
|
46
|
-
svgIcon,
|
|
47
|
-
required = false,
|
|
48
|
-
id = uid,
|
|
49
|
-
...textareaProps
|
|
50
|
-
} = props;
|
|
51
|
-
const icon = svgIcon ?? (status && index_js_1.StatusIconMap[status]());
|
|
52
|
-
return React.createElement(
|
|
53
|
-
index_js_1.InputContainer,
|
|
54
|
-
{
|
|
55
|
-
label: label,
|
|
56
|
-
disabled: disabled,
|
|
57
|
-
required: required,
|
|
58
|
-
status: status,
|
|
59
|
-
message: message,
|
|
60
|
-
icon: icon,
|
|
61
|
-
isLabelInline: displayStyle === 'inline',
|
|
62
|
-
isIconInline: iconDisplayStyle === 'inline',
|
|
63
|
-
className: className,
|
|
64
|
-
style: style,
|
|
65
|
-
inputId: id,
|
|
66
|
-
},
|
|
67
|
-
React.createElement(index_js_2.Textarea, {
|
|
68
|
-
disabled: disabled,
|
|
69
|
-
className: textareaClassName,
|
|
70
|
-
style: textareaStyle,
|
|
71
|
-
required: required,
|
|
72
|
-
id: id,
|
|
73
|
-
...textareaProps,
|
|
74
|
-
ref: ref,
|
|
75
|
-
}),
|
|
32
|
+
exports.LabeledTextarea = React.forwardRef((props, forwardedRef) => {
|
|
33
|
+
return (
|
|
34
|
+
// ref types don't match but it's internal, so ts-ignore is ok here
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
React.createElement(index_js_1.LabeledInput, {
|
|
38
|
+
as: 'textarea',
|
|
39
|
+
rows: 3,
|
|
40
|
+
ref: forwardedRef,
|
|
41
|
+
...props,
|
|
42
|
+
})
|
|
76
43
|
);
|
|
77
44
|
});
|
|
78
45
|
exports.default = exports.LabeledTextarea;
|
package/cjs/core/Menu/Menu.d.ts
CHANGED
|
@@ -17,5 +17,5 @@ type MenuProps = {
|
|
|
17
17
|
/**
|
|
18
18
|
* Basic menu component. Can be used for select or dropdown components.
|
|
19
19
|
*/
|
|
20
|
-
export declare const Menu: PolymorphicForwardRefComponent<"
|
|
20
|
+
export declare const Menu: PolymorphicForwardRefComponent<"div", MenuProps>;
|
|
21
21
|
export default Menu;
|
package/cjs/core/Menu/Menu.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
/**
|
|
2
3
|
* Divider between menu items. Should be used inside `Menu`.
|
|
3
4
|
* @example
|
|
@@ -13,5 +14,5 @@
|
|
|
13
14
|
* ]}
|
|
14
15
|
* </Menu>
|
|
15
16
|
*/
|
|
16
|
-
export declare const MenuDivider: import("../utils/props.js").PolymorphicForwardRefComponent<
|
|
17
|
+
export declare const MenuDivider: import("../utils/props.js").PolymorphicForwardRefComponent<NonNullable<keyof JSX.IntrinsicElements>, {}>;
|
|
17
18
|
export default MenuDivider;
|
|
@@ -21,7 +21,7 @@ const index_js_1 = require('../utils/index.js');
|
|
|
21
21
|
* ]}
|
|
22
22
|
* </Menu>
|
|
23
23
|
*/
|
|
24
|
-
exports.MenuDivider = index_js_1.polymorphic
|
|
24
|
+
exports.MenuDivider = (0, index_js_1.polymorphic)('iui-menu-divider', {
|
|
25
25
|
role: 'separator',
|
|
26
26
|
});
|
|
27
27
|
exports.default = exports.MenuDivider;
|
|
@@ -64,5 +64,5 @@ export type MenuItemProps = {
|
|
|
64
64
|
/**
|
|
65
65
|
* Basic menu item component. Should be used inside `Menu` component for each item.
|
|
66
66
|
*/
|
|
67
|
-
export declare const MenuItem: PolymorphicForwardRefComponent<"
|
|
67
|
+
export declare const MenuItem: PolymorphicForwardRefComponent<"div", MenuItemProps>;
|
|
68
68
|
export default MenuItem;
|
|
@@ -26,5 +26,5 @@ type MenuItemSkeletonProps = {
|
|
|
26
26
|
/**
|
|
27
27
|
* Menu item that uses skeletons to indicate loading state.
|
|
28
28
|
*/
|
|
29
|
-
export declare const MenuItemSkeleton: PolymorphicForwardRefComponent<"
|
|
29
|
+
export declare const MenuItemSkeleton: PolymorphicForwardRefComponent<"div", MenuItemSkeletonProps>;
|
|
30
30
|
export default MenuItemSkeleton;
|
|
@@ -25,7 +25,6 @@ exports.MenuItemSkeleton = React.forwardRef((props, forwardedRef) => {
|
|
|
25
25
|
return React.createElement(
|
|
26
26
|
index_js_1.Box,
|
|
27
27
|
{
|
|
28
|
-
as: 'li',
|
|
29
28
|
className: (0, classnames_1.default)('iui-menu-item-skeleton', className),
|
|
30
29
|
'data-iui-size': hasSublabel && 'large',
|
|
31
30
|
style: {
|