@badrap/material-symbols-omnibus
Advanced tools
Comparing version 0.0.0 to 0.0.1
import React from "react"; | ||
type MaterialSymbolProps = { | ||
export type MaterialSymbolInfo = { | ||
height: number; | ||
width: number; | ||
viewBox: [number, number, number, number]; | ||
path: string; | ||
}; | ||
export declare function resolveMaterialSymbol(props: { | ||
name: string; | ||
filled?: boolean; | ||
}): MaterialSymbolInfo | undefined; | ||
export type MaterialSymbolProps = { | ||
name: string; | ||
filled?: boolean; | ||
fallback?: React.ReactNode; | ||
@@ -9,2 +19,1 @@ className?: string; | ||
export declare function MaterialSymbol(props: MaterialSymbolProps): React.ReactNode; | ||
export {}; |
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import data from "../data/symbols.json"; | ||
const hasOwnProperty = Object.prototype.hasOwnProperty; | ||
export function resolveMaterialSymbol(props) { | ||
const { name, filled } = props; | ||
if (!hasOwnProperty.call(data, name)) { | ||
return undefined; | ||
} | ||
return { | ||
height: 48, | ||
width: 48, | ||
viewBox: [0, -960, 960, 960], | ||
path: data[name][filled ? 1 : 0], | ||
}; | ||
} | ||
export function MaterialSymbol(props) { | ||
const { name, filled, fallback, className } = props; | ||
if (!hasOwnProperty.call(data, name)) { | ||
const { fallback, className } = props; | ||
const resolved = resolveMaterialSymbol(props); | ||
if (!resolved) { | ||
return fallback; | ||
} | ||
return (_jsx("svg", { className: className, xmlns: "http://www.w3.org/2000/svg", height: "48", width: "48", fill: "currentColor", viewBox: "0 -960 960 960", children: _jsx("path", { d: data[name][filled ? 1 : 0] }) })); | ||
return (_jsx("svg", { className: className, xmlns: "http://www.w3.org/2000/svg", height: resolved.height, width: resolved.width, viewBox: resolved.viewBox.join(""), fill: "currentColor", children: _jsx("path", { d: resolved.path }) })); | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@badrap/material-symbols-omnibus", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"type": "module", | ||
@@ -11,3 +11,4 @@ "description": "", | ||
"publishConfig": { | ||
"access": "public" | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
@@ -14,0 +15,0 @@ "exports": "./dist/src/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2538383
9218
1