@navikt/ds-react 8.9.0 → 8.9.1
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/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.d.ts +1 -0
- package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js +5 -3
- package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js.map +1 -1
- package/cjs/data/drag-and-drop/item/DragAndDropItem.d.ts +4 -0
- package/cjs/data/drag-and-drop/item/DragAndDropItem.js +3 -7
- package/cjs/data/drag-and-drop/item/DragAndDropItem.js.map +1 -1
- package/cjs/data/drag-and-drop/root/DragAndDrop.context.d.ts +2 -1
- package/cjs/data/drag-and-drop/root/DragAndDrop.context.js.map +1 -1
- package/cjs/data/drag-and-drop/root/DragAndDropRoot.d.ts +12 -10
- package/cjs/data/drag-and-drop/root/DragAndDropRoot.js +71 -39
- package/cjs/data/drag-and-drop/root/DragAndDropRoot.js.map +1 -1
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.d.ts +3 -3
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.js +4 -4
- package/cjs/data/table/helpers/selection/getMultipleSelectProps.js.map +1 -1
- package/cjs/data/table/helpers/selection/getSingleSelectProps.d.ts +2 -2
- package/cjs/data/table/helpers/selection/getSingleSelectProps.js +4 -1
- package/cjs/data/table/helpers/selection/getSingleSelectProps.js.map +1 -1
- package/cjs/data/table/helpers/selection/selection.types.d.ts +5 -5
- package/cjs/data/table/root/DataTableAuto.js +9 -11
- package/cjs/data/table/root/DataTableAuto.js.map +1 -1
- package/cjs/data/table/td/DataTableTd.d.ts +4 -0
- package/cjs/data/table/td/DataTableTd.js +4 -2
- package/cjs/data/table/td/DataTableTd.js.map +1 -1
- package/cjs/data/table/th/DataTableTh.d.ts +4 -0
- package/cjs/data/table/th/DataTableTh.js +6 -3
- package/cjs/data/table/th/DataTableTh.js.map +1 -1
- package/cjs/data/token-filter/FilterChip.d.ts +10 -0
- package/cjs/data/token-filter/FilterChip.js +65 -0
- package/cjs/data/token-filter/FilterChip.js.map +1 -0
- package/cjs/data/token-filter/TokenFilter.js +3 -10
- package/cjs/data/token-filter/TokenFilter.js.map +1 -1
- package/cjs/form/checkbox/Checkbox.js +19 -33
- package/cjs/form/checkbox/Checkbox.js.map +1 -1
- package/cjs/form/checkbox/checkbox-input/CheckboxInput.d.ts +21 -0
- package/cjs/form/checkbox/checkbox-input/CheckboxInput.js +65 -0
- package/cjs/form/checkbox/checkbox-input/CheckboxInput.js.map +1 -0
- package/cjs/form/checkbox/types.d.ts +1 -1
- package/cjs/form/fieldset/Fieldset.js +2 -6
- package/cjs/form/fieldset/Fieldset.js.map +1 -1
- package/cjs/form/radio/Radio.js +9 -7
- package/cjs/form/radio/Radio.js.map +1 -1
- package/cjs/form/radio/radio-input/RadioInput.d.ts +19 -0
- package/cjs/form/radio/radio-input/RadioInput.js +55 -0
- package/cjs/form/radio/radio-input/RadioInput.js.map +1 -0
- package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.d.ts +1 -0
- package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js +5 -3
- package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js.map +1 -1
- package/esm/data/drag-and-drop/item/DragAndDropItem.d.ts +4 -0
- package/esm/data/drag-and-drop/item/DragAndDropItem.js +3 -7
- package/esm/data/drag-and-drop/item/DragAndDropItem.js.map +1 -1
- package/esm/data/drag-and-drop/root/DragAndDrop.context.d.ts +2 -1
- package/esm/data/drag-and-drop/root/DragAndDrop.context.js.map +1 -1
- package/esm/data/drag-and-drop/root/DragAndDropRoot.d.ts +12 -10
- package/esm/data/drag-and-drop/root/DragAndDropRoot.js +71 -39
- package/esm/data/drag-and-drop/root/DragAndDropRoot.js.map +1 -1
- package/esm/data/table/helpers/selection/getMultipleSelectProps.d.ts +3 -3
- package/esm/data/table/helpers/selection/getMultipleSelectProps.js +4 -4
- package/esm/data/table/helpers/selection/getMultipleSelectProps.js.map +1 -1
- package/esm/data/table/helpers/selection/getSingleSelectProps.d.ts +2 -2
- package/esm/data/table/helpers/selection/getSingleSelectProps.js +4 -1
- package/esm/data/table/helpers/selection/getSingleSelectProps.js.map +1 -1
- package/esm/data/table/helpers/selection/selection.types.d.ts +5 -5
- package/esm/data/table/root/DataTableAuto.js +9 -11
- package/esm/data/table/root/DataTableAuto.js.map +1 -1
- package/esm/data/table/td/DataTableTd.d.ts +4 -0
- package/esm/data/table/td/DataTableTd.js +4 -2
- package/esm/data/table/td/DataTableTd.js.map +1 -1
- package/esm/data/table/th/DataTableTh.d.ts +4 -0
- package/esm/data/table/th/DataTableTh.js +6 -3
- package/esm/data/table/th/DataTableTh.js.map +1 -1
- package/esm/data/token-filter/FilterChip.d.ts +10 -0
- package/esm/data/token-filter/FilterChip.js +30 -0
- package/esm/data/token-filter/FilterChip.js.map +1 -0
- package/esm/data/token-filter/TokenFilter.js +3 -10
- package/esm/data/token-filter/TokenFilter.js.map +1 -1
- package/esm/form/checkbox/Checkbox.js +19 -33
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/checkbox/checkbox-input/CheckboxInput.d.ts +21 -0
- package/esm/form/checkbox/checkbox-input/CheckboxInput.js +29 -0
- package/esm/form/checkbox/checkbox-input/CheckboxInput.js.map +1 -0
- package/esm/form/checkbox/types.d.ts +1 -1
- package/esm/form/fieldset/Fieldset.js +2 -6
- package/esm/form/fieldset/Fieldset.js.map +1 -1
- package/esm/form/radio/Radio.js +9 -7
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/radio/radio-input/RadioInput.d.ts +19 -0
- package/esm/form/radio/radio-input/RadioInput.js +19 -0
- package/esm/form/radio/radio-input/RadioInput.js.map +1 -0
- package/package.json +3 -3
- package/src/data/drag-and-drop/drag-handler/DragAndDropDragHandler.tsx +7 -3
- package/src/data/drag-and-drop/item/DragAndDropItem.tsx +15 -11
- package/src/data/drag-and-drop/root/DragAndDrop.context.tsx +4 -2
- package/src/data/drag-and-drop/root/DragAndDropRoot.tsx +94 -45
- package/src/data/table/helpers/selection/getMultipleSelectProps.ts +7 -7
- package/src/data/table/helpers/selection/getSingleSelectProps.ts +6 -3
- package/src/data/table/helpers/selection/selection.types.ts +5 -5
- package/src/data/table/root/DataTableAuto.tsx +25 -15
- package/src/data/table/td/DataTableTd.tsx +15 -2
- package/src/data/table/th/DataTableTh.tsx +13 -2
- package/src/data/token-filter/FilterChip.tsx +100 -0
- package/src/data/token-filter/TokenFilter.tsx +8 -24
- package/src/form/checkbox/Checkbox.tsx +37 -64
- package/src/form/checkbox/checkbox-input/CheckboxInput.tsx +69 -0
- package/src/form/checkbox/types.ts +1 -1
- package/src/form/fieldset/Fieldset.tsx +4 -6
- package/src/form/radio/Radio.tsx +43 -38
- package/src/form/radio/radio-input/RadioInput.tsx +32 -0
|
@@ -3,93 +3,66 @@ import { BodyShort } from "../../typography";
|
|
|
3
3
|
import { omit, useId } from "../../utils-external";
|
|
4
4
|
import { cl } from "../../utils/helpers";
|
|
5
5
|
import { ReadOnlyIconWithTitle } from "../ReadOnlyIcon";
|
|
6
|
+
import { CheckboxInput } from "./checkbox-input/CheckboxInput";
|
|
6
7
|
import { CheckboxProps } from "./types";
|
|
7
8
|
import useCheckbox from "./useCheckbox";
|
|
8
9
|
|
|
9
10
|
export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
10
|
-
(props,
|
|
11
|
+
(props: CheckboxProps, forwardedRef) => {
|
|
11
12
|
const { inputProps, hasError, size, readOnly, nested } = useCheckbox(props);
|
|
12
13
|
const descriptionId = useId();
|
|
13
14
|
|
|
15
|
+
const { className, description, children, indeterminate, hideLabel } =
|
|
16
|
+
props;
|
|
17
|
+
|
|
14
18
|
return (
|
|
15
19
|
<div
|
|
16
|
-
className={cl(
|
|
17
|
-
|
|
18
|
-
"aksel-checkbox",
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"aksel-checkbox--error": hasError,
|
|
22
|
-
"aksel-checkbox--disabled": inputProps.disabled,
|
|
23
|
-
"aksel-checkbox--readonly": readOnly,
|
|
24
|
-
},
|
|
25
|
-
)}
|
|
20
|
+
className={cl(className, "aksel-checkbox", `aksel-checkbox--${size}`, {
|
|
21
|
+
"aksel-checkbox--error": hasError,
|
|
22
|
+
"aksel-checkbox--disabled": inputProps.disabled,
|
|
23
|
+
"aksel-checkbox--readonly": readOnly,
|
|
24
|
+
})}
|
|
26
25
|
data-color={hasError ? "danger" : props["data-color"]}
|
|
27
26
|
>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (el) {
|
|
50
|
-
el.indeterminate = props.indeterminate ?? false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (typeof ref === "function") {
|
|
54
|
-
ref(el);
|
|
55
|
-
} else if (ref != null) {
|
|
56
|
-
ref.current = el;
|
|
57
|
-
}
|
|
58
|
-
}}
|
|
59
|
-
/>
|
|
60
|
-
<svg
|
|
61
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
62
|
-
viewBox="0 0 13 10"
|
|
63
|
-
fill="none"
|
|
64
|
-
focusable={false}
|
|
65
|
-
role="img"
|
|
66
|
-
aria-hidden
|
|
67
|
-
className="aksel-checkbox__icon"
|
|
68
|
-
>
|
|
69
|
-
<path
|
|
70
|
-
d="M4.03524 6.41478L10.4752 0.404669C11.0792 -0.160351 12.029 -0.130672 12.5955 0.47478C13.162 1.08027 13.1296 2.03007 12.5245 2.59621L5.02111 9.59934C4.74099 9.85904 4.37559 10 4.00025 10C3.60651 10 3.22717 9.84621 2.93914 9.56111L0.439143 7.06111C-0.146381 6.47558 -0.146381 5.52542 0.439143 4.93989C1.02467 4.35437 1.97483 4.35437 2.56036 4.93989L4.03524 6.41478Z"
|
|
71
|
-
fill="currentColor"
|
|
72
|
-
/>
|
|
73
|
-
</svg>
|
|
74
|
-
</div>
|
|
27
|
+
<CheckboxInput
|
|
28
|
+
ref={forwardedRef}
|
|
29
|
+
{...omit(props, [
|
|
30
|
+
"children",
|
|
31
|
+
"size",
|
|
32
|
+
"error",
|
|
33
|
+
"description",
|
|
34
|
+
"hideLabel",
|
|
35
|
+
"indeterminate",
|
|
36
|
+
"errorId",
|
|
37
|
+
"readOnly",
|
|
38
|
+
])}
|
|
39
|
+
{...omit(inputProps, ["aria-invalid", "aria-describedby"])}
|
|
40
|
+
aria-describedby={
|
|
41
|
+
cl(inputProps["aria-describedby"], {
|
|
42
|
+
[descriptionId]: description,
|
|
43
|
+
}) || undefined
|
|
44
|
+
}
|
|
45
|
+
indeterminate={indeterminate ?? false}
|
|
46
|
+
standalone={false}
|
|
47
|
+
/>
|
|
75
48
|
<BodyShort
|
|
76
49
|
as="label"
|
|
77
50
|
htmlFor={inputProps.id}
|
|
78
51
|
size={size}
|
|
79
|
-
className=
|
|
80
|
-
|
|
81
|
-
})}
|
|
52
|
+
className="aksel-checkbox__label"
|
|
53
|
+
visuallyHidden={hideLabel}
|
|
82
54
|
>
|
|
83
55
|
{!nested && readOnly && <ReadOnlyIconWithTitle />}
|
|
84
|
-
{
|
|
56
|
+
{children}
|
|
85
57
|
</BodyShort>
|
|
86
|
-
{
|
|
58
|
+
{description && (
|
|
87
59
|
<BodyShort
|
|
88
60
|
id={descriptionId}
|
|
89
61
|
size={size}
|
|
90
62
|
className="aksel-form-field__subdescription aksel-checkbox__description"
|
|
63
|
+
visuallyHidden={hideLabel}
|
|
91
64
|
>
|
|
92
|
-
{
|
|
65
|
+
{description}
|
|
93
66
|
</BodyShort>
|
|
94
67
|
)}
|
|
95
68
|
</div>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React, { forwardRef, useCallback } from "react";
|
|
2
|
+
import { cl } from "../../../utils/helpers";
|
|
3
|
+
import { useMergeRefs } from "../../../utils/hooks";
|
|
4
|
+
|
|
5
|
+
type CheckboxInputProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
6
|
+
indeterminate?: boolean;
|
|
7
|
+
children?: never;
|
|
8
|
+
standalone?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Reduces pseudo-element target-size.
|
|
11
|
+
*/
|
|
12
|
+
compact?: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const CheckboxInput = forwardRef<HTMLInputElement, CheckboxInputProps>(
|
|
16
|
+
(
|
|
17
|
+
{
|
|
18
|
+
className,
|
|
19
|
+
indeterminate,
|
|
20
|
+
standalone = true,
|
|
21
|
+
compact,
|
|
22
|
+
...rest
|
|
23
|
+
}: CheckboxInputProps,
|
|
24
|
+
forwardedRef,
|
|
25
|
+
) => {
|
|
26
|
+
const indeterminateRef = useCallback(
|
|
27
|
+
(el: HTMLInputElement | null) => {
|
|
28
|
+
if (el) {
|
|
29
|
+
el.indeterminate = indeterminate ?? false;
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
[indeterminate],
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const mergedRef = useMergeRefs(indeterminateRef, forwardedRef);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
className="aksel-checkbox__input-wrapper"
|
|
40
|
+
data-standalone={standalone}
|
|
41
|
+
data-compact={compact}
|
|
42
|
+
>
|
|
43
|
+
<input
|
|
44
|
+
{...rest}
|
|
45
|
+
className={cl("aksel-checkbox__input", className)}
|
|
46
|
+
type="checkbox"
|
|
47
|
+
ref={mergedRef}
|
|
48
|
+
/>
|
|
49
|
+
<svg
|
|
50
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
51
|
+
viewBox="0 0 13 10"
|
|
52
|
+
fill="none"
|
|
53
|
+
focusable={false}
|
|
54
|
+
role="img"
|
|
55
|
+
aria-hidden
|
|
56
|
+
className="aksel-checkbox__icon"
|
|
57
|
+
>
|
|
58
|
+
<path
|
|
59
|
+
d="M4.03524 6.41478L10.4752 0.404669C11.0792 -0.160351 12.029 -0.130672 12.5955 0.47478C13.162 1.08027 13.1296 2.03007 12.5245 2.59621L5.02111 9.59934C4.74099 9.85904 4.37559 10 4.00025 10C3.60651 10 3.22717 9.84621 2.93914 9.56111L0.439143 7.06111C-0.146381 6.47558 -0.146381 5.52542 0.439143 4.93989C1.02467 4.35437 1.97483 4.35437 2.56036 4.93989L4.03524 6.41478Z"
|
|
60
|
+
fill="currentColor"
|
|
61
|
+
/>
|
|
62
|
+
</svg>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export { CheckboxInput };
|
|
69
|
+
export type { CheckboxInputProps };
|
|
@@ -19,7 +19,7 @@ export interface CheckboxProps
|
|
|
19
19
|
*/
|
|
20
20
|
children: React.ReactNode;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Visually hides label and description, and makes it viewable for screen-readers only.
|
|
23
23
|
*/
|
|
24
24
|
hideLabel?: boolean;
|
|
25
25
|
/**
|
|
@@ -108,9 +108,8 @@ export const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
|
|
|
108
108
|
id={legendId}
|
|
109
109
|
size={size}
|
|
110
110
|
as="legend"
|
|
111
|
-
className=
|
|
112
|
-
|
|
113
|
-
})}
|
|
111
|
+
className="aksel-fieldset__legend"
|
|
112
|
+
visuallyHidden={!!hideLegend}
|
|
114
113
|
>
|
|
115
114
|
{readOnly &&
|
|
116
115
|
(_fieldsSupportNativeReadOnly ? (
|
|
@@ -122,9 +121,8 @@ export const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
|
|
|
122
121
|
</Label>
|
|
123
122
|
{!!description && (
|
|
124
123
|
<BodyShort
|
|
125
|
-
className=
|
|
126
|
-
|
|
127
|
-
})}
|
|
124
|
+
className="aksel-fieldset__description"
|
|
125
|
+
visuallyHidden={!!hideLegend}
|
|
128
126
|
id={inputDescriptionId}
|
|
129
127
|
size={size ?? "medium"}
|
|
130
128
|
as="div"
|
package/src/form/radio/Radio.tsx
CHANGED
|
@@ -2,52 +2,57 @@ import React, { forwardRef } from "react";
|
|
|
2
2
|
import { BodyShort } from "../../typography";
|
|
3
3
|
import { omit, useId } from "../../utils-external";
|
|
4
4
|
import { cl } from "../../utils/helpers";
|
|
5
|
+
import { RadioInput } from "./radio-input/RadioInput";
|
|
5
6
|
import { RadioProps } from "./types";
|
|
6
7
|
import { useRadio } from "./useRadio";
|
|
7
8
|
|
|
8
|
-
export const Radio = forwardRef<HTMLInputElement, RadioProps>(
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
export const Radio = forwardRef<HTMLInputElement, RadioProps>(
|
|
10
|
+
(props: RadioProps, forwardedRef) => {
|
|
11
|
+
const { inputProps, size, hasError, readOnly } = useRadio(props);
|
|
12
|
+
const descriptionId = useId();
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"aksel-radio
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{...omit(props, ["children", "size", "description", "readOnly"])}
|
|
23
|
-
{...omit(inputProps, ["aria-invalid", "aria-describedby"])}
|
|
24
|
-
aria-describedby={
|
|
25
|
-
cl(inputProps["aria-describedby"], {
|
|
26
|
-
[descriptionId]: props.description,
|
|
27
|
-
}) || undefined
|
|
28
|
-
}
|
|
29
|
-
className="aksel-radio__input"
|
|
30
|
-
ref={ref}
|
|
31
|
-
/>
|
|
32
|
-
<BodyShort
|
|
33
|
-
as="label"
|
|
34
|
-
htmlFor={inputProps.id}
|
|
35
|
-
className="aksel-radio__label"
|
|
36
|
-
size={size}
|
|
14
|
+
const { className, description, children } = props;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div
|
|
18
|
+
className={cl(className, "aksel-radio", `aksel-radio--${size}`, {
|
|
19
|
+
"aksel-radio--error": hasError,
|
|
20
|
+
"aksel-radio--disabled": inputProps.disabled,
|
|
21
|
+
"aksel-radio--readonly": readOnly,
|
|
22
|
+
})}
|
|
23
|
+
data-color={hasError ? "danger" : props["data-color"]}
|
|
37
24
|
>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
<RadioInput
|
|
26
|
+
ref={forwardedRef}
|
|
27
|
+
{...omit(props, ["children", "size", "description", "readOnly"])}
|
|
28
|
+
{...omit(inputProps, ["aria-invalid", "aria-describedby"])}
|
|
29
|
+
aria-describedby={
|
|
30
|
+
cl(inputProps["aria-describedby"], {
|
|
31
|
+
[descriptionId]: description,
|
|
32
|
+
}) || undefined
|
|
33
|
+
}
|
|
34
|
+
standalone={false}
|
|
35
|
+
/>
|
|
41
36
|
<BodyShort
|
|
42
|
-
|
|
37
|
+
as="label"
|
|
38
|
+
htmlFor={inputProps.id}
|
|
39
|
+
className="aksel-radio__label"
|
|
43
40
|
size={size}
|
|
44
|
-
className="aksel-form-field__subdescription aksel-radio__description"
|
|
45
41
|
>
|
|
46
|
-
{
|
|
42
|
+
{children}
|
|
47
43
|
</BodyShort>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
44
|
+
{description && (
|
|
45
|
+
<BodyShort
|
|
46
|
+
id={descriptionId}
|
|
47
|
+
size={size}
|
|
48
|
+
className="aksel-form-field__subdescription aksel-radio__description"
|
|
49
|
+
>
|
|
50
|
+
{description}
|
|
51
|
+
</BodyShort>
|
|
52
|
+
)}
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
);
|
|
52
57
|
|
|
53
58
|
export default Radio;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { cl } from "../../../utils/helpers";
|
|
3
|
+
|
|
4
|
+
type RadioInputProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
5
|
+
children?: never;
|
|
6
|
+
standalone?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Reduces pseudo-element target-size.
|
|
9
|
+
*/
|
|
10
|
+
compact?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const RadioInput = forwardRef<HTMLInputElement, RadioInputProps>(
|
|
14
|
+
(
|
|
15
|
+
{ className, standalone = true, compact, ...rest }: RadioInputProps,
|
|
16
|
+
forwardedRef,
|
|
17
|
+
) => {
|
|
18
|
+
return (
|
|
19
|
+
<input
|
|
20
|
+
{...rest}
|
|
21
|
+
ref={forwardedRef}
|
|
22
|
+
className={cl("aksel-radio__input", className)}
|
|
23
|
+
data-standalone={standalone}
|
|
24
|
+
data-compact={compact}
|
|
25
|
+
type="radio"
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export { RadioInput };
|
|
32
|
+
export type { RadioInputProps };
|