@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.
Files changed (144) hide show
  1. package/dist/cjs/chunks/_plugin-vue_export-helper.js +9 -1
  2. package/dist/cjs/chunks/p-action-bar.js +60 -1
  3. package/dist/cjs/chunks/p-card.js +28 -1
  4. package/dist/cjs/chunks/p-checkbox.js +24 -1
  5. package/dist/cjs/chunks/p-dropdown-select.js +414 -1
  6. package/dist/cjs/chunks/p-input-percent.js +53 -1
  7. package/dist/cjs/chunks/p-pagination-info.js +66 -1
  8. package/dist/cjs/chunks/p-pagination.js +122 -1
  9. package/dist/cjs/chunks/p-ring-loader.js +81 -1
  10. package/dist/cjs/chunks/p-select-btn.js +97 -1
  11. package/dist/cjs/chunks/p-select.js +123 -1
  12. package/dist/cjs/chunks/p-table-loader.js +70 -1
  13. package/dist/cjs/chunks/p-tabs.js +52 -1
  14. package/dist/cjs/config.js +105 -1
  15. package/dist/cjs/currency.js +9 -1
  16. package/dist/cjs/dom.js +27 -1
  17. package/dist/cjs/index.js +976 -1
  18. package/dist/cjs/inputClassesMixin.js +50 -1
  19. package/dist/cjs/inputClassesShared.js +76 -1
  20. package/dist/cjs/listKeyboardNavigation.js +110 -1
  21. package/dist/cjs/number.js +9 -1
  22. package/dist/cjs/object.js +4 -1
  23. package/dist/cjs/p-action-bar.js +3 -1
  24. package/dist/cjs/p-alert.js +65 -1
  25. package/dist/cjs/p-avatar.js +71 -1
  26. package/dist/cjs/p-btn.js +358 -2
  27. package/dist/cjs/p-card.js +3 -1
  28. package/dist/cjs/p-checkbox.js +3 -1
  29. package/dist/cjs/p-chips.js +110 -1
  30. package/dist/cjs/p-close-btn.js +36 -1
  31. package/dist/cjs/p-date-picker.js +139 -1
  32. package/dist/cjs/p-drawer.js +253 -1
  33. package/dist/cjs/p-dropdown-select.js +3 -1
  34. package/dist/cjs/p-dropdown.js +138 -1
  35. package/dist/cjs/p-file-upload.js +21 -1
  36. package/dist/cjs/p-info-icon.js +35 -1
  37. package/dist/cjs/p-inline-date-picker.js +142 -1
  38. package/dist/cjs/p-input-number.js +146 -1
  39. package/dist/cjs/p-input-percent.js +3 -1
  40. package/dist/cjs/p-input-search.js +110 -1
  41. package/dist/cjs/p-input.js +89 -1
  42. package/dist/cjs/p-loading.js +38 -1
  43. package/dist/cjs/p-modal.js +369 -1
  44. package/dist/cjs/p-pagination-info.js +3 -1
  45. package/dist/cjs/p-pagination.js +3 -1
  46. package/dist/cjs/p-progress-bar.js +41 -1
  47. package/dist/cjs/p-ring-loader.js +3 -1
  48. package/dist/cjs/p-select-btn.js +3 -1
  49. package/dist/cjs/p-select-list.js +4 -1
  50. package/dist/cjs/p-select-pill.js +111 -1
  51. package/dist/cjs/p-select.js +3 -1
  52. package/dist/cjs/p-skeleton-loader.js +73 -1
  53. package/dist/cjs/p-table-filter-icon.js +20 -1
  54. package/dist/cjs/p-table-header-cell.js +75 -1
  55. package/dist/cjs/p-table-loader.js +3 -1
  56. package/dist/cjs/p-table-sort.js +8 -1
  57. package/dist/cjs/p-table-td.js +88 -1
  58. package/dist/cjs/p-table.js +12 -1
  59. package/dist/cjs/p-tabs.js +3 -1
  60. package/dist/cjs/p-textarea.js +73 -1
  61. package/dist/cjs/p-toggle.js +114 -1
  62. package/dist/cjs/pagination.js +29 -1
  63. package/dist/cjs/string.js +12 -1
  64. package/dist/cjs/tailwind.js +4353 -1
  65. package/dist/cjs/text.js +16 -1
  66. package/dist/cjs/useInputClasses.js +44 -1
  67. package/dist/cjs/usePLoading.js +35 -1
  68. package/dist/cjs/usePModal.js +21 -1
  69. package/dist/cjs/usePTableColResize.js +81 -1
  70. package/dist/cjs/usePTableRowVirtualizer.js +31 -1
  71. package/dist/cjs/useSelectList.js +256 -1
  72. package/dist/es/chunks/_plugin-vue_export-helper.js +7 -6
  73. package/dist/es/chunks/p-action-bar.js +45 -36
  74. package/dist/es/chunks/p-card.js +18 -14
  75. package/dist/es/chunks/p-checkbox.js +14 -11
  76. package/dist/es/chunks/p-dropdown-select.js +232 -183
  77. package/dist/es/chunks/p-input-percent.js +34 -25
  78. package/dist/es/chunks/p-pagination-info.js +30 -24
  79. package/dist/es/chunks/p-pagination.js +78 -48
  80. package/dist/es/chunks/p-ring-loader.js +63 -40
  81. package/dist/es/chunks/p-select-btn.js +80 -59
  82. package/dist/es/chunks/p-select.js +81 -54
  83. package/dist/es/chunks/p-table-loader.js +46 -32
  84. package/dist/es/chunks/p-tabs.js +35 -29
  85. package/dist/es/config.js +2 -2
  86. package/dist/es/currency.js +3 -3
  87. package/dist/es/dom.js +24 -12
  88. package/dist/es/index.js +703 -561
  89. package/dist/es/inputClassesMixin.js +20 -14
  90. package/dist/es/inputClassesShared.js +60 -45
  91. package/dist/es/listKeyboardNavigation.js +86 -36
  92. package/dist/es/number.js +7 -2
  93. package/dist/es/object.js +2 -2
  94. package/dist/es/p-action-bar.js +2 -2
  95. package/dist/es/p-alert.js +35 -30
  96. package/dist/es/p-avatar.js +30 -27
  97. package/dist/es/p-btn.js +209 -164
  98. package/dist/es/p-card.js +2 -2
  99. package/dist/es/p-checkbox.js +2 -2
  100. package/dist/es/p-chips.js +60 -40
  101. package/dist/es/p-close-btn.js +20 -16
  102. package/dist/es/p-date-picker.js +66 -58
  103. package/dist/es/p-drawer.js +108 -89
  104. package/dist/es/p-dropdown-select.js +2 -2
  105. package/dist/es/p-dropdown.js +52 -33
  106. package/dist/es/p-file-upload.js +17 -9
  107. package/dist/es/p-info-icon.js +21 -16
  108. package/dist/es/p-inline-date-picker.js +64 -53
  109. package/dist/es/p-input-number.js +84 -66
  110. package/dist/es/p-input-percent.js +2 -2
  111. package/dist/es/p-input-search.js +43 -41
  112. package/dist/es/p-input.js +51 -45
  113. package/dist/es/p-loading.js +31 -22
  114. package/dist/es/p-modal.js +261 -174
  115. package/dist/es/p-pagination-info.js +2 -2
  116. package/dist/es/p-pagination.js +2 -2
  117. package/dist/es/p-progress-bar.js +26 -23
  118. package/dist/es/p-ring-loader.js +2 -2
  119. package/dist/es/p-select-btn.js +2 -2
  120. package/dist/es/p-select-list.js +2 -2
  121. package/dist/es/p-select-pill.js +58 -41
  122. package/dist/es/p-select.js +2 -2
  123. package/dist/es/p-skeleton-loader.js +34 -29
  124. package/dist/es/p-table-filter-icon.js +11 -11
  125. package/dist/es/p-table-header-cell.js +38 -33
  126. package/dist/es/p-table-loader.js +2 -2
  127. package/dist/es/p-table-sort.js +2 -2
  128. package/dist/es/p-table-td.js +76 -29
  129. package/dist/es/p-table.js +10 -6
  130. package/dist/es/p-tabs.js +2 -2
  131. package/dist/es/p-textarea.js +36 -34
  132. package/dist/es/p-toggle.js +53 -48
  133. package/dist/es/pagination.js +25 -8
  134. package/dist/es/string.js +10 -2
  135. package/dist/es/tailwind.js +1660 -1101
  136. package/dist/es/text.js +13 -8
  137. package/dist/es/useInputClasses.js +38 -22
  138. package/dist/es/usePLoading.js +31 -15
  139. package/dist/es/usePModal.js +15 -12
  140. package/dist/es/usePTableColResize.js +71 -39
  141. package/dist/es/usePTableRowVirtualizer.js +24 -15
  142. package/dist/es/useSelectList.js +234 -121
  143. package/dist/style.css +2124 -1
  144. package/package.json +1 -1
