@coopdigital/react 1.23.0 → 1.24.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.
@@ -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,2 @@
1
+ import { Section, SectionProps } from "./Section.js";
2
+ export { Section, Section as default, SectionProps };
@@ -0,0 +1,5 @@
1
+ import { Section } from "./Section.js";
2
+ //#region src/components/Section/index.ts
3
+ var Section_default = Section;
4
+ //#endregion
5
+ export { Section, Section_default 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 };
@@ -0,0 +1,2 @@
1
+ import { Wrapper, WrapperProps } from "./Wrapper.js";
2
+ export { Wrapper, Wrapper as default, WrapperProps };
@@ -0,0 +1,5 @@
1
+ import { Wrapper } from "./Wrapper.js";
2
+ //#region src/components/Wrapper/index.ts
3
+ var Wrapper_default = Wrapper;
4
+ //#endregion
5
+ export { Wrapper, Wrapper_default 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
- 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, Select, SelectOption, SelectOptionGroup, SelectProps, Signpost, SignpostProps, SkipNav, SkipNavProps, Squircle, SquircleProps, SquircleSvgProps, Tag, TagProps, TextInput, TextInputProps, Textarea, TextareaProps, ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt, ValidationSummaryProps };
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
- 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, Select, SelectOption, SelectOptionGroup, Signpost, SkipNav, Squircle, Tag, TextInput, Textarea, ValidationSummary, ValidationSummaryErrors, ValidationSummaryHeading, ValidationSummaryPrompt };
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.23.0",
4
+ "version": "1.24.0",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -115,5 +115,5 @@
115
115
  "merge-refs": "^2.0.0",
116
116
  "react-day-picker": "^10.0.1"
117
117
  },
118
- "gitHead": "c8458928ecfa27cda6cb6293952a31f68c00eed3"
118
+ "gitHead": "74c62ece6c7a4f0770bf52b466ccd98b36550233"
119
119
  }
@@ -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,5 @@
1
+ import Section from "./Section"
2
+
3
+ export default Section
4
+ export { Section }
5
+ export * from "./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
@@ -0,0 +1,5 @@
1
+ import Wrapper from "./Wrapper"
2
+
3
+ export default Wrapper
4
+ export { Wrapper }
5
+ export * from "./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"