@bouko/react 3.0.0 → 3.0.2
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Component } from "../../core/types";
|
|
2
2
|
type Props = Component & {
|
|
3
3
|
color?: string;
|
|
4
|
+
icon?: React.ReactNode;
|
|
4
5
|
size?: "xs" | "sm" | "md";
|
|
5
6
|
};
|
|
6
7
|
/**
|
|
@@ -13,5 +14,5 @@ type Props = Component & {
|
|
|
13
14
|
*
|
|
14
15
|
* @param {string} color - Color of badge. (optional, default = accent)
|
|
15
16
|
**/
|
|
16
|
-
export declare function Badge({ style, color, size, children }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
export declare function Badge({ style, color, size, icon, children }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
17
18
|
export default Badge;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { opacitize, cn, tv } from "@bouko/style";
|
|
3
3
|
/**
|
|
4
4
|
* Color-themed badge component.
|
|
@@ -10,9 +10,11 @@ import { opacitize, cn, tv } from "@bouko/style";
|
|
|
10
10
|
*
|
|
11
11
|
* @param {string} color - Color of badge. (optional, default = accent)
|
|
12
12
|
**/
|
|
13
|
-
export function Badge({ style, color = "--color-accent", size = "md", children }) {
|
|
13
|
+
export function Badge({ style, color = "--color-accent", size = "md", icon, children }) {
|
|
14
14
|
if (!children)
|
|
15
15
|
return null;
|
|
16
|
+
if (color === "future")
|
|
17
|
+
return (_jsxs("div", { className: "flex items-center gap-2 test-badge", children: [icon && _jsx("div", { className: "text-primary-dark", children: icon }), _jsx("span", { children: children })] }));
|
|
16
18
|
return (_jsx("span", { className: cn(base({ size }), style), style: styles(color), children: children }));
|
|
17
19
|
}
|
|
18
20
|
const styles = (color) => ({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
|
|
3
3
|
"name": "@bouko/react",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.2",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"react-router-dom": "^7.12.0"
|
|
18
18
|
},
|
|
19
19
|
"exports": {
|
|
20
|
+
".": "./dist/index.js",
|
|
20
21
|
"./styles.css": "./dist/styles.css"
|
|
21
22
|
},
|
|
22
23
|
"engines": {},
|