@xipkg/button 1.0.1 → 1.1.3
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/Button.tsx +11 -8
- package/package.json +1 -1
- package/.turbo/turbo-build.log +0 -14
- package/dist/index.d.ts +0 -14
- package/dist/index.js +0 -108
package/Button.tsx
CHANGED
|
@@ -5,25 +5,28 @@ import { cva, type VariantProps } from 'class-variance-authority';
|
|
|
5
5
|
import { cn } from '@xipkg/utils';
|
|
6
6
|
|
|
7
7
|
export const buttonVariants = cva(
|
|
8
|
-
'inline-flex items-center
|
|
8
|
+
'inline-flex border-box justify-center items-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
|
-
default:
|
|
13
|
-
|
|
12
|
+
default:
|
|
13
|
+
'text-gray-0 dark:text-gray-100 bg-brand-80 hover:bg-brand-100 active:bg-brand-100 focus:bg-brand-100',
|
|
14
|
+
secondary:
|
|
15
|
+
'bg-gray-0 text-gray-100 border-gray-30 border-2 hover:bg-gray-5 active:bg-gray-5 focus:bg-gray-5',
|
|
14
16
|
ghost: 'text-gray-100 bg-gray-0 border-0 hover:bg-gray-5 active:bg-gray-5 focus:bg-gray-5',
|
|
15
17
|
error: 'bg-red-80 text-gray-0 hover:bg-red-100 active:bg-red-100 focus:bg-red-100',
|
|
16
|
-
success:
|
|
18
|
+
success:
|
|
19
|
+
'bg-green-80 text-gray-0 hover:bg-green-100 active:bg-green-100 focus:bg-green-100',
|
|
17
20
|
},
|
|
18
21
|
size: {
|
|
19
|
-
l: 'h-14 px-8
|
|
20
|
-
m: 'h-12
|
|
21
|
-
s: 'h-8
|
|
22
|
+
l: 'h-14 rounded-xl px-8 text-[20px] pb-[3px]',
|
|
23
|
+
m: 'h-12 rounded-lg px-4 text-[16px] pb-[2px]',
|
|
24
|
+
s: 'h-8 rounded-md px-3 text-[14px] pb-[2px]',
|
|
22
25
|
},
|
|
23
26
|
},
|
|
24
27
|
defaultVariants: {
|
|
25
28
|
variant: 'default',
|
|
26
|
-
size: '
|
|
29
|
+
size: 'm',
|
|
27
30
|
},
|
|
28
31
|
},
|
|
29
32
|
);
|
package/package.json
CHANGED
package/.turbo/turbo-build.log
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @xipkg/button@1.0.0 build
|
|
3
|
-
> tsup index.ts --format cjs --dts
|
|
4
|
-
|
|
5
|
-
CLI Building entry: index.ts
|
|
6
|
-
CLI Using tsconfig: tsconfig.json
|
|
7
|
-
CLI tsup v6.7.0
|
|
8
|
-
CLI Target: es6
|
|
9
|
-
CJS Build start
|
|
10
|
-
CJS dist/index.js 4.66 KB
|
|
11
|
-
CJS ⚡️ Build success in 28ms
|
|
12
|
-
DTS Build start
|
|
13
|
-
DTS ⚡️ Build success in 2936ms
|
|
14
|
-
DTS dist/index.d.ts 734.00 B
|
package/dist/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { VariantProps } from 'class-variance-authority';
|
|
4
|
-
|
|
5
|
-
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "default" | "secondary" | "ghost" | "error" | "success" | null | undefined;
|
|
7
|
-
size?: "l" | "m" | "s" | null | undefined;
|
|
8
|
-
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
9
|
-
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
10
|
-
asChild?: boolean;
|
|
11
|
-
}
|
|
12
|
-
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
-
|
|
14
|
-
export { Button, ButtonProps, buttonVariants };
|
package/dist/index.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
|
-
var __export = (target, all) => {
|
|
38
|
-
for (var name in all)
|
|
39
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
-
};
|
|
41
|
-
var __copyProps = (to, from, except, desc) => {
|
|
42
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
-
for (let key of __getOwnPropNames(from))
|
|
44
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
-
}
|
|
47
|
-
return to;
|
|
48
|
-
};
|
|
49
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
-
mod
|
|
56
|
-
));
|
|
57
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
|
-
|
|
59
|
-
// index.ts
|
|
60
|
-
var pkg_exports = {};
|
|
61
|
-
__export(pkg_exports, {
|
|
62
|
-
Button: () => Button,
|
|
63
|
-
buttonVariants: () => buttonVariants
|
|
64
|
-
});
|
|
65
|
-
module.exports = __toCommonJS(pkg_exports);
|
|
66
|
-
|
|
67
|
-
// Button.tsx
|
|
68
|
-
var React = __toESM(require("react"));
|
|
69
|
-
var import_react_slot = require("@radix-ui/react-slot");
|
|
70
|
-
var import_class_variance_authority = require("class-variance-authority");
|
|
71
|
-
var import_utils = require("@xipkg/utils");
|
|
72
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
73
|
-
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
74
|
-
"inline-flex items-center w-fit justify-center ring-offset-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
75
|
-
{
|
|
76
|
-
variants: {
|
|
77
|
-
variant: {
|
|
78
|
-
default: "text-gray-0 dark:text-gray-100 bg-brand-80 hover:bg-brand-100 active:bg-brand-100 focus:bg-brand-100",
|
|
79
|
-
secondary: "bg-gray-0 text-gray-100 border-gray-30 border-2 hover:bg-gray-5 active:bg-gray-5 focus:bg-gray-5",
|
|
80
|
-
ghost: "text-gray-100 bg-gray-0 border-0 hover:bg-gray-5 active:bg-gray-5 focus:bg-gray-5",
|
|
81
|
-
error: "bg-red-80 text-gray-0 hover:bg-red-100 active:bg-red-100 focus:bg-red-100",
|
|
82
|
-
success: "bg-green-80 text-gray-0 hover:bg-green-100 active:bg-green-100 focus:bg-green-100"
|
|
83
|
-
},
|
|
84
|
-
size: {
|
|
85
|
-
l: "h-14 px-8 rounded-xl text-[20px]",
|
|
86
|
-
m: "h-12 px-6 rounded-lg text-[16px]",
|
|
87
|
-
s: "h-8 px-4 rounded-md text-[14px]"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
defaultVariants: {
|
|
91
|
-
variant: "default",
|
|
92
|
-
size: "l"
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
var Button = React.forwardRef(
|
|
97
|
-
(_a, ref) => {
|
|
98
|
-
var _b = _a, { className, variant, size, asChild = false, children } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild", "children"]);
|
|
99
|
-
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
100
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, __spreadProps(__spreadValues({ className: (0, import_utils.cn)(buttonVariants({ variant, size, className })), ref }, props), { children }));
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
Button.displayName = "Button";
|
|
104
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
-
0 && (module.exports = {
|
|
106
|
-
Button,
|
|
107
|
-
buttonVariants
|
|
108
|
-
});
|