@spark-ui/badge 7.3.7 → 8.0.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/CHANGELOG.md +4 -0
- package/dist/Badge.d.ts +8 -5
- package/dist/BadgeItem.d.ts +7 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +11 -11
- package/dist/public/docgen.json +42 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [8.0.0](https://github.com/adevinta/spark/compare/v7.3.7...v8.0.0) (2025-01-13)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @spark-ui/badge
|
9
|
+
|
6
10
|
## [7.3.7](https://github.com/adevinta/spark/compare/v7.3.6...v7.3.7) (2025-01-08)
|
7
11
|
|
8
12
|
**Note:** Version bump only for package @spark-ui/badge
|
package/dist/Badge.d.ts
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
1
|
+
import { PropsWithChildren, Ref } from 'react';
|
2
2
|
import { BadgeItemProps } from './BadgeItem';
|
3
|
-
export type BadgeProps = PropsWithChildren<Omit<BadgeItemProps, 'type'
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
export type BadgeProps = PropsWithChildren<Omit<BadgeItemProps, 'type'>> & {
|
4
|
+
ref?: Ref<HTMLElement>;
|
5
|
+
};
|
6
|
+
export declare const Badge: {
|
7
|
+
({ children, ...props }: BadgeProps): import("react").JSX.Element;
|
8
|
+
displayName: string;
|
9
|
+
};
|
package/dist/BadgeItem.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { HTMLAttributes,
|
1
|
+
import { HTMLAttributes, Ref } from 'react';
|
2
2
|
import { type StylesProps } from './BadgeItem.styles';
|
3
|
-
export interface BadgeItemProps extends
|
3
|
+
export interface BadgeItemProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'aria-label'>, StylesProps {
|
4
4
|
/**
|
5
5
|
* Numeric value used as indicator inside the component.
|
6
6
|
*/
|
@@ -23,5 +23,9 @@ export interface BadgeItemProps extends PropsWithRef<Omit<HTMLAttributes<HTMLSpa
|
|
23
23
|
* @default 'relative'
|
24
24
|
*/
|
25
25
|
type?: 'relative' | 'standalone';
|
26
|
+
ref?: Ref<HTMLSpanElement>;
|
26
27
|
}
|
27
|
-
export declare const BadgeItem:
|
28
|
+
export declare const BadgeItem: {
|
29
|
+
({ intent, size, type, count, overflowCount, "aria-label": label, className, ...others }: BadgeItemProps): import("react").JSX.Element;
|
30
|
+
displayName: string;
|
31
|
+
};
|
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),c=require("@spark-ui/internal-utils"),f=require("class-variance-authority").cva(["inline-flex h-fit","empty:p-none","text-center font-bold","rounded-full box-content"],{variants:{intent:c.makeVariants({main:["bg-main","text-on-main","border-surface"],support:["bg-support","text-on-support","border-surface"],accent:["bg-accent","text-on-accent","border-surface"],success:["bg-success","text-on-success","border-surface"],alert:["bg-alert","text-on-alert","border-surface"],danger:["bg-error","text-on-error","border-surface"],info:["bg-info","text-on-info","border-surface"],neutral:["bg-neutral","text-on-neutral","border-surface"],surface:["bg-surface","text-on-surface","border-surface"],basic:["bg-basic","text-on-basic","border-surface"]}),size:c.makeVariants({sm:["text-small","px-[var(--sz-6)] py-[var(--sz-2)]","empty:size-sz-8"],md:["text-caption","px-md py-sm","empty:size-sz-16"]}),type:{relative:["absolute right-none border-md","translate-x-1/2 -translate-y-1/2"],standalone:[]}},defaultVariants:{intent:"danger",size:"md",type:"relative"}}),o=({intent:e="danger",size:t="md",type:l="relative",count:a,overflowCount:n=99,"aria-label":s,className:u,...d})=>{const b=a&&a>n,m={...d,"aria-label":typeof s=="function"?s({count:a,overflowCount:n}):s};return r.createElement("span",{"data-spark-component":"badge",role:"status",className:f({intent:e,size:t,type:l,className:u}),...m},b?`${n}+`:a)};o.displayName="BadgeItem";const i=({children:e,...t})=>e?r.createElement("div",{className:"relative inline-flex"},e,r.createElement(o,{...t})):r.createElement(o,{type:"standalone",...t});i.displayName="Badge",exports.Badge=i;
|
package/dist/index.mjs
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
import
|
2
|
-
import { makeVariants as
|
3
|
-
import { cva as
|
4
|
-
const
|
5
|
-
const u =
|
6
|
-
return
|
7
|
-
}
|
8
|
-
|
9
|
-
const
|
10
|
-
|
1
|
+
import r from "react";
|
2
|
+
import { makeVariants as c } from "@spark-ui/internal-utils";
|
3
|
+
import { cva as b } from "class-variance-authority";
|
4
|
+
const p = b(["inline-flex h-fit", "empty:p-none", "text-center font-bold", "rounded-full box-content"], { variants: { intent: c({ main: ["bg-main", "text-on-main", "border-surface"], support: ["bg-support", "text-on-support", "border-surface"], accent: ["bg-accent", "text-on-accent", "border-surface"], success: ["bg-success", "text-on-success", "border-surface"], alert: ["bg-alert", "text-on-alert", "border-surface"], danger: ["bg-error", "text-on-error", "border-surface"], info: ["bg-info", "text-on-info", "border-surface"], neutral: ["bg-neutral", "text-on-neutral", "border-surface"], surface: ["bg-surface", "text-on-surface", "border-surface"], basic: ["bg-basic", "text-on-basic", "border-surface"] }), size: c({ sm: ["text-small", "px-[var(--sz-6)] py-[var(--sz-2)]", "empty:size-sz-8"], md: ["text-caption", "px-md py-sm", "empty:size-sz-16"] }), type: { relative: ["absolute right-none border-md", "translate-x-1/2 -translate-y-1/2"], standalone: [] } }, defaultVariants: { intent: "danger", size: "md", type: "relative" } }), o = ({ intent: e = "danger", size: t = "md", type: i = "relative", count: a, overflowCount: n = 99, "aria-label": s, className: l, ...d }) => {
|
5
|
+
const u = a && a > n, m = { ...d, "aria-label": typeof s == "function" ? s({ count: a, overflowCount: n }) : s };
|
6
|
+
return r.createElement("span", { "data-spark-component": "badge", role: "status", className: p({ intent: e, size: t, type: i, className: l }), ...m }, u ? `${n}+` : a);
|
7
|
+
};
|
8
|
+
o.displayName = "BadgeItem";
|
9
|
+
const f = ({ children: e, ...t }) => e ? r.createElement("div", { className: "relative inline-flex" }, e, r.createElement(o, { ...t })) : r.createElement(o, { type: "standalone", ...t });
|
10
|
+
f.displayName = "Badge";
|
11
11
|
export {
|
12
|
-
|
12
|
+
f as Badge
|
13
13
|
};
|
package/dist/public/docgen.json
CHANGED
@@ -129,6 +129,29 @@
|
|
129
129
|
"type": {
|
130
130
|
"name": "number"
|
131
131
|
}
|
132
|
+
},
|
133
|
+
"ref": {
|
134
|
+
"defaultValue": null,
|
135
|
+
"description": "",
|
136
|
+
"name": "ref",
|
137
|
+
"parent": {
|
138
|
+
"fileName": "badge/src/BadgeItem.tsx",
|
139
|
+
"name": "BadgeItemProps"
|
140
|
+
},
|
141
|
+
"declarations": [
|
142
|
+
{
|
143
|
+
"fileName": "badge/src/BadgeItem.tsx",
|
144
|
+
"name": "BadgeItemProps"
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"fileName": "badge/src/Badge.tsx",
|
148
|
+
"name": "TypeLiteral"
|
149
|
+
}
|
150
|
+
],
|
151
|
+
"required": false,
|
152
|
+
"type": {
|
153
|
+
"name": "Ref<HTMLSpanElement> & Ref<HTMLElement>"
|
154
|
+
}
|
132
155
|
}
|
133
156
|
}
|
134
157
|
},
|
@@ -227,6 +250,25 @@
|
|
227
250
|
]
|
228
251
|
}
|
229
252
|
},
|
253
|
+
"ref": {
|
254
|
+
"defaultValue": null,
|
255
|
+
"description": "",
|
256
|
+
"name": "ref",
|
257
|
+
"parent": {
|
258
|
+
"fileName": "badge/src/BadgeItem.tsx",
|
259
|
+
"name": "BadgeItemProps"
|
260
|
+
},
|
261
|
+
"declarations": [
|
262
|
+
{
|
263
|
+
"fileName": "badge/src/BadgeItem.tsx",
|
264
|
+
"name": "BadgeItemProps"
|
265
|
+
}
|
266
|
+
],
|
267
|
+
"required": false,
|
268
|
+
"type": {
|
269
|
+
"name": "Ref<HTMLSpanElement>"
|
270
|
+
}
|
271
|
+
},
|
230
272
|
"intent": {
|
231
273
|
"defaultValue": {
|
232
274
|
"value": "danger"
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@spark-ui/badge",
|
3
|
-
"version": "
|
3
|
+
"version": "8.0.0",
|
4
4
|
"description": "Badge component is a visual indicator for numeric values such as tallies and scores.",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
@@ -35,7 +35,7 @@
|
|
35
35
|
"url": "https://github.com/adevinta/spark/issues?q=is%3Aopen+is%3Aissue+label%3A%22Component%3A+badge%22"
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
|
-
"@spark-ui/internal-utils": "^
|
38
|
+
"@spark-ui/internal-utils": "^8.0.0",
|
39
39
|
"class-variance-authority": "0.7.0"
|
40
40
|
},
|
41
41
|
"peerDependencies": {
|
@@ -47,5 +47,5 @@
|
|
47
47
|
},
|
48
48
|
"homepage": "https://sparkui.vercel.app",
|
49
49
|
"license": "MIT",
|
50
|
-
"gitHead": "
|
50
|
+
"gitHead": "309903aa55f44ebd43d2a1fe43691f110a5036ea"
|
51
51
|
}
|