@coopdigital/react 1.9.0 → 1.10.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.
@@ -8,12 +8,12 @@ const componentSlots = {
8
8
  Children: null,
9
9
  PillBadge: null,
10
10
  };
11
- const Pill = ({ as, children, className, href, ref, size = "md", ...props }) => {
11
+ const Pill = ({ as, children, className, href, ref, size, ...props }) => {
12
12
  const element = as !== null && as !== void 0 ? as : (href ? "a" : "span");
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 !== "md" ? size : undefined,
16
+ "data-size": (size === null || size === void 0 ? void 0 : size.length) ? size : undefined,
17
17
  href,
18
18
  ...props,
19
19
  };
@@ -2,11 +2,11 @@ import clsx from 'clsx';
2
2
  import React from 'react';
3
3
  import { hasUserBg } from '../../utils/index.js';
4
4
 
5
- const Tag = ({ as, children, className, href, ref, size = "md", ...props }) => {
5
+ const Tag = ({ as, children, className, href, ref, size, ...props }) => {
6
6
  const element = as !== null && as !== void 0 ? 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 !== "md" ? size : undefined,
9
+ "data-size": (size === null || size === void 0 ? void 0 : size.length) ? size : undefined,
10
10
  href,
11
11
  ...props,
12
12
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopdigital/react",
3
3
  "type": "module",
4
- "version": "1.9.0",
4
+ "version": "1.10.1",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -100,11 +100,12 @@
100
100
  "storybook": "$storybook"
101
101
  },
102
102
  "dependencies": {
103
- "@coopdigital/styles": "^1.6.0",
103
+ "@coopdigital/styles": "^1.7.0",
104
104
  "@radix-ui/react-popover": "^1.1.17",
105
105
  "clsx": "^2.1.1",
106
+ "date-fns": "^4.4.0",
106
107
  "merge-refs": "^2.0.0",
107
108
  "react-day-picker": "^10.0.1"
108
109
  },
109
- "gitHead": "11857739418628c781dd2df457cc7365505e25f8"
110
+ "gitHead": "7f50804d76c04f60394d3ca9d21b0f282180cea5"
110
111
  }
@@ -9,7 +9,7 @@ import { hasUserBg } from "../../utils"
9
9
 
10
10
  export interface PillProps extends HTMLAttributes<HTMLAnchorElement> {
11
11
  /** **(Optional)** Specify a custom element to override default `a` or `span`. */
12
- // oxlint-disable-next-line typecscript/no-explicit-any
12
+ // oxlint-disable-next-line typescript/no-explicit-any
13
13
  as?: React.FC<any> | ForwardRefExoticComponent<any> | string
14
14
  /** **(Optional)** Main content inside the component. It can be any valid JSX or string. */
15
15
  children?: React.ReactNode
@@ -35,22 +35,14 @@ const componentSlots = {
35
35
  PillBadge: null,
36
36
  }
37
37
 
38
- const Pill = ({
39
- as,
40
- children,
41
- className,
42
- href,
43
- ref,
44
- size = "md",
45
- ...props
46
- }: PillProps): JSX.Element => {
38
+ const Pill = ({ as, children, className, href, ref, size, ...props }: PillProps): JSX.Element => {
47
39
  const element: PillProps["as"] = as ?? (href ? "a" : "span")
48
40
 
49
41
  const slots = useSlots(componentSlots, children)
50
42
 
51
43
  const componentProps = {
52
44
  className: clsx("coop-pill", !hasUserBg(className) && "bg-tint-grey", className),
53
- "data-size": size.length && size !== "md" ? size : undefined,
45
+ "data-size": size?.length ? size : undefined,
54
46
  href,
55
47
  ...props,
56
48
  }
@@ -21,20 +21,12 @@ export interface TagProps extends HTMLAttributes<HTMLAnchorElement> {
21
21
  size?: "sm" | "md"
22
22
  }
23
23
 
24
- const Tag = ({
25
- as,
26
- children,
27
- className,
28
- href,
29
- ref,
30
- size = "md",
31
- ...props
32
- }: TagProps): JSX.Element => {
24
+ const Tag = ({ as, children, className, href, ref, size, ...props }: TagProps): JSX.Element => {
33
25
  const element: TagProps["as"] = as ?? (href ? "a" : "span")
34
26
 
35
27
  const componentProps = {
36
28
  className: clsx("coop-tag", !hasUserBg(className) && "bg-tint-grey", className),
37
- "data-size": size.length && size !== "md" ? size : undefined,
29
+ "data-size": size?.length ? size : undefined,
38
30
  href,
39
31
  ...props,
40
32
  }