@hitachivantara/uikit-react-core 5.99.0 → 5.100.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/BaseSwitch/BaseSwitch.cjs +19 -5
- package/dist/cjs/BaseSwitch/BaseSwitch.styles.cjs +22 -6
- package/dist/cjs/Dialog/Title/Title.cjs +2 -2
- package/dist/cjs/Loading/Loading.cjs +1 -0
- package/dist/cjs/Loading/Loading.styles.cjs +16 -17
- package/dist/cjs/NumberInput/NumberInput.cjs +5 -5
- package/dist/cjs/Pagination/Pagination.cjs +6 -3
- package/dist/cjs/ScrollToVertical/VerticalScrollListItem/VerticalScrollListItem.styles.cjs +1 -1
- package/dist/cjs/Switch/Switch.cjs +1 -14
- package/dist/cjs/themes/ds3.cjs +3 -4
- package/dist/cjs/themes/pentahoPlus.cjs +44 -12
- package/dist/esm/BaseSwitch/BaseSwitch.js +19 -5
- package/dist/esm/BaseSwitch/BaseSwitch.styles.js +22 -6
- package/dist/esm/Dialog/Title/Title.js +2 -2
- package/dist/esm/Loading/Loading.js +1 -0
- package/dist/esm/Loading/Loading.styles.js +16 -17
- package/dist/esm/NumberInput/NumberInput.js +1 -1
- package/dist/esm/Pagination/Pagination.js +2 -1
- package/dist/esm/ScrollToVertical/VerticalScrollListItem/VerticalScrollListItem.styles.js +1 -1
- package/dist/esm/Switch/Switch.js +1 -14
- package/dist/esm/themes/ds3.js +3 -4
- package/dist/esm/themes/pentahoPlus.js +44 -12
- package/dist/types/index.d.ts +10 -2
- package/package.json +5 -5
|
@@ -4,6 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const MuiSwitch = require("@mui/material/Switch");
|
|
6
6
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
7
|
+
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
7
8
|
const BaseSwitch_styles = require("./BaseSwitch.styles.cjs");
|
|
8
9
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
9
10
|
const MuiSwitch__default = /* @__PURE__ */ _interopDefault(MuiSwitch);
|
|
@@ -24,9 +25,11 @@ const HvBaseSwitch = React.forwardRef(
|
|
|
24
25
|
inputProps,
|
|
25
26
|
onFocusVisible,
|
|
26
27
|
onBlur,
|
|
28
|
+
size = "sm",
|
|
29
|
+
color,
|
|
27
30
|
...others
|
|
28
31
|
} = uikitReactUtils.useDefaultProps("HvBaseSwitch", props);
|
|
29
|
-
const { classes, cx } = BaseSwitch_styles.useClasses(classesProp);
|
|
32
|
+
const { classes, cx, css } = BaseSwitch_styles.useClasses(classesProp);
|
|
30
33
|
const [focusVisible, setFocusVisible] = React.useState(false);
|
|
31
34
|
const onFocusVisibleCallback = React.useCallback(
|
|
32
35
|
(evt) => {
|
|
@@ -66,7 +69,6 @@ const HvBaseSwitch = React.forwardRef(
|
|
|
66
69
|
},
|
|
67
70
|
className
|
|
68
71
|
),
|
|
69
|
-
color: "default",
|
|
70
72
|
disabled,
|
|
71
73
|
required,
|
|
72
74
|
readOnly,
|
|
@@ -76,15 +78,27 @@ const HvBaseSwitch = React.forwardRef(
|
|
|
76
78
|
defaultChecked,
|
|
77
79
|
classes: {
|
|
78
80
|
root: classes.switch,
|
|
79
|
-
switchBase: classes.switchBase,
|
|
81
|
+
switchBase: cx(classes.switchBase),
|
|
80
82
|
checked: classes.checked,
|
|
81
|
-
track:
|
|
82
|
-
|
|
83
|
+
track: cx(
|
|
84
|
+
classes.track,
|
|
85
|
+
color ? css({
|
|
86
|
+
backgroundColor: `${uikitStyles.getColor(color, "transparent")}!important`,
|
|
87
|
+
border: "none"
|
|
88
|
+
}) : void 0
|
|
89
|
+
),
|
|
90
|
+
thumb: cx(
|
|
91
|
+
classes.thumb,
|
|
92
|
+
color ? css({
|
|
93
|
+
border: "none"
|
|
94
|
+
}) : void 0
|
|
95
|
+
),
|
|
83
96
|
disabled: classes.disabled
|
|
84
97
|
},
|
|
85
98
|
inputProps,
|
|
86
99
|
onFocusVisible: onFocusVisibleCallback,
|
|
87
100
|
onBlur: onBlurCallback,
|
|
101
|
+
"data-size": size,
|
|
88
102
|
...others
|
|
89
103
|
}
|
|
90
104
|
);
|
|
@@ -5,10 +5,10 @@ const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
|
5
5
|
const focusUtils = require("../utils/focusUtils.cjs");
|
|
6
6
|
const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvBaseSwitch", {
|
|
7
7
|
root: {
|
|
8
|
-
padding:
|
|
8
|
+
padding: uikitStyles.theme.space.xs,
|
|
9
9
|
cursor: "pointer",
|
|
10
|
-
width: "
|
|
11
|
-
height: "
|
|
10
|
+
width: "fit-content",
|
|
11
|
+
height: "fit-content",
|
|
12
12
|
alignItems: "center",
|
|
13
13
|
justifyContent: "center",
|
|
14
14
|
borderRadius: uikitStyles.theme.radii.round,
|
|
@@ -27,7 +27,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvBaseSwitc
|
|
|
27
27
|
backgroundColor: uikitStyles.theme.colors.primary,
|
|
28
28
|
borderColor: "transparent"
|
|
29
29
|
},
|
|
30
|
-
"
|
|
30
|
+
"&:not($disabled) $thumb": {
|
|
31
31
|
borderColor: "transparent"
|
|
32
32
|
},
|
|
33
33
|
"&:hover": {
|
|
@@ -57,7 +57,23 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvBaseSwitc
|
|
|
57
57
|
switchBase: {
|
|
58
58
|
width: "40px",
|
|
59
59
|
height: "32px",
|
|
60
|
-
padding: 0
|
|
60
|
+
padding: 0,
|
|
61
|
+
"&[data-size=medium]": {
|
|
62
|
+
"+.HvBaseSwitch-track": {
|
|
63
|
+
width: 48,
|
|
64
|
+
height: 22
|
|
65
|
+
},
|
|
66
|
+
"& $thumb": {
|
|
67
|
+
left: -2,
|
|
68
|
+
top: 3,
|
|
69
|
+
width: 18,
|
|
70
|
+
height: 18
|
|
71
|
+
},
|
|
72
|
+
"&$checked $thumb": {
|
|
73
|
+
left: 8,
|
|
74
|
+
top: 3
|
|
75
|
+
}
|
|
76
|
+
}
|
|
61
77
|
},
|
|
62
78
|
track: {
|
|
63
79
|
opacity: 1,
|
|
@@ -69,7 +85,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvBaseSwitc
|
|
|
69
85
|
},
|
|
70
86
|
thumb: {
|
|
71
87
|
position: "relative",
|
|
72
|
-
left: "-
|
|
88
|
+
left: "-5px",
|
|
73
89
|
width: "10px",
|
|
74
90
|
height: "10px",
|
|
75
91
|
border: `solid 1px ${uikitStyles.theme.colors.borderStrong}`,
|
|
@@ -14,8 +14,8 @@ const HvDialogTitle = (props) => {
|
|
|
14
14
|
classes: classesProp,
|
|
15
15
|
className,
|
|
16
16
|
children,
|
|
17
|
-
variant
|
|
18
|
-
showIcon =
|
|
17
|
+
variant,
|
|
18
|
+
showIcon = variant != null,
|
|
19
19
|
customIcon,
|
|
20
20
|
...others
|
|
21
21
|
} = uikitReactUtils.useDefaultProps("HvDialogTitle", props);
|
|
@@ -25,6 +25,7 @@ const HvLoading = React.forwardRef(function HvLoading2(props, ref) {
|
|
|
25
25
|
{
|
|
26
26
|
ref,
|
|
27
27
|
hidden: !!hidden,
|
|
28
|
+
"data-size": size,
|
|
28
29
|
style: uikitReactUtils.mergeStyles(style, {
|
|
29
30
|
color: uikitStyles.getColor(color, small ? "text" : "brand"),
|
|
30
31
|
"--customColor": uikitStyles.getColor(color)
|
|
@@ -8,28 +8,27 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvLoading",
|
|
|
8
8
|
flexDirection: "column",
|
|
9
9
|
alignItems: "center",
|
|
10
10
|
justifyContent: "center",
|
|
11
|
-
gap: uikitStyles.theme.space.xs
|
|
11
|
+
gap: uikitStyles.theme.space.xs,
|
|
12
|
+
"&[data-size=small]": {
|
|
13
|
+
"--bar-size": "2px",
|
|
14
|
+
"--size": "18px",
|
|
15
|
+
"--height": "40%"
|
|
16
|
+
}
|
|
12
17
|
},
|
|
13
18
|
barContainer: {
|
|
14
19
|
display: "flex",
|
|
15
20
|
alignItems: "center",
|
|
16
21
|
justifyContent: "space-around",
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
height: 30
|
|
20
|
-
},
|
|
21
|
-
":has($small)": {
|
|
22
|
-
"--height": "40%",
|
|
23
|
-
width: 18,
|
|
24
|
-
height: 18
|
|
25
|
-
}
|
|
22
|
+
width: "var(--size, 30px)",
|
|
23
|
+
height: "var(--size, 30px)"
|
|
26
24
|
},
|
|
27
25
|
loadingBar: {
|
|
28
26
|
backgroundColor: "currentcolor",
|
|
29
27
|
display: "inline-block",
|
|
30
28
|
animation: "loading 1s ease-in-out infinite",
|
|
31
29
|
// TODO: make this the default when it has better support
|
|
32
|
-
width: "round(up, 0.11em, 2px)",
|
|
30
|
+
// width: "round(up, 0.11em, 2px)",
|
|
31
|
+
width: "var(--bar-size, 4px)",
|
|
33
32
|
height: "100%",
|
|
34
33
|
"@keyframes loading": {
|
|
35
34
|
"50%": {
|
|
@@ -46,13 +45,13 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvLoading",
|
|
|
46
45
|
overlay: {},
|
|
47
46
|
blur: {},
|
|
48
47
|
hidden: { display: "none" },
|
|
49
|
-
small
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
regular: {
|
|
53
|
-
|
|
54
|
-
},
|
|
48
|
+
/** @deprecated use data-size=small instead */
|
|
49
|
+
small: {},
|
|
50
|
+
/** @deprecated use data-size=regular instead */
|
|
51
|
+
regular: {},
|
|
52
|
+
/** @deprecated leverage data-size=small instead */
|
|
55
53
|
smallColor: {},
|
|
54
|
+
/** @deprecated leverage data-size=regular instead */
|
|
56
55
|
regularColor: {}
|
|
57
56
|
});
|
|
58
57
|
exports.staticClasses = staticClasses;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const
|
|
5
|
+
const utils = require("@mui/material/utils");
|
|
6
6
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
7
7
|
const icons = require("../icons.cjs");
|
|
8
|
-
const utils = require("../Input/utils.cjs");
|
|
8
|
+
const utils$1 = require("../Input/utils.cjs");
|
|
9
9
|
const NumberInput_styles = require("./NumberInput.styles.cjs");
|
|
10
10
|
const Adornment = require("../FormElement/Adornment/Adornment.cjs");
|
|
11
11
|
const Input = require("../Input/Input.cjs");
|
|
@@ -18,18 +18,18 @@ const HvNumberInput = React.forwardRef(function HvNumberInput2(props, ref) {
|
|
|
18
18
|
} = uikitReactUtils.useDefaultProps("HvNumberInput", props);
|
|
19
19
|
const { classes, cx } = NumberInput_styles.useClasses(classesProp);
|
|
20
20
|
const inputRef = React.useRef(null);
|
|
21
|
-
const forkedRef =
|
|
21
|
+
const forkedRef = utils.useForkRef(ref, inputRef);
|
|
22
22
|
const buttons = React.useMemo(() => {
|
|
23
23
|
const handleIncrease = () => {
|
|
24
24
|
if (inputRef.current) {
|
|
25
25
|
inputRef.current.stepUp();
|
|
26
|
-
utils.changeInputValue(inputRef.current, inputRef.current.value);
|
|
26
|
+
utils$1.changeInputValue(inputRef.current, inputRef.current.value);
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
const handleDecrease = () => {
|
|
30
30
|
if (inputRef.current) {
|
|
31
31
|
inputRef.current.stepDown();
|
|
32
|
-
utils.changeInputValue(inputRef.current, inputRef.current.value);
|
|
32
|
+
utils$1.changeInputValue(inputRef.current, inputRef.current.value);
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const
|
|
5
|
+
const styles = require("@mui/material/styles");
|
|
6
|
+
const useMediaQuery = require("@mui/material/useMediaQuery");
|
|
6
7
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
7
8
|
const useLabels = require("../hooks/useLabels.cjs");
|
|
8
9
|
const icons = require("../icons.cjs");
|
|
@@ -12,6 +13,8 @@ const Select = require("./Select.cjs");
|
|
|
12
13
|
const Typography = require("../Typography/Typography.cjs");
|
|
13
14
|
const IconButton = require("../IconButton/IconButton.cjs");
|
|
14
15
|
const Input = require("../Input/Input.cjs");
|
|
16
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
17
|
+
const useMediaQuery__default = /* @__PURE__ */ _interopDefault(useMediaQuery);
|
|
15
18
|
const defaultPageSizeOptions = [5, 10, 20, 25, 50, 100];
|
|
16
19
|
const DEFAULT_LABELS = {
|
|
17
20
|
/** The show label. */
|
|
@@ -64,8 +67,8 @@ const HvPagination = React.forwardRef(function HvPagination2(props, ref) {
|
|
|
64
67
|
} = uikitReactUtils.useDefaultProps("HvPagination", props);
|
|
65
68
|
const { classes, cx } = Pagination_styles.useClasses(classesProp);
|
|
66
69
|
const labels = useLabels.useLabels(DEFAULT_LABELS, labelsProp);
|
|
67
|
-
const muiTheme =
|
|
68
|
-
const isXsDown =
|
|
70
|
+
const muiTheme = styles.useTheme();
|
|
71
|
+
const isXsDown = useMediaQuery__default.default(muiTheme.breakpoints.down("xs"));
|
|
69
72
|
const [pageInput, setPageInput] = React.useState(page);
|
|
70
73
|
const changePage = React.useCallback(
|
|
71
74
|
(newPage) => {
|
|
@@ -26,7 +26,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses(name, {
|
|
|
26
26
|
fontSize: 4,
|
|
27
27
|
color: uikitStyles.theme.colors.textDisabled
|
|
28
28
|
},
|
|
29
|
-
|
|
29
|
+
/** @deprecated: use classes.button instead */
|
|
30
30
|
text: {},
|
|
31
31
|
button: {
|
|
32
32
|
display: "flex",
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
6
|
-
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
7
6
|
const useControlled = require("../hooks/useControlled.cjs");
|
|
8
7
|
const useUniqueId = require("../hooks/useUniqueId.cjs");
|
|
9
8
|
const setId = require("../utils/setId.cjs");
|
|
@@ -13,7 +12,6 @@ const FormElement = require("../FormElement/FormElement.cjs");
|
|
|
13
12
|
const Label = require("../FormElement/Label/Label.cjs");
|
|
14
13
|
const utils = require("../FormElement/utils.cjs");
|
|
15
14
|
const WarningText = require("../FormElement/WarningText/WarningText.cjs");
|
|
16
|
-
const isSemantical = (color) => ["positive", "negative", "warning"].includes(color);
|
|
17
15
|
const HvSwitch = React.forwardRef(
|
|
18
16
|
function HvSwitch2(props, ref) {
|
|
19
17
|
const {
|
|
@@ -37,10 +35,9 @@ const HvSwitch = React.forwardRef(
|
|
|
37
35
|
statusMessage,
|
|
38
36
|
"aria-errormessage": ariaErrorMessage,
|
|
39
37
|
inputProps,
|
|
40
|
-
color,
|
|
41
38
|
...others
|
|
42
39
|
} = uikitReactUtils.useDefaultProps("HvSwitch", props);
|
|
43
|
-
const { classes, cx
|
|
40
|
+
const { classes, cx } = Switch_styles.useClasses(classesProp);
|
|
44
41
|
const elementId = useUniqueId.useUniqueId(id);
|
|
45
42
|
const [isChecked, setIsChecked] = useControlled.useControlled(checked, defaultChecked);
|
|
46
43
|
const [validationState, setValidationState] = useControlled.useControlled(
|
|
@@ -116,16 +113,6 @@ const HvSwitch = React.forwardRef(
|
|
|
116
113
|
"aria-describedby": ariaDescribedBy,
|
|
117
114
|
...inputProps
|
|
118
115
|
},
|
|
119
|
-
...color && {
|
|
120
|
-
classes: {
|
|
121
|
-
switchBase: css({
|
|
122
|
-
"&&&+.HvBaseSwitch-track,&&&.HvBaseSwitch-checked+.HvBaseSwitch-track": {
|
|
123
|
-
backgroundColor: uikitStyles.getColor(color),
|
|
124
|
-
borderColor: isSemantical(color) ? uikitStyles.getColor(`${color}Deep`) : "#00000032"
|
|
125
|
-
}
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
116
|
...others
|
|
130
117
|
}
|
|
131
118
|
)
|
package/dist/cjs/themes/ds3.cjs
CHANGED
|
@@ -181,9 +181,7 @@ const ds3 = uikitStyles.mergeTheme(uikitStyles.ds3, {
|
|
|
181
181
|
HvBaseSwitch: {
|
|
182
182
|
classes: {
|
|
183
183
|
root: {
|
|
184
|
-
|
|
185
|
-
height: "16px",
|
|
186
|
-
borderRadius: 0,
|
|
184
|
+
padding: 0,
|
|
187
185
|
"&:hover": {
|
|
188
186
|
backgroundColor: "transparent"
|
|
189
187
|
},
|
|
@@ -204,7 +202,8 @@ const ds3 = uikitStyles.mergeTheme(uikitStyles.ds3, {
|
|
|
204
202
|
},
|
|
205
203
|
thumb: {
|
|
206
204
|
width: 12,
|
|
207
|
-
height: 12
|
|
205
|
+
height: 12,
|
|
206
|
+
left: -9
|
|
208
207
|
}
|
|
209
208
|
}
|
|
210
209
|
},
|
|
@@ -114,39 +114,71 @@ const pentahoPlus = uikitStyles.mergeTheme(uikitStyles.pentahoPlus, {
|
|
|
114
114
|
HvBaseSwitch: {
|
|
115
115
|
classes: {
|
|
116
116
|
root: {
|
|
117
|
-
|
|
117
|
+
padding: uikitStyles.theme.space.xxs,
|
|
118
|
+
borderRadius: uikitStyles.theme.radii.full,
|
|
118
119
|
"&:hover": {
|
|
119
120
|
backgroundColor: uikitStyles.theme.colors.bgHover
|
|
120
121
|
},
|
|
121
122
|
"& .HvBaseSwitch-switchBase": {
|
|
122
123
|
"& .HvBaseSwitch-thumb": {
|
|
123
124
|
borderColor: "transparent",
|
|
124
|
-
|
|
125
|
+
backgroundColor: "#FFFFFF",
|
|
126
|
+
left: -8,
|
|
127
|
+
top: -3,
|
|
128
|
+
width: 14,
|
|
129
|
+
height: 14
|
|
125
130
|
},
|
|
126
131
|
"+.HvBaseSwitch-track": {
|
|
127
|
-
height: 14,
|
|
128
132
|
backgroundColor: uikitStyles.theme.colors.textDimmed,
|
|
129
|
-
|
|
133
|
+
border: "none",
|
|
134
|
+
width: 40,
|
|
135
|
+
height: 18
|
|
130
136
|
},
|
|
131
137
|
"&.HvBaseSwitch-checked": {
|
|
132
|
-
"& .HvBaseSwitch-thumb": {
|
|
133
|
-
border: `1px solid ${uikitStyles.theme.colors.bgContainer}`
|
|
134
|
-
},
|
|
135
138
|
"+.HvBaseSwitch-track": {
|
|
136
|
-
|
|
139
|
+
backgroundColor: uikitStyles.theme.colors.positive
|
|
140
|
+
},
|
|
141
|
+
"& .HvBaseSwitch-thumb": {
|
|
142
|
+
left: -2
|
|
137
143
|
}
|
|
138
144
|
},
|
|
139
145
|
"&.HvBaseSwitch-disabled": {
|
|
140
146
|
"& .HvBaseSwitch-thumb": {
|
|
141
|
-
|
|
142
|
-
borderColor: uikitStyles.theme.colors.borderDisabled
|
|
147
|
+
borderColor: uikitStyles.theme.colors.textDisabled
|
|
143
148
|
},
|
|
144
149
|
"+.HvBaseSwitch-track": {
|
|
145
|
-
|
|
146
|
-
|
|
150
|
+
backgroundColor: uikitStyles.theme.colors.bgDisabled,
|
|
151
|
+
border: "none"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"&[data-size=medium]": {
|
|
155
|
+
"+.HvBaseSwitch-track": {
|
|
156
|
+
width: 48,
|
|
157
|
+
height: 24
|
|
158
|
+
},
|
|
159
|
+
"& .HvBaseSwitch-thumb": {
|
|
160
|
+
left: -5,
|
|
161
|
+
top: 0,
|
|
162
|
+
width: 16,
|
|
163
|
+
height: 16
|
|
164
|
+
},
|
|
165
|
+
"&.HvBaseSwitch-checked .HvBaseSwitch-thumb": {
|
|
166
|
+
left: 3,
|
|
167
|
+
top: 0
|
|
147
168
|
}
|
|
148
169
|
}
|
|
149
170
|
}
|
|
171
|
+
},
|
|
172
|
+
readOnly: {
|
|
173
|
+
":hover": {
|
|
174
|
+
backgroundColor: "transparent"
|
|
175
|
+
},
|
|
176
|
+
"& .HvBaseSwitch-switchBase + .HvBaseSwitch-track": {
|
|
177
|
+
backgroundColor: uikitStyles.theme.colors.border
|
|
178
|
+
},
|
|
179
|
+
"& .HvBaseSwitch-switchBase.HvBaseSwitch-checked + .HvBaseSwitch-track": {
|
|
180
|
+
backgroundColor: uikitStyles.theme.mix("positive", 0.5, "dimmer")
|
|
181
|
+
}
|
|
150
182
|
}
|
|
151
183
|
}
|
|
152
184
|
},
|
|
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useState, useCallback } from "react";
|
|
3
3
|
import MuiSwitch from "@mui/material/Switch";
|
|
4
4
|
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
5
|
+
import { getColor } from "@hitachivantara/uikit-styles";
|
|
5
6
|
import { useClasses } from "./BaseSwitch.styles.js";
|
|
6
7
|
import { staticClasses } from "./BaseSwitch.styles.js";
|
|
7
8
|
const HvBaseSwitch = forwardRef(
|
|
@@ -21,9 +22,11 @@ const HvBaseSwitch = forwardRef(
|
|
|
21
22
|
inputProps,
|
|
22
23
|
onFocusVisible,
|
|
23
24
|
onBlur,
|
|
25
|
+
size = "sm",
|
|
26
|
+
color,
|
|
24
27
|
...others
|
|
25
28
|
} = useDefaultProps("HvBaseSwitch", props);
|
|
26
|
-
const { classes, cx } = useClasses(classesProp);
|
|
29
|
+
const { classes, cx, css } = useClasses(classesProp);
|
|
27
30
|
const [focusVisible, setFocusVisible] = useState(false);
|
|
28
31
|
const onFocusVisibleCallback = useCallback(
|
|
29
32
|
(evt) => {
|
|
@@ -63,7 +66,6 @@ const HvBaseSwitch = forwardRef(
|
|
|
63
66
|
},
|
|
64
67
|
className
|
|
65
68
|
),
|
|
66
|
-
color: "default",
|
|
67
69
|
disabled,
|
|
68
70
|
required,
|
|
69
71
|
readOnly,
|
|
@@ -73,15 +75,27 @@ const HvBaseSwitch = forwardRef(
|
|
|
73
75
|
defaultChecked,
|
|
74
76
|
classes: {
|
|
75
77
|
root: classes.switch,
|
|
76
|
-
switchBase: classes.switchBase,
|
|
78
|
+
switchBase: cx(classes.switchBase),
|
|
77
79
|
checked: classes.checked,
|
|
78
|
-
track:
|
|
79
|
-
|
|
80
|
+
track: cx(
|
|
81
|
+
classes.track,
|
|
82
|
+
color ? css({
|
|
83
|
+
backgroundColor: `${getColor(color, "transparent")}!important`,
|
|
84
|
+
border: "none"
|
|
85
|
+
}) : void 0
|
|
86
|
+
),
|
|
87
|
+
thumb: cx(
|
|
88
|
+
classes.thumb,
|
|
89
|
+
color ? css({
|
|
90
|
+
border: "none"
|
|
91
|
+
}) : void 0
|
|
92
|
+
),
|
|
80
93
|
disabled: classes.disabled
|
|
81
94
|
},
|
|
82
95
|
inputProps,
|
|
83
96
|
onFocusVisible: onFocusVisibleCallback,
|
|
84
97
|
onBlur: onBlurCallback,
|
|
98
|
+
"data-size": size,
|
|
85
99
|
...others
|
|
86
100
|
}
|
|
87
101
|
);
|
|
@@ -3,10 +3,10 @@ import { theme } from "@hitachivantara/uikit-styles";
|
|
|
3
3
|
import { outlineStyles } from "../utils/focusUtils.js";
|
|
4
4
|
const { staticClasses, useClasses } = createClasses("HvBaseSwitch", {
|
|
5
5
|
root: {
|
|
6
|
-
padding:
|
|
6
|
+
padding: theme.space.xs,
|
|
7
7
|
cursor: "pointer",
|
|
8
|
-
width: "
|
|
9
|
-
height: "
|
|
8
|
+
width: "fit-content",
|
|
9
|
+
height: "fit-content",
|
|
10
10
|
alignItems: "center",
|
|
11
11
|
justifyContent: "center",
|
|
12
12
|
borderRadius: theme.radii.round,
|
|
@@ -25,7 +25,7 @@ const { staticClasses, useClasses } = createClasses("HvBaseSwitch", {
|
|
|
25
25
|
backgroundColor: theme.colors.primary,
|
|
26
26
|
borderColor: "transparent"
|
|
27
27
|
},
|
|
28
|
-
"
|
|
28
|
+
"&:not($disabled) $thumb": {
|
|
29
29
|
borderColor: "transparent"
|
|
30
30
|
},
|
|
31
31
|
"&:hover": {
|
|
@@ -55,7 +55,23 @@ const { staticClasses, useClasses } = createClasses("HvBaseSwitch", {
|
|
|
55
55
|
switchBase: {
|
|
56
56
|
width: "40px",
|
|
57
57
|
height: "32px",
|
|
58
|
-
padding: 0
|
|
58
|
+
padding: 0,
|
|
59
|
+
"&[data-size=medium]": {
|
|
60
|
+
"+.HvBaseSwitch-track": {
|
|
61
|
+
width: 48,
|
|
62
|
+
height: 22
|
|
63
|
+
},
|
|
64
|
+
"& $thumb": {
|
|
65
|
+
left: -2,
|
|
66
|
+
top: 3,
|
|
67
|
+
width: 18,
|
|
68
|
+
height: 18
|
|
69
|
+
},
|
|
70
|
+
"&$checked $thumb": {
|
|
71
|
+
left: 8,
|
|
72
|
+
top: 3
|
|
73
|
+
}
|
|
74
|
+
}
|
|
59
75
|
},
|
|
60
76
|
track: {
|
|
61
77
|
opacity: 1,
|
|
@@ -67,7 +83,7 @@ const { staticClasses, useClasses } = createClasses("HvBaseSwitch", {
|
|
|
67
83
|
},
|
|
68
84
|
thumb: {
|
|
69
85
|
position: "relative",
|
|
70
|
-
left: "-
|
|
86
|
+
left: "-5px",
|
|
71
87
|
width: "10px",
|
|
72
88
|
height: "10px",
|
|
73
89
|
border: `solid 1px ${theme.colors.borderStrong}`,
|
|
@@ -6,28 +6,27 @@ const { staticClasses, useClasses } = createClasses("HvLoading", {
|
|
|
6
6
|
flexDirection: "column",
|
|
7
7
|
alignItems: "center",
|
|
8
8
|
justifyContent: "center",
|
|
9
|
-
gap: theme.space.xs
|
|
9
|
+
gap: theme.space.xs,
|
|
10
|
+
"&[data-size=small]": {
|
|
11
|
+
"--bar-size": "2px",
|
|
12
|
+
"--size": "18px",
|
|
13
|
+
"--height": "40%"
|
|
14
|
+
}
|
|
10
15
|
},
|
|
11
16
|
barContainer: {
|
|
12
17
|
display: "flex",
|
|
13
18
|
alignItems: "center",
|
|
14
19
|
justifyContent: "space-around",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
height: 30
|
|
18
|
-
},
|
|
19
|
-
":has($small)": {
|
|
20
|
-
"--height": "40%",
|
|
21
|
-
width: 18,
|
|
22
|
-
height: 18
|
|
23
|
-
}
|
|
20
|
+
width: "var(--size, 30px)",
|
|
21
|
+
height: "var(--size, 30px)"
|
|
24
22
|
},
|
|
25
23
|
loadingBar: {
|
|
26
24
|
backgroundColor: "currentcolor",
|
|
27
25
|
display: "inline-block",
|
|
28
26
|
animation: "loading 1s ease-in-out infinite",
|
|
29
27
|
// TODO: make this the default when it has better support
|
|
30
|
-
width: "round(up, 0.11em, 2px)",
|
|
28
|
+
// width: "round(up, 0.11em, 2px)",
|
|
29
|
+
width: "var(--bar-size, 4px)",
|
|
31
30
|
height: "100%",
|
|
32
31
|
"@keyframes loading": {
|
|
33
32
|
"50%": {
|
|
@@ -44,13 +43,13 @@ const { staticClasses, useClasses } = createClasses("HvLoading", {
|
|
|
44
43
|
overlay: {},
|
|
45
44
|
blur: {},
|
|
46
45
|
hidden: { display: "none" },
|
|
47
|
-
small
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
regular: {
|
|
51
|
-
|
|
52
|
-
},
|
|
46
|
+
/** @deprecated use data-size=small instead */
|
|
47
|
+
small: {},
|
|
48
|
+
/** @deprecated use data-size=regular instead */
|
|
49
|
+
regular: {},
|
|
50
|
+
/** @deprecated leverage data-size=small instead */
|
|
53
51
|
smallColor: {},
|
|
52
|
+
/** @deprecated leverage data-size=regular instead */
|
|
54
53
|
regularColor: {}
|
|
55
54
|
});
|
|
56
55
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useRef, useMemo } from "react";
|
|
3
|
-
import { useForkRef } from "@mui/material";
|
|
3
|
+
import { useForkRef } from "@mui/material/utils";
|
|
4
4
|
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
5
5
|
import { HvIcon } from "../icons.js";
|
|
6
6
|
import { changeInputValue } from "../Input/utils.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useState, useCallback, useEffect } from "react";
|
|
3
|
-
import { useTheme
|
|
3
|
+
import { useTheme } from "@mui/material/styles";
|
|
4
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
4
5
|
import { useDefaultProps, clamp } from "@hitachivantara/uikit-react-utils";
|
|
5
6
|
import { useLabels } from "../hooks/useLabels.js";
|
|
6
7
|
import { HvIcon } from "../icons.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useCallback } from "react";
|
|
3
3
|
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
4
|
-
import { getColor } from "@hitachivantara/uikit-styles";
|
|
5
4
|
import { useControlled } from "../hooks/useControlled.js";
|
|
6
5
|
import { useUniqueId } from "../hooks/useUniqueId.js";
|
|
7
6
|
import { setId } from "../utils/setId.js";
|
|
@@ -12,7 +11,6 @@ import { HvFormElement } from "../FormElement/FormElement.js";
|
|
|
12
11
|
import { HvLabel } from "../FormElement/Label/Label.js";
|
|
13
12
|
import { isInvalid } from "../FormElement/utils.js";
|
|
14
13
|
import { HvWarningText } from "../FormElement/WarningText/WarningText.js";
|
|
15
|
-
const isSemantical = (color) => ["positive", "negative", "warning"].includes(color);
|
|
16
14
|
const HvSwitch = forwardRef(
|
|
17
15
|
function HvSwitch2(props, ref) {
|
|
18
16
|
const {
|
|
@@ -36,10 +34,9 @@ const HvSwitch = forwardRef(
|
|
|
36
34
|
statusMessage,
|
|
37
35
|
"aria-errormessage": ariaErrorMessage,
|
|
38
36
|
inputProps,
|
|
39
|
-
color,
|
|
40
37
|
...others
|
|
41
38
|
} = useDefaultProps("HvSwitch", props);
|
|
42
|
-
const { classes, cx
|
|
39
|
+
const { classes, cx } = useClasses(classesProp);
|
|
43
40
|
const elementId = useUniqueId(id);
|
|
44
41
|
const [isChecked, setIsChecked] = useControlled(checked, defaultChecked);
|
|
45
42
|
const [validationState, setValidationState] = useControlled(
|
|
@@ -115,16 +112,6 @@ const HvSwitch = forwardRef(
|
|
|
115
112
|
"aria-describedby": ariaDescribedBy,
|
|
116
113
|
...inputProps
|
|
117
114
|
},
|
|
118
|
-
...color && {
|
|
119
|
-
classes: {
|
|
120
|
-
switchBase: css({
|
|
121
|
-
"&&&+.HvBaseSwitch-track,&&&.HvBaseSwitch-checked+.HvBaseSwitch-track": {
|
|
122
|
-
backgroundColor: getColor(color),
|
|
123
|
-
borderColor: isSemantical(color) ? getColor(`${color}Deep`) : "#00000032"
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
115
|
...others
|
|
129
116
|
}
|
|
130
117
|
)
|
package/dist/esm/themes/ds3.js
CHANGED
|
@@ -179,9 +179,7 @@ const ds3 = mergeTheme(ds3$1, {
|
|
|
179
179
|
HvBaseSwitch: {
|
|
180
180
|
classes: {
|
|
181
181
|
root: {
|
|
182
|
-
|
|
183
|
-
height: "16px",
|
|
184
|
-
borderRadius: 0,
|
|
182
|
+
padding: 0,
|
|
185
183
|
"&:hover": {
|
|
186
184
|
backgroundColor: "transparent"
|
|
187
185
|
},
|
|
@@ -202,7 +200,8 @@ const ds3 = mergeTheme(ds3$1, {
|
|
|
202
200
|
},
|
|
203
201
|
thumb: {
|
|
204
202
|
width: 12,
|
|
205
|
-
height: 12
|
|
203
|
+
height: 12,
|
|
204
|
+
left: -9
|
|
206
205
|
}
|
|
207
206
|
}
|
|
208
207
|
},
|
|
@@ -112,39 +112,71 @@ const pentahoPlus = mergeTheme(pentahoPlus$1, {
|
|
|
112
112
|
HvBaseSwitch: {
|
|
113
113
|
classes: {
|
|
114
114
|
root: {
|
|
115
|
-
|
|
115
|
+
padding: theme.space.xxs,
|
|
116
|
+
borderRadius: theme.radii.full,
|
|
116
117
|
"&:hover": {
|
|
117
118
|
backgroundColor: theme.colors.bgHover
|
|
118
119
|
},
|
|
119
120
|
"& .HvBaseSwitch-switchBase": {
|
|
120
121
|
"& .HvBaseSwitch-thumb": {
|
|
121
122
|
borderColor: "transparent",
|
|
122
|
-
|
|
123
|
+
backgroundColor: "#FFFFFF",
|
|
124
|
+
left: -8,
|
|
125
|
+
top: -3,
|
|
126
|
+
width: 14,
|
|
127
|
+
height: 14
|
|
123
128
|
},
|
|
124
129
|
"+.HvBaseSwitch-track": {
|
|
125
|
-
height: 14,
|
|
126
130
|
backgroundColor: theme.colors.textDimmed,
|
|
127
|
-
|
|
131
|
+
border: "none",
|
|
132
|
+
width: 40,
|
|
133
|
+
height: 18
|
|
128
134
|
},
|
|
129
135
|
"&.HvBaseSwitch-checked": {
|
|
130
|
-
"& .HvBaseSwitch-thumb": {
|
|
131
|
-
border: `1px solid ${theme.colors.bgContainer}`
|
|
132
|
-
},
|
|
133
136
|
"+.HvBaseSwitch-track": {
|
|
134
|
-
|
|
137
|
+
backgroundColor: theme.colors.positive
|
|
138
|
+
},
|
|
139
|
+
"& .HvBaseSwitch-thumb": {
|
|
140
|
+
left: -2
|
|
135
141
|
}
|
|
136
142
|
},
|
|
137
143
|
"&.HvBaseSwitch-disabled": {
|
|
138
144
|
"& .HvBaseSwitch-thumb": {
|
|
139
|
-
|
|
140
|
-
borderColor: theme.colors.borderDisabled
|
|
145
|
+
borderColor: theme.colors.textDisabled
|
|
141
146
|
},
|
|
142
147
|
"+.HvBaseSwitch-track": {
|
|
143
|
-
|
|
144
|
-
|
|
148
|
+
backgroundColor: theme.colors.bgDisabled,
|
|
149
|
+
border: "none"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"&[data-size=medium]": {
|
|
153
|
+
"+.HvBaseSwitch-track": {
|
|
154
|
+
width: 48,
|
|
155
|
+
height: 24
|
|
156
|
+
},
|
|
157
|
+
"& .HvBaseSwitch-thumb": {
|
|
158
|
+
left: -5,
|
|
159
|
+
top: 0,
|
|
160
|
+
width: 16,
|
|
161
|
+
height: 16
|
|
162
|
+
},
|
|
163
|
+
"&.HvBaseSwitch-checked .HvBaseSwitch-thumb": {
|
|
164
|
+
left: 3,
|
|
165
|
+
top: 0
|
|
145
166
|
}
|
|
146
167
|
}
|
|
147
168
|
}
|
|
169
|
+
},
|
|
170
|
+
readOnly: {
|
|
171
|
+
":hover": {
|
|
172
|
+
backgroundColor: "transparent"
|
|
173
|
+
},
|
|
174
|
+
"& .HvBaseSwitch-switchBase + .HvBaseSwitch-track": {
|
|
175
|
+
backgroundColor: theme.colors.border
|
|
176
|
+
},
|
|
177
|
+
"& .HvBaseSwitch-switchBase.HvBaseSwitch-checked + .HvBaseSwitch-track": {
|
|
178
|
+
backgroundColor: theme.mix("positive", 0.5, "dimmer")
|
|
179
|
+
}
|
|
148
180
|
}
|
|
149
181
|
}
|
|
150
182
|
},
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1794,7 +1794,7 @@ export declare const HvBaseSwitch: ForwardRefExoticComponent<Omit<HvBaseSwitchPr
|
|
|
1794
1794
|
|
|
1795
1795
|
export declare type HvBaseSwitchClasses = ExtractNames<typeof useClasses_34>;
|
|
1796
1796
|
|
|
1797
|
-
export declare interface HvBaseSwitchProps extends Omit<SwitchProps, "onChange" | "classes"> {
|
|
1797
|
+
export declare interface HvBaseSwitchProps extends Omit<SwitchProps, "onChange" | "classes" | "color"> {
|
|
1798
1798
|
/**
|
|
1799
1799
|
* Class names to be applied.
|
|
1800
1800
|
*/
|
|
@@ -1859,6 +1859,12 @@ export declare interface HvBaseSwitchProps extends Omit<SwitchProps, "onChange"
|
|
|
1859
1859
|
* @ignore
|
|
1860
1860
|
*/
|
|
1861
1861
|
onBlur?: (event: React.FocusEvent<any>) => void;
|
|
1862
|
+
/**
|
|
1863
|
+
* The size of the switch.
|
|
1864
|
+
*/
|
|
1865
|
+
size?: SwitchProps["size"];
|
|
1866
|
+
/** Color applied to the switch. */
|
|
1867
|
+
color?: HvColorAny;
|
|
1862
1868
|
}
|
|
1863
1869
|
|
|
1864
1870
|
export { HvBaseTheme }
|
|
@@ -6122,7 +6128,7 @@ export declare interface HvSwitchColumnCellProp {
|
|
|
6122
6128
|
switchProps?: HvBaseSwitchProps;
|
|
6123
6129
|
}
|
|
6124
6130
|
|
|
6125
|
-
export declare interface HvSwitchProps extends Omit<SwitchProps, "color" | "onChange" | "classes"> {
|
|
6131
|
+
export declare interface HvSwitchProps extends Omit<SwitchProps, "color" | "onChange" | "classes" | "size"> {
|
|
6126
6132
|
/**
|
|
6127
6133
|
* A Jss Object used to override or extend the styles applied to the switch.
|
|
6128
6134
|
*/
|
|
@@ -6208,6 +6214,8 @@ export declare interface HvSwitchProps extends Omit<SwitchProps, "color" | "onCh
|
|
|
6208
6214
|
component?: SwitchProps["component"];
|
|
6209
6215
|
/** Color applied to the switch. */
|
|
6210
6216
|
color?: HvColorAny;
|
|
6217
|
+
/** The size of the switch. */
|
|
6218
|
+
size?: HvBaseSwitchProps["size"];
|
|
6211
6219
|
}
|
|
6212
6220
|
|
|
6213
6221
|
export declare const HvTab: ForwardRefExoticComponent<Omit<HvTabProps, "ref"> & RefAttributes<HTMLDivElement>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.100.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Hitachi Vantara UI Kit Team",
|
|
6
6
|
"description": "UI Kit Core React components.",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@emotion/cache": "^11.11.0",
|
|
34
34
|
"@emotion/serialize": "^1.1.2",
|
|
35
|
-
"@hitachivantara/uikit-react-shared": "^5.5.
|
|
36
|
-
"@hitachivantara/uikit-react-utils": "^0.2.
|
|
37
|
-
"@hitachivantara/uikit-styles": "^5.50.
|
|
35
|
+
"@hitachivantara/uikit-react-shared": "^5.5.3",
|
|
36
|
+
"@hitachivantara/uikit-react-utils": "^0.2.43",
|
|
37
|
+
"@hitachivantara/uikit-styles": "^5.50.1",
|
|
38
38
|
"@internationalized/date": "^3.2.0",
|
|
39
39
|
"@mui/base": "5.0.0-beta.68",
|
|
40
40
|
"@popperjs/core": "^2.11.8",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"access": "public",
|
|
62
62
|
"directory": "package"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "8661e8a73c6ae39431fe12f6cc95e8eb282968e2",
|
|
65
65
|
"exports": {
|
|
66
66
|
".": {
|
|
67
67
|
"types": "./dist/types/index.d.ts",
|