@purr-react-tailwindcss/components.button 0.0.5 → 0.0.7
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/package.json +5 -3
- package/dist/_components.d.ts +0 -4
- package/dist/_types.d.ts +0 -14
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -54
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purr-react-tailwindcss/components.button",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"typescript": "*",
|
|
25
25
|
"react": "*",
|
|
26
26
|
"clsx": "*",
|
|
27
|
-
"@purr-core/utils.definitions": "0.0.
|
|
28
|
-
"@purr-react-tailwindcss/components.icon": "0.0.
|
|
27
|
+
"@purr-core/utils.definitions": "0.0.11",
|
|
28
|
+
"@purr-react-tailwindcss/components.icon": "0.0.7"
|
|
29
29
|
},
|
|
30
30
|
"author": "@DinhThienPhuc",
|
|
31
31
|
"license": "ISC",
|
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"dev": "vite build --watch",
|
|
36
36
|
"build": "tsc && vite build",
|
|
37
|
+
"build:vite": "tsc && vite build",
|
|
38
|
+
"build:tsup": "tsup",
|
|
37
39
|
"lint": "eslint . --ext ts,tsx --max-warnings 0"
|
|
38
40
|
}
|
|
39
41
|
}
|
package/dist/_components.d.ts
DELETED
package/dist/_types.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes, MouseEventHandler, ReactNode } from 'react';
|
|
2
|
-
import { IExtendable } from '@purr-core/utils.definitions';
|
|
3
|
-
|
|
4
|
-
export type TButtonSize = "small" | "medium" | "large";
|
|
5
|
-
export type TButtonVariant = "outlined" | "contained" | "text";
|
|
6
|
-
export interface IButtonProps {
|
|
7
|
-
size?: TButtonSize;
|
|
8
|
-
variant?: TButtonVariant;
|
|
9
|
-
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
10
|
-
loading?: boolean;
|
|
11
|
-
loadingComponent?: ReactNode;
|
|
12
|
-
children?: ReactNode;
|
|
13
|
-
htmlAttributes?: ButtonHTMLAttributes<HTMLButtonElement> & IExtendable;
|
|
14
|
-
}
|
package/dist/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),i=require("clsx"),a=require("react"),d=require("@purr-react-tailwindcss/components.icon"),c={className:"animate-spin text-blue-300 w-4 h-4"},m=({variant:e="text",size:t="medium",loading:r=!1,loadingComponent:n,htmlAttributes:s,children:o,onClick:b})=>{const l=a.useMemo(()=>r?n??u.jsx(d.Icon,{name:"loader-2",htmlAttributes:c}):o,[o,r,n]);return u.jsx("button",{onClick:b,className:i("flex","items-center","justify-center","transition-all","duration-200","ease-in-out","shadow-none","outline-none","overflow-hidden","rounded","min-w-16","text-sm","font-medium","cursor-pointer","button",t==="small"?"h-6 px-4":"",t==="medium"?"h-9 px-5":"",t==="large"?"h-12 px-6":"",e==="contained"?"border border-blue-300 bg-blue-300 text-gray-900 hover:bg-blue-400":"",e==="outlined"?"border border-blue-300 bg-transparent text-blue-300 hover:border-blue-200 hover:text-blue-200":"",e==="text"?"border border-transparent bg-transparent text-blue-300 hover:text-blue-200":""),...s,children:l})};exports.Button=m;
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
-
import s from "clsx";
|
|
3
|
-
import { useMemo as a } from "react";
|
|
4
|
-
import { Icon as d } from "@purr-react-tailwindcss/components.icon";
|
|
5
|
-
const i = {
|
|
6
|
-
className: "animate-spin text-blue-300 w-4 h-4"
|
|
7
|
-
}, h = ({
|
|
8
|
-
variant: e = "text",
|
|
9
|
-
size: t = "medium",
|
|
10
|
-
loading: r = !1,
|
|
11
|
-
loadingComponent: o,
|
|
12
|
-
htmlAttributes: b,
|
|
13
|
-
children: n,
|
|
14
|
-
onClick: l
|
|
15
|
-
}) => {
|
|
16
|
-
const m = a(() => r ? o ?? /* @__PURE__ */ u(d, { name: "loader-2", htmlAttributes: i }) : n, [n, r, o]);
|
|
17
|
-
return /* @__PURE__ */ u(
|
|
18
|
-
"button",
|
|
19
|
-
{
|
|
20
|
-
onClick: l,
|
|
21
|
-
className: s(
|
|
22
|
-
"flex",
|
|
23
|
-
"items-center",
|
|
24
|
-
"justify-center",
|
|
25
|
-
"transition-all",
|
|
26
|
-
"duration-200",
|
|
27
|
-
"ease-in-out",
|
|
28
|
-
"shadow-none",
|
|
29
|
-
"outline-none",
|
|
30
|
-
"overflow-hidden",
|
|
31
|
-
"rounded",
|
|
32
|
-
"min-w-16",
|
|
33
|
-
"text-sm",
|
|
34
|
-
"font-medium",
|
|
35
|
-
"cursor-pointer",
|
|
36
|
-
"button",
|
|
37
|
-
t === "small" ? "h-6 px-4" : "",
|
|
38
|
-
t === "medium" ? "h-9 px-5" : "",
|
|
39
|
-
t === "large" ? "h-12 px-6" : "",
|
|
40
|
-
// variant === "contained"
|
|
41
|
-
// ? "text-gray-900 !bg-blue-300 border border-blue-300 hover:!bg-blue-400"
|
|
42
|
-
// : "",
|
|
43
|
-
e === "contained" ? "border border-blue-300 bg-blue-300 text-gray-900 hover:bg-blue-400" : "",
|
|
44
|
-
e === "outlined" ? "border border-blue-300 bg-transparent text-blue-300 hover:border-blue-200 hover:text-blue-200" : "",
|
|
45
|
-
e === "text" ? "border border-transparent bg-transparent text-blue-300 hover:text-blue-200" : ""
|
|
46
|
-
),
|
|
47
|
-
...b,
|
|
48
|
-
children: m
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
export {
|
|
53
|
-
h as Button
|
|
54
|
-
};
|