@hitachivantara/uikit-react-core 5.91.1 → 5.91.2
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/BaseCheckBox/BaseCheckBox.cjs +7 -15
- package/dist/cjs/BaseCheckBox/BaseCheckBox.styles.cjs +7 -50
- package/dist/cjs/BaseCheckBox/CheckBoxIcon.cjs +78 -0
- package/dist/cjs/BaseInput/BaseInput.styles.cjs +0 -4
- package/dist/cjs/BaseRadio/BaseRadio.cjs +7 -17
- package/dist/cjs/BaseRadio/BaseRadio.styles.cjs +2 -26
- package/dist/cjs/BaseRadio/RadioIcon.cjs +54 -0
- package/dist/cjs/Dropdown/Dropdown.cjs +1 -1
- package/dist/cjs/InlineEditor/InlineEditor.cjs +1 -1
- package/dist/cjs/Tag/Tag.cjs +4 -4
- package/dist/cjs/Tag/Tag.styles.cjs +1 -2
- package/dist/cjs/TagsInput/TagsInput.cjs +1 -1
- package/dist/cjs/TreeView/internals/hooks/useInstanceEventHandler.cjs +1 -1
- package/dist/esm/AppSwitcher/Action/Action.js.map +1 -1
- package/dist/esm/BaseCheckBox/BaseCheckBox.js +7 -15
- package/dist/esm/BaseCheckBox/BaseCheckBox.js.map +1 -1
- package/dist/esm/BaseCheckBox/BaseCheckBox.styles.js +7 -50
- package/dist/esm/BaseCheckBox/BaseCheckBox.styles.js.map +1 -1
- package/dist/esm/BaseCheckBox/CheckBoxIcon.js +78 -0
- package/dist/esm/BaseCheckBox/CheckBoxIcon.js.map +1 -0
- package/dist/esm/BaseInput/BaseInput.styles.js +0 -4
- package/dist/esm/BaseInput/BaseInput.styles.js.map +1 -1
- package/dist/esm/BaseRadio/BaseRadio.js +7 -17
- package/dist/esm/BaseRadio/BaseRadio.js.map +1 -1
- package/dist/esm/BaseRadio/BaseRadio.styles.js +2 -26
- package/dist/esm/BaseRadio/BaseRadio.styles.js.map +1 -1
- package/dist/esm/BaseRadio/RadioIcon.js +54 -0
- package/dist/esm/BaseRadio/RadioIcon.js.map +1 -0
- package/dist/esm/BreadCrumb/PathElement/PathElement.js.map +1 -1
- package/dist/esm/DotPagination/DotPagination.js.map +1 -1
- package/dist/esm/DropDownMenu/DropDownMenu.js.map +1 -1
- package/dist/esm/Dropdown/Dropdown.js +1 -1
- package/dist/esm/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/FileUploader/Preview/Preview.js.map +1 -1
- package/dist/esm/Focus/Focus.js.map +1 -1
- package/dist/esm/InlineEditor/InlineEditor.js +1 -1
- package/dist/esm/InlineEditor/InlineEditor.js.map +1 -1
- package/dist/esm/MultiButton/MultiButton.js.map +1 -1
- package/dist/esm/Table/renderers/DateColumnCell.js.map +1 -1
- package/dist/esm/Table/renderers/ProgressColumnCell.js.map +1 -1
- package/dist/esm/Table/renderers/SwitchColumnCell.js.map +1 -1
- package/dist/esm/Tabs/Tab/Tab.js.map +1 -1
- package/dist/esm/Tag/Tag.js +5 -5
- package/dist/esm/Tag/Tag.js.map +1 -1
- package/dist/esm/Tag/Tag.styles.js +1 -2
- package/dist/esm/Tag/Tag.styles.js.map +1 -1
- package/dist/esm/TagsInput/TagsInput.js +1 -1
- package/dist/esm/TagsInput/TagsInput.js.map +1 -1
- package/dist/esm/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/TreeView/internals/hooks/useInstanceEventHandler.js +1 -1
- package/dist/esm/TreeView/internals/hooks/useInstanceEventHandler.js.map +1 -1
- package/dist/esm/hooks/useClickOutside.js.map +1 -1
- package/dist/esm/types/generic.js.map +1 -1
- package/dist/types/index.d.ts +29 -29
- package/package.json +9 -9
- package/dist/cjs/BaseCheckBox/icons.cjs +0 -15
- package/dist/cjs/BaseRadio/icons.cjs +0 -17
- package/dist/esm/BaseCheckBox/icons.js +0 -15
- package/dist/esm/BaseCheckBox/icons.js.map +0 -1
- package/dist/esm/BaseRadio/icons.js +0 -17
- package/dist/esm/BaseRadio/icons.js.map +0 -1
|
@@ -5,20 +5,13 @@ const React = require("react");
|
|
|
5
5
|
const MuiCheckbox = require("@mui/material/Checkbox");
|
|
6
6
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
7
7
|
const BaseCheckBox_styles = require("./BaseCheckBox.styles.cjs");
|
|
8
|
-
const
|
|
8
|
+
const CheckBoxIcon = require("./CheckBoxIcon.cjs");
|
|
9
9
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
10
|
const MuiCheckbox__default = /* @__PURE__ */ _interopDefault(MuiCheckbox);
|
|
11
|
-
const icons = {
|
|
12
|
-
checkbox: /* @__PURE__ */ jsxRuntime.jsx(icons$1.Box, {}),
|
|
13
|
-
checkboxPartial: /* @__PURE__ */ jsxRuntime.jsx(icons$1.Partial, {}),
|
|
14
|
-
checkboxChecked: /* @__PURE__ */ jsxRuntime.jsx(icons$1.Check, {})
|
|
15
|
-
};
|
|
16
11
|
const HvBaseCheckBox = React.forwardRef(function HvBaseCheckBox2(props, ref) {
|
|
17
12
|
const {
|
|
18
|
-
id,
|
|
19
13
|
classes: classesProp,
|
|
20
14
|
className,
|
|
21
|
-
name,
|
|
22
15
|
inputProps,
|
|
23
16
|
onChange,
|
|
24
17
|
onFocusVisible,
|
|
@@ -58,27 +51,26 @@ const HvBaseCheckBox = React.forwardRef(function HvBaseCheckBox2(props, ref) {
|
|
|
58
51
|
},
|
|
59
52
|
[onFocusVisible]
|
|
60
53
|
);
|
|
54
|
+
const params = { indeterminate, disabled, semantic };
|
|
61
55
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
62
56
|
MuiCheckbox__default.default,
|
|
63
57
|
{
|
|
64
58
|
ref,
|
|
65
|
-
id,
|
|
66
|
-
name,
|
|
67
59
|
value,
|
|
68
60
|
className: cx(
|
|
69
61
|
classes.root,
|
|
70
62
|
{
|
|
71
|
-
[classes.disabled]: disabled,
|
|
72
63
|
[classes.focusVisible]: focusVisible,
|
|
73
64
|
[classes.checked]: checked,
|
|
74
65
|
[classes.indeterminate]: indeterminate,
|
|
75
|
-
[classes.semantic]: semantic
|
|
66
|
+
[classes.semantic]: semantic,
|
|
67
|
+
[classes.disabled]: disabled
|
|
76
68
|
},
|
|
77
69
|
className
|
|
78
70
|
),
|
|
79
|
-
icon:
|
|
80
|
-
indeterminateIcon:
|
|
81
|
-
checkedIcon:
|
|
71
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(CheckBoxIcon.HvCheckBoxIcon, { ...params }),
|
|
72
|
+
indeterminateIcon: /* @__PURE__ */ jsxRuntime.jsx(CheckBoxIcon.HvCheckBoxIcon, { variant: "indeterminate", ...params }),
|
|
73
|
+
checkedIcon: /* @__PURE__ */ jsxRuntime.jsx(CheckBoxIcon.HvCheckBoxIcon, { variant: "checked", ...params }),
|
|
82
74
|
disabled,
|
|
83
75
|
required,
|
|
84
76
|
readOnly,
|
|
@@ -14,27 +14,13 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvBaseCheck
|
|
|
14
14
|
"&:hover": {
|
|
15
15
|
backgroundColor: uikitStyles.theme.colors.bgHover,
|
|
16
16
|
borderRadius: uikitStyles.theme.radii.round
|
|
17
|
-
},
|
|
18
|
-
"& svg": {
|
|
19
|
-
width: 16,
|
|
20
|
-
height: 16,
|
|
21
|
-
color: uikitStyles.theme.colors.bgContainer,
|
|
22
|
-
borderRadius: uikitStyles.theme.radii.base,
|
|
23
|
-
border: `1px solid ${uikitStyles.theme.colors.borderStrong}`
|
|
24
17
|
}
|
|
25
18
|
},
|
|
26
19
|
disabled: {
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
color: uikitStyles.theme.colors.bgDisabled,
|
|
32
|
-
borderColor: uikitStyles.theme.colors.borderDisabled,
|
|
33
|
-
backgroundColor: uikitStyles.theme.colors.bgDisabled
|
|
34
|
-
},
|
|
35
|
-
"&:hover": {
|
|
36
|
-
backgroundColor: "transparent"
|
|
37
|
-
}
|
|
20
|
+
cursor: "not-allowed",
|
|
21
|
+
pointerEvents: "initial",
|
|
22
|
+
"&:hover": {
|
|
23
|
+
backgroundColor: "transparent"
|
|
38
24
|
}
|
|
39
25
|
},
|
|
40
26
|
focusVisible: {
|
|
@@ -43,38 +29,9 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvBaseCheck
|
|
|
43
29
|
}
|
|
44
30
|
},
|
|
45
31
|
icon: {},
|
|
46
|
-
checked: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
backgroundColor: uikitStyles.theme.colors.primaryStrong,
|
|
50
|
-
color: uikitStyles.theme.colors.bgContainer
|
|
51
|
-
},
|
|
52
|
-
"&$disabled": {
|
|
53
|
-
"& svg": {
|
|
54
|
-
color: uikitStyles.theme.colors.textDisabled,
|
|
55
|
-
borderColor: "currentcolor"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
indeterminate: {
|
|
60
|
-
"& svg": {
|
|
61
|
-
color: uikitStyles.theme.colors.textSubtle
|
|
62
|
-
},
|
|
63
|
-
"&$disabled": {
|
|
64
|
-
"& svg": {
|
|
65
|
-
color: uikitStyles.theme.colors.textDisabled,
|
|
66
|
-
borderColor: "currentcolor"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
semantic: {
|
|
71
|
-
"&$indeterminate": {
|
|
72
|
-
"& svg": {
|
|
73
|
-
backgroundColor: uikitStyles.theme.colors.bgContainer,
|
|
74
|
-
border: `1px solid ${uikitStyles.theme.colors.borderStrong}`
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
32
|
+
checked: {},
|
|
33
|
+
indeterminate: {},
|
|
34
|
+
semantic: {}
|
|
78
35
|
});
|
|
79
36
|
exports.staticClasses = staticClasses;
|
|
80
37
|
exports.useClasses = useClasses;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
6
|
+
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
7
|
+
const { useClasses } = uikitReactUtils.createClasses("HvCheckBoxIcon", {
|
|
8
|
+
root: {
|
|
9
|
+
display: "inline-flex",
|
|
10
|
+
fill: "currentcolor",
|
|
11
|
+
width: "1em",
|
|
12
|
+
height: "1em",
|
|
13
|
+
flexShrink: 0,
|
|
14
|
+
fontSize: 16,
|
|
15
|
+
color: uikitStyles.theme.colors.bgContainer,
|
|
16
|
+
borderRadius: uikitStyles.theme.radii.base,
|
|
17
|
+
border: `1px solid ${uikitStyles.theme.colors.borderStrong}`
|
|
18
|
+
},
|
|
19
|
+
checked: {
|
|
20
|
+
borderColor: "transparent",
|
|
21
|
+
backgroundColor: uikitStyles.theme.colors.primaryStrong,
|
|
22
|
+
color: uikitStyles.theme.colors.bgContainer
|
|
23
|
+
},
|
|
24
|
+
indeterminate: {
|
|
25
|
+
color: uikitStyles.theme.colors.textSubtle
|
|
26
|
+
},
|
|
27
|
+
semantic: {
|
|
28
|
+
"&[data-variant=indeterminate]": {
|
|
29
|
+
backgroundColor: uikitStyles.theme.colors.bgContainer,
|
|
30
|
+
borderColor: uikitStyles.theme.colors.borderStrong
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
disabled: {
|
|
34
|
+
color: uikitStyles.theme.colors.bgDisabled,
|
|
35
|
+
borderColor: uikitStyles.theme.colors.borderDisabled,
|
|
36
|
+
backgroundColor: uikitStyles.theme.colors.bgDisabled,
|
|
37
|
+
"&[data-variant=checked],&[data-variant=indeterminate]": {
|
|
38
|
+
color: uikitStyles.theme.colors.textDisabled,
|
|
39
|
+
borderColor: "currentcolor"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const HvCheckBoxIcon = (props) => {
|
|
44
|
+
const {
|
|
45
|
+
className,
|
|
46
|
+
classes: classesProp,
|
|
47
|
+
variant,
|
|
48
|
+
disabled,
|
|
49
|
+
semantic
|
|
50
|
+
} = uikitReactUtils.useDefaultProps("HvCheckBoxIcon", props);
|
|
51
|
+
const { classes, cx } = useClasses(classesProp, false);
|
|
52
|
+
const d = React.useMemo(() => {
|
|
53
|
+
switch (variant) {
|
|
54
|
+
case "checked":
|
|
55
|
+
return "m5.03,12.06l-3.76,-3.75l1.42,-1.42l2.24,2.25l6.3,-7.2l1.5,1.31l-7.7,8.81z";
|
|
56
|
+
case "indeterminate":
|
|
57
|
+
return "m3,8l8,0l0,-2l-8,0l0,2z";
|
|
58
|
+
case "default":
|
|
59
|
+
default:
|
|
60
|
+
return "m0,0l16,0l0,16l-16,0l0,-16z";
|
|
61
|
+
}
|
|
62
|
+
}, [variant]);
|
|
63
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
"svg",
|
|
65
|
+
{
|
|
66
|
+
viewBox: "0 0 14 14",
|
|
67
|
+
"data-variant": variant,
|
|
68
|
+
className: cx(classes.root, className, {
|
|
69
|
+
[classes.checked]: variant === "checked",
|
|
70
|
+
[classes.indeterminate]: variant === "indeterminate",
|
|
71
|
+
[classes.semantic]: semantic,
|
|
72
|
+
[classes.disabled]: disabled
|
|
73
|
+
}),
|
|
74
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d })
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
exports.HvCheckBoxIcon = HvCheckBoxIcon;
|
|
@@ -6,10 +6,6 @@ const focusUtils = require("../utils/focusUtils.cjs");
|
|
|
6
6
|
const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvBaseInput", {
|
|
7
7
|
root: {
|
|
8
8
|
// #region `input` style reset
|
|
9
|
-
"input:-webkit-autofill": {
|
|
10
|
-
WebkitBoxShadow: `0 0 0px 1000px ${uikitStyles.theme.colors.textDimmed} inset`,
|
|
11
|
-
WebkitTextFillColor: uikitStyles.theme.colors.text
|
|
12
|
-
},
|
|
13
9
|
// Clears number input up/down arrows in Chrome and Firefox
|
|
14
10
|
"input[type=number]": {
|
|
15
11
|
MozAppearance: "textfield",
|
|
@@ -5,33 +5,25 @@ const React = require("react");
|
|
|
5
5
|
const MuiRadio = require("@mui/material/Radio");
|
|
6
6
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
7
7
|
const BaseRadio_styles = require("./BaseRadio.styles.cjs");
|
|
8
|
-
const
|
|
8
|
+
const RadioIcon = require("./RadioIcon.cjs");
|
|
9
9
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
10
|
const MuiRadio__default = /* @__PURE__ */ _interopDefault(MuiRadio);
|
|
11
|
-
const icons = {
|
|
12
|
-
radio: /* @__PURE__ */ jsxRuntime.jsx(icons$1.Unselected, {}),
|
|
13
|
-
radioChecked: /* @__PURE__ */ jsxRuntime.jsx(icons$1.Selected, {})
|
|
14
|
-
};
|
|
15
11
|
const HvBaseRadio = React.forwardRef(
|
|
16
12
|
function HvBaseRadio2(props, ref) {
|
|
17
13
|
const {
|
|
18
14
|
classes: classesProp,
|
|
19
15
|
className,
|
|
20
|
-
id,
|
|
21
|
-
name,
|
|
22
16
|
value = "on",
|
|
23
|
-
required
|
|
24
|
-
readOnly
|
|
25
|
-
disabled
|
|
17
|
+
required,
|
|
18
|
+
readOnly,
|
|
19
|
+
disabled,
|
|
26
20
|
checked,
|
|
27
21
|
defaultChecked,
|
|
28
22
|
onChange,
|
|
29
|
-
semantic
|
|
23
|
+
semantic,
|
|
30
24
|
inputProps,
|
|
31
25
|
onFocusVisible,
|
|
32
26
|
onBlur,
|
|
33
|
-
icon,
|
|
34
|
-
checkedIcon,
|
|
35
27
|
...others
|
|
36
28
|
} = uikitReactUtils.useDefaultProps("HvBaseRadio", props);
|
|
37
29
|
const { classes, cx } = BaseRadio_styles.useClasses(classesProp);
|
|
@@ -63,8 +55,6 @@ const HvBaseRadio = React.forwardRef(
|
|
|
63
55
|
MuiRadio__default.default,
|
|
64
56
|
{
|
|
65
57
|
ref,
|
|
66
|
-
id,
|
|
67
|
-
name,
|
|
68
58
|
className: cx(
|
|
69
59
|
classes.root,
|
|
70
60
|
{
|
|
@@ -75,8 +65,8 @@ const HvBaseRadio = React.forwardRef(
|
|
|
75
65
|
},
|
|
76
66
|
className
|
|
77
67
|
),
|
|
78
|
-
icon:
|
|
79
|
-
checkedIcon:
|
|
68
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(RadioIcon.HvRadioIcon, { disabled }),
|
|
69
|
+
checkedIcon: /* @__PURE__ */ jsxRuntime.jsx(RadioIcon.HvRadioIcon, { checked: true, disabled }),
|
|
80
70
|
color: "default",
|
|
81
71
|
disabled,
|
|
82
72
|
required,
|
|
@@ -11,24 +11,13 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvBaseRadio
|
|
|
11
11
|
height: 32,
|
|
12
12
|
cursor: "pointer",
|
|
13
13
|
borderRadius: "inherit",
|
|
14
|
-
"& svg": {
|
|
15
|
-
width: 16,
|
|
16
|
-
height: 16,
|
|
17
|
-
borderRadius: uikitStyles.theme.radii.full,
|
|
18
|
-
border: `1px solid ${uikitStyles.theme.colors.borderStrong}`,
|
|
19
|
-
backgroundColor: uikitStyles.theme.colors.bgContainer
|
|
20
|
-
},
|
|
21
14
|
":hover": {
|
|
22
15
|
backgroundColor: uikitStyles.theme.colors.bgHover
|
|
23
16
|
}
|
|
24
17
|
},
|
|
25
18
|
disabled: {
|
|
26
19
|
cursor: "not-allowed",
|
|
27
|
-
pointerEvents: "initial"
|
|
28
|
-
"& svg": {
|
|
29
|
-
borderColor: uikitStyles.theme.colors.textDisabled,
|
|
30
|
-
backgroundColor: uikitStyles.theme.colors.bgDisabled
|
|
31
|
-
}
|
|
20
|
+
pointerEvents: "initial"
|
|
32
21
|
},
|
|
33
22
|
focusVisible: {
|
|
34
23
|
"& svg": {
|
|
@@ -37,20 +26,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvBaseRadio
|
|
|
37
26
|
}
|
|
38
27
|
},
|
|
39
28
|
icon: {},
|
|
40
|
-
checked: {
|
|
41
|
-
"& svg": {
|
|
42
|
-
borderColor: "transparent",
|
|
43
|
-
backgroundColor: uikitStyles.theme.colors.primaryStrong,
|
|
44
|
-
color: uikitStyles.theme.colors.bgContainer
|
|
45
|
-
},
|
|
46
|
-
"&$disabled": {
|
|
47
|
-
"& svg": {
|
|
48
|
-
borderColor: "transparent",
|
|
49
|
-
backgroundColor: uikitStyles.theme.colors.borderDisabled,
|
|
50
|
-
color: uikitStyles.theme.colors.bgDisabled
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
29
|
+
checked: {},
|
|
54
30
|
semantic: {}
|
|
55
31
|
});
|
|
56
32
|
exports.staticClasses = staticClasses;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
5
|
+
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
6
|
+
const { useClasses } = uikitReactUtils.createClasses("HvRadioIcon", {
|
|
7
|
+
root: {
|
|
8
|
+
display: "inline-flex",
|
|
9
|
+
fill: "currentcolor",
|
|
10
|
+
width: "1em",
|
|
11
|
+
height: "1em",
|
|
12
|
+
flexShrink: 0,
|
|
13
|
+
fontSize: 16,
|
|
14
|
+
borderRadius: uikitStyles.theme.radii.full,
|
|
15
|
+
border: `1px solid ${uikitStyles.theme.colors.borderStrong}`,
|
|
16
|
+
backgroundColor: uikitStyles.theme.colors.bgContainer
|
|
17
|
+
},
|
|
18
|
+
checked: {
|
|
19
|
+
borderColor: "transparent",
|
|
20
|
+
backgroundColor: uikitStyles.theme.colors.primaryStrong,
|
|
21
|
+
color: uikitStyles.theme.colors.bgContainer
|
|
22
|
+
},
|
|
23
|
+
disabled: {
|
|
24
|
+
borderColor: uikitStyles.theme.colors.textDisabled,
|
|
25
|
+
backgroundColor: uikitStyles.theme.colors.bgDisabled
|
|
26
|
+
},
|
|
27
|
+
checkedDisabled: {
|
|
28
|
+
borderColor: "transparent",
|
|
29
|
+
backgroundColor: uikitStyles.theme.colors.borderDisabled,
|
|
30
|
+
color: uikitStyles.theme.colors.bgDisabled
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const HvRadioIcon = (props) => {
|
|
34
|
+
const {
|
|
35
|
+
className,
|
|
36
|
+
classes: classesProp,
|
|
37
|
+
checked,
|
|
38
|
+
disabled
|
|
39
|
+
} = uikitReactUtils.useDefaultProps("HvRadioIcon", props);
|
|
40
|
+
const { classes, cx } = useClasses(classesProp, false);
|
|
41
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
"svg",
|
|
43
|
+
{
|
|
44
|
+
viewBox: "0 0 16 16",
|
|
45
|
+
className: cx(classes.root, className, {
|
|
46
|
+
[classes.checked]: checked,
|
|
47
|
+
[classes.disabled]: disabled,
|
|
48
|
+
[classes.checkedDisabled]: checked && disabled
|
|
49
|
+
}),
|
|
50
|
+
children: checked && /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "4.5" })
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
exports.HvRadioIcon = HvRadioIcon;
|
|
@@ -101,7 +101,7 @@ const HvDropdown = generic.fixedForwardRef(function HvDropdown2(props, ref) {
|
|
|
101
101
|
utils.getSelectionLabel(labels, placeholder, multiSelect, values)
|
|
102
102
|
);
|
|
103
103
|
}, [labels, multiSelect, placeholder, values]);
|
|
104
|
-
const dropdownHeaderRef = React.useRef();
|
|
104
|
+
const dropdownHeaderRef = React.useRef(void 0);
|
|
105
105
|
const {
|
|
106
106
|
ref: refProp,
|
|
107
107
|
dropdownHeaderRef: dropdownHeaderRefProp,
|
|
@@ -35,7 +35,7 @@ const HvInlineEditor = generic.fixedForwardRef(function HvInlineEditor2(props, r
|
|
|
35
35
|
const [value, setValue] = useControlled.useControlled(valueProp, defaultValue);
|
|
36
36
|
const [editMode, setEditMode] = React.useState(false);
|
|
37
37
|
const [cachedValue, setCachedValue] = React.useState(value);
|
|
38
|
-
const inputRef = React.useRef();
|
|
38
|
+
const inputRef = React.useRef(void 0);
|
|
39
39
|
const { activeTheme } = uikitReactUtils.useTheme();
|
|
40
40
|
const [isOverflowing, setIsOverflowing] = React.useState(false);
|
|
41
41
|
const typographyStyles = activeTheme?.typography[variant] || {};
|
package/dist/cjs/Tag/Tag.cjs
CHANGED
|
@@ -5,6 +5,7 @@ const React = require("react");
|
|
|
5
5
|
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
6
6
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
7
7
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
8
|
+
const CheckBoxIcon = require("../BaseCheckBox/CheckBoxIcon.cjs");
|
|
8
9
|
const useControlled = require("../hooks/useControlled.cjs");
|
|
9
10
|
const keyboardUtils = require("../utils/keyboardUtils.cjs");
|
|
10
11
|
const Tag_styles = require("./Tag.styles.cjs");
|
|
@@ -51,7 +52,6 @@ const HvTag = React.forwardRef(function HvTag2(props, ref) {
|
|
|
51
52
|
uikitStyles.theme.palette[color]?.[600] || uikitStyles.getColor(color)
|
|
52
53
|
);
|
|
53
54
|
const isClickable = !!(onClick || onDelete || selectable);
|
|
54
|
-
const CheckboxIcon = isSelected ? uikitReactIcons.CheckboxCheck : uikitReactIcons.Checkbox;
|
|
55
55
|
const deleteIcon = deleteIconProp && React.isValidElement(deleteIconProp) ? React.cloneElement(deleteIconProp, {
|
|
56
56
|
className: cx(classes.deleteIcon, {
|
|
57
57
|
[classes.disabledDeleteIcon]: disabled
|
|
@@ -102,11 +102,11 @@ const HvTag = React.forwardRef(function HvTag2(props, ref) {
|
|
|
102
102
|
children: [
|
|
103
103
|
iconProp,
|
|
104
104
|
selectable && showSelectIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
105
|
-
|
|
105
|
+
CheckBoxIcon.HvCheckBoxIcon,
|
|
106
106
|
{
|
|
107
107
|
className: classes.icon,
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
variant: isSelected ? "checked" : "default",
|
|
109
|
+
disabled
|
|
110
110
|
}
|
|
111
111
|
),
|
|
112
112
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -77,8 +77,7 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvTag", {
|
|
|
77
77
|
},
|
|
78
78
|
// TODO: remove in favour of `hasIcon` once it's no longer needed
|
|
79
79
|
icon: {
|
|
80
|
-
|
|
81
|
-
height: 12
|
|
80
|
+
fontSize: 12
|
|
82
81
|
},
|
|
83
82
|
/** @deprecated use `root` instead */
|
|
84
83
|
chipRoot: {},
|
|
@@ -78,7 +78,7 @@ const HvTagsInput = React.forwardRef(
|
|
|
78
78
|
const inputRef = React.useRef(null);
|
|
79
79
|
const containerRef = React.useRef(null);
|
|
80
80
|
const skipReset = React.useRef(false);
|
|
81
|
-
const blurTimeout = React.useRef();
|
|
81
|
+
const blurTimeout = React.useRef(null);
|
|
82
82
|
const focusUtils = useFocus.useFocus({ containerRef });
|
|
83
83
|
const forkedContainerRef = utils.useForkRef(ref, containerRef);
|
|
84
84
|
const hasCounter = maxTagsQuantity != null && !hideCounter;
|
|
@@ -33,7 +33,7 @@ function createUseInstanceEventHandler(registryContainer2) {
|
|
|
33
33
|
new ObjectToBeRetainedByReact()
|
|
34
34
|
);
|
|
35
35
|
const subscription = React__namespace.useRef(null);
|
|
36
|
-
const handlerRef = React__namespace.useRef();
|
|
36
|
+
const handlerRef = React__namespace.useRef(void 0);
|
|
37
37
|
handlerRef.current = handler;
|
|
38
38
|
const cleanupTokenRef = React__namespace.useRef(null);
|
|
39
39
|
if (!subscription.current && handlerRef.current) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Action.js","sources":["../../../../src/AppSwitcher/Action/Action.tsx"],"sourcesContent":["import { useCallback, useState } from \"react\";\nimport { Info } from \"@hitachivantara/uikit-react-icons\";\nimport { type ExtractNames } from \"@hitachivantara/uikit-react-utils\";\nimport { getColor, HvColorAny } from \"@hitachivantara/uikit-styles\";\n\nimport { HvAvatar } from \"../../Avatar\";\nimport { useUniqueId } from \"../../hooks/useUniqueId\";\nimport { HvListItem } from \"../../ListContainer\";\nimport { HvOverflowTooltip } from \"../../OverflowTooltip\";\nimport { HvTooltip } from \"../../Tooltip\";\nimport { HvBaseProps } from \"../../types/generic\";\nimport { HvTypography } from \"../../Typography\";\nimport { staticClasses, useClasses } from \"./Action.styles\";\n\nexport { staticClasses as appSwitcherActionClasses };\n\nexport type HvAppSwitcherActionClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvAppSwitcherActionApplication {\n /** Id of the application. */\n id?: string;\n /** Name of the application, this is the value that will be displayed on the component. */\n name: string;\n /** URL with the icon location to be used to represent the application. iconUrl will only be used if no iconElement is provided. */\n iconUrl?: string;\n /** Element to be added as the icon representing the application. The iconElement will be the primary option to be displayed. */\n iconElement?: React.ReactElement
|
|
1
|
+
{"version":3,"file":"Action.js","sources":["../../../../src/AppSwitcher/Action/Action.tsx"],"sourcesContent":["import { useCallback, useState } from \"react\";\nimport { Info } from \"@hitachivantara/uikit-react-icons\";\nimport { type ExtractNames } from \"@hitachivantara/uikit-react-utils\";\nimport { getColor, HvColorAny } from \"@hitachivantara/uikit-styles\";\n\nimport { HvAvatar } from \"../../Avatar\";\nimport { useUniqueId } from \"../../hooks/useUniqueId\";\nimport { HvListItem } from \"../../ListContainer\";\nimport { HvOverflowTooltip } from \"../../OverflowTooltip\";\nimport { HvTooltip } from \"../../Tooltip\";\nimport { HvBaseProps } from \"../../types/generic\";\nimport { HvTypography } from \"../../Typography\";\nimport { staticClasses, useClasses } from \"./Action.styles\";\n\nexport { staticClasses as appSwitcherActionClasses };\n\nexport type HvAppSwitcherActionClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvAppSwitcherActionApplication {\n /** Id of the application. */\n id?: string;\n /** Name of the application, this is the value that will be displayed on the component. */\n name: string;\n /** URL with the icon location to be used to represent the application. iconUrl will only be used if no iconElement is provided. */\n iconUrl?: string;\n /** Element to be added as the icon representing the application. The iconElement will be the primary option to be displayed. */\n iconElement?: React.ReactElement<any>;\n /** Small description of the application. */\n description?: string;\n /** URL where the application is accessible. */\n url?: string;\n /** Defines if the application should be opened in the same tab or in a new one. */\n target?: \"_top\" | \"_blank\";\n /** If true, the item will be disabled. */\n disabled?: boolean;\n /** True when the application is selected, false otherwise. */\n isSelected?: boolean;\n /** The color of the application. */\n color?: HvColorAny;\n}\n\nexport interface HvAppSwitcherActionProps extends HvBaseProps {\n /** The application data to be used to render the Action object. */\n application: HvAppSwitcherActionApplication;\n /** Callback triggered when the action is clicked. */\n onClickCallback?: (\n event: React.MouseEvent,\n application: HvAppSwitcherActionApplication,\n ) => void;\n /** Must return a boolean stating if the action element is selected or not. */\n isSelectedCallback?: (application: HvAppSwitcherActionApplication) => boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvAppSwitcherActionClasses;\n}\n\nexport const HvAppSwitcherAction = ({\n id,\n className,\n classes: classesProp,\n application,\n onClickCallback = () => {},\n isSelectedCallback = () => false,\n}: HvAppSwitcherActionProps) => {\n const { classes, cx } = useClasses(classesProp);\n\n const { name, description, disabled, iconElement, iconUrl, url, target } =\n application;\n\n const color = getColor(\n disabled ? \"textDisabled\" : application?.color,\n \"text\",\n );\n\n const [validIconUrl, setValidIconUrl] = useState<boolean>(true);\n\n const renderApplicationIcon = () => {\n if (iconElement) {\n return iconElement;\n }\n\n if (iconUrl && validIconUrl) {\n return (\n <img\n className={classes.iconUrl}\n src={iconUrl}\n onError={() => {\n setValidIconUrl(false);\n }}\n alt={description}\n />\n );\n }\n\n const brokenTitle = name.split(\" \");\n const initials =\n brokenTitle[0].substring(0, 1) +\n (brokenTitle[1] ? brokenTitle[1].substring(0, 1) : \"\");\n\n return (\n <HvAvatar size=\"sm\" backgroundColor={color} variant=\"square\" aria-hidden>\n {initials}\n </HvAvatar>\n );\n };\n\n const isSelected = isSelectedCallback(application);\n\n /**\n * Handles the onClick event and triggers the appropriate callback if it exists.\n */\n const handleOnClick = useCallback(\n (event: React.MouseEvent) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n\n onClickCallback?.(event, { ...application, isSelected });\n },\n [application, disabled, isSelected, onClickCallback],\n );\n\n const isLink = url != null;\n const descriptionElementId = useUniqueId(id);\n\n return (\n <HvListItem\n id={id}\n interactive\n tabIndex={0}\n selected={isSelected}\n disabled={disabled}\n className={cx(\n classes.root,\n { [classes.disabled]: disabled, [classes.selected]: isSelected },\n className,\n )}\n >\n <HvTypography\n component=\"button\"\n className={classes.typography}\n onClick={handleOnClick}\n style={{ borderColor: color }}\n aria-label={name}\n {...(description && { \"aria-describedby\": descriptionElementId })}\n {...(isLink && { component: \"a\", href: url, target: target || \"_top\" })}\n >\n <div className={classes.icon}>{renderApplicationIcon()}</div>\n\n <HvOverflowTooltip\n paragraphOverflow\n className={classes.title}\n placement=\"top-start\"\n data={name}\n classes={{\n tooltipAnchorParagraph: classes.titleAnchor,\n }}\n />\n\n {description && (\n <HvTooltip title={description}>\n <Info className={classes.iconInfo} id={descriptionElementId} />\n </HvTooltip>\n )}\n </HvTypography>\n </HvListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAuDO,MAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA,kBAAkB,MAAM;AAAA,EAAC;AAAA,EACzB,qBAAqB,MAAM;AAC7B,MAAgC;AAC9B,QAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAExC,QAAA,EAAE,MAAM,aAAa,UAAU,aAAa,SAAS,KAAK,WAC9D;AAEF,QAAM,QAAQ;AAAA,IACZ,WAAW,iBAAiB,aAAa;AAAA,IACzC;AAAA,EACF;AAEA,QAAM,CAAC,cAAc,eAAe,IAAI,SAAkB,IAAI;AAE9D,QAAM,wBAAwB,MAAM;AAClC,QAAI,aAAa;AACR,aAAA;AAAA,IAAA;AAGT,QAAI,WAAW,cAAc;AAEzB,aAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW,QAAQ;AAAA,UACnB,KAAK;AAAA,UACL,SAAS,MAAM;AACb,4BAAgB,KAAK;AAAA,UACvB;AAAA,UACA,KAAK;AAAA,QAAA;AAAA,MACP;AAAA,IAAA;AAIE,UAAA,cAAc,KAAK,MAAM,GAAG;AAClC,UAAM,WACJ,YAAY,CAAC,EAAE,UAAU,GAAG,CAAC,KAC5B,YAAY,CAAC,IAAI,YAAY,CAAC,EAAE,UAAU,GAAG,CAAC,IAAI;AAGnD,WAAA,oBAAC,UAAS,EAAA,MAAK,MAAK,iBAAiB,OAAO,SAAQ,UAAS,eAAW,MACrE,UACH,SAAA,CAAA;AAAA,EAEJ;AAEM,QAAA,aAAa,mBAAmB,WAAW;AAKjD,QAAM,gBAAgB;AAAA,IACpB,CAAC,UAA4B;AAC3B,UAAI,UAAU;AACZ,cAAM,eAAe;AACrB;AAAA,MAAA;AAGF,wBAAkB,OAAO,EAAE,GAAG,aAAa,YAAY;AAAA,IACzD;AAAA,IACA,CAAC,aAAa,UAAU,YAAY,eAAe;AAAA,EACrD;AAEA,QAAM,SAAS,OAAO;AAChB,QAAA,uBAAuB,YAAY,EAAE;AAGzC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,aAAW;AAAA,MACX,UAAU;AAAA,MACV,UAAU;AAAA,MACV;AAAA,MACA,WAAW;AAAA,QACT,QAAQ;AAAA,QACR,EAAE,CAAC,QAAQ,QAAQ,GAAG,UAAU,CAAC,QAAQ,QAAQ,GAAG,WAAW;AAAA,QAC/D;AAAA,MACF;AAAA,MAEA,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,WAAW,QAAQ;AAAA,UACnB,SAAS;AAAA,UACT,OAAO,EAAE,aAAa,MAAM;AAAA,UAC5B,cAAY;AAAA,UACX,GAAI,eAAe,EAAE,oBAAoB,qBAAqB;AAAA,UAC9D,GAAI,UAAU,EAAE,WAAW,KAAK,MAAM,KAAK,QAAQ,UAAU,OAAO;AAAA,UAErE,UAAA;AAAA,YAAA,oBAAC,OAAI,EAAA,WAAW,QAAQ,MAAO,mCAAwB;AAAA,YAEvD;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,mBAAiB;AAAA,gBACjB,WAAW,QAAQ;AAAA,gBACnB,WAAU;AAAA,gBACV,MAAM;AAAA,gBACN,SAAS;AAAA,kBACP,wBAAwB,QAAQ;AAAA,gBAAA;AAAA,cAClC;AAAA,YACF;AAAA,YAEC,eACC,oBAAC,WAAU,EAAA,OAAO,aAChB,UAAA,oBAAC,MAAK,EAAA,WAAW,QAAQ,UAAU,IAAI,qBAAA,CAAsB,EAC/D,CAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AAEJ;"}
|
|
@@ -4,18 +4,11 @@ import MuiCheckbox from "@mui/material/Checkbox";
|
|
|
4
4
|
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
5
5
|
import { useClasses } from "./BaseCheckBox.styles.js";
|
|
6
6
|
import { staticClasses } from "./BaseCheckBox.styles.js";
|
|
7
|
-
import {
|
|
8
|
-
const icons = {
|
|
9
|
-
checkbox: /* @__PURE__ */ jsx(Box, {}),
|
|
10
|
-
checkboxPartial: /* @__PURE__ */ jsx(Partial, {}),
|
|
11
|
-
checkboxChecked: /* @__PURE__ */ jsx(Check, {})
|
|
12
|
-
};
|
|
7
|
+
import { HvCheckBoxIcon } from "./CheckBoxIcon.js";
|
|
13
8
|
const HvBaseCheckBox = forwardRef(function HvBaseCheckBox2(props, ref) {
|
|
14
9
|
const {
|
|
15
|
-
id,
|
|
16
10
|
classes: classesProp,
|
|
17
11
|
className,
|
|
18
|
-
name,
|
|
19
12
|
inputProps,
|
|
20
13
|
onChange,
|
|
21
14
|
onFocusVisible,
|
|
@@ -55,27 +48,26 @@ const HvBaseCheckBox = forwardRef(function HvBaseCheckBox2(props, ref) {
|
|
|
55
48
|
},
|
|
56
49
|
[onFocusVisible]
|
|
57
50
|
);
|
|
51
|
+
const params = { indeterminate, disabled, semantic };
|
|
58
52
|
return /* @__PURE__ */ jsx(
|
|
59
53
|
MuiCheckbox,
|
|
60
54
|
{
|
|
61
55
|
ref,
|
|
62
|
-
id,
|
|
63
|
-
name,
|
|
64
56
|
value,
|
|
65
57
|
className: cx(
|
|
66
58
|
classes.root,
|
|
67
59
|
{
|
|
68
|
-
[classes.disabled]: disabled,
|
|
69
60
|
[classes.focusVisible]: focusVisible,
|
|
70
61
|
[classes.checked]: checked,
|
|
71
62
|
[classes.indeterminate]: indeterminate,
|
|
72
|
-
[classes.semantic]: semantic
|
|
63
|
+
[classes.semantic]: semantic,
|
|
64
|
+
[classes.disabled]: disabled
|
|
73
65
|
},
|
|
74
66
|
className
|
|
75
67
|
),
|
|
76
|
-
icon:
|
|
77
|
-
indeterminateIcon:
|
|
78
|
-
checkedIcon:
|
|
68
|
+
icon: /* @__PURE__ */ jsx(HvCheckBoxIcon, { ...params }),
|
|
69
|
+
indeterminateIcon: /* @__PURE__ */ jsx(HvCheckBoxIcon, { variant: "indeterminate", ...params }),
|
|
70
|
+
checkedIcon: /* @__PURE__ */ jsx(HvCheckBoxIcon, { variant: "checked", ...params }),
|
|
79
71
|
disabled,
|
|
80
72
|
required,
|
|
81
73
|
readOnly,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCheckBox.js","sources":["../../../src/BaseCheckBox/BaseCheckBox.tsx"],"sourcesContent":["import { forwardRef, useCallback, useState } from \"react\";\nimport MuiCheckbox, {\n CheckboxProps as MuiCheckboxProps,\n} from \"@mui/material/Checkbox\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { staticClasses, useClasses } from \"./BaseCheckBox.styles\";\nimport {
|
|
1
|
+
{"version":3,"file":"BaseCheckBox.js","sources":["../../../src/BaseCheckBox/BaseCheckBox.tsx"],"sourcesContent":["import { forwardRef, useCallback, useState } from \"react\";\nimport MuiCheckbox, {\n CheckboxProps as MuiCheckboxProps,\n} from \"@mui/material/Checkbox\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { staticClasses, useClasses } from \"./BaseCheckBox.styles\";\nimport { HvCheckBoxIcon } from \"./CheckBoxIcon\";\n\nexport { staticClasses as baseCheckBoxClasses };\n\nexport type HvBaseCheckBoxClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvBaseCheckBoxProps\n extends Omit<MuiCheckboxProps, \"onChange\" | \"classes\"> {\n /**\n * The input name.\n */\n name?: string;\n /**\n * The value of the input.\n *\n * Is up to the application's logic when to consider the submission of this value.\n * Generally it should be used only when the checkbox is neither unchecked nor indeterminate.\n *\n * The default value is \"on\".\n */\n value?: any;\n /**\n * Indicates that the input is disabled.\n */\n disabled?: boolean;\n /**\n * Indicates that the input is not editable.\n */\n readOnly?: boolean;\n /**\n * Indicates that user input is required.\n */\n required?: boolean;\n /**\n * If `true` the checkbox is selected, if set to `false` the checkbox is not selected.\n *\n * When defined the checkbox state becomes controlled.\n */\n checked?: boolean;\n /**\n * When uncontrolled, defines the initial checked state.\n */\n defaultChecked?: boolean;\n /**\n * If `true` the checkbox visually shows the indeterminate state.\n */\n indeterminate?: boolean;\n /**\n * The callback fired when the checkbox is pressed.\n */\n onChange?: (\n event: React.ChangeEvent<HTMLInputElement>,\n checked: boolean,\n value: any,\n ) => void;\n /**\n * Whether the selector should use semantic colors.\n */\n semantic?: boolean;\n /**\n * Properties passed on to the input element.\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /**\n * Callback fired when the component is focused with a keyboard.\n * We trigger a `onFocus` callback too.\n */\n onFocusVisible?: (event: React.FocusEvent<any>) => void;\n /**\n * Callback fired when the component is blurred.\n */\n onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;\n /**\n * A Jss Object used to override or extend the styles applied to the checkbox.\n */\n classes?: HvBaseCheckBoxClasses;\n}\n\n/**\n * A Checkbox is a mechanism that allows user to select one or more options.\n *\n * The Base Checkbox is a building block of the Checkbox form element. Don't use unless\n * implementing a custom use case not covered by the Checkbox form element.\n */\nexport const HvBaseCheckBox = forwardRef<\n HTMLButtonElement,\n HvBaseCheckBoxProps\n>(function HvBaseCheckBox(props, ref) {\n const {\n classes: classesProp,\n className,\n inputProps,\n onChange,\n onFocusVisible,\n onBlur,\n checked,\n indeterminate,\n defaultChecked,\n value = \"on\",\n required = false,\n readOnly = false,\n disabled = false,\n semantic = false,\n ...others\n } = useDefaultProps(\"HvBaseCheckBox\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const [focusVisible, setFocusVisible] = useState<boolean>(false);\n\n const onChangeCallback = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n if (readOnly) {\n return;\n }\n\n onChange?.(event, event.target.checked, value);\n },\n [onChange, readOnly, value],\n );\n\n const onBlurCallback = useCallback(\n (event: React.FocusEvent<HTMLButtonElement>) => {\n setFocusVisible(false);\n onBlur?.(event);\n },\n [onBlur],\n );\n\n const onFocusVisibleCallback = useCallback(\n (event: React.FocusEvent<any>) => {\n setFocusVisible(true);\n onFocusVisible?.(event);\n },\n [onFocusVisible],\n );\n\n const params = { indeterminate, disabled, semantic };\n\n return (\n <MuiCheckbox\n ref={ref}\n value={value}\n className={cx(\n classes.root,\n {\n [classes.focusVisible]: focusVisible,\n [classes.checked]: checked,\n [classes.indeterminate]: indeterminate,\n [classes.semantic]: semantic,\n [classes.disabled]: disabled,\n },\n className,\n )}\n icon={<HvCheckBoxIcon {...params} />}\n indeterminateIcon={<HvCheckBoxIcon variant=\"indeterminate\" {...params} />}\n checkedIcon={<HvCheckBoxIcon variant=\"checked\" {...params} />}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n checked={checked}\n defaultChecked={defaultChecked}\n indeterminate={indeterminate}\n inputProps={inputProps}\n onChange={onChangeCallback}\n onFocusVisible={onFocusVisibleCallback}\n onBlur={onBlurCallback}\n color=\"default\"\n {...others}\n />\n );\n});\n"],"names":["HvBaseCheckBox"],"mappings":";;;;;;;AA8FO,MAAM,iBAAiB,WAG5B,SAASA,gBAAe,OAAO,KAAK;AAC9B,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,WAAW;AAAA,IACX,WAAW;AAAA,IACX,WAAW;AAAA,IACX,GAAG;AAAA,EAAA,IACD,gBAAgB,kBAAkB,KAAK;AAE3C,QAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAE9C,QAAM,CAAC,cAAc,eAAe,IAAI,SAAkB,KAAK;AAE/D,QAAM,mBAAmB;AAAA,IACvB,CAAC,UAA+C;AAC9C,UAAI,UAAU;AACZ;AAAA,MAAA;AAGF,iBAAW,OAAO,MAAM,OAAO,SAAS,KAAK;AAAA,IAC/C;AAAA,IACA,CAAC,UAAU,UAAU,KAAK;AAAA,EAC5B;AAEA,QAAM,iBAAiB;AAAA,IACrB,CAAC,UAA+C;AAC9C,sBAAgB,KAAK;AACrB,eAAS,KAAK;AAAA,IAChB;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AAEA,QAAM,yBAAyB;AAAA,IAC7B,CAAC,UAAiC;AAChC,sBAAgB,IAAI;AACpB,uBAAiB,KAAK;AAAA,IACxB;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,QAAM,SAAS,EAAE,eAAe,UAAU,SAAS;AAGjD,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACT,QAAQ;AAAA,QACR;AAAA,UACE,CAAC,QAAQ,YAAY,GAAG;AAAA,UACxB,CAAC,QAAQ,OAAO,GAAG;AAAA,UACnB,CAAC,QAAQ,aAAa,GAAG;AAAA,UACzB,CAAC,QAAQ,QAAQ,GAAG;AAAA,UACpB,CAAC,QAAQ,QAAQ,GAAG;AAAA,QACtB;AAAA,QACA;AAAA,MACF;AAAA,MACA,MAAM,oBAAC,gBAAgB,EAAA,GAAG,OAAQ,CAAA;AAAA,MAClC,mBAAoB,oBAAA,gBAAA,EAAe,SAAQ,iBAAiB,GAAG,QAAQ;AAAA,MACvE,aAAc,oBAAA,gBAAA,EAAe,SAAQ,WAAW,GAAG,QAAQ;AAAA,MAC3D;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,gBAAgB;AAAA,MAChB,QAAQ;AAAA,MACR,OAAM;AAAA,MACL,GAAG;AAAA,IAAA;AAAA,EACN;AAEJ,CAAC;"}
|