@phila/phila-ui-button 0.0.1-beta.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 +113 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +24 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Phila Button Component
|
|
2
|
+
|
|
3
|
+
A simple, customizable Vue 3 button component built with TypeScript and Vite.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎨 Multiple variants: primary, secondary, outline, ghost
|
|
8
|
+
- 📏 Three sizes: small, medium, large
|
|
9
|
+
- ♿ Accessibility features: focus states, disabled state
|
|
10
|
+
- 🎯 TypeScript support with full type definitions
|
|
11
|
+
- 🎨 Modern, clean design with hover effects
|
|
12
|
+
- 📦 Tree-shakeable and lightweight
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @phila/phila-ui-button
|
|
18
|
+
# or
|
|
19
|
+
yarn add @phila/phila-ui-button
|
|
20
|
+
# or
|
|
21
|
+
pnpm add @phila/phila-ui-button
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```vue
|
|
27
|
+
<template>
|
|
28
|
+
<Button variant="primary" size="medium" @click="handleClick"> Click me! </Button>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import { Button } from "@phila/phila-ui-button";
|
|
33
|
+
|
|
34
|
+
const handleClick = () => {
|
|
35
|
+
console.log("Button clicked!");
|
|
36
|
+
};
|
|
37
|
+
</script>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
| Prop | Type | Default | Description |
|
|
43
|
+
| ---------- | -------------------------------------------------- | ----------- | ------------------------------ |
|
|
44
|
+
| `variant` | `'primary' \| 'secondary' \| 'outline' \| 'ghost'` | `'primary'` | The visual style variant |
|
|
45
|
+
| `size` | `'small' \| 'medium' \| 'large'` | `'medium'` | The button size |
|
|
46
|
+
| `disabled` | `boolean` | `false` | Whether the button is disabled |
|
|
47
|
+
|
|
48
|
+
## Events
|
|
49
|
+
|
|
50
|
+
| Event | Payload | Description |
|
|
51
|
+
| ------- | ------------ | ----------------------------------------------------------- |
|
|
52
|
+
| `click` | `MouseEvent` | Emitted when the button is clicked (only when not disabled) |
|
|
53
|
+
|
|
54
|
+
## Examples
|
|
55
|
+
|
|
56
|
+
### All Variants
|
|
57
|
+
|
|
58
|
+
```vue
|
|
59
|
+
<Button variant="primary">Primary</Button>
|
|
60
|
+
<Button variant="secondary">Secondary</Button>
|
|
61
|
+
<Button variant="outline">Outline</Button>
|
|
62
|
+
<Button variant="ghost">Ghost</Button>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### All Sizes
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<Button size="small">Small</Button>
|
|
69
|
+
<Button size="medium">Medium</Button>
|
|
70
|
+
<Button size="large">Large</Button>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Disabled State
|
|
74
|
+
|
|
75
|
+
```vue
|
|
76
|
+
<Button disabled>Disabled Button</Button>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### With Click Handler
|
|
80
|
+
|
|
81
|
+
```vue
|
|
82
|
+
<Button @click="handleClick">Click Me!</Button>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Development
|
|
86
|
+
|
|
87
|
+
### Install Dependencies
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pnpm install
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Run Demo
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pnpm dev
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Build Library
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pnpm build
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Type Check
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pnpm type-check
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
MIT
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),i=require("@phila/phila-ui-core"),r=["disabled"],u=e.defineComponent({__name:"PhlButton",props:{disabled:{type:Boolean,default:!1}},emits:["click"],setup(s,{emit:n}){const o=s,l=n,a=e.computed(()=>i.cn("phila-button",o.className)),c=t=>{o.disabled||l("click",t)};return(t,d)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(a.value),disabled:t.disabled,onClick:c},[e.renderSlot(t.$slots,"default")],10,r))}});exports.Button=u;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineComponent as c, computed as i, createElementBlock as r, openBlock as d, normalizeClass as m, renderSlot as u } from "vue";
|
|
2
|
+
import { cn as p } from "@phila/phila-ui-core";
|
|
3
|
+
const b = ["disabled"], h = /* @__PURE__ */ c({
|
|
4
|
+
__name: "PhlButton",
|
|
5
|
+
props: {
|
|
6
|
+
disabled: { type: Boolean, default: !1 }
|
|
7
|
+
},
|
|
8
|
+
emits: ["click"],
|
|
9
|
+
setup(o, { emit: s }) {
|
|
10
|
+
const t = o, n = s, l = i(() => p("phila-button", t.className)), a = (e) => {
|
|
11
|
+
t.disabled || n("click", e);
|
|
12
|
+
};
|
|
13
|
+
return (e, f) => (d(), r("button", {
|
|
14
|
+
class: m(l.value),
|
|
15
|
+
disabled: e.disabled,
|
|
16
|
+
onClick: a
|
|
17
|
+
}, [
|
|
18
|
+
u(e.$slots, "default")
|
|
19
|
+
], 10, b));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export {
|
|
23
|
+
h as Button
|
|
24
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@phila/phila-ui-button",
|
|
3
|
+
"version": "0.0.1-beta.0",
|
|
4
|
+
"description": "Button component for Phila UI library",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"keywords": [
|
|
19
|
+
"ui",
|
|
20
|
+
"button",
|
|
21
|
+
"vue",
|
|
22
|
+
"component"
|
|
23
|
+
],
|
|
24
|
+
"author": "",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"vue": "^3.0.0",
|
|
28
|
+
"@phila/phila-ui-core": "1.0.25-beta.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^24.0.0",
|
|
33
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
34
|
+
"eslint": "^9.0.0",
|
|
35
|
+
"typescript": "^5.8.3",
|
|
36
|
+
"vite": "^7.0.6",
|
|
37
|
+
"vite-plugin-dts": "^3.9.1",
|
|
38
|
+
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
39
|
+
"vue": "^3.5.18",
|
|
40
|
+
"vue-tsc": "^3.0.5"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "vite build",
|
|
44
|
+
"dev": "vite build --watch",
|
|
45
|
+
"lint": "eslint src/**/*.{ts,vue}",
|
|
46
|
+
"lint:fix": "eslint src/**/*.{ts,vue} --fix",
|
|
47
|
+
"type-check": "tsc --noEmit",
|
|
48
|
+
"clean": "rm -rf dist",
|
|
49
|
+
"format": "prettier --write .",
|
|
50
|
+
"format:check": "prettier --check ."
|
|
51
|
+
}
|
|
52
|
+
}
|