draft-components 3.0.1 → 3.1.0
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/css/draft-components.css
CHANGED
|
@@ -10,5 +10,10 @@ export type SelectionControlProps = {
|
|
|
10
10
|
label: ReactNode;
|
|
11
11
|
children: JSX.Element | SelectionControlRenderFn;
|
|
12
12
|
} & SelectionControlBaseProps;
|
|
13
|
-
export declare
|
|
13
|
+
export declare const SelectionControl: import("react").ForwardRefExoticComponent<{
|
|
14
|
+
labelFor?: string | undefined;
|
|
15
|
+
caption?: ReactNode;
|
|
16
|
+
label: ReactNode;
|
|
17
|
+
children: JSX.Element | SelectionControlRenderFn;
|
|
18
|
+
} & SelectionControlBaseProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
19
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cloneElement, useId } from 'react';
|
|
2
|
+
import { cloneElement, forwardRef, useId } from 'react';
|
|
3
3
|
import { classNames } from '../../lib/react-helpers.js';
|
|
4
4
|
import { Label } from '../label/index.js';
|
|
5
5
|
import { Caption } from '../caption/index.js';
|
|
6
|
-
export function SelectionControl({ label, labelFor, caption, className, children, ...props }) {
|
|
6
|
+
export const SelectionControl = forwardRef(function SelectionControl({ label, labelFor, caption, className, children, ...props }, ref) {
|
|
7
7
|
const defaultId = useId();
|
|
8
8
|
const controlId = labelFor || defaultId;
|
|
9
|
-
return (_jsxs("div", { ...props, className: classNames(className, {
|
|
9
|
+
return (_jsxs("div", { ...props, ref: ref, className: classNames(className, {
|
|
10
10
|
'dc-selection-control': true,
|
|
11
11
|
'dc-selection-control__with_caption': caption,
|
|
12
12
|
}), children: [_jsx("div", { className: "dc-selection-control__input", children: typeof children === 'function'
|
|
@@ -14,4 +14,4 @@ export function SelectionControl({ label, labelFor, caption, className, children
|
|
|
14
14
|
: cloneElement(children, { id: children.props.id || controlId }) }), _jsx(Label, { className: "dc-selection-control__label", htmlFor: controlId, children: label }), caption
|
|
15
15
|
? (_jsx(Caption, { className: "dc-selection-control__caption", children: caption }))
|
|
16
16
|
: null] }));
|
|
17
|
-
}
|
|
17
|
+
});
|