@itwin/itwinui-react 1.24.0 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/cjs/core/Buttons/Button/Button.d.ts +1 -1
- package/cjs/core/Buttons/Button/Button.js +4 -5
- package/cjs/core/Buttons/IconButton/IconButton.js +2 -3
- package/cjs/core/Checkbox/Checkbox.d.ts +11 -0
- package/cjs/core/Checkbox/Checkbox.js +14 -4
- package/cjs/core/ColorPicker/ColorBuilder.js +1 -1
- package/cjs/core/ColorPicker/ColorInputPanel.js +43 -21
- package/cjs/core/ColorPicker/ColorPalette.js +1 -1
- package/cjs/core/ColorPicker/ColorPicker.js +2 -2
- package/cjs/core/ColorPicker/ColorPickerContext.d.ts +2 -2
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/ColorPicker/ColorSwatch.js +10 -6
- package/cjs/core/ComboBox/ComboBox.d.ts +2 -2
- package/cjs/core/DatePicker/DatePicker.d.ts +1 -1
- package/cjs/core/ErrorPage/ErrorPage.d.ts +2 -1
- package/cjs/core/ErrorPage/ErrorPage.js +3 -2
- package/cjs/core/InformationPanel/InformationPanel.d.ts +4 -1
- package/cjs/core/InformationPanel/InformationPanel.js +4 -1
- package/cjs/core/InformationPanel/InformationPanelContent.d.ts +42 -0
- package/cjs/core/InformationPanel/InformationPanelContent.js +66 -0
- package/cjs/core/InformationPanel/index.d.ts +2 -0
- package/cjs/core/InformationPanel/index.js +3 -1
- package/cjs/core/Label/Label.d.ts +31 -0
- package/cjs/core/Label/Label.js +53 -0
- package/cjs/core/Label/index.d.ts +4 -0
- package/cjs/core/Label/index.js +10 -0
- package/cjs/core/LabeledInput/LabeledInput.d.ts +2 -2
- package/cjs/core/LabeledTextarea/LabeledTextarea.d.ts +1 -1
- package/cjs/core/Menu/MenuItem.d.ts +1 -1
- package/cjs/core/Modal/ModalButtonBar.d.ts +2 -1
- package/cjs/core/Modal/ModalButtonBar.js +3 -2
- package/cjs/core/Table/Table.d.ts +8 -0
- package/cjs/core/Table/Table.js +71 -10
- package/cjs/core/Table/TableCell.js +1 -1
- package/cjs/core/Table/TablePaginator.d.ts +7 -7
- package/cjs/core/Table/TablePaginator.js +20 -10
- package/cjs/core/Table/TableRowMemoized.d.ts +21 -0
- package/cjs/core/Table/TableRowMemoized.js +6 -3
- package/cjs/core/Table/actionHandlers/resizeHandler.d.ts +51 -0
- package/cjs/core/Table/actionHandlers/resizeHandler.js +22 -0
- package/cjs/core/Table/actionHandlers/selectHandler.d.ts +10 -7
- package/cjs/core/Table/hooks/index.d.ts +1 -0
- package/cjs/core/Table/hooks/index.js +3 -1
- package/cjs/core/Table/hooks/useResizeColumns.d.ts +5 -0
- package/cjs/core/Table/hooks/useResizeColumns.js +271 -0
- package/cjs/core/Table/utils.d.ts +1 -1
- package/cjs/core/Table/utils.js +8 -2
- package/cjs/core/Tabs/Tabs.d.ts +4 -0
- package/cjs/core/Tabs/Tabs.js +23 -29
- package/cjs/core/index.d.ts +6 -4
- package/cjs/core/index.js +6 -2
- package/cjs/core/utils/color/ColorValue.d.ts +1 -0
- package/cjs/core/utils/color/ColorValue.js +96 -84
- package/cjs/core/utils/components/MiddleTextTruncation.d.ts +21 -0
- package/cjs/core/utils/components/MiddleTextTruncation.js +56 -0
- package/cjs/core/utils/components/index.d.ts +1 -0
- package/cjs/core/utils/components/index.js +1 -0
- package/cjs/core/utils/hooks/index.d.ts +1 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useContainerWidth.d.ts +17 -0
- package/cjs/core/utils/hooks/useContainerWidth.js +50 -0
- package/cjs/core/utils/hooks/useOverflow.d.ts +1 -1
- package/cjs/core/utils/hooks/useOverflow.js +30 -17
- package/cjs/types/react-table-config.d.ts +16 -3
- package/esm/core/Buttons/Button/Button.d.ts +1 -1
- package/esm/core/Buttons/Button/Button.js +4 -5
- package/esm/core/Buttons/IconButton/IconButton.js +2 -3
- package/esm/core/Checkbox/Checkbox.d.ts +11 -0
- package/esm/core/Checkbox/Checkbox.js +14 -4
- package/esm/core/ColorPicker/ColorBuilder.js +1 -1
- package/esm/core/ColorPicker/ColorInputPanel.js +43 -21
- package/esm/core/ColorPicker/ColorPalette.js +1 -1
- package/esm/core/ColorPicker/ColorPicker.js +2 -2
- package/esm/core/ColorPicker/ColorPickerContext.d.ts +2 -2
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/ColorPicker/ColorSwatch.js +10 -6
- package/esm/core/ComboBox/ComboBox.d.ts +2 -2
- package/esm/core/DatePicker/DatePicker.d.ts +1 -1
- package/esm/core/ErrorPage/ErrorPage.d.ts +2 -1
- package/esm/core/ErrorPage/ErrorPage.js +3 -2
- package/esm/core/InformationPanel/InformationPanel.d.ts +4 -1
- package/esm/core/InformationPanel/InformationPanel.js +4 -1
- package/esm/core/InformationPanel/InformationPanelContent.d.ts +42 -0
- package/esm/core/InformationPanel/InformationPanelContent.js +59 -0
- package/esm/core/InformationPanel/index.d.ts +2 -0
- package/esm/core/InformationPanel/index.js +1 -0
- package/esm/core/Label/Label.d.ts +31 -0
- package/esm/core/Label/Label.js +46 -0
- package/esm/core/Label/index.d.ts +4 -0
- package/esm/core/Label/index.js +6 -0
- package/esm/core/LabeledInput/LabeledInput.d.ts +2 -2
- package/esm/core/LabeledTextarea/LabeledTextarea.d.ts +1 -1
- package/esm/core/Menu/MenuItem.d.ts +1 -1
- package/esm/core/Modal/ModalButtonBar.d.ts +2 -1
- package/esm/core/Modal/ModalButtonBar.js +3 -2
- package/esm/core/Table/Table.d.ts +8 -0
- package/esm/core/Table/Table.js +73 -12
- package/esm/core/Table/TableCell.js +1 -1
- package/esm/core/Table/TablePaginator.d.ts +7 -7
- package/esm/core/Table/TablePaginator.js +21 -11
- package/esm/core/Table/TableRowMemoized.d.ts +21 -0
- package/esm/core/Table/TableRowMemoized.js +4 -2
- package/esm/core/Table/actionHandlers/resizeHandler.d.ts +51 -0
- package/esm/core/Table/actionHandlers/resizeHandler.js +17 -0
- package/esm/core/Table/actionHandlers/selectHandler.d.ts +10 -7
- package/esm/core/Table/hooks/index.d.ts +1 -0
- package/esm/core/Table/hooks/index.js +1 -0
- package/esm/core/Table/hooks/useResizeColumns.d.ts +5 -0
- package/esm/core/Table/hooks/useResizeColumns.js +267 -0
- package/esm/core/Table/utils.d.ts +1 -1
- package/esm/core/Table/utils.js +8 -2
- package/esm/core/Tabs/Tabs.d.ts +4 -0
- package/esm/core/Tabs/Tabs.js +24 -30
- package/esm/core/index.d.ts +6 -4
- package/esm/core/index.js +3 -2
- package/esm/core/utils/color/ColorValue.d.ts +1 -0
- package/esm/core/utils/color/ColorValue.js +96 -84
- package/esm/core/utils/components/MiddleTextTruncation.d.ts +21 -0
- package/esm/core/utils/components/MiddleTextTruncation.js +49 -0
- package/esm/core/utils/components/index.d.ts +1 -0
- package/esm/core/utils/components/index.js +1 -0
- package/esm/core/utils/hooks/index.d.ts +1 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useContainerWidth.d.ts +17 -0
- package/esm/core/utils/hooks/useContainerWidth.js +43 -0
- package/esm/core/utils/hooks/useOverflow.d.ts +1 -1
- package/esm/core/utils/hooks/useOverflow.js +30 -17
- package/esm/types/react-table-config.d.ts +16 -3
- package/package.json +13 -5
|
@@ -38,12 +38,11 @@ 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, rest = __rest(props, ["isActive", "children", "styleType", "size", "type", "className"]);
|
|
40
40
|
useTheme();
|
|
41
|
-
return (React.createElement("button", __assign({ ref: ref, className: cx('iui-button', (_a = {},
|
|
41
|
+
return (React.createElement("button", __assign({ ref: ref, className: cx('iui-button', "iui-" + styleType, (_a = {},
|
|
42
42
|
_a["iui-" + size] = !!size,
|
|
43
|
-
_a["iui-" + styleType] = styleType !== 'default',
|
|
44
43
|
_a['iui-active'] = isActive,
|
|
45
44
|
_a), className), type: type }, rest), React.cloneElement(children, {
|
|
46
|
-
className: cx('iui-icon', children.props.className),
|
|
45
|
+
className: cx('iui-button-icon', children.props.className),
|
|
47
46
|
'aria-hidden': true,
|
|
48
47
|
})));
|
|
49
48
|
});
|
|
@@ -14,6 +14,11 @@ export declare type CheckboxProps = {
|
|
|
14
14
|
* Status of checkbox.
|
|
15
15
|
*/
|
|
16
16
|
status?: 'positive' | 'warning' | 'negative';
|
|
17
|
+
/**
|
|
18
|
+
* Type of checkbox, regular or eyeball checkbox that is used for visibility.
|
|
19
|
+
* @default 'default'
|
|
20
|
+
*/
|
|
21
|
+
variant?: 'default' | 'eyeball';
|
|
17
22
|
/**
|
|
18
23
|
* Set focus on checkbox.
|
|
19
24
|
*/
|
|
@@ -41,6 +46,7 @@ export declare type CheckboxProps = {
|
|
|
41
46
|
* <Checkbox label='Positive Checkbox' status='positive' />
|
|
42
47
|
* <Checkbox label='Warning Checkbox' status='warning' />
|
|
43
48
|
* <Checkbox label='Negative Checkbox' status='negative' />
|
|
49
|
+
* <Checkbox label='Visibility Checkbox' variant='eyeball' />
|
|
44
50
|
*/
|
|
45
51
|
export declare const Checkbox: React.ForwardRefExoticComponent<{
|
|
46
52
|
/**
|
|
@@ -56,6 +62,11 @@ export declare const Checkbox: React.ForwardRefExoticComponent<{
|
|
|
56
62
|
* Status of checkbox.
|
|
57
63
|
*/
|
|
58
64
|
status?: "positive" | "warning" | "negative" | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Type of checkbox, regular or eyeball checkbox that is used for visibility.
|
|
67
|
+
* @default 'default'
|
|
68
|
+
*/
|
|
69
|
+
variant?: "default" | "eyeball" | undefined;
|
|
59
70
|
/**
|
|
60
71
|
* Set focus on checkbox.
|
|
61
72
|
*/
|
|
@@ -38,10 +38,11 @@ import '@itwin/itwinui-css/css/inputs.css';
|
|
|
38
38
|
* <Checkbox label='Positive Checkbox' status='positive' />
|
|
39
39
|
* <Checkbox label='Warning Checkbox' status='warning' />
|
|
40
40
|
* <Checkbox label='Negative Checkbox' status='negative' />
|
|
41
|
+
* <Checkbox label='Visibility Checkbox' variant='eyeball' />
|
|
41
42
|
*/
|
|
42
43
|
export var Checkbox = React.forwardRef(function (props, ref) {
|
|
43
44
|
var _a;
|
|
44
|
-
var className = props.className, _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props.indeterminate, indeterminate = _c === void 0 ? false : _c, label = props.label, status = props.status, setFocus = props.setFocus,
|
|
45
|
+
var className = props.className, _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props.indeterminate, indeterminate = _c === void 0 ? false : _c, label = props.label, status = props.status, _d = props.variant, variant = _d === void 0 ? 'default' : _d, setFocus = props.setFocus, _e = props.isLoading, isLoading = _e === void 0 ? false : _e, style = props.style, checkmarkClassName = props.checkmarkClassName, checkmarkStyle = props.checkmarkStyle, rest = __rest(props, ["className", "disabled", "indeterminate", "label", "status", "variant", "setFocus", "isLoading", "style", "checkmarkClassName", "checkmarkStyle"]);
|
|
45
46
|
useTheme();
|
|
46
47
|
var inputElementRef = React.useRef(null);
|
|
47
48
|
var refs = useMergedRefs(inputElementRef, ref);
|
|
@@ -58,18 +59,27 @@ export var Checkbox = React.forwardRef(function (props, ref) {
|
|
|
58
59
|
: inputElementRef.current.checked;
|
|
59
60
|
}
|
|
60
61
|
});
|
|
62
|
+
var defaultCheckbox = (React.createElement("svg", { viewBox: '0 0 16 16', "aria-hidden": 'true', focusable: 'false' },
|
|
63
|
+
React.createElement("path", { className: 'iui-check', d: 'M6,14L0,8l2-2l4,4l8-8l2,2L6,14z' }),
|
|
64
|
+
React.createElement("path", { className: 'iui-check-partial', d: 'm1 6.5h14v3h-14z' })));
|
|
65
|
+
var visibilityCheckbox = (React.createElement("svg", { viewBox: '0 0 16 16', "aria-hidden": 'true', focusable: 'false' },
|
|
66
|
+
React.createElement("path", { className: 'iui-check', d: 'm8 2.99051a8.81883 8.81883 0 0 0 -8 4.95062 8.74664 8.74664 0 0 0 8 5.06836 8.63266 8.63266 0 0 0 8-5.06836 8.83631 8.83631 0 0 0 -8-4.95062zm-1.31445 1.86981a1.47663 1.47663 0 1 1 -1.47663 1.47668 1.47665 1.47665 0 0 1 1.47663-1.47668zm1.31445 6.64917a7.17486 7.17486 0 0 1 -6.30475-3.55237 7.4952 7.4952 0 0 1 2.81475-2.6336 3.83956 3.83956 0 1 0 6.98126.00244 7.522 7.522 0 0 1 2.81774 2.63916 7.09785 7.09785 0 0 1 -6.309 3.54437z' }),
|
|
67
|
+
React.createElement("g", { className: 'iui-check-partial' },
|
|
68
|
+
React.createElement("path", { d: 'm8 3v7.9a4.01179 4.01179 0 0 0 4-4 6.7509 6.7509 0 0 0 -.2-1.4l.1.1a6.89429 6.89429 0 0 1 2.4 2.4 8.39088 8.39088 0 0 1 -2.3 2.3 6.89412 6.89412 0 0 1 -3.9 1.2c-.03345 0-.06653-.00677-.1-.0072v1.5072a8.90686 8.90686 0 0 0 8-5 8.90686 8.90686 0 0 0 -8-5z', opacity: '.33' }),
|
|
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' })));
|
|
61
71
|
return (React.createElement("label", { className: cx('iui-checkbox', (_a = {
|
|
62
72
|
'iui-disabled': disabled
|
|
63
73
|
},
|
|
64
74
|
_a["iui-" + status] = !!status,
|
|
65
75
|
_a['iui-loading'] = isLoading,
|
|
76
|
+
_a['iui-checkbox-visibility'] = variant === 'eyeball',
|
|
66
77
|
_a), className), style: style },
|
|
67
78
|
React.createElement("input", __assign({ disabled: disabled || isLoading, type: 'checkbox', ref: refs }, rest)),
|
|
68
79
|
React.createElement("span", { className: cx('iui-checkbox-checkmark', checkmarkClassName), style: checkmarkStyle },
|
|
69
80
|
isLoading && React.createElement(ProgressRadial, { indeterminate: true }),
|
|
70
|
-
!isLoading &&
|
|
71
|
-
|
|
72
|
-
React.createElement("path", { className: 'iui-check-partial', d: 'm1 6.5h14v3h-14z' })))),
|
|
81
|
+
!isLoading &&
|
|
82
|
+
(variant === 'default' ? defaultCheckbox : visibilityCheckbox)),
|
|
73
83
|
label && React.createElement("span", { className: 'iui-label' }, label)));
|
|
74
84
|
});
|
|
75
85
|
export default Checkbox;
|
|
@@ -86,7 +86,7 @@ export var ColorBuilder = React.forwardRef(function (props, ref) {
|
|
|
86
86
|
};
|
|
87
87
|
// Update slider change
|
|
88
88
|
var updateHueSlider = React.useCallback(function (huePercent, selectionChanged) {
|
|
89
|
-
var hue =
|
|
89
|
+
var hue = Number(huePercent.toFixed(2));
|
|
90
90
|
var newHsvColor = {
|
|
91
91
|
h: hue,
|
|
92
92
|
s: hsvColor.s,
|
|
@@ -44,6 +44,7 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
44
44
|
var _a, _b, _c, _d, _f, _g, _h, _j;
|
|
45
45
|
var defaultColorFormat = props.defaultColorFormat, _k = props.allowedColorFormats, allowedColorFormats = _k === void 0 ? ['hsl', 'rgb', 'hex'] : _k, className = props.className, rest = __rest(props, ["defaultColorFormat", "allowedColorFormats", "className"]);
|
|
46
46
|
useTheme();
|
|
47
|
+
var inputsContainerRef = React.useRef(null);
|
|
47
48
|
var _l = useColorPickerContext(), activeColor = _l.activeColor, applyHsvColorChange = _l.applyHsvColorChange, hsvColor = _l.hsvColor, showAlpha = _l.showAlpha;
|
|
48
49
|
var _m = React.useState(defaultColorFormat), currentFormat = _m[0], setCurrentFormat = _m[1];
|
|
49
50
|
React.useEffect(function () {
|
|
@@ -52,14 +53,14 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
52
53
|
// need to use state since input may have parsing error
|
|
53
54
|
var _o = React.useState(['', '', '', '']), input = _o[0], setInput = _o[1];
|
|
54
55
|
React.useEffect(function () {
|
|
55
|
-
var _a, _b
|
|
56
|
+
var _a, _b;
|
|
56
57
|
if (currentFormat === 'hsl') {
|
|
57
58
|
var hsl = activeColor.toHslColor();
|
|
58
59
|
setInput([
|
|
59
|
-
hsvColor.h
|
|
60
|
-
hsl.s
|
|
61
|
-
hsl.l
|
|
62
|
-
(
|
|
60
|
+
ColorValue.getFormattedColorNumber(hsvColor.h),
|
|
61
|
+
ColorValue.getFormattedColorNumber(hsl.s),
|
|
62
|
+
ColorValue.getFormattedColorNumber(hsl.l),
|
|
63
|
+
ColorValue.getFormattedColorNumber((_a = hsl.a) !== null && _a !== void 0 ? _a : activeColor.getAlpha() / 255, 2),
|
|
63
64
|
]);
|
|
64
65
|
}
|
|
65
66
|
else if (currentFormat === 'rgb') {
|
|
@@ -68,7 +69,7 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
68
69
|
rgb.r.toString(),
|
|
69
70
|
rgb.g.toString(),
|
|
70
71
|
rgb.b.toString(),
|
|
71
|
-
(
|
|
72
|
+
ColorValue.getFormattedColorNumber((_b = rgb.a) !== null && _b !== void 0 ? _b : activeColor.getAlpha() / 255, 2),
|
|
72
73
|
]);
|
|
73
74
|
}
|
|
74
75
|
else {
|
|
@@ -83,6 +84,11 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
83
84
|
allowedColorFormats.length]) !== null && _a !== void 0 ? _a : allowedColorFormats[0];
|
|
84
85
|
setCurrentFormat(newFormat);
|
|
85
86
|
}, [currentFormat, allowedColorFormats]);
|
|
87
|
+
var isFocusInside = function (focused) {
|
|
88
|
+
return !!(focused &&
|
|
89
|
+
inputsContainerRef.current &&
|
|
90
|
+
inputsContainerRef.current.contains(focused));
|
|
91
|
+
};
|
|
86
92
|
var handleColorInputChange = function () {
|
|
87
93
|
var color;
|
|
88
94
|
if (currentFormat === 'hex') {
|
|
@@ -136,7 +142,7 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
136
142
|
color = ColorValue.create({ r: r, g: g, b: b, a: a });
|
|
137
143
|
}
|
|
138
144
|
if (color) {
|
|
139
|
-
applyHsvColorChange(color.toHsvColor(), true);
|
|
145
|
+
applyHsvColorChange(color.toHsvColor(), true, color);
|
|
140
146
|
}
|
|
141
147
|
};
|
|
142
148
|
var hexInputField = (React.createElement(InputContainer, { status: validHexInput ? undefined : 'negative' },
|
|
@@ -158,7 +164,7 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
158
164
|
React.createElement(InputContainer, { status: Number(input[0]) < 0 || Number(input[0]) > 360
|
|
159
165
|
? 'negative'
|
|
160
166
|
: undefined },
|
|
161
|
-
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '359', placeholder: 'H', value: (_a = input[0]) !== null && _a !== void 0 ? _a : '', onChange: function (event) {
|
|
167
|
+
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '359', step: '.1', placeholder: 'H', value: (_a = input[0]) !== null && _a !== void 0 ? _a : '', onChange: function (event) {
|
|
162
168
|
setInput([event.target.value, input[1], input[2], input[3]]);
|
|
163
169
|
}, onKeyDown: function (event) {
|
|
164
170
|
if (event.key === 'Enter') {
|
|
@@ -167,12 +173,14 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
167
173
|
}
|
|
168
174
|
}, onBlur: function (event) {
|
|
169
175
|
event.preventDefault();
|
|
170
|
-
|
|
176
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
177
|
+
handleColorInputChange();
|
|
178
|
+
}
|
|
171
179
|
} })),
|
|
172
180
|
React.createElement(InputContainer, { status: Number(input[1]) < 0 || Number(input[1]) > 100
|
|
173
181
|
? 'negative'
|
|
174
182
|
: undefined },
|
|
175
|
-
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '100', placeholder: 'S', value: (_b = input[1]) !== null && _b !== void 0 ? _b : '', onChange: function (event) {
|
|
183
|
+
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'S', value: (_b = input[1]) !== null && _b !== void 0 ? _b : '', onChange: function (event) {
|
|
176
184
|
setInput([input[0], event.target.value, input[2], input[3]]);
|
|
177
185
|
}, onKeyDown: function (event) {
|
|
178
186
|
if (event.key === 'Enter') {
|
|
@@ -181,12 +189,14 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
181
189
|
}
|
|
182
190
|
}, onBlur: function (event) {
|
|
183
191
|
event.preventDefault();
|
|
184
|
-
|
|
192
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
193
|
+
handleColorInputChange();
|
|
194
|
+
}
|
|
185
195
|
} })),
|
|
186
196
|
React.createElement(InputContainer, { status: Number(input[2]) < 0 || Number(input[2]) > 100
|
|
187
197
|
? 'negative'
|
|
188
198
|
: undefined },
|
|
189
|
-
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '100', placeholder: 'L', value: (_c = input[2]) !== null && _c !== void 0 ? _c : '', onChange: function (event) {
|
|
199
|
+
React.createElement(Input, { size: 'small', type: 'number', min: '0', max: '100', step: '.1', placeholder: 'L', value: (_c = input[2]) !== null && _c !== void 0 ? _c : '', onChange: function (event) {
|
|
190
200
|
setInput([input[0], input[1], event.target.value, input[3]]);
|
|
191
201
|
}, onKeyDown: function (event) {
|
|
192
202
|
if (event.key === 'Enter') {
|
|
@@ -195,7 +205,9 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
195
205
|
}
|
|
196
206
|
}, onBlur: function (event) {
|
|
197
207
|
event.preventDefault();
|
|
198
|
-
|
|
208
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
209
|
+
handleColorInputChange();
|
|
210
|
+
}
|
|
199
211
|
} })),
|
|
200
212
|
showAlpha && (React.createElement(InputContainer, { status: Number(input[3]) < 0 || Number(input[3]) > 1
|
|
201
213
|
? 'negative'
|
|
@@ -209,7 +221,9 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
209
221
|
}
|
|
210
222
|
}, onBlur: function (event) {
|
|
211
223
|
event.preventDefault();
|
|
212
|
-
|
|
224
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
225
|
+
handleColorInputChange();
|
|
226
|
+
}
|
|
213
227
|
} })))));
|
|
214
228
|
var rgbInputs = (React.createElement(React.Fragment, null,
|
|
215
229
|
React.createElement(InputContainer, { status: Number(input[0]) < 0 || Number(input[0]) > 255
|
|
@@ -224,7 +238,9 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
224
238
|
}
|
|
225
239
|
}, onBlur: function (event) {
|
|
226
240
|
event.preventDefault();
|
|
227
|
-
|
|
241
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
242
|
+
handleColorInputChange();
|
|
243
|
+
}
|
|
228
244
|
} })),
|
|
229
245
|
React.createElement(InputContainer, { status: Number(input[1]) < 0 || Number(input[1]) > 255
|
|
230
246
|
? 'negative'
|
|
@@ -238,7 +254,9 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
238
254
|
}
|
|
239
255
|
}, onBlur: function (event) {
|
|
240
256
|
event.preventDefault();
|
|
241
|
-
|
|
257
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
258
|
+
handleColorInputChange();
|
|
259
|
+
}
|
|
242
260
|
} })),
|
|
243
261
|
React.createElement(InputContainer, { status: Number(input[2]) < 0 || Number(input[2]) > 255
|
|
244
262
|
? 'negative'
|
|
@@ -252,7 +270,9 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
252
270
|
}
|
|
253
271
|
}, onBlur: function (event) {
|
|
254
272
|
event.preventDefault();
|
|
255
|
-
|
|
273
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
274
|
+
handleColorInputChange();
|
|
275
|
+
}
|
|
256
276
|
} })),
|
|
257
277
|
showAlpha && (React.createElement(InputContainer, { status: Number(input[3]) < 0 || Number(input[3]) > 1
|
|
258
278
|
? 'negative'
|
|
@@ -266,7 +286,9 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
266
286
|
}
|
|
267
287
|
}, onBlur: function (event) {
|
|
268
288
|
event.preventDefault();
|
|
269
|
-
|
|
289
|
+
if (!isFocusInside(event.relatedTarget)) {
|
|
290
|
+
handleColorInputChange();
|
|
291
|
+
}
|
|
270
292
|
} })))));
|
|
271
293
|
return (React.createElement("div", __assign({ className: cx('iui-color-input-wrapper', className), ref: ref }, rest),
|
|
272
294
|
React.createElement("div", { className: 'iui-color-picker-section-label' }, showAlpha && currentFormat != 'hex'
|
|
@@ -276,9 +298,9 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
276
298
|
allowedColorFormats.length > 1 && (React.createElement(IconButton, { styleType: 'borderless', onClick: swapColorFormat, size: 'small' },
|
|
277
299
|
React.createElement("svg", { viewBox: '0 0 16 16', className: 'iui-icon', "aria-hidden": true },
|
|
278
300
|
React.createElement("path", { d: 'm5 15-3.78125-3.5 3.78125-3.5v2h8v3h-8zm6-7 3.78125-3.5-3.78125-3.5v2h-8v3h8z' })))),
|
|
279
|
-
React.createElement("div", { className: 'iui-color-input-fields' },
|
|
301
|
+
React.createElement("div", { ref: inputsContainerRef, className: 'iui-color-input-fields' },
|
|
280
302
|
currentFormat === 'hex' && hexInputField,
|
|
281
|
-
currentFormat === '
|
|
282
|
-
currentFormat === '
|
|
303
|
+
currentFormat === 'rgb' && rgbInputs,
|
|
304
|
+
currentFormat === 'hsl' && hslInputs))));
|
|
283
305
|
});
|
|
284
306
|
export default ColorInputPanel;
|
|
@@ -123,7 +123,7 @@ export var ColorPalette = React.forwardRef(function (props, ref) {
|
|
|
123
123
|
event.preventDefault();
|
|
124
124
|
onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(color);
|
|
125
125
|
setActiveColor(color);
|
|
126
|
-
}, isActive: color.
|
|
126
|
+
}, isActive: color.equals(activeColor) }));
|
|
127
127
|
}))));
|
|
128
128
|
});
|
|
129
129
|
export default ColorPalette;
|
|
@@ -79,10 +79,10 @@ export var ColorPicker = function (props) {
|
|
|
79
79
|
setHsvColor(inColor.toHsvColor());
|
|
80
80
|
}
|
|
81
81
|
}, [inColor]);
|
|
82
|
-
var applyHsvColorChange = React.useCallback(function (newColor, selectionChanged) {
|
|
82
|
+
var applyHsvColorChange = React.useCallback(function (newColor, selectionChanged, newColorValue) {
|
|
83
83
|
// save the HSV values
|
|
84
84
|
setHsvColor(newColor);
|
|
85
|
-
var newActiveColor = ColorValue.create(newColor);
|
|
85
|
+
var newActiveColor = newColorValue !== null && newColorValue !== void 0 ? newColorValue : ColorValue.create(newColor);
|
|
86
86
|
// Only update selected color when dragging is done
|
|
87
87
|
if (selectionChanged) {
|
|
88
88
|
onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(newActiveColor);
|
|
@@ -5,7 +5,7 @@ export declare const ColorPickerContext: React.Context<{
|
|
|
5
5
|
setActiveColor: (color: ColorValue | ((prevColor: ColorValue) => ColorValue)) => void;
|
|
6
6
|
hsvColor: HsvColor;
|
|
7
7
|
onChangeComplete?: ((color: ColorValue) => void) | undefined;
|
|
8
|
-
applyHsvColorChange: (newColor: HsvColor, selectionChanged: boolean) => void;
|
|
8
|
+
applyHsvColorChange: (newColor: HsvColor, selectionChanged: boolean, newColorValue?: ColorValue | undefined) => void;
|
|
9
9
|
showAlpha: boolean;
|
|
10
10
|
} | undefined>;
|
|
11
11
|
export declare const useColorPickerContext: () => {
|
|
@@ -13,6 +13,6 @@ export declare const useColorPickerContext: () => {
|
|
|
13
13
|
setActiveColor: (color: ColorValue | ((prevColor: ColorValue) => ColorValue)) => void;
|
|
14
14
|
hsvColor: HsvColor;
|
|
15
15
|
onChangeComplete?: ((color: ColorValue) => void) | undefined;
|
|
16
|
-
applyHsvColorChange: (newColor: HsvColor, selectionChanged: boolean) => void;
|
|
16
|
+
applyHsvColorChange: (newColor: HsvColor, selectionChanged: boolean, newColorValue?: ColorValue | undefined) => void;
|
|
17
17
|
showAlpha: boolean;
|
|
18
18
|
};
|
|
@@ -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" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "
|
|
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" | "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" | "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-disabled" | "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" | "isActive" | "key"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
21
|
export default ColorSwatch;
|
|
@@ -36,14 +36,18 @@ import { getColorValue } from './ColorPicker';
|
|
|
36
36
|
* <ColorSwatch color={{ r: 255, g: 255, b: 0 }} onClick={onClick}/>
|
|
37
37
|
*/
|
|
38
38
|
export var ColorSwatch = React.forwardRef(function (props, ref) {
|
|
39
|
-
var _a, _b, _c;
|
|
40
39
|
var color = props.color, style = props.style, onClick = props.onClick, isActive = props.isActive, className = props.className, rest = __rest(props, ["color", "style", "onClick", "isActive", "className"]);
|
|
41
40
|
useTheme();
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
var colorString = React.useMemo(function () {
|
|
42
|
+
return typeof color === 'string'
|
|
43
|
+
? color
|
|
44
|
+
: getColorValue(color).toHslString(true);
|
|
45
|
+
}, [color]);
|
|
46
|
+
var _style = React.useMemo(function () {
|
|
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, "--swatch-color: " + colorString))
|
|
49
|
+
? __assign({ '--swatch-color': colorString }, style) : __assign({ backgroundColor: colorString }, style);
|
|
50
|
+
}, [colorString, style]);
|
|
47
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)));
|
|
48
52
|
});
|
|
49
53
|
export default ColorSwatch;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { InputProps } from '../Input';
|
|
3
3
|
import { SelectOption } from '../Select';
|
|
4
|
-
import { PopoverProps, CommonProps } from '../utils';
|
|
4
|
+
import { PopoverProps, CommonProps, InputContainerProps } from '../utils';
|
|
5
5
|
import 'tippy.js/animations/shift-away.css';
|
|
6
6
|
export declare type ComboBoxProps<T> = {
|
|
7
7
|
/**
|
|
@@ -33,7 +33,7 @@ export declare type ComboBoxProps<T> = {
|
|
|
33
33
|
* @default 'No options found'
|
|
34
34
|
*/
|
|
35
35
|
emptyStateMessage?: string;
|
|
36
|
-
} & Omit<CommonProps, 'title'>;
|
|
36
|
+
} & Pick<InputContainerProps, 'status'> & Omit<CommonProps, 'title'>;
|
|
37
37
|
/**
|
|
38
38
|
* ComboBox component that allows typing a value to filter the options in dropdown list.
|
|
39
39
|
* Values can be selected either using mouse clicks or using the Enter key.
|
|
@@ -18,7 +18,7 @@ export declare type DatePickerProps = {
|
|
|
18
18
|
/**
|
|
19
19
|
* Callback when date is changed.
|
|
20
20
|
*/
|
|
21
|
-
onChange?: (date
|
|
21
|
+
onChange?: (date: Date) => void;
|
|
22
22
|
/**
|
|
23
23
|
* Pass localized week days (start from sunday) and months.
|
|
24
24
|
* Use helper function `generateLocalizedStrings` to generate strings using `Intl.DateTimeFormat`.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { CommonProps } from '../utils';
|
|
2
3
|
import '@itwin/itwinui-css/css/non-ideal-state.css';
|
|
3
4
|
export declare type ErrorPageType = '401' | '403' | '404' | '500' | '502' | '503' | 'generic';
|
|
4
5
|
export declare type ErrorTypeTranslations = {
|
|
@@ -45,7 +46,7 @@ export declare type ErrorPageProps = {
|
|
|
45
46
|
* Used to translate default error messages, if no specific @errorName passed in
|
|
46
47
|
*/
|
|
47
48
|
translatedErrorMessages?: ErrorTypeTranslations;
|
|
48
|
-
}
|
|
49
|
+
} & Omit<CommonProps, 'title'>;
|
|
49
50
|
/**
|
|
50
51
|
* A stylized display to communicate common http errors.
|
|
51
52
|
* @example
|
|
@@ -34,6 +34,7 @@ import SvgError from '@itwin/itwinui-illustrations-react/cjs/illustrations/Error
|
|
|
34
34
|
import React from 'react';
|
|
35
35
|
import { Button } from '../Buttons/Button';
|
|
36
36
|
import { useTheme } from '../utils';
|
|
37
|
+
import cx from 'classnames';
|
|
37
38
|
import '@itwin/itwinui-css/css/non-ideal-state.css';
|
|
38
39
|
/**
|
|
39
40
|
* A stylized display to communicate common http errors.
|
|
@@ -41,7 +42,7 @@ import '@itwin/itwinui-css/css/non-ideal-state.css';
|
|
|
41
42
|
* <ErrorPage errorType='401' />
|
|
42
43
|
*/
|
|
43
44
|
export var ErrorPage = function (props) {
|
|
44
|
-
var errorType = props.errorType, errorName = props.errorName, errorMessage = props.errorMessage, primaryButtonHandle = props.primaryButtonHandle, primaryButtonLabel = props.primaryButtonLabel, secondaryButtonHandle = props.secondaryButtonHandle, secondaryButtonLabel = props.secondaryButtonLabel, translatedErrorMessages = props.translatedErrorMessages, rest = __rest(props, ["errorType", "errorName", "errorMessage", "primaryButtonHandle", "primaryButtonLabel", "secondaryButtonHandle", "secondaryButtonLabel", "translatedErrorMessages"]);
|
|
45
|
+
var errorType = props.errorType, errorName = props.errorName, errorMessage = props.errorMessage, primaryButtonHandle = props.primaryButtonHandle, primaryButtonLabel = props.primaryButtonLabel, secondaryButtonHandle = props.secondaryButtonHandle, secondaryButtonLabel = props.secondaryButtonLabel, translatedErrorMessages = props.translatedErrorMessages, className = props.className, rest = __rest(props, ["errorType", "errorName", "errorMessage", "primaryButtonHandle", "primaryButtonLabel", "secondaryButtonHandle", "secondaryButtonLabel", "translatedErrorMessages", "className"]);
|
|
45
46
|
useTheme();
|
|
46
47
|
var defaultErrorMessages = __assign({ badGateway: 'Bad gateway', error: 'Error', forbidden: 'Forbidden', internalServerError: 'Internal server error', pageNotFound: 'Page not found', serviceUnavailable: 'Service unavailable', unauthorized: 'Unauthorized' }, translatedErrorMessages);
|
|
47
48
|
function getErrorIcon() {
|
|
@@ -121,7 +122,7 @@ export var ErrorPage = function (props) {
|
|
|
121
122
|
primaryButton,
|
|
122
123
|
secondaryButton));
|
|
123
124
|
}
|
|
124
|
-
return (React.createElement("div", __assign({ className: 'iui-non-ideal-state' }, rest),
|
|
125
|
+
return (React.createElement("div", __assign({ className: cx('iui-non-ideal-state', className) }, rest),
|
|
125
126
|
getErrorIcon(),
|
|
126
127
|
React.createElement("div", { className: 'iui-non-ideal-state-title' }, getHeadingMessage()),
|
|
127
128
|
errorMessage && (React.createElement("div", { className: 'iui-non-ideal-state-description' }, errorMessage)),
|
|
@@ -35,7 +35,10 @@ export declare type InformationPanelProps = {
|
|
|
35
35
|
* <Text variant='subheading'>InfoPanel heading</Text>
|
|
36
36
|
* </InformationPanelHeader>
|
|
37
37
|
* <InformationPanelBody>
|
|
38
|
-
* <
|
|
38
|
+
* <Text>Metadata</Text>
|
|
39
|
+
* <InformationPanelContent ... />
|
|
40
|
+
* <Text>Attributes</Text>
|
|
41
|
+
* <InformationPanelContent ... />
|
|
39
42
|
* </InformationPanelBody>
|
|
40
43
|
* </InformationPanel>
|
|
41
44
|
* </InformationPanelWrapper>
|
|
@@ -41,7 +41,10 @@ import '@itwin/itwinui-css/css/information-panel.css';
|
|
|
41
41
|
* <Text variant='subheading'>InfoPanel heading</Text>
|
|
42
42
|
* </InformationPanelHeader>
|
|
43
43
|
* <InformationPanelBody>
|
|
44
|
-
* <
|
|
44
|
+
* <Text>Metadata</Text>
|
|
45
|
+
* <InformationPanelContent ... />
|
|
46
|
+
* <Text>Attributes</Text>
|
|
47
|
+
* <InformationPanelContent ... />
|
|
45
48
|
* </InformationPanelBody>
|
|
46
49
|
* </InformationPanel>
|
|
47
50
|
* </InformationPanelWrapper>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CommonProps } from '../utils';
|
|
3
|
+
import '@itwin/itwinui-css/css/information-panel.css';
|
|
4
|
+
export declare type InformationPanelContentProps = {
|
|
5
|
+
/**
|
|
6
|
+
* If set to 'inline', the label/input pairs will be shown on the same line.
|
|
7
|
+
* The component handles the spacing and alignment automatically.
|
|
8
|
+
*
|
|
9
|
+
* @default 'default'
|
|
10
|
+
*/
|
|
11
|
+
displayStyle?: 'default' | 'inline';
|
|
12
|
+
/**
|
|
13
|
+
* Content of the component.
|
|
14
|
+
* Should ideally be pairs of `Label` and input components.
|
|
15
|
+
*/
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
} & Omit<CommonProps, 'title'>;
|
|
18
|
+
/**
|
|
19
|
+
* The `InformationPanelContent` component should be used inside `InformationPanelBody`
|
|
20
|
+
* to style rows of key/value pairs, where the key is ideally represented by a `Label` component
|
|
21
|
+
* and the value can be any input element (including readonly inputs for non-modifiable fields).
|
|
22
|
+
*
|
|
23
|
+
* By default, the pairs are displayed of label and input are displayed in separate lines,
|
|
24
|
+
* but displayStyle can be set to 'inline' to show them in the same line with correct alignment.
|
|
25
|
+
*
|
|
26
|
+
* You can use multiple `InformationPanelContent` instances inside one `InformationPanelBody`; this is
|
|
27
|
+
* useful when you want to show other content, e.g. separate headings for different sections of key/value pairs.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* <InformationPanelContent displayStyle='inline'>
|
|
31
|
+
* <Label htmlFor='name-input'>File name</Label>
|
|
32
|
+
* <Input id='name-input' value='Alpha.mp3' />
|
|
33
|
+
*
|
|
34
|
+
* <Label htmlFor='year-input'>Year</Label>
|
|
35
|
+
* <Input id='year-input' value='2021' />
|
|
36
|
+
*
|
|
37
|
+
* <Label htmlFor='path-input'>Path</Label>
|
|
38
|
+
* <Input id='path-input' value='/Shared/Music/' />
|
|
39
|
+
* </InformationPanelContent>
|
|
40
|
+
*/
|
|
41
|
+
export declare const InformationPanelContent: (props: InformationPanelContentProps) => JSX.Element;
|
|
42
|
+
export default InformationPanelContent;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/*---------------------------------------------------------------------------------------------
|
|
24
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
|
+
*--------------------------------------------------------------------------------------------*/
|
|
27
|
+
import cx from 'classnames';
|
|
28
|
+
import React from 'react';
|
|
29
|
+
import { useTheme } from '../utils';
|
|
30
|
+
import '@itwin/itwinui-css/css/information-panel.css';
|
|
31
|
+
/**
|
|
32
|
+
* The `InformationPanelContent` component should be used inside `InformationPanelBody`
|
|
33
|
+
* to style rows of key/value pairs, where the key is ideally represented by a `Label` component
|
|
34
|
+
* and the value can be any input element (including readonly inputs for non-modifiable fields).
|
|
35
|
+
*
|
|
36
|
+
* By default, the pairs are displayed of label and input are displayed in separate lines,
|
|
37
|
+
* but displayStyle can be set to 'inline' to show them in the same line with correct alignment.
|
|
38
|
+
*
|
|
39
|
+
* You can use multiple `InformationPanelContent` instances inside one `InformationPanelBody`; this is
|
|
40
|
+
* useful when you want to show other content, e.g. separate headings for different sections of key/value pairs.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* <InformationPanelContent displayStyle='inline'>
|
|
44
|
+
* <Label htmlFor='name-input'>File name</Label>
|
|
45
|
+
* <Input id='name-input' value='Alpha.mp3' />
|
|
46
|
+
*
|
|
47
|
+
* <Label htmlFor='year-input'>Year</Label>
|
|
48
|
+
* <Input id='year-input' value='2021' />
|
|
49
|
+
*
|
|
50
|
+
* <Label htmlFor='path-input'>Path</Label>
|
|
51
|
+
* <Input id='path-input' value='/Shared/Music/' />
|
|
52
|
+
* </InformationPanelContent>
|
|
53
|
+
*/
|
|
54
|
+
export var InformationPanelContent = function (props) {
|
|
55
|
+
var className = props.className, _a = props.displayStyle, displayStyle = _a === void 0 ? 'default' : _a, children = props.children, rest = __rest(props, ["className", "displayStyle", "children"]);
|
|
56
|
+
useTheme();
|
|
57
|
+
return (React.createElement("div", __assign({ className: cx('iui-information-body-content', { 'iui-inline': displayStyle === 'inline' }, className) }, rest), children));
|
|
58
|
+
};
|
|
59
|
+
export default InformationPanelContent;
|
|
@@ -8,3 +8,5 @@ export { InformationPanelHeader } from './InformationPanelHeader';
|
|
|
8
8
|
export type { InformationPanelHeaderProps } from './InformationPanelHeader';
|
|
9
9
|
export { InformationPanelBody } from './InformationPanelBody';
|
|
10
10
|
export type { InformationPanelBodyProps } from './InformationPanelBody';
|
|
11
|
+
export { InformationPanelContent } from './InformationPanelContent';
|
|
12
|
+
export type { InformationPanelContentProps } from './InformationPanelContent';
|
|
@@ -7,3 +7,4 @@ export default './InformationPanel';
|
|
|
7
7
|
export { InformationPanelWrapper } from './InformationPanelWrapper';
|
|
8
8
|
export { InformationPanelHeader } from './InformationPanelHeader';
|
|
9
9
|
export { InformationPanelBody } from './InformationPanelBody';
|
|
10
|
+
export { InformationPanelContent } from './InformationPanelContent';
|