@coopdigital/react 1.23.0 → 1.25.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/dist/components/AlertBanner/AlertBanner.d.ts +1 -1
- package/dist/components/Fieldset/Fieldset.d.ts +3 -8
- package/dist/components/Fieldset/Fieldset.js +2 -4
- package/dist/components/Section/Section.d.ts +18 -0
- package/dist/components/Section/Section.js +16 -0
- package/dist/components/Section/index.d.ts +2 -0
- package/dist/components/Section/index.js +5 -0
- package/dist/components/Wrapper/Wrapper.d.ts +18 -0
- package/dist/components/Wrapper/Wrapper.js +16 -0
- package/dist/components/Wrapper/index.d.ts +2 -0
- package/dist/components/Wrapper/index.js +5 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +3 -1
- package/package.json +4 -3
- package/src/components/AlertBanner/AlertBanner.tsx +1 -1
- package/src/components/Fieldset/Fieldset.tsx +0 -9
- package/src/components/Section/Section.tsx +31 -0
- package/src/components/Section/index.ts +5 -0
- package/src/components/Wrapper/Wrapper.tsx +32 -0
- package/src/components/Wrapper/index.ts +5 -0
- package/src/index.ts +2 -0
|
@@ -10,7 +10,7 @@ export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
10
10
|
/** Specify a custom React ref for this component. */
|
|
11
11
|
ref?: Ref<HTMLDivElement>;
|
|
12
12
|
/** Specify the component variant. */
|
|
13
|
-
variant?: "black" | "default";
|
|
13
|
+
variant?: "black" | "grey" | "default";
|
|
14
14
|
}
|
|
15
15
|
interface AlertBannerHeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
16
16
|
/** Content inside the component. */
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { StandardSizes } from "../../types/index.js";
|
|
2
1
|
import { ErrorProps } from "../FieldMarkers/Error.js";
|
|
3
2
|
import { HintProps } from "../FieldMarkers/Hint.js";
|
|
4
3
|
import { LegendProps } from "../FieldMarkers/Legend.js";
|
|
@@ -19,11 +18,9 @@ export interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElemen
|
|
|
19
18
|
hideErrorBar?: boolean;
|
|
20
19
|
/** Specify a custom React ref for this component. */
|
|
21
20
|
ref?: Ref<HTMLFieldSetElement>;
|
|
22
|
-
/** Specify the size of the component. Applies to all descendants. */
|
|
23
|
-
size?: StandardSizes;
|
|
24
21
|
}
|
|
25
22
|
declare const Fieldset: {
|
|
26
|
-
({ children, className, disabled, error, hideErrorBar, ref,
|
|
23
|
+
({ children, className, disabled, error, hideErrorBar, ref, ...props }: FieldsetProps): JSX.Element;
|
|
27
24
|
slot: {
|
|
28
25
|
name: string;
|
|
29
26
|
};
|
|
@@ -34,7 +31,7 @@ declare const Fieldset: {
|
|
|
34
31
|
};
|
|
35
32
|
};
|
|
36
33
|
Fields: {
|
|
37
|
-
({
|
|
34
|
+
({ children, className, orientation, ...props }: FieldsetFieldsProps): JSX.Element;
|
|
38
35
|
slot: {
|
|
39
36
|
name: string;
|
|
40
37
|
};
|
|
@@ -53,8 +50,6 @@ declare const Fieldset: {
|
|
|
53
50
|
};
|
|
54
51
|
};
|
|
55
52
|
interface FieldsetFieldsProps extends HTMLAttributes<HTMLDivElement> {
|
|
56
|
-
/** Specify whether all descendant Fields should render inside a box. */
|
|
57
|
-
boxed?: boolean;
|
|
58
53
|
/** Content inside the component. */
|
|
59
54
|
children?: React.ReactNode;
|
|
60
55
|
/** Specify additional CSS classes. */
|
|
@@ -63,7 +58,7 @@ interface FieldsetFieldsProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
63
58
|
orientation?: "horizontal" | "vertical";
|
|
64
59
|
}
|
|
65
60
|
declare const FieldsetFields: {
|
|
66
|
-
({
|
|
61
|
+
({ children, className, orientation, ...props }: FieldsetFieldsProps): JSX.Element;
|
|
67
62
|
slot: {
|
|
68
63
|
name: string;
|
|
69
64
|
};
|
|
@@ -4,13 +4,12 @@ import { Legend } from "../FieldMarkers/Legend.js";
|
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/Fieldset/Fieldset.tsx
|
|
7
|
-
const Fieldset = ({ children, className, disabled, error = false, hideErrorBar = false, ref,
|
|
7
|
+
const Fieldset = ({ children, className, disabled, error = false, hideErrorBar = false, ref, ...props }) => {
|
|
8
8
|
const componentProps = {
|
|
9
9
|
"aria-disabled": disabled,
|
|
10
10
|
className: clsx("coop-fieldset", className),
|
|
11
11
|
"data-error": error || void 0,
|
|
12
12
|
"data-hide-error": hideErrorBar || void 0,
|
|
13
|
-
"data-size": size ?? void 0,
|
|
14
13
|
disabled,
|
|
15
14
|
...props
|
|
16
15
|
};
|
|
@@ -20,10 +19,9 @@ const Fieldset = ({ children, className, disabled, error = false, hideErrorBar =
|
|
|
20
19
|
children
|
|
21
20
|
});
|
|
22
21
|
};
|
|
23
|
-
const FieldsetFields = ({
|
|
22
|
+
const FieldsetFields = ({ children, className, orientation = "vertical", ...props }) => {
|
|
24
23
|
const componentProps = {
|
|
25
24
|
className: clsx("coop-fieldset-fields", className),
|
|
26
|
-
"data-boxed": boxed || void 0,
|
|
27
25
|
"data-orientation": orientation !== "vertical" ? orientation : void 0,
|
|
28
26
|
...props
|
|
29
27
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { HTMLAttributes, JSX, ReactNode, Ref } from "react";
|
|
2
|
+
//#region src/components/Section/Section.d.ts
|
|
3
|
+
export interface SectionProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Specify a custom element for the component
|
|
5
|
+
*
|
|
6
|
+
* Default: `<section>`
|
|
7
|
+
*/
|
|
8
|
+
as?: React.FC<any> | string;
|
|
9
|
+
/** **(Optional)** Content inside the component. */
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
/** **(Optional)** Specify additional CSS classes. */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** **(Optional)** Specify a custom React ref for this component. */
|
|
14
|
+
ref?: Ref<HTMLDivElement>;
|
|
15
|
+
}
|
|
16
|
+
export declare const Section: ({ as, children, className, ref, ...props }: SectionProps) => JSX.Element;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Section as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import React from "react";
|
|
3
|
+
//#region src/components/Section/Section.tsx
|
|
4
|
+
const Section = ({ as, children, className, ref, ...props }) => {
|
|
5
|
+
const componentProps = {
|
|
6
|
+
className: clsx("coop-section", className),
|
|
7
|
+
...props
|
|
8
|
+
};
|
|
9
|
+
const element = as ?? "section";
|
|
10
|
+
return React.createElement(element, {
|
|
11
|
+
...componentProps,
|
|
12
|
+
ref
|
|
13
|
+
}, children);
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Section, Section as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { HTMLAttributes, JSX, ReactNode, Ref } from "react";
|
|
2
|
+
//#region src/components/Wrapper/Wrapper.d.ts
|
|
3
|
+
export interface WrapperProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Specify a custom element for the component
|
|
5
|
+
*
|
|
6
|
+
* Default: `<div>`
|
|
7
|
+
*/
|
|
8
|
+
as?: React.FC<any> | string;
|
|
9
|
+
/** **(Optional)** Content inside the component. */
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
/** **(Optional)** Specify additional CSS classes. */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** **(Optional)** Specify a custom React ref for this component. */
|
|
14
|
+
ref?: Ref<HTMLDivElement>;
|
|
15
|
+
}
|
|
16
|
+
export declare const Wrapper: ({ as, children, className, ref, ...props }: WrapperProps) => JSX.Element;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Wrapper as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import React from "react";
|
|
3
|
+
//#region src/components/Wrapper/Wrapper.tsx
|
|
4
|
+
const Wrapper = ({ as, children, className, ref, ...props }) => {
|
|
5
|
+
const componentProps = {
|
|
6
|
+
className: clsx("coop-wrap", className),
|
|
7
|
+
...props
|
|
8
|
+
};
|
|
9
|
+
const element = as ?? "div";
|
|
10
|
+
return React.createElement(element, {
|
|
11
|
+
...componentProps,
|
|
12
|
+
ref
|
|
13
|
+
}, children);
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Wrapper, Wrapper as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ import { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverProps, Pop
|
|
|
27
27
|
import { Radio, RadioProps } from "./components/Radio/Radio.js";
|
|
28
28
|
import { RootSVG } from "./components/RootSVG/RootSVG.js";
|
|
29
29
|
import { Searchbox, SearchboxButton, SearchboxInput, SearchboxProps } from "./components/Searchbox/Searchbox.js";
|
|
30
|
+
import { Section, SectionProps } from "./components/Section/Section.js";
|
|
31
|
+
import "./components/Section/index.js";
|
|
30
32
|
import { Select, SelectOption, SelectOptionGroup, SelectProps } from "./components/Select/Select.js";
|
|
31
33
|
import { Signpost, SignpostProps } from "./components/Signpost/Signpost.js";
|
|
32
34
|
import { SkipNav, SkipNavProps } from "./components/SkipNav/SkipNav.js";
|
|
@@ -34,4 +36,6 @@ import { Squircle, SquircleProps, SquircleSvgProps } from "./components/Squircle
|
|
|
34
36
|
import { Tag, TagProps } from "./components/Tag/Tag.js";
|
|
35
37
|
import { Textarea, TextareaProps } from "./components/Textarea/Textarea.js";
|
|
36
38
|
import { ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt, ValidationSummaryProps } from "./components/ValidationSummary/ValidationSummary.js";
|
|
37
|
-
|
|
39
|
+
import { Wrapper, WrapperProps } from "./components/Wrapper/Wrapper.js";
|
|
40
|
+
import "./components/Wrapper/index.js";
|
|
41
|
+
export { AlertBanner, AlertBannerHeading, AlertBannerProps, Author, AuthorProps, Box, BoxProps, Button, ButtonProps, Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, CardProps, Checkbox, CheckboxProps, Combobox, ComboboxControlsProps, ComboboxInputProps, ComboboxOptionsProps, ComboboxProps, DatePicker, DatePickerProps, type DateType, type DateTypeStr, Dialog, DialogBody, DialogHeader, DialogProps, Expandable, ExpandableContent, ExpandableProps, ExpandableSummary, Field, FieldError, FieldHint, FieldLabel, Fieldset, FieldsetError, FieldsetFields, FieldsetHint, FieldsetLegend, FieldsetProps, Flourish, FlourishProps, Form, FormProps, Image, ImageProps, LoadingSpinner, LoadingSpinnerProps, Logo, LogoProps, PasswordInput, PasswordInputProps, Picture, PictureProps, Pill, PillBadge, PillProps, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverProps, PopoverTrigger, Radio, RadioProps, RootSVG, Searchbox, SearchboxButton, SearchboxInput, SearchboxProps, Section, SectionProps, Select, SelectOption, SelectOptionGroup, SelectProps, Signpost, SignpostProps, SkipNav, SkipNavProps, Squircle, SquircleProps, SquircleSvgProps, Tag, TagProps, TextInput, TextInputProps, Textarea, TextareaProps, ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt, ValidationSummaryProps, Wrapper, WrapperProps };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ import { Pill, PillBadge } from "./components/Pill/Pill.js";
|
|
|
23
23
|
import { Radio } from "./components/Radio/Radio.js";
|
|
24
24
|
import { RootSVG } from "./components/RootSVG/RootSVG.js";
|
|
25
25
|
import { Searchbox, SearchboxButton, SearchboxInput } from "./components/Searchbox/Searchbox.js";
|
|
26
|
+
import { Section } from "./components/Section/Section.js";
|
|
26
27
|
import { Select, SelectOption, SelectOptionGroup } from "./components/Select/Select.js";
|
|
27
28
|
import { Signpost } from "./components/Signpost/Signpost.js";
|
|
28
29
|
import { SkipNav } from "./components/SkipNav/SkipNav.js";
|
|
@@ -30,4 +31,5 @@ import { Squircle } from "./components/Squircle/Squircle.js";
|
|
|
30
31
|
import { Tag } from "./components/Tag/Tag.js";
|
|
31
32
|
import { Textarea } from "./components/Textarea/Textarea.js";
|
|
32
33
|
import { ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt } from "./components/ValidationSummary/ValidationSummary.js";
|
|
33
|
-
|
|
34
|
+
import { Wrapper } from "./components/Wrapper/Wrapper.js";
|
|
35
|
+
export { AlertBanner, AlertBannerHeading, Author, Box, Button, Card, CardBadge, CardContent, CardHeading, CardIcon, CardImage, CardLink, CardPicture, Checkbox, Combobox, DatePicker, Dialog, DialogBody, DialogHeader, Expandable, ExpandableContent, ExpandableSummary, Field, FieldError, FieldHint, FieldLabel, Fieldset, FieldsetError, FieldsetFields, FieldsetHint, FieldsetLegend, Flourish, Form, Image, LoadingSpinner, Logo, PasswordInput, Picture, Pill, PillBadge, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Radio, RootSVG, Searchbox, SearchboxButton, SearchboxInput, Section, Select, SelectOption, SelectOptionGroup, Signpost, SkipNav, Squircle, Tag, TextInput, Textarea, ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt, Wrapper };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopdigital/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.25.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"@playwright/test": "^1.63.0",
|
|
72
72
|
"@storybook/addon-a11y": "^10.6.0",
|
|
73
73
|
"@storybook/addon-docs": "^10.6.0",
|
|
74
|
+
"@storybook/addon-links": "^10.6.0",
|
|
74
75
|
"@storybook/addon-onboarding": "^10.6.0",
|
|
75
76
|
"@storybook/react-vite": "^10.6.0",
|
|
76
77
|
"@testing-library/jest-dom": "^7.0.1",
|
|
@@ -106,7 +107,7 @@
|
|
|
106
107
|
"storybook": "$storybook"
|
|
107
108
|
},
|
|
108
109
|
"dependencies": {
|
|
109
|
-
"@coopdigital/styles": "^1.
|
|
110
|
+
"@coopdigital/styles": "^1.18.0",
|
|
110
111
|
"@radix-ui/react-popover": "^1.1.23",
|
|
111
112
|
"clsx": "^2.1.1",
|
|
112
113
|
"date-fns": "^4.4.0",
|
|
@@ -115,5 +116,5 @@
|
|
|
115
116
|
"merge-refs": "^2.0.0",
|
|
116
117
|
"react-day-picker": "^10.0.1"
|
|
117
118
|
},
|
|
118
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "f6b4f40d340e6382403d2d69a399b0a913e658c8"
|
|
119
120
|
}
|
|
@@ -12,7 +12,7 @@ export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
12
12
|
/** Specify a custom React ref for this component. */
|
|
13
13
|
ref?: Ref<HTMLDivElement>
|
|
14
14
|
/** Specify the component variant. */
|
|
15
|
-
variant?: "black" | "default"
|
|
15
|
+
variant?: "black" | "grey" | "default"
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
interface AlertBannerHeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
@@ -4,7 +4,6 @@ import { type FieldsetHTMLAttributes, HTMLAttributes, type JSX, Ref } from "reac
|
|
|
4
4
|
import { Error as BaseError, type ErrorProps } from "@/components/FieldMarkers/Error"
|
|
5
5
|
import { Hint as BaseHint, type HintProps } from "@/components/FieldMarkers/Hint"
|
|
6
6
|
import { Legend as BaseLegend, type LegendProps } from "@/components/FieldMarkers/Legend"
|
|
7
|
-
import { StandardSizes } from "@/types"
|
|
8
7
|
|
|
9
8
|
export interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {
|
|
10
9
|
/** Content inside the component.
|
|
@@ -21,8 +20,6 @@ export interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElemen
|
|
|
21
20
|
hideErrorBar?: boolean
|
|
22
21
|
/** Specify a custom React ref for this component. */
|
|
23
22
|
ref?: Ref<HTMLFieldSetElement>
|
|
24
|
-
/** Specify the size of the component. Applies to all descendants. */
|
|
25
|
-
size?: StandardSizes
|
|
26
23
|
}
|
|
27
24
|
const Fieldset = ({
|
|
28
25
|
children,
|
|
@@ -31,7 +28,6 @@ const Fieldset = ({
|
|
|
31
28
|
error = false,
|
|
32
29
|
hideErrorBar = false,
|
|
33
30
|
ref,
|
|
34
|
-
size,
|
|
35
31
|
...props
|
|
36
32
|
}: FieldsetProps): JSX.Element => {
|
|
37
33
|
const componentProps = {
|
|
@@ -39,7 +35,6 @@ const Fieldset = ({
|
|
|
39
35
|
className: clsx("coop-fieldset", className),
|
|
40
36
|
"data-error": error || undefined,
|
|
41
37
|
"data-hide-error": hideErrorBar || undefined,
|
|
42
|
-
"data-size": size ?? undefined,
|
|
43
38
|
disabled,
|
|
44
39
|
...props,
|
|
45
40
|
}
|
|
@@ -52,8 +47,6 @@ const Fieldset = ({
|
|
|
52
47
|
}
|
|
53
48
|
|
|
54
49
|
interface FieldsetFieldsProps extends HTMLAttributes<HTMLDivElement> {
|
|
55
|
-
/** Specify whether all descendant Fields should render inside a box. */
|
|
56
|
-
boxed?: boolean
|
|
57
50
|
/** Content inside the component. */
|
|
58
51
|
children?: React.ReactNode
|
|
59
52
|
/** Specify additional CSS classes. */
|
|
@@ -63,7 +56,6 @@ interface FieldsetFieldsProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
63
56
|
}
|
|
64
57
|
|
|
65
58
|
const FieldsetFields = ({
|
|
66
|
-
boxed = false,
|
|
67
59
|
children,
|
|
68
60
|
className,
|
|
69
61
|
orientation = "vertical",
|
|
@@ -71,7 +63,6 @@ const FieldsetFields = ({
|
|
|
71
63
|
}: FieldsetFieldsProps): JSX.Element => {
|
|
72
64
|
const componentProps = {
|
|
73
65
|
className: clsx("coop-fieldset-fields", className),
|
|
74
|
-
"data-boxed": boxed || undefined,
|
|
75
66
|
"data-orientation": orientation !== "vertical" ? orientation : undefined,
|
|
76
67
|
...props,
|
|
77
68
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HTMLAttributes, JSX, ReactNode, Ref } from "react"
|
|
2
|
+
|
|
3
|
+
import clsx from "clsx"
|
|
4
|
+
import React from "react"
|
|
5
|
+
|
|
6
|
+
export interface SectionProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
/** Specify a custom element for the component
|
|
8
|
+
*
|
|
9
|
+
* Default: `<section>`
|
|
10
|
+
*/
|
|
11
|
+
// oxlint-disable-next-line typescript/no-explicit-any
|
|
12
|
+
as?: React.FC<any> | string
|
|
13
|
+
/** **(Optional)** Content inside the component. */
|
|
14
|
+
children?: ReactNode
|
|
15
|
+
/** **(Optional)** Specify additional CSS classes. */
|
|
16
|
+
className?: string
|
|
17
|
+
/** **(Optional)** Specify a custom React ref for this component. */
|
|
18
|
+
ref?: Ref<HTMLDivElement>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Section = ({ as, children, className, ref, ...props }: SectionProps): JSX.Element => {
|
|
22
|
+
const componentProps = {
|
|
23
|
+
className: clsx("coop-section", className),
|
|
24
|
+
...props,
|
|
25
|
+
}
|
|
26
|
+
const element: SectionProps["as"] = as ?? "section"
|
|
27
|
+
|
|
28
|
+
return React.createElement(element, { ...componentProps, ref }, children)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default Section
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { HTMLAttributes, JSX, ReactNode, Ref } from "react"
|
|
2
|
+
|
|
3
|
+
import clsx from "clsx"
|
|
4
|
+
import React from "react"
|
|
5
|
+
|
|
6
|
+
export interface WrapperProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
/** Specify a custom element for the component
|
|
8
|
+
*
|
|
9
|
+
* Default: `<div>`
|
|
10
|
+
*/
|
|
11
|
+
// oxlint-disable-next-line typescript/no-explicit-any
|
|
12
|
+
as?: React.FC<any> | string
|
|
13
|
+
/** **(Optional)** Content inside the component. */
|
|
14
|
+
children?: ReactNode
|
|
15
|
+
/** **(Optional)** Specify additional CSS classes. */
|
|
16
|
+
className?: string
|
|
17
|
+
/** **(Optional)** Specify a custom React ref for this component. */
|
|
18
|
+
ref?: Ref<HTMLDivElement>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Wrapper = ({ as, children, className, ref, ...props }: WrapperProps): JSX.Element => {
|
|
22
|
+
const componentProps = {
|
|
23
|
+
className: clsx("coop-wrap", className),
|
|
24
|
+
...props,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const element: WrapperProps["as"] = as ?? "div"
|
|
28
|
+
|
|
29
|
+
return React.createElement(element, { ...componentProps, ref }, children)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default Wrapper
|
package/src/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * from "./components/Popover/Popover"
|
|
|
22
22
|
export * from "./components/Radio/Radio"
|
|
23
23
|
export * from "./components/RootSVG/RootSVG"
|
|
24
24
|
export * from "./components/Searchbox/Searchbox"
|
|
25
|
+
export * from "./components/Section"
|
|
25
26
|
export * from "./components/Select/Select"
|
|
26
27
|
export * from "./components/Signpost/Signpost"
|
|
27
28
|
export * from "./components/SkipNav/SkipNav"
|
|
@@ -30,3 +31,4 @@ export * from "./components/Tag/Tag"
|
|
|
30
31
|
export * from "./components/Textarea/Textarea"
|
|
31
32
|
export * from "./components/TextInput/TextInput"
|
|
32
33
|
export * from "./components/ValidationSummary/ValidationSummary"
|
|
34
|
+
export * from "./components/Wrapper"
|