@tabula/ui-button
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -96,2 +96,14 @@ import "./index.css"; | ||
// src/helpers.ts | ||
import { uiLayers } from "@tabula/ui-theme"; | ||
function titleOf(title, children) { | ||
if (title != null && title.length > 0) { | ||
return title; | ||
} | ||
if (typeof children === "string" && children.length > 0) { | ||
return children; | ||
} | ||
return; | ||
} | ||
// src/UiButton20.tsx | ||
@@ -103,3 +115,3 @@ import { jsx as jsx2, jsxs } from "react/jsx-runtime"; | ||
hasIcon: Icon != null, | ||
title: title ?? children, | ||
title: titleOf(title, children), | ||
variantClassName: variants[variant], | ||
@@ -123,3 +135,3 @@ ...props, | ||
hasIcon: Icon != null, | ||
title: title ?? children, | ||
title: titleOf(title, children), | ||
variantClassName: variants2[variant], | ||
@@ -143,3 +155,3 @@ ...props, | ||
hasIcon: Icon != null, | ||
title: title ?? children, | ||
title: titleOf(title, children), | ||
variantClassName: variants3[variant], | ||
@@ -163,3 +175,3 @@ ...props, | ||
hasIcon: Icon != null, | ||
title: title ?? children, | ||
title: titleOf(title, children), | ||
variantClassName: variants4[variant], | ||
@@ -185,3 +197,3 @@ ...props, | ||
hasIcon: Icon != null, | ||
title: title ?? children, | ||
title: titleOf(title, children), | ||
variantClassName: variants5[variant], | ||
@@ -188,0 +200,0 @@ ...props, |
{ | ||
"name": "@tabula/ui-button", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Button components which are used to initialize an action", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -0,1 +1,2 @@ | ||
import { ReactNode } from 'react'; | ||
import { StyleRule } from '@vanilla-extract/css'; | ||
@@ -8,2 +9,3 @@ export declare function wrap(styleRule: StyleRule): StyleRule; | ||
export declare function gradient({ from, to }: GradientOptions): string; | ||
export declare function titleOf(title: string | undefined, children: ReactNode): string | undefined; | ||
export {}; |
import { ComponentType, MouseEventHandler, PropsWithChildren } from 'react'; | ||
export type Type = 'button' | 'link' | 'visual'; | ||
type CommonProps = { | ||
type CommonProps = PropsWithChildren<{ | ||
className?: string; | ||
@@ -30,3 +30,3 @@ /** | ||
type?: Type; | ||
}; | ||
}>; | ||
type ButtonProps = { | ||
@@ -63,6 +63,6 @@ type?: 'button'; | ||
}; | ||
type InnerBaseProps = PropsWithChildren<CommonProps & { | ||
type InnerBaseProps = CommonProps & { | ||
hasIcon?: boolean; | ||
variantClassName: string; | ||
}>; | ||
}; | ||
export type InnerProps = (InnerBaseProps & ButtonProps) | (InnerBaseProps & LinkProps) | (InnerBaseProps & VisualProps); | ||
@@ -73,3 +73,2 @@ type Icon = ComponentType<{ | ||
type VariantBaseProps<Variant extends string> = CommonProps & { | ||
children?: string; | ||
/** | ||
@@ -76,0 +75,0 @@ * The icon component. |
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
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
80607
747