@spark-ui/badge 2.1.2 → 2.1.4

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,18 @@
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
+ ## [2.1.4](https://github.com/adevinta/spark/compare/@spark-ui/badge@2.1.3...@spark-ui/badge@2.1.4) (2024-02-28)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **badge:** badge outline now utilizes "surface" token ([79feadf](https://github.com/adevinta/spark/commit/79feadf159e93a2d26703108fec915d0a09ff6a5)), closes [#1906](https://github.com/adevinta/spark/issues/1906)
11
+
12
+ ## [2.1.3](https://github.com/adevinta/spark/compare/@spark-ui/badge@2.1.2...@spark-ui/badge@2.1.3) (2024-01-29)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **badge:** fix badge size on empty content ([3f12094](https://github.com/adevinta/spark/commit/3f12094ba630517bc27f3b104ae69f8bb845064b))
17
+
6
18
  ## [2.1.2](https://github.com/adevinta/spark/compare/@spark-ui/badge@2.1.1...@spark-ui/badge@2.1.2) (2023-12-05)
7
19
 
8
20
  **Note:** Version bump only for package @spark-ui/badge
@@ -7,6 +7,7 @@ export interface BadgeItemProps extends PropsWithRef<Omit<HTMLAttributes<HTMLSpa
7
7
  count?: number;
8
8
  /**
9
9
  * Maximum numeric value to be dispayed as a count value.
10
+ * @default 99
10
11
  */
11
12
  overflowCount?: number;
12
13
  /**
@@ -19,6 +20,7 @@ export interface BadgeItemProps extends PropsWithRef<Omit<HTMLAttributes<HTMLSpa
19
20
  }) => string);
20
21
  /**
21
22
  * Describes the way the component is displayed: relative to another element or just standalone.
23
+ * @default 'relative'
22
24
  */
23
25
  type?: 'relative' | 'standalone';
24
26
  }
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),l=require("@spark-ui/internal-utils"),x=require("class-variance-authority"),d="danger",b="relative",y=x.cva(["inline-flex h-fit","empty:p-none","text-center font-bold","rounded-full box-content"],{variants:{intent:l.makeVariants({main:["bg-main","text-on-main","border-on-main"],support:["bg-support","text-on-support","border-on-support"],accent:["bg-accent","text-on-accent","border-on-accent"],success:["bg-success","text-on-success","border-on-success"],alert:["bg-alert","text-on-alert","border-on-alert"],danger:["bg-error","text-on-error","border-on-error"],info:["bg-info","text-on-info","border-on-info"],neutral:["bg-neutral","text-on-neutral","border-on-neutral"],surface:["bg-surface","text-on-surface","border-on-surface"],basic:["bg-basic","text-on-basic","border-on-basic"]}),size:l.makeVariants({sm:["text-small","px-[var(--sz-6)] py-[var(--sz-2)]","empty:h-sz-12 empty:w-sz-12"],md:["text-caption","px-md py-sm","empty:h-sz-16 empty:w-sz-16"]}),type:{relative:["absolute right-none translate-x-2/4 -translate-y-2/4 border-md"],standalone:[]}},defaultVariants:{intent:d,size:"md",type:b}}),i=e.forwardRef(({intent:t=d,size:r="md",type:n=b,count:a,overflowCount:o=99,"aria-label":s,className:m,...u},p)=>{const f=a&&a>o,g={...u,"aria-label":typeof s=="function"?s({count:a,overflowCount:o}):s};return e.createElement("span",{ref:p,"data-spark-component":"badge",role:"status",className:y({intent:t,size:r,type:n,className:m}),...g},f?`${o}+`:a)});i.displayName="BadgeItem";const c=e.forwardRef(({children:t,...r},n)=>t?e.createElement("div",{className:"relative inline-flex"},t,e.createElement(i,{ref:n,...r})):e.createElement(i,{ref:n,type:"standalone",...r}));c.displayName="Badge",exports.Badge=c;
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;
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
- import r, { forwardRef as i } from "react";
2
- import { makeVariants as c } from "@spark-ui/internal-utils";
3
- import { cva as g } from "class-variance-authority";
4
- const m = "danger", d = "relative", y = g(["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-on-main"], support: ["bg-support", "text-on-support", "border-on-support"], accent: ["bg-accent", "text-on-accent", "border-on-accent"], success: ["bg-success", "text-on-success", "border-on-success"], alert: ["bg-alert", "text-on-alert", "border-on-alert"], danger: ["bg-error", "text-on-error", "border-on-error"], info: ["bg-info", "text-on-info", "border-on-info"], neutral: ["bg-neutral", "text-on-neutral", "border-on-neutral"], surface: ["bg-surface", "text-on-surface", "border-on-surface"], basic: ["bg-basic", "text-on-basic", "border-on-basic"] }), size: c({ sm: ["text-small", "px-[var(--sz-6)] py-[var(--sz-2)]", "empty:h-sz-12 empty:w-sz-12"], md: ["text-caption", "px-md py-sm", "empty:h-sz-16 empty:w-sz-16"] }), type: { relative: ["absolute right-none translate-x-2/4 -translate-y-2/4 border-md"], standalone: [] } }, defaultVariants: { intent: m, size: "md", type: d } }), l = i(({ intent: e = m, size: t = "md", type: a = d, count: n, overflowCount: o = 99, "aria-label": s, className: p, ...b }, u) => {
5
- const f = n && n > o, x = { ...b, "aria-label": typeof s == "function" ? s({ count: n, overflowCount: o }) : s };
6
- return r.createElement("span", { ref: u, "data-spark-component": "badge", role: "status", className: y({ intent: e, size: t, type: a, className: p }), ...x }, f ? `${o}+` : n);
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
7
  });
