@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
@@ -1,10 +1,14 @@
1
- import { defineComponent as d, computed as p, openBlock as c, createBlock as f, withCtx as x, createElementVNode as u, normalizeClass as V } from "vue";
2
- import z from "../p-input-number.js";
3
- import { isNumber as s } from "lodash-es";
4
- const _ = /* @__PURE__ */ u("div", null, "%", -1), b = [
5
- _
6
- ], C = /* @__PURE__ */ d({
7
- name: "PInputPercent",
1
+ import { defineComponent, computed, openBlock, createBlock, withCtx, createElementVNode, normalizeClass } from "vue";
2
+ import PInputNumber from "../p-input-number.js";
3
+ import { isNumber } from "lodash-es";
4
+ const _hoisted_1 = /* @__PURE__ */ createElementVNode("div", null, "%", -1);
5
+ const _hoisted_2 = [
6
+ _hoisted_1
7
+ ];
8
+ const _sfc_main = /* @__PURE__ */ defineComponent({
9
+ ...{
10
+ name: "PInputPercent"
11
+ },
8
12
  __name: "p-input-percent",
9
13
  props: {
10
14
  modelValue: {
@@ -17,29 +21,34 @@ const _ = /* @__PURE__ */ u("div", null, "%", -1), b = [
17
21
  }
18
22
  },
19
23
  emits: ["update:modelValue"],
20
- setup(t, { emit: a }) {
21
- const n = {
24
+ setup(__props, { emit: __emit }) {
25
+ const prefixClasses = {
22
26
  sm: "text-sm h-8 left-2",
23
27
  md: "text-base h-10 left-3",
24
28
  lg: "text-lg h-12 left-5"
25
- }, l = t, i = a, o = p({
26
- get: () => s(l.modelValue) ? l.modelValue * 100 : l.modelValue,
27
- set: (e) => i("update:modelValue", s(e) ? e / 100 : e)
29
+ };
30
+ const props = __props;
31
+ const emit = __emit;
32
+ const convertedValue = computed({
33
+ get: () => isNumber(props.modelValue) ? props.modelValue * 100 : props.modelValue,
34
+ set: (nV) => emit("update:modelValue", isNumber(nV) ? nV / 100 : nV)
28
35
  });
29
- return (e, m) => (c(), f(z, {
30
- modelValue: o.value,
31
- "onUpdate:modelValue": m[0] || (m[0] = (r) => o.value = r),
32
- size: t.size
33
- }, {
34
- prefix: x(() => [
35
- u("div", {
36
- class: V(["absolute flex items-center", n[t.size]])
37
- }, b, 2)
38
- ]),
39
- _: 1
40
- }, 8, ["modelValue", "size"]));
36
+ return (_ctx, _cache) => {
37
+ return openBlock(), createBlock(PInputNumber, {
38
+ modelValue: convertedValue.value,
39
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => convertedValue.value = $event),
40
+ size: __props.size
41
+ }, {
42
+ prefix: withCtx(() => [
43
+ createElementVNode("div", {
44
+ class: normalizeClass(["absolute flex items-center", prefixClasses[__props.size]])
45
+ }, _hoisted_2, 2)
46
+ ]),
47
+ _: 1
48
+ }, 8, ["modelValue", "size"]);
49
+ };
41
50
  }
42
51
  });
43
52
  export {
44
- C as _
53
+ _sfc_main as _
45
54
  };
@@ -1,10 +1,11 @@
1
- import { defineComponent as m, computed as r, openBlock as n, createBlock as g, createElementBlock as c, Fragment as p, createTextVNode as u, toDisplayString as a, renderSlot as f } from "vue";
2
- import d from "../p-skeleton-loader.js";
3
- const y = {
1
+ import { defineComponent, computed, openBlock, createBlock, createElementBlock, Fragment, createTextVNode, toDisplayString, renderSlot } from "vue";
2
+ import PSkeletonLoader from "../p-skeleton-loader.js";
3
+ const _hoisted_1 = {
4
4
  key: 1,
5
5
  class: "text-sm font-medium text-p-gray-40"
6
- }, S = /* @__PURE__ */ m({
7
- name: "PPaginationInfo",
6
+ };
7
+ const _sfc_main = /* @__PURE__ */ defineComponent({
8
+ ...{ name: "PPaginationInfo" },
8
9
  __name: "p-pagination-info",
9
10
  props: {
10
11
  /**
@@ -33,29 +34,34 @@ const y = {
33
34
  */
34
35
  loading: {
35
36
  type: Boolean,
36
- default: !1
37
+ default: false
37
38
  }
38
39
  },
39
- setup(o) {
40
- const e = o, s = r(() => {
41
- const t = Math.ceil(e.count / e.pageSize);
42
- return ((e.currentPage > t ? t : e.currentPage) - 1) * e.pageSize + 1;
43
- }), l = r(() => {
44
- const t = e.currentPage * e.pageSize;
45
- return t >= e.count ? e.count : t;
40
+ setup(__props) {
41
+ const props = __props;
42
+ const from = computed(() => {
43
+ const maxNumOfPages = Math.ceil(props.count / props.pageSize);
44
+ const currentPage = props.currentPage > maxNumOfPages ? maxNumOfPages : props.currentPage;
45
+ return (currentPage - 1) * props.pageSize + 1;
46
+ });
47
+ const to = computed(() => {
48
+ const to2 = props.currentPage * props.pageSize;
49
+ return to2 >= props.count ? props.count : to2;
46
50
  });
47
- return (t, i) => o.loading ? (n(), g(d, {
48
- key: 0,
49
- class: "h-6 w-56"
50
- })) : (n(), c("div", y, [
51
- o.count ? (n(), c(p, { key: 0 }, [
52
- u("Showing " + a(s.value) + " to " + a(l.value) + " of " + a(o.count) + " results", 1)
53
- ], 64)) : f(t.$slots, "no-results", { key: 1 }, () => [
54
- u("No results found")
55
- ])
56
- ]));
51
+ return (_ctx, _cache) => {
52
+ return __props.loading ? (openBlock(), createBlock(PSkeletonLoader, {
53
+ key: 0,
54
+ class: "h-6 w-56"
55
+ })) : (openBlock(), createElementBlock("div", _hoisted_1, [
56
+ __props.count ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
57
+ createTextVNode("Showing " + toDisplayString(from.value) + " to " + toDisplayString(to.value) + " of " + toDisplayString(__props.count) + " results", 1)
58
+ ], 64)) : renderSlot(_ctx.$slots, "no-results", { key: 1 }, () => [
59
+ createTextVNode("No results found")
60
+ ])
61
+ ]));
62
+ };
57
63
  }
58
64
  });
59
65
  export {
60
- S as _
66
+ _sfc_main as _
61
67
  };
@@ -1,15 +1,31 @@
1
- import { defineComponent as y, computed as C, openBlock as o, createElementBlock as l, Fragment as p, createBlock as L, createCommentVNode as v, createElementVNode as a, normalizeClass as r, renderList as S, toDisplayString as f } from "vue";
2
- import V from "../p-skeleton-loader.js";
3
- import { createPagingRange as w } from "../pagination.js";
4
- const k = "data:image/svg+xml,%3csvg%20width='8'%20height='12'%20viewBox='0%200%208%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0.25%205.99968C0.25%205.64968%200.4%205.34968%200.65%205.14968L6.25%200.249681C6.65%20-0.100319%207.2%20-0.0503187%207.55%200.349681C7.85%200.749681%207.85%201.29968%207.45%201.59968L2.55%205.89968C2.5%205.94968%202.5%205.99968%202.55%206.04968L7.45%2010.3497C7.85%2010.6997%207.9%2011.2497%207.55%2011.6497C7.2%2012.0497%206.65%2012.0997%206.25%2011.7497C6.25%2011.7497%206.25%2011.7497%206.2%2011.6997L0.65%206.84968C0.4%206.64968%200.25%206.29968%200.25%205.99968Z'%20fill='%23918da1'%20/%3e%3c/svg%3e", A = "data:image/svg+xml,%3csvg%20width='8'%20height='14'%20viewBox='0%200%208%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.75695%206.98136C7.75695%207.33136%207.60695%207.63136%207.35695%207.83136L1.75695%2012.7814C1.35695%2013.1314%200.756947%2013.0814%200.456947%2012.6814C0.156947%2012.2814%200.156947%2011.7314%200.556947%2011.3814L5.45695%207.08136C5.50695%207.03136%205.50695%206.98136%205.45695%206.88136L0.556947%202.58136C0.156947%202.23136%200.156947%201.63136%200.506947%201.28136C0.856947%200.931361%201.40695%200.881361%201.80695%201.18136L7.40695%206.08136C7.60695%206.33136%207.75695%206.63136%207.75695%206.98136Z'%20fill='%23918da1'%20/%3e%3c/svg%3e", B = {
1
+ import { defineComponent, computed, openBlock, createElementBlock, Fragment, createBlock, createCommentVNode, createElementVNode, normalizeClass, renderList, toDisplayString } from "vue";
2
+ import PSkeletonLoader from "../p-skeleton-loader.js";
3
+ import { createPagingRange } from "../pagination.js";
4
+ const _imports_0 = "data:image/svg+xml,%3csvg%20width='8'%20height='12'%20viewBox='0%200%208%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0.25%205.99968C0.25%205.64968%200.4%205.34968%200.65%205.14968L6.25%200.249681C6.65%20-0.100319%207.2%20-0.0503187%207.55%200.349681C7.85%200.749681%207.85%201.29968%207.45%201.59968L2.55%205.89968C2.5%205.94968%202.5%205.99968%202.55%206.04968L7.45%2010.3497C7.85%2010.6997%207.9%2011.2497%207.55%2011.6497C7.2%2012.0497%206.65%2012.0997%206.25%2011.7497C6.25%2011.7497%206.25%2011.7497%206.2%2011.6997L0.65%206.84968C0.4%206.64968%200.25%206.29968%200.25%205.99968Z'%20fill='%23918da1'%20/%3e%3c/svg%3e";
5
+ const _imports_1 = "data:image/svg+xml,%3csvg%20width='8'%20height='14'%20viewBox='0%200%208%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.75695%206.98136C7.75695%207.33136%207.60695%207.63136%207.35695%207.83136L1.75695%2012.7814C1.35695%2013.1314%200.756947%2013.0814%200.456947%2012.6814C0.156947%2012.2814%200.156947%2011.7314%200.556947%2011.3814L5.45695%207.08136C5.50695%207.03136%205.50695%206.98136%205.45695%206.88136L0.556947%202.58136C0.156947%202.23136%200.156947%201.63136%200.506947%201.28136C0.856947%200.931361%201.40695%200.881361%201.80695%201.18136L7.40695%206.08136C7.60695%206.33136%207.75695%206.63136%207.75695%206.98136Z'%20fill='%23918da1'%20/%3e%3c/svg%3e";
6
+ const _hoisted_1 = {
5
7
  key: 1,
6
8
  class: "flex text-p-gray-40"
7
- }, T = /* @__PURE__ */ a("img", { src: k }, null, -1), E = [
8
- T
9
- ], I = ["onClick"], O = { class: "flex" }, P = ["aria-label"], R = /* @__PURE__ */ a("img", { src: A }, null, -1), $ = [
10
- R
11
- ], m = "...", c = "w-6 h-6 flex justify-center items-center mx-1 font-semibold text-sm leading-none", z = "text-p-purple-60 bg-p-gray-30 rounded-lg", M = "cursor-pointer", h = "cursor-pointer", _ = "opacity-50", F = /* @__PURE__ */ y({
12
- name: "PPagination",
9
+ };
10
+ const _hoisted_2 = /* @__PURE__ */ createElementVNode("img", { src: _imports_0 }, null, -1);
11
+ const _hoisted_3 = [
12
+ _hoisted_2
13
+ ];
14
+ const _hoisted_4 = ["onClick"];
15
+ const _hoisted_5 = { class: "flex" };
16
+ const _hoisted_6 = ["aria-label"];
17
+ const _hoisted_7 = /* @__PURE__ */ createElementVNode("img", { src: _imports_1 }, null, -1);
18
+ const _hoisted_8 = [
19
+ _hoisted_7
20
+ ];
21
+ const DOTS = "...";
22
+ const BTN_CLASS = "w-6 h-6 flex justify-center items-center mx-1 font-semibold text-sm leading-none";
23
+ const BTN_ACTIVE_CLASS = "text-p-purple-60 bg-p-gray-30 rounded-lg";
24
+ const BTN_INACTIVE_CLASS = "cursor-pointer";
25
+ const ARROW_ACTIVE_CLASS = "cursor-pointer";
26
+ const ARROW_INACTIVE_CLASS = "opacity-50";
27
+ const _sfc_main = /* @__PURE__ */ defineComponent({
28
+ ...{ name: "PPagination" },
13
29
  __name: "p-pagination",
14
30
  props: {
15
31
  /**
@@ -45,49 +61,63 @@ const k = "data:image/svg+xml,%3csvg%20width='8'%20height='12'%20viewBox='0%200%
45
61
  */
46
62
  loading: {
47
63
  type: Boolean,
48
- default: !1
64
+ default: false
49
65
  }
50
66
  },
51
67
  emits: ["update:modelValue"],
52
- setup(e, { emit: x }) {
53
- const N = x, n = e, u = C(() => n.count && Math.ceil(n.count / n.pageSize)), g = C(() => w(Number(n.modelValue), u.value, n.pageOffset, m)), d = (s) => {
54
- s >= 1 && s <= u.value && N("update:modelValue", s);
68
+ setup(__props, { emit: __emit }) {
69
+ const emit = __emit;
70
+ const props = __props;
71
+ const pageCount = computed(() => {
72
+ return props.count && Math.ceil(props.count / props.pageSize);
73
+ });
74
+ const pages = computed(() => {
75
+ return createPagingRange(Number(props.modelValue), pageCount.value, props.pageOffset, DOTS);
76
+ });
77
+ const setPage = (page) => {
78
+ if (page >= 1 && page <= pageCount.value) {
79
+ emit("update:modelValue", page);
80
+ }
81
+ };
82
+ return (_ctx, _cache) => {
83
+ return openBlock(), createElementBlock(Fragment, null, [
84
+ __props.loading ? (openBlock(), createBlock(PSkeletonLoader, {
85
+ key: 0,
86
+ class: "h-6 w-56"
87
+ })) : createCommentVNode("", true),
88
+ !__props.loading && pages.value.length > 1 ? (openBlock(), createElementBlock("div", _hoisted_1, [
89
+ createElementVNode("div", {
90
+ class: normalizeClass([BTN_CLASS, Number(__props.modelValue) <= 1 ? ARROW_INACTIVE_CLASS : ARROW_ACTIVE_CLASS]),
91
+ "aria-label": "go to the previous page",
92
+ onClick: _cache[0] || (_cache[0] = ($event) => setPage(Number(__props.modelValue) - 1))
93
+ }, _hoisted_3, 2),
94
+ (openBlock(true), createElementBlock(Fragment, null, renderList(pages.value, (page, index) => {
95
+ return openBlock(), createElementBlock("div", {
96
+ key: index,
97
+ onClick: ($event) => setPage(Number(page))
98
+ }, [
99
+ createElementVNode("div", _hoisted_5, [
100
+ page !== DOTS ? (openBlock(), createElementBlock("div", {
101
+ key: 0,
102
+ class: normalizeClass([BTN_CLASS, page === __props.modelValue ? BTN_ACTIVE_CLASS : BTN_INACTIVE_CLASS]),
103
+ "aria-label": `go to page ${page}`
104
+ }, toDisplayString(page), 11, _hoisted_6)) : (openBlock(), createElementBlock("div", {
105
+ key: 1,
106
+ class: normalizeClass(BTN_CLASS)
107
+ }, toDisplayString(DOTS)))
108
+ ])
109
+ ], 8, _hoisted_4);
110
+ }), 128)),
111
+ createElementVNode("div", {
112
+ class: normalizeClass([BTN_CLASS, __props.modelValue === pageCount.value ? ARROW_INACTIVE_CLASS : ARROW_ACTIVE_CLASS]),
113
+ "aria-label": "go to the next page",
114
+ onClick: _cache[1] || (_cache[1] = ($event) => setPage(Number(__props.modelValue) + 1))
115
+ }, _hoisted_8, 2)
116
+ ])) : createCommentVNode("", true)
117
+ ], 64);
55
118
  };
56
- return (s, i) => (o(), l(p, null, [
57
- e.loading ? (o(), L(V, {
58
- key: 0,
59
- class: "h-6 w-56"
60
- })) : v("", !0),
61
- !e.loading && g.value.length > 1 ? (o(), l("div", B, [
62
- a("div", {
63
- class: r([c, Number(e.modelValue) <= 1 ? _ : h]),
64
- "aria-label": "go to the previous page",
65
- onClick: i[0] || (i[0] = (t) => d(Number(e.modelValue) - 1))
66
- }, E, 2),
67
- (o(!0), l(p, null, S(g.value, (t, b) => (o(), l("div", {
68
- key: b,
69
- onClick: (D) => d(Number(t))
70
- }, [
71
- a("div", O, [
72
- t !== m ? (o(), l("div", {
73
- key: 0,
74
- class: r([c, t === e.modelValue ? z : M]),
75
- "aria-label": `go to page ${t}`
76
- }, f(t), 11, P)) : (o(), l("div", {
77
- key: 1,
78
- class: r(c)
79
- }, f(m)))
80
- ])
81
- ], 8, I))), 128)),
82
- a("div", {
83
- class: r([c, e.modelValue === u.value ? _ : h]),
84
- "aria-label": "go to the next page",
85
- onClick: i[1] || (i[1] = (t) => d(Number(e.modelValue) + 1))
86
- }, $, 2)
87
- ])) : v("", !0)
88
- ], 64));
89
119
  }
90
120
  });
91
121
  export {
92
- F as _
122
+ _sfc_main as _
93
123
  };
@@ -1,7 +1,10 @@
1
- import { defineComponent as S, computed as i, openBlock as g, createElementBlock as x, normalizeStyle as n, createElementVNode as o, normalizeClass as l } from "vue";
2
- import { getColor as $ } from "../tailwind.js";
3
- const s = "block animate-spin absolute box-border rounded-full w-4/5 h-4/5 m-[10%]", _ = /* @__PURE__ */ S({
4
- name: "PRingLoader",
1
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, createElementVNode, normalizeClass } from "vue";
2
+ import { getColor } from "../tailwind.js";
3
+ const INNER_DIV_CLASS = "block animate-spin absolute box-border rounded-full w-4/5 h-4/5 m-[10%]";
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ ...{
6
+ name: "PRingLoader"
7
+ },
5
8
  __name: "p-ring-loader",
6
9
  props: {
7
10
  size: {
@@ -10,50 +13,70 @@ const s = "block animate-spin absolute box-border rounded-full w-4/5 h-4/5 m-[10
10
13
  },
11
14
  color: {
12
15
  type: String,
13
- default: $("primary")
16
+ default: getColor("primary")
14
17
  },
15
18
  duration: {
16
19
  type: String,
17
20
  default: "1.2s",
18
- validator(t) {
19
- return /^\d*\.?\d+(s|ms)$/.test(t);
21
+ validator(value) {
22
+ const res = /^\d*\.?\d+(s|ms)$/;
23
+ return res.test(value);
20
24
  }
21
25
  }
22
26
  },
23
- setup(t) {
24
- const a = (c, u, h) => {
25
- var d, p;
26
- const m = {}, f = (d = u.match(/^\d*\.?\d+/)) == null ? void 0 : d[0], D = ((p = u.match(/s|(ms)$/)) == null ? void 0 : p[0]) || "s", z = Math.round(Number(f) * 1e3 * h) / 1e3;
27
- return m[c] = z + D, m;
28
- }, e = t, r = i(() => ({
29
- borderWidth: `${e.size * 0.1}px`,
30
- borderColor: `${e.color} transparent transparent transparent`,
31
- animationDuration: e.duration,
32
- animationTimingFunction: "cubic-bezier(0.5, 0, 0.5, 1)"
33
- })), y = i(() => a("animationDelay", e.duration, -0.375)), v = i(() => a("animationDelay", e.duration, -0.25)), b = i(() => a("animationDelay", e.duration, -0.125));
34
- return (c, u) => (g(), x("div", {
35
- class: "relative inline-block",
36
- style: n({ width: `${t.size}px`, height: `${t.size}px` })
37
- }, [
38
- o("div", {
39
- class: l(s),
40
- style: n([r.value, y.value])
41
- }, null, 4),
42
- o("div", {
43
- class: l(s),
44
- style: n([r.value, v.value])
45
- }, null, 4),
46
- o("div", {
47
- class: l(s),
48
- style: n([r.value, b.value])
49
- }, null, 4),
50
- o("div", {
51
- class: l(s),
52
- style: n([r.value])
53
- }, null, 4)
54
- ], 4));
27
+ setup(__props) {
28
+ const calcPropertyValue = (propName, originalValue, modificator) => {
29
+ var _a, _b;
30
+ const computedStyle = {};
31
+ const timeQuantityOuter = (_a = originalValue.match(/^\d*\.?\d+/)) == null ? void 0 : _a[0];
32
+ const timeUnit = ((_b = originalValue.match(/s|(ms)$/)) == null ? void 0 : _b[0]) || "s";
33
+ const timeQuantityInner = Math.round(Number(timeQuantityOuter) * 1e3 * modificator) / 1e3;
34
+ computedStyle[propName] = timeQuantityInner + timeUnit;
35
+ return computedStyle;
36
+ };
37
+ const props = __props;
38
+ const spinnerStyle = computed(() => {
39
+ return {
40
+ borderWidth: `${props.size * 0.1}px`,
41
+ borderColor: `${props.color} transparent transparent transparent`,
42
+ animationDuration: props.duration,
43
+ animationTimingFunction: "cubic-bezier(0.5, 0, 0.5, 1)"
44
+ };
45
+ });
46
+ const animDiv1 = computed(() => {
47
+ return calcPropertyValue("animationDelay", props.duration, -0.375);
48
+ });
49
+ const animDiv2 = computed(() => {
50
+ return calcPropertyValue("animationDelay", props.duration, -0.25);
51
+ });
52
+ const animDiv3 = computed(() => {
53
+ return calcPropertyValue("animationDelay", props.duration, -0.125);
54
+ });
55
+ return (_ctx, _cache) => {
56
+ return openBlock(), createElementBlock("div", {
57
+ class: "relative inline-block",
58
+ style: normalizeStyle({ width: `${__props.size}px`, height: `${__props.size}px` })
59
+ }, [
60
+ createElementVNode("div", {
61
+ class: normalizeClass(INNER_DIV_CLASS),
62
+ style: normalizeStyle([spinnerStyle.value, animDiv1.value])
63
+ }, null, 4),
64
+ createElementVNode("div", {
65
+ class: normalizeClass(INNER_DIV_CLASS),
66
+ style: normalizeStyle([spinnerStyle.value, animDiv2.value])
67
+ }, null, 4),
68
+ createElementVNode("div", {
69
+ class: normalizeClass(INNER_DIV_CLASS),
70
+ style: normalizeStyle([spinnerStyle.value, animDiv3.value])
71
+ }, null, 4),
72
+ createElementVNode("div", {
73
+ class: normalizeClass(INNER_DIV_CLASS),
74
+ style: normalizeStyle([spinnerStyle.value])
75
+ }, null, 4)
76
+ ], 4);
77
+ };
55
78
  }
56
79
  });
57
80
  export {
58
- _
81
+ _sfc_main as _
59
82
  };
@@ -1,7 +1,9 @@
1
- import { defineComponent as V, resolveDirective as g, openBlock as i, createElementBlock as s, normalizeClass as r, Fragment as h, renderList as y, withDirectives as B, createBlock as T, withCtx as b, renderSlot as v, createTextVNode as w, toDisplayString as k } from "vue";
2
- import S from "../p-btn.js";
3
- const P = /* @__PURE__ */ V({
4
- name: "PBtnGroup",
1
+ import { defineComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, Fragment, renderList, withDirectives, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
2
+ import PBtn from "../p-btn.js";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ ...{
5
+ name: "PBtnGroup"
6
+ },
5
7
  __name: "p-select-btn",
6
8
  props: {
7
9
  modelValue: { default: null },
@@ -10,68 +12,87 @@ const P = /* @__PURE__ */ V({
10
12
  itemText: { default: "text" },
11
13
  itemTooltipText: { default: "text" },
12
14
  size: { default: "md" },
13
- showTooltip: { type: Boolean, default: !1 },
14
- highlightSelected: { type: Boolean, default: !0 },
15
- grow: { type: Boolean, default: !1 },
16
- multiple: { type: Boolean, default: !1 },
17
- noPadding: { type: Boolean, default: !1 }
15
+ showTooltip: { type: Boolean, default: false },
16
+ highlightSelected: { type: Boolean, default: true },
17
+ grow: { type: Boolean, default: false },
18
+ multiple: { type: Boolean, default: false },
19
+ noPadding: { type: Boolean, default: false }
18
20
  },
19
21
  emits: ["update:modelValue"],
20
- setup(m, { emit: p }) {
21
- const a = p, l = m, f = (e) => l.showTooltip ? e[l.itemTooltipText] : "", c = (e) => {
22
- if (!l.multiple)
23
- a("update:modelValue", e[l.itemValue]);
24
- else if (Array.isArray(l.modelValue)) {
25
- const n = e[l.itemValue];
26
- l.modelValue.findIndex((t) => t[l.itemValue] === n) !== -1 ? a(
27
- "update:modelValue",
28
- l.modelValue.filter((t) => t[l.itemValue] !== n)
29
- ) : a("update:modelValue", [...l.modelValue, e]);
30
- } else
31
- a("update:modelValue", [e]);
32
- }, u = (e) => {
33
- if (l.multiple) {
34
- if (Array.isArray(l.modelValue))
35
- return l.modelValue.findIndex((d) => d[l.itemValue] === e[l.itemValue]) !== -1;
36
- } else
37
- return l.modelValue === e[l.itemValue];
22
+ setup(__props, { emit: __emit }) {
23
+ const emit = __emit;
24
+ const props = __props;
25
+ const tooltipText = (item) => {
26
+ return props.showTooltip ? item[props.itemTooltipText] : "";
27
+ };
28
+ const select = (item) => {
29
+ if (!props.multiple) {
30
+ emit("update:modelValue", item[props.itemValue]);
31
+ } else {
32
+ if (Array.isArray(props.modelValue)) {
33
+ const val = item[props.itemValue];
34
+ const index = props.modelValue.findIndex((i) => i[props.itemValue] === val);
35
+ if (index !== -1) {
36
+ emit(
37
+ "update:modelValue",
38
+ props.modelValue.filter((i) => i[props.itemValue] !== val)
39
+ );
40
+ } else {
41
+ emit("update:modelValue", [...props.modelValue, item]);
42
+ }
43
+ } else {
44
+ emit("update:modelValue", [item]);
45
+ }
46
+ }
47
+ };
48
+ const isSelected = (item) => {
49
+ if (!props.multiple) {
50
+ return props.modelValue === item[props.itemValue];
51
+ } else {
52
+ if (Array.isArray(props.modelValue)) {
53
+ const index = props.modelValue.findIndex((i) => i[props.itemValue] === item[props.itemValue]);
54
+ return index !== -1;
55
+ }
56
+ }
38
57
  };
39
- return (e, n) => {
40
- const d = g("tooltip");
41
- return i(), s("div", {
42
- class: r({ flex: e.grow, "*:px-0 *:py-0": e.noPadding })
58
+ return (_ctx, _cache) => {
59
+ const _directive_tooltip = resolveDirective("tooltip");
60
+ return openBlock(), createElementBlock("div", {
61
+ class: normalizeClass({ flex: _ctx.grow, "*:px-0 *:py-0": _ctx.noPadding })
43
62
  }, [
44
- (i(!0), s(h, null, y(e.items, (t, o) => B((i(), T(S, {
45
- key: t[e.itemValue],
46
- size: e.size,
47
- type: "secondary-outline-blue",
48
- disabled: t.disabled,
49
- class: r({
50
- "rounded-none": o !== 0 && o !== e.items.length - 1,
51
- "rounded-br-none rounded-tr-none": o === 0,
52
- "rounded-bl-none rounded-tl-none": o === e.items.length - 1,
53
- "-mr-0.5": o !== e.items.length - 1,
54
- "flex-1": e.grow
55
- }),
56
- selected: u(t) && e.highlightSelected,
57
- onClick: (z) => c(t)
58
- }, {
59
- default: b(() => [
60
- v(e.$slots, `btn-${o}`, {
61
- item: t,
62
- isSelected: u(t)
63
- }, () => [
64
- w(k(t[e.itemText]), 1)
65
- ])
66
- ]),
67
- _: 2
68
- }, 1032, ["size", "disabled", "class", "selected", "onClick"])), [
69
- [d, { content: f(t) }]
70
- ])), 128))
63
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (item, index) => {
64
+ return withDirectives((openBlock(), createBlock(PBtn, {
65
+ key: item[_ctx.itemValue],
66
+ size: _ctx.size,
67
+ type: "secondary-outline-blue",
68
+ disabled: item.disabled,
69
+ class: normalizeClass({
70
+ "rounded-none": index !== 0 && index !== _ctx.items.length - 1,
71
+ "rounded-br-none rounded-tr-none": index === 0,
72
+ "rounded-bl-none rounded-tl-none": index === _ctx.items.length - 1,
73
+ "-mr-0.5": index !== _ctx.items.length - 1,
74
+ "flex-1": _ctx.grow
75
+ }),
76
+ selected: isSelected(item) && _ctx.highlightSelected,
77
+ onClick: ($event) => select(item)
78
+ }, {
79
+ default: withCtx(() => [
80
+ renderSlot(_ctx.$slots, `btn-${index}`, {
81
+ item,
82
+ isSelected: isSelected(item)
83
+ }, () => [
84
+ createTextVNode(toDisplayString(item[_ctx.itemText]), 1)
85
+ ])
86
+ ]),
87
+ _: 2
88
+ }, 1032, ["size", "disabled", "class", "selected", "onClick"])), [
89
+ [_directive_tooltip, { content: tooltipText(item) }]
90
+ ]);
91
+ }), 128))
71
92
  ], 2);
72
93
  };
73
94
  }
74
95
  });
75
96
  export {
76
- P as _
97
+ _sfc_main as _
77
98
  };