tw-react-components 0.0.190 → 0.0.192
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/index.esm.js +36 -4
- package/package.json +1 -1
- package/src/components/Card/index.d.ts +30 -3
package/index.esm.js
CHANGED
|
@@ -569,7 +569,7 @@ const sizeClassNames = {
|
|
|
569
569
|
const Button = (_a) => {
|
|
570
570
|
var { children, className, size = 'medium', color = 'slate', variant = 'filled', rounded, loading, disabled, prefixIcon: PrefixIcon, suffixIcon: SuffixIcon, unstyled, dataTestId = 'button' } = _a, props = __rest(_a, ["children", "className", "size", "color", "variant", "rounded", "loading", "disabled", "prefixIcon", "suffixIcon", "unstyled", "dataTestId"]);
|
|
571
571
|
return (jsxs("button", Object.assign({ className: cn('inline-flex aspect-square shrink-0 items-center justify-center font-medium whitespace-nowrap transition-all outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:shrink-0', 'focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive focus-visible:ring-[3px]', sizeClassNames[size].base, variantClassNames[variant].base, variantClassNames[variant].colors[color].base, !unstyled &&
|
|
572
|
-
`${variantClassNames[variant].colors[color].hover} ${variantClassNames[variant].colors[color].focus} ${variantClassNames[variant].colors[color].active} cursor-pointer`, unstyled && 'cursor-default', rounded ? 'rounded-full' : 'rounded-md', children ? `${sizeClassNames[size].withChildren} aspect-[initial]` : 'justify-center', className), "data-testid": dataTestId, type: "button", disabled: disabled || loading }, props, { children: [
|
|
572
|
+
`${variantClassNames[variant].colors[color].hover} ${variantClassNames[variant].colors[color].focus} ${variantClassNames[variant].colors[color].active} cursor-pointer`, unstyled && 'cursor-default', rounded ? 'rounded-full' : 'rounded-md', children ? `${sizeClassNames[size].withChildren} aspect-[initial]` : 'justify-center', className), "data-testid": dataTestId, type: "button", disabled: disabled || loading }, props, { children: [loading ? (jsx(Spinner, { className: "w-fit bg-transparent dark:bg-transparent", spinnerClassName: children ? sizeClassNames[size].icon.withChildren : sizeClassNames[size].icon.base, dataTestId: `${dataTestId}-spinner` })) : (PrefixIcon && (jsx(PrefixIcon, { className: children ? sizeClassNames[size].icon.withChildren : sizeClassNames[size].icon.base }))), children, SuffixIcon && !loading && (jsx(SuffixIcon, { className: children ? sizeClassNames[size].icon.withChildren : sizeClassNames[size].icon.base }))] })));
|
|
573
573
|
};
|
|
574
574
|
|
|
575
575
|
const Badge = (_a) => {
|
|
@@ -582,10 +582,42 @@ const Block = (_a) => {
|
|
|
582
582
|
return (jsx("div", Object.assign({ "data-testid": dataTestId, className: cn(centered && 'mx-auto', container && 'container', fullWidth && 'w-full', fullHeight && 'h-full', className) }, props, { children: children })));
|
|
583
583
|
};
|
|
584
584
|
|
|
585
|
-
const Card = (_a) => {
|
|
586
|
-
var {
|
|
587
|
-
return (jsx(
|
|
585
|
+
const $Card = (_a) => {
|
|
586
|
+
var { className, dataTestId = 'card' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
587
|
+
return (jsx("div", Object.assign({ className: cn('bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm', className), "data-slot": "card", "data-testid": dataTestId }, props)));
|
|
588
588
|
};
|
|
589
|
+
const CardHeader = (_a) => {
|
|
590
|
+
var { className, dataTestId = 'card-header' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
591
|
+
return (jsx("div", Object.assign({ className: cn('@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6', className), "data-slot": "card-header", "data-testid": dataTestId }, props)));
|
|
592
|
+
};
|
|
593
|
+
const CardTitle = (_a) => {
|
|
594
|
+
var { className, dataTestId = 'card-title' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
595
|
+
return (jsx("div", Object.assign({ className: cn('leading-none font-semibold', className), "data-slot": "card-title", "data-testid": dataTestId }, props)));
|
|
596
|
+
};
|
|
597
|
+
const CardDescription = (_a) => {
|
|
598
|
+
var { className, dataTestId = 'card-description' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
599
|
+
return (jsx("div", Object.assign({ className: cn('text-muted-foreground text-sm', className), "data-slot": "card-description", "data-testid": dataTestId }, props)));
|
|
600
|
+
};
|
|
601
|
+
const CardAction = (_a) => {
|
|
602
|
+
var { className, dataTestId = 'card-action' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
603
|
+
return (jsx("div", Object.assign({ className: cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', className), "data-slot": "card-action", "data-testid": dataTestId }, props)));
|
|
604
|
+
};
|
|
605
|
+
const CardContent = (_a) => {
|
|
606
|
+
var { className, dataTestId = 'card-content' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
607
|
+
return (jsx("div", Object.assign({ className: cn('px-6', className), "data-slot": "card-content", "data-testid": dataTestId }, props)));
|
|
608
|
+
};
|
|
609
|
+
const CardFooter = (_a) => {
|
|
610
|
+
var { className, dataTestId = 'card-footer' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
611
|
+
return (jsx("div", Object.assign({ className: cn('flex items-center px-6 [.border-t]:pt-6', className), "data-slot": "card-footer", "data-testid": dataTestId }, props)));
|
|
612
|
+
};
|
|
613
|
+
const Card = Object.assign($Card, {
|
|
614
|
+
Header: CardHeader,
|
|
615
|
+
Footer: CardFooter,
|
|
616
|
+
Title: CardTitle,
|
|
617
|
+
Action: CardAction,
|
|
618
|
+
Description: CardDescription,
|
|
619
|
+
Content: CardContent,
|
|
620
|
+
});
|
|
589
621
|
|
|
590
622
|
const CollapsibleRoot = (_a) => {
|
|
591
623
|
var { dataTestId = 'collapsible' } = _a, props = __rest(_a, ["dataTestId"]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tw-react-components",
|
|
3
3
|
"description": "A set of React components build with TailwindCSS to make a nice dashboard.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.192",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://bacali95.github.io/tw-react-components",
|
|
7
7
|
"type": "module",
|
|
@@ -1,3 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type CardProps = React.ComponentProps<'div'> & {
|
|
3
|
+
dataTestId?: string;
|
|
4
|
+
};
|
|
5
|
+
export type CardHeaderProps = React.ComponentProps<'div'> & {
|
|
6
|
+
dataTestId?: string;
|
|
7
|
+
};
|
|
8
|
+
export type CardTitleProps = React.ComponentProps<'div'> & {
|
|
9
|
+
dataTestId?: string;
|
|
10
|
+
};
|
|
11
|
+
export type CardDescriptionProps = React.ComponentProps<'div'> & {
|
|
12
|
+
dataTestId?: string;
|
|
13
|
+
};
|
|
14
|
+
export type CardActionProps = React.ComponentProps<'div'> & {
|
|
15
|
+
dataTestId?: string;
|
|
16
|
+
};
|
|
17
|
+
export type CardContentProps = React.ComponentProps<'div'> & {
|
|
18
|
+
dataTestId?: string;
|
|
19
|
+
};
|
|
20
|
+
export type CardFooterProps = React.ComponentProps<'div'> & {
|
|
21
|
+
dataTestId?: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const Card: (({ className, dataTestId, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
24
|
+
Header: ({ className, dataTestId, ...props }: CardHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
Footer: ({ className, dataTestId, ...props }: CardFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
Title: ({ className, dataTestId, ...props }: CardTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
Action: ({ className, dataTestId, ...props }: CardActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
Description: ({ className, dataTestId, ...props }: CardDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
Content: ({ className, dataTestId, ...props }: CardContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
};
|