@hitachivantara/uikit-react-core 5.81.2 → 5.82.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/Accordion/Accordion.cjs +1 -7
- package/dist/cjs/BaseInput/BaseInput.styles.cjs +6 -6
- package/dist/cjs/Button/Button.cjs +1 -1
- package/dist/cjs/CheckBox/CheckBox.styles.cjs +2 -2
- package/dist/cjs/CheckBoxGroup/CheckBoxGroup.styles.cjs +1 -1
- package/dist/cjs/DatePicker/DatePicker.styles.cjs +2 -2
- package/dist/cjs/Dropdown/Dropdown.styles.cjs +1 -1
- package/dist/cjs/DropdownButton/DropdownButton.cjs +1 -1
- package/dist/cjs/Forms/WarningText/WarningText.cjs +13 -16
- package/dist/cjs/Forms/WarningText/WarningText.styles.cjs +7 -3
- package/dist/cjs/MultiButton/MultiButton.styles.cjs +1 -2
- package/dist/cjs/Radio/Radio.styles.cjs +2 -2
- package/dist/cjs/RadioGroup/RadioGroup.styles.cjs +1 -1
- package/dist/cjs/Section/Section.cjs +1 -1
- package/dist/cjs/Select/Select.styles.cjs +1 -1
- package/dist/cjs/SelectionList/SelectionList.styles.cjs +1 -1
- package/dist/cjs/Switch/Switch.styles.cjs +1 -1
- package/dist/cjs/Table/hooks/useRowExpand.cjs +1 -1
- package/dist/cjs/TagsInput/TagsInput.styles.cjs +2 -2
- package/dist/cjs/TimePicker/TimePicker.styles.cjs +2 -2
- package/dist/cjs/TimePicker/Unit/Unit.cjs +6 -7
- package/dist/cjs/ToggleButton/ToggleButton.cjs +5 -6
- package/dist/cjs/VerticalNavigation/TreeView/TreeViewItem.cjs +1 -7
- package/dist/esm/Accordion/Accordion.js +1 -7
- package/dist/esm/Accordion/Accordion.js.map +1 -1
- package/dist/esm/BaseInput/BaseInput.styles.js +6 -6
- package/dist/esm/BaseInput/BaseInput.styles.js.map +1 -1
- package/dist/esm/Button/Button.js +1 -1
- package/dist/esm/Button/Button.js.map +1 -1
- package/dist/esm/CheckBox/CheckBox.styles.js +2 -2
- package/dist/esm/CheckBox/CheckBox.styles.js.map +1 -1
- package/dist/esm/CheckBoxGroup/CheckBoxGroup.styles.js +1 -1
- package/dist/esm/CheckBoxGroup/CheckBoxGroup.styles.js.map +1 -1
- package/dist/esm/DatePicker/DatePicker.styles.js +2 -2
- package/dist/esm/DatePicker/DatePicker.styles.js.map +1 -1
- package/dist/esm/Dropdown/Dropdown.styles.js +1 -1
- package/dist/esm/Dropdown/Dropdown.styles.js.map +1 -1
- package/dist/esm/DropdownButton/DropdownButton.js +1 -1
- package/dist/esm/DropdownButton/DropdownButton.js.map +1 -1
- package/dist/esm/Forms/WarningText/WarningText.js +13 -16
- package/dist/esm/Forms/WarningText/WarningText.js.map +1 -1
- package/dist/esm/Forms/WarningText/WarningText.styles.js +7 -3
- package/dist/esm/Forms/WarningText/WarningText.styles.js.map +1 -1
- package/dist/esm/MultiButton/MultiButton.styles.js +1 -2
- package/dist/esm/MultiButton/MultiButton.styles.js.map +1 -1
- package/dist/esm/Radio/Radio.styles.js +2 -2
- package/dist/esm/Radio/Radio.styles.js.map +1 -1
- package/dist/esm/RadioGroup/RadioGroup.styles.js +1 -1
- package/dist/esm/RadioGroup/RadioGroup.styles.js.map +1 -1
- package/dist/esm/Section/Section.js +1 -1
- package/dist/esm/Section/Section.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.styles.js +1 -1
- package/dist/esm/SelectionList/SelectionList.styles.js.map +1 -1
- package/dist/esm/Switch/Switch.styles.js +1 -1
- package/dist/esm/Switch/Switch.styles.js.map +1 -1
- package/dist/esm/Table/hooks/useRowExpand.js +1 -1
- package/dist/esm/Table/hooks/useRowExpand.js.map +1 -1
- package/dist/esm/TagsInput/TagsInput.styles.js +2 -2
- package/dist/esm/TagsInput/TagsInput.styles.js.map +1 -1
- package/dist/esm/TimePicker/TimePicker.styles.js +2 -2
- package/dist/esm/TimePicker/TimePicker.styles.js.map +1 -1
- package/dist/esm/TimePicker/Unit/Unit.js +6 -7
- package/dist/esm/TimePicker/Unit/Unit.js.map +1 -1
- package/dist/esm/ToggleButton/ToggleButton.js +5 -6
- package/dist/esm/ToggleButton/ToggleButton.js.map +1 -1
- package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.js +1 -7
- package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.js.map +1 -1
- package/package.json +6 -6
|
@@ -56,13 +56,7 @@ const HvAccordion = React.forwardRef(function HvAccordion2(props, ref) {
|
|
|
56
56
|
onClick: handleClick,
|
|
57
57
|
variant: labelVariant,
|
|
58
58
|
children: [
|
|
59
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
60
|
-
uikitReactIcons.DropUpXS,
|
|
61
|
-
{
|
|
62
|
-
color: "inherit",
|
|
63
|
-
style: { rotate: isOpen ? void 0 : "180deg" }
|
|
64
|
-
}
|
|
65
|
-
),
|
|
59
|
+
/* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.DropUpXS, { color: "inherit", rotate: !isOpen }),
|
|
66
60
|
label
|
|
67
61
|
]
|
|
68
62
|
}
|
|
@@ -46,24 +46,24 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvBaseInput
|
|
|
46
46
|
invalid: {
|
|
47
47
|
"&:not(.disabled)": {
|
|
48
48
|
"& $inputBorderContainer": {
|
|
49
|
-
backgroundColor: uikitStyles.theme.colors.
|
|
49
|
+
backgroundColor: uikitStyles.theme.colors.negative_120
|
|
50
50
|
},
|
|
51
51
|
"&:hover $inputBorderContainer": {
|
|
52
|
-
backgroundColor: uikitStyles.theme.colors.
|
|
52
|
+
backgroundColor: uikitStyles.theme.colors.negative_120
|
|
53
53
|
},
|
|
54
54
|
"& $inputRootMultiline": {
|
|
55
55
|
"& $input": {
|
|
56
|
-
border: `1px solid ${uikitStyles.theme.colors.
|
|
56
|
+
border: `1px solid ${uikitStyles.theme.colors.negative_120}`
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"&:hover $inputRootMultiline": {
|
|
60
60
|
"& $input": {
|
|
61
|
-
border: `1px solid ${uikitStyles.theme.colors.
|
|
61
|
+
border: `1px solid ${uikitStyles.theme.colors.negative_120}`
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"&:focus-within $inputRootMultiline": {
|
|
65
65
|
"& $input": {
|
|
66
|
-
border: `1px solid ${uikitStyles.theme.colors.
|
|
66
|
+
border: `1px solid ${uikitStyles.theme.colors.negative_120}`
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -106,7 +106,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvBaseInput
|
|
|
106
106
|
left: "2px",
|
|
107
107
|
backgroundColor: uikitStyles.theme.colors.atmo4
|
|
108
108
|
},
|
|
109
|
-
inputRootInvalid: { borderColor: uikitStyles.theme.colors.
|
|
109
|
+
inputRootInvalid: { borderColor: uikitStyles.theme.colors.negative_120 },
|
|
110
110
|
inputRootReadOnly: {
|
|
111
111
|
borderColor: uikitStyles.theme.colors.secondary_60,
|
|
112
112
|
backgroundColor: uikitStyles.theme.colors.atmo2
|
|
@@ -85,7 +85,7 @@ const HvButton = generic.fixedForwardRef(function HvButton2(props, ref) {
|
|
|
85
85
|
tabIndex: focusableWhenDisabled ? 0 : -1,
|
|
86
86
|
"aria-disabled": true
|
|
87
87
|
},
|
|
88
|
-
...selected && { "aria-pressed": selected },
|
|
88
|
+
...selected != null && { "aria-pressed": selected },
|
|
89
89
|
...others,
|
|
90
90
|
children: [
|
|
91
91
|
startIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: classes.startIcon, children: startIcon }),
|
|
@@ -30,7 +30,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvCheckBox"
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
invalidContainer: {
|
|
33
|
-
borderBottom: `1px solid ${uikitStyles.theme.colors.
|
|
33
|
+
borderBottom: `1px solid ${uikitStyles.theme.colors.negative_120}`,
|
|
34
34
|
"&:hover": {
|
|
35
35
|
borderBottomLeftRadius: "0px",
|
|
36
36
|
borderBottomRightRadius: "0px"
|
|
@@ -38,7 +38,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvCheckBox"
|
|
|
38
38
|
},
|
|
39
39
|
checkbox: { height: "32px" },
|
|
40
40
|
invalidCheckbox: {
|
|
41
|
-
borderBottom: `1px solid ${uikitStyles.theme.colors.
|
|
41
|
+
borderBottom: `1px solid ${uikitStyles.theme.colors.negative_120}`,
|
|
42
42
|
borderBottomLeftRadius: "0px",
|
|
43
43
|
borderBottomRightRadius: "0px"
|
|
44
44
|
},
|
|
@@ -28,7 +28,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvCheckBoxG
|
|
|
28
28
|
},
|
|
29
29
|
invalid: {
|
|
30
30
|
paddingBottom: uikitStyles.theme.space.xs,
|
|
31
|
-
borderBottom: `1px solid ${uikitStyles.theme.colors.
|
|
31
|
+
borderBottom: `1px solid ${uikitStyles.theme.colors.negative_120}`
|
|
32
32
|
},
|
|
33
33
|
selectAll: {},
|
|
34
34
|
error: {}
|
|
@@ -26,9 +26,9 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvDatePicke
|
|
|
26
26
|
},
|
|
27
27
|
panel: {},
|
|
28
28
|
dropdownHeaderInvalid: {
|
|
29
|
-
border: `1px solid ${uikitStyles.theme.colors.
|
|
29
|
+
border: `1px solid ${uikitStyles.theme.colors.negative_120}`,
|
|
30
30
|
"&:hover": {
|
|
31
|
-
border: `1px solid ${uikitStyles.theme.colors.
|
|
31
|
+
border: `1px solid ${uikitStyles.theme.colors.negative_120}`
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
dropdownHeaderOpen: {},
|
|
@@ -28,7 +28,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvDropdown"
|
|
|
28
28
|
width: "100%",
|
|
29
29
|
borderRadius: uikitStyles.theme.radii.base,
|
|
30
30
|
"& $dropdownHeaderInvalid": {
|
|
31
|
-
border: `1px solid ${uikitStyles.theme.colors.
|
|
31
|
+
border: `1px solid ${uikitStyles.theme.colors.negative_120}`
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
arrow: {},
|
|
@@ -20,7 +20,7 @@ const HvDropdownButton = React.forwardRef(function HvDropdownButton2(props, ref)
|
|
|
20
20
|
...others
|
|
21
21
|
} = uikitReactUtils.useDefaultProps("HvDropdownButton", props);
|
|
22
22
|
const { classes, cx } = DropdownButton_styles.useClasses(classesProp);
|
|
23
|
-
const endIcon = icon ? void 0 : /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.DropDownXS, {
|
|
23
|
+
const endIcon = icon ? void 0 : /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.DropDownXS, { size: "XS", rotate: open });
|
|
24
24
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
25
25
|
Button.HvButton,
|
|
26
26
|
{
|
|
@@ -7,16 +7,15 @@ const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
|
7
7
|
const setId = require("../../utils/setId.cjs");
|
|
8
8
|
const WarningText_styles = require("./WarningText.styles.cjs");
|
|
9
9
|
const FormElementContext = require("../FormElement/context/FormElementContext.cjs");
|
|
10
|
-
const Typography = require("../../Typography/Typography.cjs");
|
|
11
10
|
const HvWarningText = (props) => {
|
|
12
11
|
const {
|
|
13
12
|
children,
|
|
14
|
-
adornment,
|
|
15
|
-
isVisible,
|
|
13
|
+
adornment: adornmentProp,
|
|
14
|
+
isVisible: isVisibleProp,
|
|
16
15
|
classes: classesProp,
|
|
17
16
|
className,
|
|
18
|
-
id,
|
|
19
|
-
disabled,
|
|
17
|
+
id: idProp,
|
|
18
|
+
disabled: disabledProp,
|
|
20
19
|
disableGutter = false,
|
|
21
20
|
disableBorder = false,
|
|
22
21
|
disableAdornment = false,
|
|
@@ -25,12 +24,11 @@ const HvWarningText = (props) => {
|
|
|
25
24
|
} = uikitReactUtils.useDefaultProps("HvWarningText", props);
|
|
26
25
|
const { classes, cx } = WarningText_styles.useClasses(classesProp);
|
|
27
26
|
const { elementId, elementStatus, elementDisabled } = React.useContext(FormElementContext.HvFormElementContext);
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const showWarning =
|
|
32
|
-
const
|
|
33
|
-
const localAdornment = adornment || /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Fail, { iconSize: "XS", className: classes.defaultIcon, color: "negative" });
|
|
27
|
+
const disabled = disabledProp || elementDisabled;
|
|
28
|
+
const visible = isVisibleProp ?? elementStatus === "invalid";
|
|
29
|
+
const id = idProp ?? setId.setId(elementId, "error");
|
|
30
|
+
const showWarning = visible && !disabled;
|
|
31
|
+
const adornment = adornmentProp || /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Fail, { size: "xs", className: classes.defaultIcon });
|
|
34
32
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
35
33
|
"div",
|
|
36
34
|
{
|
|
@@ -43,21 +41,20 @@ const HvWarningText = (props) => {
|
|
|
43
41
|
className
|
|
44
42
|
),
|
|
45
43
|
children: [
|
|
46
|
-
!disableAdornment &&
|
|
44
|
+
!disableAdornment && adornment,
|
|
47
45
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
48
|
-
|
|
46
|
+
"span",
|
|
49
47
|
{
|
|
50
|
-
id
|
|
48
|
+
id,
|
|
51
49
|
className: cx(classes.warningText, {
|
|
52
50
|
[classes.topGutter]: !disableGutter,
|
|
53
51
|
[classes.hideText]: hideText
|
|
54
52
|
}),
|
|
55
|
-
variant: "caption1",
|
|
56
53
|
role: "status",
|
|
57
54
|
"aria-live": "polite",
|
|
58
55
|
"aria-relevant": "additions text",
|
|
59
56
|
...others,
|
|
60
|
-
children: showWarning &&
|
|
57
|
+
children: showWarning && children
|
|
61
58
|
}
|
|
62
59
|
)
|
|
63
60
|
]
|
|
@@ -3,10 +3,14 @@ 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 { staticClasses, useClasses } = uikitReactUtils.createClasses("HvWarningText", {
|
|
6
|
-
root: {
|
|
6
|
+
root: {
|
|
7
|
+
display: "none",
|
|
8
|
+
color: uikitStyles.theme.colors.negative_120
|
|
9
|
+
},
|
|
7
10
|
defaultIcon: { minWidth: "24px", width: "24px", height: "24px" },
|
|
8
11
|
warningText: {
|
|
9
|
-
|
|
12
|
+
...uikitStyles.theme.typography.caption1,
|
|
13
|
+
color: "inherit",
|
|
10
14
|
paddingRight: uikitStyles.theme.space.xs
|
|
11
15
|
},
|
|
12
16
|
show: { display: "flex" },
|
|
@@ -20,7 +24,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvWarningTe
|
|
|
20
24
|
margin: 0,
|
|
21
25
|
overflow: "hidden"
|
|
22
26
|
},
|
|
23
|
-
topBorder: { borderTop:
|
|
27
|
+
topBorder: { borderTop: "1px solid currentcolor" }
|
|
24
28
|
});
|
|
25
29
|
exports.staticClasses = staticClasses;
|
|
26
30
|
exports.useClasses = useClasses;
|
|
@@ -17,11 +17,10 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvMultiButt
|
|
|
17
17
|
borderRadius: uikitStyles.theme.radii.base,
|
|
18
18
|
"& $button": {
|
|
19
19
|
minWidth: 32,
|
|
20
|
-
minHeight: 32,
|
|
21
20
|
width: "100%",
|
|
22
21
|
maxWidth: 200,
|
|
23
22
|
padding: 0,
|
|
24
|
-
flex: 1,
|
|
23
|
+
flex: "1 1 auto",
|
|
25
24
|
borderColor: "inherit",
|
|
26
25
|
borderRadius: 0,
|
|
27
26
|
fontWeight: uikitStyles.theme.typography.body.fontWeight,
|
|
@@ -19,7 +19,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvRadio", {
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
invalidContainer: {
|
|
22
|
-
borderBottom: `1px solid ${uikitStyles.theme.colors.
|
|
22
|
+
borderBottom: `1px solid ${uikitStyles.theme.colors.negative_120}`,
|
|
23
23
|
"&:hover": {
|
|
24
24
|
borderBottomLeftRadius: "0px",
|
|
25
25
|
borderBottomRightRadius: "0px"
|
|
@@ -37,7 +37,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvRadio", {
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
invalidRadio: {
|
|
40
|
-
borderBottom: `1px solid ${uikitStyles.theme.colors.
|
|
40
|
+
borderBottom: `1px solid ${uikitStyles.theme.colors.negative_120}`,
|
|
41
41
|
"&:hover": {
|
|
42
42
|
borderBottomLeftRadius: "0px",
|
|
43
43
|
borderBottomRightRadius: "0px"
|
|
@@ -28,7 +28,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvRadioGrou
|
|
|
28
28
|
},
|
|
29
29
|
invalid: {
|
|
30
30
|
paddingBottom: uikitStyles.theme.space.xs,
|
|
31
|
-
borderBottom: `1px solid ${uikitStyles.theme.colors.
|
|
31
|
+
borderBottom: `1px solid ${uikitStyles.theme.colors.negative_120}`
|
|
32
32
|
},
|
|
33
33
|
error: {}
|
|
34
34
|
});
|
|
@@ -54,7 +54,7 @@ const HvSection = React.forwardRef(
|
|
|
54
54
|
"aria-label": isOpen ? "Collapse" : "Expand",
|
|
55
55
|
...buttonProps,
|
|
56
56
|
...expandButtonProps,
|
|
57
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Down, {
|
|
57
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.Down, { rotate: isOpen })
|
|
58
58
|
}
|
|
59
59
|
),
|
|
60
60
|
title,
|
|
@@ -12,7 +12,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvSelect",
|
|
|
12
12
|
disabled: {},
|
|
13
13
|
readOnly: {},
|
|
14
14
|
invalid: {
|
|
15
|
-
border: `1px solid ${uikitStyles.theme.colors.
|
|
15
|
+
border: `1px solid ${uikitStyles.theme.colors.negative_120}`
|
|
16
16
|
},
|
|
17
17
|
labelContainer: {
|
|
18
18
|
display: "flex",
|
|
@@ -32,7 +32,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvSelection
|
|
|
32
32
|
zIndex: 1
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
invalid: { borderBottom: `1px solid ${uikitStyles.theme.colors.
|
|
35
|
+
invalid: { borderBottom: `1px solid ${uikitStyles.theme.colors.negative_120}` }
|
|
36
36
|
});
|
|
37
37
|
exports.staticClasses = staticClasses;
|
|
38
38
|
exports.useClasses = useClasses;
|
|
@@ -19,7 +19,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvSwitch",
|
|
|
19
19
|
},
|
|
20
20
|
invalidSwitch: {
|
|
21
21
|
paddingBottom: "1px",
|
|
22
|
-
borderBottom: `1px solid ${uikitStyles.theme.colors.
|
|
22
|
+
borderBottom: `1px solid ${uikitStyles.theme.colors.negative_120}`
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
exports.staticClasses = staticClasses;
|
|
@@ -24,7 +24,7 @@ const CellWithExpandButton = ({
|
|
|
24
24
|
"aria-label": row.isExpanded ? labels.collapseRowButtonAriaLabel : labels.expandRowButtonAriaLabel,
|
|
25
25
|
"aria-expanded": row.isExpanded,
|
|
26
26
|
onClick: rowProps?.onClick,
|
|
27
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.DropDownXS, {
|
|
27
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.DropDownXS, { rotate: row.isExpanded })
|
|
28
28
|
}
|
|
29
29
|
),
|
|
30
30
|
cell?.value && /* @__PURE__ */ jsxRuntime.jsx(Typography.HvTypography, { variant: "label", component: "span", children: cell.value })
|
|
@@ -96,10 +96,10 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvTagsInput
|
|
|
96
96
|
paddingTop: 0
|
|
97
97
|
},
|
|
98
98
|
"&$error": {
|
|
99
|
-
border: `1px solid ${uikitStyles.theme.colors.
|
|
99
|
+
border: `1px solid ${uikitStyles.theme.colors.negative_120}`
|
|
100
100
|
},
|
|
101
101
|
"&$invalid": {
|
|
102
|
-
border: `1px solid ${uikitStyles.theme.colors.
|
|
102
|
+
border: `1px solid ${uikitStyles.theme.colors.negative_120}`
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
105
|
tagInputContainerRoot: {
|
|
@@ -25,9 +25,9 @@ const { useClasses, staticClasses } = uikitReactUtils.createClasses("HvTimePicke
|
|
|
25
25
|
dropdownHeader: {},
|
|
26
26
|
dropdownHeaderOpen: {},
|
|
27
27
|
dropdownHeaderInvalid: {
|
|
28
|
-
border: `1px solid ${uikitStyles.theme.colors.
|
|
28
|
+
border: `1px solid ${uikitStyles.theme.colors.negative_120}`,
|
|
29
29
|
"&:hover": {
|
|
30
|
-
border: `1px solid ${uikitStyles.theme.colors.
|
|
30
|
+
border: `1px solid ${uikitStyles.theme.colors.negative_120}`
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
dropdownPanel: {},
|
|
@@ -4,8 +4,8 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
5
5
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
6
6
|
const Unit_styles = require("./Unit.styles.cjs");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const Button = require("../../Button/Button.cjs");
|
|
8
|
+
const BaseInput = require("../../BaseInput/BaseInput.cjs");
|
|
9
9
|
const Unit = ({
|
|
10
10
|
id,
|
|
11
11
|
state,
|
|
@@ -21,12 +21,11 @@ const Unit = ({
|
|
|
21
21
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes.root, children: [
|
|
22
22
|
type !== "literal" && /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.DropUpXS, { onClick: onAdd }),
|
|
23
23
|
type === "literal" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: classes.separator, children: text }),
|
|
24
|
-
type === "dayPeriod" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
24
|
+
type === "dayPeriod" && /* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, { icon: true, className: classes.periodToggle, onClick: onAdd, children: text }),
|
|
25
25
|
["hour", "minute", "second"].includes(type) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
-
|
|
26
|
+
BaseInput.HvBaseInput,
|
|
27
27
|
{
|
|
28
28
|
id,
|
|
29
|
-
disableClear: true,
|
|
30
29
|
style: {
|
|
31
30
|
...uikitStyles.theme.typography.title3
|
|
32
31
|
},
|
|
@@ -37,13 +36,13 @@ const Unit = ({
|
|
|
37
36
|
inputRoot: classes.inputRoot
|
|
38
37
|
},
|
|
39
38
|
onKeyDown: (event) => {
|
|
40
|
-
if (event.key === "Enter") {
|
|
39
|
+
if ("key" in event && event.key === "Enter") {
|
|
41
40
|
event.preventDefault();
|
|
42
41
|
event.stopPropagation();
|
|
43
42
|
}
|
|
44
43
|
},
|
|
45
44
|
required: true,
|
|
46
|
-
|
|
45
|
+
invalid: state.isInvalid,
|
|
47
46
|
value: text.padStart(2, "0"),
|
|
48
47
|
onChange,
|
|
49
48
|
placeholder,
|
|
@@ -19,17 +19,16 @@ const HvToggleButton = React.forwardRef(function HvToggleButton2(props, ref) {
|
|
|
19
19
|
selected,
|
|
20
20
|
Boolean(defaultSelected)
|
|
21
21
|
);
|
|
22
|
-
const onClickHandler = (event) => {
|
|
23
|
-
setIsSelected(!isSelected);
|
|
24
|
-
onClick?.(event, !isSelected);
|
|
25
|
-
};
|
|
26
22
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
27
23
|
Button.HvButton,
|
|
28
24
|
{
|
|
29
25
|
ref,
|
|
30
26
|
icon: true,
|
|
31
|
-
|
|
32
|
-
onClick:
|
|
27
|
+
selected: isSelected,
|
|
28
|
+
onClick: (event) => {
|
|
29
|
+
setIsSelected(!isSelected);
|
|
30
|
+
onClick?.(event, !isSelected);
|
|
31
|
+
},
|
|
33
32
|
...others,
|
|
34
33
|
children: children || (!isSelected ? notSelectedIcon : selectedIcon)
|
|
35
34
|
}
|
|
@@ -328,13 +328,7 @@ const HvVerticalNavigationTreeViewItem = React.forwardRef(
|
|
|
328
328
|
children: /* @__PURE__ */ jsxRuntime.jsx(OverflowTooltip.HvOverflowTooltip, { data: label })
|
|
329
329
|
}
|
|
330
330
|
),
|
|
331
|
-
isOpen && expandable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
332
|
-
uikitReactIcons.DropDownXS,
|
|
333
|
-
{
|
|
334
|
-
color: "currentcolor",
|
|
335
|
-
style: { rotate: expanded ? "180deg" : void 0 }
|
|
336
|
-
}
|
|
337
|
-
)
|
|
331
|
+
isOpen && expandable && /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.DropDownXS, { color: "currentcolor", rotate: expanded })
|
|
338
332
|
]
|
|
339
333
|
}
|
|
340
334
|
) });
|
|
@@ -55,13 +55,7 @@ const HvAccordion = forwardRef(function HvAccordion2(props, ref) {
|
|
|
55
55
|
onClick: handleClick,
|
|
56
56
|
variant: labelVariant,
|
|
57
57
|
children: [
|
|
58
|
-
/* @__PURE__ */ jsx(
|
|
59
|
-
DropUpXS,
|
|
60
|
-
{
|
|
61
|
-
color: "inherit",
|
|
62
|
-
style: { rotate: isOpen ? void 0 : "180deg" }
|
|
63
|
-
}
|
|
64
|
-
),
|
|
58
|
+
/* @__PURE__ */ jsx(DropUpXS, { color: "inherit", rotate: !isOpen }),
|
|
65
59
|
label
|
|
66
60
|
]
|
|
67
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","sources":["../../../src/Accordion/Accordion.tsx"],"sourcesContent":["import { forwardRef, useCallback, useMemo } from \"react\";\nimport { DropUpXS } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvButtonBase } from \"../ButtonBase\";\nimport { useExpandable } from \"../hooks/useExpandable\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { HvTypography, HvTypographyVariants } from \"../Typography\";\nimport { staticClasses, useClasses } from \"./Accordion.styles\";\n\nexport { staticClasses as accordionClasses };\n\nexport type HvAccordionClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvAccordionProps\n extends HvBaseProps<HTMLDivElement, \"onChange\" | \"children\"> {\n /** Content to be rendered. */\n children: React.ReactNode;\n /** The accordion label button. */\n label?: string;\n /** The function that will be executed whenever the accordion toggles. It will receive the state of the accordion. */\n onChange?: (event: React.SyntheticEvent, value: boolean) => void;\n /** Whether the accordion is open or not. If this property is defined the accordion must be fully controlled. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** An object containing props to be passed onto container holding the accordion children. */\n containerProps?: React.HTMLAttributes<HTMLDivElement>;\n /** Heading level to apply to accordion button. If ´undefined´ the button won't have a header wrapper. */\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n /** Whether the accordion is disabled. */\n disabled?: boolean;\n /** Typography variant for the label. */\n labelVariant?: HvTypographyVariants;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvAccordionClasses;\n /** Whether to disable the internal usage of `preventDefault` and `stopPropagation` when the `onChange` event is triggered. */\n disableEventHandling?: boolean; // TODO - remove in v6 as this should be the default behavior: `preventDefault` and `stopPropagation` shouldn't be triggered internally\n}\n\n/**\n * A accordion is a design element that expands in place to expose hidden information.\n */\nexport const HvAccordion = forwardRef<\n React.ComponentRef<\"div\">,\n HvAccordionProps\n>(function HvAccordion(props, ref) {\n const {\n id,\n className,\n classes: classesProp,\n disabled = false,\n label,\n onChange,\n children,\n expanded,\n headingLevel,\n defaultExpanded = false,\n containerProps,\n labelVariant = \"label\",\n disableEventHandling,\n ...others\n } = useDefaultProps(\"HvAccordion\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const { isOpen, toggleOpen, buttonProps, regionProps } = useExpandable({\n id,\n expanded,\n disabled,\n defaultExpanded,\n });\n\n const handleClick = useCallback(\n (event: React.SyntheticEvent) => {\n if (!disabled) {\n onChange?.(event, isOpen);\n toggleOpen();\n }\n\n if (!disableEventHandling) {\n event.preventDefault();\n event.stopPropagation();\n }\n },\n [disableEventHandling, disabled, isOpen, onChange, toggleOpen],\n );\n\n const accordionHeader = useMemo(() => {\n const accordionButton = (\n <HvTypography\n {...buttonProps}\n component={HvButtonBase}\n className={cx(classes.label, { [classes.disabled]: disabled })}\n disabled={disabled}\n onClick={handleClick}\n variant={labelVariant}\n >\n <DropUpXS
|
|
1
|
+
{"version":3,"file":"Accordion.js","sources":["../../../src/Accordion/Accordion.tsx"],"sourcesContent":["import { forwardRef, useCallback, useMemo } from \"react\";\nimport { DropUpXS } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvButtonBase } from \"../ButtonBase\";\nimport { useExpandable } from \"../hooks/useExpandable\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { HvTypography, HvTypographyVariants } from \"../Typography\";\nimport { staticClasses, useClasses } from \"./Accordion.styles\";\n\nexport { staticClasses as accordionClasses };\n\nexport type HvAccordionClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvAccordionProps\n extends HvBaseProps<HTMLDivElement, \"onChange\" | \"children\"> {\n /** Content to be rendered. */\n children: React.ReactNode;\n /** The accordion label button. */\n label?: string;\n /** The function that will be executed whenever the accordion toggles. It will receive the state of the accordion. */\n onChange?: (event: React.SyntheticEvent, value: boolean) => void;\n /** Whether the accordion is open or not. If this property is defined the accordion must be fully controlled. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** An object containing props to be passed onto container holding the accordion children. */\n containerProps?: React.HTMLAttributes<HTMLDivElement>;\n /** Heading level to apply to accordion button. If ´undefined´ the button won't have a header wrapper. */\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n /** Whether the accordion is disabled. */\n disabled?: boolean;\n /** Typography variant for the label. */\n labelVariant?: HvTypographyVariants;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvAccordionClasses;\n /** Whether to disable the internal usage of `preventDefault` and `stopPropagation` when the `onChange` event is triggered. */\n disableEventHandling?: boolean; // TODO - remove in v6 as this should be the default behavior: `preventDefault` and `stopPropagation` shouldn't be triggered internally\n}\n\n/**\n * A accordion is a design element that expands in place to expose hidden information.\n */\nexport const HvAccordion = forwardRef<\n React.ComponentRef<\"div\">,\n HvAccordionProps\n>(function HvAccordion(props, ref) {\n const {\n id,\n className,\n classes: classesProp,\n disabled = false,\n label,\n onChange,\n children,\n expanded,\n headingLevel,\n defaultExpanded = false,\n containerProps,\n labelVariant = \"label\",\n disableEventHandling,\n ...others\n } = useDefaultProps(\"HvAccordion\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const { isOpen, toggleOpen, buttonProps, regionProps } = useExpandable({\n id,\n expanded,\n disabled,\n defaultExpanded,\n });\n\n const handleClick = useCallback(\n (event: React.SyntheticEvent) => {\n if (!disabled) {\n onChange?.(event, isOpen);\n toggleOpen();\n }\n\n if (!disableEventHandling) {\n event.preventDefault();\n event.stopPropagation();\n }\n },\n [disableEventHandling, disabled, isOpen, onChange, toggleOpen],\n );\n\n const accordionHeader = useMemo(() => {\n const accordionButton = (\n <HvTypography\n {...buttonProps}\n component={HvButtonBase}\n className={cx(classes.label, { [classes.disabled]: disabled })}\n disabled={disabled}\n onClick={handleClick}\n variant={labelVariant}\n >\n <DropUpXS color=\"inherit\" rotate={!isOpen} />\n {label}\n </HvTypography>\n );\n\n return headingLevel === undefined ? (\n accordionButton\n ) : (\n <HvTypography component={`h${headingLevel}`} variant={labelVariant}>\n {accordionButton}\n </HvTypography>\n );\n }, [\n cx,\n classes,\n handleClick,\n label,\n buttonProps,\n disabled,\n headingLevel,\n isOpen,\n labelVariant,\n ]);\n\n return (\n <div ref={ref} id={id} className={cx(classes.root, className)} {...others}>\n {accordionHeader}\n <div\n className={cx(classes.container, { [classes.hidden]: !isOpen })}\n hidden={!isOpen}\n {...regionProps}\n {...containerProps}\n >\n {children}\n </div>\n </div>\n );\n});\n"],"names":["HvAccordion"],"mappings":";;;;;;;;;AA8CO,MAAM,cAAc,WAGzB,SAASA,aAAY,OAAO,KAAK;AAC3B,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,eAAe,KAAK;AACxC,QAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAE9C,QAAM,EAAE,QAAQ,YAAY,aAAa,YAAA,IAAgB,cAAc;AAAA,IACrE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAED,QAAM,cAAc;AAAA,IAClB,CAAC,UAAgC;AAC/B,UAAI,CAAC,UAAU;AACb,mBAAW,OAAO,MAAM;AACb,mBAAA;AAAA,MAAA;AAGb,UAAI,CAAC,sBAAsB;AACzB,cAAM,eAAe;AACrB,cAAM,gBAAgB;AAAA,MAAA;AAAA,IAE1B;AAAA,IACA,CAAC,sBAAsB,UAAU,QAAQ,UAAU,UAAU;AAAA,EAC/D;AAEM,QAAA,kBAAkB,QAAQ,MAAM;AACpC,UAAM,kBACJ;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,WAAW;AAAA,QACX,WAAW,GAAG,QAAQ,OAAO,EAAE,CAAC,QAAQ,QAAQ,GAAG,UAAU;AAAA,QAC7D;AAAA,QACA,SAAS;AAAA,QACT,SAAS;AAAA,QAET,UAAA;AAAA,UAAA,oBAAC,UAAS,EAAA,OAAM,WAAU,QAAQ,CAAC,QAAQ;AAAA,UAC1C;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAGK,WAAA,iBAAiB,SACtB,kBAEC,oBAAA,cAAA,EAAa,WAAW,IAAI,YAAY,IAAI,SAAS,cACnD,UACH,iBAAA;AAAA,EAAA,GAED;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAGC,SAAA,qBAAC,OAAI,EAAA,KAAU,IAAQ,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,QAChE,UAAA;AAAA,IAAA;AAAA,IACD;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,GAAG,QAAQ,WAAW,EAAE,CAAC,QAAQ,MAAM,GAAG,CAAC,QAAQ;AAAA,QAC9D,QAAQ,CAAC;AAAA,QACR,GAAG;AAAA,QACH,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ,CAAC;"}
|
|
@@ -44,24 +44,24 @@ const { staticClasses, useClasses } = createClasses("HvBaseInput", {
|
|
|
44
44
|
invalid: {
|
|
45
45
|
"&:not(.disabled)": {
|
|
46
46
|
"& $inputBorderContainer": {
|
|
47
|
-
backgroundColor: theme.colors.
|
|
47
|
+
backgroundColor: theme.colors.negative_120
|
|
48
48
|
},
|
|
49
49
|
"&:hover $inputBorderContainer": {
|
|
50
|
-
backgroundColor: theme.colors.
|
|
50
|
+
backgroundColor: theme.colors.negative_120
|
|
51
51
|
},
|
|
52
52
|
"& $inputRootMultiline": {
|
|
53
53
|
"& $input": {
|
|
54
|
-
border: `1px solid ${theme.colors.
|
|
54
|
+
border: `1px solid ${theme.colors.negative_120}`
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"&:hover $inputRootMultiline": {
|
|
58
58
|
"& $input": {
|
|
59
|
-
border: `1px solid ${theme.colors.
|
|
59
|
+
border: `1px solid ${theme.colors.negative_120}`
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"&:focus-within $inputRootMultiline": {
|
|
63
63
|
"& $input": {
|
|
64
|
-
border: `1px solid ${theme.colors.
|
|
64
|
+
border: `1px solid ${theme.colors.negative_120}`
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -104,7 +104,7 @@ const { staticClasses, useClasses } = createClasses("HvBaseInput", {
|
|
|
104
104
|
left: "2px",
|
|
105
105
|
backgroundColor: theme.colors.atmo4
|
|
106
106
|
},
|
|
107
|
-
inputRootInvalid: { borderColor: theme.colors.
|
|
107
|
+
inputRootInvalid: { borderColor: theme.colors.negative_120 },
|
|
108
108
|
inputRootReadOnly: {
|
|
109
109
|
borderColor: theme.colors.secondary_60,
|
|
110
110
|
backgroundColor: theme.colors.atmo2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInput.styles.js","sources":["../../../src/BaseInput/BaseInput.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"../utils/focusUtils\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvBaseInput\", {\n root: {\n display: \"inline-block\",\n width: \"100%\",\n position: \"relative\",\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.colors.primary,\n },\n\n \"&:focus-within $inputBorderContainer\": {\n backgroundColor: theme.colors.primary,\n },\n },\n disabled: {\n \"& $inputRoot\": {\n backgroundColor: theme.colors.atmo2,\n borderColor: theme.colors.secondary_60,\n },\n\n \"& $inputBorderContainer\": {\n backgroundColor: theme.colors.atmo4,\n },\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.colors.atmo4,\n },\n\n \"&& $input\": {\n color: theme.colors.secondary_60,\n WebkitTextFillColor: theme.colors.secondary_60,\n },\n\n \"& $inputRootMultiline\": {\n \"& $input\": {\n backgroundColor: theme.colors.atmo2,\n border: `1px solid ${theme.colors.secondary_60}`,\n },\n },\n\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n backgroundColor: theme.colors.atmo2,\n border: `1px solid ${theme.colors.secondary_60}`,\n },\n },\n },\n invalid: {\n \"&:not(.disabled)\": {\n \"& $inputBorderContainer\": {\n backgroundColor: theme.colors.
|
|
1
|
+
{"version":3,"file":"BaseInput.styles.js","sources":["../../../src/BaseInput/BaseInput.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"../utils/focusUtils\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvBaseInput\", {\n root: {\n display: \"inline-block\",\n width: \"100%\",\n position: \"relative\",\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.colors.primary,\n },\n\n \"&:focus-within $inputBorderContainer\": {\n backgroundColor: theme.colors.primary,\n },\n },\n disabled: {\n \"& $inputRoot\": {\n backgroundColor: theme.colors.atmo2,\n borderColor: theme.colors.secondary_60,\n },\n\n \"& $inputBorderContainer\": {\n backgroundColor: theme.colors.atmo4,\n },\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.colors.atmo4,\n },\n\n \"&& $input\": {\n color: theme.colors.secondary_60,\n WebkitTextFillColor: theme.colors.secondary_60,\n },\n\n \"& $inputRootMultiline\": {\n \"& $input\": {\n backgroundColor: theme.colors.atmo2,\n border: `1px solid ${theme.colors.secondary_60}`,\n },\n },\n\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n backgroundColor: theme.colors.atmo2,\n border: `1px solid ${theme.colors.secondary_60}`,\n },\n },\n },\n invalid: {\n \"&:not(.disabled)\": {\n \"& $inputBorderContainer\": {\n backgroundColor: theme.colors.negative_120,\n },\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: theme.colors.negative_120,\n },\n\n \"& $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.negative_120}`,\n },\n },\n\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.negative_120}`,\n },\n },\n\n \"&:focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.negative_120}`,\n },\n },\n },\n },\n resizable: { width: \"auto\" },\n readOnly: {\n \"& $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n\n \"&:hover $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n\n \"&:focus-within $inputBorderContainer\": {\n backgroundColor: \"transparent\",\n },\n\n \"& $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.secondary_60}`,\n backgroundColor: theme.colors.atmo2,\n },\n },\n\n \"&:hover $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.secondary_60}`,\n backgroundColor: theme.colors.atmo2,\n },\n },\n\n \"&:focus-within $inputRootMultiline\": {\n \"& $input\": {\n border: `1px solid ${theme.colors.secondary_60}`,\n backgroundColor: theme.colors.atmo2,\n },\n },\n },\n inputBorderContainer: {\n position: \"absolute\",\n width: \"calc(100% - 4px)\",\n height: \"0px\",\n top: \"31px\",\n left: \"2px\",\n backgroundColor: theme.colors.atmo4,\n },\n inputRootInvalid: { borderColor: theme.colors.negative_120 },\n inputRootReadOnly: {\n borderColor: theme.colors.secondary_60,\n backgroundColor: theme.colors.atmo2,\n },\n inputRoot: {\n margin: 0,\n width: \"100%\",\n borderRadius: theme.radii.base,\n height: \"32px\",\n border: `1px solid ${theme.colors.secondary}`,\n boxSizing: \"border-box\",\n backgroundColor: theme.colors.atmo1,\n fontFamily: theme.fontFamily.body,\n\n \"&:hover:not($inputRootDisabled):not($inputRootInvalid):not($inputRootReadOnly)\":\n {\n borderColor: theme.colors.primary,\n },\n\n \"&:hover:not($inputRootDisabled)::before\": {\n borderBottom: \"none\",\n },\n\n \"&::before\": {\n borderBottom: \"none\",\n },\n\n \"&::after\": {\n borderBottom: \"none\",\n },\n },\n inputRootFocused: {\n backgroundColor: theme.colors.atmo1,\n ...outlineStyles,\n\n \"&:hover\": {\n backgroundColor: theme.colors.atmo1,\n },\n\n \"&$inputRootReadOnly\": {\n backgroundColor: theme.colors.atmo2,\n },\n },\n inputRootDisabled: {\n cursor: \"not-allowed\",\n\n \"&&::before\": {\n borderBottomStyle: \"none\",\n },\n },\n inputRootMultiline: {\n padding: 0,\n backgroundColor: \"transparent\",\n overflow: \"auto\",\n border: \"none\",\n height: \"auto\",\n\n \"& $input\": {\n border: `1px solid ${theme.colors.secondary}`,\n borderRadius: theme.radii.base,\n backgroundColor: theme.colors.atmo1,\n height: \"auto\",\n minHeight: \"21px\",\n padding: \"5px 10px\",\n overflow: \"auto\",\n marginLeft: \"0px\",\n marginRight: \"0px\",\n\n \"&:hover\": {\n border: `1px solid ${theme.colors.primary}`,\n },\n },\n },\n input: {\n height: \"19px\",\n marginLeft: theme.space.xs,\n marginRight: theme.space.xs,\n padding: \"6px 0 5px\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n outline: \"none\",\n width: \"initial\",\n flexGrow: 1,\n ...(theme.typography.body as React.CSSProperties),\n\n \"&::placeholder\": {\n opacity: 1,\n color: theme.colors.secondary_80,\n },\n\n \"&::-ms-clear\": {\n display: \"none\",\n },\n },\n inputDisabled: {},\n inputReadOnly: {\n color: theme.colors.secondary_80,\n },\n inputResizable: { resize: \"both\", width: \"100%\" },\n});\n"],"names":[],"mappings":";;;AAKO,MAAM,EAAE,eAAe,eAAe,cAAc,eAAe;AAAA,EACxE,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,IAEV,iCAAiC;AAAA,MAC/B,iBAAiB,MAAM,OAAO;AAAA,IAChC;AAAA,IAEA,wCAAwC;AAAA,MACtC,iBAAiB,MAAM,OAAO;AAAA,IAAA;AAAA,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M,OAAO;AAAA,EACtB;AAAA,EACA,gBAAgB,EAAE,QAAQ,QAAQ,OAAO,OAAO;AAClD,CAAC;"}
|
|
@@ -84,7 +84,7 @@ const HvButton = fixedForwardRef(function HvButton2(props, ref) {
|
|
|
84
84
|
tabIndex: focusableWhenDisabled ? 0 : -1,
|
|
85
85
|
"aria-disabled": true
|
|
86
86
|
},
|
|
87
|
-
...selected && { "aria-pressed": selected },
|
|
87
|
+
...selected != null && { "aria-pressed": selected },
|
|
88
88
|
...others,
|
|
89
89
|
children: [
|
|
90
90
|
startIcon && /* @__PURE__ */ jsx("span", { className: classes.startIcon, children: startIcon }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/Button/Button.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport {\n mergeStyles,\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\nimport {\n getColor,\n HvColorAny,\n HvRadius,\n HvSize,\n theme,\n} from \"@hitachivantara/uikit-styles\";\n\nimport {\n fixedForwardRef,\n PolymorphicComponentRef,\n PolymorphicRef,\n} from \"../types/generic\";\nimport {\n getIconSizeStyles,\n getOverrideColors,\n getSizeStyles,\n staticClasses,\n useClasses,\n} from \"./Button.styles\";\nimport { HvButtonVariant } from \"./types\";\n\ntype Variant = \"contained\" | \"subtle\" | \"ghost\";\n\nexport { staticClasses as buttonClasses };\n\nexport type HvButtonClasses = ExtractNames<typeof useClasses>;\n\nexport type HvButtonProps<C extends React.ElementType = \"button\"> =\n PolymorphicComponentRef<\n C,\n {\n /** Use the variant prop to change the visual style of the button. */\n variant?: HvButtonVariant;\n /** Whether the button is an icon-only button. */\n icon?: boolean;\n /** Whether the button is disabled or not. */\n disabled?: boolean;\n /** Class names to be applied. */\n className?: string;\n /** Element placed before the children. */\n startIcon?: React.ReactNode;\n /** Element placed after the children. */\n endIcon?: React.ReactNode;\n /** Color of the button. */\n color?: HvColorAny;\n /** Button size. */\n size?: HvSize;\n /** Button border radius. */\n radius?: HvRadius;\n /** Defines the default colors of the button are forced into the icon. */\n overrideIconColors?: boolean;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvButtonClasses;\n /** Whether the button is selected or not. */\n selected?: boolean;\n /**\n * Whether the button is focusable when disabled.\n * Without this property, the accessibility of the button decreases when disabled since it's not read by screen readers.\n * Set this property to `true` when you need the button to still be focusable when disabled for accessibility purposes.\n */\n focusableWhenDisabled?: boolean;\n }\n >;\n\nfunction parseVariant(variant: HvButtonVariant): [HvColorAny, Variant] {\n const deprecatedVariantMap: Record<string, HvButtonVariant> = {\n secondary: \"secondarySubtle\",\n };\n\n const mappedVariant = deprecatedVariantMap[variant];\n\n if (import.meta.env.DEV && mappedVariant) {\n // eslint-disable-next-line no-console\n console.warn(\n `HvButton variant '${variant}' is deprecated. Please use '${mappedVariant}'.`,\n );\n }\n\n if (variant === \"semantic\") return [\"inherit\", \"ghost\"];\n if (variant === \"secondary\") return [\"secondary\", \"subtle\"];\n if (variant === \"ghost\") return [\"primary\", \"ghost\"];\n if (variant === \"contained\" || variant === \"subtle\") {\n return [\"secondary\", variant];\n }\n\n const result = variant.split(/(?=[A-Z])/);\n if (!result[1]) return [result[0], \"contained\"];\n\n return result.map((x) => x.toLowerCase()) as [HvColorAny, Variant];\n}\n/**\n * Button component is used to trigger an action or event.\n */\nexport const HvButton = fixedForwardRef(function HvButton<\n C extends React.ElementType = \"button\",\n>(props: HvButtonProps<C>, ref: PolymorphicRef<C>) {\n const {\n classes: classesProp,\n children,\n icon = false,\n variant: variantProp = icon ? \"secondaryGhost\" : \"primary\",\n color: colorProp,\n disabled = false,\n className,\n startIcon,\n endIcon,\n size,\n radius,\n overrideIconColors = true,\n component: Component = \"button\",\n focusableWhenDisabled,\n onClick: onClickProp,\n onMouseDown: onMouseDownProp,\n selected,\n style,\n ...others\n } = useDefaultProps(\"HvButton\", props);\n const { classes, css, cx } = useClasses(classesProp);\n const [parsedColor, variant] = parseVariant(variantProp);\n const color = colorProp ?? parsedColor;\n\n const handleClick: HvButtonProps[\"onClick\"] = (e) => {\n if (disabled) return;\n onClickProp?.(e);\n };\n\n const handleMouseDown: HvButtonProps[\"onMouseDown\"] = (e) => {\n if (disabled) return;\n onMouseDownProp?.(e);\n };\n\n const sizeStyles = useMemo(\n () => size && (icon ? getIconSizeStyles(size) : getSizeStyles(size)),\n [size, icon],\n );\n\n return (\n <Component\n ref={ref}\n style={mergeStyles(style, {\n \"--color\": color && getColor(color),\n \"--radius\": radius && theme.radii[radius],\n \"--HvButton-height\": sizeStyles?.height ?? \"32px\",\n })}\n className={cx(\n classes.root,\n classes[variant],\n classes[variantProp as keyof HvButtonClasses], // Placed after type and color CSS for DS3 override\n overrideIconColors && css(getOverrideColors()),\n {\n [classes.icon]: icon,\n [classes.disabled]: disabled,\n },\n sizeStyles && css(sizeStyles),\n className,\n )}\n data-color={color}\n onClick={handleClick}\n onMouseDown={handleMouseDown}\n {...(Component === \"button\" && { type: \"button\" })}\n {...(disabled && {\n disabled: !focusableWhenDisabled,\n tabIndex: focusableWhenDisabled ? 0 : -1,\n \"aria-disabled\": true,\n })}\n {...(selected && { \"aria-pressed\": selected })}\n {...others}\n >\n {startIcon && <span className={classes.startIcon}>{startIcon}</span>}\n {children}\n {endIcon && <span className={classes.endIcon}>{endIcon}</span>}\n </Component>\n );\n});\n"],"names":["HvButton"],"mappings":";;;;;;;AAuEA,SAAS,aAAa,SAAiD;AAcrE,MAAI,YAAY,WAAmB,QAAA,CAAC,WAAW,OAAO;AACtD,MAAI,YAAY,YAAoB,QAAA,CAAC,aAAa,QAAQ;AAC1D,MAAI,YAAY,QAAgB,QAAA,CAAC,WAAW,OAAO;AAC/C,MAAA,YAAY,eAAe,YAAY,UAAU;AAC5C,WAAA,CAAC,aAAa,OAAO;AAAA,EAAA;AAGxB,QAAA,SAAS,QAAQ,MAAM,WAAW;AACpC,MAAA,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,WAAW;AAE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AAQ,IAAI,GAAG;AAAA,UAChB,CAAC,QAAQ,QAAQ,GAAG;AAAA,QACtB;AAAA,QACA,cAAc,IAAI,UAAU;AAAA,QAC5B;AAAA,MACF;AAAA,MACA,cAAY;AAAA,MACZ,SAAS;AAAA,MACT,aAAa;AAAA,MACZ,GAAI,cAAc,YAAY,EAAE,MAAM,SAAS;AAAA,MAC/C,GAAI,YAAY;AAAA,QACf,UAAU,CAAC;AAAA,QACX,UAAU,wBAAwB,IAAI;AAAA,QACtC,iBAAiB;AAAA,MACnB;AAAA,MACC,GAAI,YAAY,EAAE,gBAAgB,SAAS;AAAA,
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/Button/Button.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport {\n mergeStyles,\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\nimport {\n getColor,\n HvColorAny,\n HvRadius,\n HvSize,\n theme,\n} from \"@hitachivantara/uikit-styles\";\n\nimport {\n fixedForwardRef,\n PolymorphicComponentRef,\n PolymorphicRef,\n} from \"../types/generic\";\nimport {\n getIconSizeStyles,\n getOverrideColors,\n getSizeStyles,\n staticClasses,\n useClasses,\n} from \"./Button.styles\";\nimport { HvButtonVariant } from \"./types\";\n\ntype Variant = \"contained\" | \"subtle\" | \"ghost\";\n\nexport { staticClasses as buttonClasses };\n\nexport type HvButtonClasses = ExtractNames<typeof useClasses>;\n\nexport type HvButtonProps<C extends React.ElementType = \"button\"> =\n PolymorphicComponentRef<\n C,\n {\n /** Use the variant prop to change the visual style of the button. */\n variant?: HvButtonVariant;\n /** Whether the button is an icon-only button. */\n icon?: boolean;\n /** Whether the button is disabled or not. */\n disabled?: boolean;\n /** Class names to be applied. */\n className?: string;\n /** Element placed before the children. */\n startIcon?: React.ReactNode;\n /** Element placed after the children. */\n endIcon?: React.ReactNode;\n /** Color of the button. */\n color?: HvColorAny;\n /** Button size. */\n size?: HvSize;\n /** Button border radius. */\n radius?: HvRadius;\n /** Defines the default colors of the button are forced into the icon. */\n overrideIconColors?: boolean;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvButtonClasses;\n /** Whether the button is selected or not. */\n selected?: boolean;\n /**\n * Whether the button is focusable when disabled.\n * Without this property, the accessibility of the button decreases when disabled since it's not read by screen readers.\n * Set this property to `true` when you need the button to still be focusable when disabled for accessibility purposes.\n */\n focusableWhenDisabled?: boolean;\n }\n >;\n\nfunction parseVariant(variant: HvButtonVariant): [HvColorAny, Variant] {\n const deprecatedVariantMap: Record<string, HvButtonVariant> = {\n secondary: \"secondarySubtle\",\n };\n\n const mappedVariant = deprecatedVariantMap[variant];\n\n if (import.meta.env.DEV && mappedVariant) {\n // eslint-disable-next-line no-console\n console.warn(\n `HvButton variant '${variant}' is deprecated. Please use '${mappedVariant}'.`,\n );\n }\n\n if (variant === \"semantic\") return [\"inherit\", \"ghost\"];\n if (variant === \"secondary\") return [\"secondary\", \"subtle\"];\n if (variant === \"ghost\") return [\"primary\", \"ghost\"];\n if (variant === \"contained\" || variant === \"subtle\") {\n return [\"secondary\", variant];\n }\n\n const result = variant.split(/(?=[A-Z])/);\n if (!result[1]) return [result[0], \"contained\"];\n\n return result.map((x) => x.toLowerCase()) as [HvColorAny, Variant];\n}\n/**\n * Button component is used to trigger an action or event.\n */\nexport const HvButton = fixedForwardRef(function HvButton<\n C extends React.ElementType = \"button\",\n>(props: HvButtonProps<C>, ref: PolymorphicRef<C>) {\n const {\n classes: classesProp,\n children,\n icon = false,\n variant: variantProp = icon ? \"secondaryGhost\" : \"primary\",\n color: colorProp,\n disabled = false,\n className,\n startIcon,\n endIcon,\n size,\n radius,\n overrideIconColors = true,\n component: Component = \"button\",\n focusableWhenDisabled,\n onClick: onClickProp,\n onMouseDown: onMouseDownProp,\n selected,\n style,\n ...others\n } = useDefaultProps(\"HvButton\", props);\n const { classes, css, cx } = useClasses(classesProp);\n const [parsedColor, variant] = parseVariant(variantProp);\n const color = colorProp ?? parsedColor;\n\n const handleClick: HvButtonProps[\"onClick\"] = (e) => {\n if (disabled) return;\n onClickProp?.(e);\n };\n\n const handleMouseDown: HvButtonProps[\"onMouseDown\"] = (e) => {\n if (disabled) return;\n onMouseDownProp?.(e);\n };\n\n const sizeStyles = useMemo(\n () => size && (icon ? getIconSizeStyles(size) : getSizeStyles(size)),\n [size, icon],\n );\n\n return (\n <Component\n ref={ref}\n style={mergeStyles(style, {\n \"--color\": color && getColor(color),\n \"--radius\": radius && theme.radii[radius],\n \"--HvButton-height\": sizeStyles?.height ?? \"32px\",\n })}\n className={cx(\n classes.root,\n classes[variant],\n classes[variantProp as keyof HvButtonClasses], // Placed after type and color CSS for DS3 override\n overrideIconColors && css(getOverrideColors()),\n {\n [classes.icon]: icon,\n [classes.disabled]: disabled,\n },\n sizeStyles && css(sizeStyles),\n className,\n )}\n data-color={color}\n onClick={handleClick}\n onMouseDown={handleMouseDown}\n {...(Component === \"button\" && { type: \"button\" })}\n {...(disabled && {\n disabled: !focusableWhenDisabled,\n tabIndex: focusableWhenDisabled ? 0 : -1,\n \"aria-disabled\": true,\n })}\n {...(selected != null && { \"aria-pressed\": selected })}\n {...others}\n >\n {startIcon && <span className={classes.startIcon}>{startIcon}</span>}\n {children}\n {endIcon && <span className={classes.endIcon}>{endIcon}</span>}\n </Component>\n );\n});\n"],"names":["HvButton"],"mappings":";;;;;;;AAuEA,SAAS,aAAa,SAAiD;AAcrE,MAAI,YAAY,WAAmB,QAAA,CAAC,WAAW,OAAO;AACtD,MAAI,YAAY,YAAoB,QAAA,CAAC,aAAa,QAAQ;AAC1D,MAAI,YAAY,QAAgB,QAAA,CAAC,WAAW,OAAO;AAC/C,MAAA,YAAY,eAAe,YAAY,UAAU;AAC5C,WAAA,CAAC,aAAa,OAAO;AAAA,EAAA;AAGxB,QAAA,SAAS,QAAQ,MAAM,WAAW;AACpC,MAAA,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,WAAW;AAE9C,SAAO,OAAO,IAAI,CAAC,MA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