@pequity/squirrel 7.0.3 → 7.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 +1 -1
- package/dist/cjs/chunks/p-btn.js +22 -26
- package/dist/cjs/chunks/p-select-btn.js +1 -1
- package/dist/cjs/p-chips.js +2 -3
- package/dist/cjs/p-icon.js +2 -1
- package/dist/cjs/p-input-search.js +77 -89
- package/dist/es/chunks/p-btn.js +23 -27
- package/dist/es/chunks/p-select-btn.js +1 -1
- package/dist/es/p-chips.js +2 -3
- package/dist/es/p-icon.js +2 -1
- package/dist/es/p-input-search.js +77 -89
- package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +6 -6
- package/dist/squirrel/components/p-chips/p-chips.vue.d.ts +0 -2
- package/dist/squirrel/components/p-icon/p-icon.types.d.ts +1 -0
- package/dist/squirrel/components/p-input-search/p-input-search.vue.d.ts +11 -171
- package/dist/squirrel.css +10 -34
- package/package.json +23 -20
- package/squirrel/components/p-btn/p-btn.spec.js +33 -35
- package/squirrel/components/p-btn/p-btn.vue +24 -28
- package/squirrel/components/p-chips/p-chips.vue +0 -1
- package/squirrel/components/p-icon/p-icon.types.ts +1 -0
- package/squirrel/components/p-input-search/p-input-search.spec.js +3 -3
- package/squirrel/components/p-input-search/p-input-search.vue +50 -86
- package/squirrel/components/p-select-btn/p-select-btn.vue +1 -1
- package/squirrel/assets/magnifying-glass.svg +0 -10
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The library is built using [Vue 3](https://vuejs.org/) and [Tailwind CSS](https:
|
|
|
10
10
|
Install the package and its dependencies using `pnpm`:
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
pnpm i vue vue-router @pequity/squirrel @tanstack/vue-virtual @vuepic/vue-datepicker
|
|
13
|
+
pnpm i vue vue-router @pequity/squirrel @tanstack/vue-virtual @vuepic/vue-datepicker floating-vue lodash-es vue-currency-input vue-toastification@2.0.0-rc.5
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Install Tailwind CSS:
|
package/dist/cjs/chunks/p-btn.js
CHANGED
|
@@ -6,8 +6,7 @@ const pRingLoader_vue_vue_type_script_setup_true_lang = require("./p-ring-loader
|
|
|
6
6
|
const link = require("../link.js");
|
|
7
7
|
const sanitization = require("../sanitization.js");
|
|
8
8
|
const index = require("./index.js");
|
|
9
|
-
const _hoisted_1 =
|
|
10
|
-
const _hoisted_2 = { class: "slot-wrapper empty:hidden" };
|
|
9
|
+
const _hoisted_1 = { class: "slot-wrapper empty:hidden" };
|
|
11
10
|
const btnClasses = {
|
|
12
11
|
slots: {
|
|
13
12
|
button: "relative inline-block whitespace-nowrap rounded font-medium outline-none disabled:pointer-events-none disabled:cursor-default disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:cursor-default aria-disabled:opacity-50",
|
|
@@ -47,7 +46,7 @@ const btnClasses = {
|
|
|
47
46
|
sm: {
|
|
48
47
|
button: "px-3 has-[.slot-wrapper:empty]:px-1.5 py-1.5 text-sm leading-5",
|
|
49
48
|
content: "gap-1",
|
|
50
|
-
icon: "text-
|
|
49
|
+
icon: "text-base p-0.5"
|
|
51
50
|
},
|
|
52
51
|
md: {
|
|
53
52
|
button: "px-6 has-[.slot-wrapper:empty]:px-2.5 has-[.slot-wrapper:empty]:py-2.5 py-2 text-base",
|
|
@@ -72,8 +71,7 @@ const BUTTON_NATIVE_TYPES = ["button", "submit", "reset"];
|
|
|
72
71
|
const LOADER_SIZES = { sm: 24, md: 30, lg: 40 };
|
|
73
72
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
74
73
|
...{
|
|
75
|
-
name: "PBtn"
|
|
76
|
-
inheritAttrs: false
|
|
74
|
+
name: "PBtn"
|
|
77
75
|
},
|
|
78
76
|
__name: "p-btn",
|
|
79
77
|
props: {
|
|
@@ -142,6 +140,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
142
140
|
}
|
|
143
141
|
},
|
|
144
142
|
setup(__props) {
|
|
143
|
+
const attrs = vue.useAttrs();
|
|
145
144
|
const props = __props;
|
|
146
145
|
const classes = vue.computed(() => {
|
|
147
146
|
const { button, content, loader, icon } = btn({
|
|
@@ -150,27 +149,24 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
150
149
|
});
|
|
151
150
|
return { button: button(), content: content(), loader: loader(), icon: icon() };
|
|
152
151
|
});
|
|
153
|
-
const
|
|
154
|
-
|
|
152
|
+
const isExternal = vue.computed(() => link.isExternalLink(String(props.to)));
|
|
153
|
+
const btnAttrs = vue.computed(() => {
|
|
154
|
+
const res = {
|
|
155
|
+
target: isExternal.value ? "_blank" : null,
|
|
156
|
+
to: !isExternal.value && props.to ? props.to : null,
|
|
157
|
+
type: props.to ? null : props.nativeType,
|
|
158
|
+
disabled: attrs.disabled || props.loading ? "" : null,
|
|
159
|
+
"aria-selected": !isExternal.value ? props.selected : false,
|
|
160
|
+
"aria-disabled": attrs.disabled || props.loading
|
|
161
|
+
};
|
|
162
|
+
if (isExternal.value) {
|
|
163
|
+
res.href = sanitization.sanitizeUrl(String(props.to));
|
|
164
|
+
}
|
|
165
|
+
return res;
|
|
155
166
|
});
|
|
156
167
|
return (_ctx, _cache) => {
|
|
157
|
-
return
|
|
158
|
-
href: vue.unref(sanitization.sanitizeUrl)(__props.to),
|
|
159
|
-
target: "_blank",
|
|
160
|
-
class: classes.value.button,
|
|
161
|
-
disabled: !!_ctx.$attrs.disabled ? true : null,
|
|
162
|
-
"aria-disabled": !!_ctx.$attrs.disabled
|
|
163
|
-
}), [
|
|
164
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
165
|
-
], 16, _hoisted_1)) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(__props.to ? "RouterLink" : "button"), vue.mergeProps({
|
|
166
|
-
key: 1,
|
|
167
|
-
type: __props.to ? null : __props.nativeType,
|
|
168
|
-
to: __props.to ? __props.to : null,
|
|
169
|
-
"aria-selected": __props.selected,
|
|
168
|
+
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(isExternal.value ? "a" : __props.to ? "RouterLink" : "button"), vue.mergeProps(btnAttrs.value, {
|
|
170
169
|
class: classes.value.button
|
|
171
|
-
}, _ctx.$attrs, {
|
|
172
|
-
disabled: !!_ctx.$attrs.disabled || __props.loading ? true : null,
|
|
173
|
-
"aria-disabled": _ctx.$attrs.disabled
|
|
174
170
|
}), {
|
|
175
171
|
default: vue.withCtx(() => [
|
|
176
172
|
vue.createElementVNode("div", {
|
|
@@ -181,7 +177,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
181
177
|
icon: __props.icon,
|
|
182
178
|
class: vue.normalizeClass(classes.value.icon)
|
|
183
179
|
}, null, 8, ["icon", "class"])) : vue.createCommentVNode("", true),
|
|
184
|
-
vue.createElementVNode("span",
|
|
180
|
+
vue.createElementVNode("span", _hoisted_1, [
|
|
185
181
|
vue.renderSlot(_ctx.$slots, "default")
|
|
186
182
|
]),
|
|
187
183
|
__props.iconRight ? (vue.openBlock(), vue.createBlock(pIcon_vue_vue_type_script_setup_true_lang._sfc_main, {
|
|
@@ -192,12 +188,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
192
188
|
], 2),
|
|
193
189
|
__props.loading ? (vue.openBlock(), vue.createBlock(pRingLoader_vue_vue_type_script_setup_true_lang._sfc_main, {
|
|
194
190
|
key: 0,
|
|
195
|
-
size:
|
|
191
|
+
size: LOADER_SIZES[props.size],
|
|
196
192
|
class: vue.normalizeClass(classes.value.loader)
|
|
197
193
|
}, null, 8, ["size", "class"])) : vue.createCommentVNode("", true)
|
|
198
194
|
]),
|
|
199
195
|
_: 3
|
|
200
|
-
}, 16, ["
|
|
196
|
+
}, 16, ["class"]);
|
|
201
197
|
};
|
|
202
198
|
}
|
|
203
199
|
});
|
|
@@ -69,7 +69,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
69
69
|
size: _ctx.size,
|
|
70
70
|
type: "secondary-outline-blue",
|
|
71
71
|
disabled: item.disabled,
|
|
72
|
-
icon: String(item.icon),
|
|
72
|
+
icon: item.icon ? String(item.icon) : "",
|
|
73
73
|
class: vue.normalizeClass({
|
|
74
74
|
"rounded-none": index !== 0 && index !== _ctx.items.length - 1 && _ctx.items.length > 1,
|
|
75
75
|
"rounded-br-none rounded-tr-none": index === 0 && _ctx.items.length > 1,
|
package/dist/cjs/p-chips.js
CHANGED
|
@@ -7,8 +7,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
7
7
|
props: {
|
|
8
8
|
items: {
|
|
9
9
|
type: Array,
|
|
10
|
-
default: () => []
|
|
11
|
-
required: true
|
|
10
|
+
default: () => []
|
|
12
11
|
},
|
|
13
12
|
itemText: {
|
|
14
13
|
type: String,
|
|
@@ -104,5 +103,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
104
103
|
], 512)
|
|
105
104
|
], 512);
|
|
106
105
|
}
|
|
107
|
-
const pChips = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
106
|
+
const pChips = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-57d9f151"]]);
|
|
108
107
|
module.exports = pChips;
|
package/dist/cjs/p-icon.js
CHANGED
|
@@ -34,6 +34,7 @@ const P_ICON_ALIASES = {
|
|
|
34
34
|
refresh: "ri:loop-left-line",
|
|
35
35
|
download: "tdesign:download",
|
|
36
36
|
upload: "tdesign:upload",
|
|
37
|
-
info: "streamline:information-circle"
|
|
37
|
+
info: "streamline:information-circle",
|
|
38
|
+
search: "streamline:magnifying-glass-solid"
|
|
38
39
|
};
|
|
39
40
|
exports.P_ICON_ALIASES = P_ICON_ALIASES;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
const vue = require("vue");
|
|
2
3
|
const pBtn_types = require("./chunks/p-btn.types.js");
|
|
4
|
+
const pIcon_vue_vue_type_script_setup_true_lang = require("./chunks/p-icon.js");
|
|
3
5
|
const pInput_vue_vue_type_script_setup_true_lang = require("./chunks/p-input.js");
|
|
4
|
-
const vue = require("vue");
|
|
5
6
|
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
6
|
-
const _sfc_main = vue.defineComponent({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
8
|
+
...{
|
|
9
|
+
name: "PInputSearch",
|
|
10
|
+
inheritAttrs: false
|
|
10
11
|
},
|
|
11
|
-
|
|
12
|
-
props: {
|
|
13
|
-
modelValue: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: ""
|
|
16
|
-
},
|
|
12
|
+
__name: "p-input-search",
|
|
13
|
+
props: /* @__PURE__ */ vue.mergeModels({
|
|
17
14
|
size: {
|
|
18
15
|
type: String,
|
|
19
16
|
default: "md",
|
|
@@ -25,88 +22,79 @@ const _sfc_main = vue.defineComponent({
|
|
|
25
22
|
type: Boolean,
|
|
26
23
|
default: false
|
|
27
24
|
}
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
}, {
|
|
26
|
+
"modelValue": { default: "" },
|
|
27
|
+
"modelModifiers": {}
|
|
28
|
+
}),
|
|
29
|
+
emits: /* @__PURE__ */ vue.mergeModels(["enter"], ["update:modelValue"]),
|
|
30
|
+
setup(__props, { emit: __emit }) {
|
|
31
|
+
const searchIconClasses = {
|
|
32
|
+
sm: "text-xs top-2.5 left-2",
|
|
33
|
+
md: "text-base top-3 left-3",
|
|
34
|
+
lg: "text-lg top-4 left-5"
|
|
34
35
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
enterIconClasses() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return `clear clear-${this.size}`;
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
watch: {
|
|
48
|
-
modelValue(value) {
|
|
49
|
-
this.query = value;
|
|
50
|
-
},
|
|
51
|
-
query(value) {
|
|
52
|
-
this.$emit("update:modelValue", value);
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
methods: {
|
|
56
|
-
clearSearch() {
|
|
57
|
-
this.query = "";
|
|
36
|
+
const model = vue.useModel(__props, "modelValue");
|
|
37
|
+
const showEnterIconOnFocus = vue.ref(false);
|
|
38
|
+
const searchInput = vue.useTemplateRef("searchInput");
|
|
39
|
+
const emit = __emit;
|
|
40
|
+
const props = __props;
|
|
41
|
+
const enterIconClasses = vue.computed(() => `enter enter-${props.size}`);
|
|
42
|
+
const clearIconClasses = vue.computed(() => `clear clear-${props.size}`);
|
|
43
|
+
const clearSearch = () => {
|
|
44
|
+
model.value = "";
|
|
58
45
|
requestAnimationFrame(() => {
|
|
59
46
|
var _a;
|
|
60
|
-
(_a =
|
|
47
|
+
(_a = searchInput.value) == null ? void 0 : _a.$el.querySelector("input").focus();
|
|
61
48
|
});
|
|
62
|
-
}
|
|
63
|
-
keydownEnter() {
|
|
64
|
-
|
|
65
|
-
}
|
|
49
|
+
};
|
|
50
|
+
const keydownEnter = () => {
|
|
51
|
+
emit("enter", model.value);
|
|
52
|
+
};
|
|
53
|
+
return (_ctx, _cache) => {
|
|
54
|
+
const _directive_tooltip = vue.resolveDirective("tooltip");
|
|
55
|
+
return vue.openBlock(), vue.createBlock(pInput_vue_vue_type_script_setup_true_lang._sfc_main, vue.mergeProps({
|
|
56
|
+
ref_key: "searchInput",
|
|
57
|
+
ref: searchInput,
|
|
58
|
+
modelValue: model.value,
|
|
59
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
60
|
+
size: __props.size
|
|
61
|
+
}, _ctx.$attrs, {
|
|
62
|
+
role: "searchbox",
|
|
63
|
+
rounded: "",
|
|
64
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => showEnterIconOnFocus.value = true),
|
|
65
|
+
onFocusout: _cache[2] || (_cache[2] = ($event) => showEnterIconOnFocus.value = false),
|
|
66
|
+
onKeydown: vue.withKeys(keydownEnter, ["enter"])
|
|
67
|
+
}), {
|
|
68
|
+
prefix: vue.withCtx(() => [
|
|
69
|
+
vue.createVNode(pIcon_vue_vue_type_script_setup_true_lang._sfc_main, {
|
|
70
|
+
icon: "search",
|
|
71
|
+
class: vue.normalizeClass(["absolute text-p-gray-40", searchIconClasses[__props.size]])
|
|
72
|
+
}, null, 8, ["class"])
|
|
73
|
+
]),
|
|
74
|
+
suffix: vue.withCtx(() => [
|
|
75
|
+
model.value && __props.showEnterIcon && showEnterIconOnFocus.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("i", {
|
|
76
|
+
key: 0,
|
|
77
|
+
class: vue.normalizeClass(["icon absolute bg-no-repeat outline-none", enterIconClasses.value])
|
|
78
|
+
}, null, 2)), [
|
|
79
|
+
[
|
|
80
|
+
_directive_tooltip,
|
|
81
|
+
{ content: "Press enter to search", delay: { show: 100, hide: 0 } },
|
|
82
|
+
void 0,
|
|
83
|
+
{ bottom: true }
|
|
84
|
+
]
|
|
85
|
+
]) : vue.createCommentVNode("", true),
|
|
86
|
+
model.value ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
87
|
+
key: 1,
|
|
88
|
+
role: "button",
|
|
89
|
+
"aria-label": "Clear search input",
|
|
90
|
+
class: vue.normalizeClass(["icon absolute cursor-pointer bg-no-repeat", clearIconClasses.value]),
|
|
91
|
+
onClick: clearSearch
|
|
92
|
+
}, null, 2)) : vue.createCommentVNode("", true)
|
|
93
|
+
]),
|
|
94
|
+
_: 1
|
|
95
|
+
}, 16, ["modelValue", "size"]);
|
|
96
|
+
};
|
|
66
97
|
}
|
|
67
98
|
});
|
|
68
|
-
|
|
69
|
-
const _component_PInput = vue.resolveComponent("PInput");
|
|
70
|
-
const _directive_tooltip = vue.resolveDirective("tooltip");
|
|
71
|
-
return vue.openBlock(), vue.createBlock(_component_PInput, vue.mergeProps({
|
|
72
|
-
ref: "searchInput",
|
|
73
|
-
modelValue: _ctx.query,
|
|
74
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.query = $event),
|
|
75
|
-
size: _ctx.size
|
|
76
|
-
}, _ctx.$attrs, {
|
|
77
|
-
role: "searchbox",
|
|
78
|
-
rounded: "",
|
|
79
|
-
onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.showEnterIconOnFocus = true),
|
|
80
|
-
onFocusout: _cache[3] || (_cache[3] = ($event) => _ctx.showEnterIconOnFocus = false),
|
|
81
|
-
onKeydown: vue.withKeys(_ctx.keydownEnter, ["enter"])
|
|
82
|
-
}), {
|
|
83
|
-
prefix: vue.withCtx(() => [
|
|
84
|
-
vue.createElementVNode("i", {
|
|
85
|
-
class: vue.normalizeClass(["icon absolute bg-no-repeat outline-none", _ctx.searchIconClasses])
|
|
86
|
-
}, null, 2)
|
|
87
|
-
]),
|
|
88
|
-
suffix: vue.withCtx(() => [
|
|
89
|
-
_ctx.query && _ctx.showEnterIcon && _ctx.showEnterIconOnFocus ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("i", {
|
|
90
|
-
key: 0,
|
|
91
|
-
class: vue.normalizeClass(["icon absolute bg-no-repeat outline-none", _ctx.enterIconClasses])
|
|
92
|
-
}, null, 2)), [
|
|
93
|
-
[
|
|
94
|
-
_directive_tooltip,
|
|
95
|
-
{ content: "Press enter to search", delay: { show: 100, hide: 0 } },
|
|
96
|
-
void 0,
|
|
97
|
-
{ bottom: true }
|
|
98
|
-
]
|
|
99
|
-
]) : vue.createCommentVNode("", true),
|
|
100
|
-
_ctx.query ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
101
|
-
key: 1,
|
|
102
|
-
role: "button",
|
|
103
|
-
"aria-label": "Clear search input",
|
|
104
|
-
class: vue.normalizeClass(["icon absolute cursor-pointer bg-no-repeat", _ctx.clearIconClasses]),
|
|
105
|
-
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clearSearch && _ctx.clearSearch(...args))
|
|
106
|
-
}, null, 2)) : vue.createCommentVNode("", true)
|
|
107
|
-
]),
|
|
108
|
-
_: 1
|
|
109
|
-
}, 16, ["modelValue", "size", "onKeydown"]);
|
|
110
|
-
}
|
|
111
|
-
const PInputSearch = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-78b7a6f8"]]);
|
|
99
|
+
const PInputSearch = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-f50c12df"]]);
|
|
112
100
|
module.exports = PInputSearch;
|
package/dist/es/chunks/p-btn.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, useAttrs, computed, createBlock, openBlock, resolveDynamicComponent, mergeProps, withCtx, createElementVNode, createCommentVNode, normalizeClass, renderSlot } from "vue";
|
|
2
2
|
import { S as SIZES } from "./p-btn.types.js";
|
|
3
3
|
import { _ as _sfc_main$1 } from "./p-icon.js";
|
|
4
4
|
import { _ as _sfc_main$2 } from "./p-ring-loader.js";
|
|
5
5
|
import { isExternalLink } from "../link.js";
|
|
6
6
|
import { sanitizeUrl } from "../sanitization.js";
|
|
7
7
|
import { c as ce } from "./index.js";
|
|
8
|
-
const _hoisted_1 =
|
|
9
|
-
const _hoisted_2 = { class: "slot-wrapper empty:hidden" };
|
|
8
|
+
const _hoisted_1 = { class: "slot-wrapper empty:hidden" };
|
|
10
9
|
const btnClasses = {
|
|
11
10
|
slots: {
|
|
12
11
|
button: "relative inline-block whitespace-nowrap rounded font-medium outline-none disabled:pointer-events-none disabled:cursor-default disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:cursor-default aria-disabled:opacity-50",
|
|
@@ -46,7 +45,7 @@ const btnClasses = {
|
|
|
46
45
|
sm: {
|
|
47
46
|
button: "px-3 has-[.slot-wrapper:empty]:px-1.5 py-1.5 text-sm leading-5",
|
|
48
47
|
content: "gap-1",
|
|
49
|
-
icon: "text-
|
|
48
|
+
icon: "text-base p-0.5"
|
|
50
49
|
},
|
|
51
50
|
md: {
|
|
52
51
|
button: "px-6 has-[.slot-wrapper:empty]:px-2.5 has-[.slot-wrapper:empty]:py-2.5 py-2 text-base",
|
|
@@ -71,8 +70,7 @@ const BUTTON_NATIVE_TYPES = ["button", "submit", "reset"];
|
|
|
71
70
|
const LOADER_SIZES = { sm: 24, md: 30, lg: 40 };
|
|
72
71
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
73
72
|
...{
|
|
74
|
-
name: "PBtn"
|
|
75
|
-
inheritAttrs: false
|
|
73
|
+
name: "PBtn"
|
|
76
74
|
},
|
|
77
75
|
__name: "p-btn",
|
|
78
76
|
props: {
|
|
@@ -141,6 +139,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
141
139
|
}
|
|
142
140
|
},
|
|
143
141
|
setup(__props) {
|
|
142
|
+
const attrs = useAttrs();
|
|
144
143
|
const props = __props;
|
|
145
144
|
const classes = computed(() => {
|
|
146
145
|
const { button, content, loader, icon } = btn({
|
|
@@ -149,27 +148,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
149
148
|
});
|
|
150
149
|
return { button: button(), content: content(), loader: loader(), icon: icon() };
|
|
151
150
|
});
|
|
152
|
-
const
|
|
153
|
-
|
|
151
|
+
const isExternal = computed(() => isExternalLink(String(props.to)));
|
|
152
|
+
const btnAttrs = computed(() => {
|
|
153
|
+
const res = {
|
|
154
|
+
target: isExternal.value ? "_blank" : null,
|
|
155
|
+
to: !isExternal.value && props.to ? props.to : null,
|
|
156
|
+
type: props.to ? null : props.nativeType,
|
|
157
|
+
disabled: attrs.disabled || props.loading ? "" : null,
|
|
158
|
+
"aria-selected": !isExternal.value ? props.selected : false,
|
|
159
|
+
"aria-disabled": attrs.disabled || props.loading
|
|
160
|
+
};
|
|
161
|
+
if (isExternal.value) {
|
|
162
|
+
res.href = sanitizeUrl(String(props.to));
|
|
163
|
+
}
|
|
164
|
+
return res;
|
|
154
165
|
});
|
|
155
166
|
return (_ctx, _cache) => {
|
|
156
|
-
return
|
|
157
|
-
href: unref(sanitizeUrl)(__props.to),
|
|
158
|
-
target: "_blank",
|
|
159
|
-
class: classes.value.button,
|
|
160
|
-
disabled: !!_ctx.$attrs.disabled ? true : null,
|
|
161
|
-
"aria-disabled": !!_ctx.$attrs.disabled
|
|
162
|
-
}), [
|
|
163
|
-
renderSlot(_ctx.$slots, "default")
|
|
164
|
-
], 16, _hoisted_1)) : (openBlock(), createBlock(resolveDynamicComponent(__props.to ? "RouterLink" : "button"), mergeProps({
|
|
165
|
-
key: 1,
|
|
166
|
-
type: __props.to ? null : __props.nativeType,
|
|
167
|
-
to: __props.to ? __props.to : null,
|
|
168
|
-
"aria-selected": __props.selected,
|
|
167
|
+
return openBlock(), createBlock(resolveDynamicComponent(isExternal.value ? "a" : __props.to ? "RouterLink" : "button"), mergeProps(btnAttrs.value, {
|
|
169
168
|
class: classes.value.button
|
|
170
|
-
}, _ctx.$attrs, {
|
|
171
|
-
disabled: !!_ctx.$attrs.disabled || __props.loading ? true : null,
|
|
172
|
-
"aria-disabled": _ctx.$attrs.disabled
|
|
173
169
|
}), {
|
|
174
170
|
default: withCtx(() => [
|
|
175
171
|
createElementVNode("div", {
|
|
@@ -180,7 +176,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
180
176
|
icon: __props.icon,
|
|
181
177
|
class: normalizeClass(classes.value.icon)
|
|
182
178
|
}, null, 8, ["icon", "class"])) : createCommentVNode("", true),
|
|
183
|
-
createElementVNode("span",
|
|
179
|
+
createElementVNode("span", _hoisted_1, [
|
|
184
180
|
renderSlot(_ctx.$slots, "default")
|
|
185
181
|
]),
|
|
186
182
|
__props.iconRight ? (openBlock(), createBlock(_sfc_main$1, {
|
|
@@ -191,12 +187,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
191
187
|
], 2),
|
|
192
188
|
__props.loading ? (openBlock(), createBlock(_sfc_main$2, {
|
|
193
189
|
key: 0,
|
|
194
|
-
size:
|
|
190
|
+
size: LOADER_SIZES[props.size],
|
|
195
191
|
class: normalizeClass(classes.value.loader)
|
|
196
192
|
}, null, 8, ["size", "class"])) : createCommentVNode("", true)
|
|
197
193
|
]),
|
|
198
194
|
_: 3
|
|
199
|
-
}, 16, ["
|
|
195
|
+
}, 16, ["class"]);
|
|
200
196
|
};
|
|
201
197
|
}
|
|
202
198
|
});
|
|
@@ -68,7 +68,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
68
68
|
size: _ctx.size,
|
|
69
69
|
type: "secondary-outline-blue",
|
|
70
70
|
disabled: item.disabled,
|
|
71
|
-
icon: String(item.icon),
|
|
71
|
+
icon: item.icon ? String(item.icon) : "",
|
|
72
72
|
class: normalizeClass({
|
|
73
73
|
"rounded-none": index !== 0 && index !== _ctx.items.length - 1 && _ctx.items.length > 1,
|
|
74
74
|
"rounded-br-none rounded-tr-none": index === 0 && _ctx.items.length > 1,
|
package/dist/es/p-chips.js
CHANGED
|
@@ -6,8 +6,7 @@ const _sfc_main = defineComponent({
|
|
|
6
6
|
props: {
|
|
7
7
|
items: {
|
|
8
8
|
type: Array,
|
|
9
|
-
default: () => []
|
|
10
|
-
required: true
|
|
9
|
+
default: () => []
|
|
11
10
|
},
|
|
12
11
|
itemText: {
|
|
13
12
|
type: String,
|
|
@@ -103,7 +102,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
103
102
|
], 512)
|
|
104
103
|
], 512);
|
|
105
104
|
}
|
|
106
|
-
const pChips = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
105
|
+
const pChips = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-57d9f151"]]);
|
|
107
106
|
export {
|
|
108
107
|
pChips as default
|
|
109
108
|
};
|
package/dist/es/p-icon.js
CHANGED
|
@@ -32,7 +32,8 @@ const P_ICON_ALIASES = {
|
|
|
32
32
|
refresh: "ri:loop-left-line",
|
|
33
33
|
download: "tdesign:download",
|
|
34
34
|
upload: "tdesign:upload",
|
|
35
|
-
info: "streamline:information-circle"
|
|
35
|
+
info: "streamline:information-circle",
|
|
36
|
+
search: "streamline:magnifying-glass-solid"
|
|
36
37
|
};
|
|
37
38
|
export {
|
|
38
39
|
P_ICON_ALIASES
|