@hitachivantara/uikit-react-core 5.91.0 → 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 +5 -29
- package/dist/cjs/BaseRadio/RadioIcon.cjs +54 -0
- package/dist/cjs/Button/Button.styles.cjs +2 -2
- package/dist/cjs/DotPagination/DotPagination.styles.cjs +3 -2
- package/dist/cjs/Dropdown/Dropdown.cjs +1 -1
- package/dist/cjs/Focus/Focus.cjs +10 -25
- package/dist/cjs/Focus/Focus.styles.cjs +0 -17
- package/dist/cjs/InlineEditor/InlineEditor.cjs +2 -2
- 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 +5 -29
- 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/Button/Button.styles.js +2 -2
- package/dist/esm/Button/Button.styles.js.map +1 -1
- package/dist/esm/DotPagination/DotPagination.js.map +1 -1
- package/dist/esm/DotPagination/DotPagination.styles.js +3 -2
- package/dist/esm/DotPagination/DotPagination.styles.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 +10 -25
- package/dist/esm/Focus/Focus.js.map +1 -1
- package/dist/esm/Focus/Focus.styles.js +0 -17
- package/dist/esm/Focus/Focus.styles.js.map +1 -1
- package/dist/esm/InlineEditor/InlineEditor.js +2 -2
- 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 +33 -35
- package/package.json +9 -9
- package/dist/cjs/BaseCheckBox/icons.cjs +0 -15
- package/dist/cjs/BaseRadio/icons.cjs +0 -17
- package/dist/cjs/utils/ConditionalWrapper.cjs +0 -8
- 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
- package/dist/esm/utils/ConditionalWrapper.js +0 -8
- package/dist/esm/utils/ConditionalWrapper.js.map +0 -1
|
@@ -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"],"m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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;"}
|
|
@@ -12,27 +12,13 @@ const { staticClasses, useClasses } = createClasses("HvBaseCheckBox", {
|
|
|
12
12
|
"&:hover": {
|
|
13
13
|
backgroundColor: theme.colors.bgHover,
|
|
14
14
|
borderRadius: theme.radii.round
|
|
15
|
-
},
|
|
16
|
-
"& svg": {
|
|
17
|
-
width: 16,
|
|
18
|
-
height: 16,
|
|
19
|
-
color: theme.colors.bgContainer,
|
|
20
|
-
borderRadius: theme.radii.base,
|
|
21
|
-
border: `1px solid ${theme.colors.borderStrong}`
|
|
22
15
|
}
|
|
23
16
|
},
|
|
24
17
|
disabled: {
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
color: theme.colors.bgDisabled,
|
|
30
|
-
borderColor: theme.colors.borderDisabled,
|
|
31
|
-
backgroundColor: theme.colors.bgDisabled
|
|
32
|
-
},
|
|
33
|
-
"&:hover": {
|
|
34
|
-
backgroundColor: "transparent"
|
|
35
|
-
}
|
|
18
|
+
cursor: "not-allowed",
|
|
19
|
+
pointerEvents: "initial",
|
|
20
|
+
"&:hover": {
|
|
21
|
+
backgroundColor: "transparent"
|
|
36
22
|
}
|
|
37
23
|
},
|
|
38
24
|
focusVisible: {
|
|
@@ -41,38 +27,9 @@ const { staticClasses, useClasses } = createClasses("HvBaseCheckBox", {
|
|
|
41
27
|
}
|
|
42
28
|
},
|
|
43
29
|
icon: {},
|
|
44
|
-
checked: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
backgroundColor: theme.colors.primaryStrong,
|
|
48
|
-
color: theme.colors.bgContainer
|
|
49
|
-
},
|
|
50
|
-
"&$disabled": {
|
|
51
|
-
"& svg": {
|
|
52
|
-
color: theme.colors.textDisabled,
|
|
53
|
-
borderColor: "currentcolor"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
indeterminate: {
|
|
58
|
-
"& svg": {
|
|
59
|
-
color: theme.colors.textSubtle
|
|
60
|
-
},
|
|
61
|
-
"&$disabled": {
|
|
62
|
-
"& svg": {
|
|
63
|
-
color: theme.colors.textDisabled,
|
|
64
|
-
borderColor: "currentcolor"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
semantic: {
|
|
69
|
-
"&$indeterminate": {
|
|
70
|
-
"& svg": {
|
|
71
|
-
backgroundColor: theme.colors.bgContainer,
|
|
72
|
-
border: `1px solid ${theme.colors.borderStrong}`
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
30
|
+
checked: {},
|
|
31
|
+
indeterminate: {},
|
|
32
|
+
semantic: {}
|
|
76
33
|
});
|
|
77
34
|
export {
|
|
78
35
|
staticClasses,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCheckBox.styles.js","sources":["../../../src/BaseCheckBox/BaseCheckBox.styles.ts"],"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(\"HvBaseCheckBox\", {\n root: {\n padding: 0,\n width: 32,\n minWidth: 32,\n height: 32,\n borderRadius: theme.radii.base,\n cursor: \"pointer\",\n \"&:hover\": {\n backgroundColor: theme.colors.bgHover,\n borderRadius: theme.radii.round,\n },\n
|
|
1
|
+
{"version":3,"file":"BaseCheckBox.styles.js","sources":["../../../src/BaseCheckBox/BaseCheckBox.styles.ts"],"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(\"HvBaseCheckBox\", {\n root: {\n padding: 0,\n width: 32,\n minWidth: 32,\n height: 32,\n borderRadius: theme.radii.base,\n cursor: \"pointer\",\n \"&:hover\": {\n backgroundColor: theme.colors.bgHover,\n borderRadius: theme.radii.round,\n },\n },\n disabled: {\n cursor: \"not-allowed\",\n pointerEvents: \"initial\",\n \"&:hover\": {\n backgroundColor: \"transparent\",\n },\n },\n focusVisible: {\n \"& svg\": {\n ...outlineStyles,\n },\n },\n icon: {},\n checked: {},\n indeterminate: {},\n semantic: {},\n});\n"],"names":[],"mappings":";;;AAKO,MAAM,EAAE,eAAe,eAAe,cAAc,kBAAkB;AAAA,EAC3E,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,cAAc,MAAM,MAAM;AAAA,IAC1B,QAAQ;AAAA,IACR,WAAW;AAAA,MACT,iBAAiB,MAAM,OAAO;AAAA,MAC9B,cAAc,MAAM,MAAM;AAAA,IAAA;AAAA,EAE9B;AAAA,EACA,UAAU;AAAA,IACR,QAAQ;AAAA,IACR,eAAe;AAAA,IACf,WAAW;AAAA,MACT,iBAAiB;AAAA,IAAA;AAAA,EAErB;AAAA,EACA,cAAc;AAAA,IACZ,SAAS;AAAA,MACP,GAAG;AAAA,IAAA;AAAA,EAEP;AAAA,EACA,MAAM,CAAC;AAAA,EACP,SAAS,CAAC;AAAA,EACV,eAAe,CAAC;AAAA,EAChB,UAAU,CAAA;AACZ,CAAC;"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useDefaultProps, createClasses } from "@hitachivantara/uikit-react-utils";
|
|
4
|
+
import { theme } from "@hitachivantara/uikit-styles";
|
|
5
|
+
const { useClasses } = createClasses("HvCheckBoxIcon", {
|
|
6
|
+
root: {
|
|
7
|
+
display: "inline-flex",
|
|
8
|
+
fill: "currentcolor",
|
|
9
|
+
width: "1em",
|
|
10
|
+
height: "1em",
|
|
11
|
+
flexShrink: 0,
|
|
12
|
+
fontSize: 16,
|
|
13
|
+
color: theme.colors.bgContainer,
|
|
14
|
+
borderRadius: theme.radii.base,
|
|
15
|
+
border: `1px solid ${theme.colors.borderStrong}`
|
|
16
|
+
},
|
|
17
|
+
checked: {
|
|
18
|
+
borderColor: "transparent",
|
|
19
|
+
backgroundColor: theme.colors.primaryStrong,
|
|
20
|
+
color: theme.colors.bgContainer
|
|
21
|
+
},
|
|
22
|
+
indeterminate: {
|
|
23
|
+
color: theme.colors.textSubtle
|
|
24
|
+
},
|
|
25
|
+
semantic: {
|
|
26
|
+
"&[data-variant=indeterminate]": {
|
|
27
|
+
backgroundColor: theme.colors.bgContainer,
|
|
28
|
+
borderColor: theme.colors.borderStrong
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
disabled: {
|
|
32
|
+
color: theme.colors.bgDisabled,
|
|
33
|
+
borderColor: theme.colors.borderDisabled,
|
|
34
|
+
backgroundColor: theme.colors.bgDisabled,
|
|
35
|
+
"&[data-variant=checked],&[data-variant=indeterminate]": {
|
|
36
|
+
color: theme.colors.textDisabled,
|
|
37
|
+
borderColor: "currentcolor"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const HvCheckBoxIcon = (props) => {
|
|
42
|
+
const {
|
|
43
|
+
className,
|
|
44
|
+
classes: classesProp,
|
|
45
|
+
variant,
|
|
46
|
+
disabled,
|
|
47
|
+
semantic
|
|
48
|
+
} = useDefaultProps("HvCheckBoxIcon", props);
|
|
49
|
+
const { classes, cx } = useClasses(classesProp, false);
|
|
50
|
+
const d = useMemo(() => {
|
|
51
|
+
switch (variant) {
|
|
52
|
+
case "checked":
|
|
53
|
+
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";
|
|
54
|
+
case "indeterminate":
|
|
55
|
+
return "m3,8l8,0l0,-2l-8,0l0,2z";
|
|
56
|
+
case "default":
|
|
57
|
+
default:
|
|
58
|
+
return "m0,0l16,0l0,16l-16,0l0,-16z";
|
|
59
|
+
}
|
|
60
|
+
}, [variant]);
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"svg",
|
|
63
|
+
{
|
|
64
|
+
viewBox: "0 0 14 14",
|
|
65
|
+
"data-variant": variant,
|
|
66
|
+
className: cx(classes.root, className, {
|
|
67
|
+
[classes.checked]: variant === "checked",
|
|
68
|
+
[classes.indeterminate]: variant === "indeterminate",
|
|
69
|
+
[classes.semantic]: semantic,
|
|
70
|
+
[classes.disabled]: disabled
|
|
71
|
+
}),
|
|
72
|
+
children: /* @__PURE__ */ jsx("path", { d })
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
HvCheckBoxIcon
|
|
78
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckBoxIcon.js","sources":["../../../src/BaseCheckBox/CheckBoxIcon.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport {\n createClasses,\n ExtractNames,\n useDefaultProps,\n} from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport type { HvBaseCheckBoxProps } from \"./BaseCheckBox\";\n\nconst { useClasses } = createClasses(\"HvCheckBoxIcon\", {\n root: {\n display: \"inline-flex\",\n fill: \"currentcolor\",\n width: \"1em\",\n height: \"1em\",\n flexShrink: 0,\n\n fontSize: 16,\n color: theme.colors.bgContainer,\n borderRadius: theme.radii.base,\n border: `1px solid ${theme.colors.borderStrong}`,\n },\n checked: {\n borderColor: \"transparent\",\n backgroundColor: theme.colors.primaryStrong,\n color: theme.colors.bgContainer,\n },\n indeterminate: {\n color: theme.colors.textSubtle,\n },\n semantic: {\n \"&[data-variant=indeterminate]\": {\n backgroundColor: theme.colors.bgContainer,\n borderColor: theme.colors.borderStrong,\n },\n },\n disabled: {\n color: theme.colors.bgDisabled,\n borderColor: theme.colors.borderDisabled,\n backgroundColor: theme.colors.bgDisabled,\n \"&[data-variant=checked],&[data-variant=indeterminate]\": {\n color: theme.colors.textDisabled,\n borderColor: \"currentcolor\",\n },\n },\n});\n\nexport type HvCheckBoxIconClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvCheckBoxIconProps\n extends Pick<HvBaseCheckBoxProps, \"className\" | \"disabled\" | \"semantic\"> {\n variant?: \"default\" | \"checked\" | \"indeterminate\";\n classes?: HvCheckBoxIconClasses;\n}\n\nexport const HvCheckBoxIcon = (props: HvCheckBoxIconProps) => {\n const {\n className,\n classes: classesProp,\n variant,\n disabled,\n semantic,\n } = useDefaultProps(\"HvCheckBoxIcon\", props);\n const { classes, cx } = useClasses(classesProp, false);\n\n const d = useMemo(() => {\n switch (variant) {\n case \"checked\":\n 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\";\n case \"indeterminate\":\n return \"m3,8l8,0l0,-2l-8,0l0,2z\";\n case \"default\":\n default:\n return \"m0,0l16,0l0,16l-16,0l0,-16z\";\n }\n }, [variant]);\n\n return (\n <svg\n viewBox=\"0 0 14 14\"\n data-variant={variant}\n className={cx(classes.root, className, {\n [classes.checked]: variant === \"checked\",\n [classes.indeterminate]: variant === \"indeterminate\",\n [classes.semantic]: semantic,\n [classes.disabled]: disabled,\n })}\n >\n <path d={d} />\n </svg>\n );\n};\n"],"names":[],"mappings":";;;;AAUA,MAAM,EAAE,WAAA,IAAe,cAAc,kBAAkB;AAAA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AAQ,MAAM,WAAW;AAAA,QACrC,CAAC,QAAQ,OAAO,GAAG,YAAY;AAAA,QAC/B,CAAC,QAAQ,aAAa,GAAG,YAAY;AAAA,QACrC,CAAC,QAAQ,QAAQ,GAAG;AAAA,QACpB,CAAC,QAAQ,QAAQ,GAAG;AAAA,MAAA,CACrB;AAAA,MAED,UAAA,oBAAC,UAAK,EAAM,CAAA;AAAA,IAAA;AAAA,EACd;AAEJ;"}
|
|
@@ -4,10 +4,6 @@ import { outlineStyles } from "../utils/focusUtils.js";
|
|
|
4
4
|
const { staticClasses, useClasses } = createClasses("HvBaseInput", {
|
|
5
5
|
root: {
|
|
6
6
|
// #region `input` style reset
|
|
7
|
-
"input:-webkit-autofill": {
|
|
8
|
-
WebkitBoxShadow: `0 0 0px 1000px ${theme.colors.textDimmed} inset`,
|
|
9
|
-
WebkitTextFillColor: theme.colors.text
|
|
10
|
-
},
|
|
11
7
|
// Clears number input up/down arrows in Chrome and Firefox
|
|
12
8
|
"input[type=number]": {
|
|
13
9
|
MozAppearance: "textfield",
|
|
@@ -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 // #region `input` style reset\n
|
|
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 // #region `input` style reset\n // Clears number input up/down arrows in Chrome and Firefox\n \"input[type=number]\": {\n MozAppearance: \"textfield\",\n \"&::-webkit-outer-spin-button,&::-webkit-inner-spin-button\": {\n WebkitAppearance: \"none\",\n margin: 0,\n },\n },\n\n // Clears time input clock in Chrome\n \"input::-webkit-calendar-picker-indicator\": {\n display: \"none\",\n },\n\n // Clears search input clear button in Chrome\n \"input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration\":\n {\n display: \"none\",\n },\n // #endregion\n\n display: \"inline-flex\",\n width: \"100%\",\n position: \"relative\",\n margin: 0,\n borderRadius: theme.radii.base,\n height: \"32px\",\n borderWidth: 1,\n borderColor: theme.colors.text,\n boxSizing: \"border-box\",\n backgroundColor: theme.colors.bgContainer,\n fontFamily: theme.fontFamily.body,\n\n \":hover:not($disabled,$invalid,$readOnly)\": {\n borderColor: theme.colors.primary,\n },\n \":focus-within:not($disabled)\": {\n ...outlineStyles,\n },\n },\n disabled: {\n backgroundColor: theme.colors.bgPage,\n borderColor: theme.colors.textDisabled,\n\n cursor: \"not-allowed\",\n\n \"&&::before\": {\n borderBottomStyle: \"none\",\n },\n },\n invalid: {\n borderColor: theme.form.errorColor,\n },\n multiline: {\n padding: 0,\n overflow: \"auto\",\n height: \"auto\",\n\n \"& $input\": {\n borderRadius: theme.radii.base,\n height: \"auto\",\n minHeight: \"21px\",\n padding: \"5px 10px\",\n overflow: \"auto\",\n margin: 0,\n },\n },\n resizable: { width: \"auto\" },\n readOnly: {\n borderColor: theme.colors.textDisabled,\n backgroundColor: theme.colors.bgPage,\n },\n focused: {},\n /** @deprecated unused. use `::after` instead */\n inputBorderContainer: {},\n /** @deprecated use `classes.invalid` instead */\n inputRootInvalid: {},\n /** @deprecated use `classes.readOnly` instead */\n inputRootReadOnly: {},\n /** @deprecated use `classes.root` instead */\n inputRoot: {},\n /** @deprecated unused */\n inputRootFocused: {},\n /** @deprecated use `classes.disabled` instead */\n inputRootDisabled: {},\n /** @deprecated use `classes.multiline` instead */\n inputRootMultiline: {},\n input: {\n height: \"100%\",\n marginLeft: theme.space.xs,\n marginRight: theme.space.xs,\n padding: 0,\n backgroundColor: \"transparent\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n outline: \"none\",\n width: \"initial\",\n flexGrow: 1,\n ...theme.typography.body,\n\n \"&::placeholder\": {\n opacity: 1,\n color: theme.colors.textSubtle,\n },\n },\n inputDisabled: {\n color: theme.colors.textDisabled,\n WebkitTextFillColor: theme.colors.textDisabled,\n },\n inputReadOnly: {\n color: theme.colors.textSubtle,\n },\n inputResizable: {\n resize: \"both\",\n width: \"100%\",\n },\n});\n"],"names":[],"mappings":";;;AAKO,MAAM,EAAE,eAAe,eAAe,cAAc,eAAe;AAAA,EACxE,MAAM;AAAA;AAAA;AAAA,IAGJ,sBAAsB;AAAA,MACpB,eAAe;AAAA,MACf,6DAA6D;AAAA,QAC3D,kBAAkB;AAAA,QAClB,QAAQ;AAAA,MAAA;AAAA,IAEZ;AAAA;AAAA,IAGA,4CAA4C;AAAA,MAC1C,SAAS;AAAA,IACX;AAAA;AAAA,IAGA,0MACE;AAAA,MACE,SAAS;AAAA,IACX;AAAA;AAAA,IAGF,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,cAAc,MAAM,MAAM;AAAA,IAC1B,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,aAAa,MAAM,OAAO;AAAA,IAC1B,WAAW;AAAA,IACX,iBAAiB,MAAM,OAAO;AAAA,IAC9B,YAAY,MAAM,WAAW;AAAA,IAE7B,4CAA4C;AAAA,MAC1C,aAAa,MAAM,OAAO;AAAA,IAC5B;AAAA,IACA,gCAAgC;AAAA,MAC9B,GAAG;AAAA,IAAA;AAAA,EAEP;AAAA,EACA,UAAU;AAAA,IACR,iBAAiB,MAAM,OAAO;AAAA,IAC9B,aAAa,MAAM,OAAO;AAAA,IAE1B,QAAQ;AAAA,IAER,cAAc;AAAA,MACZ,mBAAmB;AAAA,IAAA;AAAA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;AAEX,CAAC;"}
|
|
@@ -4,31 +4,23 @@ import MuiRadio from "@mui/material/Radio";
|
|
|
4
4
|
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
5
5
|
import { useClasses } from "./BaseRadio.styles.js";
|
|
6
6
|
import { staticClasses } from "./BaseRadio.styles.js";
|
|
7
|
-
import {
|
|
8
|
-
const icons = {
|
|
9
|
-
radio: /* @__PURE__ */ jsx(Unselected, {}),
|
|
10
|
-
radioChecked: /* @__PURE__ */ jsx(Selected, {})
|
|
11
|
-
};
|
|
7
|
+
import { HvRadioIcon } from "./RadioIcon.js";
|
|
12
8
|
const HvBaseRadio = forwardRef(
|
|
13
9
|
function HvBaseRadio2(props, ref) {
|
|
14
10
|
const {
|
|
15
11
|
classes: classesProp,
|
|
16
12
|
className,
|
|
17
|
-
id,
|
|
18
|
-
name,
|
|
19
13
|
value = "on",
|
|
20
|
-
required
|
|
21
|
-
readOnly
|
|
22
|
-
disabled
|
|
14
|
+
required,
|
|
15
|
+
readOnly,
|
|
16
|
+
disabled,
|
|
23
17
|
checked,
|
|
24
18
|
defaultChecked,
|
|
25
19
|
onChange,
|
|
26
|
-
semantic
|
|
20
|
+
semantic,
|
|
27
21
|
inputProps,
|
|
28
22
|
onFocusVisible,
|
|
29
23
|
onBlur,
|
|
30
|
-
icon,
|
|
31
|
-
checkedIcon,
|
|
32
24
|
...others
|
|
33
25
|
} = useDefaultProps("HvBaseRadio", props);
|
|
34
26
|
const { classes, cx } = useClasses(classesProp);
|
|
@@ -60,8 +52,6 @@ const HvBaseRadio = forwardRef(
|
|
|
60
52
|
MuiRadio,
|
|
61
53
|
{
|
|
62
54
|
ref,
|
|
63
|
-
id,
|
|
64
|
-
name,
|
|
65
55
|
className: cx(
|
|
66
56
|
classes.root,
|
|
67
57
|
{
|
|
@@ -72,8 +62,8 @@ const HvBaseRadio = forwardRef(
|
|
|
72
62
|
},
|
|
73
63
|
className
|
|
74
64
|
),
|
|
75
|
-
icon:
|
|
76
|
-
checkedIcon:
|
|
65
|
+
icon: /* @__PURE__ */ jsx(HvRadioIcon, { disabled }),
|
|
66
|
+
checkedIcon: /* @__PURE__ */ jsx(HvRadioIcon, { checked: true, disabled }),
|
|
77
67
|
color: "default",
|
|
78
68
|
disabled,
|
|
79
69
|
required,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseRadio.js","sources":["../../../src/BaseRadio/BaseRadio.tsx"],"sourcesContent":["import { forwardRef, useCallback, useState } from \"react\";\nimport MuiRadio, { RadioProps as MuiRadioProps } from \"@mui/material/Radio\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { staticClasses, useClasses } from \"./BaseRadio.styles\";\nimport {
|
|
1
|
+
{"version":3,"file":"BaseRadio.js","sources":["../../../src/BaseRadio/BaseRadio.tsx"],"sourcesContent":["import { forwardRef, useCallback, useState } from \"react\";\nimport MuiRadio, { RadioProps as MuiRadioProps } from \"@mui/material/Radio\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { staticClasses, useClasses } from \"./BaseRadio.styles\";\nimport { HvRadioIcon } from \"./RadioIcon\";\n\nexport { staticClasses as baseRadioClasses };\n\nexport type HvBaseRadioClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvBaseRadioProps\n extends Omit<MuiRadioProps, \"onChange\" | \"classes\"> {\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * A Jss Object used to override or extend the styles applied to the radio button.\n */\n classes?: HvBaseRadioClasses;\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * The input name.\n */\n name?: string;\n /**\n * The value of the input.\n *\n * The default value is \"on\".\n */\n value?: any;\n /**\n * Indicates that user input is required.\n */\n required?: boolean;\n /**\n * Indicates that the input is not editable.\n */\n readOnly?: boolean;\n /**\n * Indicates that the input is disabled.\n */\n disabled?: boolean;\n /**\n * If `true` the radio button is selected, if set to `false` the radio button is not selected.\n *\n * When defined the radio button state becomes controlled.\n */\n checked?: boolean;\n /**\n * When uncontrolled, defines the initial checked state.\n */\n defaultChecked?: boolean;\n /**\n * The callback fired when the radio button 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 * @ignore\n */\n onBlur?: (event: React.FocusEvent<any>) => void;\n}\n\n/**\n * A Radio Button is a mechanism that allows user to select one or more options.\n *\n * The Base Radio Button is a building block of the Radio Button form element. Don't\n * use unless implementing a custom use case not covered by the Radio Button form element.\n */\nexport const HvBaseRadio = forwardRef<HTMLButtonElement, HvBaseRadioProps>(\n function HvBaseRadio(props, ref) {\n const {\n classes: classesProp,\n className,\n value = \"on\",\n required,\n readOnly,\n disabled,\n checked,\n defaultChecked,\n onChange,\n semantic,\n inputProps,\n onFocusVisible,\n onBlur,\n ...others\n } = useDefaultProps(\"HvBaseRadio\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const [focusVisible, setFocusVisible] = useState(false);\n\n const onFocusVisibleCallback = useCallback(\n (evt: React.FocusEvent<any>) => {\n setFocusVisible(true);\n onFocusVisible?.(evt);\n },\n [onFocusVisible],\n );\n\n const onBlurCallback = useCallback(\n (evt: React.FocusEvent<any>) => {\n setFocusVisible(false);\n onBlur?.(evt);\n },\n [onBlur],\n );\n\n const onLocalChange = useCallback(\n (evt: React.ChangeEvent<HTMLInputElement>) => {\n if (readOnly) {\n return;\n }\n\n onChange?.(evt, evt.target.checked, value);\n },\n [onChange, readOnly, value],\n );\n\n return (\n <MuiRadio\n ref={ref}\n className={cx(\n classes.root,\n {\n [classes.disabled]: disabled,\n [classes.focusVisible]: focusVisible,\n [classes.checked]: checked,\n [classes.semantic]: semantic,\n },\n className,\n )}\n icon={<HvRadioIcon disabled={disabled} />}\n checkedIcon={<HvRadioIcon checked disabled={disabled} />}\n color=\"default\"\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n onChange={onLocalChange}\n value={value}\n checked={checked}\n defaultChecked={defaultChecked}\n inputProps={inputProps}\n onFocusVisible={onFocusVisibleCallback}\n onBlur={onBlurCallback}\n {...others}\n />\n );\n },\n);\n"],"names":["HvBaseRadio"],"mappings":";;;;;;;AA6FO,MAAM,cAAc;AAAA,EACzB,SAASA,aAAY,OAAO,KAAK;AACzB,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA,IACD,gBAAgB,eAAe,KAAK;AAExC,UAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAE9C,UAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AAEtD,UAAM,yBAAyB;AAAA,MAC7B,CAAC,QAA+B;AAC9B,wBAAgB,IAAI;AACpB,yBAAiB,GAAG;AAAA,MACtB;AAAA,MACA,CAAC,cAAc;AAAA,IACjB;AAEA,UAAM,iBAAiB;AAAA,MACrB,CAAC,QAA+B;AAC9B,wBAAgB,KAAK;AACrB,iBAAS,GAAG;AAAA,MACd;AAAA,MACA,CAAC,MAAM;AAAA,IACT;AAEA,UAAM,gBAAgB;AAAA,MACpB,CAAC,QAA6C;AAC5C,YAAI,UAAU;AACZ;AAAA,QAAA;AAGF,mBAAW,KAAK,IAAI,OAAO,SAAS,KAAK;AAAA,MAC3C;AAAA,MACA,CAAC,UAAU,UAAU,KAAK;AAAA,IAC5B;AAGE,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT,QAAQ;AAAA,UACR;AAAA,YACE,CAAC,QAAQ,QAAQ,GAAG;AAAA,YACpB,CAAC,QAAQ,YAAY,GAAG;AAAA,YACxB,CAAC,QAAQ,OAAO,GAAG;AAAA,YACnB,CAAC,QAAQ,QAAQ,GAAG;AAAA,UACtB;AAAA,UACA;AAAA,QACF;AAAA,QACA,MAAO,oBAAA,aAAA,EAAY,SAAoB,CAAA;AAAA,QACvC,aAAa,oBAAC,aAAY,EAAA,SAAO,MAAC,UAAoB;AAAA,QACtD,OAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,gBAAgB;AAAA,QAChB,QAAQ;AAAA,QACP,GAAG;AAAA,MAAA;AAAA,IACN;AAAA,EAAA;AAGN;"}
|
|
@@ -8,25 +8,14 @@ const { staticClasses, useClasses } = createClasses("HvBaseRadio", {
|
|
|
8
8
|
minWidth: 32,
|
|
9
9
|
height: 32,
|
|
10
10
|
cursor: "pointer",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
borderRadius: theme.radii.full,
|
|
15
|
-
border: `1px solid ${theme.colors.borderStrong}`,
|
|
16
|
-
backgroundColor: theme.colors.bgContainer
|
|
17
|
-
},
|
|
18
|
-
"&:hover": {
|
|
19
|
-
backgroundColor: theme.colors.bgHover,
|
|
20
|
-
borderRadius: theme.radii.round
|
|
11
|
+
borderRadius: "inherit",
|
|
12
|
+
":hover": {
|
|
13
|
+
backgroundColor: theme.colors.bgHover
|
|
21
14
|
}
|
|
22
15
|
},
|
|
23
16
|
disabled: {
|
|
24
17
|
cursor: "not-allowed",
|
|
25
|
-
pointerEvents: "initial"
|
|
26
|
-
"& svg": {
|
|
27
|
-
borderColor: theme.colors.textDisabled,
|
|
28
|
-
backgroundColor: theme.colors.bgDisabled
|
|
29
|
-
}
|
|
18
|
+
pointerEvents: "initial"
|
|
30
19
|
},
|
|
31
20
|
focusVisible: {
|
|
32
21
|
"& svg": {
|
|
@@ -35,20 +24,7 @@ const { staticClasses, useClasses } = createClasses("HvBaseRadio", {
|
|
|
35
24
|
}
|
|
36
25
|
},
|
|
37
26
|
icon: {},
|
|
38
|
-
checked: {
|
|
39
|
-
"& svg": {
|
|
40
|
-
borderColor: "transparent",
|
|
41
|
-
backgroundColor: theme.colors.primaryStrong,
|
|
42
|
-
color: theme.colors.bgContainer
|
|
43
|
-
},
|
|
44
|
-
"&$disabled": {
|
|
45
|
-
"& svg": {
|
|
46
|
-
borderColor: "transparent",
|
|
47
|
-
backgroundColor: theme.colors.borderDisabled,
|
|
48
|
-
color: theme.colors.bgDisabled
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
27
|
+
checked: {},
|
|
52
28
|
semantic: {}
|
|
53
29
|
});
|
|
54
30
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseRadio.styles.js","sources":["../../../src/BaseRadio/BaseRadio.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(\"HvBaseRadio\", {\n root: {\n padding: 0,\n width: 32,\n minWidth: 32,\n height: 32,\n cursor: \"pointer\",\n \"
|
|
1
|
+
{"version":3,"file":"BaseRadio.styles.js","sources":["../../../src/BaseRadio/BaseRadio.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(\"HvBaseRadio\", {\n root: {\n padding: 0,\n width: 32,\n minWidth: 32,\n height: 32,\n cursor: \"pointer\",\n borderRadius: \"inherit\",\n \":hover\": {\n backgroundColor: theme.colors.bgHover,\n },\n },\n disabled: {\n cursor: \"not-allowed\",\n pointerEvents: \"initial\",\n },\n focusVisible: {\n \"& svg\": {\n borderRadius: theme.radii.full,\n ...outlineStyles,\n },\n },\n icon: {},\n checked: {},\n semantic: {},\n});\n"],"names":[],"mappings":";;;AAKO,MAAM,EAAE,eAAe,eAAe,cAAc,eAAe;AAAA,EACxE,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,UAAU;AAAA,MACR,iBAAiB,MAAM,OAAO;AAAA,IAAA;AAAA,EAElC;AAAA,EACA,UAAU;AAAA,IACR,QAAQ;AAAA,IACR,eAAe;AAAA,EACjB;AAAA,EACA,cAAc;AAAA,IACZ,SAAS;AAAA,MACP,cAAc,MAAM,MAAM;AAAA,MAC1B,GAAG;AAAA,IAAA;AAAA,EAEP;AAAA,EACA,MAAM,CAAC;AAAA,EACP,SAAS,CAAC;AAAA,EACV,UAAU,CAAA;AACZ,CAAC;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useDefaultProps, createClasses } from "@hitachivantara/uikit-react-utils";
|
|
3
|
+
import { theme } from "@hitachivantara/uikit-styles";
|
|
4
|
+
const { useClasses } = createClasses("HvRadioIcon", {
|
|
5
|
+
root: {
|
|
6
|
+
display: "inline-flex",
|
|
7
|
+
fill: "currentcolor",
|
|
8
|
+
width: "1em",
|
|
9
|
+
height: "1em",
|
|
10
|
+
flexShrink: 0,
|
|
11
|
+
fontSize: 16,
|
|
12
|
+
borderRadius: theme.radii.full,
|
|
13
|
+
border: `1px solid ${theme.colors.borderStrong}`,
|
|
14
|
+
backgroundColor: theme.colors.bgContainer
|
|
15
|
+
},
|
|
16
|
+
checked: {
|
|
17
|
+
borderColor: "transparent",
|
|
18
|
+
backgroundColor: theme.colors.primaryStrong,
|
|
19
|
+
color: theme.colors.bgContainer
|
|
20
|
+
},
|
|
21
|
+
disabled: {
|
|
22
|
+
borderColor: theme.colors.textDisabled,
|
|
23
|
+
backgroundColor: theme.colors.bgDisabled
|
|
24
|
+
},
|
|
25
|
+
checkedDisabled: {
|
|
26
|
+
borderColor: "transparent",
|
|
27
|
+
backgroundColor: theme.colors.borderDisabled,
|
|
28
|
+
color: theme.colors.bgDisabled
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const HvRadioIcon = (props) => {
|
|
32
|
+
const {
|
|
33
|
+
className,
|
|
34
|
+
classes: classesProp,
|
|
35
|
+
checked,
|
|
36
|
+
disabled
|
|
37
|
+
} = useDefaultProps("HvRadioIcon", props);
|
|
38
|
+
const { classes, cx } = useClasses(classesProp, false);
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
"svg",
|
|
41
|
+
{
|
|
42
|
+
viewBox: "0 0 16 16",
|
|
43
|
+
className: cx(classes.root, className, {
|
|
44
|
+
[classes.checked]: checked,
|
|
45
|
+
[classes.disabled]: disabled,
|
|
46
|
+
[classes.checkedDisabled]: checked && disabled
|
|
47
|
+
}),
|
|
48
|
+
children: checked && /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "4.5" })
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
HvRadioIcon
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioIcon.js","sources":["../../../src/BaseRadio/RadioIcon.tsx"],"sourcesContent":["import {\n createClasses,\n ExtractNames,\n useDefaultProps,\n} from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport type { HvBaseRadioProps } from \"./BaseRadio\";\n\nconst { useClasses } = createClasses(\"HvRadioIcon\", {\n root: {\n display: \"inline-flex\",\n fill: \"currentcolor\",\n width: \"1em\",\n height: \"1em\",\n flexShrink: 0,\n\n fontSize: 16,\n borderRadius: theme.radii.full,\n border: `1px solid ${theme.colors.borderStrong}`,\n backgroundColor: theme.colors.bgContainer,\n },\n checked: {\n borderColor: \"transparent\",\n backgroundColor: theme.colors.primaryStrong,\n color: theme.colors.bgContainer,\n },\n disabled: {\n borderColor: theme.colors.textDisabled,\n backgroundColor: theme.colors.bgDisabled,\n },\n checkedDisabled: {\n borderColor: \"transparent\",\n backgroundColor: theme.colors.borderDisabled,\n color: theme.colors.bgDisabled,\n },\n});\n\nexport type HvRadioIconClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvRadioIconProps\n extends Pick<HvBaseRadioProps, \"checked\" | \"disabled\" | \"className\"> {\n classes?: HvRadioIconClasses;\n}\n\nexport const HvRadioIcon = (props: HvRadioIconProps) => {\n const {\n className,\n classes: classesProp,\n checked,\n disabled,\n } = useDefaultProps(\"HvRadioIcon\", props);\n const { classes, cx } = useClasses(classesProp, false);\n\n return (\n <svg\n viewBox=\"0 0 16 16\"\n className={cx(classes.root, className, {\n [classes.checked]: checked,\n [classes.disabled]: disabled,\n [classes.checkedDisabled]: checked && disabled,\n })}\n >\n {checked && <circle cx=\"8\" cy=\"8\" r=\"4.5\" />}\n </svg>\n );\n};\n"],"names":[],"mappings":";;;AASA,MAAM,EAAE,WAAA,IAAe,cAAc,eAAe;AAAA,EAClD,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,YAAY;AAAA,IAEZ,UAAU;AAAA,IACV,cAAc,MAAM,MAAM;AAAA,IAC1B,QAAQ,aAAa,MAAM,OAAO,YAAY;AAAA,IAC9C,iBAAiB,MAAM,OAAO;AAAA,EAChC;AAAA,EACA,SAAS;AAAA,IACP,aAAa;AAAA,IACb,iBAAiB,MAAM,OAAO;AAAA,IAC9B,OAAO,MAAM,OAAO;AAAA,EACtB;AAAA,EACA,UAAU;AAAA,IACR,aAAa,MAAM,OAAO;AAAA,IAC1B,iBAAiB,MAAM,OAAO;AAAA,EAChC;AAAA,EACA,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,iBAAiB,MAAM,OAAO;AAAA,IAC9B,OAAO,MAAM,OAAO;AAAA,EAAA;AAExB,CAAC;AASY,MAAA,cAAc,CAAC,UAA4B;AAChD,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EAAA,IACE,gBAAgB,eAAe,KAAK;AACxC,QAAM,EAAE,SAAS,GAAA,IAAO,WAAW,aAAa,KAAK;AAGnD,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,WAAW,GAAG,QAAQ,MAAM,WAAW;AAAA,QACrC,CAAC,QAAQ,OAAO,GAAG;AAAA,QACnB,CAAC,QAAQ,QAAQ,GAAG;AAAA,QACpB,CAAC,QAAQ,eAAe,GAAG,WAAW;AAAA,MAAA,CACvC;AAAA,MAEA,UAAA,+BAAY,UAAO,EAAA,IAAG,KAAI,IAAG,KAAI,GAAE,MAAM,CAAA;AAAA,IAAA;AAAA,EAC5C;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathElement.js","sources":["../../../../src/BreadCrumb/PathElement/PathElement.tsx"],"sourcesContent":["import { DropRightXS } from \"@hitachivantara/uikit-react-icons\";\nimport { type ExtractNames } from \"@hitachivantara/uikit-react-utils\";\n\nimport { staticClasses, useClasses } from \"./PathElement.styles\";\n\nexport { staticClasses as pathElementClasses };\n\nexport type HvPathElementClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvPathElementProps {\n last?: boolean;\n classes?: HvPathElementClasses;\n children: React.ReactElement
|
|
1
|
+
{"version":3,"file":"PathElement.js","sources":["../../../../src/BreadCrumb/PathElement/PathElement.tsx"],"sourcesContent":["import { DropRightXS } from \"@hitachivantara/uikit-react-icons\";\nimport { type ExtractNames } from \"@hitachivantara/uikit-react-utils\";\n\nimport { staticClasses, useClasses } from \"./PathElement.styles\";\n\nexport { staticClasses as pathElementClasses };\n\nexport type HvPathElementClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvPathElementProps {\n last?: boolean;\n classes?: HvPathElementClasses;\n children: React.ReactElement<any>;\n}\n\nexport const HvPathElement = ({\n classes: classesProp,\n last = false,\n children,\n}: HvPathElementProps) => {\n const { classes } = useClasses(classesProp);\n\n return (\n <li className={classes.centerContainer}>\n {children}\n {!last && (\n <DropRightXS\n className={classes.separatorContainer}\n color=\"textDisabled\"\n />\n )}\n </li>\n );\n};\n"],"names":[],"mappings":";;;;AAeO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,SAAS;AAAA,EACT,OAAO;AAAA,EACP;AACF,MAA0B;AACxB,QAAM,EAAE,QAAA,IAAY,WAAW,WAAW;AAE1C,SACG,qBAAA,MAAA,EAAG,WAAW,QAAQ,iBACpB,UAAA;AAAA,IAAA;AAAA,IACA,CAAC,QACA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,QAAQ;AAAA,QACnB,OAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EACR,GAEJ;AAEJ;"}
|
|
@@ -68,10 +68,10 @@ const { staticClasses, useClasses } = createClasses("HvButton", {
|
|
|
68
68
|
backgroundColor: "var(--color)",
|
|
69
69
|
":where(:not($disabled))": {
|
|
70
70
|
":hover, :focus-visible": {
|
|
71
|
-
backgroundColor:
|
|
71
|
+
backgroundColor: theme.mix("var(--color)", 0.8, "black")
|
|
72
72
|
},
|
|
73
73
|
":active": {
|
|
74
|
-
backgroundColor:
|
|
74
|
+
backgroundColor: theme.mix("var(--color)", 0.7, "black")
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.styles.js","sources":["../../../src/Button/Button.styles.ts"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme, type HvSize } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"../utils/focusUtils\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvButton\", {\n /** applied to the root element */\n root: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n textTransform: \"none\",\n cursor: \"pointer\",\n whiteSpace: \"nowrap\",\n\n // Background color common for almost all variants\n \":where(:not($disabled))\": {\n \":hover, :focus-visible\": {\n backgroundColor: theme.colors.bgHover,\n },\n },\n \":focus-visible\": {\n ...outlineStyles,\n },\n\n // Default button - no size specified\n fontFamily: theme.fontFamily.body,\n ...theme.typography.label,\n color: \"var(--color, currentcolor)\",\n backgroundColor: \"transparent\",\n height: \"var(--HvButton-height, fit-content)\",\n border: \"1px solid transparent\",\n borderRadius: `var(--radius, ${theme.radii.base})`,\n padding: theme.spacing(0, \"sm\"),\n\n \"& $startIcon, & $endIcon\": {\n flexShrink: 0,\n lineHeight: 0,\n marginTop: -1,\n marginBottom: -1,\n },\n },\n /** applied to the _left_ icon container */\n startIcon: {\n marginLeft: theme.spacing(-1),\n },\n /** applied to the _right_ icon container */\n endIcon: {\n marginRight: theme.spacing(-1),\n },\n focusVisible: {},\n /** applied to the root element when disabled */\n disabled: {\n cursor: \"not-allowed\",\n color: theme.colors.textDisabled,\n backgroundColor: \"transparent\",\n borderColor: \"transparent\",\n \":hover, :focus-visible\": {\n backgroundColor: \"transparent\",\n borderColor: \"transparent\",\n },\n },\n /** applied to the root element when is icon-only */\n icon: {\n margin: 0,\n padding: 0,\n width: \"var(--HvButton-height, fit-content)\",\n },\n /** applied to the root element when using the `contained` variant */\n contained: {\n color: theme.colors.textDimmed, // `color-contrast(var(--color) vs ${colors.textDimmed}, ${colors.textLight}, ${colors.textDark})`,\n backgroundColor: \"var(--color)\",\n \":where(:not($disabled))\": {\n \":hover, :focus-visible\": {\n backgroundColor: \"
|
|
1
|
+
{"version":3,"file":"Button.styles.js","sources":["../../../src/Button/Button.styles.ts"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme, type HvSize } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"../utils/focusUtils\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvButton\", {\n /** applied to the root element */\n root: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n textTransform: \"none\",\n cursor: \"pointer\",\n whiteSpace: \"nowrap\",\n\n // Background color common for almost all variants\n \":where(:not($disabled))\": {\n \":hover, :focus-visible\": {\n backgroundColor: theme.colors.bgHover,\n },\n },\n \":focus-visible\": {\n ...outlineStyles,\n },\n\n // Default button - no size specified\n fontFamily: theme.fontFamily.body,\n ...theme.typography.label,\n color: \"var(--color, currentcolor)\",\n backgroundColor: \"transparent\",\n height: \"var(--HvButton-height, fit-content)\",\n border: \"1px solid transparent\",\n borderRadius: `var(--radius, ${theme.radii.base})`,\n padding: theme.spacing(0, \"sm\"),\n\n \"& $startIcon, & $endIcon\": {\n flexShrink: 0,\n lineHeight: 0,\n marginTop: -1,\n marginBottom: -1,\n },\n },\n /** applied to the _left_ icon container */\n startIcon: {\n marginLeft: theme.spacing(-1),\n },\n /** applied to the _right_ icon container */\n endIcon: {\n marginRight: theme.spacing(-1),\n },\n focusVisible: {},\n /** applied to the root element when disabled */\n disabled: {\n cursor: \"not-allowed\",\n color: theme.colors.textDisabled,\n backgroundColor: \"transparent\",\n borderColor: \"transparent\",\n \":hover, :focus-visible\": {\n backgroundColor: \"transparent\",\n borderColor: \"transparent\",\n },\n },\n /** applied to the root element when is icon-only */\n icon: {\n margin: 0,\n padding: 0,\n width: \"var(--HvButton-height, fit-content)\",\n },\n /** applied to the root element when using the `contained` variant */\n contained: {\n color: theme.colors.textDimmed, // `color-contrast(var(--color) vs ${colors.textDimmed}, ${colors.textLight}, ${colors.textDark})`,\n backgroundColor: \"var(--color)\",\n \":where(:not($disabled))\": {\n \":hover, :focus-visible\": {\n backgroundColor: theme.mix(\"var(--color)\", 0.8, \"black\"),\n },\n \":active\": {\n backgroundColor: theme.mix(\"var(--color)\", 0.7, \"black\"),\n },\n },\n },\n /** applied to the root element when using the `subtle` variant */\n subtle: {\n borderColor: \"currentcolor\",\n },\n /** applied to the root element when using the `ghost` variant */\n ghost: {},\n /** applied to the root element when using the `semantic` variant */\n semantic: {\n color: theme.colors.textDark,\n backgroundColor: \"transparent\",\n borderColor: \"transparent\",\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.alpha(\"textLight\", 0.3),\n },\n \"&:active\": {\n backgroundColor: theme.alpha(\"textLight\", 0.5),\n },\n \"&$disabled\": {\n backgroundColor: theme.alpha(\"textLight\", 0.1),\n },\n },\n\n // TODO - remove in v6\n primary: {},\n primarySubtle: {},\n primaryGhost: {},\n secondarySubtle: {},\n secondaryGhost: {},\n\n // Deprecated (DS3)\n secondary: {},\n});\n\n// TODO - remove xs and xl in v6 since they are not DS spec\nconst sizes: Record<\n HvSize,\n { height: string; space?: HvSize; fontSize?: keyof typeof theme.fontSizes }\n> = {\n xs: { height: \"24px\", fontSize: \"sm\" },\n sm: { height: \"24px\", fontSize: \"sm\" },\n md: { height: \"32px\" },\n lg: { height: \"48px\", space: \"md\" },\n xl: { height: \"48px\", space: \"md\" },\n};\n\nexport const getSizeStyles = (size: HvSize) => {\n const { height, space = \"sm\", fontSize } = sizes[size];\n return {\n height,\n padding: theme.spacing(0, space),\n fontSize: fontSize && theme.fontSizes[fontSize],\n };\n};\n\nexport const getIconSizeStyles = (size: HvSize) => {\n const { height } = sizes[size];\n return {\n height,\n width: height,\n };\n};\n"],"names":[],"mappings":";;;AAKO,MAAM,EAAE,eAAe,eAAe,cAAc,YAAY;AAAA;AAAA,EAErE,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,eAAe;AAAA,IACf,QAAQ;AAAA,IACR,YAAY;AAAA;AAAA,IAGZ,2BAA2B;AAAA,MACzB,0BAA0B;AAAA,QACxB,iBAAiB,MAAM,OAAO;AAAA,MAAA;AAAA,IAElC;AAAA,IACA,kBAAkB;AAAA,MAChB,GAAG;AAAA,IACL;AAAA;AAAA,IAGA,YAAY,MAAM,WA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AA,IACb,4BAA4B;AAAA,MAC1B,iBAAiB,MAAM,MAAM,aAAa,GAAG;AAAA,IAC/C;AAAA,IACA,YAAY;AAAA,MACV,iBAAiB,MAAM,MAAM,aAAa,GAAG;AAAA,IAC/C;AAAA,IACA,cAAc;AAAA,MACZ,iBAAiB,MAAM,MAAM,aAAa,GAAG;AAAA,IAAA;AAAA,EAEjD;AAAA;AAAA,EAGA,SAAS,CAAC;AAAA,EACV,eAAe,CAAC;AAAA,EAChB,cAAc,CAAC;AAAA,EACf,iBAAiB,CAAC;AAAA,EAClB,gBAAgB,CAAC;AAAA;AAAA,EAGjB,WAAW,CAAA;AACb,CAAC;AAGD,MAAM,QAGF;AAAA,EACF,IAAI,EAAE,QAAQ,QAAQ,UAAU,KAAK;AAAA,EACrC,IAAI,EAAE,QAAQ,QAAQ,UAAU,KAAK;AAAA,EACrC,IAAI,EAAE,QAAQ,OAAO;AAAA,EACrB,IAAI,EAAE,QAAQ,QAAQ,OAAO,KAAK;AAAA,EAClC,IAAI,EAAE,QAAQ,QAAQ,OAAO,KAAK;AACpC;AAEa,MAAA,gBAAgB,CAAC,SAAiB;AAC7C,QAAM,EAAE,QAAQ,QAAQ,MAAM,SAAS,IAAI,MAAM,IAAI;AAC9C,SAAA;AAAA,IACL;AAAA,IACA,SAAS,MAAM,QAAQ,GAAG,KAAK;AAAA,IAC/B,UAAU,YAAY,MAAM,UAAU,QAAQ;AAAA,EAChD;AACF;AAEa,MAAA,oBAAoB,CAAC,SAAiB;AACjD,QAAM,EAAE,OAAA,IAAW,MAAM,IAAI;AACtB,SAAA;AAAA,IACL;AAAA,IACA,OAAO;AAAA,EACT;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DotPagination.js","sources":["../../../src/DotPagination/DotPagination.tsx"],"sourcesContent":["import { cloneElement } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseRadio } from \"../BaseRadio\";\nimport { HvRadioGroup, HvRadioGroupProps } from \"../RadioGroup\";\nimport { range } from \"../utils/helpers\";\nimport { staticClasses, useClasses } from \"./DotPagination.styles\";\n\nconst currentStep = (\n <div style={{ fontSize: 8 }}>\n <div />\n </div>\n);\n\nconst otherStep = (\n <div style={{ fontSize: 4 }}>\n <div />\n </div>\n);\n\nexport { staticClasses as dotPaginationClasses };\n\nexport type HvDotPaginationClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDotPaginationProps\n extends Omit<HvRadioGroupProps, \"classes\"> {\n /**\n * Icon to override the default one used for the unselected state.\n *\n * The default icon is `OtherStep`.\n */\n unselectedIcon?: React.ReactElement
|
|
1
|
+
{"version":3,"file":"DotPagination.js","sources":["../../../src/DotPagination/DotPagination.tsx"],"sourcesContent":["import { cloneElement } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseRadio } from \"../BaseRadio\";\nimport { HvRadioGroup, HvRadioGroupProps } from \"../RadioGroup\";\nimport { range } from \"../utils/helpers\";\nimport { staticClasses, useClasses } from \"./DotPagination.styles\";\n\nconst currentStep = (\n <div style={{ fontSize: 8 }}>\n <div />\n </div>\n);\n\nconst otherStep = (\n <div style={{ fontSize: 4 }}>\n <div />\n </div>\n);\n\nexport { staticClasses as dotPaginationClasses };\n\nexport type HvDotPaginationClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDotPaginationProps\n extends Omit<HvRadioGroupProps, \"classes\"> {\n /**\n * Icon to override the default one used for the unselected state.\n *\n * The default icon is `OtherStep`.\n */\n unselectedIcon?: React.ReactElement<any>;\n /**\n * Icon to override the default one used for the selected state.\n *\n * The default icon is `CurrentStep`.\n */\n selectedIcon?: React.ReactElement<any>;\n /**\n * The number of pages the component has.\n */\n pages?: number;\n /**\n * The currently selected page.\n */\n page?: number;\n /**\n * The callback fired when the page value changes.\n */\n onPageChange?: (\n event: React.ChangeEvent<HTMLInputElement>,\n page: number,\n ) => void;\n /**\n * The callback fired to get the page aria label.\n */\n getItemAriaLabel?: (page: number) => string;\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes?: HvDotPaginationClasses;\n}\n\nconst getSelectorIcons = (\n radioIcon?: React.ReactElement<any>,\n radioCheckedIcon?: React.ReactElement<any>,\n classes?: HvDotPaginationClasses,\n) => {\n return {\n radio: cloneElement(radioIcon || otherStep, {\n className: classes?.icon,\n }),\n radioChecked: cloneElement(radioCheckedIcon || currentStep, {\n className: classes?.icon,\n }),\n };\n};\n\n/**\n * Pagination is the process of dividing a document into discrete pages. It relates to how users interact with structured content on a website or application.\n * This component uses Radio Buttons to represent each page.\n */\nexport const HvDotPagination = (props: HvDotPaginationProps) => {\n const {\n className,\n classes: classesProp,\n unselectedIcon,\n selectedIcon,\n pages = 1,\n page = 0,\n onPageChange,\n getItemAriaLabel,\n ...others\n } = useDefaultProps(\"HvDotPagination\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const icons = getSelectorIcons(unselectedIcon, selectedIcon, classes);\n\n return (\n <HvRadioGroup\n className={cx(classes.root, className)}\n classes={{\n horizontal: classes.horizontal,\n }}\n orientation=\"horizontal\"\n {...others}\n >\n {range(pages).map((i) => (\n <HvBaseRadio\n className={cx(classes.radioRoot, classes.radio)}\n key={i}\n value={i}\n checked={page === i}\n onChange={(event) => onPageChange?.(event, i)}\n icon={icons.radio}\n checkedIcon={icons.radioChecked}\n inputProps={{ \"aria-label\": getItemAriaLabel?.(i) }}\n />\n ))}\n </HvRadioGroup>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAWA,MAAM,cACH,oBAAA,OAAA,EAAI,OAAO,EAAE,UAAU,EAAE,GACxB,UAAC,oBAAA,OAAA,CAAA,CAAI,EACP,CAAA;AAGF,MAAM,YACH,oBAAA,OAAA,EAAI,OAAO,EAAE,UAAU,EAAE,GACxB,UAAC,oBAAA,OAAA,CAAA,CAAI,EACP,CAAA;AA8CF,MAAM,mBAAmB,CACvB,WACA,kBAC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