@phila/phila-ui-button 0.0.1-beta.0 → 1.0.0-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 +93 -41
- package/dist/index.js +1 -1
- package/dist/index.mjs +11 -16
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,85 +1,123 @@
|
|
|
1
1
|
# Phila Button Component
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Vue component in this package is for development purposes only. See installation & usage documentation for more details.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- 🎨 Multiple variants: primary, secondary,
|
|
8
|
-
-
|
|
7
|
+
- 🎨 Multiple variants: primary, secondary, destructive, standard (icon-button only)
|
|
8
|
+
- 🔄 Multiple Layouts: text, icon-text, text-icon, icon-button
|
|
9
|
+
- 📏 Four sizes: extra-small, small, medium, large, extra-large (icon-button only)
|
|
9
10
|
- ♿ 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
11
|
|
|
14
12
|
## Installation
|
|
15
13
|
|
|
14
|
+
Note: Button styles are included in the core package, so installation of the button vue component is optional.
|
|
15
|
+
|
|
16
16
|
```bash
|
|
17
|
+
npm install @phila/core
|
|
17
18
|
npm install @phila/phila-ui-button
|
|
18
19
|
# or
|
|
19
|
-
|
|
20
|
-
# or
|
|
20
|
+
pnpm add @phila/core
|
|
21
21
|
pnpm add @phila/phila-ui-button
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
Import core styles and other components in your main entry file (e.g., `main.js|ts`):
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import "@phila/core/styles/template-light.css";
|
|
28
|
+
```
|
|
29
|
+
|
|
24
30
|
## Usage
|
|
25
31
|
|
|
32
|
+
Use a button element with the appropriate classes. You can also apply those classes to links to style a link as a button.
|
|
33
|
+
|
|
26
34
|
```vue
|
|
27
35
|
<template>
|
|
28
|
-
<
|
|
36
|
+
<button class="phila-button phila-button--primary is-medium" @click="handleClick">Medium primary button</button>
|
|
37
|
+
|
|
38
|
+
<a class="phila-button phila-button--primary" href="#" @click.prevent="handleClick"> Link as a button </a>
|
|
29
39
|
</template>
|
|
30
40
|
|
|
31
41
|
<script setup lang="ts">
|
|
32
|
-
import { Button } from "@phila/phila-ui-button";
|
|
33
|
-
|
|
34
42
|
const handleClick = () => {
|
|
35
43
|
console.log("Button clicked!");
|
|
36
44
|
};
|
|
37
45
|
</script>
|
|
38
46
|
```
|
|
39
47
|
|
|
40
|
-
##
|
|
48
|
+
## Button Classes
|
|
49
|
+
|
|
50
|
+
The Phila UI button requires the `phila-button` class and one modifier class. You can apply the following modifier classes:
|
|
51
|
+
|
|
52
|
+
### Variants
|
|
53
|
+
|
|
54
|
+
- `phila-button--primary`
|
|
55
|
+
- `phila-button--secondary`
|
|
56
|
+
- `phila-button--destructive`
|
|
57
|
+
|
|
58
|
+
### Sizes
|
|
41
59
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
| `disabled` | `boolean` | `false` | Whether the button is disabled |
|
|
60
|
+
- `is-extra-small`
|
|
61
|
+
- `is-small`
|
|
62
|
+
- `is-medium`
|
|
63
|
+
- `is-large` (optional, large is default)
|
|
47
64
|
|
|
48
|
-
|
|
65
|
+
### States
|
|
49
66
|
|
|
50
|
-
|
|
51
|
-
| ------- | ------------ | ----------------------------------------------------------- |
|
|
52
|
-
| `click` | `MouseEvent` | Emitted when the button is clicked (only when not disabled) |
|
|
67
|
+
- Disabled: apply the `disabled` attribute to the button element.
|
|
53
68
|
|
|
54
|
-
##
|
|
69
|
+
## Button layouts
|
|
55
70
|
|
|
56
|
-
|
|
71
|
+
There are three main layouts for the Phila UI button:
|
|
72
|
+
|
|
73
|
+
1. **Text**: The default layout, displaying only text.
|
|
74
|
+
2. **Text + Icon**: Displays both text and an icon.
|
|
75
|
+
3. **Icon Button**: Displays only an icon.
|
|
76
|
+
|
|
77
|
+
### Text
|
|
57
78
|
|
|
58
79
|
```vue
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<Button variant="ghost">Ghost</Button>
|
|
80
|
+
<button class="phila-button phila-button--primary">
|
|
81
|
+
Button text
|
|
82
|
+
</button>
|
|
63
83
|
```
|
|
64
84
|
|
|
65
|
-
|
|
85
|
+
Note: Overflow text will not be truncated with ellipsis unless the button text is wrapped in a span.
|
|
86
|
+
|
|
87
|
+
### Text + Icon
|
|
88
|
+
|
|
89
|
+
Icons require manual installation of FontAwesome.
|
|
66
90
|
|
|
67
91
|
```vue
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
<
|
|
92
|
+
<button class="phila-button phila-button--primary">
|
|
93
|
+
<span class="icon">
|
|
94
|
+
<i class="fas fa-search"></i>
|
|
95
|
+
</span>
|
|
96
|
+
<span>Button text</span>
|
|
97
|
+
</button>
|
|
71
98
|
```
|
|
72
99
|
|
|
73
|
-
###
|
|
100
|
+
### Icon + Text
|
|
74
101
|
|
|
75
102
|
```vue
|
|
76
|
-
<
|
|
103
|
+
<button class="phila-button phila-button--primary">
|
|
104
|
+
<span>Button text</span>
|
|
105
|
+
<span class="icon">
|
|
106
|
+
<i class="fas fa-search"></i>
|
|
107
|
+
</span>
|
|
108
|
+
</button>
|
|
77
109
|
```
|
|
78
110
|
|
|
79
|
-
###
|
|
111
|
+
### Icon Button
|
|
112
|
+
|
|
113
|
+
Icon buttons require the `icon-button` class. The default size is "extra-large". For other sizes, include the appropriate size class. To use the "standard" variant, replace `phila-button--primary|secondary|destructive` with `icon-button--standard`.
|
|
80
114
|
|
|
81
115
|
```vue
|
|
82
|
-
<
|
|
116
|
+
<button class="phila-button phila-button--primary icon-button">
|
|
117
|
+
<span class="icon">
|
|
118
|
+
<i class="fas fa-search"></i>
|
|
119
|
+
</span>
|
|
120
|
+
</button>
|
|
83
121
|
```
|
|
84
122
|
|
|
85
123
|
## Development
|
|
@@ -90,24 +128,38 @@ const handleClick = () => {
|
|
|
90
128
|
pnpm install
|
|
91
129
|
```
|
|
92
130
|
|
|
93
|
-
### Run
|
|
131
|
+
### Run Storybook demo
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npm run storybook
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Run lint
|
|
94
138
|
|
|
95
139
|
```bash
|
|
96
|
-
|
|
140
|
+
npm run lint
|
|
97
141
|
```
|
|
98
142
|
|
|
99
|
-
### Build
|
|
143
|
+
### Create Production Build
|
|
100
144
|
|
|
101
145
|
```bash
|
|
102
|
-
|
|
146
|
+
npm run build
|
|
103
147
|
```
|
|
104
148
|
|
|
105
|
-
|
|
149
|
+
## Test locally in your development environment
|
|
106
150
|
|
|
107
151
|
```bash
|
|
108
|
-
|
|
152
|
+
npm pack
|
|
153
|
+
cp ./dist/*.tgz ~/path/to/your/local/npm/repo
|
|
154
|
+
cd ~/path/to/your/local/npm/repo
|
|
155
|
+
npm install *.tgz
|
|
156
|
+
|
|
109
157
|
```
|
|
110
158
|
|
|
159
|
+
## Publishing to NPM
|
|
160
|
+
|
|
161
|
+
Follow the [release instructions](../../RELEASE.md) using changesets.
|
|
162
|
+
|
|
111
163
|
## License
|
|
112
164
|
|
|
113
165
|
MIT
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=e.defineComponent({__name:"PhlButton",props:{disabled:{type:Boolean,default:!1}},setup(n){const o=n;return(l,t)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[t[0]||(t[0]=e.createElementVNode("h3",null,"Example button",-1)),e.createElementVNode("button",e.mergeProps({class:"phila-button"},o),[e.renderSlot(l.$slots,"default")],16)],64))}});exports.Button=r;
|
package/dist/index.mjs
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
|
|
3
|
-
const b = ["disabled"], h = /* @__PURE__ */ c({
|
|
1
|
+
import { defineComponent as r, createElementBlock as s, openBlock as a, Fragment as p, createElementVNode as t, mergeProps as u, renderSlot as m } from "vue";
|
|
2
|
+
const c = /* @__PURE__ */ r({
|
|
4
3
|
__name: "PhlButton",
|
|
5
4
|
props: {
|
|
6
5
|
disabled: { type: Boolean, default: !1 }
|
|
7
6
|
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
onClick: a
|
|
17
|
-
}, [
|
|
18
|
-
u(e.$slots, "default")
|
|
19
|
-
], 10, b));
|
|
7
|
+
setup(o) {
|
|
8
|
+
const n = o;
|
|
9
|
+
return (l, e) => (a(), s(p, null, [
|
|
10
|
+
e[0] || (e[0] = t("h3", null, "Example button", -1)),
|
|
11
|
+
t("button", u({ class: "phila-button" }, n), [
|
|
12
|
+
m(l.$slots, "default")
|
|
13
|
+
], 16)
|
|
14
|
+
], 64));
|
|
20
15
|
}
|
|
21
16
|
});
|
|
22
17
|
export {
|
|
23
|
-
|
|
18
|
+
c as Button
|
|
24
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phila/phila-ui-button",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
4
|
"description": "Button component for Phila UI library",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"vue": "^3.0.0",
|
|
28
|
-
"@phila/phila-ui-core": "
|
|
28
|
+
"@phila/phila-ui-core": "2.0.0-beta.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {},
|
|
31
31
|
"devDependencies": {
|