8
- l.displayName = "BadgeItem";
9
- const v = i(({ children: e, ...t }, a) => e ? r.createElement("div", { className: "relative inline-flex" }, e, r.createElement(l, { ref: a, ...t })) : r.createElement(l, { ref: a, type: "standalone", ...t }));
10
- v.displayName = "Badge";
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";
11
11
  export {
12
- v as Badge
12
+ g as Badge
13
13
  };
@@ -25,7 +25,9 @@
25
25
  }
26
26
  },
27
27
  "intent": {
28
- "defaultValue": null,
28
+ "defaultValue": {
29
+ "value": "'danger'"
30
+ },
29
31
  "description": "Visual color appearance of the component.",
30
32
  "name": "intent",
31
33
  "declarations": [],
@@ -68,7 +70,9 @@
68
70
  }
69
71
  },
70
72
  "size": {
71
- "defaultValue": null,
73
+ "defaultValue": {
74
+ "value": "'md'"
75
+ },
72
76
  "description": "Size of the component.",
73
77
  "name": "size",
74
78
  "declarations": [],
@@ -106,7 +110,9 @@
106
110
  }
107
111
  },
108
112
  "overflowCount": {
109
- "defaultValue": null,
113
+ "defaultValue": {
114
+ "value": "99"
115
+ },
110
116
  "description": "Maximum numeric value to be dispayed as a count value.",
111
117
  "name": "overflowCount",
112
118
  "parent": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-ui/badge",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "Badge component is a visual indicator for numeric values such as tallies and scores.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -46,5 +46,5 @@
46
46
  },
47
47
  "homepage": "https://sparkui.vercel.app",
48
48
  "license": "MIT",
49
- "gitHead": "e2fd654d551c09971906b3b0036f9a385369bb7a"
49
+ "gitHead": "27b15f9113bcf5d926273645b304344d0c05c16c"
50
50
  }
package/dist/config.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export declare const DEFAULT_INTENT = "danger";
2
- export declare const DEFAULT_SIZE = "md";
3
- export declare const DEFAULT_TYPE = "relative";
4
- export declare const DEFAULT_OVERFLOW_COUNT = 99;