@hitachivantara/uikit-react-core 5.87.2 → 5.88.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/ActionsGeneric/ActionsGeneric.cjs +1 -1
- package/dist/cjs/Banner/BannerContent/BannerContent.cjs +1 -1
- package/dist/cjs/BaseInput/BaseInput.cjs +44 -83
- package/dist/cjs/BaseInput/BaseInput.styles.cjs +68 -142
- package/dist/cjs/BaseInput/validations.cjs +2 -1
- package/dist/cjs/Calendar/CalendarHeader/CalendarHeader.cjs +0 -6
- package/dist/cjs/Calendar/CalendarHeader/CalendarHeader.styles.cjs +1 -5
- package/dist/cjs/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/cjs/DatePicker/DatePicker.cjs +12 -12
- package/dist/cjs/Dropdown/Dropdown.cjs +8 -10
- package/dist/cjs/FilterGroup/FilterContent/FilterContent.cjs +1 -1
- package/dist/cjs/FormElement/Adornment/Adornment.cjs +15 -36
- package/dist/cjs/FormElement/Adornment/Adornment.styles.cjs +11 -17
- package/dist/cjs/InlineEditor/InlineEditor.cjs +10 -14
- package/dist/cjs/InlineEditor/InlineEditor.styles.cjs +13 -36
- package/dist/cjs/Input/Input.cjs +33 -56
- package/dist/cjs/Input/Input.styles.cjs +6 -19
- package/dist/cjs/List/List.cjs +12 -12
- package/dist/cjs/Pagination/Pagination.styles.cjs +2 -1
- package/dist/cjs/Pagination/Select.cjs +1 -1
- package/dist/cjs/Select/Select.styles.cjs +1 -1
- package/dist/cjs/Table/TableBody/TableBody.cjs +16 -17
- package/dist/cjs/TableSection/TableSection.styles.cjs +10 -10
- package/dist/cjs/Tag/Tag.cjs +1 -1
- package/dist/cjs/TagsInput/TagsInput.cjs +103 -169
- package/dist/cjs/TagsInput/TagsInput.styles.cjs +45 -111
- package/dist/cjs/TextArea/TextArea.cjs +1 -3
- package/dist/cjs/TextArea/TextArea.styles.cjs +1 -1
- package/dist/cjs/TimePicker/TimePicker.cjs +5 -4
- package/dist/cjs/TimePicker/Unit/Unit.cjs +0 -1
- package/dist/cjs/TimePicker/Unit/Unit.styles.cjs +0 -3
- package/dist/cjs/hooks/useFocus.cjs +38 -0
- package/dist/cjs/utils/CounterLabel.cjs +3 -2
- package/dist/cjs/utils/focusUtils.cjs +0 -4
- package/dist/esm/ActionsGeneric/ActionsGeneric.js +1 -1
- package/dist/esm/AvatarGroup/AvatarGroupContext.js +1 -1
- package/dist/esm/Banner/BannerContent/BannerContent.js +1 -1
- package/dist/esm/BaseCheckBox/BaseCheckBox.js +1 -1
- package/dist/esm/BaseDropdown/BaseDropdown.js +3 -3
- package/dist/esm/BaseInput/BaseInput.js +45 -84
- package/dist/esm/BaseInput/BaseInput.js.map +1 -1
- package/dist/esm/BaseInput/BaseInput.styles.js +68 -142
- package/dist/esm/BaseInput/BaseInput.styles.js.map +1 -1
- package/dist/esm/BaseInput/validations.js +2 -1
- package/dist/esm/BaseInput/validations.js.map +1 -1
- package/dist/esm/BaseRadio/BaseRadio.js +1 -1
- package/dist/esm/Button/Button.js +1 -1
- package/dist/esm/Calendar/CalendarHeader/CalendarHeader.js +1 -7
- package/dist/esm/Calendar/CalendarHeader/CalendarHeader.js.map +1 -1
- package/dist/esm/Calendar/CalendarHeader/CalendarHeader.styles.js +1 -5
- package/dist/esm/Calendar/CalendarHeader/CalendarHeader.styles.js.map +1 -1
- package/dist/esm/CheckBoxGroup/CheckBoxGroup.js.map +1 -1
- package/dist/esm/ColorPicker/ColorPicker.js +1 -1
- package/dist/esm/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/esm/ColorPicker/Fields/Fields.js.map +1 -1
- package/dist/esm/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/DatePicker/utils.js +1 -1
- package/dist/esm/Dialog/context.js +1 -1
- package/dist/esm/DotPagination/DotPagination.js +1 -1
- package/dist/esm/Dropdown/Dropdown.js +8 -10
- package/dist/esm/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/DropdownButton/DropdownButton.js.map +1 -1
- package/dist/esm/FilterGroup/FilterContent/FilterContent.js +1 -1
- package/dist/esm/FilterGroup/FilterContent/FilterContent.js.map +1 -1
- package/dist/esm/FilterGroup/FilterGroupContext.js +1 -1
- package/dist/esm/FilterGroup/RightPanel/RightPanel.js.map +1 -1
- package/dist/esm/Focus/Focus.js +1 -1
- package/dist/esm/FormElement/Adornment/Adornment.js +15 -36
- package/dist/esm/FormElement/Adornment/Adornment.js.map +1 -1
- package/dist/esm/FormElement/Adornment/Adornment.styles.js +11 -17
- package/dist/esm/FormElement/Adornment/Adornment.styles.js.map +1 -1
- package/dist/esm/Header/Navigation/useSelectionPath.js.map +1 -1
- package/dist/esm/InlineEditor/InlineEditor.js +10 -14
- package/dist/esm/InlineEditor/InlineEditor.js.map +1 -1
- package/dist/esm/InlineEditor/InlineEditor.styles.js +13 -36
- package/dist/esm/InlineEditor/InlineEditor.styles.js.map +1 -1
- package/dist/esm/Input/Input.js +34 -57
- package/dist/esm/Input/Input.js.map +1 -1
- package/dist/esm/Input/Input.styles.js +6 -19
- package/dist/esm/Input/Input.styles.js.map +1 -1
- package/dist/esm/List/List.js +12 -12
- package/dist/esm/List/List.js.map +1 -1
- package/dist/esm/Pagination/Pagination.styles.js +5 -4
- package/dist/esm/Pagination/Pagination.styles.js.map +1 -1
- package/dist/esm/Pagination/Select.js +1 -1
- package/dist/esm/QueryBuilder/Context.js +1 -1
- package/dist/esm/QueryBuilder/QueryBuilder.js +1 -1
- package/dist/esm/QueryBuilder/utils/index.js +1 -1
- package/dist/esm/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/Select/Select.styles.js +1 -1
- package/dist/esm/Select/Select.styles.js.map +1 -1
- package/dist/esm/SelectionList/SelectionList.js.map +1 -1
- package/dist/esm/Slider/Slider.js +1 -1
- package/dist/esm/Slider/Slider.js.map +1 -1
- package/dist/esm/SnackbarProvider/SnackbarProvider.js +2 -2
- package/dist/esm/Table/TableBody/TableBody.js +16 -17
- package/dist/esm/Table/TableBody/TableBody.js.map +1 -1
- package/dist/esm/TableSection/TableSection.styles.js +24 -24
- package/dist/esm/Tag/Tag.js +1 -1
- package/dist/esm/Tag/Tag.js.map +1 -1
- package/dist/esm/TagsInput/TagsInput.js +103 -169
- package/dist/esm/TagsInput/TagsInput.js.map +1 -1
- package/dist/esm/TagsInput/TagsInput.styles.js +45 -111
- package/dist/esm/TagsInput/TagsInput.styles.js.map +1 -1
- package/dist/esm/TextArea/TextArea.js +1 -3
- package/dist/esm/TextArea/TextArea.js.map +1 -1
- package/dist/esm/TextArea/TextArea.styles.js +1 -1
- package/dist/esm/TextArea/TextArea.styles.js.map +1 -1
- package/dist/esm/TimePicker/TimePicker.js +1 -0
- package/dist/esm/TimePicker/TimePicker.js.map +1 -1
- package/dist/esm/TimePicker/Unit/Unit.js +0 -1
- package/dist/esm/TimePicker/Unit/Unit.js.map +1 -1
- package/dist/esm/TimePicker/Unit/Unit.styles.js +0 -3
- package/dist/esm/TimePicker/Unit/Unit.styles.js.map +1 -1
- package/dist/esm/TreeView/internals/TreeViewProvider.js +1 -1
- package/dist/esm/TreeView/internals/hooks/plugins/useTreeViewKeyboardNavigation.js +1 -1
- package/dist/esm/VerticalNavigation/NavigationSlider/NavigationSlider.js.map +1 -1
- package/dist/esm/hooks/useFocus.js +38 -0
- package/dist/esm/hooks/useFocus.js.map +1 -0
- package/dist/esm/hooks/useScrollTo.js.map +1 -1
- package/dist/esm/utils/CounterLabel.js +3 -2
- package/dist/esm/utils/CounterLabel.js.map +1 -1
- package/dist/esm/utils/document.js.map +1 -1
- package/dist/esm/utils/focusUtils.js +0 -4
- package/dist/esm/utils/focusUtils.js.map +1 -1
- package/dist/types/index.d.ts +213 -274
- package/package.json +8 -8
|
@@ -6,68 +6,47 @@ const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
|
6
6
|
const context = require("../context.cjs");
|
|
7
7
|
const Adornment_styles = require("./Adornment.styles.cjs");
|
|
8
8
|
const ButtonBase = require("../../ButtonBase/ButtonBase.cjs");
|
|
9
|
-
const noop = () => {
|
|
10
|
-
};
|
|
11
9
|
const HvAdornment = React.forwardRef(function HvAdornment2(props, ref) {
|
|
12
10
|
const {
|
|
13
|
-
id,
|
|
14
11
|
classes: classesProp,
|
|
15
12
|
className,
|
|
16
13
|
icon,
|
|
17
14
|
showWhen,
|
|
18
15
|
onClick,
|
|
19
16
|
isVisible,
|
|
17
|
+
tabIndex,
|
|
20
18
|
...others
|
|
21
19
|
} = uikitReactUtils.useDefaultProps("HvAdornment", props);
|
|
22
20
|
const { classes, cx } = Adornment_styles.useClasses(classesProp);
|
|
23
21
|
const { status, disabled } = React.useContext(context.HvFormElementContext);
|
|
24
22
|
const { input } = React.useContext(context.HvFormElementDescriptorsContext);
|
|
25
23
|
const displayIcon = isVisible ?? (showWhen == null || status === showWhen);
|
|
26
|
-
const
|
|
27
|
-
return
|
|
28
|
-
|
|
24
|
+
const Component = onClick ? ButtonBase.HvButtonBase : "div";
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
+
Component,
|
|
29
27
|
{
|
|
30
|
-
id,
|
|
31
|
-
focusableWhenDisabled: true,
|
|
32
28
|
ref,
|
|
33
|
-
|
|
34
|
-
tabIndex: -1,
|
|
35
|
-
"aria-controls": input?.[0]?.id,
|
|
29
|
+
"aria-hidden": tabIndex == null || tabIndex < 0 ? true : void 0,
|
|
36
30
|
className: cx(
|
|
37
31
|
classes.root,
|
|
38
32
|
classes.adornment,
|
|
39
|
-
classes.
|
|
33
|
+
classes.icon,
|
|
34
|
+
onClick ? classes.adornmentButton : classes.adornmentIcon,
|
|
40
35
|
{
|
|
41
36
|
[classes.hideIcon]: !displayIcon,
|
|
42
37
|
[classes.disabled]: disabled
|
|
43
38
|
},
|
|
44
39
|
className
|
|
45
40
|
),
|
|
46
|
-
onClick
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
...onClick && {
|
|
42
|
+
disabled,
|
|
43
|
+
tabIndex: tabIndex ?? -1,
|
|
44
|
+
"aria-controls": input?.[0]?.id,
|
|
45
|
+
onClick,
|
|
46
|
+
onMouseDown: (event) => event.preventDefault()
|
|
47
|
+
},
|
|
50
48
|
...others,
|
|
51
|
-
children:
|
|
52
|
-
}
|
|
53
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
-
"div",
|
|
55
|
-
{
|
|
56
|
-
id,
|
|
57
|
-
ref,
|
|
58
|
-
className: cx(
|
|
59
|
-
classes.root,
|
|
60
|
-
classes.adornment,
|
|
61
|
-
classes.adornmentIcon,
|
|
62
|
-
{
|
|
63
|
-
[classes.hideIcon]: !displayIcon,
|
|
64
|
-
[classes.disabled]: disabled
|
|
65
|
-
},
|
|
66
|
-
className
|
|
67
|
-
),
|
|
68
|
-
role: "presentation",
|
|
69
|
-
...others,
|
|
70
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.icon, children: icon })
|
|
49
|
+
children: icon
|
|
71
50
|
}
|
|
72
51
|
);
|
|
73
52
|
});
|
|
@@ -2,27 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
4
4
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
5
|
-
const focusUtils = require("../../utils/focusUtils.cjs");
|
|
6
5
|
const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvAdornment", {
|
|
7
|
-
root: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
backgroundColor: "transparent",
|
|
11
|
-
border: "none",
|
|
12
|
-
padding: 0,
|
|
13
|
-
margin: 0
|
|
6
|
+
root: {
|
|
7
|
+
width: 32,
|
|
8
|
+
height: 30
|
|
14
9
|
},
|
|
15
|
-
|
|
10
|
+
/** @deprecated use `classes.root` */
|
|
11
|
+
icon: {},
|
|
12
|
+
/** @deprecated use `classes.root` */
|
|
13
|
+
adornment: {},
|
|
14
|
+
/** @deprecated use `classes.root` */
|
|
15
|
+
adornmentIcon: {},
|
|
16
16
|
hideIcon: { display: "none" },
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"&:focus": {
|
|
20
|
-
...focusUtils.outlineStyles
|
|
21
|
-
}
|
|
22
|
-
},
|
|
17
|
+
/** @deprecated use `classes.root` */
|
|
18
|
+
adornmentButton: {},
|
|
23
19
|
disabled: {
|
|
24
|
-
"&$adornmentButton": { cursor: "not-allowed" },
|
|
25
|
-
"&$adornmentIcon": { cursor: "not-allowed" },
|
|
26
20
|
"& svg *.color0": { fill: uikitStyles.theme.colors.secondary_60 }
|
|
27
21
|
}
|
|
28
22
|
});
|
|
@@ -40,12 +40,9 @@ const HvInlineEditor = generic.fixedForwardRef(function HvInlineEditor2(props, r
|
|
|
40
40
|
const [isOverflowing, setIsOverflowing] = React.useState(false);
|
|
41
41
|
const typographyStyles = activeTheme?.typography[variant] || {};
|
|
42
42
|
const { lineHeight } = typographyStyles;
|
|
43
|
-
const checkOverflow = () => {
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
inputRef.current.scrollWidth > inputRef.current.clientWidth
|
|
47
|
-
);
|
|
48
|
-
}
|
|
43
|
+
const checkOverflow = (el) => {
|
|
44
|
+
if (!el) return;
|
|
45
|
+
setIsOverflowing(el.scrollWidth > el.clientWidth);
|
|
49
46
|
};
|
|
50
47
|
useEnhancedEffect.useEnhancedEffect(() => {
|
|
51
48
|
const input = inputRef.current;
|
|
@@ -70,13 +67,11 @@ const HvInlineEditor = generic.fixedForwardRef(function HvInlineEditor2(props, r
|
|
|
70
67
|
newValue = cachedValue;
|
|
71
68
|
setEditMode(false);
|
|
72
69
|
setValue(newValue);
|
|
73
|
-
checkOverflow();
|
|
74
70
|
}
|
|
75
71
|
onKeyDown?.(event, newValue);
|
|
76
72
|
};
|
|
77
73
|
const handleChange = (event, val) => {
|
|
78
74
|
setValue(val);
|
|
79
|
-
checkOverflow();
|
|
80
75
|
onChange?.(event, val);
|
|
81
76
|
};
|
|
82
77
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cx(classes.root, className), children: editMode && !disabled ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -86,8 +81,7 @@ const HvInlineEditor = generic.fixedForwardRef(function HvInlineEditor2(props, r
|
|
|
86
81
|
inputRef,
|
|
87
82
|
classes: {
|
|
88
83
|
root: classes.inputRoot,
|
|
89
|
-
input: classes.input
|
|
90
|
-
inputBorderContainer: classes.inputBorderContainer
|
|
84
|
+
input: classes.input
|
|
91
85
|
},
|
|
92
86
|
inputProps: {
|
|
93
87
|
style: {
|
|
@@ -101,7 +95,7 @@ const HvInlineEditor = generic.fixedForwardRef(function HvInlineEditor2(props, r
|
|
|
101
95
|
onKeyDown: handleKeyDown,
|
|
102
96
|
...others
|
|
103
97
|
}
|
|
104
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
98
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
105
99
|
Button.HvButton,
|
|
106
100
|
{
|
|
107
101
|
variant: "secondaryGhost",
|
|
@@ -121,18 +115,20 @@ const HvInlineEditor = generic.fixedForwardRef(function HvInlineEditor2(props, r
|
|
|
121
115
|
onClick: handleClick,
|
|
122
116
|
disabled,
|
|
123
117
|
...buttonProps,
|
|
124
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Tooltip.HvTooltip, { title: isOverflowing && value, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
125
119
|
Typography.HvTypography,
|
|
126
120
|
{
|
|
121
|
+
component: "div",
|
|
122
|
+
ref: checkOverflow,
|
|
127
123
|
variant,
|
|
128
124
|
noWrap: true,
|
|
129
125
|
className: cx(classes.text, { [classes.textEmpty]: !value }),
|
|
130
126
|
...typographyProps,
|
|
131
127
|
children: value || placeholder
|
|
132
128
|
}
|
|
133
|
-
)
|
|
129
|
+
) })
|
|
134
130
|
}
|
|
135
|
-
) })
|
|
131
|
+
) });
|
|
136
132
|
});
|
|
137
133
|
exports.inlineEditorClasses = InlineEditor_styles.staticClasses;
|
|
138
134
|
exports.HvInlineEditor = HvInlineEditor;
|
|
@@ -2,29 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
4
4
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
5
|
-
const BaseInput_styles = require("../BaseInput/BaseInput.styles.cjs");
|
|
6
|
-
require("../BaseInput/BaseInput.cjs");
|
|
7
|
-
const Input_styles = require("../Input/Input.styles.cjs");
|
|
8
|
-
require("../Input/Input.cjs");
|
|
9
5
|
const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvInlineEditor", {
|
|
10
|
-
root: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
minHeight: "32px"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
inputBorderContainer: {
|
|
17
|
-
top: "unset",
|
|
18
|
-
bottom: 0
|
|
19
|
-
},
|
|
6
|
+
root: {},
|
|
7
|
+
/** @deprecated unused. use `classes.root::after` instead */
|
|
8
|
+
inputBorderContainer: {},
|
|
20
9
|
input: {},
|
|
21
|
-
inputRoot: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
textOverflow: "ellipsis",
|
|
25
|
-
whiteSpace: "nowrap",
|
|
26
|
-
alignSelf: "center"
|
|
10
|
+
inputRoot: {
|
|
11
|
+
height: "100%",
|
|
12
|
+
minHeight: "32px"
|
|
27
13
|
},
|
|
14
|
+
text: {},
|
|
28
15
|
largeText: {},
|
|
29
16
|
textEmpty: {
|
|
30
17
|
color: uikitStyles.theme.colors.secondary_60
|
|
@@ -37,41 +24,31 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvInlineEdi
|
|
|
37
24
|
height: "100%",
|
|
38
25
|
width: "100%",
|
|
39
26
|
maxWidth: "100%",
|
|
40
|
-
justifyContent: "
|
|
27
|
+
justifyContent: "start",
|
|
28
|
+
textAlign: "start",
|
|
41
29
|
alignItems: "center",
|
|
42
30
|
backgroundColor: uikitStyles.theme.colors.atmo1,
|
|
43
|
-
|
|
31
|
+
borderColor: "transparent",
|
|
44
32
|
"&:hover, &:focus": {
|
|
45
|
-
|
|
33
|
+
borderColor: uikitStyles.theme.colors.primary,
|
|
46
34
|
backgroundColor: uikitStyles.theme.colors.atmo1,
|
|
47
35
|
"& $icon": {
|
|
48
36
|
visibility: "visible"
|
|
49
37
|
}
|
|
50
38
|
},
|
|
51
39
|
"&:active": {
|
|
52
|
-
|
|
40
|
+
borderColor: uikitStyles.theme.colors.secondary,
|
|
53
41
|
backgroundColor: "transparent",
|
|
54
42
|
"& $icon": {
|
|
55
43
|
visibility: "visible"
|
|
56
44
|
}
|
|
57
|
-
},
|
|
58
|
-
"& > div": {
|
|
59
|
-
width: "100%"
|
|
60
|
-
},
|
|
61
|
-
"& > div > span": {
|
|
62
|
-
width: "100%"
|
|
63
45
|
}
|
|
64
46
|
},
|
|
65
47
|
icon: {
|
|
66
48
|
cursor: "pointer",
|
|
67
49
|
visibility: "hidden",
|
|
68
50
|
alignSelf: "center",
|
|
69
|
-
height:
|
|
70
|
-
width: "32px",
|
|
71
|
-
minWidth: "32px",
|
|
72
|
-
"& svg": {
|
|
73
|
-
margin: uikitStyles.theme.spacing(0, "xs")
|
|
74
|
-
}
|
|
51
|
+
height: 16
|
|
75
52
|
},
|
|
76
53
|
iconVisible: {
|
|
77
54
|
visibility: "visible"
|
package/dist/cjs/Input/Input.cjs
CHANGED
|
@@ -54,7 +54,7 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
54
54
|
id,
|
|
55
55
|
name,
|
|
56
56
|
value: valueProp,
|
|
57
|
-
defaultValue
|
|
57
|
+
defaultValue,
|
|
58
58
|
required,
|
|
59
59
|
readOnly,
|
|
60
60
|
disabled,
|
|
@@ -99,8 +99,7 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
99
99
|
const suggestionsRef = React.useRef(null);
|
|
100
100
|
const [focused, setFocused] = React.useState(false);
|
|
101
101
|
const isDirty = React.useRef(false);
|
|
102
|
-
const
|
|
103
|
-
const isEmptyValue = value == null || value === "";
|
|
102
|
+
const isEmptyValue = !inputRef.current?.value;
|
|
104
103
|
const [validationState, setValidationState] = useControlled.useControlled(
|
|
105
104
|
status,
|
|
106
105
|
utils$1.validationStates.standBy
|
|
@@ -124,7 +123,6 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
124
123
|
const performValidation = React.useCallback(() => {
|
|
125
124
|
const inputValidity = validations.validateInput(
|
|
126
125
|
inputRef.current,
|
|
127
|
-
String(value),
|
|
128
126
|
required,
|
|
129
127
|
minCharQuantity,
|
|
130
128
|
maxCharQuantity,
|
|
@@ -145,8 +143,7 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
145
143
|
setValidationMessage,
|
|
146
144
|
setValidationState,
|
|
147
145
|
validation,
|
|
148
|
-
validationType
|
|
149
|
-
value
|
|
146
|
+
validationType
|
|
150
147
|
]);
|
|
151
148
|
const canShowError = ariaErrorMessage == null && (status !== void 0 && statusMessage !== void 0 || status === void 0 && validations.hasBuiltInValidations(
|
|
152
149
|
required,
|
|
@@ -200,7 +197,6 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
200
197
|
};
|
|
201
198
|
const onChangeHandler = (event, newValue) => {
|
|
202
199
|
isDirty.current = true;
|
|
203
|
-
setValue(newValue);
|
|
204
200
|
onChange?.(event, newValue);
|
|
205
201
|
if (canShowSuggestions) {
|
|
206
202
|
suggestionHandler(newValue);
|
|
@@ -210,12 +206,12 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
210
206
|
if (eventTargetIsInsideContainer(suggestionsRef.current, event)) return;
|
|
211
207
|
setFocused(false);
|
|
212
208
|
const inputValidity = performValidation();
|
|
213
|
-
onBlur?.(event,
|
|
209
|
+
onBlur?.(event, event.target.value, inputValidity);
|
|
214
210
|
};
|
|
215
211
|
const onFocusHandler = (event) => {
|
|
216
212
|
setFocused(true);
|
|
217
213
|
setValidationState(utils$1.validationStates.standBy);
|
|
218
|
-
onFocus?.(event,
|
|
214
|
+
onFocus?.(event, event.target.value);
|
|
219
215
|
};
|
|
220
216
|
const getSuggestions = (li) => {
|
|
221
217
|
const listEl = document.getElementById(
|
|
@@ -232,13 +228,14 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
232
228
|
}
|
|
233
229
|
};
|
|
234
230
|
const onKeyDownHandler = (event) => {
|
|
231
|
+
const { value } = event.currentTarget;
|
|
235
232
|
if (keyboardUtils.isKey(event, "ArrowDown") && hasSuggestions) {
|
|
236
233
|
const li = getSuggestions(0);
|
|
237
234
|
li?.focus();
|
|
238
235
|
} else if (keyboardUtils.isKey(event, "Enter")) {
|
|
239
|
-
onEnter?.(event,
|
|
236
|
+
onEnter?.(event, value);
|
|
240
237
|
}
|
|
241
|
-
onKeyDown?.(event,
|
|
238
|
+
onKeyDown?.(event, value);
|
|
242
239
|
};
|
|
243
240
|
const onContainerBlurHandler = (event) => {
|
|
244
241
|
if (event.relatedTarget) {
|
|
@@ -248,8 +245,7 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
248
245
|
}, 10);
|
|
249
246
|
}
|
|
250
247
|
};
|
|
251
|
-
const
|
|
252
|
-
const showClear = !disabled && !readOnly && !disableClear && !isEmptyValue && (!hasOnEnter || type !== "search" || disableSearchButton || validationState !== utils$1.validationStates.standBy);
|
|
248
|
+
const showClear = !disabled && !readOnly && !disableClear && !isEmptyValue && (!onEnter || type !== "search" || disableSearchButton || validationState !== utils$1.validationStates.standBy);
|
|
253
249
|
const showSearchIcon = type === "search" && !disableSearchButton;
|
|
254
250
|
const showRevealPasswordButton = type === "password" && !disableRevealPassword;
|
|
255
251
|
const handleClear = React.useCallback(
|
|
@@ -289,42 +285,27 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
289
285
|
elementId,
|
|
290
286
|
cx
|
|
291
287
|
]);
|
|
292
|
-
const handleSearch = React.useCallback(
|
|
293
|
-
(event) => {
|
|
294
|
-
onEnter?.(event, String(value));
|
|
295
|
-
},
|
|
296
|
-
[onEnter, value]
|
|
297
|
-
);
|
|
298
288
|
const searchButton = React.useMemo(() => {
|
|
299
|
-
const reallyShowIt = showSearchIcon && (isEmptyValue ||
|
|
300
|
-
if (!reallyShowIt)
|
|
301
|
-
return null;
|
|
302
|
-
}
|
|
289
|
+
const reallyShowIt = showSearchIcon && (isEmptyValue || onEnter && validationState === utils$1.validationStates.standBy);
|
|
290
|
+
if (!reallyShowIt) return null;
|
|
303
291
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
304
292
|
Adornment.HvAdornment,
|
|
305
293
|
{
|
|
306
294
|
className: classes.adornmentButton,
|
|
307
|
-
onClick:
|
|
308
|
-
|
|
309
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Search, {})
|
|
295
|
+
onClick: onEnter && ((evt) => onEnter?.(evt, inputRef.current?.value ?? "")),
|
|
296
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Search, { title: labels.searchButtonLabel })
|
|
310
297
|
}
|
|
311
298
|
);
|
|
312
299
|
}, [
|
|
313
300
|
showSearchIcon,
|
|
314
301
|
isEmptyValue,
|
|
315
|
-
|
|
302
|
+
onEnter,
|
|
316
303
|
validationState,
|
|
317
304
|
classes.adornmentButton,
|
|
318
|
-
|
|
319
|
-
labels?.searchButtonLabel
|
|
305
|
+
labels.searchButtonLabel
|
|
320
306
|
]);
|
|
321
|
-
const handleRevealPassword = React.useCallback(() => {
|
|
322
|
-
setRevealPassword(!revealPassword);
|
|
323
|
-
}, [revealPassword]);
|
|
324
307
|
const revealPasswordButton = React.useMemo(() => {
|
|
325
|
-
if (!showRevealPasswordButton)
|
|
326
|
-
return null;
|
|
327
|
-
}
|
|
308
|
+
if (!showRevealPasswordButton) return null;
|
|
328
309
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
329
310
|
Tooltip.HvTooltip,
|
|
330
311
|
{
|
|
@@ -335,10 +316,12 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
335
316
|
Adornment.HvAdornment,
|
|
336
317
|
{
|
|
337
318
|
className: classes.adornmentButton,
|
|
338
|
-
onClick:
|
|
319
|
+
onClick: () => setRevealPassword((s) => !s),
|
|
339
320
|
"aria-label": labels?.revealPasswordButtonLabel,
|
|
340
321
|
"aria-controls": setId.setId(elementId, "input"),
|
|
341
|
-
icon: revealPassword ? /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.PreviewOff, {}) : /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Preview, {})
|
|
322
|
+
icon: revealPassword ? /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.PreviewOff, {}) : /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Preview, {}),
|
|
323
|
+
tabIndex: 0,
|
|
324
|
+
...{ selected: revealPassword }
|
|
342
325
|
}
|
|
343
326
|
)
|
|
344
327
|
}
|
|
@@ -350,28 +333,23 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
350
333
|
labels?.revealPasswordButtonClickToShowTooltip,
|
|
351
334
|
labels?.revealPasswordButtonLabel,
|
|
352
335
|
classes.adornmentButton,
|
|
353
|
-
handleRevealPassword,
|
|
354
336
|
elementId
|
|
355
337
|
]);
|
|
356
338
|
const validationIcon = React.useMemo(() => {
|
|
357
|
-
if (!showValidationIcon)
|
|
358
|
-
|
|
359
|
-
}
|
|
360
|
-
if (!utils$1.isValid(validationState)) {
|
|
361
|
-
return null;
|
|
362
|
-
}
|
|
339
|
+
if (!showValidationIcon) return null;
|
|
340
|
+
if (!utils$1.isValid(validationState)) return null;
|
|
363
341
|
return /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Success, { color: "positive", className: classes.icon });
|
|
364
342
|
}, [showValidationIcon, validationState, classes.icon]);
|
|
365
343
|
const customIconEl = React.useMemo(
|
|
366
|
-
() => React.isValidElement(endAdornment)
|
|
344
|
+
() => React.isValidElement(endAdornment) ? React.cloneElement(endAdornment, {
|
|
367
345
|
className: cx(endAdornment.props.className, classes.icon)
|
|
368
|
-
}),
|
|
346
|
+
}) : endAdornment,
|
|
369
347
|
[classes.icon, endAdornment, cx]
|
|
370
348
|
);
|
|
371
349
|
const adornments = React.useMemo(() => {
|
|
372
350
|
if (!clearButton && !revealPasswordButton && !searchButton && !validationIcon && !customIconEl)
|
|
373
351
|
return null;
|
|
374
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes.adornmentsBox,
|
|
352
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes.adornmentsBox, children: [
|
|
375
353
|
clearButton,
|
|
376
354
|
revealPasswordButton,
|
|
377
355
|
searchButton,
|
|
@@ -435,7 +413,8 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
435
413
|
{
|
|
436
414
|
id: hasLabel || showClear || showRevealPasswordButton ? setId.setId(elementId, "input") : setId.setId(id, "input"),
|
|
437
415
|
name,
|
|
438
|
-
value,
|
|
416
|
+
value: valueProp,
|
|
417
|
+
defaultValue,
|
|
439
418
|
required,
|
|
440
419
|
readOnly,
|
|
441
420
|
disabled,
|
|
@@ -448,11 +427,10 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
448
427
|
type: realType,
|
|
449
428
|
classes: {
|
|
450
429
|
input: classes.input,
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
inputBorderContainer: classes.inputBorderContainer
|
|
430
|
+
root: classes.inputRoot,
|
|
431
|
+
focused: classes.inputRootFocused,
|
|
432
|
+
disabled: classes.inputRootDisabled,
|
|
433
|
+
multiline: classes.inputRootMultiline
|
|
456
434
|
},
|
|
457
435
|
invalid: isStateInvalid,
|
|
458
436
|
inputProps: {
|
|
@@ -462,13 +440,12 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
462
440
|
"aria-errormessage": errorMessageId,
|
|
463
441
|
"aria-describedby": ariaDescribedBy != null ? ariaDescribedBy : description ? setId.setId(elementId, "description") : void 0,
|
|
464
442
|
"aria-controls": canShowSuggestions ? setId.setId(elementId, "suggestions") : void 0,
|
|
465
|
-
ref: inputRef,
|
|
466
443
|
// prevent browsers auto-fill/suggestions when we have our own
|
|
467
444
|
autoComplete: canShowSuggestions ? "off" : void 0,
|
|
468
445
|
onFocus: (event) => {
|
|
469
446
|
inputProps.onFocus?.(event);
|
|
470
447
|
if (canShowSuggestions && suggestOnFocus) {
|
|
471
|
-
suggestionHandler(
|
|
448
|
+
suggestionHandler(event.currentTarget.value);
|
|
472
449
|
}
|
|
473
450
|
},
|
|
474
451
|
onClick: (event) => {
|
|
@@ -477,7 +454,7 @@ const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
|
477
454
|
},
|
|
478
455
|
...inputProps
|
|
479
456
|
},
|
|
480
|
-
|
|
457
|
+
ref: forkedRef,
|
|
481
458
|
endAdornment: adornments,
|
|
482
459
|
...others
|
|
483
460
|
}
|
|
@@ -13,6 +13,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvInput", {
|
|
|
13
13
|
display: "flex",
|
|
14
14
|
flexDirection: "row",
|
|
15
15
|
height: "30px",
|
|
16
|
+
alignItems: "center",
|
|
16
17
|
justifyContent: "center",
|
|
17
18
|
marginRight: 1
|
|
18
19
|
},
|
|
@@ -35,18 +36,9 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvInput", {
|
|
|
35
36
|
backgroundColor: uikitStyles.theme.colors.atmo1,
|
|
36
37
|
boxShadow: `0px 8px 0px ${uikitStyles.theme.colors.atmo1}, 0px 0px 9px 0px rgba(65,65,65,.12)`
|
|
37
38
|
},
|
|
38
|
-
input: {
|
|
39
|
-
"&::-ms-clear": {
|
|
40
|
-
display: "none"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
39
|
+
input: {},
|
|
43
40
|
inputRoot: {
|
|
44
|
-
":hover": {
|
|
45
|
-
"& $iconClear": {
|
|
46
|
-
display: "block"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
":focus-within $iconClear": {
|
|
41
|
+
":is(:hover,:focus-within) $iconClear": {
|
|
50
42
|
display: "block"
|
|
51
43
|
}
|
|
52
44
|
},
|
|
@@ -55,15 +47,10 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvInput", {
|
|
|
55
47
|
display: "block"
|
|
56
48
|
}
|
|
57
49
|
},
|
|
58
|
-
inputRootDisabled: {
|
|
59
|
-
cursor: "not-allowed"
|
|
60
|
-
},
|
|
50
|
+
inputRootDisabled: {},
|
|
61
51
|
inputRootMultiline: { padding: 0 },
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
display: "none"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
52
|
+
/** @deprecated unused. use `::after` instead */
|
|
53
|
+
inputBorderContainer: {},
|
|
67
54
|
error: {}
|
|
68
55
|
});
|
|
69
56
|
exports.staticClasses = staticClasses;
|
package/dist/cjs/List/List.cjs
CHANGED
|
@@ -5,19 +5,21 @@ const React = require("react");
|
|
|
5
5
|
const reactWindow = require("react-window");
|
|
6
6
|
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
7
7
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
8
|
+
const CounterLabel = require("../utils/CounterLabel.cjs");
|
|
8
9
|
const setId = require("../utils/setId.cjs");
|
|
9
10
|
const List_styles = require("./List.styles.cjs");
|
|
10
11
|
const useSelectableList = require("./useSelectableList.cjs");
|
|
11
12
|
const utils = require("./utils.cjs");
|
|
12
13
|
const CheckBox = require("../CheckBox/CheckBox.cjs");
|
|
14
|
+
const Radio = require("../Radio/Radio.cjs");
|
|
13
15
|
const OverflowTooltip = require("../OverflowTooltip/OverflowTooltip.cjs");
|
|
14
16
|
const Link = require("../Link/Link.cjs");
|
|
15
|
-
const Radio = require("../Radio/Radio.cjs");
|
|
16
17
|
const ListContainer = require("../ListContainer/ListContainer.cjs");
|
|
17
|
-
const Typography = require("../Typography/Typography.cjs");
|
|
18
18
|
const ListItem = require("../ListContainer/ListItem/ListItem.cjs");
|
|
19
19
|
const DEFAULT_LABELS = {
|
|
20
|
+
/** The label used for the All checkbox action. @deprecated no longer used */
|
|
20
21
|
selectAll: "Select All",
|
|
22
|
+
/** The label used in the middle of the multi-selection count. */
|
|
21
23
|
selectionConjunction: "/"
|
|
22
24
|
};
|
|
23
25
|
const HvList = (props) => {
|
|
@@ -89,22 +91,20 @@ const HvList = (props) => {
|
|
|
89
91
|
}) : null;
|
|
90
92
|
};
|
|
91
93
|
const renderSelectAll = () => {
|
|
92
|
-
const { selectAll, selectionConjunction } = labels;
|
|
93
94
|
const anySelected2 = !!selection?.length;
|
|
94
95
|
const allSelected = selection.length === list.length;
|
|
95
|
-
const selectionLabel = /* @__PURE__ */ jsxRuntime.jsx(Typography.HvTypography, { component: "span", children: !anySelected2 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
96
|
-
/* @__PURE__ */ jsxRuntime.jsx("b", { children: selectAll }),
|
|
97
|
-
` (${list.length})`
|
|
98
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
99
|
-
/* @__PURE__ */ jsxRuntime.jsx("b", { children: selection.length }),
|
|
100
|
-
` ${selectionConjunction} `,
|
|
101
|
-
list.length
|
|
102
|
-
] }) });
|
|
103
96
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
104
97
|
CheckBox.HvCheckBox,
|
|
105
98
|
{
|
|
106
99
|
id: setId.setId(id, "select-all"),
|
|
107
|
-
label:
|
|
100
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(
|
|
101
|
+
CounterLabel.CounterLabel,
|
|
102
|
+
{
|
|
103
|
+
selected: selection.length,
|
|
104
|
+
total: list.length,
|
|
105
|
+
conjunctionLabel: labels.selectionConjunction
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
108
|
onChange: handleSelectAll,
|
|
109
109
|
className: classes.selectAllSelector,
|
|
110
110
|
indeterminate: anySelected2 && !allSelected,
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
4
4
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
5
|
+
const Input_styles = require("../Input/Input.styles.cjs");
|
|
6
|
+
require("../Input/Input.cjs");
|
|
5
7
|
const BaseDropdown_styles = require("../BaseDropdown/BaseDropdown.styles.cjs");
|
|
6
8
|
require("../BaseDropdown/BaseDropdown.cjs");
|
|
7
|
-
const Input_styles = require("../Input/Input.styles.cjs");
|
|
8
9
|
const hoverColor = uikitStyles.theme.colors.atmo3;
|
|
9
10
|
const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvPagination", {
|
|
10
11
|
/** Styles applied to the component root class. */
|
|
@@ -4,10 +4,10 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
6
6
|
const Select_styles = require("./Select.styles.cjs");
|
|
7
|
-
const ListItem = require("../ListContainer/ListItem/ListItem.cjs");
|
|
8
7
|
const BaseDropdown = require("../BaseDropdown/BaseDropdown.cjs");
|
|
9
8
|
const Panel = require("../Panel/Panel.cjs");
|
|
10
9
|
const SelectionList = require("../SelectionList/SelectionList.cjs");
|
|
10
|
+
const ListItem = require("../ListContainer/ListItem/ListItem.cjs");
|
|
11
11
|
const Option = ({ ...props }) => /* @__PURE__ */ jsxRuntime.jsx(ListItem.HvListItem, { ...props });
|
|
12
12
|
const HvSelect = (props) => {
|
|
13
13
|
const {
|
|
@@ -12,7 +12,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvSelect",
|
|
|
12
12
|
disabled: {},
|
|
13
13
|
readOnly: {},
|
|
14
14
|
invalid: {
|
|
15
|
-
|
|
15
|
+
borderColor: uikitStyles.theme.colors.negative_120
|
|
16
16
|
},
|
|
17
17
|
labelContainer: {
|
|
18
18
|
display: "flex",
|