@hitachivantara/uikit-react-core 5.87.2 → 5.87.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BaseInput/BaseInput.cjs +44 -83
- package/dist/cjs/BaseInput/BaseInput.styles.cjs +68 -142
- package/dist/cjs/Calendar/CalendarHeader/CalendarHeader.cjs +0 -6
- package/dist/cjs/Calendar/CalendarHeader/CalendarHeader.styles.cjs +1 -5
- package/dist/cjs/Dropdown/Dropdown.cjs +8 -10
- package/dist/cjs/InlineEditor/InlineEditor.cjs +10 -14
- package/dist/cjs/InlineEditor/InlineEditor.styles.cjs +13 -36
- package/dist/cjs/Input/Input.cjs +4 -5
- package/dist/cjs/Input/Input.styles.cjs +5 -19
- package/dist/cjs/List/List.cjs +11 -11
- package/dist/cjs/Pagination/Pagination.styles.cjs +1 -0
- package/dist/cjs/Select/Select.styles.cjs +1 -1
- package/dist/cjs/TagsInput/TagsInput.styles.cjs +3 -8
- package/dist/cjs/TextArea/TextArea.styles.cjs +1 -1
- package/dist/cjs/TimePicker/Unit/Unit.cjs +0 -1
- package/dist/cjs/TimePicker/Unit/Unit.styles.cjs +0 -3
- package/dist/cjs/utils/CounterLabel.cjs +3 -2
- 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/Calendar/CalendarHeader/CalendarHeader.js +0 -6
- 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/Dropdown/Dropdown.js +8 -10
- package/dist/esm/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/FilterGroup/RightPanel/RightPanel.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 +4 -5
- package/dist/esm/Input/Input.js.map +1 -1
- package/dist/esm/Input/Input.styles.js +5 -19
- package/dist/esm/Input/Input.styles.js.map +1 -1
- package/dist/esm/List/List.js +11 -11
- package/dist/esm/List/List.js.map +1 -1
- package/dist/esm/Pagination/Pagination.styles.js +1 -0
- package/dist/esm/Pagination/Pagination.styles.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/TagsInput/TagsInput.styles.js +3 -8
- package/dist/esm/TagsInput/TagsInput.styles.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/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/utils/CounterLabel.js +3 -2
- package/dist/esm/utils/CounterLabel.js.map +1 -1
- package/dist/types/index.d.ts +27 -29
- package/package.json +6 -6
|
@@ -35,18 +35,9 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvInput", {
|
|
|
35
35
|
backgroundColor: uikitStyles.theme.colors.atmo1,
|
|
36
36
|
boxShadow: `0px 8px 0px ${uikitStyles.theme.colors.atmo1}, 0px 0px 9px 0px rgba(65,65,65,.12)`
|
|
37
37
|
},
|
|
38
|
-
input: {
|
|
39
|
-
"&::-ms-clear": {
|
|
40
|
-
display: "none"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
38
|
+
input: {},
|
|
43
39
|
inputRoot: {
|
|
44
|
-
":hover": {
|
|
45
|
-
"& $iconClear": {
|
|
46
|
-
display: "block"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
":focus-within $iconClear": {
|
|
40
|
+
":is(:hover,:focus-within) $iconClear": {
|
|
50
41
|
display: "block"
|
|
51
42
|
}
|
|
52
43
|
},
|
|
@@ -55,15 +46,10 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvInput", {
|
|
|
55
46
|
display: "block"
|
|
56
47
|
}
|
|
57
48
|
},
|
|
58
|
-
inputRootDisabled: {
|
|
59
|
-
cursor: "not-allowed"
|
|
60
|
-
},
|
|
49
|
+
inputRootDisabled: {},
|
|
61
50
|
inputRootMultiline: { padding: 0 },
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
display: "none"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
51
|
+
/** @deprecated unused. use `::after` instead */
|
|
52
|
+
inputBorderContainer: {},
|
|
67
53
|
error: {}
|
|
68
54
|
});
|
|
69
55
|
exports.staticClasses = staticClasses;
|
package/dist/cjs/List/List.cjs
CHANGED
|
@@ -5,6 +5,7 @@ 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");
|
|
@@ -14,10 +15,11 @@ const OverflowTooltip = require("../OverflowTooltip/OverflowTooltip.cjs");
|
|
|
14
15
|
const Link = require("../Link/Link.cjs");
|
|
15
16
|
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,
|
|
@@ -5,6 +5,7 @@ const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
|
5
5
|
const BaseDropdown_styles = require("../BaseDropdown/BaseDropdown.styles.cjs");
|
|
6
6
|
require("../BaseDropdown/BaseDropdown.cjs");
|
|
7
7
|
const Input_styles = require("../Input/Input.styles.cjs");
|
|
8
|
+
require("../Input/Input.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. */
|
|
@@ -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",
|
|
@@ -3,6 +3,7 @@ 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
5
|
const BaseInput_styles = require("../BaseInput/BaseInput.styles.cjs");
|
|
6
|
+
require("../BaseInput/BaseInput.cjs");
|
|
6
7
|
const Suggestions_styles = require("../FormElement/Suggestions/Suggestions.styles.cjs");
|
|
7
8
|
const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvTagsInput", {
|
|
8
9
|
input: {
|
|
@@ -115,10 +116,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvTagsInput
|
|
|
115
116
|
tagInputRoot: {
|
|
116
117
|
[`& .${BaseInput_styles.staticClasses.root}`]: {
|
|
117
118
|
width: "100%",
|
|
118
|
-
border: "none"
|
|
119
|
-
"&:hover $tagInputBorderContainer": {
|
|
120
|
-
background: "none"
|
|
121
|
-
}
|
|
119
|
+
border: "none"
|
|
122
120
|
},
|
|
123
121
|
[`&& .${BaseInput_styles.staticClasses.inputRoot}`]: {
|
|
124
122
|
marginLeft: 0,
|
|
@@ -129,10 +127,6 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvTagsInput
|
|
|
129
127
|
padding: 0,
|
|
130
128
|
border: "none"
|
|
131
129
|
},
|
|
132
|
-
[`& .${BaseInput_styles.staticClasses.inputBorderContainer}`]: {
|
|
133
|
-
border: "none",
|
|
134
|
-
background: "none"
|
|
135
|
-
},
|
|
136
130
|
[`& .${BaseInput_styles.staticClasses.inputRootFocused}`]: {
|
|
137
131
|
outline: "none",
|
|
138
132
|
boxShadow: "none"
|
|
@@ -155,6 +149,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvTagsInput
|
|
|
155
149
|
outlineOffset: "-1px",
|
|
156
150
|
boxShadow: "0 0 0 1px #52A8EC, 0 0 0 4px rgba(29,155,209,.3)"
|
|
157
151
|
},
|
|
152
|
+
/** @deprecated unused. use `::after` instead */
|
|
158
153
|
tagInputBorderContainer: {},
|
|
159
154
|
tagInputRootFocused: {},
|
|
160
155
|
tagInputRootEmpty: {},
|
|
@@ -8,7 +8,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvTextArea"
|
|
|
8
8
|
invalid: {},
|
|
9
9
|
baseInput: { clear: "both", float: "left" },
|
|
10
10
|
input: {},
|
|
11
|
-
inputResizable: {
|
|
11
|
+
inputResizable: {},
|
|
12
12
|
labelContainer: { float: "left", display: "flex", alignItems: "flex-start" },
|
|
13
13
|
label: {},
|
|
14
14
|
description: { display: "block", float: "left" },
|
|
@@ -4,9 +4,10 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const CounterLabel = ({
|
|
5
5
|
selected,
|
|
6
6
|
total,
|
|
7
|
-
conjunctionLabel = "/"
|
|
7
|
+
conjunctionLabel = "/",
|
|
8
|
+
...others
|
|
8
9
|
}) => {
|
|
9
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
10
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { ...others, children: [
|
|
10
11
|
/* @__PURE__ */ jsxRuntime.jsx("b", { children: selected }),
|
|
11
12
|
" ",
|
|
12
13
|
` ${conjunctionLabel} ${total}`
|
|
@@ -1,36 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useContext } from "react";
|
|
3
|
-
import { css, Global } from "@emotion/react";
|
|
4
3
|
import MuiInputBase from "@mui/material/InputBase";
|
|
5
4
|
import { useForkRef } from "@mui/material/utils";
|
|
6
5
|
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
7
|
-
import { theme } from "@hitachivantara/uikit-styles";
|
|
8
6
|
import { useClasses } from "./BaseInput.styles.js";
|
|
9
7
|
import { staticClasses } from "./BaseInput.styles.js";
|
|
10
8
|
import { HvFormElementContext, HvFormElementDescriptorsContext } from "../FormElement/context.js";
|
|
11
9
|
import { buildFormElementPropsFromContext, buildAriaPropsFromContext } from "../FormElement/utils.js";
|
|
12
|
-
const baseInputStyles = css({
|
|
13
|
-
"input:-webkit-autofill": {
|
|
14
|
-
WebkitBoxShadow: `0 0 0px 1000px ${theme.colors.atmo1} inset`,
|
|
15
|
-
WebkitTextFillColor: theme.colors.secondary
|
|
16
|
-
},
|
|
17
|
-
// Clears number input up/down arrows in Chrome and Firefox
|
|
18
|
-
"input::-webkit-outer-spin-button,input::-webkit-inner-spin-button": {
|
|
19
|
-
WebkitAppearance: "none",
|
|
20
|
-
margin: 0
|
|
21
|
-
},
|
|
22
|
-
"input[type=number]": {
|
|
23
|
-
MozAppearance: "textfield"
|
|
24
|
-
},
|
|
25
|
-
// Clears time input clock in Chrome
|
|
26
|
-
"input::-webkit-calendar-picker-indicator": {
|
|
27
|
-
display: "none"
|
|
28
|
-
},
|
|
29
|
-
// Clears search input clear button in Chrome
|
|
30
|
-
"input::-webkit-search-decoration,input::-webkit-search-cancel-button,input::-webkit-search-results-button,input::-webkit-search-results-decoration": {
|
|
31
|
-
display: "none"
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
10
|
const HvBaseInput = forwardRef(function HvBaseInput2(props, ref) {
|
|
35
11
|
const {
|
|
36
12
|
classes: classesProp,
|
|
@@ -47,7 +23,7 @@ const HvBaseInput = forwardRef(function HvBaseInput2(props, ref) {
|
|
|
47
23
|
placeholder,
|
|
48
24
|
multiline,
|
|
49
25
|
resizable,
|
|
50
|
-
invalid,
|
|
26
|
+
invalid: invalidProp,
|
|
51
27
|
inputRef,
|
|
52
28
|
inputProps = {},
|
|
53
29
|
...others
|
|
@@ -62,72 +38,57 @@ const HvBaseInput = forwardRef(function HvBaseInput2(props, ref) {
|
|
|
62
38
|
formElementContext
|
|
63
39
|
);
|
|
64
40
|
const forkedRef = useForkRef(ref, inputRef);
|
|
65
|
-
const
|
|
41
|
+
const invalid = invalidProp || formElementProps.status === "invalid";
|
|
66
42
|
const formElementDescriptorsContext = useContext(
|
|
67
43
|
HvFormElementDescriptorsContext
|
|
68
44
|
);
|
|
69
45
|
const ariaProps = buildAriaPropsFromContext(
|
|
70
46
|
inputProps,
|
|
71
47
|
formElementDescriptorsContext,
|
|
72
|
-
|
|
48
|
+
invalid,
|
|
73
49
|
id
|
|
74
50
|
);
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
required: formElementProps.required,
|
|
117
|
-
...inputProps,
|
|
118
|
-
...ariaProps
|
|
119
|
-
},
|
|
120
|
-
inputRef: forkedRef,
|
|
121
|
-
multiline,
|
|
122
|
-
rows: 10,
|
|
123
|
-
...others
|
|
124
|
-
}
|
|
125
|
-
),
|
|
126
|
-
!multiline && /* @__PURE__ */ jsx("div", { role: "presentation", className: classes.inputBorderContainer })
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
)
|
|
130
|
-
] });
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
MuiInputBase,
|
|
53
|
+
{
|
|
54
|
+
id,
|
|
55
|
+
name: formElementProps.name,
|
|
56
|
+
value,
|
|
57
|
+
defaultValue,
|
|
58
|
+
placeholder,
|
|
59
|
+
readOnly: !!formElementProps.readOnly,
|
|
60
|
+
disabled: formElementProps.disabled,
|
|
61
|
+
onChange: (event) => onChange?.(event, event.target.value),
|
|
62
|
+
className: cx(classes.root, classes.inputRoot, className, {
|
|
63
|
+
[classes.inputRootMultiline]: multiline,
|
|
64
|
+
[classes.multiline]: multiline,
|
|
65
|
+
[classes.inputRootInvalid]: invalid,
|
|
66
|
+
[classes.invalid]: invalid,
|
|
67
|
+
[classes.inputRootReadOnly]: formElementProps.readOnly,
|
|
68
|
+
[classes.readOnly]: formElementProps.readOnly,
|
|
69
|
+
[classes.inputRootDisabled]: formElementProps.disabled,
|
|
70
|
+
[classes.disabled]: formElementProps.disabled
|
|
71
|
+
}),
|
|
72
|
+
classes: {
|
|
73
|
+
focused: cx(classes.focused, classes.inputRootFocused),
|
|
74
|
+
input: cx(classes.input, {
|
|
75
|
+
[classes.inputResizable]: !formElementProps.disabled && resizable,
|
|
76
|
+
[classes.inputDisabled]: formElementProps.disabled,
|
|
77
|
+
[classes.inputReadOnly]: formElementProps.readOnly
|
|
78
|
+
})
|
|
79
|
+
},
|
|
80
|
+
inputProps: {
|
|
81
|
+
// Avoid the required attribute at the root node
|
|
82
|
+
required: formElementProps.required,
|
|
83
|
+
...inputProps,
|
|
84
|
+
...ariaProps
|
|
85
|
+
},
|
|
86
|
+
inputRef: forkedRef,
|
|
87
|
+
multiline,
|
|
88
|
+
...multiline ? { rows: 10 } : { type },
|
|
89
|
+
...others
|
|
90
|
+
}
|
|
91
|
+
);
|
|
131
92
|
});
|
|
132
93
|
export {
|
|
133
94
|
HvBaseInput,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInput.js","sources":["../../../src/BaseInput/BaseInput.tsx"],"sourcesContent":["import { forwardRef, useContext } from \"react\";\nimport
|
|
1
|
+
{"version":3,"file":"BaseInput.js","sources":["../../../src/BaseInput/BaseInput.tsx"],"sourcesContent":["import { forwardRef, useContext } from \"react\";\nimport MuiInputBase, { type InputBaseProps } from \"@mui/material/InputBase\";\nimport { useForkRef } from \"@mui/material/utils\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport {\n buildAriaPropsFromContext,\n buildFormElementPropsFromContext,\n HvFormElementContext,\n HvFormElementDescriptorsContext,\n} from \"../FormElement\";\nimport { staticClasses, useClasses } from \"./BaseInput.styles\";\n\nexport { staticClasses as baseInputClasses };\n\nexport type HvBaseInputClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvBaseInputProps\n extends Omit<\n InputBaseProps,\n \"onChange\" | \"classes\" | \"ref\" | \"color\" | \"size\"\n > {\n /** The input name. */\n name?: string;\n /** The value of the input, when controlled. */\n value?: React.InputHTMLAttributes<HTMLInputElement>[\"value\"];\n /** The initial value of the input, when uncontrolled. */\n defaultValue?: React.InputHTMLAttributes<HTMLInputElement>[\"value\"];\n /** If `true` the input is disabled. */\n disabled?: boolean;\n /** Indicates that the input is not editable. */\n readOnly?: boolean;\n /** If true, the input element will be required. */\n required?: boolean;\n /** The function that will be executed onChange, allows modification of the input,\n * it receives the value. If a new value should be presented it must returned it. */\n onChange?: (\n event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,\n value: string,\n ) => void;\n /** If true, a textarea element will be rendered. */\n multiline?: boolean;\n /** If true and multiline is also true the textarea element will be resizable. */\n resizable?: boolean;\n /** Denotes if the input is in an invalid state. */\n invalid?: boolean;\n /**\n * Allows passing a ref to the underlying input\n * @deprecated Use `ref` directly instead\n * */\n inputRef?: InputBaseProps[\"inputRef\"];\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvBaseInputClasses;\n}\n\n/**\n * An Input component that only posses the most basic functionalities.\n * It should be used alongside the other form elements to construct a proper accessible form.\n */\nexport const HvBaseInput = forwardRef<\n // no-indent\n React.ElementRef<\"input\">,\n HvBaseInputProps\n>(function HvBaseInput(props, ref) {\n const {\n classes: classesProp,\n className = \"\",\n id,\n name,\n value,\n defaultValue,\n required,\n readOnly,\n disabled,\n onChange,\n type = \"text\",\n placeholder,\n multiline,\n resizable,\n invalid: invalidProp,\n inputRef,\n inputProps = {},\n ...others\n } = useDefaultProps(\"HvBaseInput\", props);\n const { classes, cx } = useClasses(classesProp);\n const formElementContext = useContext(HvFormElementContext);\n const formElementProps = buildFormElementPropsFromContext(\n name,\n disabled,\n readOnly,\n required,\n formElementContext,\n );\n\n const forkedRef = useForkRef(ref, inputRef);\n\n const invalid = invalidProp || formElementProps.status === \"invalid\";\n\n const formElementDescriptorsContext = useContext(\n HvFormElementDescriptorsContext,\n );\n const ariaProps = buildAriaPropsFromContext(\n inputProps,\n formElementDescriptorsContext,\n invalid,\n id,\n );\n\n return (\n <MuiInputBase\n id={id}\n name={formElementProps.name}\n value={value}\n defaultValue={defaultValue}\n placeholder={placeholder}\n readOnly={!!formElementProps.readOnly}\n disabled={formElementProps.disabled}\n onChange={(event) => onChange?.(event, event.target.value)}\n className={cx(classes.root, classes.inputRoot, className, {\n [classes.inputRootMultiline]: multiline,\n [classes.multiline]: multiline,\n [classes.inputRootInvalid]: invalid,\n [classes.invalid]: invalid,\n [classes.inputRootReadOnly]: formElementProps.readOnly,\n [classes.readOnly]: formElementProps.readOnly,\n [classes.inputRootDisabled]: formElementProps.disabled,\n [classes.disabled]: formElementProps.disabled,\n })}\n classes={{\n focused: cx(classes.focused, classes.inputRootFocused),\n input: cx(classes.input, {\n [classes.inputResizable]: !formElementProps.disabled && resizable,\n [classes.inputDisabled]: formElementProps.disabled,\n [classes.inputReadOnly]: formElementProps.readOnly,\n }),\n }}\n inputProps={{\n // Avoid the required attribute at the root node\n required: formElementProps.required,\n ...inputProps,\n ...ariaProps,\n }}\n inputRef={forkedRef}\n multiline={multiline}\n {...(multiline ? { rows: 10 } : { type })}\n {...others}\n />\n );\n});\n"],"names":["HvBaseInput"],"mappings":";;;;;;;;;AA8DO,MAAM,cAAc,WAIzB,SAASA,aAAY,OAAO,KAAK;AAC3B,QAAA;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA,aAAa,CAAC;AAAA,IACd,GAAG;AAAA,EAAA,IACD,gBAAgB,eAAe,KAAK;AACxC,QAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AACxC,QAAA,qBAAqB,WAAW,oBAAoB;AAC1D,QAAM,mBAAmB;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEM,QAAA,YAAY,WAAW,KAAK,QAAQ;AAEpC,QAAA,UAAU,eAAe,iBAAiB,WAAW;AAE3D,QAAM,gCAAgC;AAAA,IACpC;AAAA,EACF;AACA,QAAM,YAAY;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAGE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,MAAM,iBAAiB;AAAA,MACvB;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU,CAAC,CAAC,iBAAiB;AAAA,MAC7B,UAAU,iBAAiB;AAAA,MAC3B,UAAU,CAAC,UAAU,WAAW,OAAO,MAAM,OAAO,KAAK;AAAA,MACzD,WAAW,GAAG,QAAQ,MAAM,QAAQ,WAAW,WAAW;AAAA,QACxD,CAAC,QAAQ,kBAAkB,GAAG;AAAA,QAC9B,CAAC,QAAQ,SAAS,GAAG;AAAA,QACrB,CAAC,QAAQ,gBAAgB,GAAG;AAAA,QAC5B,CAAC,QAAQ,OAAO,GAAG;AAAA,QACnB,CAAC,QAAQ,iBAAiB,GAAG,iBAAiB;AAAA,QAC9C,CAAC,QAAQ,QAAQ,GAAG,iBAAiB;AAAA,QACrC,CAAC,QAAQ,iBAAiB,GAAG,iBAAiB;AAAA,QAC9C,CAAC,QAAQ,QAAQ,GAAG,iBAAiB;AAAA,MAAA,CACtC;AAAA,MACD,SAAS;AAAA,QACP,SAAS,GAAG,QAAQ,SAAS,QAAQ,gBAAgB;AAAA,QACrD,OAAO,GAAG,QAAQ,OAAO;AAAA,UACvB,CAAC,QAAQ,cAAc,GAAG,CAAC,iBAAiB,YAAY;AAAA,UACxD,CAAC,QAAQ,aAAa,GAAG,iBAAiB;AAAA,UAC1C,CAAC,QAAQ,aAAa,GAAG,iBAAiB;AAAA,QAC3C,CAAA;AAAA,MACH;AAAA,MACA,YAAY;AAAA;AAAA,QAEV,UAAU,iBAAiB;AAAA,QAC3B,GAAG;AAAA,QACH,GAAG;AAAA,MACL;AAAA,MACA,UAAU;AAAA,MACV;AAAA,MACC,GAAI,YAAY,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK;AAAA,MACtC,GAAG;AAAA,IAAA;AAAA,EACN;AAEJ,CAAC;"}
|
|
@@ -3,176 +3,99 @@ import { theme } from "@hitachivantara/uikit-styles";
|
|
|
3
3
|
import { outlineStyles } from "../utils/focusUtils.js";
|
|
4
4
|
const { staticClasses, useClasses } = createClasses("HvBaseInput", {
|
|
5
5
|
root: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"& $inputRoot": {
|
|
18
|
-
backgroundColor: theme.colors.atmo2,
|
|
19
|
-
borderColor: theme.colors.secondary_60
|
|
20
|
-
},
|
|
21
|
-
"& $inputBorderContainer": {
|
|
22
|
-
backgroundColor: theme.colors.atmo4
|
|
23
|
-
},
|
|
24
|
-
"&:hover $inputBorderContainer": {
|
|
25
|
-
backgroundColor: theme.colors.atmo4
|
|
26
|
-
},
|
|
27
|
-
"&& $input": {
|
|
28
|
-
color: theme.colors.secondary_60,
|
|
29
|
-
WebkitTextFillColor: theme.colors.secondary_60
|
|
30
|
-
},
|
|
31
|
-
"& $inputRootMultiline": {
|
|
32
|
-
"& $input": {
|
|
33
|
-
backgroundColor: theme.colors.atmo2,
|
|
34
|
-
border: `1px solid ${theme.colors.secondary_60}`
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"&:hover $inputRootMultiline": {
|
|
38
|
-
"& $input": {
|
|
39
|
-
backgroundColor: theme.colors.atmo2,
|
|
40
|
-
border: `1px solid ${theme.colors.secondary_60}`
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
invalid: {
|
|
45
|
-
"&:not(.disabled)": {
|
|
46
|
-
"& $inputBorderContainer": {
|
|
47
|
-
backgroundColor: theme.colors.negative_120
|
|
48
|
-
},
|
|
49
|
-
"&:hover $inputBorderContainer": {
|
|
50
|
-
backgroundColor: theme.colors.negative_120
|
|
51
|
-
},
|
|
52
|
-
"& $inputRootMultiline": {
|
|
53
|
-
"& $input": {
|
|
54
|
-
border: `1px solid ${theme.colors.negative_120}`
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
"&:hover $inputRootMultiline": {
|
|
58
|
-
"& $input": {
|
|
59
|
-
border: `1px solid ${theme.colors.negative_120}`
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"&:focus-within $inputRootMultiline": {
|
|
63
|
-
"& $input": {
|
|
64
|
-
border: `1px solid ${theme.colors.negative_120}`
|
|
65
|
-
}
|
|
6
|
+
// #region `input` style reset
|
|
7
|
+
"input:-webkit-autofill": {
|
|
8
|
+
WebkitBoxShadow: `0 0 0px 1000px ${theme.colors.atmo1} inset`,
|
|
9
|
+
WebkitTextFillColor: theme.colors.secondary
|
|
10
|
+
},
|
|
11
|
+
// Clears number input up/down arrows in Chrome and Firefox
|
|
12
|
+
"input[type=number]": {
|
|
13
|
+
MozAppearance: "textfield",
|
|
14
|
+
"&::-webkit-outer-spin-button,&::-webkit-inner-spin-button": {
|
|
15
|
+
WebkitAppearance: "none",
|
|
16
|
+
margin: 0
|
|
66
17
|
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
resizable: { width: "auto" },
|
|
70
|
-
readOnly: {
|
|
71
|
-
"& $inputBorderContainer": {
|
|
72
|
-
backgroundColor: "transparent"
|
|
73
18
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"&:focus-within $inputBorderContainer": {
|
|
78
|
-
backgroundColor: "transparent"
|
|
79
|
-
},
|
|
80
|
-
"& $inputRootMultiline": {
|
|
81
|
-
"& $input": {
|
|
82
|
-
border: `1px solid ${theme.colors.secondary_60}`,
|
|
83
|
-
backgroundColor: theme.colors.atmo2
|
|
84
|
-
}
|
|
19
|
+
// Clears time input clock in Chrome
|
|
20
|
+
"input::-webkit-calendar-picker-indicator": {
|
|
21
|
+
display: "none"
|
|
85
22
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
backgroundColor: theme.colors.atmo2
|
|
90
|
-
}
|
|
23
|
+
// Clears search input clear button in Chrome
|
|
24
|
+
"input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration": {
|
|
25
|
+
display: "none"
|
|
91
26
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
border: `1px solid ${theme.colors.secondary_60}`,
|
|
95
|
-
backgroundColor: theme.colors.atmo2
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
inputBorderContainer: {
|
|
100
|
-
position: "absolute",
|
|
101
|
-
width: "calc(100% - 4px)",
|
|
102
|
-
height: "0px",
|
|
103
|
-
top: "31px",
|
|
104
|
-
left: "2px",
|
|
105
|
-
backgroundColor: theme.colors.atmo4
|
|
106
|
-
},
|
|
107
|
-
inputRootInvalid: { borderColor: theme.colors.negative_120 },
|
|
108
|
-
inputRootReadOnly: {
|
|
109
|
-
borderColor: theme.colors.secondary_60,
|
|
110
|
-
backgroundColor: theme.colors.atmo2
|
|
111
|
-
},
|
|
112
|
-
inputRoot: {
|
|
113
|
-
margin: 0,
|
|
27
|
+
// #endregion
|
|
28
|
+
display: "inline-flex",
|
|
114
29
|
width: "100%",
|
|
30
|
+
position: "relative",
|
|
31
|
+
margin: 0,
|
|
115
32
|
borderRadius: theme.radii.base,
|
|
116
33
|
height: "32px",
|
|
117
|
-
|
|
34
|
+
borderWidth: 1,
|
|
35
|
+
borderColor: theme.colors.secondary,
|
|
118
36
|
boxSizing: "border-box",
|
|
119
37
|
backgroundColor: theme.colors.atmo1,
|
|
120
38
|
fontFamily: theme.fontFamily.body,
|
|
121
|
-
"
|
|
39
|
+
":hover:not($disabled,$invalid,$readOnly)": {
|
|
122
40
|
borderColor: theme.colors.primary
|
|
123
41
|
},
|
|
124
|
-
"
|
|
125
|
-
|
|
126
|
-
},
|
|
127
|
-
"&::before": {
|
|
128
|
-
borderBottom: "none"
|
|
129
|
-
},
|
|
130
|
-
"&::after": {
|
|
131
|
-
borderBottom: "none"
|
|
42
|
+
":focus-within:not($disabled)": {
|
|
43
|
+
...outlineStyles
|
|
132
44
|
}
|
|
133
45
|
},
|
|
134
|
-
|
|
135
|
-
backgroundColor: theme.colors.
|
|
136
|
-
|
|
137
|
-
"&:hover": {
|
|
138
|
-
backgroundColor: theme.colors.atmo1
|
|
139
|
-
},
|
|
140
|
-
"&$inputRootReadOnly": {
|
|
141
|
-
backgroundColor: theme.colors.atmo2
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
inputRootDisabled: {
|
|
46
|
+
disabled: {
|
|
47
|
+
backgroundColor: theme.colors.atmo2,
|
|
48
|
+
borderColor: theme.colors.secondary_60,
|
|
145
49
|
cursor: "not-allowed",
|
|
146
50
|
"&&::before": {
|
|
147
51
|
borderBottomStyle: "none"
|
|
148
52
|
}
|
|
149
53
|
},
|
|
150
|
-
|
|
54
|
+
invalid: {
|
|
55
|
+
borderColor: theme.colors.negative_120
|
|
56
|
+
},
|
|
57
|
+
multiline: {
|
|
151
58
|
padding: 0,
|
|
152
|
-
backgroundColor: "transparent",
|
|
153
59
|
overflow: "auto",
|
|
154
|
-
border: "none",
|
|
155
60
|
height: "auto",
|
|
156
61
|
"& $input": {
|
|
157
|
-
border: `1px solid ${theme.colors.secondary}`,
|
|
158
62
|
borderRadius: theme.radii.base,
|
|
159
|
-
backgroundColor: theme.colors.atmo1,
|
|
160
63
|
height: "auto",
|
|
161
64
|
minHeight: "21px",
|
|
162
65
|
padding: "5px 10px",
|
|
163
66
|
overflow: "auto",
|
|
164
|
-
|
|
165
|
-
marginRight: "0px",
|
|
166
|
-
"&:hover": {
|
|
167
|
-
border: `1px solid ${theme.colors.primary}`
|
|
168
|
-
}
|
|
67
|
+
margin: 0
|
|
169
68
|
}
|
|
170
69
|
},
|
|
70
|
+
resizable: { width: "auto" },
|
|
71
|
+
readOnly: {
|
|
72
|
+
borderColor: theme.colors.secondary_60,
|
|
73
|
+
backgroundColor: theme.colors.atmo2
|
|
74
|
+
},
|
|
75
|
+
focused: {},
|
|
76
|
+
/** @deprecated unused. use `::after` instead */
|
|
77
|
+
inputBorderContainer: {},
|
|
78
|
+
/** @deprecated use `classes.invalid` instead */
|
|
79
|
+
inputRootInvalid: { borderColor: theme.colors.negative_120 },
|
|
80
|
+
/** @deprecated use `classes.readOnly` instead */
|
|
81
|
+
inputRootReadOnly: {
|
|
82
|
+
borderColor: theme.colors.secondary_60,
|
|
83
|
+
backgroundColor: theme.colors.atmo2
|
|
84
|
+
},
|
|
85
|
+
/** @deprecated use `classes.root` instead */
|
|
86
|
+
inputRoot: {},
|
|
87
|
+
/** @deprecated unused */
|
|
88
|
+
inputRootFocused: {},
|
|
89
|
+
/** @deprecated use `classes.disabled` instead */
|
|
90
|
+
inputRootDisabled: {},
|
|
91
|
+
/** @deprecated use `classes.multiline` instead */
|
|
92
|
+
inputRootMultiline: {},
|
|
171
93
|
input: {
|
|
172
|
-
height: "
|
|
94
|
+
height: "100%",
|
|
173
95
|
marginLeft: theme.space.xs,
|
|
174
96
|
marginRight: theme.space.xs,
|
|
175
|
-
padding: "
|
|
97
|
+
padding: theme.spacing("5px", 0),
|
|
98
|
+
backgroundColor: "transparent",
|
|
176
99
|
overflow: "hidden",
|
|
177
100
|
textOverflow: "ellipsis",
|
|
178
101
|
outline: "none",
|
|
@@ -182,16 +105,19 @@ const { staticClasses, useClasses } = createClasses("HvBaseInput", {
|
|
|
182
105
|
"&::placeholder": {
|
|
183
106
|
opacity: 1,
|
|
184
107
|
color: theme.colors.secondary_80
|
|
185
|
-
},
|
|
186
|
-
"&::-ms-clear": {
|
|
187
|
-
display: "none"
|
|
188
108
|
}
|
|
189
109
|
},
|
|
190
|
-
inputDisabled: {
|
|
110
|
+
inputDisabled: {
|
|
111
|
+
color: theme.colors.secondary_60,
|
|
112
|
+
WebkitTextFillColor: theme.colors.secondary_60
|
|
113
|
+
},
|
|
191
114
|
inputReadOnly: {
|
|
192
115
|
color: theme.colors.secondary_80
|
|
193
116
|
},
|
|
194
|
-
inputResizable: {
|
|
117
|
+
inputResizable: {
|
|
118
|
+
resize: "both",
|
|
119
|
+
width: "100%"
|
|
120
|
+
}
|
|
195
121
|
});
|
|
196
122
|
export {
|
|
197
123
|
staticClasses,
|