@coopdigital/react 0.48.0 → 0.49.1

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,11 @@
1
+ import type { FormHTMLAttributes, JSX, ReactNode, Ref } from "react";
2
+ export interface FormProps extends FormHTMLAttributes<HTMLFormElement> {
3
+ /** **(Optional)** Main content inside the form. This will usually be a collection of Field, Fieldset and Button components. */
4
+ children?: string | ReactNode;
5
+ /** **(Optional)** Specify additional CSS classes to be applied to the component. */
6
+ className?: string;
7
+ /** **(Optional)** Specify a custom React ref for this component. */
8
+ ref?: Ref<HTMLFormElement>;
9
+ }
10
+ export declare const Form: ({ children, className, ref, ...props }: FormProps) => JSX.Element;
11
+ export default Form;
@@ -0,0 +1,12 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import clsx from 'clsx';
3
+
4
+ const Form = ({ children, className, ref, ...props }) => {
5
+ const componentProps = {
6
+ className: clsx("coop-form ", className),
7
+ ...props,
8
+ };
9
+ return (jsx("form", { ...componentProps, ref: ref, children: children }));
10
+ };
11
+
12
+ export { Form, Form as default };
@@ -0,0 +1,4 @@
1
+ import Form from "./Form";
2
+ export default Form;
3
+ export { Form };
4
+ export * from "./Form";
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from "./components/Expandable";
7
7
  export * from "./components/Field";
8
8
  export * from "./components/Fieldset";
9
9
  export * from "./components/Flourish";
10
+ export * from "./components/Form";
10
11
  export * from "./components/Image";
11
12
  export * from "./components/Pill";
12
13
  export * from "./components/Radio";
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ export { Expandable } from './components/Expandable/Expandable.js';
7
7
  export { Field, FieldControl } from './components/Field/Field.js';
8
8
  export { Fieldset, FieldsetFields } from './components/Fieldset/Fieldset.js';
9
9
  export { Flourish } from './components/Flourish/Flourish.js';
10
+ export { Form } from './components/Form/Form.js';
10
11
  export { Image } from './components/Image/Image.js';
11
12
  export { Pill } from './components/Pill/Pill.js';
12
13
  export { Radio } from './components/Radio/Radio.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopdigital/react",
3
3
  "type": "module",
4
- "version": "0.48.0",
4
+ "version": "0.49.1",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -57,18 +57,18 @@
57
57
  "devDependencies": {
58
58
  "@axe-core/playwright": "^4.11.0",
59
59
  "@playwright/test": "^1.57.0",
60
- "@storybook/addon-a11y": "^10.1.0",
61
- "@storybook/addon-docs": "^10.1.0",
62
- "@storybook/addon-onboarding": "^10.1.0",
63
- "@storybook/react-vite": "^10.1.0",
60
+ "@storybook/addon-a11y": "^10.1.11",
61
+ "@storybook/addon-docs": "^10.1.11",
62
+ "@storybook/addon-onboarding": "^10.1.11",
63
+ "@storybook/react-vite": "^10.1.11",
64
64
  "@testing-library/jest-dom": "^6.9.1",
65
- "@testing-library/react": "^16.3.0",
65
+ "@testing-library/react": "^16.3.1",
66
66
  "@types/react": "^19.2.7",
67
67
  "@types/react-dom": "^19.2.3",
68
- "react": "^19.2.0",
69
- "react-dom": "^19.2.0",
68
+ "react": "^19.2.3",
69
+ "react-dom": "^19.2.3",
70
70
  "serve": "^14.2.5",
71
- "storybook": "^10.1.0"
71
+ "storybook": "^10.1.11"
72
72
  },
73
73
  "peerDependencies": {
74
74
  "react": "^19.1.0",
@@ -78,8 +78,8 @@
78
78
  "storybook": "$storybook"
79
79
  },
80
80
  "dependencies": {
81
- "@coopdigital/styles": "^0.41.0",
81
+ "@coopdigital/styles": "^0.42.1",
82
82
  "clsx": "^2.1.1"
83
83
  },
84
- "gitHead": "96d3459231c76b94984900894ac0ae2bac2f091b"
84
+ "gitHead": "55ae9bb5c240621f1047179774b45e957985a736"
85
85
  }
@@ -0,0 +1,27 @@
1
+ import type { FormHTMLAttributes, JSX, ReactNode, Ref } from "react"
2
+
3
+ import clsx from "clsx"
4
+
5
+ export interface FormProps extends FormHTMLAttributes<HTMLFormElement> {
6
+ /** **(Optional)** Main content inside the form. This will usually be a collection of Field, Fieldset and Button components. */
7
+ children?: string | ReactNode
8
+ /** **(Optional)** Specify additional CSS classes to be applied to the component. */
9
+ className?: string
10
+ /** **(Optional)** Specify a custom React ref for this component. */
11
+ ref?: Ref<HTMLFormElement>
12
+ }
13
+
14
+ export const Form = ({ children, className, ref, ...props }: FormProps): JSX.Element => {
15
+ const componentProps = {
16
+ className: clsx("coop-form ", className),
17
+ ...props,
18
+ }
19
+
20
+ return (
21
+ <form {...componentProps} ref={ref}>
22
+ {children}
23
+ </form>
24
+ )
25
+ }
26
+
27
+ export default Form
@@ -0,0 +1,5 @@
1
+ import Form from "./Form"
2
+
3
+ export default Form
4
+ export { Form }
5
+ export * from "./Form"
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ export * from "./components/Expandable"
7
7
  export * from "./components/Field"
8
8
  export * from "./components/Fieldset"
9
9
  export * from "./components/Flourish"
10
+ export * from "./components/Form"
10
11
  export * from "./components/Image"
11
12
  export * from "./components/Pill"
12
13
  export * from "./components/Radio"