@hitachivantara/uikit-react-core 5.96.2 → 5.97.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/dist/cjs/AppSwitcher/Action/Action.cjs +1 -1
- package/dist/cjs/BaseInput/validations.cjs +13 -47
- package/dist/cjs/BreadCrumb/utils.cjs +1 -1
- package/dist/cjs/FilterGroup/Counter/Counter.cjs +1 -1
- package/dist/cjs/Header/Navigation/MenuBar/Bar.cjs +1 -1
- package/dist/cjs/InlineEditor/InlineEditor.cjs +1 -1
- package/dist/cjs/Input/Input.cjs +4 -12
- package/dist/cjs/List/List.cjs +3 -3
- package/dist/cjs/Table/hooks/useHvRowSelection.cjs +4 -4
- package/dist/cjs/TagsInput/TagsInput.cjs +1 -1
- package/dist/cjs/TextArea/TextArea.cjs +3 -4
- package/dist/cjs/TimePicker/Placeholder.cjs +2 -2
- package/dist/cjs/TimePicker/TimePicker.cjs +2 -2
- package/dist/cjs/TreeView/TreeItem/TreeItem.cjs +1 -1
- package/dist/cjs/TreeView/TreeItem/useHvTreeItem.cjs +1 -19
- package/dist/cjs/VerticalNavigation/TreeView/TreeViewItem.cjs +2 -2
- package/dist/cjs/hooks/useForkRef.cjs +1 -19
- package/dist/cjs/hooks/useImageLoaded.cjs +3 -9
- package/dist/cjs/themes/pentahoPlus.cjs +1 -1
- package/dist/esm/AppSwitcher/Action/Action.js +1 -1
- package/dist/esm/BaseInput/validations.js +13 -47
- package/dist/esm/BreadCrumb/utils.js +1 -1
- package/dist/esm/FilterGroup/Counter/Counter.js +1 -1
- package/dist/esm/Header/Navigation/MenuBar/Bar.js +1 -1
- package/dist/esm/InlineEditor/InlineEditor.js +1 -1
- package/dist/esm/Input/Input.js +5 -13
- package/dist/esm/List/List.js +3 -3
- package/dist/esm/Table/hooks/useHvRowSelection.js +4 -4
- package/dist/esm/TagsInput/TagsInput.js +1 -1
- package/dist/esm/TextArea/TextArea.js +3 -4
- package/dist/esm/TimePicker/Placeholder.js +2 -2
- package/dist/esm/TimePicker/TimePicker.js +2 -2
- package/dist/esm/TreeView/TreeItem/TreeItem.js +1 -1
- package/dist/esm/TreeView/TreeItem/useHvTreeItem.js +2 -2
- package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.js +2 -2
- package/dist/esm/hooks/useForkRef.js +2 -2
- package/dist/esm/hooks/useImageLoaded.js +3 -9
- package/dist/esm/themes/pentahoPlus.js +1 -1
- package/dist/types/index.d.ts +18 -20
- package/package.json +4 -4
|
@@ -45,7 +45,7 @@ const HvAppSwitcherAction = ({
|
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
const brokenTitle = name.split(" ");
|
|
48
|
-
const initials = brokenTitle[0].
|
|
48
|
+
const initials = brokenTitle[0].slice(0, 1) + (brokenTitle[1] ? brokenTitle[1].slice(0, 1) : "");
|
|
49
49
|
return /* @__PURE__ */ jsxRuntime.jsx(Avatar.HvAvatar, { size: "sm", backgroundColor: color, variant: "square", "aria-hidden": true, children: initials });
|
|
50
50
|
};
|
|
51
51
|
const isSelected = isSelectedCallback(application);
|
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
num.trim().length > 0 && !Number.isNaN(Number(num))
|
|
6
|
-
);
|
|
7
|
-
const isEmail = (email) => {
|
|
8
|
-
const regexp = /^[^\\s]+[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?[.])+[a-z0-9](?:[a-z0-9-]*[a-z0-9])$/i;
|
|
9
|
-
return regexp.test(email);
|
|
3
|
+
const isTypeValidationIgnored = (type) => {
|
|
4
|
+
return type === "text" || type === "password";
|
|
10
5
|
};
|
|
11
|
-
const
|
|
12
|
-
switch (type) {
|
|
13
|
-
case "number":
|
|
14
|
-
return "number";
|
|
15
|
-
case "email":
|
|
16
|
-
return "email";
|
|
17
|
-
default:
|
|
18
|
-
return "none";
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const hasBuiltInValidations = (required, validationType, minCharQuantity, maxCharQuantity, validation, inputProps) => required || validationType !== "none" || minCharQuantity != null || maxCharQuantity != null || validation != null || inputProps?.required != null || inputProps?.minLength != null || inputProps?.maxLength != null || inputProps?.min != null || inputProps?.max != null || inputProps?.type != null && inputProps?.type !== "text" && inputProps?.type !== "password" || inputProps?.pattern != null;
|
|
6
|
+
const hasBuiltInValidations = (required, inputType, minCharQuantity, maxCharQuantity, validation, inputProps) => required || !isTypeValidationIgnored(inputType) || minCharQuantity != null || maxCharQuantity != null || validation != null || inputProps?.required != null || inputProps?.minLength != null || inputProps?.maxLength != null || inputProps?.min != null || inputProps?.max != null || inputProps?.type && !isTypeValidationIgnored(inputProps.type) || inputProps?.pattern != null;
|
|
22
7
|
const computeValidationState = (inputValidity, isEmptyValue) => {
|
|
23
8
|
if (inputValidity.valid && isEmptyValue) {
|
|
24
9
|
return "standBy";
|
|
@@ -43,19 +28,10 @@ const computeValidationMessage = (inputValidity, errorMessages) => {
|
|
|
43
28
|
}
|
|
44
29
|
return errorMessages.error;
|
|
45
30
|
};
|
|
46
|
-
const validateInput = (input, required, minCharQuantity, maxCharQuantity,
|
|
31
|
+
const validateInput = (input, required, minCharQuantity, maxCharQuantity, validation) => {
|
|
47
32
|
const inputValidity = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
customError: input?.validity?.customError,
|
|
51
|
-
patternMismatch: input?.validity?.patternMismatch,
|
|
52
|
-
rangeOverflow: input?.validity?.rangeOverflow,
|
|
53
|
-
rangeUnderflow: input?.validity?.rangeUnderflow,
|
|
54
|
-
stepMismatch: input?.validity?.stepMismatch,
|
|
55
|
-
tooLong: input?.validity?.tooLong,
|
|
56
|
-
tooShort: input?.validity?.tooShort,
|
|
57
|
-
typeMismatch: input?.validity?.typeMismatch,
|
|
58
|
-
valueMissing: input?.validity?.valueMissing
|
|
33
|
+
...input?.validity,
|
|
34
|
+
valid: input?.validity?.valid ?? true
|
|
59
35
|
};
|
|
60
36
|
const value = input?.value;
|
|
61
37
|
if (!value) {
|
|
@@ -72,20 +48,6 @@ const validateInput = (input, required, minCharQuantity, maxCharQuantity, valida
|
|
|
72
48
|
inputValidity.tooLong = true;
|
|
73
49
|
inputValidity.valid = false;
|
|
74
50
|
}
|
|
75
|
-
switch (validationType) {
|
|
76
|
-
case "number":
|
|
77
|
-
if (!isNumeric(value)) {
|
|
78
|
-
inputValidity.typeMismatch = true;
|
|
79
|
-
inputValidity.valid = false;
|
|
80
|
-
}
|
|
81
|
-
break;
|
|
82
|
-
case "email":
|
|
83
|
-
if (!isEmail(value)) {
|
|
84
|
-
inputValidity.typeMismatch = true;
|
|
85
|
-
inputValidity.valid = false;
|
|
86
|
-
}
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
51
|
if (validation != null && !validation(value)) {
|
|
90
52
|
inputValidity.customError = true;
|
|
91
53
|
inputValidity.valid = false;
|
|
@@ -94,15 +56,19 @@ const validateInput = (input, required, minCharQuantity, maxCharQuantity, valida
|
|
|
94
56
|
return inputValidity;
|
|
95
57
|
};
|
|
96
58
|
const DEFAULT_ERROR_MESSAGES = {
|
|
59
|
+
/** The value when a validation fails. */
|
|
97
60
|
error: "Invalid value",
|
|
98
|
-
|
|
99
|
-
minCharError: "The value is too short",
|
|
61
|
+
/** The message that appears when there are too many characters. */
|
|
100
62
|
maxCharError: "The value is too long",
|
|
63
|
+
/** The message that appears when there are too few characters. */
|
|
64
|
+
minCharError: "The value is too short",
|
|
65
|
+
/** The message that appears when the input is empty and required. */
|
|
66
|
+
requiredError: "The value is required",
|
|
67
|
+
/** The message that appears when the input is value is incompatible with the expected type. */
|
|
101
68
|
typeMismatchError: "Invalid value"
|
|
102
69
|
};
|
|
103
70
|
exports.DEFAULT_ERROR_MESSAGES = DEFAULT_ERROR_MESSAGES;
|
|
104
71
|
exports.computeValidationMessage = computeValidationMessage;
|
|
105
72
|
exports.computeValidationState = computeValidationState;
|
|
106
|
-
exports.computeValidationType = computeValidationType;
|
|
107
73
|
exports.hasBuiltInValidations = hasBuiltInValidations;
|
|
108
74
|
exports.validateInput = validateInput;
|
|
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const icons = require("../icons.cjs");
|
|
5
5
|
const setId = require("../utils/setId.cjs");
|
|
6
6
|
const DropDownMenu = require("../DropDownMenu/DropDownMenu.cjs");
|
|
7
|
-
const removeExtension = (label) => label.includes(".") ? label.
|
|
7
|
+
const removeExtension = (label) => label.includes(".") ? label.slice(0, label.lastIndexOf(".")) : label;
|
|
8
8
|
const pathWithSubMenu = (id, listRoute, maxVisible, onClick, dropDownMenuProps) => {
|
|
9
9
|
const nbrElemToSubMenu = listRoute.length - maxVisible;
|
|
10
10
|
const subMenuList = listRoute.slice(1, nbrElemToSubMenu + 1);
|
|
@@ -26,7 +26,7 @@ const HvFilterGroupCounter = (props) => {
|
|
|
26
26
|
filterValues = [],
|
|
27
27
|
appliedFilters = []
|
|
28
28
|
} = React.useContext(FilterGroupContext.HvFilterGroupContext);
|
|
29
|
-
const options = groupId && filterOptions.
|
|
29
|
+
const options = groupId && filterOptions.some((option) => option.id === groupId) ? [filterOptions.find((option) => option.id === groupId)] : filterOptions;
|
|
30
30
|
const optionIdx = filterOptions.findIndex((option) => option.id === groupId);
|
|
31
31
|
let groupsCounter = 0;
|
|
32
32
|
appliedFilters.forEach((fg, i) => {
|
|
@@ -17,7 +17,7 @@ const Bar = (props) => {
|
|
|
17
17
|
const { classes, cx } = Bar_styles.useClasses(classesProp);
|
|
18
18
|
const selectionPath = React.useContext(SelectionContext.SelectionContext);
|
|
19
19
|
const isMenu = type === "menu";
|
|
20
|
-
const isActive = isMenu && data.
|
|
20
|
+
const isActive = isMenu && data.some((item) => item.id === selectionPath?.[1]);
|
|
21
21
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22
22
|
"div",
|
|
23
23
|
{
|
|
@@ -111,7 +111,7 @@ const HvInlineEditor = generic.fixedForwardRef(function HvInlineEditor2(props, r
|
|
|
111
111
|
}
|
|
112
112
|
),
|
|
113
113
|
className: cx(classes.button, {
|
|
114
|
-
[classes.largeText]:
|
|
114
|
+
[classes.largeText]: Number(lineHeight) >= 28
|
|
115
115
|
}),
|
|
116
116
|
onClick: handleClick,
|
|
117
117
|
disabled,
|
package/dist/cjs/Input/Input.cjs
CHANGED
|
@@ -115,19 +115,17 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
115
115
|
validationMessages?.typeMismatchError
|
|
116
116
|
]
|
|
117
117
|
);
|
|
118
|
-
const validationType = React.useMemo(() => validations.computeValidationType(type), [type]);
|
|
119
118
|
const performValidation = React.useCallback(() => {
|
|
120
119
|
const inputValidity = validations.validateInput(
|
|
121
120
|
inputRef.current,
|
|
122
121
|
required,
|
|
123
122
|
minCharQuantity,
|
|
124
123
|
maxCharQuantity,
|
|
125
|
-
validationType,
|
|
126
124
|
validation
|
|
127
125
|
);
|
|
128
126
|
setValidationState(validations.computeValidationState(inputValidity, isEmptyValue));
|
|
129
127
|
setValidationMessage(
|
|
130
|
-
validations.computeValidationMessage(inputValidity, errorMessages)
|
|
128
|
+
validations.computeValidationMessage(inputValidity, errorMessages) || ""
|
|
131
129
|
);
|
|
132
130
|
return inputValidity;
|
|
133
131
|
}, [
|
|
@@ -138,12 +136,11 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
138
136
|
required,
|
|
139
137
|
setValidationMessage,
|
|
140
138
|
setValidationState,
|
|
141
|
-
validation
|
|
142
|
-
validationType
|
|
139
|
+
validation
|
|
143
140
|
]);
|
|
144
141
|
const canShowError = ariaErrorMessage == null && (status !== void 0 && statusMessage !== void 0 || status === void 0 && validations.hasBuiltInValidations(
|
|
145
142
|
required,
|
|
146
|
-
|
|
143
|
+
type,
|
|
147
144
|
minCharQuantity,
|
|
148
145
|
maxCharQuantity,
|
|
149
146
|
validation,
|
|
@@ -157,12 +154,7 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
157
154
|
if (type === "password") {
|
|
158
155
|
return revealPassword ? "text" : "password";
|
|
159
156
|
}
|
|
160
|
-
if (
|
|
161
|
-
return "search";
|
|
162
|
-
}
|
|
163
|
-
if (type === "number") {
|
|
164
|
-
return "number";
|
|
165
|
-
}
|
|
157
|
+
if (["search", "number", "email"].includes(type)) return type;
|
|
166
158
|
return "text";
|
|
167
159
|
}, [revealPassword, type]);
|
|
168
160
|
const [suggestionValues, setSuggestionValues] = React.useState(null);
|
package/dist/cjs/List/List.cjs
CHANGED
|
@@ -177,9 +177,9 @@ const HvList = (props) => {
|
|
|
177
177
|
return renderListItem(item, index, {
|
|
178
178
|
style: {
|
|
179
179
|
...style,
|
|
180
|
-
top: `${parseFloat(style.top) + 5}px`,
|
|
181
|
-
left: `${parseFloat(style.left) + 5}px`,
|
|
182
|
-
width: `calc(${parseFloat(style.width)}% - 10px)`
|
|
180
|
+
top: `${Number.parseFloat(style.top) + 5}px`,
|
|
181
|
+
left: `${Number.parseFloat(style.left) + 5}px`,
|
|
182
|
+
width: `calc(${Number.parseFloat(style.width)}% - 10px)`
|
|
183
183
|
},
|
|
184
184
|
tabIndex,
|
|
185
185
|
interactive: true,
|
|
@@ -123,7 +123,7 @@ function reducer(state, action, previousState, instance) {
|
|
|
123
123
|
applyToggleAllRowsSelectedToPrefilteredRows
|
|
124
124
|
} = instance;
|
|
125
125
|
const rowsToSelect = applyToggleAllRowsSelectedToPrefilteredRows ? initialRowsById : nonGroupedRowsById;
|
|
126
|
-
const selectAll =
|
|
126
|
+
const selectAll = setSelected ?? !isAllRowsSelected;
|
|
127
127
|
const selectedRowIds = { ...state.selectedRowIds };
|
|
128
128
|
if (selectAll) {
|
|
129
129
|
Object.keys(rowsToSelect).forEach((rowId) => {
|
|
@@ -153,7 +153,7 @@ function reducer(state, action, previousState, instance) {
|
|
|
153
153
|
}
|
|
154
154
|
const { rowsById, selectSubRows = true, getSubRows } = instance;
|
|
155
155
|
const isSelected = state.selectedRowIds[id];
|
|
156
|
-
const shouldExist =
|
|
156
|
+
const shouldExist = setSelected ?? !isSelected;
|
|
157
157
|
if (isSelected === shouldExist) {
|
|
158
158
|
return state;
|
|
159
159
|
}
|
|
@@ -188,7 +188,7 @@ function reducer(state, action, previousState, instance) {
|
|
|
188
188
|
isAllPageRowsSelected,
|
|
189
189
|
getSubRows
|
|
190
190
|
} = instance;
|
|
191
|
-
const selectAll =
|
|
191
|
+
const selectAll = setSelected ?? !isAllPageRowsSelected;
|
|
192
192
|
const newSelectedRowIds = { ...state.selectedRowIds };
|
|
193
193
|
const handleRowById = (rowId) => {
|
|
194
194
|
const row = rowsById[rowId];
|
|
@@ -222,7 +222,7 @@ function reducer(state, action, previousState, instance) {
|
|
|
222
222
|
const { id, value: setLockedSelection } = action;
|
|
223
223
|
const { rowsById, selectSubRows = true, getSubRows } = instance;
|
|
224
224
|
const isLockedSelection = state.lockedSelectionRowIds[id];
|
|
225
|
-
const shouldExist =
|
|
225
|
+
const shouldExist = setLockedSelection ?? !isLockedSelection;
|
|
226
226
|
if (isLockedSelection === shouldExist) {
|
|
227
227
|
return state;
|
|
228
228
|
}
|
|
@@ -93,7 +93,7 @@ const HvTagsInput = React.forwardRef(
|
|
|
93
93
|
(currValue) => {
|
|
94
94
|
if (maxTagsQuantity !== null && maxTagsQuantity !== void 0 && currValue.length > maxTagsQuantity) {
|
|
95
95
|
setValidationState("invalid");
|
|
96
|
-
setValidationMessage(errorMessages.maxCharError);
|
|
96
|
+
setValidationMessage(errorMessages.maxCharError || "");
|
|
97
97
|
setStateValid(false);
|
|
98
98
|
} else {
|
|
99
99
|
setValidationState("valid");
|
|
@@ -88,12 +88,11 @@ const HvTextArea = React.forwardRef(function HvTextArea2(props, ref) {
|
|
|
88
88
|
required,
|
|
89
89
|
minCharQuantity,
|
|
90
90
|
maxCharQuantity,
|
|
91
|
-
"none",
|
|
92
91
|
validation
|
|
93
92
|
);
|
|
94
93
|
setValidationState(validations.computeValidationState(inputValidity, isEmptyValue));
|
|
95
94
|
setValidationMessage(
|
|
96
|
-
validations.computeValidationMessage(inputValidity, errorMessages)
|
|
95
|
+
validations.computeValidationMessage(inputValidity, errorMessages) || ""
|
|
97
96
|
);
|
|
98
97
|
return inputValidity;
|
|
99
98
|
}, [
|
|
@@ -110,7 +109,7 @@ const HvTextArea = React.forwardRef(function HvTextArea2(props, ref) {
|
|
|
110
109
|
const limitValue = (currentValue) => {
|
|
111
110
|
if (currentValue === void 0 || !blockMax) return currentValue;
|
|
112
111
|
const isOverflow = maxCharQuantity == null ? false : currentValue.length > maxCharQuantity;
|
|
113
|
-
return !isOverflow ? currentValue : currentValue.
|
|
112
|
+
return !isOverflow ? currentValue : currentValue.slice(0, maxCharQuantity);
|
|
114
113
|
};
|
|
115
114
|
const onContainerBlurHandler = (event) => {
|
|
116
115
|
setFocused(false);
|
|
@@ -164,7 +163,7 @@ const HvTextArea = React.forwardRef(function HvTextArea2(props, ref) {
|
|
|
164
163
|
}, [focused, isEmptyValue, performValidation]);
|
|
165
164
|
const canShowError = ariaErrorMessage == null && (status !== void 0 && statusMessage !== void 0 || status === void 0 && validations.hasBuiltInValidations(
|
|
166
165
|
required,
|
|
167
|
-
"
|
|
166
|
+
"text",
|
|
168
167
|
minCharQuantity,
|
|
169
168
|
// If blockMax is true maxCharQuantity will never produce an error
|
|
170
169
|
// unless the value is controlled, so we can't prevent it to overflow maxCharQuantity
|
|
@@ -36,14 +36,14 @@ const Placeholder = React.forwardRef(
|
|
|
36
36
|
...others,
|
|
37
37
|
children: [
|
|
38
38
|
name && /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value: getDateValue(value) }),
|
|
39
|
-
segments.map((segment
|
|
39
|
+
segments.map((segment) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
40
40
|
PlaceholderSegment,
|
|
41
41
|
{
|
|
42
42
|
segment,
|
|
43
43
|
state,
|
|
44
44
|
placeholder: placeholders[segment.type]
|
|
45
45
|
},
|
|
46
|
-
|
|
46
|
+
segment.type
|
|
47
47
|
))
|
|
48
48
|
]
|
|
49
49
|
}
|
|
@@ -183,7 +183,7 @@ const HvTimePicker = React.forwardRef(
|
|
|
183
183
|
]
|
|
184
184
|
},
|
|
185
185
|
...otherDropdownProps,
|
|
186
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: timeFieldRef, className: classes.timePopperContainer, children: state.segments.map((segment
|
|
186
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: timeFieldRef, className: classes.timePopperContainer, children: state.segments.map((segment) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
187
187
|
Unit.Unit,
|
|
188
188
|
{
|
|
189
189
|
state,
|
|
@@ -195,7 +195,7 @@ const HvTimePicker = React.forwardRef(
|
|
|
195
195
|
state.setSegment(segment.type, Number(val));
|
|
196
196
|
}
|
|
197
197
|
},
|
|
198
|
-
|
|
198
|
+
segment.type
|
|
199
199
|
)) })
|
|
200
200
|
}
|
|
201
201
|
),
|
|
@@ -73,7 +73,7 @@ const HvTreeItem = React.forwardRef(
|
|
|
73
73
|
if (instance && label) {
|
|
74
74
|
return instance.mapFirstChar(
|
|
75
75
|
nodeId,
|
|
76
|
-
(contentRef.current?.textContent ?? "").
|
|
76
|
+
(contentRef.current?.textContent ?? "").slice(0, 1).toLowerCase()
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
return void 0;
|
|
@@ -3,27 +3,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const DescendantProvider = require("../internals/DescendantProvider.cjs");
|
|
5
5
|
const TreeViewProvider = require("../internals/TreeViewProvider.cjs");
|
|
6
|
-
function _interopNamespace(e) {
|
|
7
|
-
if (e && e.__esModule) return e;
|
|
8
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
9
|
-
if (e) {
|
|
10
|
-
for (const k in e) {
|
|
11
|
-
if (k !== "default") {
|
|
12
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: () => e[k]
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
n.default = e;
|
|
21
|
-
return Object.freeze(n);
|
|
22
|
-
}
|
|
23
|
-
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
24
6
|
function useHvTreeItem(nodeId) {
|
|
25
7
|
const { instance, multiSelect } = TreeViewProvider.useTreeViewContext();
|
|
26
|
-
const { level = 0 } =
|
|
8
|
+
const { level = 0 } = React.useContext(DescendantProvider.DescendantContext);
|
|
27
9
|
const expandable = instance ? instance.isNodeExpandable(nodeId) : false;
|
|
28
10
|
const expanded = instance ? instance.isNodeExpanded(nodeId) : false;
|
|
29
11
|
const focused = instance ? instance.isNodeFocused(nodeId) : false;
|
|
@@ -120,7 +120,7 @@ const HvVerticalNavigationTreeViewItem = React.forwardRef(
|
|
|
120
120
|
if (mapFirstChar && unMapFirstChar && label && contentRef.current?.textContent) {
|
|
121
121
|
mapFirstChar(
|
|
122
122
|
nodeId,
|
|
123
|
-
contentRef.current?.textContent.
|
|
123
|
+
contentRef.current?.textContent.slice(0, 1).toLowerCase()
|
|
124
124
|
);
|
|
125
125
|
return () => {
|
|
126
126
|
unMapFirstChar(nodeId);
|
|
@@ -311,7 +311,7 @@ const HvVerticalNavigationTreeViewItem = React.forwardRef(
|
|
|
311
311
|
variant: "square",
|
|
312
312
|
size: "xs",
|
|
313
313
|
backgroundColor: "textSubtle",
|
|
314
|
-
children: payload?.label?.
|
|
314
|
+
children: payload?.label?.slice(0, 1)
|
|
315
315
|
}
|
|
316
316
|
) : useIcons && icon,
|
|
317
317
|
hasChildren && !isOpen ? /* @__PURE__ */ jsxRuntime.jsx(icons.HvIcon, { name: "Forwards", size: "xs", compact: true }) : hasAnyChildWithData && !isOpen && /* @__PURE__ */ jsxRuntime.jsx("div", {})
|
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
-
function _interopNamespace(e) {
|
|
5
|
-
if (e && e.__esModule) return e;
|
|
6
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
-
if (e) {
|
|
8
|
-
for (const k in e) {
|
|
9
|
-
if (k !== "default") {
|
|
10
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: () => e[k]
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
n.default = e;
|
|
19
|
-
return Object.freeze(n);
|
|
20
|
-
}
|
|
21
|
-
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
22
4
|
const setRef = (ref, value) => {
|
|
23
5
|
if (typeof ref === "function") {
|
|
24
6
|
ref(value);
|
|
@@ -27,7 +9,7 @@ const setRef = (ref, value) => {
|
|
|
27
9
|
}
|
|
28
10
|
};
|
|
29
11
|
const useForkRef = (refA, refB) => {
|
|
30
|
-
return
|
|
12
|
+
return React.useMemo(() => {
|
|
31
13
|
if (refA == null && refB == null) {
|
|
32
14
|
return null;
|
|
33
15
|
}
|
|
@@ -4,24 +4,18 @@ const React = require("react");
|
|
|
4
4
|
const useImageLoaded = (src, srcSet) => {
|
|
5
5
|
const [imageLoaded, setImageLoaded] = React.useState(false);
|
|
6
6
|
React.useEffect(() => {
|
|
7
|
-
if (!src && !srcSet)
|
|
8
|
-
return void 0;
|
|
9
|
-
}
|
|
7
|
+
if (!src && !srcSet) return;
|
|
10
8
|
setImageLoaded(false);
|
|
11
9
|
let active = true;
|
|
12
10
|
const image = new Image();
|
|
13
11
|
image.src = src || "";
|
|
14
12
|
image.srcset = srcSet || "";
|
|
15
13
|
image.onload = () => {
|
|
16
|
-
if (!active)
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
14
|
+
if (!active) return;
|
|
19
15
|
setImageLoaded("loaded");
|
|
20
16
|
};
|
|
21
17
|
image.onerror = () => {
|
|
22
|
-
if (!active)
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
18
|
+
if (!active) return;
|
|
25
19
|
setImageLoaded("error");
|
|
26
20
|
};
|
|
27
21
|
return () => {
|
|
@@ -51,7 +51,7 @@ const pentahoPlus = uikitStyles.mergeTheme(uikitStyles.pentahoPlus, {
|
|
|
51
51
|
Object.entries(notificationMap).map(([variant, color]) => [
|
|
52
52
|
variant,
|
|
53
53
|
{
|
|
54
|
-
backgroundColor: uikitStyles.theme.
|
|
54
|
+
backgroundColor: uikitStyles.theme.mix(`${color}Dimmed`, 0.5, "dimmer"),
|
|
55
55
|
"--icolor": uikitStyles.theme.colors[color],
|
|
56
56
|
"--outline": uikitStyles.theme.colors[`${color}Border`],
|
|
57
57
|
"--bg": uikitStyles.theme.colors[`${color}Subtle`],
|
|
@@ -44,7 +44,7 @@ const HvAppSwitcherAction = ({
|
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
const brokenTitle = name.split(" ");
|
|
47
|
-
const initials = brokenTitle[0].
|
|
47
|
+
const initials = brokenTitle[0].slice(0, 1) + (brokenTitle[1] ? brokenTitle[1].slice(0, 1) : "");
|
|
48
48
|
return /* @__PURE__ */ jsx(HvAvatar, { size: "sm", backgroundColor: color, variant: "square", "aria-hidden": true, children: initials });
|
|
49
49
|
};
|
|
50
50
|
const isSelected = isSelectedCallback(application);
|
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
num.trim().length > 0 && !Number.isNaN(Number(num))
|
|
4
|
-
);
|
|
5
|
-
const isEmail = (email) => {
|
|
6
|
-
const regexp = /^[^\\s]+[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?[.])+[a-z0-9](?:[a-z0-9-]*[a-z0-9])$/i;
|
|
7
|
-
return regexp.test(email);
|
|
1
|
+
const isTypeValidationIgnored = (type) => {
|
|
2
|
+
return type === "text" || type === "password";
|
|
8
3
|
};
|
|
9
|
-
const
|
|
10
|
-
switch (type) {
|
|
11
|
-
case "number":
|
|
12
|
-
return "number";
|
|
13
|
-
case "email":
|
|
14
|
-
return "email";
|
|
15
|
-
default:
|
|
16
|
-
return "none";
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
const hasBuiltInValidations = (required, validationType, minCharQuantity, maxCharQuantity, validation, inputProps) => required || validationType !== "none" || minCharQuantity != null || maxCharQuantity != null || validation != null || inputProps?.required != null || inputProps?.minLength != null || inputProps?.maxLength != null || inputProps?.min != null || inputProps?.max != null || inputProps?.type != null && inputProps?.type !== "text" && inputProps?.type !== "password" || inputProps?.pattern != null;
|
|
4
|
+
const hasBuiltInValidations = (required, inputType, minCharQuantity, maxCharQuantity, validation, inputProps) => required || !isTypeValidationIgnored(inputType) || minCharQuantity != null || maxCharQuantity != null || validation != null || inputProps?.required != null || inputProps?.minLength != null || inputProps?.maxLength != null || inputProps?.min != null || inputProps?.max != null || inputProps?.type && !isTypeValidationIgnored(inputProps.type) || inputProps?.pattern != null;
|
|
20
5
|
const computeValidationState = (inputValidity, isEmptyValue) => {
|
|
21
6
|
if (inputValidity.valid && isEmptyValue) {
|
|
22
7
|
return "standBy";
|
|
@@ -41,19 +26,10 @@ const computeValidationMessage = (inputValidity, errorMessages) => {
|
|
|
41
26
|
}
|
|
42
27
|
return errorMessages.error;
|
|
43
28
|
};
|
|
44
|
-
const validateInput = (input, required, minCharQuantity, maxCharQuantity,
|
|
29
|
+
const validateInput = (input, required, minCharQuantity, maxCharQuantity, validation) => {
|
|
45
30
|
const inputValidity = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
customError: input?.validity?.customError,
|
|
49
|
-
patternMismatch: input?.validity?.patternMismatch,
|
|
50
|
-
rangeOverflow: input?.validity?.rangeOverflow,
|
|
51
|
-
rangeUnderflow: input?.validity?.rangeUnderflow,
|
|
52
|
-
stepMismatch: input?.validity?.stepMismatch,
|
|
53
|
-
tooLong: input?.validity?.tooLong,
|
|
54
|
-
tooShort: input?.validity?.tooShort,
|
|
55
|
-
typeMismatch: input?.validity?.typeMismatch,
|
|
56
|
-
valueMissing: input?.validity?.valueMissing
|
|
31
|
+
...input?.validity,
|
|
32
|
+
valid: input?.validity?.valid ?? true
|
|
57
33
|
};
|
|
58
34
|
const value = input?.value;
|
|
59
35
|
if (!value) {
|
|
@@ -70,20 +46,6 @@ const validateInput = (input, required, minCharQuantity, maxCharQuantity, valida
|
|
|
70
46
|
inputValidity.tooLong = true;
|
|
71
47
|
inputValidity.valid = false;
|
|
72
48
|
}
|
|
73
|
-
switch (validationType) {
|
|
74
|
-
case "number":
|
|
75
|
-
if (!isNumeric(value)) {
|
|
76
|
-
inputValidity.typeMismatch = true;
|
|
77
|
-
inputValidity.valid = false;
|
|
78
|
-
}
|
|
79
|
-
break;
|
|
80
|
-
case "email":
|
|
81
|
-
if (!isEmail(value)) {
|
|
82
|
-
inputValidity.typeMismatch = true;
|
|
83
|
-
inputValidity.valid = false;
|
|
84
|
-
}
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
49
|
if (validation != null && !validation(value)) {
|
|
88
50
|
inputValidity.customError = true;
|
|
89
51
|
inputValidity.valid = false;
|
|
@@ -92,17 +54,21 @@ const validateInput = (input, required, minCharQuantity, maxCharQuantity, valida
|
|
|
92
54
|
return inputValidity;
|
|
93
55
|
};
|
|
94
56
|
const DEFAULT_ERROR_MESSAGES = {
|
|
57
|
+
/** The value when a validation fails. */
|
|
95
58
|
error: "Invalid value",
|
|
96
|
-
|
|
97
|
-
minCharError: "The value is too short",
|
|
59
|
+
/** The message that appears when there are too many characters. */
|
|
98
60
|
maxCharError: "The value is too long",
|
|
61
|
+
/** The message that appears when there are too few characters. */
|
|
62
|
+
minCharError: "The value is too short",
|
|
63
|
+
/** The message that appears when the input is empty and required. */
|
|
64
|
+
requiredError: "The value is required",
|
|
65
|
+
/** The message that appears when the input is value is incompatible with the expected type. */
|
|
99
66
|
typeMismatchError: "Invalid value"
|
|
100
67
|
};
|
|
101
68
|
export {
|
|
102
69
|
DEFAULT_ERROR_MESSAGES,
|
|
103
70
|
computeValidationMessage,
|
|
104
71
|
computeValidationState,
|
|
105
|
-
computeValidationType,
|
|
106
72
|
hasBuiltInValidations,
|
|
107
73
|
validateInput
|
|
108
74
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { HvIcon } from "../icons.js";
|
|
3
3
|
import { setId } from "../utils/setId.js";
|
|
4
4
|
import { HvDropDownMenu } from "../DropDownMenu/DropDownMenu.js";
|
|
5
|
-
const removeExtension = (label) => label.includes(".") ? label.
|
|
5
|
+
const removeExtension = (label) => label.includes(".") ? label.slice(0, label.lastIndexOf(".")) : label;
|
|
6
6
|
const pathWithSubMenu = (id, listRoute, maxVisible, onClick, dropDownMenuProps) => {
|
|
7
7
|
const nbrElemToSubMenu = listRoute.length - maxVisible;
|
|
8
8
|
const subMenuList = listRoute.slice(1, nbrElemToSubMenu + 1);
|
|
@@ -25,7 +25,7 @@ const HvFilterGroupCounter = (props) => {
|
|
|
25
25
|
filterValues = [],
|
|
26
26
|
appliedFilters = []
|
|
27
27
|
} = useContext(HvFilterGroupContext);
|
|
28
|
-
const options = groupId && filterOptions.
|
|
28
|
+
const options = groupId && filterOptions.some((option) => option.id === groupId) ? [filterOptions.find((option) => option.id === groupId)] : filterOptions;
|
|
29
29
|
const optionIdx = filterOptions.findIndex((option) => option.id === groupId);
|
|
30
30
|
let groupsCounter = 0;
|
|
31
31
|
appliedFilters.forEach((fg, i) => {
|
|
@@ -16,7 +16,7 @@ const Bar = (props) => {
|
|
|
16
16
|
const { classes, cx } = useClasses(classesProp);
|
|
17
17
|
const selectionPath = useContext(SelectionContext);
|
|
18
18
|
const isMenu = type === "menu";
|
|
19
|
-
const isActive = isMenu && data.
|
|
19
|
+
const isActive = isMenu && data.some((item) => item.id === selectionPath?.[1]);
|
|
20
20
|
return /* @__PURE__ */ jsx(
|
|
21
21
|
"div",
|
|
22
22
|
{
|
|
@@ -110,7 +110,7 @@ const HvInlineEditor = fixedForwardRef(function HvInlineEditor2(props, ref) {
|
|
|
110
110
|
}
|
|
111
111
|
),
|
|
112
112
|
className: cx(classes.button, {
|
|
113
|
-
[classes.largeText]:
|
|
113
|
+
[classes.largeText]: Number(lineHeight) >= 28
|
|
114
114
|
}),
|
|
115
115
|
onClick: handleClick,
|
|
116
116
|
disabled,
|
package/dist/esm/Input/Input.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useRef, useState, useMemo, useCallback, useEffect } from "react";
|
|
3
3
|
import { useForkRef } from "@mui/material/utils";
|
|
4
4
|
import { useDefaultProps, useTheme } from "@hitachivantara/uikit-react-utils";
|
|
5
|
-
import { DEFAULT_ERROR_MESSAGES,
|
|
5
|
+
import { DEFAULT_ERROR_MESSAGES, validateInput, computeValidationState, computeValidationMessage, hasBuiltInValidations } from "../BaseInput/validations.js";
|
|
6
6
|
import { HvLabelContainer } from "../FormElement/LabelContainer.js";
|
|
7
7
|
import { HvSuggestions } from "../FormElement/Suggestions/Suggestions.js";
|
|
8
8
|
import { useControlled } from "../hooks/useControlled.js";
|
|
@@ -114,19 +114,17 @@ const HvInput = fixedForwardRef(function HvInput2(props, ref) {
|
|
|
114
114
|
validationMessages?.typeMismatchError
|
|
115
115
|
]
|
|
116
116
|
);
|
|
117
|
-
const validationType = useMemo(() => computeValidationType(type), [type]);
|
|
118
117
|
const performValidation = useCallback(() => {
|
|
119
118
|
const inputValidity = validateInput(
|
|
120
119
|
inputRef.current,
|
|
121
120
|
required,
|
|
122
121
|
minCharQuantity,
|
|
123
122
|
maxCharQuantity,
|
|
124
|
-
validationType,
|
|
125
123
|
validation
|
|
126
124
|
);
|
|
127
125
|
setValidationState(computeValidationState(inputValidity, isEmptyValue));
|
|
128
126
|
setValidationMessage(
|
|
129
|
-
computeValidationMessage(inputValidity, errorMessages)
|
|
127
|
+
computeValidationMessage(inputValidity, errorMessages) || ""
|
|
130
128
|
);
|
|
131
129
|
return inputValidity;
|
|
132
130
|
}, [
|
|
@@ -137,12 +135,11 @@ const HvInput = fixedForwardRef(function HvInput2(props, ref) {
|
|
|
137
135
|
required,
|
|
138
136
|
setValidationMessage,
|
|
139
137
|
setValidationState,
|
|
140
|
-
validation
|
|
141
|
-
validationType
|
|
138
|
+
validation
|
|
142
139
|
]);
|
|
143
140
|
const canShowError = ariaErrorMessage == null && (status !== void 0 && statusMessage !== void 0 || status === void 0 && hasBuiltInValidations(
|
|
144
141
|
required,
|
|
145
|
-
|
|
142
|
+
type,
|
|
146
143
|
minCharQuantity,
|
|
147
144
|
maxCharQuantity,
|
|
148
145
|
validation,
|
|
@@ -156,12 +153,7 @@ const HvInput = fixedForwardRef(function HvInput2(props, ref) {
|
|
|
156
153
|
if (type === "password") {
|
|
157
154
|
return revealPassword ? "text" : "password";
|
|
158
155
|
}
|
|
159
|
-
if (
|
|
160
|
-
return "search";
|
|
161
|
-
}
|
|
162
|
-
if (type === "number") {
|
|
163
|
-
return "number";
|
|
164
|
-
}
|
|
156
|
+
if (["search", "number", "email"].includes(type)) return type;
|
|
165
157
|
return "text";
|
|
166
158
|
}, [revealPassword, type]);
|
|
167
159
|
const [suggestionValues, setSuggestionValues] = useState(null);
|
package/dist/esm/List/List.js
CHANGED
|
@@ -176,9 +176,9 @@ const HvList = (props) => {
|
|
|
176
176
|
return renderListItem(item, index, {
|
|
177
177
|
style: {
|
|
178
178
|
...style,
|
|
179
|
-
top: `${parseFloat(style.top) + 5}px`,
|
|
180
|
-
left: `${parseFloat(style.left) + 5}px`,
|
|
181
|
-
width: `calc(${parseFloat(style.width)}% - 10px)`
|
|
179
|
+
top: `${Number.parseFloat(style.top) + 5}px`,
|
|
180
|
+
left: `${Number.parseFloat(style.left) + 5}px`,
|
|
181
|
+
width: `calc(${Number.parseFloat(style.width)}% - 10px)`
|
|
182
182
|
},
|
|
183
183
|
tabIndex,
|
|
184
184
|
interactive: true,
|
|
@@ -121,7 +121,7 @@ function reducer(state, action, previousState, instance) {
|
|
|
121
121
|
applyToggleAllRowsSelectedToPrefilteredRows
|
|
122
122
|
} = instance;
|
|
123
123
|
const rowsToSelect = applyToggleAllRowsSelectedToPrefilteredRows ? initialRowsById : nonGroupedRowsById;
|
|
124
|
-
const selectAll =
|
|
124
|
+
const selectAll = setSelected ?? !isAllRowsSelected;
|
|
125
125
|
const selectedRowIds = { ...state.selectedRowIds };
|
|
126
126
|
if (selectAll) {
|
|
127
127
|
Object.keys(rowsToSelect).forEach((rowId) => {
|
|
@@ -151,7 +151,7 @@ function reducer(state, action, previousState, instance) {
|
|
|
151
151
|
}
|
|
152
152
|
const { rowsById, selectSubRows = true, getSubRows } = instance;
|
|
153
153
|
const isSelected = state.selectedRowIds[id];
|
|
154
|
-
const shouldExist =
|
|
154
|
+
const shouldExist = setSelected ?? !isSelected;
|
|
155
155
|
if (isSelected === shouldExist) {
|
|
156
156
|
return state;
|
|
157
157
|
}
|
|
@@ -186,7 +186,7 @@ function reducer(state, action, previousState, instance) {
|
|
|
186
186
|
isAllPageRowsSelected,
|
|
187
187
|
getSubRows
|
|
188
188
|
} = instance;
|
|
189
|
-
const selectAll =
|
|
189
|
+
const selectAll = setSelected ?? !isAllPageRowsSelected;
|
|
190
190
|
const newSelectedRowIds = { ...state.selectedRowIds };
|
|
191
191
|
const handleRowById = (rowId) => {
|
|
192
192
|
const row = rowsById[rowId];
|
|
@@ -220,7 +220,7 @@ function reducer(state, action, previousState, instance) {
|
|
|
220
220
|
const { id, value: setLockedSelection } = action;
|
|
221
221
|
const { rowsById, selectSubRows = true, getSubRows } = instance;
|
|
222
222
|
const isLockedSelection = state.lockedSelectionRowIds[id];
|
|
223
|
-
const shouldExist =
|
|
223
|
+
const shouldExist = setLockedSelection ?? !isLockedSelection;
|
|
224
224
|
if (isLockedSelection === shouldExist) {
|
|
225
225
|
return state;
|
|
226
226
|
}
|
|
@@ -92,7 +92,7 @@ const HvTagsInput = forwardRef(
|
|
|
92
92
|
(currValue) => {
|
|
93
93
|
if (maxTagsQuantity !== null && maxTagsQuantity !== void 0 && currValue.length > maxTagsQuantity) {
|
|
94
94
|
setValidationState("invalid");
|
|
95
|
-
setValidationMessage(errorMessages.maxCharError);
|
|
95
|
+
setValidationMessage(errorMessages.maxCharError || "");
|
|
96
96
|
setStateValid(false);
|
|
97
97
|
} else {
|
|
98
98
|
setValidationState("valid");
|
|
@@ -87,12 +87,11 @@ const HvTextArea = forwardRef(function HvTextArea2(props, ref) {
|
|
|
87
87
|
required,
|
|
88
88
|
minCharQuantity,
|
|
89
89
|
maxCharQuantity,
|
|
90
|
-
"none",
|
|
91
90
|
validation
|
|
92
91
|
);
|
|
93
92
|
setValidationState(computeValidationState(inputValidity, isEmptyValue));
|
|
94
93
|
setValidationMessage(
|
|
95
|
-
computeValidationMessage(inputValidity, errorMessages)
|
|
94
|
+
computeValidationMessage(inputValidity, errorMessages) || ""
|
|
96
95
|
);
|
|
97
96
|
return inputValidity;
|
|
98
97
|
}, [
|
|
@@ -109,7 +108,7 @@ const HvTextArea = forwardRef(function HvTextArea2(props, ref) {
|
|
|
109
108
|
const limitValue = (currentValue) => {
|
|
110
109
|
if (currentValue === void 0 || !blockMax) return currentValue;
|
|
111
110
|
const isOverflow = maxCharQuantity == null ? false : currentValue.length > maxCharQuantity;
|
|
112
|
-
return !isOverflow ? currentValue : currentValue.
|
|
111
|
+
return !isOverflow ? currentValue : currentValue.slice(0, maxCharQuantity);
|
|
113
112
|
};
|
|
114
113
|
const onContainerBlurHandler = (event) => {
|
|
115
114
|
setFocused(false);
|
|
@@ -163,7 +162,7 @@ const HvTextArea = forwardRef(function HvTextArea2(props, ref) {
|
|
|
163
162
|
}, [focused, isEmptyValue, performValidation]);
|
|
164
163
|
const canShowError = ariaErrorMessage == null && (status !== void 0 && statusMessage !== void 0 || status === void 0 && hasBuiltInValidations(
|
|
165
164
|
required,
|
|
166
|
-
"
|
|
165
|
+
"text",
|
|
167
166
|
minCharQuantity,
|
|
168
167
|
// If blockMax is true maxCharQuantity will never produce an error
|
|
169
168
|
// unless the value is controlled, so we can't prevent it to overflow maxCharQuantity
|
|
@@ -34,14 +34,14 @@ const Placeholder = forwardRef(
|
|
|
34
34
|
...others,
|
|
35
35
|
children: [
|
|
36
36
|
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: getDateValue(value) }),
|
|
37
|
-
segments.map((segment
|
|
37
|
+
segments.map((segment) => /* @__PURE__ */ jsx(
|
|
38
38
|
PlaceholderSegment,
|
|
39
39
|
{
|
|
40
40
|
segment,
|
|
41
41
|
state,
|
|
42
42
|
placeholder: placeholders[segment.type]
|
|
43
43
|
},
|
|
44
|
-
|
|
44
|
+
segment.type
|
|
45
45
|
))
|
|
46
46
|
]
|
|
47
47
|
}
|
|
@@ -182,7 +182,7 @@ const HvTimePicker = forwardRef(
|
|
|
182
182
|
]
|
|
183
183
|
},
|
|
184
184
|
...otherDropdownProps,
|
|
185
|
-
children: /* @__PURE__ */ jsx("div", { ref: timeFieldRef, className: classes.timePopperContainer, children: state.segments.map((segment
|
|
185
|
+
children: /* @__PURE__ */ jsx("div", { ref: timeFieldRef, className: classes.timePopperContainer, children: state.segments.map((segment) => /* @__PURE__ */ jsx(
|
|
186
186
|
Unit,
|
|
187
187
|
{
|
|
188
188
|
state,
|
|
@@ -194,7 +194,7 @@ const HvTimePicker = forwardRef(
|
|
|
194
194
|
state.setSegment(segment.type, Number(val));
|
|
195
195
|
}
|
|
196
196
|
},
|
|
197
|
-
|
|
197
|
+
segment.type
|
|
198
198
|
)) })
|
|
199
199
|
}
|
|
200
200
|
),
|
|
@@ -70,7 +70,7 @@ const HvTreeItem = forwardRef(
|
|
|
70
70
|
if (instance && label) {
|
|
71
71
|
return instance.mapFirstChar(
|
|
72
72
|
nodeId,
|
|
73
|
-
(contentRef.current?.textContent ?? "").
|
|
73
|
+
(contentRef.current?.textContent ?? "").slice(0, 1).toLowerCase()
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
return void 0;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useContext } from "react";
|
|
2
2
|
import { DescendantContext } from "../internals/DescendantProvider.js";
|
|
3
3
|
import { useTreeViewContext } from "../internals/TreeViewProvider.js";
|
|
4
4
|
function useHvTreeItem(nodeId) {
|
|
5
5
|
const { instance, multiSelect } = useTreeViewContext();
|
|
6
|
-
const { level = 0 } =
|
|
6
|
+
const { level = 0 } = useContext(DescendantContext);
|
|
7
7
|
const expandable = instance ? instance.isNodeExpandable(nodeId) : false;
|
|
8
8
|
const expanded = instance ? instance.isNodeExpanded(nodeId) : false;
|
|
9
9
|
const focused = instance ? instance.isNodeFocused(nodeId) : false;
|
|
@@ -119,7 +119,7 @@ const HvVerticalNavigationTreeViewItem = forwardRef(
|
|
|
119
119
|
if (mapFirstChar && unMapFirstChar && label && contentRef.current?.textContent) {
|
|
120
120
|
mapFirstChar(
|
|
121
121
|
nodeId,
|
|
122
|
-
contentRef.current?.textContent.
|
|
122
|
+
contentRef.current?.textContent.slice(0, 1).toLowerCase()
|
|
123
123
|
);
|
|
124
124
|
return () => {
|
|
125
125
|
unMapFirstChar(nodeId);
|
|
@@ -310,7 +310,7 @@ const HvVerticalNavigationTreeViewItem = forwardRef(
|
|
|
310
310
|
variant: "square",
|
|
311
311
|
size: "xs",
|
|
312
312
|
backgroundColor: "textSubtle",
|
|
313
|
-
children: payload?.label?.
|
|
313
|
+
children: payload?.label?.slice(0, 1)
|
|
314
314
|
}
|
|
315
315
|
) : useIcons && icon,
|
|
316
316
|
hasChildren && !isOpen ? /* @__PURE__ */ jsx(HvIcon, { name: "Forwards", size: "xs", compact: true }) : hasAnyChildWithData && !isOpen && /* @__PURE__ */ jsx("div", {})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useMemo } from "react";
|
|
2
2
|
const setRef = (ref, value) => {
|
|
3
3
|
if (typeof ref === "function") {
|
|
4
4
|
ref(value);
|
|
@@ -7,7 +7,7 @@ const setRef = (ref, value) => {
|
|
|
7
7
|
}
|
|
8
8
|
};
|
|
9
9
|
const useForkRef = (refA, refB) => {
|
|
10
|
-
return
|
|
10
|
+
return useMemo(() => {
|
|
11
11
|
if (refA == null && refB == null) {
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
@@ -2,24 +2,18 @@ import { useState, useEffect } from "react";
|
|
|
2
2
|
const useImageLoaded = (src, srcSet) => {
|
|
3
3
|
const [imageLoaded, setImageLoaded] = useState(false);
|
|
4
4
|
useEffect(() => {
|
|
5
|
-
if (!src && !srcSet)
|
|
6
|
-
return void 0;
|
|
7
|
-
}
|
|
5
|
+
if (!src && !srcSet) return;
|
|
8
6
|
setImageLoaded(false);
|
|
9
7
|
let active = true;
|
|
10
8
|
const image = new Image();
|
|
11
9
|
image.src = src || "";
|
|
12
10
|
image.srcset = srcSet || "";
|
|
13
11
|
image.onload = () => {
|
|
14
|
-
if (!active)
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
12
|
+
if (!active) return;
|
|
17
13
|
setImageLoaded("loaded");
|
|
18
14
|
};
|
|
19
15
|
image.onerror = () => {
|
|
20
|
-
if (!active)
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
16
|
+
if (!active) return;
|
|
23
17
|
setImageLoaded("error");
|
|
24
18
|
};
|
|
25
19
|
return () => {
|
|
@@ -49,7 +49,7 @@ const pentahoPlus = mergeTheme(pentahoPlus$1, {
|
|
|
49
49
|
Object.entries(notificationMap).map(([variant, color]) => [
|
|
50
50
|
variant,
|
|
51
51
|
{
|
|
52
|
-
backgroundColor: theme.
|
|
52
|
+
backgroundColor: theme.mix(`${color}Dimmed`, 0.5, "dimmer"),
|
|
53
53
|
"--icolor": theme.colors[color],
|
|
54
54
|
"--outline": theme.colors[`${color}Border`],
|
|
55
55
|
"--bg": theme.colors[`${color}Subtle`],
|
package/dist/types/index.d.ts
CHANGED
|
@@ -625,6 +625,19 @@ export declare type DeepPartial<T> = T extends {} ? Partial<{
|
|
|
625
625
|
[P in keyof T]: DeepPartial<T[P]>;
|
|
626
626
|
}> : T;
|
|
627
627
|
|
|
628
|
+
declare const DEFAULT_ERROR_MESSAGES: {
|
|
629
|
+
/** The value when a validation fails. */
|
|
630
|
+
error: string;
|
|
631
|
+
/** The message that appears when there are too many characters. */
|
|
632
|
+
maxCharError: string;
|
|
633
|
+
/** The message that appears when there are too few characters. */
|
|
634
|
+
minCharError: string;
|
|
635
|
+
/** The message that appears when the input is empty and required. */
|
|
636
|
+
requiredError: string;
|
|
637
|
+
/** The message that appears when the input is value is incompatible with the expected type. */
|
|
638
|
+
typeMismatchError: string;
|
|
639
|
+
};
|
|
640
|
+
|
|
628
641
|
declare const DEFAULT_LABELS: {
|
|
629
642
|
dropdownMenu: string;
|
|
630
643
|
};
|
|
@@ -6749,11 +6762,7 @@ export { HvThemeContextValue }
|
|
|
6749
6762
|
|
|
6750
6763
|
export declare type HvThemeCustomizationProps = HvExtraDeepPartialProps<Omit<HvThemeStructure, "colors" | "name" | "base">> & {
|
|
6751
6764
|
colors?: {
|
|
6752
|
-
modes?:
|
|
6753
|
-
[key: string]: Partial<HvThemeColorModeStructure> & {
|
|
6754
|
-
[key: string]: string;
|
|
6755
|
-
};
|
|
6756
|
-
};
|
|
6765
|
+
modes?: Record<string, Partial<HvThemeColorModeStructure> & Record<string, string>>;
|
|
6757
6766
|
};
|
|
6758
6767
|
};
|
|
6759
6768
|
|
|
@@ -7174,18 +7183,7 @@ export declare interface HvUseTableProps extends Omit<TableProps, "role">, UseHv
|
|
|
7174
7183
|
export declare interface HvUseTableRowProps extends Omit<TableRowProps, "role">, UseHvTableStylesTableRowProps, UseHvRowSelectionTableRowProps, UseHvRowExpandTableRowProps, HvTableRowProps {
|
|
7175
7184
|
}
|
|
7176
7185
|
|
|
7177
|
-
export declare
|
|
7178
|
-
/** The value when a validation fails. */
|
|
7179
|
-
error?: string;
|
|
7180
|
-
/** The message that appears when there are too many characters. */
|
|
7181
|
-
maxCharError?: string;
|
|
7182
|
-
/** The message that appears when there are too few characters. */
|
|
7183
|
-
minCharError?: string;
|
|
7184
|
-
/** The message that appears when the input is empty and required. */
|
|
7185
|
-
requiredError?: string;
|
|
7186
|
-
/** The message that appears when the input is value is incompatible with the expected type. */
|
|
7187
|
-
typeMismatchError?: string;
|
|
7188
|
-
}
|
|
7186
|
+
export declare type HvValidationMessages = Partial<typeof DEFAULT_ERROR_MESSAGES>;
|
|
7189
7187
|
|
|
7190
7188
|
/**
|
|
7191
7189
|
* Use a vertical layout for global navigation on wide screens. treeview mode provides structured hierarchy but overrides standard keyboard navigation.
|
|
@@ -10628,9 +10626,9 @@ export declare function useHvTreeItem(nodeId: string): {
|
|
|
10628
10626
|
expanded: boolean;
|
|
10629
10627
|
selected: boolean;
|
|
10630
10628
|
focused: boolean;
|
|
10631
|
-
handleExpansion: (event:
|
|
10632
|
-
handleSelection: (event:
|
|
10633
|
-
preventSelection: (event:
|
|
10629
|
+
handleExpansion: (event: React.MouseEvent) => void;
|
|
10630
|
+
handleSelection: (event: React.MouseEvent) => void;
|
|
10631
|
+
preventSelection: (event: React.MouseEvent) => void;
|
|
10634
10632
|
};
|
|
10635
10633
|
|
|
10636
10634
|
export declare const useImageLoaded: (src?: string, srcSet?: string) => string | boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.97.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Hitachi Vantara UI Kit Team",
|
|
6
6
|
"description": "Core React components for the NEXT Design System.",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@emotion/cache": "^11.11.0",
|
|
34
34
|
"@emotion/serialize": "^1.1.2",
|
|
35
|
-
"@hitachivantara/uikit-react-shared": "^5.
|
|
36
|
-
"@hitachivantara/uikit-react-utils": "^0.2.
|
|
35
|
+
"@hitachivantara/uikit-react-shared": "^5.5.0",
|
|
36
|
+
"@hitachivantara/uikit-react-utils": "^0.2.40",
|
|
37
37
|
"@hitachivantara/uikit-styles": "^5.48.2",
|
|
38
38
|
"@internationalized/date": "^3.2.0",
|
|
39
39
|
"@mui/base": "5.0.0-beta.68",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"access": "public",
|
|
62
62
|
"directory": "package"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "acfc9b4224682aaebdf1c171e80eb1bfc2632a47",
|
|
65
65
|
"exports": {
|
|
66
66
|
".": {
|
|
67
67
|
"types": "./dist/types/index.d.ts",
|