@b3-crow/ui-kit 0.0.16
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/.github/dependabot.yml +6 -0
- package/.github/workflows/publish.yml +71 -0
- package/.github/workflows/template-sync.yml +31 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +1 -0
- package/.prettierignore +28 -0
- package/.prettierrc +13 -0
- package/.templatesyncignore +2 -0
- package/.whitesource +14 -0
- package/LICENSE +21 -0
- package/README.md +98 -0
- package/commitlint.config.cjs +4 -0
- package/dist/components/ui/button.d.ts +15 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +33 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/index.d.ts.map +1 -0
- package/dist/components/ui/index.js +2 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +6 -0
- package/dist/lib/utils.js.map +1 -0
- package/eslint.config.mts +7 -0
- package/lint-staged +0 -0
- package/package.json +58 -0
- package/postcss.config.mjs +5 -0
- package/src/components/ui/button.tsx +63 -0
- package/src/components/ui/index.ts +1 -0
- package/src/index.ts +5 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/utils.ts +7 -0
- package/src/styles/globals.css +7 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: Publish npm Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
packages: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
update-version:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
if: ${{ github.actor != 'github-actions[bot]' }}
|
|
16
|
+
outputs:
|
|
17
|
+
version: ${{ steps.read_version.outputs.new_version }}
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
with:
|
|
22
|
+
persist-credentials: false
|
|
23
|
+
|
|
24
|
+
- name: Configure Git Identity
|
|
25
|
+
run: |
|
|
26
|
+
git config user.name "github-actions[bot]"
|
|
27
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
28
|
+
|
|
29
|
+
- name: Read current version
|
|
30
|
+
id: read_version
|
|
31
|
+
run: |
|
|
32
|
+
current=$(jq -r '.version' package.json)
|
|
33
|
+
echo "current version: $current"
|
|
34
|
+
IFS='.' read -r major minor patch <<< "$current"
|
|
35
|
+
patch=$((patch + 1))
|
|
36
|
+
new="$major.$minor.$patch"
|
|
37
|
+
echo "new version: $new"
|
|
38
|
+
echo "new_version=$new" >> $GITHUB_OUTPUT
|
|
39
|
+
|
|
40
|
+
- name: Bump version in package.json
|
|
41
|
+
run: |
|
|
42
|
+
jq --arg v "${{ steps.read_version.outputs.new_version }}" '.version = $v' package.json > package.json.tmp
|
|
43
|
+
mv package.json.tmp package.json
|
|
44
|
+
|
|
45
|
+
- name: Commit & push version bump
|
|
46
|
+
env:
|
|
47
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
48
|
+
run: |
|
|
49
|
+
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git
|
|
50
|
+
git add package.json
|
|
51
|
+
git diff --cached --quiet || git commit -m "chore: bump up version +0.0.1 [skip ci]"
|
|
52
|
+
git push origin HEAD
|
|
53
|
+
|
|
54
|
+
build:
|
|
55
|
+
runs-on: ubuntu-latest
|
|
56
|
+
needs: update-version
|
|
57
|
+
permissions:
|
|
58
|
+
contents: read
|
|
59
|
+
packages: write
|
|
60
|
+
steps:
|
|
61
|
+
- uses: actions/checkout@v4
|
|
62
|
+
- uses: actions/setup-node@v4
|
|
63
|
+
with:
|
|
64
|
+
node-version: '20.x'
|
|
65
|
+
registry-url: 'https://registry.npmjs.org'
|
|
66
|
+
- uses: pnpm/action-setup@v4
|
|
67
|
+
- run: pnpm install
|
|
68
|
+
- run: pnpm build
|
|
69
|
+
- run: pnpm publish --no-git-checks
|
|
70
|
+
env:
|
|
71
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
on:
|
|
2
|
+
schedule:
|
|
3
|
+
- cron: '0 0 1 * *'
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: write
|
|
8
|
+
pull-requests: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
repo-sync:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: write
|
|
15
|
+
pull-requests: write
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
with:
|
|
21
|
+
token: ${{ secrets.GH_TOKEN }}
|
|
22
|
+
persist-credentials: false
|
|
23
|
+
|
|
24
|
+
- name: actions-template-sync
|
|
25
|
+
uses: AndreasAugustin/actions-template-sync@v2
|
|
26
|
+
with:
|
|
27
|
+
git_user_name: Methika Fernando
|
|
28
|
+
git_user_email: methikafernando2006@gmail.com
|
|
29
|
+
source_gh_token: ${{ secrets.GH_TOKEN }}
|
|
30
|
+
target_gh_token: ${{ secrets.GH_TOKEN }}
|
|
31
|
+
source_repo_path: CROW-B3/npm-sdk-template
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx commitlint --edit $1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pnpm run lint-staged
|
package/.prettierignore
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
|
|
4
|
+
# Build outputs
|
|
5
|
+
.next/
|
|
6
|
+
out/
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
|
|
10
|
+
# Environment files
|
|
11
|
+
.env*
|
|
12
|
+
|
|
13
|
+
# Logs
|
|
14
|
+
*.log
|
|
15
|
+
|
|
16
|
+
# Package manager files
|
|
17
|
+
package-lock.json
|
|
18
|
+
yarn.lock
|
|
19
|
+
pnpm-lock.yaml
|
|
20
|
+
|
|
21
|
+
# IDE files
|
|
22
|
+
.vscode/
|
|
23
|
+
.idea/
|
|
24
|
+
|
|
25
|
+
# OS files
|
|
26
|
+
.DS_Store
|
|
27
|
+
Thumbs.db
|
|
28
|
+
|
package/.prettierrc
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"semi": true,
|
|
3
|
+
"trailingComma": "es5",
|
|
4
|
+
"singleQuote": true,
|
|
5
|
+
"tabWidth": 2,
|
|
6
|
+
"useTabs": false,
|
|
7
|
+
"printWidth": 80,
|
|
8
|
+
"bracketSpacing": true,
|
|
9
|
+
"arrowParens": "avoid",
|
|
10
|
+
"endOfLine": "lf",
|
|
11
|
+
"jsxSingleQuote": false,
|
|
12
|
+
"bracketSameLine": false
|
|
13
|
+
}
|
package/.whitesource
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scanSettings": {
|
|
3
|
+
"baseBranches": []
|
|
4
|
+
},
|
|
5
|
+
"checkRunSettings": {
|
|
6
|
+
"vulnerableCheckRunConclusionLevel": "failure",
|
|
7
|
+
"displayMode": "diff",
|
|
8
|
+
"useMendCheckNames": true
|
|
9
|
+
},
|
|
10
|
+
"issueSettings": {
|
|
11
|
+
"minSeverityLevel": "LOW",
|
|
12
|
+
"issueType": "DEPENDENCY"
|
|
13
|
+
}
|
|
14
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 CROW By B3
|
|
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,98 @@
|
|
|
1
|
+
# CROW-B3 UI Kit
|
|
2
|
+
|
|
3
|
+
CROW-B3 UI Kit is a set of UI components for CROW-B3 projects.
|
|
4
|
+
A React component library built with shadcn/ui and Tailwind CSS v4.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pnpm add @b3-crow/ui-kit
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Local Development
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
"@b3-crow/ui-kit": "file:../ui-kit"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Setup
|
|
19
|
+
|
|
20
|
+
### 1. Install Peer Dependencies
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pnpm add react react-dom
|
|
24
|
+
pnpm add -D tailwindcss @tailwindcss/postcss postcss
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 2. Configure PostCSS
|
|
28
|
+
|
|
29
|
+
Create or update `postcss.config.mjs`:
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
export default {
|
|
33
|
+
plugins: {
|
|
34
|
+
'@tailwindcss/postcss': {},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. Import Styles
|
|
40
|
+
|
|
41
|
+
Import the global styles in your app:
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import '@b3-crow/ui-kit/dist/styles/globals.css';
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
### Button Component
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { Button } from '@b3-crow/ui-kit';
|
|
53
|
+
|
|
54
|
+
function App() {
|
|
55
|
+
return (
|
|
56
|
+
<div>
|
|
57
|
+
<Button>Click me</Button>
|
|
58
|
+
<Button variant="outline">Outline</Button>
|
|
59
|
+
<Button variant="destructive">Delete</Button>
|
|
60
|
+
<Button size="lg">Large</Button>
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Available Components
|
|
67
|
+
|
|
68
|
+
- **Button**: Fully customizable button component with multiple variants and sizes
|
|
69
|
+
|
|
70
|
+
### Utilities
|
|
71
|
+
|
|
72
|
+
- **cn**: Utility function for merging Tailwind classes
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
import { cn } from '@b3-crow/ui-kit';
|
|
76
|
+
|
|
77
|
+
const className = cn('px-4 py-2', 'bg-blue-500', { 'text-white': true });
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Development
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Install dependencies
|
|
84
|
+
pnpm install
|
|
85
|
+
|
|
86
|
+
# Build the library
|
|
87
|
+
pnpm run build
|
|
88
|
+
|
|
89
|
+
# Lint
|
|
90
|
+
pnpm run lint
|
|
91
|
+
|
|
92
|
+
# Format
|
|
93
|
+
pnpm run format
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
MIT
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function Button({ className, variant, size, asChild, type, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare namespace Button {
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
14
|
+
export { Button, buttonVariants };
|
|
15
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,cAAc;;;mFA4BnB,CAAC;AAEF,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAe,EACf,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,WAAW,2CASb;kBAhBQ,MAAM;;;AAmBf,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from '@/lib/utils';
|
|
5
|
+
const buttonVariants = cva('inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: 'bg-primary text-primary-foreground shadow hover:bg-primary/90',
|
|
9
|
+
destructive: 'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',
|
|
10
|
+
outline: 'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',
|
|
11
|
+
secondary: 'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80',
|
|
12
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
13
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
default: 'h-9 px-4 py-2',
|
|
17
|
+
sm: 'h-8 rounded-md px-3 text-xs',
|
|
18
|
+
lg: 'h-10 rounded-md px-8',
|
|
19
|
+
icon: 'h-9 w-9',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: 'default',
|
|
24
|
+
size: 'default',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
function Button({ className, variant, size, asChild = false, type, ...props }) {
|
|
28
|
+
const Comp = asChild ? Slot : 'button';
|
|
29
|
+
return (_jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), type: asChild ? type : (type ?? 'button'), ...props }));
|
|
30
|
+
}
|
|
31
|
+
Button.displayName = 'Button';
|
|
32
|
+
export { Button, buttonVariants };
|
|
33
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/components/ui/button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAG/C,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,MAAM,cAAc,GAAG,GAAG,CACxB,uSAAuS,EACvS;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EACL,+DAA+D;YACjE,WAAW,EACT,8EAA8E;YAChF,OAAO,EACL,0FAA0F;YAC5F,SAAS,EACP,wEAAwE;YAC1E,KAAK,EAAE,8CAA8C;YACrD,IAAI,EAAE,iDAAiD;SACxD;QACD,IAAI,EAAE;YACJ,OAAO,EAAE,eAAe;YACxB,EAAE,EAAE,6BAA6B;YACjC,EAAE,EAAE,sBAAsB;YAC1B,IAAI,EAAE,SAAS;SAChB;KACF;IACD,eAAe,EAAE;QACf,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;KAChB;CACF,CACF,CAAC;AAQF,SAAS,MAAM,CAAC,EACd,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAO,GAAG,KAAK,EACf,IAAI,EACJ,GAAG,KAAK,EACI;IACZ,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;IACvC,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAC3D,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,QAAQ,CAAC,KACrC,KAAK,GACT,CACH,CAAC;AACJ,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAoB,cAAc,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC;AAGhC,cAAc,OAAO,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,cAAc,iBAAiB,CAAC;AAEhC,mBAAmB;AACnB,cAAc,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
package/lint-staged
ADDED
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@b3-crow/ui-kit",
|
|
3
|
+
"version": "0.0.16",
|
|
4
|
+
"description": "CROW-B3 UI Kit",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/CROW-B3/npm-sdk-template.git"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"author": "CROW By B3",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@antfu/eslint-config": "^6.2.0",
|
|
18
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
19
|
+
"@tailwindcss/postcss": "^4.1.17",
|
|
20
|
+
"@types/react": "^19.2.5",
|
|
21
|
+
"@types/react-dom": "^19.2.3",
|
|
22
|
+
"autoprefixer": "^10.4.22",
|
|
23
|
+
"commitlint": "^20.1.0",
|
|
24
|
+
"husky": "^9.1.7",
|
|
25
|
+
"lint-staged": "^16.2.6",
|
|
26
|
+
"postcss": "^8.5.6",
|
|
27
|
+
"prettier": "^3.6.2",
|
|
28
|
+
"tailwindcss": "^4.1.17",
|
|
29
|
+
"typescript": "^5.9.3"
|
|
30
|
+
},
|
|
31
|
+
"lint-staged": {
|
|
32
|
+
"*.{js,jsx,ts,tsx}": [
|
|
33
|
+
"eslint --fix",
|
|
34
|
+
"prettier --write"
|
|
35
|
+
],
|
|
36
|
+
"*.{json,md,css,scss,html,yml,yaml}": [
|
|
37
|
+
"prettier --write"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"react": "^19.2.0",
|
|
42
|
+
"react-dom": "^19.2.0"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
46
|
+
"class-variance-authority": "^0.7.1",
|
|
47
|
+
"clsx": "^2.1.1",
|
|
48
|
+
"tailwind-merge": "^3.4.0"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsc",
|
|
52
|
+
"build:watch": "tsc --watch",
|
|
53
|
+
"lint": "eslint src/",
|
|
54
|
+
"lint:fix": "eslint src/ --fix",
|
|
55
|
+
"format": "pnpm exec prettier src/ --write",
|
|
56
|
+
"lint-staged": "lint-staged"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/lib/utils';
|
|
7
|
+
|
|
8
|
+
const buttonVariants = cva(
|
|
9
|
+
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default:
|
|
14
|
+
'bg-primary text-primary-foreground shadow hover:bg-primary/90',
|
|
15
|
+
destructive:
|
|
16
|
+
'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',
|
|
17
|
+
outline:
|
|
18
|
+
'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',
|
|
19
|
+
secondary:
|
|
20
|
+
'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80',
|
|
21
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
22
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
default: 'h-9 px-4 py-2',
|
|
26
|
+
sm: 'h-8 rounded-md px-3 text-xs',
|
|
27
|
+
lg: 'h-10 rounded-md px-8',
|
|
28
|
+
icon: 'h-9 w-9',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
variant: 'default',
|
|
33
|
+
size: 'default',
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export interface ButtonProps
|
|
39
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
40
|
+
VariantProps<typeof buttonVariants> {
|
|
41
|
+
asChild?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function Button({
|
|
45
|
+
className,
|
|
46
|
+
variant,
|
|
47
|
+
size,
|
|
48
|
+
asChild = false,
|
|
49
|
+
type,
|
|
50
|
+
...props
|
|
51
|
+
}: ButtonProps) {
|
|
52
|
+
const Comp = asChild ? Slot : 'button';
|
|
53
|
+
return (
|
|
54
|
+
<Comp
|
|
55
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
56
|
+
type={asChild ? type : (type ?? 'button')}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
Button.displayName = 'Button';
|
|
62
|
+
|
|
63
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button, type ButtonProps, buttonVariants } from './button';
|
package/src/index.ts
ADDED
package/src/lib/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { cn } from './utils';
|
package/src/lib/utils.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"outDir": "dist",
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationMap": true,
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"jsx": "react-jsx",
|
|
16
|
+
"baseUrl": ".",
|
|
17
|
+
"paths": {
|
|
18
|
+
"@/*": ["./src/*"]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"include": ["src/**/*"],
|
|
22
|
+
"exclude": ["node_modules", "dist"]
|
|
23
|
+
}
|