@nucleux/badge 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nucleux
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs ADDED
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var utils = require('@nucleux/utils');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+
8
+ function _interopNamespace(e) {
9
+ if (e && e.__esModule) return e;
10
+ var n = Object.create(null);
11
+ if (e) {
12
+ Object.keys(e).forEach(function (k) {
13
+ if (k !== 'default') {
14
+ var d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function () { return e[k]; }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
27
+
28
+ // src/index.tsx
29
+ var badgeVariants = {
30
+ default: "bg-primary text-primary-foreground",
31
+ secondary: "bg-muted text-muted-foreground",
32
+ outline: "border border-border bg-background text-foreground",
33
+ success: "bg-success/15 text-success",
34
+ info: "bg-info/15 text-info",
35
+ destructive: "bg-destructive/15 text-destructive"
36
+ };
37
+ var Badge = React__namespace.forwardRef(
38
+ ({ variant = "default", icon, className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
39
+ "span",
40
+ {
41
+ ref,
42
+ className: utils.cn(
43
+ "inline-flex items-center gap-1 whitespace-nowrap rounded-full px-2.5 py-0.5 text-xs font-medium leading-4",
44
+ badgeVariants[variant],
45
+ className
46
+ ),
47
+ ...props,
48
+ children: [
49
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "-ml-0.5 inline-flex shrink-0 items-center", children: icon }),
50
+ children
51
+ ]
52
+ }
53
+ )
54
+ );
55
+ Badge.displayName = "Badge";
56
+
57
+ exports.Badge = Badge;
58
+ //# sourceMappingURL=index.cjs.map
59
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"names":["React","jsxs","cn","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAM,aAAA,GAA8C;AAAA,EAClD,OAAA,EAAS,oCAAA;AAAA,EACT,SAAA,EAAW,gCAAA;AAAA,EACX,OAAA,EAAS,oDAAA;AAAA,EACT,OAAA,EAAS,4BAAA;AAAA,EACT,IAAA,EAAM,sBAAA;AAAA,EACN,WAAA,EAAa;AACf,CAAA;AAUO,IAAM,KAAA,GAAcA,gBAAA,CAAA,UAAA;AAAA,EACzB,CAAC,EAAE,OAAA,GAAU,SAAA,EAAW,IAAA,EAAM,WAAW,QAAA,EAAU,GAAG,KAAA,EAAM,EAAG,GAAA,qBAC7DC,eAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAWC,QAAA;AAAA,QACT,2GAAA;AAAA,QACA,cAAc,OAAO,CAAA;AAAA,QACrB;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,IAAA,oBAAQC,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,2CAAA,EAA6C,QAAA,EAAA,IAAA,EAAK,CAAA;AAAA,QAC1E;AAAA;AAAA;AAAA;AAGP;AACA,KAAA,CAAM,WAAA,GAAc,OAAA","file":"index.cjs","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\n\nexport type BadgeVariant =\n | \"default\"\n | \"secondary\"\n | \"outline\"\n | \"success\"\n | \"info\"\n | \"destructive\";\n\nconst badgeVariants: Record<BadgeVariant, string> = {\n default: \"bg-primary text-primary-foreground\",\n secondary: \"bg-muted text-muted-foreground\",\n outline: \"border border-border bg-background text-foreground\",\n success: \"bg-success/15 text-success\",\n info: \"bg-info/15 text-info\",\n destructive: \"bg-destructive/15 text-destructive\",\n};\n\nexport interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Visual style. */\n variant?: BadgeVariant;\n /** Optional icon rendered before the label. */\n icon?: React.ReactNode;\n}\n\n/** Compact status pill — action counts, states (\"Summarized\"), progress (\"1/3 Done\"). */\nexport const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(\n ({ variant = \"default\", icon, className, children, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\n \"inline-flex items-center gap-1 whitespace-nowrap rounded-full px-2.5 py-0.5 text-xs font-medium leading-4\",\n badgeVariants[variant],\n className,\n )}\n {...props}\n >\n {icon && <span className=\"-ml-0.5 inline-flex shrink-0 items-center\">{icon}</span>}\n {children}\n </span>\n ),\n);\nBadge.displayName = \"Badge\";\n"]}
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+
3
+ type BadgeVariant = "default" | "secondary" | "outline" | "success" | "info" | "destructive";
4
+ interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
5
+ /** Visual style. */
6
+ variant?: BadgeVariant;
7
+ /** Optional icon rendered before the label. */
8
+ icon?: React.ReactNode;
9
+ }
10
+ /** Compact status pill — action counts, states ("Summarized"), progress ("1/3 Done"). */
11
+ declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
12
+
13
+ export { Badge, type BadgeProps, type BadgeVariant };
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+
3
+ type BadgeVariant = "default" | "secondary" | "outline" | "success" | "info" | "destructive";
4
+ interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
5
+ /** Visual style. */
6
+ variant?: BadgeVariant;
7
+ /** Optional icon rendered before the label. */
8
+ icon?: React.ReactNode;
9
+ }
10
+ /** Compact status pill — action counts, states ("Summarized"), progress ("1/3 Done"). */
11
+ declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
12
+
13
+ export { Badge, type BadgeProps, type BadgeVariant };
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import * as React from 'react';
3
+ import { cn } from '@nucleux/utils';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ // src/index.tsx
7
+ var badgeVariants = {
8
+ default: "bg-primary text-primary-foreground",
9
+ secondary: "bg-muted text-muted-foreground",
10
+ outline: "border border-border bg-background text-foreground",
11
+ success: "bg-success/15 text-success",
12
+ info: "bg-info/15 text-info",
13
+ destructive: "bg-destructive/15 text-destructive"
14
+ };
15
+ var Badge = React.forwardRef(
16
+ ({ variant = "default", icon, className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
17
+ "span",
18
+ {
19
+ ref,
20
+ className: cn(
21
+ "inline-flex items-center gap-1 whitespace-nowrap rounded-full px-2.5 py-0.5 text-xs font-medium leading-4",
22
+ badgeVariants[variant],
23
+ className
24
+ ),
25
+ ...props,
26
+ children: [
27
+ icon && /* @__PURE__ */ jsx("span", { className: "-ml-0.5 inline-flex shrink-0 items-center", children: icon }),
28
+ children
29
+ ]
30
+ }
31
+ )
32
+ );
33
+ Badge.displayName = "Badge";
34
+
35
+ export { Badge };
36
+ //# sourceMappingURL=index.js.map
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"names":[],"mappings":";;;;;AAWA,IAAM,aAAA,GAA8C;AAAA,EAClD,OAAA,EAAS,oCAAA;AAAA,EACT,SAAA,EAAW,gCAAA;AAAA,EACX,OAAA,EAAS,oDAAA;AAAA,EACT,OAAA,EAAS,4BAAA;AAAA,EACT,IAAA,EAAM,sBAAA;AAAA,EACN,WAAA,EAAa;AACf,CAAA;AAUO,IAAM,KAAA,GAAc,KAAA,CAAA,UAAA;AAAA,EACzB,CAAC,EAAE,OAAA,GAAU,SAAA,EAAW,IAAA,EAAM,WAAW,QAAA,EAAU,GAAG,KAAA,EAAM,EAAG,GAAA,qBAC7D,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,EAAA;AAAA,QACT,2GAAA;AAAA,QACA,cAAc,OAAO,CAAA;AAAA,QACrB;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,IAAA,oBAAQ,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,2CAAA,EAA6C,QAAA,EAAA,IAAA,EAAK,CAAA;AAAA,QAC1E;AAAA;AAAA;AAAA;AAGP;AACA,KAAA,CAAM,WAAA,GAAc,OAAA","file":"index.js","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\n\nexport type BadgeVariant =\n | \"default\"\n | \"secondary\"\n | \"outline\"\n | \"success\"\n | \"info\"\n | \"destructive\";\n\nconst badgeVariants: Record<BadgeVariant, string> = {\n default: \"bg-primary text-primary-foreground\",\n secondary: \"bg-muted text-muted-foreground\",\n outline: \"border border-border bg-background text-foreground\",\n success: \"bg-success/15 text-success\",\n info: \"bg-info/15 text-info\",\n destructive: \"bg-destructive/15 text-destructive\",\n};\n\nexport interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Visual style. */\n variant?: BadgeVariant;\n /** Optional icon rendered before the label. */\n icon?: React.ReactNode;\n}\n\n/** Compact status pill — action counts, states (\"Summarized\"), progress (\"1/3 Done\"). */\nexport const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(\n ({ variant = \"default\", icon, className, children, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\n \"inline-flex items-center gap-1 whitespace-nowrap rounded-full px-2.5 py-0.5 text-xs font-medium leading-4\",\n badgeVariants[variant],\n className,\n )}\n {...props}\n >\n {icon && <span className=\"-ml-0.5 inline-flex shrink-0 items-center\">{icon}</span>}\n {children}\n </span>\n ),\n);\nBadge.displayName = \"Badge\";\n"]}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@nucleux/badge",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "peerDependencies": {
20
+ "react": ">=18",
21
+ "react-dom": ">=18"
22
+ },
23
+ "dependencies": {
24
+ "@nucleux/utils": "0.1.0"
25
+ },
26
+ "devDependencies": {
27
+ "tsup": "^8.3.5",
28
+ "typescript": "^5.7.2",
29
+ "@types/react": "^18.3.18",
30
+ "react": "^18.3.1",
31
+ "lucide-react": "^0.469.0"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/intelligaia-open-labs/nucleux.git",
40
+ "directory": "packages/badge"
41
+ },
42
+ "homepage": "https://github.com/intelligaia-open-labs/nucleux#readme",
43
+ "scripts": {
44
+ "build": "tsup"
45
+ }
46
+ }