@postenbring/hedwig-react 4.2.0 → 4.2.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/{chunk-J2DJ6ELO.mjs → chunk-62VLFCXX.mjs} +2 -2
- package/dist/{chunk-GIFDGUFW.mjs → chunk-DMRQEQQK.mjs} +2 -2
- package/dist/{chunk-54HLJVAF.mjs → chunk-DOW6EHBI.mjs} +2 -2
- package/dist/{chunk-7REW23LO.mjs → chunk-F23MNQCK.mjs} +4 -8
- package/dist/chunk-F23MNQCK.mjs.map +1 -0
- package/dist/chunk-JGQTAIEP.mjs +67 -0
- package/dist/chunk-JGQTAIEP.mjs.map +1 -0
- package/dist/{chunk-BUFV457A.mjs → chunk-JGYPZ7ET.mjs} +3 -3
- package/dist/{chunk-NMW3IWZ4.mjs → chunk-OQD4GKOS.mjs} +2 -2
- package/dist/{chunk-OHPDYPZ5.mjs → chunk-QER35NXN.mjs} +2 -2
- package/dist/{chunk-4K54KSRB.mjs → chunk-QOIBRXYT.mjs} +2 -2
- package/dist/{chunk-6O5AEAIL.mjs → chunk-RGZSYJFL.mjs} +2 -2
- package/dist/chunk-RJ763KDH.mjs +21 -0
- package/dist/chunk-RJ763KDH.mjs.map +1 -0
- package/dist/{chunk-77UAHNU6.mjs → chunk-VNH7CZJ4.mjs} +2 -2
- package/dist/form/checkbox/checkbox.js +3 -6
- package/dist/form/checkbox/checkbox.js.map +1 -1
- package/dist/form/checkbox/checkbox.mjs +4 -4
- package/dist/form/checkbox/index.js +3 -6
- package/dist/form/checkbox/index.js.map +1 -1
- package/dist/form/checkbox/index.mjs +4 -4
- package/dist/form/date-picker/date-picker.js +3 -6
- package/dist/form/date-picker/date-picker.js.map +1 -1
- package/dist/form/date-picker/date-picker.mjs +4 -4
- package/dist/form/date-picker/index.js +3 -6
- package/dist/form/date-picker/index.js.map +1 -1
- package/dist/form/date-picker/index.mjs +4 -4
- package/dist/form/error-message/error-message.js +3 -6
- package/dist/form/error-message/error-message.js.map +1 -1
- package/dist/form/error-message/error-message.mjs +2 -2
- package/dist/form/error-message/index.js +3 -6
- package/dist/form/error-message/index.js.map +1 -1
- package/dist/form/error-message/index.mjs +2 -2
- package/dist/form/error-summary/error-summary.mjs +1 -1
- package/dist/form/error-summary/index.mjs +1 -1
- package/dist/form/fieldset/fieldset.js +3 -6
- package/dist/form/fieldset/fieldset.js.map +1 -1
- package/dist/form/fieldset/fieldset.mjs +3 -3
- package/dist/form/fieldset/index.js +3 -6
- package/dist/form/fieldset/index.js.map +1 -1
- package/dist/form/fieldset/index.mjs +3 -3
- package/dist/form/index.js +51 -60
- package/dist/form/index.js.map +1 -1
- package/dist/form/index.mjs +13 -13
- package/dist/form/input/index.js +3 -6
- package/dist/form/input/index.js.map +1 -1
- package/dist/form/input/index.mjs +4 -4
- package/dist/form/input/input.js +3 -6
- package/dist/form/input/input.js.map +1 -1
- package/dist/form/input/input.mjs +4 -4
- package/dist/form/input-group/index.js +3 -6
- package/dist/form/input-group/index.js.map +1 -1
- package/dist/form/input-group/index.mjs +3 -3
- package/dist/form/input-group/input-group.js +3 -6
- package/dist/form/input-group/input-group.js.map +1 -1
- package/dist/form/input-group/input-group.mjs +3 -3
- package/dist/form/radio-button/index.js +3 -6
- package/dist/form/radio-button/index.js.map +1 -1
- package/dist/form/radio-button/index.mjs +5 -5
- package/dist/form/radio-button/radio-button.js +3 -6
- package/dist/form/radio-button/radio-button.js.map +1 -1
- package/dist/form/radio-button/radio-button.mjs +5 -5
- package/dist/form/radio-button/radio-group.js +3 -6
- package/dist/form/radio-button/radio-group.js.map +1 -1
- package/dist/form/radio-button/radio-group.mjs +4 -4
- package/dist/form/search-wrapper/index.js +6 -17
- package/dist/form/search-wrapper/index.js.map +1 -1
- package/dist/form/search-wrapper/index.mjs +1 -1
- package/dist/form/search-wrapper/search-wrapper.d.ts +2 -5
- package/dist/form/search-wrapper/search-wrapper.d.ts.map +1 -1
- package/dist/form/search-wrapper/search-wrapper.js +6 -17
- package/dist/form/search-wrapper/search-wrapper.js.map +1 -1
- package/dist/form/search-wrapper/search-wrapper.mjs +1 -1
- package/dist/form/select/index.js +45 -46
- package/dist/form/select/index.js.map +1 -1
- package/dist/form/select/index.mjs +4 -4
- package/dist/form/select/select.d.ts.map +1 -1
- package/dist/form/select/select.js +45 -46
- package/dist/form/select/select.js.map +1 -1
- package/dist/form/select/select.mjs +4 -4
- package/dist/form/textarea/index.js +3 -6
- package/dist/form/textarea/index.js.map +1 -1
- package/dist/form/textarea/index.mjs +4 -4
- package/dist/form/textarea/textarea.js +3 -6
- package/dist/form/textarea/textarea.js.map +1 -1
- package/dist/form/textarea/textarea.mjs +4 -4
- package/dist/form/validation-message/index.js +3 -9
- package/dist/form/validation-message/index.js.map +1 -1
- package/dist/form/validation-message/index.mjs +1 -1
- package/dist/form/validation-message/validation-message.d.ts +2 -4
- package/dist/form/validation-message/validation-message.d.ts.map +1 -1
- package/dist/form/validation-message/validation-message.js +3 -9
- package/dist/form/validation-message/validation-message.js.map +1 -1
- package/dist/form/validation-message/validation-message.mjs +1 -1
- package/dist/index.js +51 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -27
- package/package.json +2 -2
- package/src/form/search-wrapper/search-wrapper.tsx +7 -22
- package/src/form/select/select.tsx +21 -21
- package/src/form/validation-message/validation-message.tsx +4 -9
- package/dist/chunk-7REW23LO.mjs.map +0 -1
- package/dist/chunk-D7L7OLFL.mjs +0 -65
- package/dist/chunk-D7L7OLFL.mjs.map +0 -1
- package/dist/chunk-ZIVURWHY.mjs +0 -30
- package/dist/chunk-ZIVURWHY.mjs.map +0 -1
- /package/dist/{chunk-J2DJ6ELO.mjs.map → chunk-62VLFCXX.mjs.map} +0 -0
- /package/dist/{chunk-GIFDGUFW.mjs.map → chunk-DMRQEQQK.mjs.map} +0 -0
- /package/dist/{chunk-54HLJVAF.mjs.map → chunk-DOW6EHBI.mjs.map} +0 -0
- /package/dist/{chunk-BUFV457A.mjs.map → chunk-JGYPZ7ET.mjs.map} +0 -0
- /package/dist/{chunk-NMW3IWZ4.mjs.map → chunk-OQD4GKOS.mjs.map} +0 -0
- /package/dist/{chunk-OHPDYPZ5.mjs.map → chunk-QER35NXN.mjs.map} +0 -0
- /package/dist/{chunk-4K54KSRB.mjs.map → chunk-QOIBRXYT.mjs.map} +0 -0
- /package/dist/{chunk-6O5AEAIL.mjs.map → chunk-RGZSYJFL.mjs.map} +0 -0
- /package/dist/{chunk-77UAHNU6.mjs.map → chunk-VNH7CZJ4.mjs.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InputGroup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DMRQEQQK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadValues
|
|
@@ -61,4 +61,4 @@ Input.displayName = "Input";
|
|
|
61
61
|
export {
|
|
62
62
|
Input
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
64
|
+
//# sourceMappingURL=chunk-62VLFCXX.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ValidationMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-F23MNQCK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getValidationMessageValue
|
|
6
6
|
} from "./chunk-3V4GFS46.mjs";
|
|
@@ -119,4 +119,4 @@ var InputGroup = forwardRef(function InputGroup2(_a, ref) {
|
|
|
119
119
|
export {
|
|
120
120
|
InputGroup
|
|
121
121
|
};
|
|
122
|
-
//# sourceMappingURL=chunk-
|
|
122
|
+
//# sourceMappingURL=chunk-DMRQEQQK.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useRadioGroupContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QER35NXN.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -61,4 +61,4 @@ RadioButton.displayName = "RadioButton";
|
|
|
61
61
|
export {
|
|
62
62
|
RadioButton
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
64
|
+
//# sourceMappingURL=chunk-DOW6EHBI.mjs.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__objRest,
|
|
3
|
-
__spreadProps,
|
|
4
3
|
__spreadValues
|
|
5
4
|
} from "./chunk-YOSPWY5K.mjs";
|
|
6
5
|
|
|
@@ -10,17 +9,14 @@ import { forwardRef } from "react";
|
|
|
10
9
|
import { jsx } from "react/jsx-runtime";
|
|
11
10
|
var ValidationMessage = forwardRef(
|
|
12
11
|
(_a, ref) => {
|
|
13
|
-
var _b = _a, {
|
|
12
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
14
13
|
return /* @__PURE__ */ jsx(
|
|
15
14
|
"div",
|
|
16
|
-
|
|
15
|
+
__spreadValues({
|
|
17
16
|
"aria-live": "polite",
|
|
18
17
|
className: clsx("hds-validation-message", className),
|
|
19
|
-
id,
|
|
20
18
|
ref
|
|
21
|
-
}, rest)
|
|
22
|
-
children
|
|
23
|
-
})
|
|
19
|
+
}, rest)
|
|
24
20
|
);
|
|
25
21
|
}
|
|
26
22
|
);
|
|
@@ -29,4 +25,4 @@ ValidationMessage.displayName = "ValidationMessage";
|
|
|
29
25
|
export {
|
|
30
26
|
ValidationMessage
|
|
31
27
|
};
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
//# sourceMappingURL=chunk-F23MNQCK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/form/validation-message/validation-message.tsx"],"sourcesContent":["import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\n\nexport interface ValidationMessageProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ className, ...rest }, ref) => (\n <div\n aria-live=\"polite\"\n className={clsx(\"hds-validation-message\", className as undefined)}\n ref={ref}\n {...rest}\n />\n ),\n);\nValidationMessage.displayName = \"ValidationMessage\";\n"],"mappings":";;;;;;AAAA,SAAS,YAAY;AACrB,SAAS,kBAAuC;AAQ5C;AAFG,IAAM,oBAAoB;AAAA,EAC/B,CAAC,IAAwB,QAAK;AAA7B,iBAAE,YARL,IAQG,IAAgB,iBAAhB,IAAgB,CAAd;AACD;AAAA,MAAC;AAAA;AAAA,QACC,aAAU;AAAA,QACV,WAAW,KAAK,0BAA0B,SAAsB;AAAA,QAChE;AAAA,SACI;AAAA,IACN;AAAA;AAEJ;AACA,kBAAkB,cAAc;","names":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InputGroup
|
|
3
|
+
} from "./chunk-DMRQEQQK.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues
|
|
8
|
+
} from "./chunk-YOSPWY5K.mjs";
|
|
9
|
+
|
|
10
|
+
// src/form/select/select.tsx
|
|
11
|
+
import { forwardRef } from "react";
|
|
12
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
var Select = forwardRef(
|
|
15
|
+
(_a, ref) => {
|
|
16
|
+
var _b = _a, {
|
|
17
|
+
className,
|
|
18
|
+
size,
|
|
19
|
+
validationMessage,
|
|
20
|
+
validationMessageProps,
|
|
21
|
+
errorMessage,
|
|
22
|
+
labelProps,
|
|
23
|
+
label,
|
|
24
|
+
id,
|
|
25
|
+
style,
|
|
26
|
+
disabled,
|
|
27
|
+
"data-color": dataColor,
|
|
28
|
+
children
|
|
29
|
+
} = _b, rest = __objRest(_b, [
|
|
30
|
+
"className",
|
|
31
|
+
"size",
|
|
32
|
+
"validationMessage",
|
|
33
|
+
"validationMessageProps",
|
|
34
|
+
"errorMessage",
|
|
35
|
+
"labelProps",
|
|
36
|
+
"label",
|
|
37
|
+
"id",
|
|
38
|
+
"style",
|
|
39
|
+
"disabled",
|
|
40
|
+
"data-color",
|
|
41
|
+
"children"
|
|
42
|
+
]);
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
InputGroup,
|
|
45
|
+
{
|
|
46
|
+
className: clsx("hds-select", className),
|
|
47
|
+
disabled,
|
|
48
|
+
validationMessage,
|
|
49
|
+
validationMessageProps,
|
|
50
|
+
errorMessage,
|
|
51
|
+
id,
|
|
52
|
+
label,
|
|
53
|
+
labelProps,
|
|
54
|
+
style,
|
|
55
|
+
size,
|
|
56
|
+
"data-color": dataColor,
|
|
57
|
+
children: /* @__PURE__ */ jsx("select", __spreadProps(__spreadValues({ disabled, ref }, rest), { children }))
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
Select.displayName = "Select";
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
Select
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=chunk-JGQTAIEP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/form/select/select.tsx"],"sourcesContent":["import { forwardRef, type ReactNode, type SelectHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup } from \"../input-group\";\nimport type { InputGroupProps } from \"../input-group\";\n\nexport type SelectProps = Omit<\n InputGroupProps & Omit<SelectHTMLAttributes<HTMLSelectElement>, \"size\">,\n \"readOnly\" | \"children\"\n> & { children: ReactNode };\n\nexport const Select = forwardRef<HTMLSelectElement, SelectProps>(\n (\n {\n className,\n size,\n validationMessage,\n validationMessageProps,\n errorMessage,\n labelProps,\n label,\n id,\n style,\n disabled,\n \"data-color\": dataColor,\n children,\n ...rest\n },\n ref,\n ) => (\n <InputGroup\n className={clsx(\"hds-select\", className as undefined)}\n disabled={disabled}\n validationMessage={validationMessage}\n validationMessageProps={validationMessageProps}\n errorMessage={errorMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n style={style}\n size={size}\n data-color={dataColor}\n >\n <select disabled={disabled} ref={ref} {...rest}>\n {children}\n </select>\n </InputGroup>\n ),\n);\n\nSelect.displayName = \"Select\";\n"],"mappings":";;;;;;;;;;AAAA,SAAS,kBAA6D;AACtE,SAAS,YAAY;AAyCf;AAhCC,IAAM,SAAS;AAAA,EACpB,CACE,IAeA,QACA;AAhBA,iBACE;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd;AAAA,IAxBN,IAYI,IAaK,iBAbL,IAaK;AAAA,MAZH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,KAAK,cAAc,SAAsB;AAAA,QACpD;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,cAAY;AAAA,QAEZ,8BAAC,yCAAO,UAAoB,OAAc,OAAzC,EACE,WACH;AAAA;AAAA,IACF;AAAA;AAEJ;AAEA,OAAO,cAAc;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useFieldsetContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QOIBRXYT.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ValidationMessage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-F23MNQCK.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getValidationMessageValue
|
|
9
9
|
} from "./chunk-3V4GFS46.mjs";
|
|
@@ -100,4 +100,4 @@ Checkbox.displayName = "Checkbox";
|
|
|
100
100
|
export {
|
|
101
101
|
Checkbox
|
|
102
102
|
};
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
103
|
+
//# sourceMappingURL=chunk-JGYPZ7ET.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InputGroup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DMRQEQQK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadValues
|
|
@@ -62,4 +62,4 @@ Textarea.displayName = "Textarea";
|
|
|
62
62
|
export {
|
|
63
63
|
Textarea
|
|
64
64
|
};
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
65
|
+
//# sourceMappingURL=chunk-OQD4GKOS.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Fieldset
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QOIBRXYT.mjs";
|
|
4
4
|
import {
|
|
5
5
|
FieldsetDescription
|
|
6
6
|
} from "./chunk-D2XZT2RA.mjs";
|
|
@@ -38,4 +38,4 @@ export {
|
|
|
38
38
|
useRadioGroupContext,
|
|
39
39
|
RadioGroup
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
41
|
+
//# sourceMappingURL=chunk-QER35NXN.mjs.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-CD4LCDK3.mjs";
|
|
7
7
|
import {
|
|
8
8
|
ValidationMessage
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-F23MNQCK.mjs";
|
|
10
10
|
import {
|
|
11
11
|
getValidationMessageValue
|
|
12
12
|
} from "./chunk-3V4GFS46.mjs";
|
|
@@ -110,4 +110,4 @@ export {
|
|
|
110
110
|
useFieldsetContext,
|
|
111
111
|
Fieldset
|
|
112
112
|
};
|
|
113
|
-
//# sourceMappingURL=chunk-
|
|
113
|
+
//# sourceMappingURL=chunk-QOIBRXYT.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InputGroup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DMRQEQQK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useMergeRefs
|
|
6
6
|
} from "./chunk-3V4GFS46.mjs";
|
|
@@ -92,4 +92,4 @@ DatePicker.displayName = "DatePicker";
|
|
|
92
92
|
export {
|
|
93
93
|
DatePicker
|
|
94
94
|
};
|
|
95
|
-
//# sourceMappingURL=chunk-
|
|
95
|
+
//# sourceMappingURL=chunk-RGZSYJFL.mjs.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "./chunk-YOSPWY5K.mjs";
|
|
5
|
+
|
|
6
|
+
// src/form/search-wrapper/search-wrapper.tsx
|
|
7
|
+
import { forwardRef } from "react";
|
|
8
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var SearchWrapper = forwardRef(
|
|
11
|
+
(_a, ref) => {
|
|
12
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
13
|
+
return /* @__PURE__ */ jsx("div", __spreadValues({ className: clsx("hds-search-wrapper", className), ref }, rest));
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
SearchWrapper.displayName = "SearchWrapper";
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
SearchWrapper
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=chunk-RJ763KDH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/form/search-wrapper/search-wrapper.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\nexport interface SearchWrapperProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n}\n\nexport const SearchWrapper = forwardRef<HTMLDivElement, SearchWrapperProps>(\n ({ className, ...rest }, ref) => (\n <div className={clsx(\"hds-search-wrapper\", className as undefined)} ref={ref} {...rest} />\n ),\n);\n\nSearchWrapper.displayName = \"SearchWrapper\";\n"],"mappings":";;;;;;AAAA,SAAS,kBAAuC;AAChD,SAAS,YAAY;AAQjB;AAFG,IAAM,gBAAgB;AAAA,EAC3B,CAAC,IAAwB,QAAK;AAA7B,iBAAE,YARL,IAQG,IAAgB,iBAAhB,IAAgB,CAAd;AACD,+BAAC,wBAAI,WAAW,KAAK,sBAAsB,SAAsB,GAAG,OAAc,KAAM;AAAA;AAE5F;AAEA,cAAc,cAAc;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ValidationMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-F23MNQCK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -21,4 +21,4 @@ ErrorMessage.displayName = "ErrorMessage";
|
|
|
21
21
|
export {
|
|
22
22
|
ErrorMessage
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-VNH7CZJ4.mjs.map
|
|
@@ -71,17 +71,14 @@ var import_react = require("react");
|
|
|
71
71
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
72
72
|
var ValidationMessage = (0, import_react.forwardRef)(
|
|
73
73
|
(_a, ref) => {
|
|
74
|
-
var _b = _a, {
|
|
74
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
75
75
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
76
76
|
"div",
|
|
77
|
-
|
|
77
|
+
__spreadValues({
|
|
78
78
|
"aria-live": "polite",
|
|
79
79
|
className: (0, import_typed_classname.clsx)("hds-validation-message", className),
|
|
80
|
-
id,
|
|
81
80
|
ref
|
|
82
|
-
}, rest)
|
|
83
|
-
children
|
|
84
|
-
})
|
|
81
|
+
}, rest)
|
|
85
82
|
);
|
|
86
83
|
}
|
|
87
84
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/checkbox/checkbox.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/utils/utils.ts","../../../src/form/fieldset/fieldset-description.tsx","../../../src/form/fieldset/fieldset-legend.tsx"],"sourcesContent":["import { forwardRef, useId, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { useFieldsetContext } from \"../fieldset\";\nimport { getValidationMessageValue } from \"../../utils\";\n\nexport type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\" | \"size\"> & {\n children: ReactNode;\n variant?: \"plain\" | \"bounding-box\";\n title?: string;\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n size?: \"small\" | \"\";\n} & (\n | {\n /**\n * Set to `true` to add error styling. The component will take care of aria to indicate invalid state.\n *\n * Normally you don't need this, as you should wrap your Checkboxes in the Fieldset component.\n * When providing an errorMessage to Fieldset, all contained Checkboxes will get correct hasError state.\n *\n * You can use this when your checkbox is part of a non-HDS fieldset which shows an error message.\n */\n hasError?: boolean;\n //validationMessage?: never;\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: never;\n }\n | {\n hasError?: never;\n /**\n * Set an error message to add error styling, and display the error message.\n * The component will take care of aria to connect the error message to the checkbox.\n *\n * Use this when your checkbox is standalone (not part of a fieldset).\n */\n //validationMessage?: ReactNode;\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n }\n );\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (\n {\n variant = \"plain\",\n hasError: hasErrorProp,\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n title,\n children,\n className,\n size = \"\",\n ...rest\n },\n ref,\n ) => {\n const validationMessageId = useId();\n const { hasError: hasFieldsetError, size: fieldsetSize } = useFieldsetContext();\n const hasError = !!errorMessage || hasFieldsetError || hasErrorProp;\n const effectiveSize = size || fieldsetSize;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n\n return (\n <div\n className={clsx(\"hds-checkbox-wrapper\", {\n \"hds-checkbox-wrapper--small\": effectiveSize === \"small\",\n })}\n >\n <div\n className={clsx(\n \"hds-checkbox\",\n {\n [`hds-checkbox--${variant}`]: variant === \"bounding-box\",\n },\n className as undefined,\n )}\n >\n <label>\n <input\n aria-invalid={hasError ? true : undefined}\n aria-describedby={validationMessageValue ? validationMessageId : undefined}\n ref={ref}\n type=\"checkbox\"\n {...rest}\n />\n <span aria-hidden className=\"hds-checkbox__checkmark\" />\n {title ? <p className=\"hds-checkbox__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </div>\n );\n },\n);\nCheckbox.displayName = \"Checkbox\";\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ValidationMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ children, id, className, ...rest }, ref) => (\n <div\n aria-live=\"polite\"\n className={clsx(\"hds-validation-message\", className as undefined)}\n id={id}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n ),\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import {\n Children,\n cloneElement,\n isValidElement,\n useId,\n forwardRef,\n createContext,\n useContext,\n} from \"react\";\nimport type {\n FieldsetHTMLAttributes,\n ReactElement,\n ReactNode,\n CSSProperties,\n ComponentProps,\n} from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { getValidationMessageValue } from \"../../utils\";\nimport { FieldsetDescription } from \"./fieldset-description\";\nimport { FieldsetLegend } from \"./fieldset-legend\";\n\ntype FieldsetLegendProps = ComponentProps<typeof FieldsetLegend>;\n\nexport interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {\n className?: string;\n style?: CSSProperties;\n \"data-color\"?: \"info\" | \"success\" | \"warning\" | \"error\";\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\n /**\n * Providing an errorMessage will also give contained Checkboxes or Radio buttons\n * error styling and aria to indicate invalid state.\n *\n * For Radio buttons you are even better off using RadioGroup.\n */\n\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /**\n * @deprecated Pass props directly to <Fieldset.Legend> instead.\n */\n legendProps?: FieldsetLegendProps;\n /**\n * @deprecated Use <Fieldset.Legend>...</Fieldset.Legend> instead.\n */\n legend?: ReactNode;\n size?: \"small\" | \"\";\n children: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n}\n\n/** @deprecated Will no longer be needed */\nconst FieldsetContext = createContext<{ hasError: boolean; size: \"small\" | \"\" }>({\n hasError: false,\n size: \"\",\n});\n\n/** @deprecated Will no longer be needed */\nexport const useFieldsetContext = () => useContext(FieldsetContext);\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(function Fieldset(\n {\n className,\n style,\n \"data-color\": dataColor = undefined,\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n legendProps,\n legend,\n size = \"\",\n children,\n ...rest\n },\n ref,\n) {\n const validationMessageId = useId();\n const validationColor = errorMessage ? \"error\" : dataColor;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n const childArray = Children.toArray(children);\n const legendChild = childArray.find(\n (child): child is ReactElement<FieldsetLegendProps> =>\n isValidElement<FieldsetLegendProps>(child) && child.type === FieldsetLegend,\n );\n const contentChildren = legendChild\n ? childArray.filter((child) => child !== legendChild)\n : childArray;\n let renderedLegend = null;\n\n if (legendChild) {\n renderedLegend = cloneElement(legendChild, {\n ...legendProps,\n ...legendChild.props,\n className: clsx(\n legendProps?.className as undefined,\n legendChild.props.className as undefined,\n ),\n });\n } else if (legend !== undefined) {\n renderedLegend = <FieldsetLegend {...legendProps}>{legend}</FieldsetLegend>;\n }\n\n return (\n <fieldset\n aria-describedby={validationMessageValue ? validationMessageId : undefined}\n aria-invalid={errorMessage ? true : undefined}\n className={clsx(\"hds-fieldset\", { [`hds-fieldset--${size}`]: size }, className as undefined)}\n data-color={validationColor}\n ref={ref}\n style={style}\n {...rest}\n >\n {renderedLegend}\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage), size }}>\n {contentChildren}\n </FieldsetContext.Provider>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </fieldset>\n );\n}) as FieldsetType;\n\ntype FieldsetType = ReturnType<typeof forwardRef<HTMLFieldSetElement, FieldsetProps>> & {\n Description: typeof FieldsetDescription;\n Legend: typeof FieldsetLegend;\n};\n\nFieldset.Description = FieldsetDescription;\nFieldset.Legend = FieldsetLegend;\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport function getValidationMessageValue(\n validationMessage?: ReactNode | { value: ReactNode },\n errorMessage?: ReactNode,\n): ReactNode {\n if (validationMessage) {\n if (typeof validationMessage === \"object\" && \"value\" in validationMessage) {\n return validationMessage.value;\n }\n\n return validationMessage;\n }\n\n return errorMessage;\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n","import { forwardRef, type HTMLAttributes } from \"react\";\n\nexport type FieldsetDescriptionProps = HTMLAttributes<HTMLParagraphElement>;\n\n/**\n * FieldsetDescription component, used to display a description for a fieldset.\n *\n * @example\n * <FieldsetDescription>\n * Gi en kort beskrivelse i begge feltene\n * </FieldsetDescription>\n */\nexport const FieldsetDescription = forwardRef<HTMLParagraphElement, FieldsetDescriptionProps>(\n function FieldsetDescription(rest, ref) {\n return <p className=\"hds-fieldset__description\" ref={ref} {...rest} />;\n },\n);\n","import { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\n/**\n * FieldsetLegend component, used to display a legend for a fieldset.\n *\n * @example\n * <FieldsetLegend>Skriv inn dine svar</FieldsetLegend>\n */\nexport const FieldsetLegend = forwardRef<HTMLLegendElement, HTMLAttributes<HTMLLegendElement>>(\n function FieldsetLegend({ className, ...rest }, ref) {\n return (\n <legend\n className={clsx(\"hds-fieldset__legend\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n\nFieldsetLegend.displayName = \"Fieldset.Legend\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA4E;AAC5E,IAAAC,0BAAqB;;;ACDrB,6BAAqB;AACrB,mBAA2C;AAUvC;AAFG,IAAM,wBAAoB;AAAA,EAC/B,CAAC,IAAsC,QAAK;AAA3C,iBAAE,YAAU,IAAI,UAVnB,IAUG,IAA8B,iBAA9B,IAA8B,CAA5B,YAAU,MAAI;AACf;AAAA,MAAC;AAAA;AAAA,QACC,aAAU;AAAA,QACV,eAAW,6BAAK,0BAA0B,SAAsB;AAAA,QAChE;AAAA,QACA;AAAA,SACI,OALL;AAAA,QAOE;AAAA;AAAA,IACH;AAAA;AAEJ;AACA,kBAAkB,cAAc;;;ACtBhC,IAAAC,gBAQO;AAQP,IAAAC,0BAAqB;;;AChBrB,YAAuB;AACvB,IAAAC,gBAA0D;AAmEnD,SAAS,0BACd,mBACA,cACW;AACX,MAAI,mBAAmB;AACrB,QAAI,OAAO,sBAAsB,YAAY,WAAW,mBAAmB;AACzE,aAAO,kBAAkB;AAAA,IAC3B;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAkDA,IAAM,wBAAiC,OAAO,sBAAQ,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK;;;ACnIxE,IAAAC,gBAAgD;AAcrC,IAAAC,sBAAA;AAFJ,IAAM,0BAAsB;AAAA,EACjC,SAASC,qBAAoB,MAAM,KAAK;AACtC,WAAO,6CAAC,sBAAE,WAA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AAgB,oBAAoB;AACvD,UAAM,gBAAgB,QAAQ;AAC9B,UAAM,yBAAyB,0BAA0B,mBAAmB,YAAY;AAExF,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,8BAAK,wBAAwB;AAAA,UACtC,+BAA+B,kBAAkB;AAAA,QACnD,CAAC;AAAA,QAED;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,eAAW;AAAA,gBACT;AAAA,gBACA;AAAA,kBACE,CAAC,iBAAiB,OAAO,EAAE,GAAG,YAAY;AAAA,gBAC5C;AAAA,gBACA;AAAA,cACF;AAAA,cAEA;AAAA,8DAAC,WACC;AAAA;AAAA,oBAAC;AAAA;AAAA,sBACC,gBAAc,WAAW,OAAO;AAAA,sBAChC,oBAAkB,yBAAyB,sBAAsB;AAAA,sBACjE;AAAA,sBACA,MAAK;AAAA,uBACD;AAAA,kBACN;AAAA,kBACA,6CAAC,UAAK,eAAW,MAAC,WAAU,2BAA0B;AAAA,kBACrD,QAAQ,6CAAC,OAAE,WAAU,uBAAuB,iBAAM,IAAO;AAAA,mBAC5D;AAAA,gBACC,QAAQ,WAAW;AAAA;AAAA;AAAA,UACtB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,IAAI;AAAA,eACC,0DAA0B,oBAFhC;AAAA,cAIE;AAAA;AAAA,UACH;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AACA,SAAS,cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_react","import_react","import_jsx_runtime","FieldsetDescription","import_react","import_typed_classname","import_jsx_runtime","FieldsetLegend","import_jsx_runtime","Fieldset","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/form/checkbox/checkbox.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/utils/utils.ts","../../../src/form/fieldset/fieldset-description.tsx","../../../src/form/fieldset/fieldset-legend.tsx"],"sourcesContent":["import { forwardRef, useId, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { useFieldsetContext } from \"../fieldset\";\nimport { getValidationMessageValue } from \"../../utils\";\n\nexport type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\" | \"size\"> & {\n children: ReactNode;\n variant?: \"plain\" | \"bounding-box\";\n title?: string;\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n size?: \"small\" | \"\";\n} & (\n | {\n /**\n * Set to `true` to add error styling. The component will take care of aria to indicate invalid state.\n *\n * Normally you don't need this, as you should wrap your Checkboxes in the Fieldset component.\n * When providing an errorMessage to Fieldset, all contained Checkboxes will get correct hasError state.\n *\n * You can use this when your checkbox is part of a non-HDS fieldset which shows an error message.\n */\n hasError?: boolean;\n //validationMessage?: never;\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: never;\n }\n | {\n hasError?: never;\n /**\n * Set an error message to add error styling, and display the error message.\n * The component will take care of aria to connect the error message to the checkbox.\n *\n * Use this when your checkbox is standalone (not part of a fieldset).\n */\n //validationMessage?: ReactNode;\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n }\n );\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (\n {\n variant = \"plain\",\n hasError: hasErrorProp,\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n title,\n children,\n className,\n size = \"\",\n ...rest\n },\n ref,\n ) => {\n const validationMessageId = useId();\n const { hasError: hasFieldsetError, size: fieldsetSize } = useFieldsetContext();\n const hasError = !!errorMessage || hasFieldsetError || hasErrorProp;\n const effectiveSize = size || fieldsetSize;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n\n return (\n <div\n className={clsx(\"hds-checkbox-wrapper\", {\n \"hds-checkbox-wrapper--small\": effectiveSize === \"small\",\n })}\n >\n <div\n className={clsx(\n \"hds-checkbox\",\n {\n [`hds-checkbox--${variant}`]: variant === \"bounding-box\",\n },\n className as undefined,\n )}\n >\n <label>\n <input\n aria-invalid={hasError ? true : undefined}\n aria-describedby={validationMessageValue ? validationMessageId : undefined}\n ref={ref}\n type=\"checkbox\"\n {...rest}\n />\n <span aria-hidden className=\"hds-checkbox__checkmark\" />\n {title ? <p className=\"hds-checkbox__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </div>\n );\n },\n);\nCheckbox.displayName = \"Checkbox\";\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\n\nexport interface ValidationMessageProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ className, ...rest }, ref) => (\n <div\n aria-live=\"polite\"\n className={clsx(\"hds-validation-message\", className as undefined)}\n ref={ref}\n {...rest}\n />\n ),\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import {\n Children,\n cloneElement,\n isValidElement,\n useId,\n forwardRef,\n createContext,\n useContext,\n} from \"react\";\nimport type {\n FieldsetHTMLAttributes,\n ReactElement,\n ReactNode,\n CSSProperties,\n ComponentProps,\n} from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { getValidationMessageValue } from \"../../utils\";\nimport { FieldsetDescription } from \"./fieldset-description\";\nimport { FieldsetLegend } from \"./fieldset-legend\";\n\ntype FieldsetLegendProps = ComponentProps<typeof FieldsetLegend>;\n\nexport interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {\n className?: string;\n style?: CSSProperties;\n \"data-color\"?: \"info\" | \"success\" | \"warning\" | \"error\";\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\n /**\n * Providing an errorMessage will also give contained Checkboxes or Radio buttons\n * error styling and aria to indicate invalid state.\n *\n * For Radio buttons you are even better off using RadioGroup.\n */\n\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /**\n * @deprecated Pass props directly to <Fieldset.Legend> instead.\n */\n legendProps?: FieldsetLegendProps;\n /**\n * @deprecated Use <Fieldset.Legend>...</Fieldset.Legend> instead.\n */\n legend?: ReactNode;\n size?: \"small\" | \"\";\n children: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n}\n\n/** @deprecated Will no longer be needed */\nconst FieldsetContext = createContext<{ hasError: boolean; size: \"small\" | \"\" }>({\n hasError: false,\n size: \"\",\n});\n\n/** @deprecated Will no longer be needed */\nexport const useFieldsetContext = () => useContext(FieldsetContext);\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(function Fieldset(\n {\n className,\n style,\n \"data-color\": dataColor = undefined,\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n legendProps,\n legend,\n size = \"\",\n children,\n ...rest\n },\n ref,\n) {\n const validationMessageId = useId();\n const validationColor = errorMessage ? \"error\" : dataColor;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n const childArray = Children.toArray(children);\n const legendChild = childArray.find(\n (child): child is ReactElement<FieldsetLegendProps> =>\n isValidElement<FieldsetLegendProps>(child) && child.type === FieldsetLegend,\n );\n const contentChildren = legendChild\n ? childArray.filter((child) => child !== legendChild)\n : childArray;\n let renderedLegend = null;\n\n if (legendChild) {\n renderedLegend = cloneElement(legendChild, {\n ...legendProps,\n ...legendChild.props,\n className: clsx(\n legendProps?.className as undefined,\n legendChild.props.className as undefined,\n ),\n });\n } else if (legend !== undefined) {\n renderedLegend = <FieldsetLegend {...legendProps}>{legend}</FieldsetLegend>;\n }\n\n return (\n <fieldset\n aria-describedby={validationMessageValue ? validationMessageId : undefined}\n aria-invalid={errorMessage ? true : undefined}\n className={clsx(\"hds-fieldset\", { [`hds-fieldset--${size}`]: size }, className as undefined)}\n data-color={validationColor}\n ref={ref}\n style={style}\n {...rest}\n >\n {renderedLegend}\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage), size }}>\n {contentChildren}\n </FieldsetContext.Provider>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </fieldset>\n );\n}) as FieldsetType;\n\ntype FieldsetType = ReturnType<typeof forwardRef<HTMLFieldSetElement, FieldsetProps>> & {\n Description: typeof FieldsetDescription;\n Legend: typeof FieldsetLegend;\n};\n\nFieldset.Description = FieldsetDescription;\nFieldset.Legend = FieldsetLegend;\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport function getValidationMessageValue(\n validationMessage?: ReactNode | { value: ReactNode },\n errorMessage?: ReactNode,\n): ReactNode {\n if (validationMessage) {\n if (typeof validationMessage === \"object\" && \"value\" in validationMessage) {\n return validationMessage.value;\n }\n\n return validationMessage;\n }\n\n return errorMessage;\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n","import { forwardRef, type HTMLAttributes } from \"react\";\n\nexport type FieldsetDescriptionProps = HTMLAttributes<HTMLParagraphElement>;\n\n/**\n * FieldsetDescription component, used to display a description for a fieldset.\n *\n * @example\n * <FieldsetDescription>\n * Gi en kort beskrivelse i begge feltene\n * </FieldsetDescription>\n */\nexport const FieldsetDescription = forwardRef<HTMLParagraphElement, FieldsetDescriptionProps>(\n function FieldsetDescription(rest, ref) {\n return <p className=\"hds-fieldset__description\" ref={ref} {...rest} />;\n },\n);\n","import { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\n/**\n * FieldsetLegend component, used to display a legend for a fieldset.\n *\n * @example\n * <FieldsetLegend>Skriv inn dine svar</FieldsetLegend>\n */\nexport const FieldsetLegend = forwardRef<HTMLLegendElement, HTMLAttributes<HTMLLegendElement>>(\n function FieldsetLegend({ className, ...rest }, ref) {\n return (\n <legend\n className={clsx(\"hds-fieldset__legend\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n\nFieldsetLegend.displayName = \"Fieldset.Legend\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA4E;AAC5E,IAAAC,0BAAqB;;;ACDrB,6BAAqB;AACrB,mBAAgD;AAQ5C;AAFG,IAAM,wBAAoB;AAAA,EAC/B,CAAC,IAAwB,Q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AK,eAAW,MAAC,WAAU,2BAA0B;AAAA,kBACrD,QAAQ,6CAAC,OAAE,WAAU,uBAAuB,iBAAM,IAAO;AAAA,mBAC5D;AAAA,gBACC,QAAQ,WAAW;AAAA;AAAA;AAAA,UACtB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,IAAI;AAAA,eACC,0DAA0B,oBAFhC;AAAA,cAIE;AAAA;AAAA,UACH;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AACA,SAAS,cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_react","import_react","import_jsx_runtime","FieldsetDescription","import_react","import_typed_classname","import_jsx_runtime","FieldsetLegend","import_jsx_runtime","Fieldset","import_jsx_runtime"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Checkbox
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-JGYPZ7ET.mjs";
|
|
4
4
|
import "../../chunk-CSIXGT7P.mjs";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-QOIBRXYT.mjs";
|
|
6
6
|
import "../../chunk-D2XZT2RA.mjs";
|
|
7
7
|
import "../../chunk-CD4LCDK3.mjs";
|
|
8
8
|
import "../../chunk-NSLSA7F7.mjs";
|
|
9
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-VNH7CZJ4.mjs";
|
|
10
10
|
import "../../chunk-5M6MEYM7.mjs";
|
|
11
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-F23MNQCK.mjs";
|
|
12
12
|
import "../../chunk-CYDWEPFL.mjs";
|
|
13
13
|
import "../../chunk-KPNAC2WN.mjs";
|
|
14
14
|
import "../../chunk-3V4GFS46.mjs";
|
|
@@ -73,17 +73,14 @@ var import_react = require("react");
|
|
|
73
73
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
74
74
|
var ValidationMessage = (0, import_react.forwardRef)(
|
|
75
75
|
(_a, ref) => {
|
|
76
|
-
var _b = _a, {
|
|
76
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
77
77
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
78
78
|
"div",
|
|
79
|
-
|
|
79
|
+
__spreadValues({
|
|
80
80
|
"aria-live": "polite",
|
|
81
81
|
className: (0, import_typed_classname.clsx)("hds-validation-message", className),
|
|
82
|
-
id,
|
|
83
82
|
ref
|
|
84
|
-
}, rest)
|
|
85
|
-
children
|
|
86
|
-
})
|
|
83
|
+
}, rest)
|
|
87
84
|
);
|
|
88
85
|
}
|
|
89
86
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/checkbox/index.tsx","../../../src/form/checkbox/checkbox.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/utils/utils.ts","../../../src/form/fieldset/fieldset-description.tsx","../../../src/form/fieldset/fieldset-legend.tsx"],"sourcesContent":["export { Checkbox } from \"./checkbox\";\nexport type * from \"./checkbox\";\n","import { forwardRef, useId, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { useFieldsetContext } from \"../fieldset\";\nimport { getValidationMessageValue } from \"../../utils\";\n\nexport type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\" | \"size\"> & {\n children: ReactNode;\n variant?: \"plain\" | \"bounding-box\";\n title?: string;\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n size?: \"small\" | \"\";\n} & (\n | {\n /**\n * Set to `true` to add error styling. The component will take care of aria to indicate invalid state.\n *\n * Normally you don't need this, as you should wrap your Checkboxes in the Fieldset component.\n * When providing an errorMessage to Fieldset, all contained Checkboxes will get correct hasError state.\n *\n * You can use this when your checkbox is part of a non-HDS fieldset which shows an error message.\n */\n hasError?: boolean;\n //validationMessage?: never;\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: never;\n }\n | {\n hasError?: never;\n /**\n * Set an error message to add error styling, and display the error message.\n * The component will take care of aria to connect the error message to the checkbox.\n *\n * Use this when your checkbox is standalone (not part of a fieldset).\n */\n //validationMessage?: ReactNode;\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n }\n );\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (\n {\n variant = \"plain\",\n hasError: hasErrorProp,\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n title,\n children,\n className,\n size = \"\",\n ...rest\n },\n ref,\n ) => {\n const validationMessageId = useId();\n const { hasError: hasFieldsetError, size: fieldsetSize } = useFieldsetContext();\n const hasError = !!errorMessage || hasFieldsetError || hasErrorProp;\n const effectiveSize = size || fieldsetSize;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n\n return (\n <div\n className={clsx(\"hds-checkbox-wrapper\", {\n \"hds-checkbox-wrapper--small\": effectiveSize === \"small\",\n })}\n >\n <div\n className={clsx(\n \"hds-checkbox\",\n {\n [`hds-checkbox--${variant}`]: variant === \"bounding-box\",\n },\n className as undefined,\n )}\n >\n <label>\n <input\n aria-invalid={hasError ? true : undefined}\n aria-describedby={validationMessageValue ? validationMessageId : undefined}\n ref={ref}\n type=\"checkbox\"\n {...rest}\n />\n <span aria-hidden className=\"hds-checkbox__checkmark\" />\n {title ? <p className=\"hds-checkbox__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </div>\n );\n },\n);\nCheckbox.displayName = \"Checkbox\";\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ValidationMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ children, id, className, ...rest }, ref) => (\n <div\n aria-live=\"polite\"\n className={clsx(\"hds-validation-message\", className as undefined)}\n id={id}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n ),\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import {\n Children,\n cloneElement,\n isValidElement,\n useId,\n forwardRef,\n createContext,\n useContext,\n} from \"react\";\nimport type {\n FieldsetHTMLAttributes,\n ReactElement,\n ReactNode,\n CSSProperties,\n ComponentProps,\n} from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { getValidationMessageValue } from \"../../utils\";\nimport { FieldsetDescription } from \"./fieldset-description\";\nimport { FieldsetLegend } from \"./fieldset-legend\";\n\ntype FieldsetLegendProps = ComponentProps<typeof FieldsetLegend>;\n\nexport interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {\n className?: string;\n style?: CSSProperties;\n \"data-color\"?: \"info\" | \"success\" | \"warning\" | \"error\";\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\n /**\n * Providing an errorMessage will also give contained Checkboxes or Radio buttons\n * error styling and aria to indicate invalid state.\n *\n * For Radio buttons you are even better off using RadioGroup.\n */\n\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /**\n * @deprecated Pass props directly to <Fieldset.Legend> instead.\n */\n legendProps?: FieldsetLegendProps;\n /**\n * @deprecated Use <Fieldset.Legend>...</Fieldset.Legend> instead.\n */\n legend?: ReactNode;\n size?: \"small\" | \"\";\n children: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n}\n\n/** @deprecated Will no longer be needed */\nconst FieldsetContext = createContext<{ hasError: boolean; size: \"small\" | \"\" }>({\n hasError: false,\n size: \"\",\n});\n\n/** @deprecated Will no longer be needed */\nexport const useFieldsetContext = () => useContext(FieldsetContext);\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(function Fieldset(\n {\n className,\n style,\n \"data-color\": dataColor = undefined,\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n legendProps,\n legend,\n size = \"\",\n children,\n ...rest\n },\n ref,\n) {\n const validationMessageId = useId();\n const validationColor = errorMessage ? \"error\" : dataColor;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n const childArray = Children.toArray(children);\n const legendChild = childArray.find(\n (child): child is ReactElement<FieldsetLegendProps> =>\n isValidElement<FieldsetLegendProps>(child) && child.type === FieldsetLegend,\n );\n const contentChildren = legendChild\n ? childArray.filter((child) => child !== legendChild)\n : childArray;\n let renderedLegend = null;\n\n if (legendChild) {\n renderedLegend = cloneElement(legendChild, {\n ...legendProps,\n ...legendChild.props,\n className: clsx(\n legendProps?.className as undefined,\n legendChild.props.className as undefined,\n ),\n });\n } else if (legend !== undefined) {\n renderedLegend = <FieldsetLegend {...legendProps}>{legend}</FieldsetLegend>;\n }\n\n return (\n <fieldset\n aria-describedby={validationMessageValue ? validationMessageId : undefined}\n aria-invalid={errorMessage ? true : undefined}\n className={clsx(\"hds-fieldset\", { [`hds-fieldset--${size}`]: size }, className as undefined)}\n data-color={validationColor}\n ref={ref}\n style={style}\n {...rest}\n >\n {renderedLegend}\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage), size }}>\n {contentChildren}\n </FieldsetContext.Provider>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </fieldset>\n );\n}) as FieldsetType;\n\ntype FieldsetType = ReturnType<typeof forwardRef<HTMLFieldSetElement, FieldsetProps>> & {\n Description: typeof FieldsetDescription;\n Legend: typeof FieldsetLegend;\n};\n\nFieldset.Description = FieldsetDescription;\nFieldset.Legend = FieldsetLegend;\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport function getValidationMessageValue(\n validationMessage?: ReactNode | { value: ReactNode },\n errorMessage?: ReactNode,\n): ReactNode {\n if (validationMessage) {\n if (typeof validationMessage === \"object\" && \"value\" in validationMessage) {\n return validationMessage.value;\n }\n\n return validationMessage;\n }\n\n return errorMessage;\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n","import { forwardRef, type HTMLAttributes } from \"react\";\n\nexport type FieldsetDescriptionProps = HTMLAttributes<HTMLParagraphElement>;\n\n/**\n * FieldsetDescription component, used to display a description for a fieldset.\n *\n * @example\n * <FieldsetDescription>\n * Gi en kort beskrivelse i begge feltene\n * </FieldsetDescription>\n */\nexport const FieldsetDescription = forwardRef<HTMLParagraphElement, FieldsetDescriptionProps>(\n function FieldsetDescription(rest, ref) {\n return <p className=\"hds-fieldset__description\" ref={ref} {...rest} />;\n },\n);\n","import { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\n/**\n * FieldsetLegend component, used to display a legend for a fieldset.\n *\n * @example\n * <FieldsetLegend>Skriv inn dine svar</FieldsetLegend>\n */\nexport const FieldsetLegend = forwardRef<HTMLLegendElement, HTMLAttributes<HTMLLegendElement>>(\n function FieldsetLegend({ className, ...rest }, ref) {\n return (\n <legend\n className={clsx(\"hds-fieldset__legend\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n\nFieldsetLegend.displayName = \"Fieldset.Legend\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAA4E;AAC5E,IAAAC,0BAAqB;;;ACDrB,6BAAqB;AACrB,mBAA2C;AAUvC;AAFG,IAAM,wBAAoB;AAAA,EAC/B,CAAC,IAAsC,QAAK;AAA3C,iBAAE,YAAU,IAAI,UAVnB,IAUG,IAA8B,iBAA9B,IAA8B,CAA5B,YAAU,MAAI;AACf;AAAA,MAAC;AAAA;AAAA,QACC,aAAU;AAAA,QACV,eAAW,6BAAK,0BAA0B,SAAsB;AAAA,QAChE;AAAA,QACA;AAAA,SACI,OALL;AAAA,QAOE;AAAA;AAAA,IACH;AAAA;AAEJ;AACA,kBAAkB,cAAc;;;ACtBhC,IAAAC,gBAQO;AAQP,IAAAC,0BAAqB;;;AChBrB,YAAuB;AACvB,IAAAC,gBAA0D;AAmEnD,SAAS,0BACd,mBACA,cACW;AACX,MAAI,mBAAmB;AACrB,QAAI,OAAO,sBAAsB,YAAY,WAAW,mBAAmB;AACzE,aAAO,kBAAkB;AAAA,IAC3B;AAEA,WAAO;AAAA,EACT;AAEA,S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A,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAM,0BAAsB,qBAAM;AAClC,UAAM,EAAE,UAAU,kBAAkB,MAAM,aAAa,IAAI,mBAAmB;AAC9E,UAAM,WAAW,CAAC,CAAC,gBAAgB,oBAAoB;AACvD,UAAM,gBAAgB,QAAQ;AAC9B,UAAM,yBAAyB,0BAA0B,mBAAmB,YAAY;AAExF,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW,8BAAK,wBAAwB;AAAA,UACtC,+BAA+B,kBAAkB;AAAA,QACnD,CAAC;AAAA,QAED;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,eAAW;AAAA,gBACT;AAAA,gBACA;AAAA,kBACE,CAAC,iBAAiB,OAAO,EAAE,GAAG,YAAY;AAAA,gBAC5C;AAAA,gBACA;AAAA,cACF;AAAA,cAEA;AAAA,8DAAC,WACC;AAAA;AAAA,oBAAC;AAAA;AAAA,sBACC,gBAAc,WAAW,OAAO;AAAA,sBAChC,oBAAkB,yBAAyB,sBAAsB;AAAA,sBACjE;AAAA,sBACA,MAAK;AAAA,uBACD;AAAA,kBACN;AAAA,kBACA,6CAAC,UAAK,eAAW,MAAC,WAAU,2BAA0B;AAAA,kBACrD,QAAQ,6CAAC,OAAE,WAAU,uBAAuB,iBAAM,IAAO;AAAA,mBAC5D;AAAA,gBACC,QAAQ,WAAW;AAAA;AAAA;AAAA,UACtB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,IAAI;AAAA,eACC,0DAA0B,oBAFhC;AAAA,cAIE;AAAA;AAAA,UACH;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AACA,SAAS,cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_react","import_react","import_jsx_runtime","FieldsetDescription","import_react","import_typed_classname","import_jsx_runtime","FieldsetLegend","import_jsx_runtime","Fieldset","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/form/checkbox/index.tsx","../../../src/form/checkbox/checkbox.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/form/fieldset/fieldset.tsx","../../../src/utils/utils.ts","../../../src/form/fieldset/fieldset-description.tsx","../../../src/form/fieldset/fieldset-legend.tsx"],"sourcesContent":["export { Checkbox } from \"./checkbox\";\nexport type * from \"./checkbox\";\n","import { forwardRef, useId, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { useFieldsetContext } from \"../fieldset\";\nimport { getValidationMessageValue } from \"../../utils\";\n\nexport type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\" | \"size\"> & {\n children: ReactNode;\n variant?: \"plain\" | \"bounding-box\";\n title?: string;\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n size?: \"small\" | \"\";\n} & (\n | {\n /**\n * Set to `true` to add error styling. The component will take care of aria to indicate invalid state.\n *\n * Normally you don't need this, as you should wrap your Checkboxes in the Fieldset component.\n * When providing an errorMessage to Fieldset, all contained Checkboxes will get correct hasError state.\n *\n * You can use this when your checkbox is part of a non-HDS fieldset which shows an error message.\n */\n hasError?: boolean;\n //validationMessage?: never;\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: never;\n }\n | {\n hasError?: never;\n /**\n * Set an error message to add error styling, and display the error message.\n * The component will take care of aria to connect the error message to the checkbox.\n *\n * Use this when your checkbox is standalone (not part of a fieldset).\n */\n //validationMessage?: ReactNode;\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n }\n );\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(\n (\n {\n variant = \"plain\",\n hasError: hasErrorProp,\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n title,\n children,\n className,\n size = \"\",\n ...rest\n },\n ref,\n ) => {\n const validationMessageId = useId();\n const { hasError: hasFieldsetError, size: fieldsetSize } = useFieldsetContext();\n const hasError = !!errorMessage || hasFieldsetError || hasErrorProp;\n const effectiveSize = size || fieldsetSize;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n\n return (\n <div\n className={clsx(\"hds-checkbox-wrapper\", {\n \"hds-checkbox-wrapper--small\": effectiveSize === \"small\",\n })}\n >\n <div\n className={clsx(\n \"hds-checkbox\",\n {\n [`hds-checkbox--${variant}`]: variant === \"bounding-box\",\n },\n className as undefined,\n )}\n >\n <label>\n <input\n aria-invalid={hasError ? true : undefined}\n aria-describedby={validationMessageValue ? validationMessageId : undefined}\n ref={ref}\n type=\"checkbox\"\n {...rest}\n />\n <span aria-hidden className=\"hds-checkbox__checkmark\" />\n {title ? <p className=\"hds-checkbox__title\">{title}</p> : children}\n </label>\n {title ? children : null}\n </div>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </div>\n );\n },\n);\nCheckbox.displayName = \"Checkbox\";\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\n\nexport interface ValidationMessageProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ className, ...rest }, ref) => (\n <div\n aria-live=\"polite\"\n className={clsx(\"hds-validation-message\", className as undefined)}\n ref={ref}\n {...rest}\n />\n ),\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import {\n Children,\n cloneElement,\n isValidElement,\n useId,\n forwardRef,\n createContext,\n useContext,\n} from \"react\";\nimport type {\n FieldsetHTMLAttributes,\n ReactElement,\n ReactNode,\n CSSProperties,\n ComponentProps,\n} from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { getValidationMessageValue } from \"../../utils\";\nimport { FieldsetDescription } from \"./fieldset-description\";\nimport { FieldsetLegend } from \"./fieldset-legend\";\n\ntype FieldsetLegendProps = ComponentProps<typeof FieldsetLegend>;\n\nexport interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {\n className?: string;\n style?: CSSProperties;\n \"data-color\"?: \"info\" | \"success\" | \"warning\" | \"error\";\n validationMessage?: ReactNode | { value: ReactNode };\n validationMessageProps?: Partial<ValidationMessageProps>;\n /**\n * Providing an errorMessage will also give contained Checkboxes or Radio buttons\n * error styling and aria to indicate invalid state.\n *\n * For Radio buttons you are even better off using RadioGroup.\n */\n\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /**\n * @deprecated Pass props directly to <Fieldset.Legend> instead.\n */\n legendProps?: FieldsetLegendProps;\n /**\n * @deprecated Use <Fieldset.Legend>...</Fieldset.Legend> instead.\n */\n legend?: ReactNode;\n size?: \"small\" | \"\";\n children: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n}\n\n/** @deprecated Will no longer be needed */\nconst FieldsetContext = createContext<{ hasError: boolean; size: \"small\" | \"\" }>({\n hasError: false,\n size: \"\",\n});\n\n/** @deprecated Will no longer be needed */\nexport const useFieldsetContext = () => useContext(FieldsetContext);\n\nexport const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(function Fieldset(\n {\n className,\n style,\n \"data-color\": dataColor = undefined,\n validationMessage,\n validationMessageProps,\n errorMessage,\n errorMessageProps,\n legendProps,\n legend,\n size = \"\",\n children,\n ...rest\n },\n ref,\n) {\n const validationMessageId = useId();\n const validationColor = errorMessage ? \"error\" : dataColor;\n const validationMessageValue = getValidationMessageValue(validationMessage, errorMessage);\n const childArray = Children.toArray(children);\n const legendChild = childArray.find(\n (child): child is ReactElement<FieldsetLegendProps> =>\n isValidElement<FieldsetLegendProps>(child) && child.type === FieldsetLegend,\n );\n const contentChildren = legendChild\n ? childArray.filter((child) => child !== legendChild)\n : childArray;\n let renderedLegend = null;\n\n if (legendChild) {\n renderedLegend = cloneElement(legendChild, {\n ...legendProps,\n ...legendChild.props,\n className: clsx(\n legendProps?.className as undefined,\n legendChild.props.className as undefined,\n ),\n });\n } else if (legend !== undefined) {\n renderedLegend = <FieldsetLegend {...legendProps}>{legend}</FieldsetLegend>;\n }\n\n return (\n <fieldset\n aria-describedby={validationMessageValue ? validationMessageId : undefined}\n aria-invalid={errorMessage ? true : undefined}\n className={clsx(\"hds-fieldset\", { [`hds-fieldset--${size}`]: size }, className as undefined)}\n data-color={validationColor}\n ref={ref}\n style={style}\n {...rest}\n >\n {renderedLegend}\n <FieldsetContext.Provider value={{ hasError: Boolean(errorMessage), size }}>\n {contentChildren}\n </FieldsetContext.Provider>\n <ValidationMessage\n id={validationMessageId}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </fieldset>\n );\n}) as FieldsetType;\n\ntype FieldsetType = ReturnType<typeof forwardRef<HTMLFieldSetElement, FieldsetProps>> & {\n Description: typeof FieldsetDescription;\n Legend: typeof FieldsetLegend;\n};\n\nFieldset.Description = FieldsetDescription;\nFieldset.Legend = FieldsetLegend;\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\nimport type { ReactNode } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport function getValidationMessageValue(\n validationMessage?: ReactNode | { value: ReactNode },\n errorMessage?: ReactNode,\n): ReactNode {\n if (validationMessage) {\n if (typeof validationMessage === \"object\" && \"value\" in validationMessage) {\n return validationMessage.value;\n }\n\n return validationMessage;\n }\n\n return errorMessage;\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n","import { forwardRef, type HTMLAttributes } from \"react\";\n\nexport type FieldsetDescriptionProps = HTMLAttributes<HTMLParagraphElement>;\n\n/**\n * FieldsetDescription component, used to display a description for a fieldset.\n *\n * @example\n * <FieldsetDescription>\n * Gi en kort beskrivelse i begge feltene\n * </FieldsetDescription>\n */\nexport const FieldsetDescription = forwardRef<HTMLParagraphElement, FieldsetDescriptionProps>(\n function FieldsetDescription(rest, ref) {\n return <p className=\"hds-fieldset__description\" ref={ref} {...rest} />;\n },\n);\n","import { forwardRef, type HTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\n\n/**\n * FieldsetLegend component, used to display a legend for a fieldset.\n *\n * @example\n * <FieldsetLegend>Skriv inn dine svar</FieldsetLegend>\n */\nexport const FieldsetLegend = forwardRef<HTMLLegendElement, HTMLAttributes<HTMLLegendElement>>(\n function FieldsetLegend({ className, ...rest }, ref) {\n return (\n <legend\n className={clsx(\"hds-fieldset__legend\", className as undefined)}\n ref={ref}\n {...rest}\n />\n );\n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AAA,kBACE,CAAC,iBAAiB,OAAO,EAAE,GAAG,YAAY;AAAA,gBAC5C;AAAA,gBACA;AAAA,cACF;AAAA,cAEA;AAAA,8DAAC,WACC;AAAA;AAAA,oBAAC;AAAA;AAAA,sBACC,gBAAc,WAAW,OAAO;AAAA,sBAChC,oBAAkB,yBAAyB,sBAAsB;AAAA,sBACjE;AAAA,sBACA,MAAK;AAAA,uBACD;AAAA,kBACN;AAAA,kBACA,6CAAC,UAAK,eAAW,MAAC,WAAU,2BAA0B;AAAA,kBACrD,QAAQ,6CAAC,OAAE,WAAU,uBAAuB,iBAAM,IAAO;AAAA,mBAC5D;AAAA,gBACC,QAAQ,WAAW;AAAA;AAAA;AAAA,UACtB;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,IAAI;AAAA,eACC,0DAA0B,oBAFhC;AAAA,cAIE;AAAA;AAAA,UACH;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AACA,SAAS,cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_react","import_react","import_jsx_runtime","FieldsetDescription","import_react","import_typed_classname","import_jsx_runtime","FieldsetLegend","import_jsx_runtime","Fieldset","import_jsx_runtime"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import "../../chunk-YJOOSTJC.mjs";
|
|
2
2
|
import {
|
|
3
3
|
Checkbox
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-JGYPZ7ET.mjs";
|
|
5
5
|
import "../../chunk-CSIXGT7P.mjs";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-QOIBRXYT.mjs";
|
|
7
7
|
import "../../chunk-D2XZT2RA.mjs";
|
|
8
8
|
import "../../chunk-CD4LCDK3.mjs";
|
|
9
9
|
import "../../chunk-NSLSA7F7.mjs";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-VNH7CZJ4.mjs";
|
|
11
11
|
import "../../chunk-5M6MEYM7.mjs";
|
|
12
|
-
import "../../chunk-
|
|
12
|
+
import "../../chunk-F23MNQCK.mjs";
|
|
13
13
|
import "../../chunk-CYDWEPFL.mjs";
|
|
14
14
|
import "../../chunk-KPNAC2WN.mjs";
|
|
15
15
|
import "../../chunk-3V4GFS46.mjs";
|
|
@@ -75,17 +75,14 @@ var import_react = require("react");
|
|
|
75
75
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
76
76
|
var ValidationMessage = (0, import_react.forwardRef)(
|
|
77
77
|
(_a, ref) => {
|
|
78
|
-
var _b = _a, {
|
|
78
|
+
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
79
79
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
80
|
"div",
|
|
81
|
-
|
|
81
|
+
__spreadValues({
|
|
82
82
|
"aria-live": "polite",
|
|
83
83
|
className: (0, import_typed_classname.clsx)("hds-validation-message", className),
|
|
84
|
-
id,
|
|
85
84
|
ref
|
|
86
|
-
}, rest)
|
|
87
|
-
children
|
|
88
|
-
})
|
|
85
|
+
}, rest)
|
|
89
86
|
);
|
|
90
87
|
}
|
|
91
88
|
);
|