@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 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
- export declare const Badge: import("react").ForwardRefExoticComponent<Omit<BadgeItemProps, "type"> & {
5
- children?: import("react").ReactNode;
6
- } & import("react").RefAttributes<HTMLElement>>;
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
+ };
@@ -1,6 +1,6 @@
1
- import { HTMLAttributes, PropsWithRef } from 'react';
1
+ import { HTMLAttributes, Ref } from 'react';
2
2
  import { type StylesProps } from './BadgeItem.styles';
3
- export interface BadgeItemProps extends PropsWithRef<Omit<HTMLAttributes<HTMLSpanElement>, 'aria-label'>>, StylesProps {
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: import("react").ForwardRefExoticComponent<BadgeItemProps & import("react").RefAttributes<HTMLSpanElement>>;
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 e=require("react"),i=require("@spark-ui/internal-utils"),p=require("class-variance-authority").cva(["inline-flex h-fit","empty:p-none","text-center font-bold","rounded-full box-content"],{variants:{intent:i.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:i.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"}}),c=e.forwardRef(({intent:t="danger",size:r="md",type:a="relative",count:n,overflowCount:s=99,"aria-label":o,className:d,...u},f)=>{const b=n&&n>s,m={...u,"aria-label":typeof o=="function"?o({count:n,overflowCount:s}):o};return e.createElement("span",{ref:f,"data-spark-component":"badge",role:"status",className:p({intent:t,size:r,type:a,className:d}),...m},b?`${s}+`:n)});c.displayName="BadgeItem";const l=e.forwardRef(({children:t,...r},a)=>t?e.createElement("div",{className:"relative inline-flex"},t,e.createElement(c,{ref:a,...r})):e.createElement(c,{ref:a,type:"standalone",...r}));l.displayName="Badge",exports.Badge=l;
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 n, { forwardRef as l } from "react";
2
- import { makeVariants as i } from "@spark-ui/internal-utils";
3
- import { cva as p } from "class-variance-authority";
4
- const x = p(["inline-flex h-fit", "empty:p-none", "text-center font-bold", "rounded-full box-content"], { variants: { intent: i({ 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: i({ 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" } }), c = l(({ intent: e = "danger", size: t = "md", type: a = "relative", count: r, overflowCount: s = 99, "aria-label": o, className: d, ...f }, m) => {
5
- const u = r && r > s, b = { ...f, "aria-label": typeof o == "function" ? o({ count: r, overflowCount: s }) : o };
6
- return n.createElement("span", { ref: m, "data-spark-component": "badge", role: "status", className: x({ intent: e, size: t, type: a, className: d }), ...b }, u ? `${s}+` : r);
7
- });
8
- c.displayName = "BadgeItem";
9
- const g = l(({ children: e, ...t }, a) => e ? n.createElement("div", { className: "relative inline-flex" }, e, n.createElement(c, { ref: a, ...t })) : n.createElement(c, { ref: a, type: "standalone", ...t }));
10
- g.displayName = "Badge";
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
- g as Badge
12
+ f as Badge
13
13
  };
@@ -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": "7.3.7",
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": "^7.3.7",
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": "ca2b7a1f2a4a921fd4c6ad8521c2dfd90471f7d6"
50
+ "gitHead": "309903aa55f44ebd43d2a1fe43691f110a5036ea"
51
51
  }