package/dist/es/p-btn.js CHANGED
@@ -1,100 +1,124 @@
1
- import { _ as P } from "./chunks/p-ring-loader.js";
2
- import { getColorDeep as U } from "./tailwind.js";
3
- import { defineComponent as I, reactive as B, inject as b, computed as c, h as x, unref as g, getCurrentInstance as V, watchEffect as $, resolveComponent as w, openBlock as m, createElementBlock as K, mergeProps as y, renderSlot as h, createBlock as S, resolveDynamicComponent as M, withCtx as z, createElementVNode as j, normalizeClass as G, normalizeStyle as H, createCommentVNode as q } from "vue";
4
- import { _ as Z } from "./chunks/_plugin-vue_export-helper.js";
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 W = typeof document < "u", J = () => {
11
- }, d = Array.isArray;
12
- function R(e, t) {
13
- return (e.aliasOf || e) === (t.aliasOf || t);
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 Q(e, t) {
16
- if (Object.keys(e).length !== Object.keys(t).length)
17
- return !1;
18
- for (const r in e)
19
- if (!X(e[r], t[r]))
20
- return !1;
21
- return !0;
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 X(e, t) {
24
- return d(e) ? O(e, t) : d(t) ? O(t, e) : e === t;
26
+ function isSameRouteLocationParamsValue(a, b) {
27
+ return isArray(a) ? isEquivalentArray(a, b) : isArray(b) ? isEquivalentArray(b, a) : a === b;
25
28
  }
26
- function O(e, t) {
27
- return d(t) ? e.length === t.length && e.every((r, o) => r === t[o]) : e.length === 1 && e[0] === t;
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 A;
30
- (function(e) {
31
- e.pop = "pop", e.push = "push";
32
- })(A || (A = {}));
33
- var _;
34
- (function(e) {
35
- e.back = "back", e.forward = "forward", e.unknown = "";
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 C;
39
- (function(e) {
40
- e[e.aborted = 4] = "aborted", e[e.cancelled = 8] = "cancelled", e[e.duplicated = 16] = "duplicated";
41
- })(C || (C = {}));
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 T = Symbol(process.env.NODE_ENV !== "production" ? "router" : ""), F = Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
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 N(e) {
47
- const t = b(T), r = b(F), o = c(() => t.resolve(g(e.to))), a = c(() => {
48
- const { matched: s } = o.value, { length: i } = s, f = s[i - 1], p = r.matched;
49
- if (!f || !p.length)
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 v = p.findIndex(R.bind(null, f));
52
- if (v > -1)
53
- return v;
54
- const E = L(s[i - 2]);
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
- i > 1 && // if the parent and matched route have the same path, this link is
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
- L(f) === E && // avoid comparing the child with its parent
61
- p[p.length - 1].path !== E ? p.findIndex(R.bind(null, s[i - 2])) : v
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
- }), l = c(() => a.value > -1 && ne(r.params, o.value.params)), u = c(() => a.value > -1 && a.value === r.matched.length - 1 && Q(r.params, o.value.params));
64
- function Y(s = {}) {
65
- return re(s) ? t[g(e.replace) ? "replace" : "push"](
66
- g(e.to)
67
- // avoid uncaught errors are they are logged anyway
68
- ).catch(J) : Promise.resolve();
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" && W) {
71
- const s = V();
72
- if (s) {
73
- const i = {
74
- route: o.value,
75
- isActive: l.value,
76
- isExactActive: u.value
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
- s.__vrl_devtools = s.__vrl_devtools || [], s.__vrl_devtools.push(i), $(() => {
79
- i.route = o.value, i.isActive = l.value, i.isExactActive = u.value;
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: o,
85
- href: c(() => o.value.href),
86
- isActive: l,
87
- isExactActive: u,
88
- navigate: Y
108
+ route,
109
+ href: computed(() => route.value.href),
110
+ isActive,
111
+ isExactActive,
112
+ navigate
89
113
  };
90
114
  }
91
- const ee = /* @__PURE__ */ I({
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: !0
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: N,
110
- setup(e, { slots: t }) {
111
- const r = B(N(e)), { options: o } = b(T), a = c(() => ({
112
- [k(e.activeClass, o.linkActiveClass, "router-link-active")]: r.isActive,
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
- [k(e.exactActiveClass, o.linkExactActiveClass, "router-link-exact-active")]: r.isExactActive
144
+ [getLinkClass(props.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive
119
145
  }));
120
146
  return () => {
121
- const l = t.default && t.default(r);
122
- return e.custom ? l : x("a", {
123
- "aria-current": r.isExactActive ? e.ariaCurrentValue : null,
124
- href: r.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: r.navigate,
128
- class: a.value
129
- }, l);
153
+ onClick: link.navigate,
154
+ class: elClass.value
155
+ }, children);
130
156
  };
131
157
  }
132
- }), te = ee;
133
- function re(e) {
134
- if (!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && !e.defaultPrevented && !(e.button !== void 0 && e.button !== 0)) {
135
- if (e.currentTarget && e.currentTarget.getAttribute) {
136
- const t = e.currentTarget.getAttribute("target");
137
- if (/\b_blank\b/i.test(t))
138
- return;
139
- }
140
- return e.preventDefault && e.preventDefault(), !0;
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 ne(e, t) {
144
- for (const r in t) {
145
- const o = t[r], a = e[r];
146
- if (typeof o == "string") {
147
- if (o !== a)
148
- return !1;
149
- } else if (!d(a) || a.length !== o.length || o.some((l, u) => l !== a[u]))
150
- return !1;
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 !0;
188
+ return true;
153
189
  }
154
- function L(e) {
155
- return e ? e.aliasOf ? e.aliasOf.path : e.path : "";
190
+ function getOriginalPath(record) {
191
+ return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
156
192
  }
157
- const k = (e, t, r) => e ?? t ?? r, n = {
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
- }, oe = ["button", "submit", "reset"], ae = "relative inline-block outline-none disabled:opacity-50 disabled:cursor-default disabled:pointer-events-none", se = {
169
- [n.PRIMARY]: "text-surface bg-primary hover:bg-accent active:bg-p-blue-80",
170
- [n.SECONDARY]: "bg-p-gray-20 hover:bg-p-gray-30 active:bg-p-gray-40",
171
- [n.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",
172
- [n.SECONDARY_OUTLINE]: "text-p-purple-60 bg-surface border border-p-gray-30 hover:bg-p-blue-10 aria-selected:bg-p-blue-10",
173
- [n.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",
174
- [n.ERROR]: "text-white bg-p-red-40 hover:bg-p-red-50",
175
- [n.SUCCESS]: "text-white bg-p-green-40 hover:bg-p-green-50",
176
- [n.PRIMARY_LINK]: "text-primary bg-transparent hover:text-accent underline",
177
- [n.SECONDARY_GHOST]: "text-on-surface hover:bg-p-gray-20",
178
- [n.SECONDARY_GHOST_DARK]: "text-white hover:bg-p-purple-50"
179
- }, D = {
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
- }, le = {
224
+ };
225
+ const LOADER_SIZES = {
184
226
  sm: 24,
185
227
  md: 30,
186
228
  lg: 40
187
- }, ie = {
188
- [n.PRIMARY]: "p-blue-15",
189
- [n.SECONDARY]: "p-purple-60",
190
- [n.PRIMARY_OUTLINE]: "p-blue-60",
191
- [n.SECONDARY_OUTLINE]: "p-purple-60",
192
- [n.SECONDARY_OUTLINE_BLUE]: "p-purple-60",
193
- [n.ERROR]: "p-blue-15",
194
- [n.SUCCESS]: "p-blue-15",
195
- [n.PRIMARY_LINK]: "p-blue-60",
196
- [n.SECONDARY_GHOST]: "p-purple-60",
197
- [n.SECONDARY_GHOST_DARK]: "p-blue-15"
198
- }, ue = I({
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: P,
202
- RouterLink: te
245
+ PRingLoader: _sfc_main$1,
246
+ RouterLink
203
247
  },
204
- inheritAttrs: !1,
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(e) {
213
- return Object.values(n).includes(e);
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(e) {
223
- return oe.includes(e);
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(e) {
233
- return Object.keys(D).includes(e);
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: !1
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: !1
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 `${ae} ${D[this.size]} ${se[this.type]}`;
310
+ return `${DEFAULT_CLASSES} ${BUTTON_SIZES[this.size]} ${BUTTON_CLASSES[this.type]}`;
267
311
  },
268
312
  loaderSize() {
269
- return +`${le[this.size]}`;
313
+ return Number(`${LOADER_SIZES[this.size]}`);
270
314
  },
271
315
  loaderColor() {
272
- const e = ie[this.type];
273
- return U(e);
316
+ const type = LOADER_COLORS[this.type];
317
+ return getColorDeep(type);
274
318
  },
275
319
  isExternalLink() {
276
- return typeof this.to == "string" && this.to.startsWith("http");
320
+ return typeof this.to === "string" && this.to.startsWith("http");
277
321
  }
278
322
  }
279
- }), ce = ["href"];
280
- function pe(e, t, r, o, a, l) {
281
- const u = w("PRingLoader");
282
- return e.isExternalLink ? (m(), K("a", y({ key: 0 }, e.$attrs, {
283
- href: e.to,
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: e.classes
330
+ class: _ctx.classes
286
331
  }), [
287
- h(e.$slots, "default")
288
- ], 16, ce)) : (m(), S(M(e.to ? "RouterLink" : "button"), y({
332
+ renderSlot(_ctx.$slots, "default")
333
+ ], 16, _hoisted_1)) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.to ? "RouterLink" : "button"), mergeProps({
289
334
  key: 1,
290
- type: e.to ? null : e.nativeType,
291
- to: e.to ? e.to : null,
292
- "aria-selected": e.selected,
293
- class: e.classes
294
- }, e.$attrs, {
295
- disabled: e.$attrs.disabled || e.loading
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: z(() => [
298
- j("div", {
299
- class: G({ invisible: e.loading })
342
+ default: withCtx(() => [
343
+ createElementVNode("div", {
344
+ class: normalizeClass({ invisible: _ctx.loading })
300
345
  }, [
301
- h(e.$slots, "default")
346
+ renderSlot(_ctx.$slots, "default")
302
347
  ], 2),
303
- e.loading ? (m(), S(u, {
348
+ _ctx.loading ? (openBlock(), createBlock(_component_PRingLoader, {
304
349
  key: 0,
305
- style: H(e.loaderStyle),
306
- color: e.loaderColor,
307
- size: e.loaderSize,
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"])) : q("", !0)
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 me = /* @__PURE__ */ Z(ue, [["render", pe]]);
359
+ const PBtn = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
315
360
  export {
316
- me as default
361
+ PBtn as default
317
362
  };
package/dist/es/p-card.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./chunks/p-card.js";
1
+ import { _ as _sfc_main } from "./chunks/p-card.js";
2
2
  export {
3
- f as default
3
+ _sfc_main as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./chunks/p-checkbox.js";
1
+ import { _ as _sfc_main } from "./chunks/p-checkbox.js";
2
2
  export {
3
- f as default
3
+ _sfc_main as default
4
4
  };