@pequity/squirrel 1.0.20-beta.2 → 1.0.20-beta.3
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/dist/cjs/chunks/_plugin-vue_export-helper.js +9 -1
- package/dist/cjs/chunks/p-action-bar.js +60 -1
- package/dist/cjs/chunks/p-card.js +28 -1
- package/dist/cjs/chunks/p-checkbox.js +24 -1
- package/dist/cjs/chunks/p-dropdown-select.js +414 -1
- package/dist/cjs/chunks/p-input-percent.js +53 -1
- package/dist/cjs/chunks/p-pagination-info.js +66 -1
- package/dist/cjs/chunks/p-pagination.js +122 -1
- package/dist/cjs/chunks/p-ring-loader.js +81 -1
- package/dist/cjs/chunks/p-select-btn.js +97 -1
- package/dist/cjs/chunks/p-select.js +123 -1
- package/dist/cjs/chunks/p-table-loader.js +70 -1
- package/dist/cjs/chunks/p-tabs.js +52 -1
- package/dist/cjs/config.js +105 -1
- package/dist/cjs/currency.js +9 -1
- package/dist/cjs/dom.js +27 -1
- package/dist/cjs/index.js +976 -1
- package/dist/cjs/inputClassesMixin.js +50 -1
- package/dist/cjs/inputClassesShared.js +76 -1
- package/dist/cjs/listKeyboardNavigation.js +110 -1
- package/dist/cjs/number.js +9 -1
- package/dist/cjs/object.js +4 -1
- package/dist/cjs/p-action-bar.js +3 -1
- package/dist/cjs/p-alert.js +65 -1
- package/dist/cjs/p-avatar.js +71 -1
- package/dist/cjs/p-btn.js +358 -2
- package/dist/cjs/p-card.js +3 -1
- package/dist/cjs/p-checkbox.js +3 -1
- package/dist/cjs/p-chips.js +110 -1
- package/dist/cjs/p-close-btn.js +36 -1
- package/dist/cjs/p-date-picker.js +139 -1
- package/dist/cjs/p-drawer.js +253 -1
- package/dist/cjs/p-dropdown-select.js +3 -1
- package/dist/cjs/p-dropdown.js +138 -1
- package/dist/cjs/p-file-upload.js +21 -1
- package/dist/cjs/p-info-icon.js +35 -1
- package/dist/cjs/p-inline-date-picker.js +142 -1
- package/dist/cjs/p-input-number.js +146 -1
- package/dist/cjs/p-input-percent.js +3 -1
- package/dist/cjs/p-input-search.js +110 -1
- package/dist/cjs/p-input.js +89 -1
- package/dist/cjs/p-loading.js +38 -1
- package/dist/cjs/p-modal.js +369 -1
- package/dist/cjs/p-pagination-info.js +3 -1
- package/dist/cjs/p-pagination.js +3 -1
- package/dist/cjs/p-progress-bar.js +41 -1
- package/dist/cjs/p-ring-loader.js +3 -1
- package/dist/cjs/p-select-btn.js +3 -1
- package/dist/cjs/p-select-list.js +4 -1
- package/dist/cjs/p-select-pill.js +111 -1
- package/dist/cjs/p-select.js +3 -1
- package/dist/cjs/p-skeleton-loader.js +73 -1
- package/dist/cjs/p-table-filter-icon.js +20 -1
- package/dist/cjs/p-table-header-cell.js +75 -1
- package/dist/cjs/p-table-loader.js +3 -1
- package/dist/cjs/p-table-sort.js +8 -1
- package/dist/cjs/p-table-td.js +88 -1
- package/dist/cjs/p-table.js +12 -1
- package/dist/cjs/p-tabs.js +3 -1
- package/dist/cjs/p-textarea.js +73 -1
- package/dist/cjs/p-toggle.js +114 -1
- package/dist/cjs/pagination.js +29 -1
- package/dist/cjs/string.js +12 -1
- package/dist/cjs/tailwind.js +4353 -1
- package/dist/cjs/text.js +16 -1
- package/dist/cjs/useInputClasses.js +44 -1
- package/dist/cjs/usePLoading.js +35 -1
- package/dist/cjs/usePModal.js +21 -1
- package/dist/cjs/usePTableColResize.js +81 -1
- package/dist/cjs/usePTableRowVirtualizer.js +31 -1
- package/dist/cjs/useSelectList.js +256 -1
- package/dist/es/chunks/_plugin-vue_export-helper.js +7 -6
- package/dist/es/chunks/p-action-bar.js +45 -36
- package/dist/es/chunks/p-card.js +18 -14
- package/dist/es/chunks/p-checkbox.js +14 -11
- package/dist/es/chunks/p-dropdown-select.js +232 -183
- package/dist/es/chunks/p-input-percent.js +34 -25
- package/dist/es/chunks/p-pagination-info.js +30 -24
- package/dist/es/chunks/p-pagination.js +78 -48
- package/dist/es/chunks/p-ring-loader.js +63 -40
- package/dist/es/chunks/p-select-btn.js +80 -59
- package/dist/es/chunks/p-select.js +81 -54
- package/dist/es/chunks/p-table-loader.js +46 -32
- package/dist/es/chunks/p-tabs.js +35 -29
- package/dist/es/config.js +2 -2
- package/dist/es/currency.js +3 -3
- package/dist/es/dom.js +24 -12
- package/dist/es/index.js +703 -561
- package/dist/es/inputClassesMixin.js +20 -14
- package/dist/es/inputClassesShared.js +60 -45
- package/dist/es/listKeyboardNavigation.js +86 -36
- package/dist/es/number.js +7 -2
- package/dist/es/object.js +2 -2
- package/dist/es/p-action-bar.js +2 -2
- package/dist/es/p-alert.js +35 -30
- package/dist/es/p-avatar.js +30 -27
- package/dist/es/p-btn.js +209 -164
- package/dist/es/p-card.js +2 -2
- package/dist/es/p-checkbox.js +2 -2
- package/dist/es/p-chips.js +60 -40
- package/dist/es/p-close-btn.js +20 -16
- package/dist/es/p-date-picker.js +66 -58
- package/dist/es/p-drawer.js +108 -89
- package/dist/es/p-dropdown-select.js +2 -2
- package/dist/es/p-dropdown.js +52 -33
- package/dist/es/p-file-upload.js +17 -9
- package/dist/es/p-info-icon.js +21 -16
- package/dist/es/p-inline-date-picker.js +64 -53
- package/dist/es/p-input-number.js +84 -66
- package/dist/es/p-input-percent.js +2 -2
- package/dist/es/p-input-search.js +43 -41
- package/dist/es/p-input.js +51 -45
- package/dist/es/p-loading.js +31 -22
- package/dist/es/p-modal.js +261 -174
- package/dist/es/p-pagination-info.js +2 -2
- package/dist/es/p-pagination.js +2 -2
- package/dist/es/p-progress-bar.js +26 -23
- package/dist/es/p-ring-loader.js +2 -2
- package/dist/es/p-select-btn.js +2 -2
- package/dist/es/p-select-list.js +2 -2
- package/dist/es/p-select-pill.js +58 -41
- package/dist/es/p-select.js +2 -2
- package/dist/es/p-skeleton-loader.js +34 -29
- package/dist/es/p-table-filter-icon.js +11 -11
- package/dist/es/p-table-header-cell.js +38 -33
- package/dist/es/p-table-loader.js +2 -2
- package/dist/es/p-table-sort.js +2 -2
- package/dist/es/p-table-td.js +76 -29
- package/dist/es/p-table.js +10 -6
- package/dist/es/p-tabs.js +2 -2
- package/dist/es/p-textarea.js +36 -34
- package/dist/es/p-toggle.js +53 -48
- package/dist/es/pagination.js +25 -8
- package/dist/es/string.js +10 -2
- package/dist/es/tailwind.js +1660 -1101
- package/dist/es/text.js +13 -8
- package/dist/es/useInputClasses.js +38 -22
- package/dist/es/usePLoading.js +31 -15
- package/dist/es/usePModal.js +15 -12
- package/dist/es/usePTableColResize.js +71 -39
- package/dist/es/usePTableRowVirtualizer.js +24 -15
- package/dist/es/useSelectList.js +234 -121
- package/dist/style.css +2124 -1
- package/package.json +1 -1
package/dist/es/p-btn.js
CHANGED
|
@@ -1,100 +1,124 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import { getColorDeep
|
|
3
|
-
import { defineComponent
|
|
4
|
-
import { _ as
|
|
1
|
+
import { _ as _sfc_main$1 } from "./chunks/p-ring-loader.js";
|
|
2
|
+
import { getColorDeep } from "./tailwind.js";
|
|
3
|
+
import { defineComponent, reactive, inject, computed, h, unref, getCurrentInstance, watchEffect, resolveComponent, openBlock, createElementBlock, mergeProps, renderSlot, createBlock, resolveDynamicComponent, withCtx, createElementVNode, normalizeClass, normalizeStyle, createCommentVNode } from "vue";
|
|
4
|
+
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
5
5
|
/*!
|
|
6
6
|
* vue-router v4.3.0
|
|
7
7
|
* (c) 2024 Eduardo San Martin Morote
|
|
8
8
|
* @license MIT
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const isBrowser = typeof document !== "undefined";
|
|
11
|
+
const noop = () => {
|
|
12
|
+
};
|
|
13
|
+
const isArray = Array.isArray;
|
|
14
|
+
function isSameRouteRecord(a, b) {
|
|
15
|
+
return (a.aliasOf || a) === (b.aliasOf || b);
|
|
14
16
|
}
|
|
15
|
-
function
|
|
16
|
-
if (Object.keys(
|
|
17
|
-
return
|
|
18
|
-
for (const
|
|
19
|
-
if (!
|
|
20
|
-
return
|
|
21
|
-
|
|
17
|
+
function isSameRouteLocationParams(a, b) {
|
|
18
|
+
if (Object.keys(a).length !== Object.keys(b).length)
|
|
19
|
+
return false;
|
|
20
|
+
for (const key in a) {
|
|
21
|
+
if (!isSameRouteLocationParamsValue(a[key], b[key]))
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
22
25
|
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
26
|
+
function isSameRouteLocationParamsValue(a, b) {
|
|
27
|
+
return isArray(a) ? isEquivalentArray(a, b) : isArray(b) ? isEquivalentArray(b, a) : a === b;
|
|
25
28
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
29
|
+
function isEquivalentArray(a, b) {
|
|
30
|
+
return isArray(b) ? a.length === b.length && a.every((value, i) => value === b[i]) : a.length === 1 && a[0] === b;
|
|
28
31
|
}
|
|
29
|
-
var
|
|
30
|
-
(function(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
var NavigationType;
|
|
33
|
+
(function(NavigationType2) {
|
|
34
|
+
NavigationType2["pop"] = "pop";
|
|
35
|
+
NavigationType2["push"] = "push";
|
|
36
|
+
})(NavigationType || (NavigationType = {}));
|
|
37
|
+
var NavigationDirection;
|
|
38
|
+
(function(NavigationDirection2) {
|
|
39
|
+
NavigationDirection2["back"] = "back";
|
|
40
|
+
NavigationDirection2["forward"] = "forward";
|
|
41
|
+
NavigationDirection2["unknown"] = "";
|
|
42
|
+
})(NavigationDirection || (NavigationDirection = {}));
|
|
37
43
|
Symbol(process.env.NODE_ENV !== "production" ? "navigation failure" : "");
|
|
38
|
-
var
|
|
39
|
-
(function(
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
var NavigationFailureType;
|
|
45
|
+
(function(NavigationFailureType2) {
|
|
46
|
+
NavigationFailureType2[NavigationFailureType2["aborted"] = 4] = "aborted";
|
|
47
|
+
NavigationFailureType2[NavigationFailureType2["cancelled"] = 8] = "cancelled";
|
|
48
|
+
NavigationFailureType2[NavigationFailureType2["duplicated"] = 16] = "duplicated";
|
|
49
|
+
})(NavigationFailureType || (NavigationFailureType = {}));
|
|
42
50
|
Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
|
|
43
51
|
Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
|
|
44
|
-
const
|
|
52
|
+
const routerKey = Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
|
|
53
|
+
const routeLocationKey = Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
|
|
45
54
|
Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
|
|
46
|
-
function
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
function useLink(props) {
|
|
56
|
+
const router = inject(routerKey);
|
|
57
|
+
const currentRoute = inject(routeLocationKey);
|
|
58
|
+
const route = computed(() => router.resolve(unref(props.to)));
|
|
59
|
+
const activeRecordIndex = computed(() => {
|
|
60
|
+
const { matched } = route.value;
|
|
61
|
+
const { length } = matched;
|
|
62
|
+
const routeMatched = matched[length - 1];
|
|
63
|
+
const currentMatched = currentRoute.matched;
|
|
64
|
+
if (!routeMatched || !currentMatched.length)
|
|
50
65
|
return -1;
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
-
return
|
|
54
|
-
const
|
|
66
|
+
const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
|
|
67
|
+
if (index > -1)
|
|
68
|
+
return index;
|
|
69
|
+
const parentRecordPath = getOriginalPath(matched[length - 2]);
|
|
55
70
|
return (
|
|
56
71
|
// we are dealing with nested routes
|
|
57
|
-
|
|
72
|
+
length > 1 && // if the parent and matched route have the same path, this link is
|
|
58
73
|
// referring to the empty child. Or we currently are on a different
|
|
59
74
|
// child of the same parent
|
|
60
|
-
|
|
61
|
-
|
|
75
|
+
getOriginalPath(routeMatched) === parentRecordPath && // avoid comparing the child with its parent
|
|
76
|
+
currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index
|
|
62
77
|
);
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
});
|
|
79
|
+
const isActive = computed(() => activeRecordIndex.value > -1 && includesParams(currentRoute.params, route.value.params));
|
|
80
|
+
const isExactActive = computed(() => activeRecordIndex.value > -1 && activeRecordIndex.value === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.value.params));
|
|
81
|
+
function navigate(e = {}) {
|
|
82
|
+
if (guardEvent(e)) {
|
|
83
|
+
return router[unref(props.replace) ? "replace" : "push"](
|
|
84
|
+
unref(props.to)
|
|
85
|
+
// avoid uncaught errors are they are logged anyway
|
|
86
|
+
).catch(noop);
|
|
87
|
+
}
|
|
88
|
+
return Promise.resolve();
|
|
69
89
|
}
|
|
70
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
route:
|
|
75
|
-
isActive:
|
|
76
|
-
isExactActive:
|
|
90
|
+
if ((process.env.NODE_ENV !== "production" || false) && isBrowser) {
|
|
91
|
+
const instance = getCurrentInstance();
|
|
92
|
+
if (instance) {
|
|
93
|
+
const linkContextDevtools = {
|
|
94
|
+
route: route.value,
|
|
95
|
+
isActive: isActive.value,
|
|
96
|
+
isExactActive: isExactActive.value
|
|
77
97
|
};
|
|
78
|
-
|
|
79
|
-
|
|
98
|
+
instance.__vrl_devtools = instance.__vrl_devtools || [];
|
|
99
|
+
instance.__vrl_devtools.push(linkContextDevtools);
|
|
100
|
+
watchEffect(() => {
|
|
101
|
+
linkContextDevtools.route = route.value;
|
|
102
|
+
linkContextDevtools.isActive = isActive.value;
|
|
103
|
+
linkContextDevtools.isExactActive = isExactActive.value;
|
|
80
104
|
}, { flush: "post" });
|
|
81
105
|
}
|
|
82
106
|
}
|
|
83
107
|
return {
|
|
84
|
-
route
|
|
85
|
-
href:
|
|
86
|
-
isActive
|
|
87
|
-
isExactActive
|
|
88
|
-
navigate
|
|
108
|
+
route,
|
|
109
|
+
href: computed(() => route.value.href),
|
|
110
|
+
isActive,
|
|
111
|
+
isExactActive,
|
|
112
|
+
navigate
|
|
89
113
|
};
|
|
90
114
|
}
|
|
91
|
-
const
|
|
115
|
+
const RouterLinkImpl = /* @__PURE__ */ defineComponent({
|
|
92
116
|
name: "RouterLink",
|
|
93
117
|
compatConfig: { MODE: 3 },
|
|
94
118
|
props: {
|
|
95
119
|
to: {
|
|
96
120
|
type: [String, Object],
|
|
97
|
-
required:
|
|
121
|
+
required: true
|
|
98
122
|
},
|
|
99
123
|
replace: Boolean,
|
|
100
124
|
activeClass: String,
|
|
@@ -106,55 +130,68 @@ const ee = /* @__PURE__ */ I({
|
|
|
106
130
|
default: "page"
|
|
107
131
|
}
|
|
108
132
|
},
|
|
109
|
-
useLink
|
|
110
|
-
setup(
|
|
111
|
-
const
|
|
112
|
-
|
|
133
|
+
useLink,
|
|
134
|
+
setup(props, { slots }) {
|
|
135
|
+
const link = reactive(useLink(props));
|
|
136
|
+
const { options } = inject(routerKey);
|
|
137
|
+
const elClass = computed(() => ({
|
|
138
|
+
[getLinkClass(props.activeClass, options.linkActiveClass, "router-link-active")]: link.isActive,
|
|
113
139
|
// [getLinkClass(
|
|
114
140
|
// props.inactiveClass,
|
|
115
141
|
// options.linkInactiveClass,
|
|
116
142
|
// 'router-link-inactive'
|
|
117
143
|
// )]: !link.isExactActive,
|
|
118
|
-
[
|
|
144
|
+
[getLinkClass(props.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive
|
|
119
145
|
}));
|
|
120
146
|
return () => {
|
|
121
|
-
const
|
|
122
|
-
return
|
|
123
|
-
"aria-current":
|
|
124
|
-
href:
|
|
147
|
+
const children = slots.default && slots.default(link);
|
|
148
|
+
return props.custom ? children : h("a", {
|
|
149
|
+
"aria-current": link.isExactActive ? props.ariaCurrentValue : null,
|
|
150
|
+
href: link.href,
|
|
125
151
|
// this would override user added attrs but Vue will still add
|
|
126
152
|
// the listener, so we end up triggering both
|
|
127
|
-
onClick:
|
|
128
|
-
class:
|
|
129
|
-
},
|
|
153
|
+
onClick: link.navigate,
|
|
154
|
+
class: elClass.value
|
|
155
|
+
}, children);
|
|
130
156
|
};
|
|
131
157
|
}
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return
|
|
158
|
+
});
|
|
159
|
+
const RouterLink = RouterLinkImpl;
|
|
160
|
+
function guardEvent(e) {
|
|
161
|
+
if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)
|
|
162
|
+
return;
|
|
163
|
+
if (e.defaultPrevented)
|
|
164
|
+
return;
|
|
165
|
+
if (e.button !== void 0 && e.button !== 0)
|
|
166
|
+
return;
|
|
167
|
+
if (e.currentTarget && e.currentTarget.getAttribute) {
|
|
168
|
+
const target = e.currentTarget.getAttribute("target");
|
|
169
|
+
if (/\b_blank\b/i.test(target))
|
|
170
|
+
return;
|
|
141
171
|
}
|
|
172
|
+
if (e.preventDefault)
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
return true;
|
|
142
175
|
}
|
|
143
|
-
function
|
|
144
|
-
for (const
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
176
|
+
function includesParams(outer, inner) {
|
|
177
|
+
for (const key in inner) {
|
|
178
|
+
const innerValue = inner[key];
|
|
179
|
+
const outerValue = outer[key];
|
|
180
|
+
if (typeof innerValue === "string") {
|
|
181
|
+
if (innerValue !== outerValue)
|
|
182
|
+
return false;
|
|
183
|
+
} else {
|
|
184
|
+
if (!isArray(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i) => value !== outerValue[i]))
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
151
187
|
}
|
|
152
|
-
return
|
|
188
|
+
return true;
|
|
153
189
|
}
|
|
154
|
-
function
|
|
155
|
-
return
|
|
190
|
+
function getOriginalPath(record) {
|
|
191
|
+
return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
|
|
156
192
|
}
|
|
157
|
-
const
|
|
193
|
+
const getLinkClass = (propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass;
|
|
194
|
+
const BUTTON_TYPES = {
|
|
158
195
|
PRIMARY: "primary",
|
|
159
196
|
SECONDARY: "secondary",
|
|
160
197
|
PRIMARY_OUTLINE: "primary-outline",
|
|
@@ -165,43 +202,50 @@ const k = (e, t, r) => e ?? t ?? r, n = {
|
|
|
165
202
|
PRIMARY_LINK: "primary-link",
|
|
166
203
|
SECONDARY_GHOST: "secondary-ghost",
|
|
167
204
|
SECONDARY_GHOST_DARK: "secondary-ghost-dark"
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
[
|
|
173
|
-
[
|
|
174
|
-
[
|
|
175
|
-
[
|
|
176
|
-
[
|
|
177
|
-
[
|
|
178
|
-
[
|
|
179
|
-
|
|
205
|
+
};
|
|
206
|
+
const BUTTON_NATIVE_TYPES = ["button", "submit", "reset"];
|
|
207
|
+
const DEFAULT_CLASSES = `relative inline-block outline-none disabled:opacity-50 disabled:cursor-default disabled:pointer-events-none`;
|
|
208
|
+
const BUTTON_CLASSES = {
|
|
209
|
+
[BUTTON_TYPES.PRIMARY]: "text-surface bg-primary hover:bg-accent active:bg-p-blue-80",
|
|
210
|
+
[BUTTON_TYPES.SECONDARY]: "bg-p-gray-20 hover:bg-p-gray-30 active:bg-p-gray-40",
|
|
211
|
+
[BUTTON_TYPES.PRIMARY_OUTLINE]: "text-p-purple-60 bg-p-blue-10 border border-p-purple-60 hover:bg-p-gray-20 focus:ring-1 focus:ring-p-purple-60",
|
|
212
|
+
[BUTTON_TYPES.SECONDARY_OUTLINE]: "text-p-purple-60 bg-surface border border-p-gray-30 hover:bg-p-blue-10 aria-selected:bg-p-blue-10",
|
|
213
|
+
[BUTTON_TYPES.SECONDARY_OUTLINE_BLUE]: "text-p-purple-60 bg-surface border border-p-gray-30 hover:bg-p-blue-10 aria-selected:bg-p-blue-15 aria-selected:text-p-blue-60",
|
|
214
|
+
[BUTTON_TYPES.ERROR]: "text-white bg-p-red-40 hover:bg-p-red-50",
|
|
215
|
+
[BUTTON_TYPES.SUCCESS]: "text-white bg-p-green-40 hover:bg-p-green-50",
|
|
216
|
+
[BUTTON_TYPES.PRIMARY_LINK]: "text-primary bg-transparent hover:text-accent underline",
|
|
217
|
+
[BUTTON_TYPES.SECONDARY_GHOST]: "text-on-surface hover:bg-p-gray-20",
|
|
218
|
+
[BUTTON_TYPES.SECONDARY_GHOST_DARK]: "text-white hover:bg-p-purple-50"
|
|
219
|
+
};
|
|
220
|
+
const BUTTON_SIZES = {
|
|
180
221
|
sm: "py-1 px-2 rounded font-medium text-sm",
|
|
181
222
|
md: "py-2 px-6 rounded font-medium text-base",
|
|
182
223
|
lg: "py-3 px-6 rounded font-medium text-lg"
|
|
183
|
-
}
|
|
224
|
+
};
|
|
225
|
+
const LOADER_SIZES = {
|
|
184
226
|
sm: 24,
|
|
185
227
|
md: 30,
|
|
186
228
|
lg: 40
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
[
|
|
190
|
-
[
|
|
191
|
-
[
|
|
192
|
-
[
|
|
193
|
-
[
|
|
194
|
-
[
|
|
195
|
-
[
|
|
196
|
-
[
|
|
197
|
-
[
|
|
198
|
-
|
|
229
|
+
};
|
|
230
|
+
const LOADER_COLORS = {
|
|
231
|
+
[BUTTON_TYPES.PRIMARY]: "p-blue-15",
|
|
232
|
+
[BUTTON_TYPES.SECONDARY]: "p-purple-60",
|
|
233
|
+
[BUTTON_TYPES.PRIMARY_OUTLINE]: "p-blue-60",
|
|
234
|
+
[BUTTON_TYPES.SECONDARY_OUTLINE]: "p-purple-60",
|
|
235
|
+
[BUTTON_TYPES.SECONDARY_OUTLINE_BLUE]: "p-purple-60",
|
|
236
|
+
[BUTTON_TYPES.ERROR]: "p-blue-15",
|
|
237
|
+
[BUTTON_TYPES.SUCCESS]: "p-blue-15",
|
|
238
|
+
[BUTTON_TYPES.PRIMARY_LINK]: "p-blue-60",
|
|
239
|
+
[BUTTON_TYPES.SECONDARY_GHOST]: "p-purple-60",
|
|
240
|
+
[BUTTON_TYPES.SECONDARY_GHOST_DARK]: "p-blue-15"
|
|
241
|
+
};
|
|
242
|
+
const _sfc_main = defineComponent({
|
|
199
243
|
name: "PBtn",
|
|
200
244
|
components: {
|
|
201
|
-
PRingLoader:
|
|
202
|
-
RouterLink
|
|
245
|
+
PRingLoader: _sfc_main$1,
|
|
246
|
+
RouterLink
|
|
203
247
|
},
|
|
204
|
-
inheritAttrs:
|
|
248
|
+
inheritAttrs: false,
|
|
205
249
|
props: {
|
|
206
250
|
/**
|
|
207
251
|
* The button style e.g primary, secondary, primary-outline, secondary-outline, error, success, primary-link
|
|
@@ -209,8 +253,8 @@ const k = (e, t, r) => e ?? t ?? r, n = {
|
|
|
209
253
|
type: {
|
|
210
254
|
type: String,
|
|
211
255
|
default: "primary",
|
|
212
|
-
validator(
|
|
213
|
-
return Object.values(
|
|
256
|
+
validator(value) {
|
|
257
|
+
return Object.values(BUTTON_TYPES).includes(value);
|
|
214
258
|
}
|
|
215
259
|
},
|
|
216
260
|
/**
|
|
@@ -219,8 +263,8 @@ const k = (e, t, r) => e ?? t ?? r, n = {
|
|
|
219
263
|
nativeType: {
|
|
220
264
|
type: String,
|
|
221
265
|
default: "button",
|
|
222
|
-
validator(
|
|
223
|
-
return
|
|
266
|
+
validator(value) {
|
|
267
|
+
return BUTTON_NATIVE_TYPES.includes(value);
|
|
224
268
|
}
|
|
225
269
|
},
|
|
226
270
|
/**
|
|
@@ -229,8 +273,8 @@ const k = (e, t, r) => e ?? t ?? r, n = {
|
|
|
229
273
|
size: {
|
|
230
274
|
type: String,
|
|
231
275
|
default: "md",
|
|
232
|
-
validator(
|
|
233
|
-
return Object.keys(
|
|
276
|
+
validator(value) {
|
|
277
|
+
return Object.keys(BUTTON_SIZES).includes(value);
|
|
234
278
|
}
|
|
235
279
|
},
|
|
236
280
|
/**
|
|
@@ -238,14 +282,14 @@ const k = (e, t, r) => e ?? t ?? r, n = {
|
|
|
238
282
|
*/
|
|
239
283
|
loading: {
|
|
240
284
|
type: Boolean,
|
|
241
|
-
default:
|
|
285
|
+
default: false
|
|
242
286
|
},
|
|
243
287
|
/**
|
|
244
288
|
* Whether the button is selected (sets aria-selected attribute)
|
|
245
289
|
*/
|
|
246
290
|
selected: {
|
|
247
291
|
type: Boolean,
|
|
248
|
-
default:
|
|
292
|
+
default: false
|
|
249
293
|
},
|
|
250
294
|
/**
|
|
251
295
|
* Exactly as the `to` prop in `RouterLink`, when used, it renders a link that triggers a navigation on click.
|
|
@@ -263,55 +307,56 @@ const k = (e, t, r) => e ?? t ?? r, n = {
|
|
|
263
307
|
},
|
|
264
308
|
computed: {
|
|
265
309
|
classes() {
|
|
266
|
-
return `${
|
|
310
|
+
return `${DEFAULT_CLASSES} ${BUTTON_SIZES[this.size]} ${BUTTON_CLASSES[this.type]}`;
|
|
267
311
|
},
|
|
268
312
|
loaderSize() {
|
|
269
|
-
return
|
|
313
|
+
return Number(`${LOADER_SIZES[this.size]}`);
|
|
270
314
|
},
|
|
271
315
|
loaderColor() {
|
|
272
|
-
const
|
|
273
|
-
return
|
|
316
|
+
const type = LOADER_COLORS[this.type];
|
|
317
|
+
return getColorDeep(type);
|
|
274
318
|
},
|
|
275
319
|
isExternalLink() {
|
|
276
|
-
return typeof this.to
|
|
320
|
+
return typeof this.to === "string" && this.to.startsWith("http");
|
|
277
321
|
}
|
|
278
322
|
}
|
|
279
|
-
})
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
323
|
+
});
|
|
324
|
+
const _hoisted_1 = ["href"];
|
|
325
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
326
|
+
const _component_PRingLoader = resolveComponent("PRingLoader");
|
|
327
|
+
return _ctx.isExternalLink ? (openBlock(), createElementBlock("a", mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
328
|
+
href: _ctx.to,
|
|
284
329
|
target: "_blank",
|
|
285
|
-
class:
|
|
330
|
+
class: _ctx.classes
|
|
286
331
|
}), [
|
|
287
|
-
|
|
288
|
-
], 16,
|
|
332
|
+
renderSlot(_ctx.$slots, "default")
|
|
333
|
+
], 16, _hoisted_1)) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.to ? "RouterLink" : "button"), mergeProps({
|
|
289
334
|
key: 1,
|
|
290
|
-
type:
|
|
291
|
-
to:
|
|
292
|
-
"aria-selected":
|
|
293
|
-
class:
|
|
294
|
-
},
|
|
295
|
-
disabled:
|
|
335
|
+
type: _ctx.to ? null : _ctx.nativeType,
|
|
336
|
+
to: _ctx.to ? _ctx.to : null,
|
|
337
|
+
"aria-selected": _ctx.selected,
|
|
338
|
+
class: _ctx.classes
|
|
339
|
+
}, _ctx.$attrs, {
|
|
340
|
+
disabled: _ctx.$attrs.disabled || _ctx.loading
|
|
296
341
|
}), {
|
|
297
|
-
default:
|
|
298
|
-
|
|
299
|
-
class:
|
|
342
|
+
default: withCtx(() => [
|
|
343
|
+
createElementVNode("div", {
|
|
344
|
+
class: normalizeClass({ invisible: _ctx.loading })
|
|
300
345
|
}, [
|
|
301
|
-
|
|
346
|
+
renderSlot(_ctx.$slots, "default")
|
|
302
347
|
], 2),
|
|
303
|
-
|
|
348
|
+
_ctx.loading ? (openBlock(), createBlock(_component_PRingLoader, {
|
|
304
349
|
key: 0,
|
|
305
|
-
style:
|
|
306
|
-
color:
|
|
307
|
-
size:
|
|
350
|
+
style: normalizeStyle(_ctx.loaderStyle),
|
|
351
|
+
color: _ctx.loaderColor,
|
|
352
|
+
size: _ctx.loaderSize,
|
|
308
353
|
class: "left-0 right-0 top-0 ml-auto mr-auto pt-1"
|
|
309
|
-
}, null, 8, ["style", "color", "size"])) :
|
|
354
|
+
}, null, 8, ["style", "color", "size"])) : createCommentVNode("", true)
|
|
310
355
|
]),
|
|
311
356
|
_: 3
|
|
312
357
|
}, 16, ["type", "to", "aria-selected", "class", "disabled"]));
|
|
313
358
|
}
|
|
314
|
-
const
|
|
359
|
+
const PBtn = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
315
360
|
export {
|
|
316
|
-
|
|
361
|
+
PBtn as default
|
|
317
362
|
};
|
package/dist/es/p-card.js
CHANGED
package/dist/es/p-checkbox.js
CHANGED