@coopdigital/react 1.26.0 → 1.26.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.
@@ -12,7 +12,7 @@ const Author = ({ author = "Co-op team", className, date, datePrefix = "", image
12
12
  };
13
13
  const componentProps = {
14
14
  className: clsx("coop-author", className),
15
- "data-size": size?.length ? size : void 0,
15
+ "data-size": size ?? void 0,
16
16
  ...props
17
17
  };
18
18
  return /* @__PURE__ */ jsxs("div", {
@@ -1,3 +1,4 @@
1
+ import { StandardSizes } from "../../types/index.js";
1
2
  import React, { ButtonHTMLAttributes, ForwardRefExoticComponent, JSX, Ref } from "react";
2
3
  //#region src/components/Button/Button.d.ts
3
4
  export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
@@ -25,7 +26,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
25
26
  /** Specify a custom React ref for this component. */
26
27
  ref?: Ref<HTMLElement>;
27
28
  /** Specify the component size. */
28
- size?: "sm" | "md" | "lg";
29
+ size?: StandardSizes;
29
30
  /** Specify the component variant. */
30
31
  variant?: "solid" | "ghost" | "text";
31
32
  }
@@ -1,3 +1,4 @@
1
+ import { StandardSizes } from "../../types/index.js";
1
2
  import { ComboboxItem, ComboboxOption } from "./combobox-utils.js";
2
3
  import { TextInputProps } from "../TextInput/TextInput.js";
3
4
  import "../TextInput/index.js";
@@ -75,7 +76,7 @@ export interface ComboboxProps extends Omit<HTMLAttributes<HTMLDivElement>, "onC
75
76
  /** Specify a custom React ref for this component. */
76
77
  ref?: Ref<HTMLDivElement>;
77
78
  /** Specify the component size. */
78
- size?: "sm" | "md" | "lg";
79
+ size?: StandardSizes;
79
80
  }
80
81
  export interface ComboboxControlsProps extends HTMLAttributes<HTMLDivElement> {
81
82
  /** Content inside the component.
@@ -13,7 +13,7 @@ const Pill = ({ as, children, className, href, ref, size, ...props }) => {
13
13
  const slots = useSlots(componentSlots, children);
14
14
  const componentProps = {
15
15
  className: clsx("coop-pill", !hasUserBg(className) && "bg-tint-grey", className),
16
- "data-size": size?.length ? size : void 0,
16
+ "data-size": size ?? void 0,
17
17
  href,
18
18
  ...props
19
19
  };
@@ -6,11 +6,11 @@ export interface SectionProps extends HTMLAttributes<HTMLDivElement> {
6
6
  * Default: `<section>`
7
7
  */
8
8
  as?: React.FC<any> | string;
9
- /** **(Optional)** Content inside the component. */
9
+ /** Content inside the component. */
10
10
  children?: ReactNode;
11
- /** **(Optional)** Specify additional CSS classes. */
11
+ /** Specify additional CSS classes. */
12
12
  className?: string;
13
- /** **(Optional)** Specify a custom React ref for this component. */
13
+ /** Specify a custom React ref for this component. */
14
14
  ref?: Ref<HTMLDivElement>;
15
15
  }
16
16
  export declare const Section: ({ as, children, className, ref, ...props }: SectionProps) => JSX.Element;
@@ -6,7 +6,7 @@ const Tag = ({ as, children, className, href, ref, size, ...props }) => {
6
6
  const element = as ?? (href ? "a" : "span");
7
7
  const componentProps = {
8
8
  className: clsx("coop-tag", !hasUserBg(className) && "bg-tint-grey", className),
9
- "data-size": size?.length ? size : void 0,
9
+ "data-size": size ?? void 0,
10
10
  href,
11
11
  ...props
12
12
  };
@@ -9,7 +9,7 @@ const TextInput = ({ className, disabled, error = false, fit = false, id, name,
9
9
  className: clsx("coop-text-input", className),
10
10
  "data-error": error || void 0,
11
11
  "data-fit": fit || void 0,
12
- "data-size": size?.length ? size : void 0,
12
+ "data-size": size ?? void 0,
13
13
  disabled,
14
14
  id: id ?? field?.id,
15
15
  name,
@@ -6,11 +6,11 @@ export interface WrapperProps extends HTMLAttributes<HTMLDivElement> {
6
6
  * Default: `<div>`
7
7
  */
8
8
  as?: React.FC<any> | string;
9
- /** **(Optional)** Content inside the component. */
9
+ /** Content inside the component. */
10
10
  children?: ReactNode;
11
- /** **(Optional)** Specify additional CSS classes. */
11
+ /** Specify additional CSS classes. */
12
12
  className?: string;
13
- /** **(Optional)** Specify a custom React ref for this component. */
13
+ /** Specify a custom React ref for this component. */
14
14
  ref?: Ref<HTMLDivElement>;
15
15
  }
16
16
  export declare const Wrapper: ({ as, children, className, ref, ...props }: WrapperProps) => JSX.Element;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopdigital/react",
3
3
  "type": "module",
4
- "version": "1.26.0",
4
+ "version": "1.26.1",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -116,5 +116,5 @@
116
116
  "merge-refs": "^2.0.0",
117
117
  "react-day-picker": "^10.0.1"
118
118
  },
119
- "gitHead": "3835a0b5cd0562f01905240d8df20d4b042323db"
119
+ "gitHead": "d973a1436fe2245a6af205621b69762c3d7f7d09"
120
120
  }
@@ -43,7 +43,7 @@ const Author = ({
43
43
 
44
44
  const componentProps = {
45
45
  className: clsx("coop-author", className),
46
- "data-size": size?.length ? size : undefined,
46
+ "data-size": size ?? undefined,
47
47
  ...props,
48
48
  }
49
49
  return (
@@ -6,6 +6,7 @@ import clsx from "clsx"
6
6
  import React, { useCallback, useState } from "react"
7
7
 
8
8
  import { LoadingSpinner } from "@/components/LoadingSpinner"
9
+ import { StandardSizes } from "@/types"
9
10
  import { hasUserBg } from "@/utils"
10
11
 
11
12
  export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
@@ -34,7 +35,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
34
35
  /** Specify a custom React ref for this component. */
35
36
  ref?: Ref<HTMLElement>
36
37
  /** Specify the component size. */
37
- size?: "sm" | "md" | "lg"
38
+ size?: StandardSizes
38
39
  /** Specify the component variant. */
39
40
  variant?: "solid" | "ghost" | "text"
40
41
  }
@@ -25,6 +25,7 @@ import { useField } from "@/components/Field/Field.context"
25
25
  import { ChevronDownIcon } from "@/components/icons"
26
26
  import { TextInput, TextInputProps } from "@/components/TextInput"
27
27
  import { useSlots } from "@/hooks"
28
+ import { StandardSizes } from "@/types"
28
29
  import { getSlotProp } from "@/utils"
29
30
 
30
31
  export interface ComboboxProps extends Omit<
@@ -101,7 +102,7 @@ export interface ComboboxProps extends Omit<
101
102
  /** Specify a custom React ref for this component. */
102
103
  ref?: Ref<HTMLDivElement>
103
104
  /** Specify the component size. */
104
- size?: "sm" | "md" | "lg"
105
+ size?: StandardSizes
105
106
  }
106
107
 
107
108
  export interface ComboboxControlsProps extends HTMLAttributes<HTMLDivElement> {
@@ -47,7 +47,7 @@ const Pill = ({ as, children, className, href, ref, size, ...props }: PillProps)
47
47
 
48
48
  const componentProps = {
49
49
  className: clsx("coop-pill", !hasUserBg(className) && "bg-tint-grey", className),
50
- "data-size": size?.length ? size : undefined,
50
+ "data-size": size ?? undefined,
51
51
  href,
52
52
  ...props,
53
53
  }
@@ -10,11 +10,11 @@ export interface SectionProps extends HTMLAttributes<HTMLDivElement> {
10
10
  */
11
11
  // oxlint-disable-next-line typescript/no-explicit-any
12
12
  as?: React.FC<any> | string
13
- /** **(Optional)** Content inside the component. */
13
+ /** Content inside the component. */
14
14
  children?: ReactNode
15
- /** **(Optional)** Specify additional CSS classes. */
15
+ /** Specify additional CSS classes. */
16
16
  className?: string
17
- /** **(Optional)** Specify a custom React ref for this component. */
17
+ /** Specify a custom React ref for this component. */
18
18
  ref?: Ref<HTMLDivElement>
19
19
  }
20
20
 
@@ -29,7 +29,7 @@ const Tag = ({ as, children, className, href, ref, size, ...props }: TagProps):
29
29
 
30
30
  const componentProps = {
31
31
  className: clsx("coop-tag", !hasUserBg(className) && "bg-tint-grey", className),
32
- "data-size": size?.length ? size : undefined,
32
+ "data-size": size ?? undefined,
33
33
  href,
34
34
  ...props,
35
35
  }
@@ -80,7 +80,7 @@ const TextInput = ({
80
80
  className: clsx("coop-text-input", className),
81
81
  "data-error": error || undefined,
82
82
  "data-fit": fit || undefined,
83
- "data-size": size?.length ? size : undefined,
83
+ "data-size": size ?? undefined,
84
84
  disabled,
85
85
  id: id ?? field?.id,
86
86
  name,
@@ -10,11 +10,11 @@ export interface WrapperProps extends HTMLAttributes<HTMLDivElement> {
10
10
  */
11
11
  // oxlint-disable-next-line typescript/no-explicit-any
12
12
  as?: React.FC<any> | string
13
- /** **(Optional)** Content inside the component. */
13
+ /** Content inside the component. */
14
14
  children?: ReactNode
15
- /** **(Optional)** Specify additional CSS classes. */
15
+ /** Specify additional CSS classes. */
16
16
  className?: string
17
- /** **(Optional)** Specify a custom React ref for this component. */
17
+ /** Specify a custom React ref for this component. */
18
18
  ref?: Ref<HTMLDivElement>
19
19
  }
20
20