@coopdigital/react 1.32.5 → 1.33.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.
@@ -15,11 +15,16 @@ interface FieldProps extends HTMLAttributes<HTMLDivElement> {
15
15
  error?: boolean;
16
16
  /** Specify whether the Field should show the left-hand error bar if it is in an error state. */
17
17
  hideErrorBar?: boolean;
18
+ /** For Radio and Checkbox, specify whether the control renders on the same row as the label.
19
+ *
20
+ * Default: `true`
21
+ */
22
+ inline?: boolean;
18
23
  /** Specify a custom React ref for this component. */
19
24
  ref?: Ref<HTMLDivElement>;
20
25
  }
21
26
  declare const Field: {
22
- ({ boxed, children, className, error: errorProp, hideErrorBar, ref, ...props }: FieldProps): JSX.Element;
27
+ ({ boxed, children, className, error: errorProp, hideErrorBar, inline, ref, ...props }: FieldProps): JSX.Element;
23
28
  slot: {
24
29
  name: string;
25
30
  };
@@ -11,7 +11,7 @@ import clsx from "clsx";
11
11
  import { jsx } from "react/jsx-runtime";
12
12
  import "react";
13
13
  // src/components/Field/Field.tsx
14
- const Field = ({ boxed = false, children, className, error: errorProp, hideErrorBar = false, ref, ...props }) => {
14
+ const Field = ({ boxed = false, children, className, error: errorProp, hideErrorBar = false, inline, ref, ...props }) => {
15
15
  const internalId = useId$1();
16
16
  const fieldset = useFieldset();
17
17
  const error = errorProp ?? fieldset?.error ?? false;
@@ -33,10 +33,11 @@ const Field = ({ boxed = false, children, className, error: errorProp, hideError
33
33
  const componentProps = {
34
34
  ...props,
35
35
  "aria-disabled": controlProps.disabled || void 0,
36
- className: clsx("coop-field", controlProps.inline && "coop-field-inline", className),
36
+ className: clsx("coop-field", className),
37
37
  "data-boxed": boxed || void 0,
38
38
  "data-error": error || void 0,
39
- "data-hide-error": hideErrorBar || void 0
39
+ "data-hide-error": hideErrorBar || void 0,
40
+ "data-inline": inline ?? controlProps.inline
40
41
  };
41
42
  return /* @__PURE__ */ jsx(FieldContext.Provider, {
42
43
  value: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopdigital/react",
3
3
  "type": "module",
4
- "version": "1.32.5",
4
+ "version": "1.33.0",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -117,7 +117,7 @@
117
117
  "storybook": "$storybook"
118
118
  },
119
119
  "dependencies": {
120
- "@coopdigital/styles": "^1.23.3",
120
+ "@coopdigital/styles": "^1.24.0",
121
121
  "@radix-ui/react-popover": "^1.3.1",
122
122
  "clsx": "^2.1.1",
123
123
  "date-fns": "^4.4.0",
@@ -126,5 +126,5 @@
126
126
  "merge-refs": "^2.0.0",
127
127
  "react-day-picker": "^10.0.2"
128
128
  },
129
- "gitHead": "967ab491b4a0120dacd119a58c6c973cc8ccb335"
129
+ "gitHead": "5dfe0e7c059ab52fcc2b68b94ea772962a5176cd"
130
130
  }
@@ -27,6 +27,11 @@ interface FieldProps extends HTMLAttributes<HTMLDivElement> {
27
27
  error?: boolean
28
28
  /** Specify whether the Field should show the left-hand error bar if it is in an error state. */
29
29
  hideErrorBar?: boolean
30
+ /** For Radio and Checkbox, specify whether the control renders on the same row as the label.
31
+ *
32
+ * Default: `true`
33
+ */
34
+ inline?: boolean
30
35
  /** Specify a custom React ref for this component. */
31
36
  ref?: Ref<HTMLDivElement>
32
37
  }
@@ -37,6 +42,7 @@ const Field = ({
37
42
  className,
38
43
  error: errorProp,
39
44
  hideErrorBar = false,
45
+ inline,
40
46
  ref,
41
47
  ...props
42
48
  }: FieldProps): JSX.Element => {
@@ -70,10 +76,11 @@ const Field = ({
70
76
  const componentProps = {
71
77
  ...props,
72
78
  "aria-disabled": controlProps.disabled || undefined,
73
- className: clsx("coop-field", controlProps.inline && "coop-field-inline", className),
79
+ className: clsx("coop-field", className),
74
80
  "data-boxed": boxed || undefined,
75
81
  "data-error": error || undefined,
76
82
  "data-hide-error": hideErrorBar || undefined,
83
+ "data-inline": inline ?? controlProps.inline,
77
84
  }
78
85
 
79
86
  return (