@phila/phila-ui-button 2.2.3 → 2.3.0-beta.9
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 +11 -20
- package/dist/index.js +1 -1
- package/dist/index.mjs +23 -30
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -65,18 +65,18 @@ const handleClick = () => {
|
|
|
65
65
|
```vue
|
|
66
66
|
<script setup lang="ts">
|
|
67
67
|
import { PhilaButton } from "@phila/phila-ui-button";
|
|
68
|
-
import {
|
|
68
|
+
import { IconPencil, IconArrowRight } from "@phila/phila-ui-core/icons";
|
|
69
69
|
</script>
|
|
70
70
|
|
|
71
71
|
<template>
|
|
72
72
|
<!-- Left Icon -->
|
|
73
|
-
<PhilaButton variant="primary" :icon="
|
|
73
|
+
<PhilaButton variant="primary" :icon="IconPencil" text="Edit" />
|
|
74
74
|
|
|
75
75
|
<!-- Right Icon -->
|
|
76
|
-
<PhilaButton variant="primary" :icon="
|
|
76
|
+
<PhilaButton variant="primary" :icon="IconArrowRight" icon-right text="Continue" />
|
|
77
77
|
|
|
78
78
|
<!-- Icon Only -->
|
|
79
|
-
<PhilaButton variant="primary" icon-only :icon="
|
|
79
|
+
<PhilaButton variant="primary" icon-only :icon="IconPencil" />
|
|
80
80
|
</template>
|
|
81
81
|
```
|
|
82
82
|
|
|
@@ -88,8 +88,7 @@ import { faPencil, faArrowRight } from "@fortawesome/pro-solid-svg-icons";
|
|
|
88
88
|
| `size` | `"extra-large" \| "large" \| "medium" \| "small" \| "extra-small"` | `"medium"` | Button size |
|
|
89
89
|
| `disabled` | `boolean` | `false` | Whether the button is disabled |
|
|
90
90
|
| `iconOnly` | `boolean` | `false` | Whether to display only an icon |
|
|
91
|
-
| `icon` | `
|
|
92
|
-
| `iconClass` | `string` | `undefined` | FontAwesome icon class name |
|
|
91
|
+
| `icon` | `IconComponent` | `undefined` | Icon component from `@phila/phila-ui-core/icons` |
|
|
93
92
|
| `iconRight` | `boolean` | `false` | Whether to position the icon on the right side |
|
|
94
93
|
| `text` | `string` | `undefined` | Button text (alternative to slot) |
|
|
95
94
|
| `className` | `string` | `undefined` | Additional CSS classes |
|
|
@@ -123,7 +122,7 @@ Buttons can also render as links by providing an `href` prop:
|
|
|
123
122
|
```vue
|
|
124
123
|
<script setup lang="ts">
|
|
125
124
|
import { PhilaButton } from "@phila/phila-ui-button";
|
|
126
|
-
import {
|
|
125
|
+
import { IconArrowRight } from "@phila/phila-ui-core/icons";
|
|
127
126
|
</script>
|
|
128
127
|
|
|
129
128
|
<template>
|
|
@@ -136,7 +135,7 @@ import { faArrowRight } from "@fortawesome/pro-solid-svg-icons";
|
|
|
136
135
|
target="_blank"
|
|
137
136
|
rel="noopener noreferrer"
|
|
138
137
|
text="Visit Site"
|
|
139
|
-
:icon="
|
|
138
|
+
:icon="IconArrowRight"
|
|
140
139
|
icon-right
|
|
141
140
|
/>
|
|
142
141
|
</template>
|
|
@@ -201,13 +200,9 @@ Note: Overflow text will not be truncated with ellipsis unless the button text i
|
|
|
201
200
|
|
|
202
201
|
### Text + Icon
|
|
203
202
|
|
|
204
|
-
Icons require manual installation of FontAwesome.
|
|
205
|
-
|
|
206
203
|
```vue
|
|
207
204
|
<button class="phila-button phila-button--primary">
|
|
208
|
-
<
|
|
209
|
-
<i class="fas fa-search"></i>
|
|
210
|
-
</span>
|
|
205
|
+
<i class="phila-icon phila-icon-magnifying-glass" aria-hidden="true"></i>
|
|
211
206
|
<span>Button text</span>
|
|
212
207
|
</button>
|
|
213
208
|
```
|
|
@@ -217,9 +212,7 @@ Icons require manual installation of FontAwesome.
|
|
|
217
212
|
```vue
|
|
218
213
|
<button class="phila-button phila-button--primary">
|
|
219
214
|
<span>Button text</span>
|
|
220
|
-
<
|
|
221
|
-
<i class="fas fa-search"></i>
|
|
222
|
-
</span>
|
|
215
|
+
<i class="phila-icon phila-icon-magnifying-glass" aria-hidden="true"></i>
|
|
223
216
|
</button>
|
|
224
217
|
```
|
|
225
218
|
|
|
@@ -228,10 +221,8 @@ Icons require manual installation of FontAwesome.
|
|
|
228
221
|
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`.
|
|
229
222
|
|
|
230
223
|
```vue
|
|
231
|
-
<button class="phila-button phila-button--primary icon-button">
|
|
232
|
-
<
|
|
233
|
-
<i class="fas fa-search"></i>
|
|
234
|
-
</span>
|
|
224
|
+
<button class="phila-button phila-button--primary icon-button" aria-label="Search">
|
|
225
|
+
<i class="phila-icon phila-icon-magnifying-glass" aria-hidden="true"></i>
|
|
235
226
|
</button>
|
|
236
227
|
```
|
|
237
228
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("@phila/phila-ui-core"),d=["disabled"],r=e.defineComponent({inheritAttrs:!1,__name:"PhlButton",props:{href:{},to:{},target:{},rel:{},disabled:{type:Boolean,default:!1},clickTarget:{},variant:{default:"primary"},size:{default:"medium"},iconOnly:{type:Boolean,default:!1},iconRight:{type:Boolean},text:{},className:{},
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("@phila/phila-ui-core"),d=require("@phila/phila-ui-core/icons"),u=["disabled"],r=e.defineComponent({inheritAttrs:!1,__name:"PhlButton",props:{href:{},to:{},target:{},rel:{},disabled:{type:Boolean,default:!1},clickTarget:{},variant:{default:"primary"},size:{default:"medium"},iconOnly:{type:Boolean,default:!1},iconRight:{type:Boolean},text:{},className:{},icon:{},src:{},svgRaw:{}},setup(n){const t=n,s=a=>"href"in a&&a.href!==void 0||"to"in a&&a.to!==void 0,l=e.computed(()=>o.cn("phila-button",`phila-button--${t.variant}`,t.size&&`is-${t.size}`,t.iconOnly&&"icon-button",t.iconOnly&&t.variant==="standard"&&"icon-button--standard",t.className)),c=e.computed(()=>s(t)?"to"in t&&t.to!==void 0?{to:t.to,disabled:t.disabled,className:l.value}:{href:t.href,target:t.target,rel:t.rel,disabled:t.disabled,className:l.value}:{}),i=e.computed(()=>({icon:t.icon,src:t.src,iconRight:t.iconRight,iconOnly:t.iconOnly,text:t.text,size:t.size}));return(a,b)=>s(t)?(e.openBlock(),e.createBlock(e.unref(o.BaseLink),e.mergeProps({key:0},{...c.value,...a.$attrs},{role:"button"}),{default:e.withCtx(()=>[e.createVNode(e.unref(o.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(a.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.text),1)])]),_:3},16)]),_:3},16)):(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:1,type:"button",disabled:t.disabled,class:l.value},a.$attrs),[e.createVNode(e.unref(o.ActionContent),e.normalizeProps(e.guardReactiveProps(i.value)),{default:e.withCtx(()=>[e.renderSlot(a.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.text),1)])]),_:3},16)],16,u))}}),f=e.defineComponent({inheritAttrs:!1,__name:"CloseButton",props:{className:{},disabled:{type:Boolean,default:!1},size:{default:"small"},ariaLabel:{default:"Close"}},setup(n){return(t,s)=>(e.openBlock(),e.createBlock(r,e.mergeProps({variant:"standard",icon:e.unref(d.IconClose),"icon-only":"",disabled:n.disabled,size:n.size,"class-name":e.unref(o.cn)("phila-close-button",n.className),"aria-label":n.ariaLabel},t.$attrs),null,16,["icon","disabled","size","class-name","aria-label"]))}});exports.CloseButton=f;exports.PhilaButton=r;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { defineComponent as y, computed as
|
|
1
|
+
import { defineComponent as y, computed as l, createBlock as B, createElementBlock as k, openBlock as r, unref as n, mergeProps as c, withCtx as i, createVNode as u, normalizeProps as f, guardReactiveProps as m, renderSlot as b, createTextVNode as h, toDisplayString as p } from "vue";
|
|
2
2
|
import { cn as g, BaseLink as C, ActionContent as v } from "@phila/phila-ui-core";
|
|
3
|
-
|
|
3
|
+
import { IconClose as N } from "@phila/phila-ui-core/icons";
|
|
4
|
+
const $ = ["disabled"], P = /* @__PURE__ */ y({
|
|
4
5
|
inheritAttrs: !1,
|
|
5
6
|
__name: "PhlButton",
|
|
6
7
|
props: {
|
|
@@ -16,33 +17,31 @@ const L = ["disabled"], N = /* @__PURE__ */ y({
|
|
|
16
17
|
iconRight: { type: Boolean },
|
|
17
18
|
text: {},
|
|
18
19
|
className: {},
|
|
19
|
-
|
|
20
|
-
iconClass: {},
|
|
20
|
+
icon: {},
|
|
21
21
|
src: {},
|
|
22
22
|
svgRaw: {}
|
|
23
23
|
},
|
|
24
24
|
setup(a) {
|
|
25
|
-
const e = a,
|
|
25
|
+
const e = a, s = (t) => "href" in t && t.href !== void 0 || "to" in t && t.to !== void 0, o = l(() => g(
|
|
26
26
|
"phila-button",
|
|
27
27
|
`phila-button--${e.variant}`,
|
|
28
28
|
e.size && `is-${e.size}`,
|
|
29
29
|
e.iconOnly && "icon-button",
|
|
30
30
|
e.iconOnly && e.variant === "standard" && "icon-button--standard",
|
|
31
31
|
e.className
|
|
32
|
-
)),
|
|
32
|
+
)), z = l(() => s(e) ? "to" in e && e.to !== void 0 ? {
|
|
33
33
|
to: e.to,
|
|
34
34
|
disabled: e.disabled,
|
|
35
|
-
className:
|
|
35
|
+
className: o.value
|
|
36
36
|
} : {
|
|
37
37
|
href: e.href,
|
|
38
38
|
target: e.target,
|
|
39
39
|
rel: e.rel,
|
|
40
40
|
disabled: e.disabled,
|
|
41
|
-
className:
|
|
42
|
-
} : {}), d =
|
|
41
|
+
className: o.value
|
|
42
|
+
} : {}), d = l(
|
|
43
43
|
() => ({
|
|
44
|
-
|
|
45
|
-
iconClass: e.iconClass,
|
|
44
|
+
icon: e.icon,
|
|
46
45
|
src: e.src,
|
|
47
46
|
iconRight: e.iconRight,
|
|
48
47
|
iconOnly: e.iconOnly,
|
|
@@ -50,10 +49,10 @@ const L = ["disabled"], N = /* @__PURE__ */ y({
|
|
|
50
49
|
size: e.size
|
|
51
50
|
})
|
|
52
51
|
);
|
|
53
|
-
return (t,
|
|
54
|
-
default:
|
|
52
|
+
return (t, _) => s(e) ? (r(), B(n(C), c({ key: 0 }, { ...z.value, ...t.$attrs }, { role: "button" }), {
|
|
53
|
+
default: i(() => [
|
|
55
54
|
u(n(v), f(m(d.value)), {
|
|
56
|
-
default:
|
|
55
|
+
default: i(() => [
|
|
57
56
|
b(t.$slots, "default", {}, () => [
|
|
58
57
|
h(p(e.text), 1)
|
|
59
58
|
])
|
|
@@ -62,29 +61,23 @@ const L = ["disabled"], N = /* @__PURE__ */ y({
|
|
|
62
61
|
}, 16)
|
|
63
62
|
]),
|
|
64
63
|
_: 3
|
|
65
|
-
}, 16)) : (r(),
|
|
64
|
+
}, 16)) : (r(), k("button", c({
|
|
66
65
|
key: 1,
|
|
67
66
|
type: "button",
|
|
68
67
|
disabled: e.disabled,
|
|
69
|
-
class:
|
|
68
|
+
class: o.value
|
|
70
69
|
}, t.$attrs), [
|
|
71
70
|
u(n(v), f(m(d.value)), {
|
|
72
|
-
default:
|
|
71
|
+
default: i(() => [
|
|
73
72
|
b(t.$slots, "default", {}, () => [
|
|
74
73
|
h(p(e.text), 1)
|
|
75
74
|
])
|
|
76
75
|
]),
|
|
77
76
|
_: 3
|
|
78
77
|
}, 16)
|
|
79
|
-
], 16,
|
|
78
|
+
], 16, $));
|
|
80
79
|
}
|
|
81
|
-
})
|
|
82
|
-
var $ = {
|
|
83
|
-
prefix: "fas",
|
|
84
|
-
iconName: "xmark",
|
|
85
|
-
icon: [384, 512, [128473, 10005, 10006, 10060, 215, "close", "multiply", "remove", "times"], "f00d", "M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]
|
|
86
|
-
};
|
|
87
|
-
const O = /* @__PURE__ */ y({
|
|
80
|
+
}), R = /* @__PURE__ */ y({
|
|
88
81
|
inheritAttrs: !1,
|
|
89
82
|
__name: "CloseButton",
|
|
90
83
|
props: {
|
|
@@ -94,18 +87,18 @@ const O = /* @__PURE__ */ y({
|
|
|
94
87
|
ariaLabel: { default: "Close" }
|
|
95
88
|
},
|
|
96
89
|
setup(a) {
|
|
97
|
-
return (e,
|
|
90
|
+
return (e, s) => (r(), B(P, c({
|
|
98
91
|
variant: "standard",
|
|
99
|
-
|
|
92
|
+
icon: n(N),
|
|
100
93
|
"icon-only": "",
|
|
101
94
|
disabled: a.disabled,
|
|
102
95
|
size: a.size,
|
|
103
96
|
"class-name": n(g)("phila-close-button", a.className),
|
|
104
97
|
"aria-label": a.ariaLabel
|
|
105
|
-
}, e.$attrs), null, 16, ["icon
|
|
98
|
+
}, e.$attrs), null, 16, ["icon", "disabled", "size", "class-name", "aria-label"]));
|
|
106
99
|
}
|
|
107
100
|
});
|
|
108
101
|
export {
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
R as CloseButton,
|
|
103
|
+
P as PhilaButton
|
|
111
104
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phila/phila-ui-button",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-beta.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Button component for Phila UI library",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@fortawesome/vue-fontawesome": "^3.1.2"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@phila/phila-ui-core": "
|
|
33
|
+
"@phila/phila-ui-core": "3.0.0-beta.8"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^24.0.0",
|