@bettrlabs/ui 0.0.0-stage → 0.1.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/README.md +46 -2
- package/dist/components/button/Button.d.ts +8 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +38 -0
- package/dist/style.css +1 -0
- package/package.json +45 -4
package/README.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @bettrlabs/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A reusable React component library for Bettrlabs applications. The package is
|
|
4
|
+
built with TypeScript and Tailwind CSS.
|
|
5
|
+
|
|
6
|
+
## Development
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install
|
|
10
|
+
npm run dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The local Vite page demonstrates the Button variants and sizes.
|
|
14
|
+
|
|
15
|
+
## Build
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm run typecheck
|
|
19
|
+
npm run build
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The build outputs ESM, CommonJS, TypeScript declarations, and compiled styles
|
|
23
|
+
to `dist/`.
|
|
24
|
+
|
|
25
|
+
## Use in an application
|
|
26
|
+
|
|
27
|
+
Install React as a peer dependency and the library in your application, then
|
|
28
|
+
import the stylesheet once at the application entry point:
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import "@bettrlabs/ui/style.css";
|
|
32
|
+
import { Button } from "@bettrlabs/ui";
|
|
33
|
+
|
|
34
|
+
export function Example() {
|
|
35
|
+
return <Button>Continue</Button>;
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`Button` supports the `primary`, `secondary`, and `outline` variants and `sm`,
|
|
40
|
+
`md`, and `lg` sizes. It also accepts standard button HTML attributes and
|
|
41
|
+
forwards its ref to the underlying button.
|
|
42
|
+
|
|
43
|
+
## Publishing
|
|
44
|
+
|
|
45
|
+
The package manifest is configured to publish the `dist/` output and README as
|
|
46
|
+
the public `@bettrlabs/ui` package. After building and authenticating with npm,
|
|
47
|
+
publish a version with `npm publish`.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes } from "react";
|
|
2
|
+
export type ButtonVariant = "primary" | "secondary" | "outline";
|
|
3
|
+
export type ButtonSize = "sm" | "md" | "lg";
|
|
4
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
size?: ButtonSize;
|
|
7
|
+
}
|
|
8
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),u=require("react"),a={primary:"bg-blue-600 text-white hover:bg-blue-700 focus-visible:outline-blue-600",secondary:"bg-slate-100 text-slate-900 hover:bg-slate-200 focus-visible:outline-slate-500",outline:"border border-slate-300 bg-white text-slate-900 hover:bg-slate-50 focus-visible:outline-blue-600"},b={sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-5 py-3 text-base"},e=u.forwardRef(({className:t,size:s="md",type:o="button",variant:i="primary",...l},n)=>r.jsx("button",{ref:n,type:o,className:["inline-flex items-center justify-center rounded-md font-medium transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2","disabled:pointer-events-none disabled:opacity-50",a[i],b[s],t].filter(Boolean).join(" "),...l}));e.displayName="Button";exports.Button=e;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as r } from "react";
|
|
3
|
+
const a = {
|
|
4
|
+
primary: "bg-blue-600 text-white hover:bg-blue-700 focus-visible:outline-blue-600",
|
|
5
|
+
secondary: "bg-slate-100 text-slate-900 hover:bg-slate-200 focus-visible:outline-slate-500",
|
|
6
|
+
outline: "border border-slate-300 bg-white text-slate-900 hover:bg-slate-50 focus-visible:outline-blue-600"
|
|
7
|
+
}, u = {
|
|
8
|
+
sm: "px-3 py-1.5 text-sm",
|
|
9
|
+
md: "px-4 py-2 text-sm",
|
|
10
|
+
lg: "px-5 py-3 text-base"
|
|
11
|
+
}, b = r(
|
|
12
|
+
({
|
|
13
|
+
className: e,
|
|
14
|
+
size: t = "md",
|
|
15
|
+
type: s = "button",
|
|
16
|
+
variant: o = "primary",
|
|
17
|
+
...i
|
|
18
|
+
}, l) => /* @__PURE__ */ n(
|
|
19
|
+
"button",
|
|
20
|
+
{
|
|
21
|
+
ref: l,
|
|
22
|
+
type: s,
|
|
23
|
+
className: [
|
|
24
|
+
"inline-flex items-center justify-center rounded-md font-medium transition-colors",
|
|
25
|
+
"focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
26
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
27
|
+
a[o],
|
|
28
|
+
u[t],
|
|
29
|
+
e
|
|
30
|
+
].filter(Boolean).join(" "),
|
|
31
|
+
...i
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
b.displayName = "Button";
|
|
36
|
+
export {
|
|
37
|
+
b as Button
|
|
38
|
+
};
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-outline-style:solid}}}@layer theme{:root,:host{--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-900:oklch(20.8% .042 265.755);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-medium:500;--font-weight-semibold:600;--tracking-wide:.025em;--radius-md:.375rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}}@layer utilities{.mx-auto{margin-inline:auto}.mt-2{margin-top:calc(var(--spacing) * 2)}.flex{display:flex}.inline-flex{display:inline-flex}.min-h-screen{min-height:100vh}.max-w-3xl{max-width:var(--container-3xl)}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.gap-3{gap:calc(var(--spacing) * 3)}.gap-6{gap:calc(var(--spacing) * 6)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-slate-300{border-color:var(--color-slate-300)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-white{background-color:var(--color-white)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-blue-600{color:var(--color-blue-600)}.text-slate-900{color:var(--color-slate-900)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media(hover:hover){.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\:bg-slate-200:hover{background-color:var(--color-slate-200)}}.focus-visible\:outline:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-blue-600:focus-visible{outline-color:var(--color-blue-600)}.focus-visible\:outline-slate-500:focus-visible{outline-color:var(--color-slate-500)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:opacity-50:disabled{opacity:.5}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bettrlabs/ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Reusable React components for Bettrlabs applications.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
},
|
|
19
|
+
"./style.css": "./dist/style.css"
|
|
20
|
+
},
|
|
21
|
+
"sideEffects": [
|
|
22
|
+
"**/*.css"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"dev": "node ./node_modules/vite/bin/vite.js",
|
|
26
|
+
"build": "node ./node_modules/vite/bin/vite.js build && node ./node_modules/typescript/bin/tsc -p tsconfig.build.json",
|
|
27
|
+
"preview": "node ./node_modules/vite/bin/vite.js preview",
|
|
28
|
+
"typecheck": "node ./node_modules/typescript/bin/tsc --noEmit"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"react": ">=18"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@tailwindcss/vite": "^4.0.0",
|
|
35
|
+
"@types/react": "^19.0.0",
|
|
36
|
+
"@types/react-dom": "^19.0.0",
|
|
37
|
+
"@vitejs/plugin-react": "^4.3.0",
|
|
38
|
+
"react": "^19.0.0",
|
|
39
|
+
"react-dom": "^19.0.0",
|
|
40
|
+
"tailwindcss": "^4.0.0",
|
|
41
|
+
"typescript": "^5.7.0",
|
|
42
|
+
"vite": "^6.0.0"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
}
|
|
47
|
+
}
|