@welcome-ui/badge
Advanced tools
Comparing version 5.5.0 to 5.6.0
@@ -32,6 +32,8 @@ var __create = Object.create; | ||
__export(src_exports, { | ||
Badge: () => Badge2 | ||
Badge: () => Badge2, | ||
BadgePanda: () => BadgePanda, | ||
StyledBadgePanda: () => StyledBadgePanda | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
var import_react = __toESM(require("react")); | ||
var import_react2 = __toESM(require("react")); | ||
var import_system = require("@welcome-ui/system"); | ||
@@ -65,2 +67,26 @@ | ||
// src/panda.tsx | ||
var import_react = __toESM(require("react")); | ||
var import_jsx = require("@welcome-ui/panda/jsx"); | ||
var import_recipes = require("@welcome-ui/panda/recipes"); | ||
var StyledBadgePanda = (0, import_jsx.styled)("div", import_recipes.badge); | ||
var BadgePanda = import_react.default.forwardRef( | ||
({ children, disabled, withNumberAbbreviation, ...rest }, ref) => { | ||
let text; | ||
const isNumber = Number.isInteger(children); | ||
const textLength = children.toString().length; | ||
if (isNumber) { | ||
if (withNumberAbbreviation && children > 99) { | ||
text = "99+"; | ||
} else { | ||
text = children; | ||
} | ||
} else { | ||
text = children; | ||
} | ||
return /* @__PURE__ */ import_react.default.createElement(StyledBadgePanda, { "aria-disabled": disabled, "data-length": textLength, ref, ...rest }, text); | ||
} | ||
); | ||
BadgePanda.displayName = "BadgePanda"; | ||
// src/index.tsx | ||
@@ -90,3 +116,3 @@ var Badge2 = (0, import_system.forwardRef)( | ||
} | ||
return /* @__PURE__ */ import_react.default.createElement( | ||
return /* @__PURE__ */ import_react2.default.createElement( | ||
Badge, | ||
@@ -93,0 +119,0 @@ { |
@@ -12,1 +12,2 @@ import { CreateWuiProps } from '@welcome-ui/system'; | ||
export declare const Badge: import("@welcome-ui/system").CreateWuiComponent<"div", BadgeProps>; | ||
export * from './panda'; |
{ | ||
"name": "@welcome-ui/badge", | ||
"version": "5.5.0", | ||
"version": "5.6.0", | ||
"description": "Customizable design system with react • styled-components • styled-system and ariakit.", | ||
@@ -15,3 +15,4 @@ "main": "dist/index.js", | ||
"./package.json": "./package.json", | ||
"./dist/index.doc.json": "./dist/index.doc.json" | ||
"./dist/index.doc.json": "./dist/index.doc.json", | ||
"./dist/index.css.json": "./dist/index.css.json" | ||
}, | ||
@@ -22,3 +23,4 @@ "scripts": { | ||
"types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", | ||
"doc": "node -r esm ../../scripts/doc-props.js --name Badge" | ||
"doc": "node -r esm ../../scripts/doc-props.js --name Badge", | ||
"css": "panda ship 'src/**/*.ts*' --outfile dist/index.css.json" | ||
}, | ||
@@ -61,3 +63,3 @@ "publishConfig": { | ||
"homepage": "https://welcome-ui.com/components/badge", | ||
"gitHead": "79ae4732d688513a143be4820df8986610d5849b" | ||
"gitHead": "bd1fc4e4645a5cfc051442ecb785f468c54160d2" | ||
} |
Sorry, the diff of this file is not supported yet
16776
9
280