-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFieldset.mjs
More file actions
56 lines (49 loc) · 1.53 KB
/
Fieldset.mjs
File metadata and controls
56 lines (49 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// @ts-check
import classNameProp from "class-name-prop";
import React from "react";
/** CSS dependency URLs for the React component {@linkcode Fieldset}. */
export const css = new Set([new URL("./Fieldset.css", import.meta.url).href]);
/** React component for a {@link HTMLFieldSetElement fieldset}. */
const Fieldset = React.forwardRef(
(
/**
* @type {FieldsetProps
* & React.ComponentPropsWithoutRef<"fieldset">
* & { [dataAttribute: `data-${string}`]: unknown }}
*/
{ legend, children, className, ...props },
/** @type {React.ForwardedRef<HTMLFieldSetElement>} */
ref
) =>
React.createElement(
"fieldset",
{
className: classNameProp("daui-Fieldset", className),
...props,
ref,
},
legend &&
React.createElement(
"legend",
{ className: "daui-Fieldset__legend" },
legend
),
React.createElement(
"div",
{ className: "daui-Fieldset__children" },
children
)
)
);
Fieldset.displayName = "Fieldset";
export default Fieldset;
/**
* Props for the {@linkcode Fieldset} React component, excluding additional
* props for the {@linkcode HTMLFieldSetElement} container.
* @typedef {object} FieldsetProps
* @prop {React.ReactNode} [legend] {@link HTMLLegendElement Legend} children.
* May only contain
* [phrasing content](https://html.spec.whatwg.org/dev/dom.html#phrasing-content)
* and
* [heading content](https://html.spec.whatwg.org/dev/dom.html#heading-content).
*/