@itwin/itwinui-react 1.37.0 → 1.37.3
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 +19 -0
- package/cjs/core/Alert/Alert.js +1 -1
- package/cjs/core/Badge/Badge.js +1 -1
- package/cjs/core/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/cjs/core/Buttons/Button/Button.js +2 -2
- package/cjs/core/Buttons/IconButton/IconButton.js +2 -2
- package/cjs/core/Carousel/Carousel.js +1 -1
- package/cjs/core/Carousel/CarouselDotsList.js +1 -1
- package/cjs/core/Carousel/CarouselSlider.js +1 -1
- package/cjs/core/Checkbox/Checkbox.js +1 -1
- package/cjs/core/ColorPicker/ColorBuilder.js +3 -3
- package/cjs/core/ColorPicker/ColorInputPanel.js +1 -1
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/ColorPicker/ColorSwatch.js +1 -1
- package/cjs/core/ComboBox/ComboBox.js +9 -6
- package/cjs/core/DatePicker/DatePicker.js +2 -2
- package/cjs/core/ExpandableBlock/ExpandableBlock.js +1 -1
- package/cjs/core/Footer/Footer.js +2 -2
- package/cjs/core/Header/HeaderBreadcrumbs.js +1 -1
- package/cjs/core/InformationPanel/InformationPanel.js +2 -2
- package/cjs/core/Input/Input.js +1 -1
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.d.ts +1 -1
- package/cjs/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +2 -2
- package/cjs/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +2 -2
- package/cjs/core/Radio/Radio.js +1 -1
- package/cjs/core/Select/Select.js +3 -3
- package/cjs/core/Slider/Slider.js +1 -1
- package/cjs/core/Slider/Thumb.js +16 -2
- package/cjs/core/Slider/Track.js +24 -13
- package/cjs/core/Surface/Surface.js +1 -1
- package/cjs/core/Table/Table.js +18 -6
- package/cjs/core/Table/TablePaginator.js +6 -6
- package/cjs/core/Table/TableRowMemoized.js +1 -1
- package/cjs/core/Table/cells/EditableCell.js +2 -1
- package/cjs/core/Table/columns/actionColumn.js +2 -2
- package/cjs/core/Table/utils.js +5 -5
- package/cjs/core/Tabs/Tabs.d.ts +1 -1
- package/cjs/core/Tabs/Tabs.js +7 -8
- package/cjs/core/Tag/TagContainer.js +1 -1
- package/cjs/core/Tile/Tile.js +1 -1
- package/cjs/core/Toast/Toast.js +2 -2
- package/cjs/core/Toast/ToastWrapper.js +1 -1
- package/cjs/core/Tree/TreeNode.js +2 -2
- package/cjs/core/Typography/Text/Text.js +1 -1
- package/cjs/core/UserIcon/UserIcon.js +2 -2
- package/cjs/core/UserIconGroup/UserIconGroup.js +3 -3
- package/cjs/core/Wizard/Step.js +1 -1
- package/cjs/core/Wizard/Wizard.js +1 -1
- package/cjs/core/utils/color/ColorValue.js +11 -11
- package/cjs/core/utils/color/index.js +5 -1
- package/cjs/core/utils/components/FocusTrap.js +6 -8
- package/cjs/core/utils/components/InputContainer.js +1 -1
- package/cjs/core/utils/components/MiddleTextTruncation.js +1 -1
- package/cjs/core/utils/components/VirtualScroll.js +1 -1
- package/cjs/core/utils/components/WithCSSTransition.js +5 -5
- package/cjs/core/utils/components/index.js +5 -1
- package/cjs/core/utils/functions/focusable.js +1 -1
- package/cjs/core/utils/functions/index.js +5 -1
- package/cjs/core/utils/hooks/index.js +5 -1
- package/cjs/core/utils/hooks/useOverflow.js +3 -3
- package/cjs/core/utils/hooks/useTheme.js +1 -1
- package/cjs/core/utils/index.js +5 -1
- package/cjs/index.js +5 -1
- package/esm/core/Alert/Alert.js +1 -1
- package/esm/core/Badge/Badge.js +1 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/esm/core/Buttons/Button/Button.js +2 -2
- package/esm/core/Buttons/IconButton/IconButton.js +2 -2
- package/esm/core/Carousel/Carousel.js +1 -1
- package/esm/core/Carousel/CarouselDotsList.js +1 -1
- package/esm/core/Carousel/CarouselSlider.js +1 -1
- package/esm/core/Checkbox/Checkbox.js +1 -1
- package/esm/core/ColorPicker/ColorBuilder.js +3 -3
- package/esm/core/ColorPicker/ColorInputPanel.js +1 -1
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/ColorPicker/ColorSwatch.js +1 -1
- package/esm/core/ComboBox/ComboBox.js +9 -6
- package/esm/core/DatePicker/DatePicker.js +2 -2
- package/esm/core/ExpandableBlock/ExpandableBlock.js +1 -1
- package/esm/core/Footer/Footer.js +2 -2
- package/esm/core/Header/HeaderBreadcrumbs.js +1 -1
- package/esm/core/InformationPanel/InformationPanel.js +2 -2
- package/esm/core/Input/Input.js +1 -1
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.d.ts +1 -1
- package/esm/core/ProgressIndicators/ProgressLinear/ProgressLinear.js +2 -2
- package/esm/core/ProgressIndicators/ProgressRadial/ProgressRadial.js +2 -2
- package/esm/core/Radio/Radio.js +1 -1
- package/esm/core/Select/Select.js +3 -3
- package/esm/core/Slider/Slider.js +1 -1
- package/esm/core/Slider/Thumb.js +16 -2
- package/esm/core/Slider/Track.js +24 -13
- package/esm/core/Surface/Surface.js +1 -1
- package/esm/core/Table/Table.js +18 -6
- package/esm/core/Table/TablePaginator.js +6 -6
- package/esm/core/Table/TableRowMemoized.js +1 -1
- package/esm/core/Table/cells/EditableCell.js +2 -1
- package/esm/core/Table/columns/actionColumn.js +2 -2
- package/esm/core/Table/utils.js +5 -5
- package/esm/core/Tabs/Tabs.d.ts +1 -1
- package/esm/core/Tabs/Tabs.js +7 -8
- package/esm/core/Tag/TagContainer.js +1 -1
- package/esm/core/Tile/Tile.js +1 -1
- package/esm/core/Toast/Toast.js +2 -2
- package/esm/core/Toast/ToastWrapper.js +1 -1
- package/esm/core/Tree/TreeNode.js +2 -2
- package/esm/core/Typography/Text/Text.js +1 -1
- package/esm/core/UserIcon/UserIcon.js +2 -2
- package/esm/core/UserIconGroup/UserIconGroup.js +3 -3
- package/esm/core/Wizard/Step.js +1 -1
- package/esm/core/Wizard/Wizard.js +1 -1
- package/esm/core/utils/color/ColorValue.js +11 -11
- package/esm/core/utils/components/FocusTrap.js +6 -8
- package/esm/core/utils/components/InputContainer.js +1 -1
- package/esm/core/utils/components/MiddleTextTruncation.js +1 -1
- package/esm/core/utils/components/VirtualScroll.js +1 -1
- package/esm/core/utils/components/WithCSSTransition.js +5 -5
- package/esm/core/utils/functions/focusable.js +1 -1
- package/esm/core/utils/hooks/useOverflow.js +3 -3
- package/esm/core/utils/hooks/useTheme.js +1 -1
- package/package.json +21 -20
package/cjs/core/utils/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/cjs/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/esm/core/Alert/Alert.js
CHANGED
|
@@ -43,7 +43,7 @@ export var Alert = function (props) {
|
|
|
43
43
|
var children = props.children, className = props.className, _a = props.type, type = _a === void 0 ? 'informational' : _a, clickableText = props.clickableText, clickableTextProps = props.clickableTextProps, onClick = props.onClick, onClose = props.onClose, style = props.style, _b = props.isSticky, isSticky = _b === void 0 ? false : _b, rest = __rest(props, ["children", "className", "type", "clickableText", "clickableTextProps", "onClick", "onClose", "style", "isSticky"]);
|
|
44
44
|
useTheme();
|
|
45
45
|
var StatusIcon = StatusIconMap[type];
|
|
46
|
-
return (React.createElement("div", __assign({ className: cx('iui-alert', "iui-"
|
|
46
|
+
return (React.createElement("div", __assign({ className: cx('iui-alert', "iui-".concat(type), { 'iui-sticky': isSticky }, className), style: style }, rest),
|
|
47
47
|
React.createElement(StatusIcon, { className: 'iui-alert-icon' }),
|
|
48
48
|
React.createElement("span", { className: 'iui-alert-message' },
|
|
49
49
|
children,
|
package/esm/core/Badge/Badge.js
CHANGED
|
@@ -60,7 +60,7 @@ export var Badge = function (props) {
|
|
|
60
60
|
var backgroundColor = props.backgroundColor, style = props.style, className = props.className, children = props.children, rest = __rest(props, ["backgroundColor", "style", "className", "children"]);
|
|
61
61
|
useTheme();
|
|
62
62
|
var _style = backgroundColor &&
|
|
63
|
-
((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-badge-background-color: "
|
|
63
|
+
((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-badge-background-color: ".concat(backgroundColor)))
|
|
64
64
|
? __assign({ '--iui-badge-background-color': getBadgeColorValue(backgroundColor) }, style) : __assign({ backgroundColor: getBadgeColorValue(backgroundColor) }, style);
|
|
65
65
|
return (React.createElement("span", __assign({ className: cx('iui-badge', className), style: _style }, rest), children));
|
|
66
66
|
};
|
|
@@ -10,7 +10,7 @@ export declare type BreadcrumbsProps = {
|
|
|
10
10
|
/**
|
|
11
11
|
* Breadcrumb items.
|
|
12
12
|
*/
|
|
13
|
-
children: React.
|
|
13
|
+
children: React.ReactNode[];
|
|
14
14
|
/**
|
|
15
15
|
* Specify a custom separator element to show between breadcrumb items.
|
|
16
16
|
* Defaults to the `SvgChevronRight` icon.
|
|
@@ -48,7 +48,7 @@ export declare const Breadcrumbs: React.ForwardRefExoticComponent<{
|
|
|
48
48
|
/**
|
|
49
49
|
* Breadcrumb items.
|
|
50
50
|
*/
|
|
51
|
-
children: React.
|
|
51
|
+
children: React.ReactNode[];
|
|
52
52
|
/**
|
|
53
53
|
* Specify a custom separator element to show between breadcrumb items.
|
|
54
54
|
* Defaults to the `SvgChevronRight` icon.
|
|
@@ -41,8 +41,8 @@ export var Button = React.forwardRef(function (props, ref) {
|
|
|
41
41
|
var _a;
|
|
42
42
|
var children = props.children, className = props.className, size = props.size, style = props.style, _b = props.styleType, styleType = _b === void 0 ? 'default' : _b, _c = props.type, type = _c === void 0 ? 'button' : _c, startIcon = props.startIcon, endIcon = props.endIcon, _d = props.as, Element = _d === void 0 ? 'button' : _d, rest = __rest(props, ["children", "className", "size", "style", "styleType", "type", "startIcon", "endIcon", "as"]);
|
|
43
43
|
useTheme();
|
|
44
|
-
return (React.createElement(Element, __assign({ ref: ref, className: cx('iui-button', "iui-"
|
|
45
|
-
_a["iui-"
|
|
44
|
+
return (React.createElement(Element, __assign({ ref: ref, className: cx('iui-button', "iui-".concat(styleType), (_a = {},
|
|
45
|
+
_a["iui-".concat(size)] = !!size,
|
|
46
46
|
_a), className), style: style, type: type }, rest),
|
|
47
47
|
startIcon &&
|
|
48
48
|
React.cloneElement(startIcon, {
|
|
@@ -38,8 +38,8 @@ export var IconButton = React.forwardRef(function (props, ref) {
|
|
|
38
38
|
var _a;
|
|
39
39
|
var isActive = props.isActive, children = props.children, _b = props.styleType, styleType = _b === void 0 ? 'default' : _b, size = props.size, _c = props.type, type = _c === void 0 ? 'button' : _c, className = props.className, _d = props.as, Element = _d === void 0 ? 'button' : _d, rest = __rest(props, ["isActive", "children", "styleType", "size", "type", "className", "as"]);
|
|
40
40
|
useTheme();
|
|
41
|
-
return (React.createElement(Element, __assign({ ref: ref, className: cx('iui-button', "iui-"
|
|
42
|
-
_a["iui-"
|
|
41
|
+
return (React.createElement(Element, __assign({ ref: ref, className: cx('iui-button', "iui-".concat(styleType), (_a = {},
|
|
42
|
+
_a["iui-".concat(size)] = !!size,
|
|
43
43
|
_a['iui-active'] = isActive,
|
|
44
44
|
_a), className), type: type }, rest), React.cloneElement(children, {
|
|
45
45
|
className: cx('iui-button-icon', children.props.className),
|
|
@@ -55,7 +55,7 @@ import { CarouselNavigation } from './CarouselNavigation';
|
|
|
55
55
|
export var Carousel = Object.assign(React.forwardRef(function (props, ref) {
|
|
56
56
|
var _a = props.activeSlideIndex, userActiveIndex = _a === void 0 ? 0 : _a, onSlideChange = props.onSlideChange, className = props.className, children = props.children, rest = __rest(props, ["activeSlideIndex", "onSlideChange", "className", "children"]);
|
|
57
57
|
// Generate a stateful random id if not specified
|
|
58
|
-
var id = React.useState(function () { var _a; return (_a = props.id) !== null && _a !== void 0 ? _a : "iui-carousel-"
|
|
58
|
+
var id = React.useState(function () { var _a; return (_a = props.id) !== null && _a !== void 0 ? _a : "iui-carousel-".concat(getRandomValue(10)); })[0];
|
|
59
59
|
useTheme();
|
|
60
60
|
var isManuallyUpdating = React.useRef(false);
|
|
61
61
|
var scrollInstantly = React.useRef(false);
|
|
@@ -96,7 +96,7 @@ export var CarouselDotsList = React.forwardRef(function (props, ref) {
|
|
|
96
96
|
var isSecondSmallDot = (index === firstVisibleDotIndex + 1 && index !== 1) ||
|
|
97
97
|
(index === lastVisibleDotIndex - 1 && index !== slideCount - 2);
|
|
98
98
|
var isClipped = index < firstVisibleDotIndex || index > lastVisibleDotIndex;
|
|
99
|
-
return (React.createElement(CarouselDot, { key: index, "aria-label": "Slide "
|
|
99
|
+
return (React.createElement(CarouselDot, { key: index, "aria-label": "Slide ".concat(index), isActive: index === currentIndex, onClick: function () { return handleSlideChange(index); }, isSmall: isSecondSmallDot, isSmaller: isFirstSmallDot || isClipped, id: idPrefix && "".concat(idPrefix, "--dot-").concat(index), "aria-controls": idPrefix && "".concat(idPrefix, "--slide-").concat(index) }));
|
|
100
100
|
});
|
|
101
101
|
}, [
|
|
102
102
|
slideCount,
|
|
@@ -43,7 +43,7 @@ export var CarouselSlider = React.forwardRef(function (props, ref) {
|
|
|
43
43
|
return (_a = React.Children.map(children, function (child, index) {
|
|
44
44
|
return React.isValidElement(child)
|
|
45
45
|
? React.cloneElement(child, {
|
|
46
|
-
id: idPrefix
|
|
46
|
+
id: "".concat(idPrefix, "--slide-").concat(index),
|
|
47
47
|
index: index,
|
|
48
48
|
})
|
|
49
49
|
: child;
|
|
@@ -69,7 +69,7 @@ export var Checkbox = React.forwardRef(function (props, ref) {
|
|
|
69
69
|
return !label ? (checkbox) : (React.createElement("label", { className: cx('iui-checkbox-wrapper', (_b = {
|
|
70
70
|
'iui-disabled': disabled
|
|
71
71
|
},
|
|
72
|
-
_b["iui-"
|
|
72
|
+
_b["iui-".concat(status)] = !!status,
|
|
73
73
|
_b['iui-loading'] = isLoading,
|
|
74
74
|
_b), className), style: style },
|
|
75
75
|
checkbox,
|
|
@@ -63,20 +63,20 @@ export var ColorBuilder = React.forwardRef(function (props, ref) {
|
|
|
63
63
|
]);
|
|
64
64
|
var _p = React.useState(false), colorDotActive = _p[0], setColorDotActive = _p[1];
|
|
65
65
|
var hueColorString = hueSliderColor.toHexString();
|
|
66
|
-
var colorSquareStyle = ((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-color-field-hue: "
|
|
66
|
+
var colorSquareStyle = ((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-color-field-hue: ".concat(hueColorString)))
|
|
67
67
|
? {
|
|
68
68
|
'--iui-color-field-hue': hueColorString,
|
|
69
69
|
'--iui-color-picker-selected-color': dotColorString,
|
|
70
70
|
}
|
|
71
71
|
: { backgroundColor: hueColorString };
|
|
72
|
-
var opacitySliderStyle = ((_f = (_e = (_d = getWindow()) === null || _d === void 0 ? void 0 : _d.CSS) === null || _e === void 0 ? void 0 : _e.supports) === null || _f === void 0 ? void 0 : _f.call(_e, "--iui-color-picker-selected-color: "
|
|
72
|
+
var opacitySliderStyle = ((_f = (_e = (_d = getWindow()) === null || _d === void 0 ? void 0 : _d.CSS) === null || _e === void 0 ? void 0 : _e.supports) === null || _f === void 0 ? void 0 : _f.call(_e, "--iui-color-picker-selected-color: ".concat(hueColorString)))
|
|
73
73
|
? { '--iui-color-picker-selected-color': hueColorString }
|
|
74
74
|
: { backgroundColor: hueColorString };
|
|
75
75
|
var squareTop = 100 - hsvColor.v;
|
|
76
76
|
var squareLeft = hsvColor.s;
|
|
77
77
|
var colorDotStyle = ((_j = (_h = (_g = getWindow()) === null || _g === void 0 ? void 0 : _g.CSS) === null || _h === void 0 ? void 0 : _h.supports) === null || _j === void 0 ? void 0 : _j.call(_h, "--iui-color-dot-inset: 0"))
|
|
78
78
|
? {
|
|
79
|
-
'--iui-color-dot-inset': squareTop.toString()
|
|
79
|
+
'--iui-color-dot-inset': "".concat(squareTop.toString(), "% auto auto ").concat(squareLeft.toString(), "%"),
|
|
80
80
|
}
|
|
81
81
|
: {
|
|
82
82
|
backgroundColor: dotColorString,
|
|
@@ -150,7 +150,7 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
150
150
|
React.createElement(Input, { size: 'small', maxLength: showAlpha ? 9 : 7, minLength: 1, placeholder: 'HEX', value: input[0], onChange: function (event) {
|
|
151
151
|
var value = event.target.value.startsWith('#')
|
|
152
152
|
? event.target.value
|
|
153
|
-
: "#"
|
|
153
|
+
: "#".concat(event.target.value);
|
|
154
154
|
setInput([value]);
|
|
155
155
|
}, onKeyDown: function (event) {
|
|
156
156
|
if (event.key === 'Enter') {
|
|
@@ -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" | "aria-disabled" | "role" | "children" | "className" | "onClick" | "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" | "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" | "
|
|
20
|
+
export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "aria-disabled" | "role" | "children" | "className" | "onClick" | "accessKey" | "draggable" | "hidden" | "lang" | "translate" | "prefix" | "contentEditable" | "inputMode" | "tabIndex" | "onFocus" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "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" | "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" | "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;
|
|
@@ -45,7 +45,7 @@ export var ColorSwatch = React.forwardRef(function (props, ref) {
|
|
|
45
45
|
}, [color]);
|
|
46
46
|
var _style = React.useMemo(function () {
|
|
47
47
|
var _a, _b, _c;
|
|
48
|
-
return ((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-color-swatch-background: "
|
|
48
|
+
return ((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-color-swatch-background: ".concat(colorString)))
|
|
49
49
|
? __assign({ '--iui-color-swatch-background': colorString }, style) : __assign({ backgroundColor: colorString }, style);
|
|
50
50
|
}, [colorString, style]);
|
|
51
51
|
return (React.createElement("div", __assign({ className: cx('iui-color-swatch', { 'iui-active': isActive }, className), style: _style, onClick: onClick, tabIndex: isActive ? 0 : -1, "aria-selected": isActive, ref: ref }, rest)));
|
|
@@ -51,18 +51,21 @@ export var ComboBox = function (props) {
|
|
|
51
51
|
// Generate a stateful random id if not specified
|
|
52
52
|
var id = React.useState(function () {
|
|
53
53
|
var _a, _b;
|
|
54
|
-
return (_b = (_a = props.id) !== null && _a !== void 0 ? _a : ((inputProps === null || inputProps === void 0 ? void 0 : inputProps.id) && inputProps.id
|
|
54
|
+
return (_b = (_a = props.id) !== null && _a !== void 0 ? _a : ((inputProps === null || inputProps === void 0 ? void 0 : inputProps.id) && "".concat(inputProps.id, "-cb"))) !== null && _b !== void 0 ? _b : "iui-cb-".concat(getRandomValue(10));
|
|
55
55
|
})[0];
|
|
56
56
|
useTheme();
|
|
57
57
|
/** Generates a memoized id for an option, given the index from original list */
|
|
58
58
|
var getOptionId = React.useCallback(function (index) {
|
|
59
59
|
var _a;
|
|
60
|
-
return (_a = options[index].id) !== null && _a !== void 0 ? _a : id
|
|
60
|
+
return (_a = options[index].id) !== null && _a !== void 0 ? _a : "".concat(id, "-option").concat(options.findIndex(function (_a) {
|
|
61
61
|
var value = _a.value;
|
|
62
62
|
return value === options[index].value;
|
|
63
|
-
});
|
|
63
|
+
}));
|
|
64
64
|
}, [options, id]);
|
|
65
65
|
var userOnChange = React.useRef(onChange);
|
|
66
|
+
React.useEffect(function () {
|
|
67
|
+
userOnChange.current = onChange;
|
|
68
|
+
}, [onChange]);
|
|
66
69
|
var memoizedItems = React.useMemo(function () {
|
|
67
70
|
return options.map(function (option, index) {
|
|
68
71
|
var label = option.label, value = option.value, rest = __rest(option, ["label", "value"]);
|
|
@@ -278,9 +281,9 @@ export var ComboBox = function (props) {
|
|
|
278
281
|
if (!((_b = toggleButtonRef.current) === null || _b === void 0 ? void 0 : _b.contains(target))) {
|
|
279
282
|
setIsOpen(false);
|
|
280
283
|
}
|
|
281
|
-
}, animation: 'shift-away', duration: 200 }, dropdownMenuProps, { content: React.createElement(Menu, { id: id
|
|
284
|
+
}, animation: 'shift-away', duration: 200 }, dropdownMenuProps, { content: React.createElement(Menu, { id: "".concat(id, "-list"), className: 'iui-scroll', style: {
|
|
282
285
|
minWidth: minWidth,
|
|
283
|
-
maxWidth: "min("
|
|
286
|
+
maxWidth: "min(".concat(minWidth * 2, "px, 90vw)"),
|
|
284
287
|
maxHeight: 300,
|
|
285
288
|
}, setFocus: false, role: 'listbox', ref: menuRef }, menuItems), onHide: function (instance) {
|
|
286
289
|
var _a;
|
|
@@ -296,7 +299,7 @@ export var ComboBox = function (props) {
|
|
|
296
299
|
} }),
|
|
297
300
|
React.createElement(Input, __assign({ ref: inputRef, onKeyDown: onKeyDown, onFocus: function () { return setIsOpen(true); }, value: inputValue, "aria-activedescendant": isOpen && focusedIndex > -1
|
|
298
301
|
? getOptionId(focusedIndex)
|
|
299
|
-
: undefined, role: 'combobox', "aria-controls": isOpen ? id
|
|
302
|
+
: undefined, role: 'combobox', "aria-controls": isOpen ? "".concat(id, "-list") : undefined, "aria-autocomplete": 'list', spellCheck: false, autoCapitalize: 'none', autoCorrect: 'off' }, inputProps, { onChange: onInput }))),
|
|
300
303
|
React.createElement("span", { ref: toggleButtonRef, className: cx('iui-end-icon', {
|
|
301
304
|
'iui-actionable': !(inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled),
|
|
302
305
|
'iui-disabled': inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled,
|
|
@@ -288,9 +288,9 @@ export var DatePicker = function (props) {
|
|
|
288
288
|
React.createElement(SvgChevronRightDouble, null)))),
|
|
289
289
|
React.createElement("div", { className: 'iui-calendar-weekdays' }, shortDays.map(function (day, index) { return (React.createElement("div", { key: day, title: longDays[index] }, day)); })),
|
|
290
290
|
React.createElement("div", { onKeyDown: handleCalendarKeyDown, role: 'listbox' }, weeks.map(function (weekDays, weekIndex) {
|
|
291
|
-
return (React.createElement("div", { key: "week-"
|
|
291
|
+
return (React.createElement("div", { key: "week-".concat(displayedMonthIndex, "-").concat(weekIndex), className: 'iui-calendar-week' }, weekDays.map(function (weekDay, dayIndex) {
|
|
292
292
|
var dateValue = weekDay.getDate();
|
|
293
|
-
return (React.createElement("div", { key: "day-"
|
|
293
|
+
return (React.createElement("div", { key: "day-".concat(displayedMonthIndex, "-").concat(dayIndex), className: getDayClass(weekDay), onClick: function () { return onDayClick(weekDay); }, role: 'option', tabIndex: isSameDay(weekDay, focusedDay) ? 0 : -1, ref: function (element) {
|
|
294
294
|
return isSameDay(weekDay, focusedDay) &&
|
|
295
295
|
needFocus.current &&
|
|
296
296
|
(element === null || element === void 0 ? void 0 : element.focus());
|
|
@@ -71,7 +71,7 @@ export var ExpandableBlock = function (props) {
|
|
|
71
71
|
caption && React.createElement("div", { className: 'iui-caption' }, caption)),
|
|
72
72
|
icon &&
|
|
73
73
|
React.cloneElement(icon, {
|
|
74
|
-
className: cx('iui-status-icon', (_a = {}, _a["iui-"
|
|
74
|
+
className: cx('iui-status-icon', (_a = {}, _a["iui-".concat(status)] = !!status, _a), icon.props.className),
|
|
75
75
|
})),
|
|
76
76
|
React.createElement(WithCSSTransition, { in: expanded },
|
|
77
77
|
React.createElement("div", { className: 'iui-expandable-content' },
|
|
@@ -64,7 +64,7 @@ export var Footer = function (props) {
|
|
|
64
64
|
var defaultElements = [
|
|
65
65
|
{
|
|
66
66
|
key: 'copyright',
|
|
67
|
-
title: "\u00A9 "
|
|
67
|
+
title: "\u00A9 ".concat(new Date().getFullYear(), " Bentley Systems, Incorporated"),
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
key: 'termsOfService',
|
|
@@ -101,7 +101,7 @@ export var Footer = function (props) {
|
|
|
101
101
|
}
|
|
102
102
|
return (React.createElement("footer", __assign({ className: cx('iui-legal-footer', className) }, rest),
|
|
103
103
|
React.createElement("ul", null, elements.map(function (element, index) {
|
|
104
|
-
return (React.createElement("li", { key: element.key || element.title
|
|
104
|
+
return (React.createElement("li", { key: element.key || "".concat(element.title, "-").concat(index) },
|
|
105
105
|
index > 0 && React.createElement("span", { className: 'iui-separator' }),
|
|
106
106
|
element.url ? (React.createElement("a", { href: element.url, target: '_blank', rel: 'noreferrer' }, element.title)) : (element.title)));
|
|
107
107
|
}))));
|
|
@@ -52,7 +52,7 @@ export var HeaderBreadcrumbs = function (props) {
|
|
|
52
52
|
useTheme();
|
|
53
53
|
return (React.createElement("nav", __assign({ "aria-label": 'breadcrumbs' }, rest), items.reduce(function (previous, current, index) { return __spreadArray(__spreadArray([], previous, true), [
|
|
54
54
|
current,
|
|
55
|
-
index !== items.length - 1 && (React.createElement(SvgChevronRight, { key: "chevron"
|
|
55
|
+
index !== items.length - 1 && (React.createElement(SvgChevronRight, { key: "chevron".concat(index), "aria-hidden": true, className: 'iui-chevron' })),
|
|
56
56
|
], false); }, [])));
|
|
57
57
|
};
|
|
58
58
|
export default HeaderBreadcrumbs;
|
|
@@ -76,10 +76,10 @@ export var InformationPanel = React.forwardRef(function (props, ref) {
|
|
|
76
76
|
}
|
|
77
77
|
var _a = infoPanelRef.current.getBoundingClientRect(), right = _a.right, bottom = _a.bottom;
|
|
78
78
|
if (orientation === 'vertical') {
|
|
79
|
-
infoPanelRef.current.style.width = right - e.clientX
|
|
79
|
+
infoPanelRef.current.style.width = "".concat(right - e.clientX, "px");
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
|
-
infoPanelRef.current.style.height = bottom - e.clientY
|
|
82
|
+
infoPanelRef.current.style.height = "".concat(bottom - e.clientY, "px");
|
|
83
83
|
}
|
|
84
84
|
}, [orientation]);
|
|
85
85
|
return (React.createElement("div", __assign({ className: cx('iui-information-panel', {
|
package/esm/core/Input/Input.js
CHANGED
|
@@ -46,6 +46,6 @@ export var Input = React.forwardRef(function (props, ref) {
|
|
|
46
46
|
inputRef.current.focus();
|
|
47
47
|
}
|
|
48
48
|
}, [setFocus]);
|
|
49
|
-
return (React.createElement("input", __assign({ className: cx('iui-input', (_a = {}, _a["iui-"
|
|
49
|
+
return (React.createElement("input", __assign({ className: cx('iui-input', (_a = {}, _a["iui-".concat(size)] = !!size, _a), className), ref: refs }, rest)));
|
|
50
50
|
});
|
|
51
51
|
export default Input;
|
|
@@ -15,7 +15,7 @@ export declare type ProgressLinearProps = {
|
|
|
15
15
|
/**
|
|
16
16
|
* Labels array. One label will be centered, two will be put to the sides.
|
|
17
17
|
*/
|
|
18
|
-
labels?: React.
|
|
18
|
+
labels?: React.ReactNode[];
|
|
19
19
|
/**
|
|
20
20
|
* Apply animation to the value change, if determinate.
|
|
21
21
|
* @default false
|
|
@@ -49,13 +49,13 @@ export var ProgressLinear = function (props) {
|
|
|
49
49
|
useTheme();
|
|
50
50
|
var boundedValue = Math.min(100, Math.max(0, value));
|
|
51
51
|
return (React.createElement("div", __assign({ className: cx('iui-progress-indicator-linear', (_a = {},
|
|
52
|
-
_a["iui-"
|
|
52
|
+
_a["iui-".concat(status)] = !!status,
|
|
53
53
|
_a), className), style: style }, rest),
|
|
54
54
|
React.createElement("div", { className: 'iui-track' },
|
|
55
55
|
React.createElement("div", { className: cx('iui-fill', {
|
|
56
56
|
'iui-determinate': !indeterminate && isAnimated,
|
|
57
57
|
'iui-indeterminate': indeterminate,
|
|
58
|
-
}), style: { width: indeterminate ? '100%' : boundedValue
|
|
58
|
+
}), style: { width: indeterminate ? '100%' : "".concat(boundedValue, "%") } })),
|
|
59
59
|
labels.length > 0 && (React.createElement("div", { className: 'iui-label' }, labels.map(function (label, index) { return (React.createElement("span", { key: index }, label)); })))));
|
|
60
60
|
};
|
|
61
61
|
export default ProgressLinear;
|
|
@@ -63,8 +63,8 @@ export var ProgressRadial = function (props) {
|
|
|
63
63
|
'iui-determinate': !indeterminate,
|
|
64
64
|
'iui-indeterminate': indeterminate
|
|
65
65
|
},
|
|
66
|
-
_a["iui-"
|
|
67
|
-
_a["iui-"
|
|
66
|
+
_a["iui-".concat(size)] = !!size,
|
|
67
|
+
_a["iui-".concat(status)] = !!status,
|
|
68
68
|
_a), className), style: style }, rest),
|
|
69
69
|
React.createElement("svg", { className: 'iui-radial', viewBox: '0 0 32 32', "aria-hidden": 'true' },
|
|
70
70
|
React.createElement("circle", { className: 'iui-track', cx: '16', cy: '16', r: '14' }),
|
package/esm/core/Radio/Radio.js
CHANGED
|
@@ -50,7 +50,7 @@ export var Radio = React.forwardRef(function (props, ref) {
|
|
|
50
50
|
}
|
|
51
51
|
}, [setFocus]);
|
|
52
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-"
|
|
53
|
+
return !label ? (radio) : (React.createElement("label", { className: cx('iui-radio-wrapper', (_b = { 'iui-disabled': disabled }, _b["iui-".concat(status)] = !!status, _b), className), style: style },
|
|
54
54
|
radio,
|
|
55
55
|
label && React.createElement("span", { className: 'iui-radio-label' }, label)));
|
|
56
56
|
});
|
|
@@ -127,7 +127,7 @@ export var Select = function (props) {
|
|
|
127
127
|
return options.map(function (option, index) {
|
|
128
128
|
var isSelected = value === option.value;
|
|
129
129
|
var menuItem = itemRenderer ? (itemRenderer(option, { close: close, isSelected: isSelected })) : (React.createElement(MenuItem, null, option.label));
|
|
130
|
-
return React.cloneElement(menuItem, __assign(__assign({ key: option.label
|
|
130
|
+
return React.cloneElement(menuItem, __assign(__assign({ key: "".concat(option.label, "-").concat(index), isSelected: isSelected, onClick: function () {
|
|
131
131
|
!option.disabled && (onChange === null || onChange === void 0 ? void 0 : onChange(option.value));
|
|
132
132
|
close();
|
|
133
133
|
}, ref: function (el) { return isSelected && (el === null || el === void 0 ? void 0 : el.scrollIntoView()); }, role: 'option' }, option), menuItem.props));
|
|
@@ -140,7 +140,7 @@ export var Select = function (props) {
|
|
|
140
140
|
return options.find(function (option) { return option.value === value; });
|
|
141
141
|
}, [options, value]);
|
|
142
142
|
return (React.createElement("div", __assign({ className: cx('iui-input-with-icon', className), "aria-expanded": isOpen, "aria-haspopup": 'listbox', style: style }, rest),
|
|
143
|
-
React.createElement(DropdownMenu, __assign({ menuItems: menuItems, placement: 'bottom-start', className: cx('iui-scroll', menuClassName), style: __assign({ minWidth: minWidth, maxWidth: "min("
|
|
143
|
+
React.createElement(DropdownMenu, __assign({ menuItems: menuItems, placement: 'bottom-start', className: cx('iui-scroll', menuClassName), style: __assign({ minWidth: minWidth, maxWidth: "min(".concat(minWidth * 2, "px, 90vw)"), maxHeight: "300px" }, menuStyle), role: 'listbox', onShow: onShowHandler, onHide: onHideHandler, disabled: disabled }, popoverProps, { visible: isOpen, onClickOutside: function (_, _a) {
|
|
144
144
|
var _b;
|
|
145
145
|
var target = _a.target;
|
|
146
146
|
if (!((_b = toggleButtonRef.current) === null || _b === void 0 ? void 0 : _b.contains(target))) {
|
|
@@ -151,7 +151,7 @@ export var Select = function (props) {
|
|
|
151
151
|
'iui-placeholder': !selectedItem && !!placeholder,
|
|
152
152
|
'iui-disabled': disabled
|
|
153
153
|
},
|
|
154
|
-
_a["iui-"
|
|
154
|
+
_a["iui-".concat(size)] = !!size,
|
|
155
155
|
_a)), onClick: function () { return !disabled && toggle(); }, onKeyDown: function (e) { return !disabled && onKeyDown(e, toggle); }, tabIndex: !disabled ? 0 : undefined },
|
|
156
156
|
!selectedItem && React.createElement("span", { className: 'iui-content' }, placeholder),
|
|
157
157
|
selectedItem &&
|
|
@@ -74,7 +74,7 @@ var focusThumb = function (sliderContainer, activeIndex) {
|
|
|
74
74
|
var doc = sliderContainer.ownerDocument;
|
|
75
75
|
if (!sliderContainer.contains(doc.activeElement) ||
|
|
76
76
|
Number((_a = doc.activeElement) === null || _a === void 0 ? void 0 : _a.getAttribute('data-index')) !== activeIndex) {
|
|
77
|
-
var thumbToFocus = sliderContainer.querySelector("[data-index=\""
|
|
77
|
+
var thumbToFocus = sliderContainer.querySelector("[data-index=\"".concat(activeIndex, "\"]"));
|
|
78
78
|
thumbToFocus && thumbToFocus.focus();
|
|
79
79
|
}
|
|
80
80
|
};
|
package/esm/core/Slider/Thumb.js
CHANGED
|
@@ -64,8 +64,22 @@ export var Thumb = function (props) {
|
|
|
64
64
|
}, [disabled, index, onThumbActivated]);
|
|
65
65
|
var _a = React.useState(false), hasFocus = _a[0], setHasFocus = _a[1];
|
|
66
66
|
var _b = React.useState(false), isHovered = _b[0], setIsHovered = _b[1];
|
|
67
|
-
var
|
|
67
|
+
var adjustedValue = React.useMemo(function () {
|
|
68
|
+
if (value < sliderMin) {
|
|
69
|
+
return sliderMin;
|
|
70
|
+
}
|
|
71
|
+
if (value > sliderMax) {
|
|
72
|
+
return sliderMax;
|
|
73
|
+
}
|
|
74
|
+
return value;
|
|
75
|
+
}, [sliderMax, sliderMin, value]);
|
|
76
|
+
var leftPercent = React.useMemo(function () {
|
|
77
|
+
if (sliderMax === sliderMin) {
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
return (100.0 * (adjustedValue - sliderMin)) / (sliderMax - sliderMin);
|
|
81
|
+
}, [adjustedValue, sliderMax, sliderMin]);
|
|
68
82
|
var _c = thumbProps || {}, style = _c.style, className = _c.className, rest = __rest(_c, ["style", "className"]);
|
|
69
83
|
return (React.createElement(Tooltip, __assign({ visible: isActive || hasFocus || isHovered, placement: 'top' }, tooltipProps),
|
|
70
|
-
React.createElement("div", __assign({}, rest, { "data-index": index, ref: thumbRef, style: __assign(__assign({}, style), { left: leftPercent
|
|
84
|
+
React.createElement("div", __assign({}, rest, { "data-index": index, ref: thumbRef, style: __assign(__assign({}, style), { left: "".concat(leftPercent, "%") }), className: cx('iui-slider-thumb', { 'iui-active': isActive }, className), role: 'slider', tabIndex: disabled ? undefined : 0, "aria-valuemin": minVal, "aria-valuenow": value, "aria-valuemax": maxVal, "aria-disabled": disabled, onPointerDown: handlePointerDownOnThumb, onKeyDown: handleOnKeyDown, onFocus: function () { return setHasFocus(true); }, onBlur: function () { return setHasFocus(false); }, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }))));
|
|
71
85
|
};
|
package/esm/core/Slider/Track.js
CHANGED
|
@@ -23,10 +23,18 @@ function shouldDisplaySegment(segmentIndex, mode) {
|
|
|
23
23
|
}
|
|
24
24
|
function generateSegments(values, min, max) {
|
|
25
25
|
var segments = [];
|
|
26
|
+
var newValues = __spreadArray([], values, true);
|
|
27
|
+
newValues.sort(function (a, b) { return a - b; });
|
|
28
|
+
if (0 === newValues.length ||
|
|
29
|
+
newValues[0] < min ||
|
|
30
|
+
newValues[newValues.length - 1] > max ||
|
|
31
|
+
min === max) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
26
34
|
var lastValue = min;
|
|
27
|
-
for (var i = 0; i <
|
|
28
|
-
segments.push({ left: lastValue, right:
|
|
29
|
-
lastValue =
|
|
35
|
+
for (var i = 0; i < newValues.length; i++) {
|
|
36
|
+
segments.push({ left: lastValue, right: newValues[i] });
|
|
37
|
+
lastValue = newValues[i];
|
|
30
38
|
}
|
|
31
39
|
segments.push({ left: lastValue, right: max });
|
|
32
40
|
return segments;
|
|
@@ -37,18 +45,21 @@ function generateSegments(values, min, max) {
|
|
|
37
45
|
*/
|
|
38
46
|
export var Track = function (props) {
|
|
39
47
|
var trackDisplayMode = props.trackDisplayMode, sliderMin = props.sliderMin, sliderMax = props.sliderMax, values = props.values;
|
|
40
|
-
var _a = React.useState(
|
|
48
|
+
var _a = React.useState(function () {
|
|
49
|
+
return generateSegments(values, sliderMin, sliderMax);
|
|
50
|
+
}), segments = _a[0], setSegments = _a[1];
|
|
41
51
|
React.useEffect(function () {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
setCurrentValues(newValues);
|
|
45
|
-
}, [values]);
|
|
46
|
-
var segments = React.useMemo(function () { return generateSegments(currentValues, sliderMin, sliderMax); }, [currentValues, sliderMin, sliderMax]);
|
|
52
|
+
setSegments(generateSegments(values, sliderMin, sliderMax));
|
|
53
|
+
}, [values, sliderMin, sliderMax]);
|
|
47
54
|
return (React.createElement(React.Fragment, null, 'none' !== trackDisplayMode &&
|
|
48
55
|
segments.map(function (segment, index) {
|
|
49
|
-
var leftPercent =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
var leftPercent = segment.left >= sliderMin && sliderMax !== sliderMin
|
|
57
|
+
? (100.0 * (segment.left - sliderMin)) / (sliderMax - sliderMin)
|
|
58
|
+
: 0;
|
|
59
|
+
var rightPercent = segment.right >= sliderMin && sliderMax !== sliderMin
|
|
60
|
+
? 100.0 -
|
|
61
|
+
(100.0 * (segment.right - sliderMin)) / (sliderMax - sliderMin)
|
|
62
|
+
: 100;
|
|
63
|
+
return (React.createElement(React.Fragment, { key: index }, shouldDisplaySegment(index, trackDisplayMode) ? (React.createElement("div", { className: 'iui-slider-track', style: { left: "".concat(leftPercent, "%"), right: "".concat(rightPercent, "%") } })) : null));
|
|
53
64
|
})));
|
|
54
65
|
};
|
|
@@ -57,7 +57,7 @@ export var Surface = React.forwardRef(function (props, ref) {
|
|
|
57
57
|
var _a, _b, _c;
|
|
58
58
|
var _d = props.elevation, elevation = _d === void 0 ? 0 : _d, className = props.className, style = props.style, children = props.children, rest = __rest(props, ["elevation", "className", "style", "children"]);
|
|
59
59
|
useTheme();
|
|
60
|
-
var _style = ((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-surface-elevation: "
|
|
60
|
+
var _style = ((_c = (_b = (_a = getWindow()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-surface-elevation: ".concat(getSurfaceElevationValue(elevation))))
|
|
61
61
|
? __assign({ '--iui-surface-elevation': getSurfaceElevationValue(elevation) }, style) : __assign({ boxShadow: getSurfaceElevationValue(elevation) }, style);
|
|
62
62
|
return (React.createElement("div", __assign({ className: cx('iui-surface', className), style: _style, ref: ref }, rest), children));
|
|
63
63
|
});
|