@iago-gois/test-lib 0.0.0
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/LICENSE +21 -0
- package/README.md +67 -0
- package/dist/index.cjs +166 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +34 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +125 -0
- package/dist/index.js.map +1 -0
- package/package.json +91 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 iago
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @iago/test-lib
|
|
2
|
+
|
|
3
|
+
[](https://github.com/iago-gois/test-lib/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/iago-gois/test-lib/actions/workflows/release.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/@iago/test-lib)
|
|
6
|
+
|
|
7
|
+
A React UI component library focused on accessibility, composability, and strict TypeScript APIs.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @iago/test-lib
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Peer dependencies:
|
|
16
|
+
|
|
17
|
+
- `react` `>=18 <20`
|
|
18
|
+
- `react-dom` `>=18 <20`
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { CgButton, CgInput } from "@iago/test-lib";
|
|
24
|
+
|
|
25
|
+
export function Example() {
|
|
26
|
+
return (
|
|
27
|
+
<div>
|
|
28
|
+
<CgInput placeholder="Email" />
|
|
29
|
+
<CgButton>Submit</CgButton>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Theming model
|
|
36
|
+
|
|
37
|
+
Import the library theme contract and override CSS variables in your app shell.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import "@iago/test-lib/src/styles/theme.css";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then define custom tokens under `:root` (or `.dark`) to match your brand.
|
|
44
|
+
|
|
45
|
+
## Import strategy
|
|
46
|
+
|
|
47
|
+
Use root imports for stable public API:
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { CgButton, CgInput, CgToast, CgTooltip } from "@iago/test-lib";
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## SSR notes
|
|
54
|
+
|
|
55
|
+
- Components are compatible with SSR frameworks like Next.js.
|
|
56
|
+
- Keep theme CSS loaded before first render to avoid hydration mismatches in color tokens.
|
|
57
|
+
|
|
58
|
+
## Release flow
|
|
59
|
+
|
|
60
|
+
- Add a changeset with `pnpm changeset`.
|
|
61
|
+
- Merge to `main`.
|
|
62
|
+
- GitHub Actions creates/updates a release PR and publishes on merge.
|
|
63
|
+
|
|
64
|
+
## Migration expectations
|
|
65
|
+
|
|
66
|
+
- Patch and minor releases are non-breaking.
|
|
67
|
+
- Breaking changes are introduced in majors with migration notes under `docs/migrations/`.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var clsx = require('clsx');
|
|
4
|
+
var tailwindMerge = require('tailwind-merge');
|
|
5
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
6
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
7
|
+
var React3 = require('react');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
var ToastPrimitive = require('@radix-ui/react-toast');
|
|
10
|
+
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
11
|
+
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule) return e;
|
|
14
|
+
var n = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
Object.keys(e).forEach(function (k) {
|
|
17
|
+
if (k !== 'default') {
|
|
18
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return e[k]; }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
n.default = e;
|
|
27
|
+
return Object.freeze(n);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
|
|
31
|
+
var ToastPrimitive__namespace = /*#__PURE__*/_interopNamespace(ToastPrimitive);
|
|
32
|
+
var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
|
|
33
|
+
|
|
34
|
+
// src/lib/cn.ts
|
|
35
|
+
function cn(...inputs) {
|
|
36
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
37
|
+
}
|
|
38
|
+
var buttonVariants = classVarianceAuthority.cva(
|
|
39
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
40
|
+
{
|
|
41
|
+
variants: {
|
|
42
|
+
variant: {
|
|
43
|
+
primary: "bg-[var(--ui-color-primary)] text-[var(--ui-color-primary-fg)] hover:opacity-90 cursor-pointer",
|
|
44
|
+
secondary: "bg-yellow-500 border border-[var(--ui-color-border)]",
|
|
45
|
+
ghost: "hover:bg-black/5"
|
|
46
|
+
},
|
|
47
|
+
size: {
|
|
48
|
+
sm: "h-8 px-3",
|
|
49
|
+
md: "h-10 px-4",
|
|
50
|
+
lg: "h-12 px-5"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
variant: "primary",
|
|
55
|
+
size: "md"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
var Button = React3__namespace.forwardRef(
|
|
60
|
+
({ asChild = false, className, size, variant, ...props }, ref) => {
|
|
61
|
+
const Comp = asChild ? reactSlot.Slot : "button";
|
|
62
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { className: cn(buttonVariants({ variant, size }), className), ref, ...props });
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
Button.displayName = "Button";
|
|
66
|
+
var Input = React3__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
67
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
68
|
+
"input",
|
|
69
|
+
{
|
|
70
|
+
className: cn(
|
|
71
|
+
"flex h-10 w-full rounded-md border border-[var(--ui-color-border)] bg-[var(--ui-color-surface)] px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-black/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ui-color-primary)] disabled:cursor-not-allowed disabled:opacity-50",
|
|
72
|
+
className
|
|
73
|
+
),
|
|
74
|
+
ref,
|
|
75
|
+
...props
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
Input.displayName = "Input";
|
|
80
|
+
var ToastProvider = ToastPrimitive__namespace.Provider;
|
|
81
|
+
var ToastViewport = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
82
|
+
ToastPrimitive__namespace.Viewport,
|
|
83
|
+
{
|
|
84
|
+
className: cn(
|
|
85
|
+
"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
|
|
86
|
+
className
|
|
87
|
+
),
|
|
88
|
+
ref,
|
|
89
|
+
...props
|
|
90
|
+
}
|
|
91
|
+
));
|
|
92
|
+
ToastViewport.displayName = ToastPrimitive__namespace.Viewport.displayName;
|
|
93
|
+
var Toast = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
94
|
+
ToastPrimitive__namespace.Root,
|
|
95
|
+
{
|
|
96
|
+
className: cn(
|
|
97
|
+
"group pointer-events-auto relative flex w-full items-center justify-between gap-3 overflow-hidden rounded-md border border-[var(--ui-color-border)] bg-[var(--ui-color-surface)] p-4 text-[var(--ui-color-fg)] shadow-lg",
|
|
98
|
+
className
|
|
99
|
+
),
|
|
100
|
+
ref,
|
|
101
|
+
...props
|
|
102
|
+
}
|
|
103
|
+
));
|
|
104
|
+
Toast.displayName = ToastPrimitive__namespace.Root.displayName;
|
|
105
|
+
var ToastTitle = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(ToastPrimitive__namespace.Title, { className: cn("text-sm font-semibold", className), ref, ...props }));
|
|
106
|
+
ToastTitle.displayName = ToastPrimitive__namespace.Title.displayName;
|
|
107
|
+
var ToastDescription = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
108
|
+
ToastPrimitive__namespace.Description,
|
|
109
|
+
{
|
|
110
|
+
className: cn("text-sm opacity-80", className),
|
|
111
|
+
ref,
|
|
112
|
+
...props
|
|
113
|
+
}
|
|
114
|
+
));
|
|
115
|
+
ToastDescription.displayName = ToastPrimitive__namespace.Description.displayName;
|
|
116
|
+
var ToastClose = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
117
|
+
ToastPrimitive__namespace.Close,
|
|
118
|
+
{
|
|
119
|
+
className: cn(
|
|
120
|
+
"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-black/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ui-color-primary)]",
|
|
121
|
+
className
|
|
122
|
+
),
|
|
123
|
+
ref,
|
|
124
|
+
"toast-close": "",
|
|
125
|
+
...props,
|
|
126
|
+
children: "x"
|
|
127
|
+
}
|
|
128
|
+
));
|
|
129
|
+
ToastClose.displayName = ToastPrimitive__namespace.Close.displayName;
|
|
130
|
+
var TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
131
|
+
var Tooltip = TooltipPrimitive__namespace.Root;
|
|
132
|
+
var TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|
|
133
|
+
var TooltipContent = React3__namespace.forwardRef(({ className, sideOffset = 8, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
134
|
+
TooltipPrimitive__namespace.Content,
|
|
135
|
+
{
|
|
136
|
+
className: cn(
|
|
137
|
+
"z-50 max-w-[220px] rounded-md bg-[var(--ui-color-fg)] px-3 py-2 text-xs text-[var(--ui-color-bg)] shadow-md",
|
|
138
|
+
className
|
|
139
|
+
),
|
|
140
|
+
ref,
|
|
141
|
+
sideOffset,
|
|
142
|
+
...props
|
|
143
|
+
}
|
|
144
|
+
) }));
|
|
145
|
+
TooltipContent.displayName = TooltipPrimitive__namespace.Content.displayName;
|
|
146
|
+
|
|
147
|
+
exports.Button = Button;
|
|
148
|
+
exports.CgButton = Button;
|
|
149
|
+
exports.CgInput = Input;
|
|
150
|
+
exports.CgToast = Toast;
|
|
151
|
+
exports.CgTooltip = Tooltip;
|
|
152
|
+
exports.Input = Input;
|
|
153
|
+
exports.Toast = Toast;
|
|
154
|
+
exports.ToastClose = ToastClose;
|
|
155
|
+
exports.ToastDescription = ToastDescription;
|
|
156
|
+
exports.ToastProvider = ToastProvider;
|
|
157
|
+
exports.ToastTitle = ToastTitle;
|
|
158
|
+
exports.ToastViewport = ToastViewport;
|
|
159
|
+
exports.Tooltip = Tooltip;
|
|
160
|
+
exports.TooltipContent = TooltipContent;
|
|
161
|
+
exports.TooltipProvider = TooltipProvider;
|
|
162
|
+
exports.TooltipTrigger = TooltipTrigger;
|
|
163
|
+
exports.buttonVariants = buttonVariants;
|
|
164
|
+
exports.cn = cn;
|
|
165
|
+
//# sourceMappingURL=index.cjs.map
|
|
166
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/cn.ts","../src/components/button/button.tsx","../src/components/input/input.tsx","../src/components/toast/toast.tsx","../src/components/tooltip/tooltip.tsx"],"names":["twMerge","clsx","cva","React","Slot","jsx","React2","ToastPrimitive","React3","TooltipPrimitive","React4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,SAAS,MAAM,MAAA,EAA8B;AAClD,EAAA,OAAOA,qBAAA,CAAQC,SAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;ACAA,IAAM,cAAA,GAAiBC,0BAAA;AAAA,EACrB,yOAAA;AAAA,E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,GAAA,qBAC1BH,cAAAA;AAAA,EAAgBE,yBAAA,CAAA,KAAA;AAAA,EAAf;AAAA,IACC,SAAA,EAAW,EAAA;AAAA,MACT,0KAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,GAAA;AAAA,IACA,aAAA,EAAY,EAAA;AAAA,IACX,GAAG,KAAA;AAAA,IACL,QAAA,EAAA;AAAA;AAED,CACD;AAED,UAAA,CAAW,cAA6BA,yBAAA,CAAA,KAAA,CAAM,WAAA;ACzE9C,IAAM,eAAA,GAAmCE,2BAAA,CAAA;AAEzC,IAAM,OAAA,GAA2BA,2BAAA,CAAA;AACjC,IAAM,cAAA,GAAkCA,2BAAA,CAAA;AAExC,IAAM,cAAA,GAAuBC,iBAAA,CAAA,UAAA,CAG3B,CAAC,EAAE,WAAW,UAAA,GAAa,CAAA,EAAG,GAAG,KAAA,IAAS,GAAA,qBAC1CL,cAAAA,CAAkBI,2BAAA,CAAA,MAAA,EAAjB,EACC,QAAA,kBAAAJ,cAAAA;AAAA,EAAkBI,2BAAA,CAAA,OAAA;AAAA,EAAjB;AAAA,IACC,SAAA,EAAW,EAAA;AAAA,MACT,6GAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,GAAA;AAAA,IACA,UAAA;AAAA,IACC,GAAG;AAAA;AACN,CAAA,EACF,CACD;AAED,cAAA,CAAe,cAA+BA,2BAAA,CAAA,OAAA,CAAQ,WAAA","file":"index.cjs","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","import { cn } from \"@/lib/cn\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { type VariantProps, cva } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n primary:\n \"bg-[var(--ui-color-primary)] text-[var(--ui-color-primary-fg)] hover:opacity-90 cursor-pointer\",\n secondary: \"bg-yellow-500 border border-[var(--ui-color-border)]\",\n ghost: \"hover:bg-black/5\",\n },\n size: {\n sm: \"h-8 px-3\",\n md: \"h-10 px-4\",\n lg: \"h-12 px-5\",\n },\n },\n defaultVariants: {\n variant: \"primary\",\n size: \"md\",\n },\n }\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ asChild = false, className, size, variant, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp className={cn(buttonVariants({ variant, size }), className)} ref={ref} {...props} />\n );\n }\n);\n\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n","import { cn } from \"@/lib/cn\";\nimport * as React from \"react\";\n\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement>;\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(({ className, ...props }, ref) => {\n return (\n <input\n className={cn(\n \"flex h-10 w-full rounded-md border border-[var(--ui-color-border)] bg-[var(--ui-color-surface)] px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-black/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ui-color-primary)] disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n ref={ref}\n {...props}\n />\n );\n});\n\nInput.displayName = \"Input\";\n\nexport { Input };\n","import { cn } from \"@/lib/cn\";\nimport * as ToastPrimitive from \"@radix-ui/react-toast\";\nimport * as React from \"react\";\n\nconst ToastProvider = ToastPrimitive.Provider;\n\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitive.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitive.Viewport>\n>(({ className, ...props }, ref) => (\n <ToastPrimitive.Viewport\n className={cn(\n \"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\",\n className\n )}\n ref={ref}\n {...props}\n />\n));\n\nToastViewport.displayName = ToastPrimitive.Viewport.displayName;\n\nconst Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <ToastPrimitive.Root\n className={cn(\n \"group pointer-events-auto relative flex w-full items-center justify-between gap-3 overflow-hidden rounded-md border border-[var(--ui-color-border)] bg-[var(--ui-color-surface)] p-4 text-[var(--ui-color-fg)] shadow-lg\",\n className\n )}\n ref={ref}\n {...props}\n />\n));\n\nToast.displayName = ToastPrimitive.Root.displayName;\n\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <ToastPrimitive.Title className={cn(\"text-sm font-semibold\", className)} ref={ref} {...props} />\n));\n\nToastTitle.displayName = ToastPrimitive.Title.displayName;\n\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <ToastPrimitive.Description\n className={cn(\"text-sm opacity-80\", className)}\n ref={ref}\n {...props}\n />\n));\n\nToastDescription.displayName = ToastPrimitive.Description.displayName;\n\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitive.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitive.Close>\n>(({ className, ...props }, ref) => (\n <ToastPrimitive.Close\n className={cn(\n \"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-black/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ui-color-primary)]\",\n className\n )}\n ref={ref}\n toast-close=\"\"\n {...props}\n >\n x\n </ToastPrimitive.Close>\n));\n\nToastClose.displayName = ToastPrimitive.Close.displayName;\n\nexport { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport };\n","import { cn } from \"@/lib/cn\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport * as React from \"react\";\n\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 8, ...props }, ref) => (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n className={cn(\n \"z-50 max-w-[220px] rounded-md bg-[var(--ui-color-fg)] px-3 py-2 text-xs text-[var(--ui-color-bg)] shadow-md\",\n className\n )}\n ref={ref}\n sideOffset={sideOffset}\n {...props}\n />\n </TooltipPrimitive.Portal>\n));\n\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as ToastPrimitive from '@radix-ui/react-toast';
|
|
5
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
6
|
+
import { ClassValue } from 'clsx';
|
|
7
|
+
|
|
8
|
+
declare const buttonVariants: (props?: ({
|
|
9
|
+
variant?: "primary" | "secondary" | "ghost" | null | undefined;
|
|
10
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
11
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
12
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
|
|
17
|
+
type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
|
|
18
|
+
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
19
|
+
|
|
20
|
+
declare const ToastProvider: React.FC<ToastPrimitive.ToastProviderProps>;
|
|
21
|
+
declare const ToastViewport: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastViewportProps & React.RefAttributes<HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
22
|
+
declare const Toast: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastProps & React.RefAttributes<HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
23
|
+
declare const ToastTitle: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastTitleProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
declare const ToastDescription: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastDescriptionProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
declare const ToastClose: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
26
|
+
|
|
27
|
+
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
28
|
+
declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
|
|
29
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
30
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
|
|
32
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
33
|
+
|
|
34
|
+
export { Button, type ButtonProps, Button as CgButton, Input as CgInput, Toast as CgToast, Tooltip as CgTooltip, Input, type InputProps, Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, cn };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as ToastPrimitive from '@radix-ui/react-toast';
|
|
5
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
6
|
+
import { ClassValue } from 'clsx';
|
|
7
|
+
|
|
8
|
+
declare const buttonVariants: (props?: ({
|
|
9
|
+
variant?: "primary" | "secondary" | "ghost" | null | undefined;
|
|
10
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
11
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
12
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
|
|
17
|
+
type InputProps = React.InputHTMLAttributes<HTMLInputElement>;
|
|
18
|
+
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
19
|
+
|
|
20
|
+
declare const ToastProvider: React.FC<ToastPrimitive.ToastProviderProps>;
|
|
21
|
+
declare const ToastViewport: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastViewportProps & React.RefAttributes<HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
22
|
+
declare const Toast: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastProps & React.RefAttributes<HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
23
|
+
declare const ToastTitle: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastTitleProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
declare const ToastDescription: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastDescriptionProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
declare const ToastClose: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
26
|
+
|
|
27
|
+
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
28
|
+
declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
|
|
29
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
30
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
|
|
32
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
33
|
+
|
|
34
|
+
export { Button, type ButtonProps, Button as CgButton, Input as CgInput, Toast as CgToast, Tooltip as CgTooltip, Input, type InputProps, Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, cn };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import * as React3 from 'react';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
import * as ToastPrimitive from '@radix-ui/react-toast';
|
|
8
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
9
|
+
|
|
10
|
+
// src/lib/cn.ts
|
|
11
|
+
function cn(...inputs) {
|
|
12
|
+
return twMerge(clsx(inputs));
|
|
13
|
+
}
|
|
14
|
+
var buttonVariants = cva(
|
|
15
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
16
|
+
{
|
|
17
|
+
variants: {
|
|
18
|
+
variant: {
|
|
19
|
+
primary: "bg-[var(--ui-color-primary)] text-[var(--ui-color-primary-fg)] hover:opacity-90 cursor-pointer",
|
|
20
|
+
secondary: "bg-yellow-500 border border-[var(--ui-color-border)]",
|
|
21
|
+
ghost: "hover:bg-black/5"
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
sm: "h-8 px-3",
|
|
25
|
+
md: "h-10 px-4",
|
|
26
|
+
lg: "h-12 px-5"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
variant: "primary",
|
|
31
|
+
size: "md"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
var Button = React3.forwardRef(
|
|
36
|
+
({ asChild = false, className, size, variant, ...props }, ref) => {
|
|
37
|
+
const Comp = asChild ? Slot : "button";
|
|
38
|
+
return /* @__PURE__ */ jsx(Comp, { className: cn(buttonVariants({ variant, size }), className), ref, ...props });
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
Button.displayName = "Button";
|
|
42
|
+
var Input = React3.forwardRef(({ className, ...props }, ref) => {
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
"input",
|
|
45
|
+
{
|
|
46
|
+
className: cn(
|
|
47
|
+
"flex h-10 w-full rounded-md border border-[var(--ui-color-border)] bg-[var(--ui-color-surface)] px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-black/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ui-color-primary)] disabled:cursor-not-allowed disabled:opacity-50",
|
|
48
|
+
className
|
|
49
|
+
),
|
|
50
|
+
ref,
|
|
51
|
+
...props
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
Input.displayName = "Input";
|
|
56
|
+
var ToastProvider = ToastPrimitive.Provider;
|
|
57
|
+
var ToastViewport = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
58
|
+
ToastPrimitive.Viewport,
|
|
59
|
+
{
|
|
60
|
+
className: cn(
|
|
61
|
+
"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
|
|
62
|
+
className
|
|
63
|
+
),
|
|
64
|
+
ref,
|
|
65
|
+
...props
|
|
66
|
+
}
|
|
67
|
+
));
|
|
68
|
+
ToastViewport.displayName = ToastPrimitive.Viewport.displayName;
|
|
69
|
+
var Toast = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
70
|
+
ToastPrimitive.Root,
|
|
71
|
+
{
|
|
72
|
+
className: cn(
|
|
73
|
+
"group pointer-events-auto relative flex w-full items-center justify-between gap-3 overflow-hidden rounded-md border border-[var(--ui-color-border)] bg-[var(--ui-color-surface)] p-4 text-[var(--ui-color-fg)] shadow-lg",
|
|
74
|
+
className
|
|
75
|
+
),
|
|
76
|
+
ref,
|
|
77
|
+
...props
|
|
78
|
+
}
|
|
79
|
+
));
|
|
80
|
+
Toast.displayName = ToastPrimitive.Root.displayName;
|
|
81
|
+
var ToastTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(ToastPrimitive.Title, { className: cn("text-sm font-semibold", className), ref, ...props }));
|
|
82
|
+
ToastTitle.displayName = ToastPrimitive.Title.displayName;
|
|
83
|
+
var ToastDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
84
|
+
ToastPrimitive.Description,
|
|
85
|
+
{
|
|
86
|
+
className: cn("text-sm opacity-80", className),
|
|
87
|
+
ref,
|
|
88
|
+
...props
|
|
89
|
+
}
|
|
90
|
+
));
|
|
91
|
+
ToastDescription.displayName = ToastPrimitive.Description.displayName;
|
|
92
|
+
var ToastClose = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
93
|
+
ToastPrimitive.Close,
|
|
94
|
+
{
|
|
95
|
+
className: cn(
|
|
96
|
+
"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-black/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ui-color-primary)]",
|
|
97
|
+
className
|
|
98
|
+
),
|
|
99
|
+
ref,
|
|
100
|
+
"toast-close": "",
|
|
101
|
+
...props,
|
|
102
|
+
children: "x"
|
|
103
|
+
}
|
|
104
|
+
));
|
|
105
|
+
ToastClose.displayName = ToastPrimitive.Close.displayName;
|
|
106
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
107
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
108
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
109
|
+
var TooltipContent = React3.forwardRef(({ className, sideOffset = 8, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
110
|
+
TooltipPrimitive.Content,
|
|
111
|
+
{
|
|
112
|
+
className: cn(
|
|
113
|
+
"z-50 max-w-[220px] rounded-md bg-[var(--ui-color-fg)] px-3 py-2 text-xs text-[var(--ui-color-bg)] shadow-md",
|
|
114
|
+
className
|
|
115
|
+
),
|
|
116
|
+
ref,
|
|
117
|
+
sideOffset,
|
|
118
|
+
...props
|
|
119
|
+
}
|
|
120
|
+
) }));
|
|
121
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
122
|
+
|
|
123
|
+
export { Button, Button as CgButton, Input as CgInput, Toast as CgToast, Tooltip as CgTooltip, Input, Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, cn };
|
|
124
|
+
//# sourceMappingURL=index.js.map
|
|
125
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/cn.ts","../src/components/button/button.tsx","../src/components/input/input.tsx","../src/components/toast/toast.tsx","../src/components/tooltip/tooltip.tsx"],"names":["React","React2","jsx","React4"],"mappings":";;;;;;;;;;AAGO,SAAS,MAAM,MAAA,EAA8B;AAClD,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;ACAA,IAAM,cAAA,GAAiB,GAAA;AAAA,EACrB,yOAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,OAAA,EACE,gGAAA;AAAA,QACF,SAAA,EAAW,sDAAA;AAAA,QACX,KAAA,EAAO;AAAA,OACT;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,UAAA;AAAA,QACJ,EAAA,EAAI,WAAA;AAAA,QACJ,EAAA,EAAI;AAAA;AACN,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS,SAAA;AAAA,MACT,IAAA,EAAM;AAAA;AACR;AAEJ;AAQA,IAAM,MAAA,GAAeA,MAAA,CAAA,UAAA;AAAA,EACnB,CAAC,EAAE,OAAA,GAAU,KAAA,EAAO,SAAA,EAAW,MAAM,OAAA,EAAS,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AAChE,IAAA,MAAM,IAAA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,MAAA,EAAjB,EACC,QAAA,kBAAAA,GAAAA;AAAA,EAAkB,gBAAA,CAAA,OAAA;AAAA,EAAjB;AAAA,IACC,SAAA,EAAW,EAAA;AAAA,MACT,6GAAA;AAAA,MACA;AAAA,KACF;AAAA,IACA,GAAA;AAAA,IACA,UAAA;AAAA,IACC,GAAG;AAAA;AACN,CAAA,EACF,CACD;AAED,cAAA,CAAe,cAA+B,gBAAA,CAAA,OAAA,CAAQ,WAAA","file":"index.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","import { cn } from \"@/lib/cn\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { type VariantProps, cva } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n primary:\n \"bg-[var(--ui-color-primary)] text-[var(--ui-color-primary-fg)] hover:opacity-90 cursor-pointer\",\n secondary: \"bg-yellow-500 border border-[var(--ui-color-border)]\",\n ghost: \"hover:bg-black/5\",\n },\n size: {\n sm: \"h-8 px-3\",\n md: \"h-10 px-4\",\n lg: \"h-12 px-5\",\n },\n },\n defaultVariants: {\n variant: \"primary\",\n size: \"md\",\n },\n }\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ asChild = false, className, size, variant, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n\n return (\n <Comp className={cn(buttonVariants({ variant, size }), className)} ref={ref} {...props} />\n );\n }\n);\n\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n","import { cn } from \"@/lib/cn\";\nimport * as React from \"react\";\n\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement>;\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(({ className, ...props }, ref) => {\n return (\n <input\n className={cn(\n \"flex h-10 w-full rounded-md border border-[var(--ui-color-border)] bg-[var(--ui-color-surface)] px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-black/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ui-color-primary)] disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n ref={ref}\n {...props}\n />\n );\n});\n\nInput.displayName = \"Input\";\n\nexport { Input };\n","import { cn } from \"@/lib/cn\";\nimport * as ToastPrimitive from \"@radix-ui/react-toast\";\nimport * as React from \"react\";\n\nconst ToastProvider = ToastPrimitive.Provider;\n\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitive.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitive.Viewport>\n>(({ className, ...props }, ref) => (\n <ToastPrimitive.Viewport\n className={cn(\n \"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\",\n className\n )}\n ref={ref}\n {...props}\n />\n));\n\nToastViewport.displayName = ToastPrimitive.Viewport.displayName;\n\nconst Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitive.Root>\n>(({ className, ...props }, ref) => (\n <ToastPrimitive.Root\n className={cn(\n \"group pointer-events-auto relative flex w-full items-center justify-between gap-3 overflow-hidden rounded-md border border-[var(--ui-color-border)] bg-[var(--ui-color-surface)] p-4 text-[var(--ui-color-fg)] shadow-lg\",\n className\n )}\n ref={ref}\n {...props}\n />\n));\n\nToast.displayName = ToastPrimitive.Root.displayName;\n\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <ToastPrimitive.Title className={cn(\"text-sm font-semibold\", className)} ref={ref} {...props} />\n));\n\nToastTitle.displayName = ToastPrimitive.Title.displayName;\n\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <ToastPrimitive.Description\n className={cn(\"text-sm opacity-80\", className)}\n ref={ref}\n {...props}\n />\n));\n\nToastDescription.displayName = ToastPrimitive.Description.displayName;\n\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitive.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitive.Close>\n>(({ className, ...props }, ref) => (\n <ToastPrimitive.Close\n className={cn(\n \"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-black/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ui-color-primary)]\",\n className\n )}\n ref={ref}\n toast-close=\"\"\n {...props}\n >\n x\n </ToastPrimitive.Close>\n));\n\nToastClose.displayName = ToastPrimitive.Close.displayName;\n\nexport { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport };\n","import { cn } from \"@/lib/cn\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport * as React from \"react\";\n\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 8, ...props }, ref) => (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n className={cn(\n \"z-50 max-w-[220px] rounded-md bg-[var(--ui-color-fg)] px-3 py-2 text-xs text-[var(--ui-color-bg)] shadow-md\",\n className\n )}\n ref={ref}\n sideOffset={sideOffset}\n {...props}\n />\n </TooltipPrimitive.Portal>\n));\n\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@iago-gois/test-lib",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Centralized React UI library focused on accessibility and composability.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/iago-gois/test-lib.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/iago-gois/test-lib#readme",
|
|
11
|
+
"keywords": ["react", "ui", "component-library", "design-system", "shadcn", "radix"],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./dist/index.cjs",
|
|
14
|
+
"module": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"require": "./dist/index.cjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": ["dist"],
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=20",
|
|
27
|
+
"pnpm": ">=9"
|
|
28
|
+
},
|
|
29
|
+
"packageManager": "pnpm@10.6.5",
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"provenance": true
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsup",
|
|
36
|
+
"typecheck": "tsc -p tsconfig.build.json --noEmit",
|
|
37
|
+
"lint": "biome check .",
|
|
38
|
+
"format": "biome format --write .",
|
|
39
|
+
"format:check": "biome format .",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest",
|
|
42
|
+
"storybook": "storybook dev -p 6006",
|
|
43
|
+
"storybook:build": "storybook build",
|
|
44
|
+
"changeset": "changeset",
|
|
45
|
+
"version-packages": "changeset version",
|
|
46
|
+
"release": "changeset publish",
|
|
47
|
+
"prepare": "husky"
|
|
48
|
+
},
|
|
49
|
+
"lint-staged": {
|
|
50
|
+
"*.{ts,tsx,js,jsx,json,md,css}": "biome check --write --no-errors-on-unmatched"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"react": ">=18 <20",
|
|
54
|
+
"react-dom": ">=18 <20"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@radix-ui/react-slot": "^1.1.1",
|
|
58
|
+
"@radix-ui/react-toast": "^1.2.14",
|
|
59
|
+
"@radix-ui/react-tooltip": "^1.2.8",
|
|
60
|
+
"class-variance-authority": "^0.7.1",
|
|
61
|
+
"clsx": "^2.1.1",
|
|
62
|
+
"lucide-react": "^0.577.0",
|
|
63
|
+
"shadcn": "^4.1.0",
|
|
64
|
+
"tailwind-merge": "^2.5.5",
|
|
65
|
+
"tw-animate-css": "^1.4.0"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@biomejs/biome": "^1.9.4",
|
|
69
|
+
"@changesets/cli": "^2.27.9",
|
|
70
|
+
"@storybook/addon-a11y": "^8.4.7",
|
|
71
|
+
"@storybook/addon-essentials": "^8.4.7",
|
|
72
|
+
"@storybook/addon-interactions": "^8.4.7",
|
|
73
|
+
"@storybook/react": "^8.4.7",
|
|
74
|
+
"@storybook/react-vite": "^8.4.7",
|
|
75
|
+
"@tailwindcss/vite": "^4.2.2",
|
|
76
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
77
|
+
"@testing-library/react": "^16.2.0",
|
|
78
|
+
"@types/node": "^22.10.2",
|
|
79
|
+
"@types/react": "^18.3.12",
|
|
80
|
+
"@types/react-dom": "^18.3.1",
|
|
81
|
+
"husky": "^9.1.7",
|
|
82
|
+
"jsdom": "^25.0.1",
|
|
83
|
+
"lint-staged": "^15.2.11",
|
|
84
|
+
"storybook": "^8.4.7",
|
|
85
|
+
"tailwindcss": "^4.2.2",
|
|
86
|
+
"tsup": "^8.3.5",
|
|
87
|
+
"typescript": "^5.7.2",
|
|
88
|
+
"vite": "^6.0.3",
|
|
89
|
+
"vitest": "^2.1.8"
|
|
90
|
+
}
|
|
91
|
+
}
|