@coopdigital/react 1.9.0 → 1.10.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.
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
4
|
+
"version": "1.10.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -100,11 +100,11 @@
|
|
|
100
100
|
"storybook": "$storybook"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@coopdigital/styles": "^1.
|
|
103
|
+
"@coopdigital/styles": "^1.7.0",
|
|
104
104
|
"@radix-ui/react-popover": "^1.1.17",
|
|
105
105
|
"clsx": "^2.1.1",
|
|
106
106
|
"merge-refs": "^2.0.0",
|
|
107
107
|
"react-day-picker": "^10.0.1"
|
|
108
108
|
},
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "9617cab1d149ce04be999b407f9128204dfc7edd"
|
|
110
110
|
}
|
|
@@ -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
|
|
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
|
|
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
|
|
29
|
+
"data-size": size?.length ? size : undefined,
|
|
38
30
|
href,
|
|
39
31
|
...props,
|
|
40
32
|
}
|