@itwin/itwinui-react 1.32.0-dev.0 → 1.33.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.
- package/CHANGELOG.md +33 -0
- package/cjs/core/ButtonGroup/ButtonGroup.d.ts +6 -1
- package/cjs/core/ButtonGroup/ButtonGroup.js +6 -3
- package/cjs/core/Checkbox/Checkbox.d.ts +13 -0
- package/cjs/core/Checkbox/Checkbox.js +15 -22
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/ComboBox/ComboBox.d.ts +17 -1
- package/cjs/core/ComboBox/ComboBox.js +55 -20
- package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +6 -0
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +3 -2
- package/cjs/core/Footer/Footer.d.ts +14 -2
- package/cjs/core/Footer/Footer.js +40 -17
- package/cjs/core/InputGroup/InputGroup.js +12 -2
- package/cjs/core/LabeledSelect/LabeledSelect.js +10 -4
- package/cjs/core/Menu/Menu.js +3 -3
- package/cjs/core/Radio/Radio.d.ts +13 -0
- package/cjs/core/Radio/Radio.js +7 -8
- package/cjs/core/Slider/Slider.js +10 -1
- package/cjs/core/StatusMessage/StatusMessage.d.ts +24 -0
- package/cjs/core/StatusMessage/StatusMessage.js +39 -0
- package/cjs/core/StatusMessage/index.d.ts +4 -0
- package/cjs/core/StatusMessage/index.js +10 -0
- package/cjs/core/Table/hooks/useSelectionCell.js +1 -2
- package/cjs/core/Tree/Tree.d.ts +123 -0
- package/cjs/core/Tree/Tree.js +177 -0
- package/cjs/core/Tree/TreeContext.d.ts +25 -0
- package/cjs/core/Tree/TreeContext.js +20 -0
- package/cjs/core/Tree/TreeNode.d.ts +87 -0
- package/cjs/core/Tree/TreeNode.js +169 -0
- package/cjs/core/Tree/TreeNodeExpander.d.ts +8 -0
- package/cjs/core/Tree/TreeNodeExpander.js +46 -0
- package/cjs/core/Tree/index.d.ts +6 -0
- package/cjs/core/Tree/index.js +13 -0
- package/cjs/core/index.d.ts +4 -0
- package/cjs/core/index.js +7 -1
- package/cjs/core/utils/components/InputContainer.d.ts +1 -0
- package/cjs/core/utils/components/InputContainer.js +8 -7
- package/cjs/core/utils/functions/focusable.js +6 -2
- package/cjs/core/utils/hooks/useIntersection.d.ts +4 -3
- package/cjs/core/utils/hooks/useIntersection.js +10 -5
- package/cjs/core/utils/hooks/useOverflow.d.ts +3 -2
- package/cjs/core/utils/hooks/useOverflow.js +24 -21
- package/esm/core/ButtonGroup/ButtonGroup.d.ts +6 -1
- package/esm/core/ButtonGroup/ButtonGroup.js +6 -3
- package/esm/core/Checkbox/Checkbox.d.ts +13 -0
- package/esm/core/Checkbox/Checkbox.js +15 -22
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/ComboBox/ComboBox.d.ts +17 -1
- package/esm/core/ComboBox/ComboBox.js +56 -21
- package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +6 -0
- package/esm/core/ExpandableBlock/ExpandableBlock.js +3 -2
- package/esm/core/Footer/Footer.d.ts +14 -2
- package/esm/core/Footer/Footer.js +40 -17
- package/esm/core/InputGroup/InputGroup.js +12 -2
- package/esm/core/LabeledSelect/LabeledSelect.js +10 -4
- package/esm/core/Menu/Menu.js +3 -3
- package/esm/core/Radio/Radio.d.ts +13 -0
- package/esm/core/Radio/Radio.js +7 -8
- package/esm/core/Slider/Slider.js +10 -1
- package/esm/core/StatusMessage/StatusMessage.d.ts +24 -0
- package/esm/core/StatusMessage/StatusMessage.js +32 -0
- package/esm/core/StatusMessage/index.d.ts +4 -0
- package/esm/core/StatusMessage/index.js +6 -0
- package/esm/core/Table/hooks/useSelectionCell.js +1 -2
- package/esm/core/Tree/Tree.d.ts +123 -0
- package/esm/core/Tree/Tree.js +170 -0
- package/esm/core/Tree/TreeContext.d.ts +25 -0
- package/esm/core/Tree/TreeContext.js +13 -0
- package/esm/core/Tree/TreeNode.d.ts +87 -0
- package/esm/core/Tree/TreeNode.js +162 -0
- package/esm/core/Tree/TreeNodeExpander.d.ts +8 -0
- package/esm/core/Tree/TreeNodeExpander.js +39 -0
- package/esm/core/Tree/index.d.ts +6 -0
- package/esm/core/Tree/index.js +7 -0
- package/esm/core/index.d.ts +4 -0
- package/esm/core/index.js +2 -0
- package/esm/core/utils/components/InputContainer.d.ts +1 -0
- package/esm/core/utils/components/InputContainer.js +8 -7
- package/esm/core/utils/functions/focusable.js +6 -2
- package/esm/core/utils/hooks/useIntersection.d.ts +4 -3
- package/esm/core/utils/hooks/useIntersection.js +10 -5
- package/esm/core/utils/hooks/useOverflow.d.ts +3 -2
- package/esm/core/utils/hooks/useOverflow.js +24 -21
- package/package.json +15 -14
|
@@ -32,6 +32,7 @@ import '@itwin/itwinui-css/css/inputs.css';
|
|
|
32
32
|
/**
|
|
33
33
|
* Simple input checkbox
|
|
34
34
|
* @example
|
|
35
|
+
* <Checkbox />
|
|
35
36
|
* <Checkbox label='Basic Checkbox' />
|
|
36
37
|
* <Checkbox label='Disabled Checkbox' disabled />
|
|
37
38
|
* <Checkbox label='Checked' checked />
|
|
@@ -41,8 +42,8 @@ import '@itwin/itwinui-css/css/inputs.css';
|
|
|
41
42
|
* <Checkbox label='Visibility Checkbox' variant='eyeball' />
|
|
42
43
|
*/
|
|
43
44
|
export var Checkbox = React.forwardRef(function (props, ref) {
|
|
44
|
-
var _a;
|
|
45
|
-
var className = props.className,
|
|
45
|
+
var _a, _b;
|
|
46
|
+
var className = props.className, _c = props.disabled, disabled = _c === void 0 ? false : _c, _d = props.indeterminate, indeterminate = _d === void 0 ? false : _d, label = props.label, status = props.status, _e = props.variant, variant = _e === void 0 ? 'default' : _e, setFocus = props.setFocus, _f = props.isLoading, isLoading = _f === void 0 ? false : _f, style = props.style, checkmarkClassName = props.checkmarkClassName, checkmarkStyle = props.checkmarkStyle, rest = __rest(props, ["className", "disabled", "indeterminate", "label", "status", "variant", "setFocus", "isLoading", "style", "checkmarkClassName", "checkmarkStyle"]);
|
|
46
47
|
useTheme();
|
|
47
48
|
var inputElementRef = React.useRef(null);
|
|
48
49
|
var refs = useMergedRefs(inputElementRef, ref);
|
|
@@ -59,27 +60,19 @@ export var Checkbox = React.forwardRef(function (props, ref) {
|
|
|
59
60
|
: inputElementRef.current.checked;
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
|
-
var
|
|
63
|
-
React.createElement("
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
React.createElement(
|
|
68
|
-
|
|
69
|
-
React.createElement("path", { d: 'm8 0a1 1 0 0 0 -1 1v2.07135a8.91637 8.91637 0 0 0 -7 4.92865 8.91637 8.91637 0 0 0 7 4.92865v2.07135a1 1 0 0 0 2 0v-14a1 1 0 0 0 -1-1zm-1.5 4.9a1.55426 1.55426 0 0 1 .5.087v2.81451a1.40746 1.40746 0 0 1 -.5.09849 1.538 1.538 0 0 1 -1.5-1.5 1.53794 1.53794 0 0 1 1.5-1.5zm-2.3 5.4a6.97279 6.97279 0 0 1 -2.5-2.3 6.89429 6.89429 0 0 1 2.4-2.4c.1 0 .1-.1.2-.1a3.194 3.194 0 0 0 -.3 1.4 4.0047 4.0047 0 0 0 3 3.857v.65289a6.37491 6.37491 0 0 1 -2.8-1.10989z' })),
|
|
70
|
-
React.createElement("path", { className: 'iui-uncheck', d: 'm1.70671 12.879 11.17218-11.17219 1.4142 1.4142-11.17218 11.17218zm.99329-1.679 1.1-1.1a5.06317 5.06317 0 0 1 -2-2.1 7.48268 7.48268 0 0 1 6.2-3.5 4.86877 4.86877 0 0 1 1.2.1l1.3-1.3a10.07431 10.07431 0 0 0 -2.5-.3 8.84129 8.84129 0 0 0 -8 5 8.42455 8.42455 0 0 0 2.7 3.2zm10.7-6.4-1.1 1.1a7.08625 7.08625 0 0 1 2 2.1 7.50323 7.50323 0 0 1 -6.2 3.5 8.31665 8.31665 0 0 1 -1.3-.2l-1.3 1.3a8.909 8.909 0 0 0 6.4-.5 9.04344 9.04344 0 0 0 4.1-4.1 9.168 9.168 0 0 0 -2.6-3.2z' })));
|
|
71
|
-
return (React.createElement("label", { className: cx('iui-checkbox', (_a = {
|
|
63
|
+
var checkbox = (React.createElement(React.Fragment, null,
|
|
64
|
+
React.createElement("input", __assign({ className: cx('iui-checkbox', {
|
|
65
|
+
'iui-checkbox-visibility': variant === 'eyeball',
|
|
66
|
+
'iui-loading': isLoading,
|
|
67
|
+
}, className && (_a = {}, _a[className] = !label, _a), checkmarkClassName), style: __assign(__assign({}, (!label && style)), checkmarkStyle), disabled: disabled || isLoading, type: 'checkbox', ref: refs }, rest)),
|
|
68
|
+
isLoading && React.createElement(ProgressRadial, { size: 'x-small', indeterminate: true })));
|
|
69
|
+
return !label ? (checkbox) : (React.createElement("label", { className: cx('iui-checkbox-wrapper', (_b = {
|
|
72
70
|
'iui-disabled': disabled
|
|
73
71
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
React.createElement("
|
|
79
|
-
React.createElement("span", { className: cx('iui-checkbox-checkmark', checkmarkClassName), style: checkmarkStyle },
|
|
80
|
-
isLoading && React.createElement(ProgressRadial, { indeterminate: true }),
|
|
81
|
-
!isLoading &&
|
|
82
|
-
(variant === 'default' ? defaultCheckbox : visibilityCheckbox)),
|
|
83
|
-
label && React.createElement("span", { className: 'iui-label' }, label)));
|
|
72
|
+
_b["iui-" + status] = !!status,
|
|
73
|
+
_b['iui-loading'] = isLoading,
|
|
74
|
+
_b), className), style: style },
|
|
75
|
+
checkbox,
|
|
76
|
+
label && React.createElement("span", { className: 'iui-checkbox-label' }, label)));
|
|
84
77
|
});
|
|
85
78
|
export default Checkbox;
|
|
@@ -17,5 +17,5 @@ export declare type ColorSwatchProps = {
|
|
|
17
17
|
* <ColorSwatch color='#23450b' onClick={onClick}/>
|
|
18
18
|
* <ColorSwatch color={{ r: 255, g: 255, b: 0 }} onClick={onClick}/>
|
|
19
19
|
*/
|
|
20
|
-
export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "role" | "children" | "className" | "accessKey" | "draggable" | "hidden" | "lang" | "translate" | "prefix" | "contentEditable" | "inputMode" | "tabIndex" | "onFocus" | "color" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-
|
|
20
|
+
export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "aria-disabled" | "role" | "children" | "className" | "accessKey" | "draggable" | "hidden" | "lang" | "translate" | "prefix" | "contentEditable" | "inputMode" | "tabIndex" | "onFocus" | "color" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "isActive"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
21
|
export default ColorSwatch;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { InputProps } from '../Input';
|
|
3
3
|
import { SelectOption } from '../Select';
|
|
4
4
|
import { PopoverProps, CommonProps, InputContainerProps } from '../utils';
|
|
@@ -12,6 +12,11 @@ export declare type ComboBoxProps<T> = {
|
|
|
12
12
|
* Controlled value of ComboBox.
|
|
13
13
|
*/
|
|
14
14
|
value?: T;
|
|
15
|
+
/**
|
|
16
|
+
* Message shown below the combobox.
|
|
17
|
+
* Use `StatusMessage` component.
|
|
18
|
+
*/
|
|
19
|
+
message?: React.ReactNode;
|
|
15
20
|
/**
|
|
16
21
|
* Callback fired when selected value changes.
|
|
17
22
|
*/
|
|
@@ -33,6 +38,17 @@ export declare type ComboBoxProps<T> = {
|
|
|
33
38
|
* @default 'No options found'
|
|
34
39
|
*/
|
|
35
40
|
emptyStateMessage?: string;
|
|
41
|
+
/**
|
|
42
|
+
* A custom item renderer can be specified to control the rendering.
|
|
43
|
+
* This function should ideally return a customized version of `MenuItem`,
|
|
44
|
+
* otherwise you will need to make sure to provide styling for the `isFocused` state.
|
|
45
|
+
*/
|
|
46
|
+
itemRenderer?: (option: SelectOption<T>, states: {
|
|
47
|
+
isSelected: boolean;
|
|
48
|
+
isFocused: boolean;
|
|
49
|
+
id: string;
|
|
50
|
+
index: number;
|
|
51
|
+
}) => JSX.Element;
|
|
36
52
|
} & Pick<InputContainerProps, 'status'> & Omit<CommonProps, 'title'>;
|
|
37
53
|
/**
|
|
38
54
|
* ComboBox component that allows typing a value to filter the options in dropdown list.
|
|
@@ -29,9 +29,10 @@ import cx from 'classnames';
|
|
|
29
29
|
import { Input } from '../Input';
|
|
30
30
|
import { Menu, MenuExtraContent, MenuItem } from '../Menu';
|
|
31
31
|
import { Text } from '../Typography';
|
|
32
|
-
import { InputContainer, useTheme, Popover, getFocusableElements, getRandomValue, } from '../utils';
|
|
32
|
+
import { InputContainer, useTheme, Popover, getFocusableElements, getRandomValue, mergeRefs, } from '../utils';
|
|
33
33
|
import SvgCaretDownSmall from '@itwin/itwinui-icons-react/cjs/icons/CaretDownSmall';
|
|
34
34
|
import 'tippy.js/animations/shift-away.css';
|
|
35
|
+
import { StatusMessage } from '../StatusMessage';
|
|
35
36
|
/**
|
|
36
37
|
* ComboBox component that allows typing a value to filter the options in dropdown list.
|
|
37
38
|
* Values can be selected either using mouse clicks or using the Enter key.
|
|
@@ -46,7 +47,7 @@ import 'tippy.js/animations/shift-away.css';
|
|
|
46
47
|
* />
|
|
47
48
|
*/
|
|
48
49
|
export var ComboBox = function (props) {
|
|
49
|
-
var options = props.options, value = props.value, onChange = props.onChange, filterFunction = props.filterFunction, className = props.className, inputProps = props.inputProps, dropdownMenuProps = props.dropdownMenuProps, _a = props.emptyStateMessage, emptyStateMessage = _a === void 0 ? 'No options found' : _a, rest = __rest(props, ["options", "value", "onChange", "filterFunction", "className", "inputProps", "dropdownMenuProps", "emptyStateMessage"]);
|
|
50
|
+
var options = props.options, value = props.value, onChange = props.onChange, filterFunction = props.filterFunction, className = props.className, inputProps = props.inputProps, dropdownMenuProps = props.dropdownMenuProps, message = props.message, status = props.status, _a = props.emptyStateMessage, emptyStateMessage = _a === void 0 ? 'No options found' : _a, itemRenderer = props.itemRenderer, rest = __rest(props, ["options", "value", "onChange", "filterFunction", "className", "inputProps", "dropdownMenuProps", "message", "status", "emptyStateMessage", "itemRenderer"]);
|
|
50
51
|
// Generate a stateful random id if not specified
|
|
51
52
|
var id = React.useState(function () {
|
|
52
53
|
var _a, _b;
|
|
@@ -61,16 +62,31 @@ export var ComboBox = function (props) {
|
|
|
61
62
|
return value === options[index].value;
|
|
62
63
|
});
|
|
63
64
|
}, [options, id]);
|
|
65
|
+
var userOnChange = React.useRef(onChange);
|
|
64
66
|
var memoizedItems = React.useMemo(function () {
|
|
65
|
-
return options.map(function (
|
|
66
|
-
var label =
|
|
67
|
-
|
|
67
|
+
return options.map(function (option, index) {
|
|
68
|
+
var label = option.label, value = option.value, rest = __rest(option, ["label", "value"]);
|
|
69
|
+
var additionalProps = {
|
|
70
|
+
value: value,
|
|
71
|
+
role: 'option',
|
|
72
|
+
onClick: function () {
|
|
73
|
+
var _a;
|
|
68
74
|
setSelectedValue(value);
|
|
69
|
-
|
|
75
|
+
(_a = userOnChange.current) === null || _a === void 0 ? void 0 : _a.call(userOnChange, value);
|
|
70
76
|
setIsOpen(false);
|
|
71
|
-
}
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
if (itemRenderer) {
|
|
80
|
+
return React.cloneElement(itemRenderer(option, {
|
|
81
|
+
id: getOptionId(index),
|
|
82
|
+
index: index,
|
|
83
|
+
isSelected: false,
|
|
84
|
+
isFocused: false,
|
|
85
|
+
}), additionalProps);
|
|
86
|
+
}
|
|
87
|
+
return (React.createElement(MenuItem, __assign({ id: getOptionId(index), key: getOptionId(index) }, additionalProps, rest), label));
|
|
72
88
|
});
|
|
73
|
-
}, [options, getOptionId,
|
|
89
|
+
}, [options, getOptionId, itemRenderer]);
|
|
74
90
|
var inputRef = React.useRef(null);
|
|
75
91
|
var menuRef = React.useRef(null);
|
|
76
92
|
var toggleButtonRef = React.useRef(null);
|
|
@@ -149,6 +165,7 @@ export var ComboBox = function (props) {
|
|
|
149
165
|
});
|
|
150
166
|
}, [inputValue, options, selectedValue, isOpen, filterFunction]);
|
|
151
167
|
var onKeyDown = React.useCallback(function (event) {
|
|
168
|
+
var _a;
|
|
152
169
|
var focusableOptions = getFocusableElements(menuRef.current);
|
|
153
170
|
var focusedIndexInFilteredList = focusableOptions.findIndex(function (_a) {
|
|
154
171
|
var _b;
|
|
@@ -182,7 +199,7 @@ export var ComboBox = function (props) {
|
|
|
182
199
|
case 'Enter':
|
|
183
200
|
if (isOpen) {
|
|
184
201
|
setSelectedValue(options[focusedIndex].value);
|
|
185
|
-
|
|
202
|
+
(_a = userOnChange.current) === null || _a === void 0 ? void 0 : _a.call(userOnChange, options[focusedIndex].value);
|
|
186
203
|
}
|
|
187
204
|
setIsOpen(function (open) { return !open; });
|
|
188
205
|
event.preventDefault();
|
|
@@ -202,26 +219,41 @@ export var ComboBox = function (props) {
|
|
|
202
219
|
}
|
|
203
220
|
break;
|
|
204
221
|
}
|
|
205
|
-
}, [focusedIndex, isOpen, options, getOptionId
|
|
222
|
+
}, [focusedIndex, isOpen, options, getOptionId]);
|
|
206
223
|
var menuItems = React.useMemo(function () {
|
|
207
224
|
if (filteredOptions.length === 0) {
|
|
208
|
-
return
|
|
209
|
-
React.createElement(
|
|
225
|
+
return [
|
|
226
|
+
React.createElement(MenuExtraContent, { key: 0 },
|
|
227
|
+
React.createElement(Text, { isMuted: true }, emptyStateMessage)),
|
|
228
|
+
];
|
|
210
229
|
}
|
|
211
230
|
return filteredOptions.map(function (option) {
|
|
231
|
+
var _a;
|
|
212
232
|
var index = options.findIndex(function (_a) {
|
|
213
233
|
var value = _a.value;
|
|
214
234
|
return option.value === value;
|
|
215
235
|
});
|
|
216
236
|
if (index < 0) {
|
|
217
|
-
return;
|
|
237
|
+
return React.createElement(React.Fragment, null);
|
|
218
238
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
239
|
+
var id = getOptionId(index);
|
|
240
|
+
var isSelected = selectedValue === option.value;
|
|
241
|
+
var isFocused = focusedIndex === index;
|
|
242
|
+
var focusScrollRef = function (el) {
|
|
243
|
+
return isFocused && (el === null || el === void 0 ? void 0 : el.scrollIntoView({ block: 'nearest' }));
|
|
244
|
+
};
|
|
245
|
+
if (isSelected || isFocused) {
|
|
246
|
+
var item = (_a = itemRenderer === null || itemRenderer === void 0 ? void 0 : itemRenderer(option, { index: index, id: id, isSelected: isSelected, isFocused: isFocused })) !== null && _a !== void 0 ? _a : React.cloneElement(memoizedItems[index], { isSelected: isSelected });
|
|
247
|
+
return React.cloneElement(item, {
|
|
248
|
+
className: cx({ 'iui-focused': isFocused }, item.props.className),
|
|
249
|
+
ref: mergeRefs(focusScrollRef, item.props.ref),
|
|
250
|
+
value: option.value,
|
|
251
|
+
role: 'option',
|
|
252
|
+
onClick: function () {
|
|
253
|
+
var _a;
|
|
254
|
+
setSelectedValue(option.value);
|
|
255
|
+
(_a = userOnChange.current) === null || _a === void 0 ? void 0 : _a.call(userOnChange, option.value);
|
|
256
|
+
setIsOpen(false);
|
|
225
257
|
},
|
|
226
258
|
});
|
|
227
259
|
}
|
|
@@ -231,11 +263,14 @@ export var ComboBox = function (props) {
|
|
|
231
263
|
filteredOptions,
|
|
232
264
|
emptyStateMessage,
|
|
233
265
|
options,
|
|
234
|
-
|
|
266
|
+
getOptionId,
|
|
235
267
|
selectedValue,
|
|
268
|
+
focusedIndex,
|
|
269
|
+
itemRenderer,
|
|
236
270
|
memoizedItems,
|
|
237
271
|
]);
|
|
238
|
-
return (React.createElement(InputContainer, __assign({ className: className,
|
|
272
|
+
return (React.createElement(InputContainer, __assign({ className: className, status: status, statusMessage: typeof message === 'string' ? (React.createElement(StatusMessage, { status: status }, message)) : (React.isValidElement(message) &&
|
|
273
|
+
React.cloneElement(message, { status: status })) }, rest, { id: id }),
|
|
239
274
|
React.createElement("div", { className: 'iui-input-with-icon' },
|
|
240
275
|
React.createElement(Popover, __assign({ placement: 'bottom-start', visible: isOpen, onClickOutside: function (_, _a) {
|
|
241
276
|
var _b;
|
|
@@ -38,6 +38,12 @@ export declare type ExpandableBlockProps = {
|
|
|
38
38
|
* @default 'default'
|
|
39
39
|
*/
|
|
40
40
|
size?: 'default' | 'small';
|
|
41
|
+
/**
|
|
42
|
+
* Style of the ExpandableBlock.
|
|
43
|
+
* Use 'borderless' to hide outline.
|
|
44
|
+
* @default 'default'
|
|
45
|
+
*/
|
|
46
|
+
styleType?: 'default' | 'borderless';
|
|
41
47
|
} & Omit<CommonProps, 'title'>;
|
|
42
48
|
/**
|
|
43
49
|
* Container that allows content to be hidden behind a brief title and a caption.
|
|
@@ -40,10 +40,10 @@ import '@itwin/itwinui-css/css/expandable-block.css';
|
|
|
40
40
|
*/
|
|
41
41
|
export var ExpandableBlock = function (props) {
|
|
42
42
|
var _a;
|
|
43
|
-
var caption = props.caption, children = props.children, className = props.className, title = props.title, onToggle = props.onToggle, style = props.style, _b = props.isExpanded, isExpanded = _b === void 0 ? false : _b, endIcon = props.endIcon, status = props.status, _c = props.size, size = _c === void 0 ? 'default' : _c, rest = __rest(props, ["caption", "children", "className", "title", "onToggle", "style", "isExpanded", "endIcon", "status", "size"]);
|
|
43
|
+
var caption = props.caption, children = props.children, className = props.className, title = props.title, onToggle = props.onToggle, style = props.style, _b = props.isExpanded, isExpanded = _b === void 0 ? false : _b, endIcon = props.endIcon, status = props.status, _c = props.size, size = _c === void 0 ? 'default' : _c, _d = props.styleType, styleType = _d === void 0 ? 'default' : _d, rest = __rest(props, ["caption", "children", "className", "title", "onToggle", "style", "isExpanded", "endIcon", "status", "size", "styleType"]);
|
|
44
44
|
useTheme();
|
|
45
45
|
var icon = endIcon !== null && endIcon !== void 0 ? endIcon : (status && StatusIconMap[status]());
|
|
46
|
-
var
|
|
46
|
+
var _e = React.useState(isExpanded), expanded = _e[0], setExpanded = _e[1];
|
|
47
47
|
React.useEffect(function () {
|
|
48
48
|
setExpanded(isExpanded);
|
|
49
49
|
}, [isExpanded]);
|
|
@@ -62,6 +62,7 @@ export var ExpandableBlock = function (props) {
|
|
|
62
62
|
'iui-with-caption': !!caption,
|
|
63
63
|
'iui-expanded': expanded,
|
|
64
64
|
'iui-small': size === 'small',
|
|
65
|
+
'iui-borderless': styleType === 'borderless',
|
|
65
66
|
}, className), style: style }, rest),
|
|
66
67
|
React.createElement("div", { "aria-expanded": expanded, className: 'iui-header', tabIndex: 0, onClick: handleToggle, onKeyDown: onKeyDown },
|
|
67
68
|
React.createElement(SvgChevronRight, { className: 'iui-icon', "aria-hidden": true }),
|
|
@@ -11,8 +11,10 @@ export declare type TitleTranslations = {
|
|
|
11
11
|
export declare type FooterProps = {
|
|
12
12
|
/**
|
|
13
13
|
* Customize footer elements.
|
|
14
|
+
* Providing a `FooterElement[]` will append the custom elements to the end of the default elements.
|
|
15
|
+
* Providing a function that returns a `FooterElement[]` allows further customization - whatever is returned from the function is displayed in the footer with no amendments.
|
|
14
16
|
*/
|
|
15
|
-
customElements?: FooterElement[];
|
|
17
|
+
customElements?: FooterElement[] | ((defaultElements: FooterElement[]) => FooterElement[]);
|
|
16
18
|
/**
|
|
17
19
|
* Provide localized strings.
|
|
18
20
|
*/
|
|
@@ -27,13 +29,23 @@ export declare type FooterElement = {
|
|
|
27
29
|
* URL of the footer element.
|
|
28
30
|
*/
|
|
29
31
|
url?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Key of the footer element.
|
|
34
|
+
*/
|
|
35
|
+
key?: keyof TitleTranslations | 'copyright' | (string & Record<never, never>);
|
|
30
36
|
};
|
|
31
37
|
/**
|
|
32
38
|
* Footer element with all needed legal and info links.
|
|
33
39
|
* Be sure to place it manually at the bottom of your page.
|
|
34
40
|
* You can use position 'absolute' with relative body or set the height of the content and place footer at the end.
|
|
35
|
-
* @example
|
|
41
|
+
* @example <caption>Appending custom element after default elements</caption>
|
|
36
42
|
* <Footer customElements={[{title: 'Bentley', url: 'https://www.bentley.com/'}]} />
|
|
43
|
+
* @example <caption>Returning only custom elements</caption>
|
|
44
|
+
* <Footer customElements={() => newFooterElements)} />
|
|
45
|
+
* @example <caption>Filtering out a specific element</caption>
|
|
46
|
+
* <Footer customElements={(defaultElements) => defaultElements.filter(({ key }) => key !== 'privacy' )} />
|
|
47
|
+
* @example <caption>Changing a url</caption>
|
|
48
|
+
* <Footer customElements={(defaultElements) => defaultElements.map(element => ({ ...element, url: element.key === 'privacy' ? customPrivacyUrl : element.url }))} />
|
|
37
49
|
*/
|
|
38
50
|
export declare const Footer: (props: FooterProps) => JSX.Element;
|
|
39
51
|
export default Footer;
|
|
@@ -48,39 +48,62 @@ var footerTranslations = {
|
|
|
48
48
|
* Footer element with all needed legal and info links.
|
|
49
49
|
* Be sure to place it manually at the bottom of your page.
|
|
50
50
|
* You can use position 'absolute' with relative body or set the height of the content and place footer at the end.
|
|
51
|
-
* @example
|
|
51
|
+
* @example <caption>Appending custom element after default elements</caption>
|
|
52
52
|
* <Footer customElements={[{title: 'Bentley', url: 'https://www.bentley.com/'}]} />
|
|
53
|
+
* @example <caption>Returning only custom elements</caption>
|
|
54
|
+
* <Footer customElements={() => newFooterElements)} />
|
|
55
|
+
* @example <caption>Filtering out a specific element</caption>
|
|
56
|
+
* <Footer customElements={(defaultElements) => defaultElements.filter(({ key }) => key !== 'privacy' )} />
|
|
57
|
+
* @example <caption>Changing a url</caption>
|
|
58
|
+
* <Footer customElements={(defaultElements) => defaultElements.map(element => ({ ...element, url: element.key === 'privacy' ? customPrivacyUrl : element.url }))} />
|
|
53
59
|
*/
|
|
54
60
|
export var Footer = function (props) {
|
|
55
61
|
var customElements = props.customElements, translatedTitles = props.translatedTitles, className = props.className, rest = __rest(props, ["customElements", "translatedTitles", "className"]);
|
|
56
62
|
useTheme();
|
|
57
|
-
var today = new Date();
|
|
58
63
|
var titles = __assign(__assign({}, footerTranslations), translatedTitles);
|
|
59
64
|
var defaultElements = [
|
|
60
65
|
{
|
|
66
|
+
key: 'copyright',
|
|
67
|
+
title: "\u00A9 " + new Date().getFullYear() + " Bentley Systems, Incorporated",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: 'termsOfService',
|
|
61
71
|
title: titles.termsOfService,
|
|
62
72
|
url: 'https://connect-agreementportal.bentley.com/AgreementApp/Home/Eula/view/readonly/BentleyConnect',
|
|
63
73
|
},
|
|
64
|
-
{ title: titles.privacy, url: 'https://www.bentley.com/en/privacy-policy' },
|
|
65
74
|
{
|
|
75
|
+
key: 'privacy',
|
|
76
|
+
title: titles.privacy,
|
|
77
|
+
url: 'https://www.bentley.com/en/privacy-policy',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
key: 'termsOfUse',
|
|
66
81
|
title: titles.termsOfUse,
|
|
67
82
|
url: 'https://www.bentley.com/en/terms-of-use-and-select-online-agreement',
|
|
68
83
|
},
|
|
69
|
-
{
|
|
70
|
-
|
|
84
|
+
{
|
|
85
|
+
key: 'cookies',
|
|
86
|
+
title: titles.cookies,
|
|
87
|
+
url: 'https://www.bentley.com/en/cookie-policy',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
key: 'legalNotices',
|
|
91
|
+
title: titles.legalNotices,
|
|
92
|
+
url: 'https://connect.bentley.com/Legal',
|
|
93
|
+
},
|
|
71
94
|
];
|
|
72
|
-
var elements =
|
|
73
|
-
|
|
95
|
+
var elements = defaultElements;
|
|
96
|
+
if (customElements) {
|
|
97
|
+
elements =
|
|
98
|
+
typeof customElements === 'function'
|
|
99
|
+
? customElements(defaultElements)
|
|
100
|
+
: __spreadArray(__spreadArray([], defaultElements, true), customElements, true);
|
|
101
|
+
}
|
|
74
102
|
return (React.createElement("footer", __assign({ className: cx('iui-legal-footer', className) }, rest),
|
|
75
|
-
React.createElement("ul", null,
|
|
76
|
-
React.createElement("li",
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
elements.map(function (element, index) {
|
|
81
|
-
return (React.createElement("li", { key: element.title + "-" + index },
|
|
82
|
-
React.createElement("span", { className: 'iui-separator' }),
|
|
83
|
-
element.url ? (React.createElement("a", { href: element.url, target: '_blank', rel: 'noreferrer' }, element.title)) : (element.title)));
|
|
84
|
-
}))));
|
|
103
|
+
React.createElement("ul", null, elements.map(function (element, index) {
|
|
104
|
+
return (React.createElement("li", { key: element.key || element.title + "-" + index },
|
|
105
|
+
index > 0 && React.createElement("span", { className: 'iui-separator' }),
|
|
106
|
+
element.url ? (React.createElement("a", { href: element.url, target: '_blank', rel: 'noreferrer' }, element.title)) : (element.title)));
|
|
107
|
+
}))));
|
|
85
108
|
};
|
|
86
109
|
export default Footer;
|
|
@@ -45,8 +45,18 @@ import '@itwin/itwinui-css/css/inputs.css';
|
|
|
45
45
|
export var InputGroup = function (props) {
|
|
46
46
|
var children = props.children, _a = props.disabled, disabled = _a === void 0 ? false : _a, _b = props.displayStyle, displayStyle = _b === void 0 ? 'default' : _b, label = props.label, message = props.message, status = props.status, svgIcon = props.svgIcon, className = props.className, style = props.style, _c = props.required, required = _c === void 0 ? false : _c, rest = __rest(props, ["children", "disabled", "displayStyle", "label", "message", "status", "svgIcon", "className", "style", "required"]);
|
|
47
47
|
useTheme();
|
|
48
|
-
var icon =
|
|
49
|
-
|
|
48
|
+
var icon = function () {
|
|
49
|
+
if (svgIcon) {
|
|
50
|
+
return React.cloneElement(svgIcon, { 'aria-hidden': true });
|
|
51
|
+
}
|
|
52
|
+
if (status && message) {
|
|
53
|
+
return React.cloneElement(StatusIconMap[status](), {
|
|
54
|
+
'aria-hidden': true,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
};
|
|
59
|
+
return (React.createElement(InputContainer, __assign({ label: label, disabled: disabled, required: required, status: status, message: message, icon: icon(), isLabelInline: displayStyle === 'inline', className: className, style: style }, rest),
|
|
50
60
|
React.createElement("div", { className: 'iui-input-group' }, children)));
|
|
51
61
|
};
|
|
52
62
|
export default InputGroup;
|
|
@@ -64,10 +64,16 @@ import '@itwin/itwinui-css/css/inputs.css';
|
|
|
64
64
|
export var LabeledSelect = function (props) {
|
|
65
65
|
var className = props.className, _a = props.disabled, disabled = _a === void 0 ? false : _a, label = props.label, message = props.message, status = props.status, svgIcon = props.svgIcon, _b = props.displayStyle, displayStyle = _b === void 0 ? 'default' : _b, style = props.style, selectClassName = props.selectClassName, selectStyle = props.selectStyle, _c = props.required, required = _c === void 0 ? false : _c, rest = __rest(props, ["className", "disabled", "label", "message", "status", "svgIcon", "displayStyle", "style", "selectClassName", "selectStyle", "required"]);
|
|
66
66
|
useTheme();
|
|
67
|
-
var icon =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
var icon = function () {
|
|
68
|
+
if (svgIcon) {
|
|
69
|
+
return React.cloneElement(svgIcon, { 'aria-hidden': true });
|
|
70
|
+
}
|
|
71
|
+
if (status && message) {
|
|
72
|
+
return StatusIconMap[status]();
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
75
|
+
};
|
|
76
|
+
return (React.createElement(InputContainer, { label: label, disabled: disabled, required: required, status: status, message: message, icon: displayStyle === 'default' ? icon() : undefined, isLabelInline: displayStyle === 'inline', className: className, style: style },
|
|
71
77
|
React.createElement(Select, __assign({ disabled: disabled, className: selectClassName, style: selectStyle }, rest))));
|
|
72
78
|
};
|
|
73
79
|
export default LabeledSelect;
|
package/esm/core/Menu/Menu.js
CHANGED
|
@@ -37,6 +37,9 @@ export var Menu = React.forwardRef(function (props, ref) {
|
|
|
37
37
|
var _c = React.useState(), focusedIndex = _c[0], setFocusedIndex = _c[1];
|
|
38
38
|
var menuRef = React.useRef(null);
|
|
39
39
|
var refs = useMergedRefs(menuRef, ref);
|
|
40
|
+
React.useEffect(function () {
|
|
41
|
+
setFocusedIndex(null);
|
|
42
|
+
}, [children]);
|
|
40
43
|
React.useEffect(function () {
|
|
41
44
|
var _a;
|
|
42
45
|
var items = getFocusableElements(menuRef.current);
|
|
@@ -49,9 +52,6 @@ export var Menu = React.forwardRef(function (props, ref) {
|
|
|
49
52
|
setFocusedIndex(selectedIndex > -1 ? selectedIndex : 0);
|
|
50
53
|
}
|
|
51
54
|
}, [setFocus, focusedIndex]);
|
|
52
|
-
React.useEffect(function () {
|
|
53
|
-
setFocusedIndex(null);
|
|
54
|
-
}, [children]);
|
|
55
55
|
var onKeyDown = function (event) {
|
|
56
56
|
var items = getFocusableElements(menuRef.current);
|
|
57
57
|
if (!(items === null || items === void 0 ? void 0 : items.length)) {
|
|
@@ -11,10 +11,16 @@ export declare type RadioProps = {
|
|
|
11
11
|
status?: 'positive' | 'warning' | 'negative';
|
|
12
12
|
/**
|
|
13
13
|
* Custom CSS class name for the checkmark element.
|
|
14
|
+
*
|
|
15
|
+
* @deprecated As of 1.32.0, this is applied on the actual radio `<input>` element.
|
|
16
|
+
* The checkmark has been moved into a pseudo-element.
|
|
14
17
|
*/
|
|
15
18
|
checkmarkClassName?: string;
|
|
16
19
|
/**
|
|
17
20
|
* Custom CSS Style for the checkmark element.
|
|
21
|
+
*
|
|
22
|
+
* @deprecated As of 1.32.0, this is applied on the actual radio `<input>` element.
|
|
23
|
+
* The checkmark has been moved into a pseudo-element.
|
|
18
24
|
*/
|
|
19
25
|
checkmarkStyle?: React.CSSProperties;
|
|
20
26
|
/**
|
|
@@ -26,6 +32,7 @@ export declare type RadioProps = {
|
|
|
26
32
|
/**
|
|
27
33
|
* Basic radio input component
|
|
28
34
|
* @example
|
|
35
|
+
* <Radio />
|
|
29
36
|
* <Radio label='Radio' />
|
|
30
37
|
* <Radio disabled={true} label='Radio' />
|
|
31
38
|
* <Radio status='positive' label='Positive' />
|
|
@@ -43,10 +50,16 @@ export declare const Radio: React.ForwardRefExoticComponent<{
|
|
|
43
50
|
status?: "positive" | "warning" | "negative" | undefined;
|
|
44
51
|
/**
|
|
45
52
|
* Custom CSS class name for the checkmark element.
|
|
53
|
+
*
|
|
54
|
+
* @deprecated As of 1.32.0, this is applied on the actual radio `<input>` element.
|
|
55
|
+
* The checkmark has been moved into a pseudo-element.
|
|
46
56
|
*/
|
|
47
57
|
checkmarkClassName?: string | undefined;
|
|
48
58
|
/**
|
|
49
59
|
* Custom CSS Style for the checkmark element.
|
|
60
|
+
*
|
|
61
|
+
* @deprecated As of 1.32.0, this is applied on the actual radio `<input>` element.
|
|
62
|
+
* The checkmark has been moved into a pseudo-element.
|
|
50
63
|
*/
|
|
51
64
|
checkmarkStyle?: React.CSSProperties | undefined;
|
|
52
65
|
/**
|
package/esm/core/Radio/Radio.js
CHANGED
|
@@ -31,6 +31,7 @@ import '@itwin/itwinui-css/css/inputs.css';
|
|
|
31
31
|
/**
|
|
32
32
|
* Basic radio input component
|
|
33
33
|
* @example
|
|
34
|
+
* <Radio />
|
|
34
35
|
* <Radio label='Radio' />
|
|
35
36
|
* <Radio disabled={true} label='Radio' />
|
|
36
37
|
* <Radio status='positive' label='Positive' />
|
|
@@ -38,8 +39,8 @@ import '@itwin/itwinui-css/css/inputs.css';
|
|
|
38
39
|
* <Radio status='negative' label='Negative' />
|
|
39
40
|
*/
|
|
40
41
|
export var Radio = React.forwardRef(function (props, ref) {
|
|
41
|
-
var _a;
|
|
42
|
-
var className = props.className,
|
|
42
|
+
var _a, _b;
|
|
43
|
+
var className = props.className, _c = props.disabled, disabled = _c === void 0 ? false : _c, label = props.label, status = props.status, style = props.style, checkmarkClassName = props.checkmarkClassName, checkmarkStyle = props.checkmarkStyle, _d = props.setFocus, setFocus = _d === void 0 ? false : _d, rest = __rest(props, ["className", "disabled", "label", "status", "style", "checkmarkClassName", "checkmarkStyle", "setFocus"]);
|
|
43
44
|
useTheme();
|
|
44
45
|
var inputElementRef = React.useRef(null);
|
|
45
46
|
var refs = useMergedRefs(inputElementRef, ref);
|
|
@@ -48,11 +49,9 @@ export var Radio = React.forwardRef(function (props, ref) {
|
|
|
48
49
|
inputElementRef.current.focus();
|
|
49
50
|
}
|
|
50
51
|
}, [setFocus]);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
React.createElement("circle", { cx: '8', cy: '8', r: '4' }))),
|
|
56
|
-
label && React.createElement("span", { className: 'iui-label' }, label)));
|
|
52
|
+
var radio = (React.createElement("input", __assign({ className: cx('iui-radio', className && (_a = {}, _a[className] = !label, _a), checkmarkClassName), style: __assign(__assign({}, (!label && style)), checkmarkStyle), disabled: disabled, type: 'radio', ref: refs }, rest)));
|
|
53
|
+
return !label ? (radio) : (React.createElement("label", { className: cx('iui-radio-wrapper', (_b = { 'iui-disabled': disabled }, _b["iui-" + status] = !!status, _b), className), style: style },
|
|
54
|
+
radio,
|
|
55
|
+
label && React.createElement("span", { className: 'iui-radio-label' }, label)));
|
|
57
56
|
});
|
|
58
57
|
export default Radio;
|
|
@@ -202,11 +202,20 @@ export var Slider = React.forwardRef(function (props, ref) {
|
|
|
202
202
|
newValues[closestValueIndex] = pointerValue;
|
|
203
203
|
setCurrentValues(newValues);
|
|
204
204
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValues);
|
|
205
|
+
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(newValues);
|
|
205
206
|
focusThumb(containerRef.current, closestValueIndex);
|
|
206
207
|
event.preventDefault();
|
|
207
208
|
event.stopPropagation();
|
|
208
209
|
}
|
|
209
|
-
}, [
|
|
210
|
+
}, [
|
|
211
|
+
min,
|
|
212
|
+
max,
|
|
213
|
+
step,
|
|
214
|
+
currentValues,
|
|
215
|
+
getAllowableThumbRange,
|
|
216
|
+
onChange,
|
|
217
|
+
onUpdate,
|
|
218
|
+
]);
|
|
210
219
|
useEventListener('pointermove', handlePointerMove, (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument);
|
|
211
220
|
useEventListener('pointerup', handlePointerUp, (_b = containerRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument);
|
|
212
221
|
var tickMarkArea = React.useMemo(function () {
|