@xipkg/button 1.0.0 → 1.0.1

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.
@@ -0,0 +1,14 @@
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
@@ -0,0 +1,14 @@
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 ADDED
@@ -0,0 +1,108 @@
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
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xipkg/button",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
@@ -11,25 +11,25 @@
11
11
  "lint": "eslint \"**/*.ts*\""
12
12
  },
13
13
  "dependencies": {
14
- "class-variance-authority": "^0.7.0",
15
- "@xipkg/utils": "*",
16
14
  "@radix-ui/react-slot": "^1.0.2",
15
+ "@xipkg/utils": "^1.0.1",
16
+ "class-variance-authority": "^0.7.0",
17
17
  "react": "^18.2.0"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@types/node": "^17.0.12",
21
21
  "@types/react": "^18.2.14",
22
22
  "@types/react-dom": "^18.2.6",
23
- "@xipkg/eslint": "^0.0.3",
23
+ "@xipkg/eslint": "^0.0.4",
24
24
  "@xipkg/typescript": "^0.0.0",
25
25
  "eslint": "^7.32.0",
26
- "typescript": "^5.1.3",
27
- "tailwindcss": "^3.3.2"
26
+ "tailwindcss": "^3.3.2",
27
+ "typescript": "^5.1.3"
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
32
  "author": "xi.effect",
33
33
  "description": "",
34
- "gitHead": "0ee562e7c7723699c85daf61b493d6a57b7c1f08"
34
+ "gitHead": "33022d3bd6e72a5ccc9097b187742f9139f7d905"
35
35
  }