@pequity/squirrel 1.0.19 → 1.0.20-beta.2

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 (146) hide show
  1. package/dist/cjs/chunks/_plugin-vue_export-helper.js +1 -0
  2. package/dist/cjs/chunks/p-action-bar.js +1 -0
  3. package/dist/cjs/chunks/p-card.js +1 -0
  4. package/dist/cjs/chunks/p-checkbox.js +1 -0
  5. package/dist/cjs/chunks/p-dropdown-select.js +1 -0
  6. package/dist/cjs/chunks/p-input-percent.js +1 -0
  7. package/dist/cjs/chunks/p-pagination-info.js +1 -0
  8. package/dist/cjs/chunks/p-pagination.js +1 -0
  9. package/dist/cjs/chunks/p-ring-loader.js +1 -0
  10. package/dist/cjs/chunks/p-select-btn.js +1 -0
  11. package/dist/cjs/chunks/p-select.js +1 -0
  12. package/dist/cjs/chunks/p-table-loader.js +1 -0
  13. package/dist/cjs/chunks/p-tabs.js +1 -0
  14. package/dist/cjs/config.js +1 -0
  15. package/dist/cjs/currency.js +1 -0
  16. package/dist/cjs/dom.js +1 -0
  17. package/dist/cjs/index.js +1 -0
  18. package/dist/cjs/inputClassesMixin.js +1 -0
  19. package/dist/cjs/inputClassesShared.js +1 -0
  20. package/dist/cjs/listKeyboardNavigation.js +1 -0
  21. package/dist/cjs/number.js +1 -0
  22. package/dist/cjs/object.js +1 -0
  23. package/dist/cjs/p-action-bar.js +1 -0
  24. package/dist/cjs/p-alert.js +1 -0
  25. package/dist/cjs/p-avatar.js +1 -0
  26. package/dist/cjs/p-btn.js +5 -0
  27. package/dist/cjs/p-card.js +1 -0
  28. package/dist/cjs/p-checkbox.js +1 -0
  29. package/dist/cjs/p-chips.js +1 -0
  30. package/dist/cjs/p-close-btn.js +1 -0
  31. package/dist/cjs/p-date-picker.js +1 -0
  32. package/dist/cjs/p-drawer.js +1 -0
  33. package/dist/cjs/p-dropdown-select.js +1 -0
  34. package/dist/cjs/p-dropdown.js +1 -0
  35. package/dist/cjs/p-file-upload.js +1 -0
  36. package/dist/cjs/p-info-icon.js +1 -0
  37. package/dist/cjs/p-inline-date-picker.js +1 -0
  38. package/dist/cjs/p-input-number.js +1 -0
  39. package/dist/cjs/p-input-percent.js +1 -0
  40. package/dist/cjs/p-input-search.js +1 -0
  41. package/dist/cjs/p-input.js +1 -0
  42. package/dist/cjs/p-loading.js +1 -0
  43. package/dist/cjs/p-modal.js +1 -0
  44. package/dist/cjs/p-pagination-info.js +1 -0
  45. package/dist/cjs/p-pagination.js +1 -0
  46. package/dist/cjs/p-progress-bar.js +1 -0
  47. package/dist/cjs/p-ring-loader.js +1 -0
  48. package/dist/cjs/p-select-btn.js +1 -0
  49. package/dist/cjs/p-select-list.js +1 -0
  50. package/dist/cjs/p-select-pill.js +1 -0
  51. package/dist/cjs/p-select.js +1 -0
  52. package/dist/cjs/p-skeleton-loader.js +1 -0
  53. package/dist/cjs/p-table-filter-icon.js +1 -0
  54. package/dist/cjs/p-table-header-cell.js +1 -0
  55. package/dist/cjs/p-table-loader.js +1 -0
  56. package/dist/cjs/p-table-sort.js +1 -0
  57. package/dist/cjs/p-table-td.js +1 -0
  58. package/dist/cjs/p-table.js +1 -0
  59. package/dist/cjs/p-tabs.js +1 -0
  60. package/dist/cjs/p-textarea.js +1 -0
  61. package/dist/cjs/p-toggle.js +1 -0
  62. package/dist/cjs/pagination.js +1 -0
  63. package/dist/cjs/string.js +1 -0
  64. package/dist/cjs/tailwind.js +1 -0
  65. package/dist/cjs/text.js +1 -0
  66. package/dist/cjs/useInputClasses.js +1 -0
  67. package/dist/cjs/usePLoading.js +1 -0
  68. package/dist/cjs/usePModal.js +1 -0
  69. package/dist/cjs/usePTableColResize.js +1 -0
  70. package/dist/cjs/usePTableRowVirtualizer.js +1 -0
  71. package/dist/cjs/useSelectList.js +1 -0
  72. package/dist/es/chunks/_plugin-vue_export-helper.js +9 -0
  73. package/dist/es/chunks/p-action-bar.js +52 -0
  74. package/dist/es/chunks/p-card.js +25 -0
  75. package/dist/es/chunks/p-checkbox.js +22 -0
  76. package/dist/es/chunks/p-dropdown-select.js +366 -0
  77. package/dist/es/chunks/p-input-percent.js +45 -0
  78. package/dist/es/chunks/p-pagination-info.js +61 -0
  79. package/dist/es/chunks/p-pagination.js +93 -0
  80. package/dist/es/chunks/p-ring-loader.js +59 -0
  81. package/dist/es/chunks/p-select-btn.js +77 -0
  82. package/dist/es/chunks/p-select.js +97 -0
  83. package/dist/es/chunks/p-table-loader.js +57 -0
  84. package/dist/es/chunks/p-tabs.js +47 -0
  85. package/dist/es/config.js +105 -0
  86. package/dist/es/currency.js +9 -0
  87. package/dist/es/dom.js +15 -0
  88. package/dist/es/index.js +836 -0
  89. package/dist/es/inputClassesMixin.js +45 -0
  90. package/dist/es/inputClassesShared.js +61 -0
  91. package/dist/es/listKeyboardNavigation.js +60 -0
  92. package/dist/es/number.js +4 -0
  93. package/dist/es/object.js +4 -0
  94. package/dist/es/p-action-bar.js +4 -0
  95. package/dist/es/p-alert.js +61 -0
  96. package/dist/es/p-avatar.js +69 -0
  97. package/dist/es/p-btn.js +317 -0
  98. package/dist/es/p-card.js +4 -0
  99. package/dist/es/p-checkbox.js +4 -0
  100. package/dist/es/p-chips.js +91 -0
  101. package/dist/es/p-close-btn.js +33 -0
  102. package/dist/es/p-date-picker.js +132 -0
  103. package/dist/es/p-drawer.js +235 -0
  104. package/dist/es/p-dropdown-select.js +4 -0
  105. package/dist/es/p-dropdown.js +120 -0
  106. package/dist/es/p-file-upload.js +13 -0
  107. package/dist/es/p-info-icon.js +31 -0
  108. package/dist/es/p-inline-date-picker.js +132 -0
  109. package/dist/es/p-input-number.js +129 -0
  110. package/dist/es/p-input-percent.js +4 -0
  111. package/dist/es/p-input-search.js +109 -0
  112. package/dist/es/p-input.js +84 -0
  113. package/dist/es/p-loading.js +30 -0
  114. package/dist/es/p-modal.js +283 -0
  115. package/dist/es/p-pagination-info.js +4 -0
  116. package/dist/es/p-pagination.js +4 -0
  117. package/dist/es/p-progress-bar.js +39 -0
  118. package/dist/es/p-ring-loader.js +4 -0
  119. package/dist/es/p-select-btn.js +4 -0
  120. package/dist/es/p-select-list.js +4 -0
  121. package/dist/es/p-select-pill.js +95 -0
  122. package/dist/es/p-select.js +4 -0
  123. package/dist/es/p-skeleton-loader.js +69 -0
  124. package/dist/es/p-table-filter-icon.js +21 -0
  125. package/dist/es/p-table-header-cell.js +71 -0
  126. package/dist/es/p-table-loader.js +4 -0
  127. package/dist/es/p-table-sort.js +8 -0
  128. package/dist/es/p-table-td.js +42 -0
  129. package/dist/es/p-table.js +8 -0
  130. package/dist/es/p-tabs.js +4 -0
  131. package/dist/es/p-textarea.js +72 -0
  132. package/dist/es/p-toggle.js +110 -0
  133. package/dist/es/pagination.js +12 -0
  134. package/dist/es/string.js +4 -0
  135. package/dist/es/tailwind.js +3794 -0
  136. package/dist/es/text.js +11 -0
  137. package/dist/es/useInputClasses.js +28 -0
  138. package/dist/es/usePLoading.js +19 -0
  139. package/dist/es/usePModal.js +18 -0
  140. package/dist/es/usePTableColResize.js +49 -0
  141. package/dist/es/usePTableRowVirtualizer.js +22 -0
  142. package/dist/es/useSelectList.js +143 -0
  143. package/dist/style.css +1 -1
  144. package/package.json +22 -20
  145. package/dist/squirrel.cjs.js +0 -5
  146. package/dist/squirrel.es.js +0 -8220
@@ -0,0 +1,366 @@
1
+ import { defineComponent as Se, ref as d, useAttrs as xe, computed as k, watch as be, onMounted as we, onUnmounted as Ce, resolveDirective as ke, openBlock as n, createElementBlock as i, normalizeClass as r, unref as e, normalizeStyle as S, toDisplayString as y, createCommentVNode as v, createVNode as R, mergeProps as T, withCtx as q, createElementVNode as a, isRef as Ae, Fragment as U, renderList as Z, withDirectives as W, renderSlot as V, vShow as Ie } from "vue";
2
+ import ze from "../p-dropdown.js";
3
+ import Me from "../p-input-search.js";
4
+ import { SIZES as L } from "../p-select-list.js";
5
+ import { omit as Te } from "lodash-es";
6
+ import { splitStringForHighlight as Y } from "../text.js";
7
+ import { toString as $ } from "../string.js";
8
+ import { useInputClasses as Ve } from "../useInputClasses.js";
9
+ import { useSelectList as Le } from "../useSelectList.js";
10
+ const $e = "data:image/svg+xml,%3csvg%20width='18'%20height='12'%20viewBox='0%200%2018%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M16.1383%200.166992L6.30411%209.83366L1.69828%205.27533L0.526611%206.46033L5.71578%2011.597C5.87174%2011.7509%206.08205%2011.8372%206.3012%2011.8372C6.52034%2011.8372%206.73065%2011.7509%206.88661%2011.597L17.3033%201.35366L16.1383%200.166992Z'%20fill='%231A123B'%20/%3e%3c/svg%3e", Ne = ["data-has-error"], Be = {
11
+ key: 0,
12
+ class: "truncate text-left text-p-gray-40"
13
+ }, De = { class: "truncate text-left" }, Oe = {
14
+ key: 0,
15
+ class: "mt-3 px-3"
16
+ }, Pe = { class: "text-p-purple-60" }, je = { class: "flex flex-row" }, Ee = /* @__PURE__ */ a("span", { class: "px-1 leading-none" }, ".", -1), Fe = ["onClick"], He = ["title"], Re = {
17
+ key: 0,
18
+ class: "ml-auto fill-p-purple-60 pl-2",
19
+ src: $e
20
+ }, Xe = /* @__PURE__ */ Se({
21
+ name: "PDropdownSelect",
22
+ inheritAttrs: !1,
23
+ __name: "p-dropdown-select",
24
+ props: {
25
+ modelValue: {
26
+ type: [String, Number, Boolean, Array, Object],
27
+ default: null
28
+ },
29
+ /**
30
+ * `p-dropdown-select v-model normally works with a string or an array of strings (for multiple mode).
31
+ * Setting this prop to `true` will switch the behavior to an object (or array of objects) for the v-model value.
32
+ * e.g `:value="{ value: 1, text: 'option text' }"`
33
+ */
34
+ valueIsObject: {
35
+ type: Boolean,
36
+ default: !1
37
+ },
38
+ /**
39
+ * Can be an array of objects or array of strings. When using objects, will look for a text - value pair.
40
+ * This can be changed using the item-text, item-value props.
41
+ */
42
+ items: {
43
+ type: Array,
44
+ default: () => []
45
+ },
46
+ label: {
47
+ type: String,
48
+ default: ""
49
+ },
50
+ errorMsg: {
51
+ type: String,
52
+ default: ""
53
+ },
54
+ required: {
55
+ type: Boolean,
56
+ default: !1
57
+ },
58
+ size: {
59
+ type: String,
60
+ default: "md",
61
+ validator(t) {
62
+ return Object.keys(L).includes(t);
63
+ }
64
+ },
65
+ /**
66
+ * Set property of **items**’s text value
67
+ */
68
+ itemText: {
69
+ type: String,
70
+ default: "text"
71
+ },
72
+ /**
73
+ * Set property of **items**’s value - must be primitive.
74
+ */
75
+ itemValue: {
76
+ type: [String, Number],
77
+ default: "value"
78
+ },
79
+ /**
80
+ * itemSize sets the list item's height and it's REQUIRED if a custom item template is used
81
+ * https://github.com/Akryum/vue-virtual-scroller/tree/v1/packages/vue-virtual-scroller#props
82
+ */
83
+ itemSize: {
84
+ type: Number,
85
+ default: null
86
+ },
87
+ /**
88
+ * The number of items visible in the list
89
+ */
90
+ itemsVisible: {
91
+ type: Number,
92
+ default: 7
93
+ },
94
+ dropdownMenuAttrs: {
95
+ type: Object,
96
+ default: () => ({})
97
+ },
98
+ dropdownMenuClass: {
99
+ type: String,
100
+ default: "overflow-x-hidden"
101
+ },
102
+ dropdownMenuStyle: {
103
+ type: Object,
104
+ default: () => ({})
105
+ },
106
+ pDropdownProps: {
107
+ type: Object,
108
+ default: () => ({})
109
+ },
110
+ searchable: {
111
+ type: Boolean,
112
+ default: !1
113
+ },
114
+ /**
115
+ * Enables multiple selection
116
+ */
117
+ multiple: {
118
+ type: Boolean,
119
+ default: !1
120
+ },
121
+ /**
122
+ * Dropdown button text
123
+ */
124
+ placeholder: {
125
+ type: String,
126
+ default: ""
127
+ },
128
+ /**
129
+ * Placeholder for the search field
130
+ */
131
+ placeholderSearch: {
132
+ type: String,
133
+ default: ""
134
+ },
135
+ /**
136
+ * Setting it to `true` will display the selected options at the top of the list
137
+ */
138
+ selectedTopShown: {
139
+ type: Boolean,
140
+ default: !1
141
+ }
142
+ },
143
+ emits: ["update:modelValue", "select"],
144
+ setup(t, { emit: G }) {
145
+ const J = G, m = t, K = () => new Promise((o) => requestAnimationFrame(() => requestAnimationFrame(o))), Q = (o) => new Promise((s) => setTimeout(s, o || 0)), X = {
146
+ triggerStyle: { display: "block" },
147
+ triggers: [],
148
+ distance: 2,
149
+ placement: "bottom-end",
150
+ noAutoFocus: !0,
151
+ enableArrowNavigation: !1
152
+ }, N = d("auto"), _ = d({ paddingTop: 0, paddingBottom: 0 }), p = d(!1);
153
+ let x = null;
154
+ const B = d({ maxHeight: "none" }), h = d(null), A = d(null), D = d(null), b = xe(), O = d(null), { labelClasses: ee, selectClasses: te, errorMsgClasses: le } = Ve(m), {
155
+ LIST_ITEM_CLASS: se,
156
+ LIST_ITEM_ACTIVE_CLASS: oe,
157
+ selectedItems: u,
158
+ computedItems: w,
159
+ computedItemSize: ne,
160
+ computedInsideSelected: ie,
161
+ internalItems: P,
162
+ internalValue: ae,
163
+ search: f,
164
+ rowVirtualizer: j,
165
+ getValue: g,
166
+ getText: I,
167
+ isSelected: z,
168
+ setupNavigationSvc: re,
169
+ destroyNavigationSvc: ue,
170
+ select: ce,
171
+ onMousemove: E,
172
+ scrollToActiveItem: de,
173
+ putSelectedItemsOnTop: me,
174
+ selectAll: C,
175
+ clearAll: F
176
+ } = Le(m, A, O, J), pe = k(() => Te(m.dropdownMenuAttrs, ["class", "style"])), fe = k(() => ({ ...m.dropdownMenuStyle, width: N.value })), ye = k(() => {
177
+ const { class: o, style: s, ...c } = b;
178
+ return c;
179
+ }), ve = k(() => b.style);
180
+ be(
181
+ p,
182
+ (o) => {
183
+ o && me();
184
+ },
185
+ {
186
+ immediate: !0
187
+ }
188
+ ), we(() => {
189
+ x = new ResizeObserver((o) => {
190
+ o.forEach((s) => {
191
+ const c = s.contentRect;
192
+ N.value = c.width + "px" || "auto";
193
+ });
194
+ }), x.observe(h.value);
195
+ }), Ce(() => {
196
+ h.value && x && x.unobserve(h.value);
197
+ });
198
+ const he = async () => {
199
+ var s, c;
200
+ const o = ((s = D.value) == null ? void 0 : s.clientHeight) || 0;
201
+ B.value = { maxHeight: `${ne.value * m.itemsVisible - o}px` }, f.value = "", re(), m.searchable && (await Q(), await K(), (c = A.value) == null || c.$el.querySelector("input").focus()), de();
202
+ }, ge = () => {
203
+ var o;
204
+ p.value = !1, ue(), ((o = h.value) == null ? void 0 : o.querySelector("button")).focus();
205
+ };
206
+ return (o, s) => {
207
+ const c = ke("close-popper");
208
+ return n(), i("div", {
209
+ ref_key: "formControl",
210
+ ref: h,
211
+ class: r([{ hidden: e(b).hidden }, e(b).class]),
212
+ "data-has-error": !!t.errorMsg,
213
+ style: S(ve.value),
214
+ "aria-label": "Dropdown select"
215
+ }, [
216
+ t.label ? (n(), i("label", {
217
+ key: 0,
218
+ class: r(e(ee))
219
+ }, y(t.label), 3)) : v("", !0),
220
+ R(ze, T({ shown: p.value }, { ...X, ...t.pDropdownProps }, {
221
+ class: "relative flex w-full items-center justify-center",
222
+ onApplyShow: he,
223
+ onApplyHide: ge
224
+ }), {
225
+ popper: q(() => [
226
+ a("div", T(pe.value, {
227
+ class: t.dropdownMenuClass,
228
+ style: fe.value,
229
+ "p-select-list": "",
230
+ role: "listbox"
231
+ }), [
232
+ t.multiple || t.searchable ? (n(), i("div", Oe, [
233
+ t.multiple ? (n(), i("div", {
234
+ key: 0,
235
+ ref_key: "actionsContainer",
236
+ ref: D,
237
+ class: "flex flex-row justify-between text-xs font-semibold text-primary"
238
+ }, [
239
+ a("p", Pe, y(e(w).length) + " items", 1),
240
+ a("div", je, [
241
+ e(w).length === e(P).length ? (n(), i("a", {
242
+ key: 0,
243
+ class: r([
244
+ e(u).length !== e(P).length ? "cursor-pointer" : "pointer-events-none opacity-50"
245
+ ]),
246
+ onClick: s[1] || (s[1] = //@ts-ignore
247
+ (...l) => e(C) && e(C)(...l))
248
+ }, " Select all ", 2)) : (n(), i("a", {
249
+ key: 1,
250
+ class: r([e(ie) ? "pointer-events-none opacity-50" : "cursor-pointer"]),
251
+ onClick: s[2] || (s[2] = //@ts-ignore
252
+ (...l) => e(C) && e(C)(...l))
253
+ }, " Select all filtered ", 2)),
254
+ Ee,
255
+ a("a", {
256
+ class: r([e(u).length ? "cursor-pointer" : "pointer-events-none opacity-50"]),
257
+ onClick: s[3] || (s[3] = //@ts-ignore
258
+ (...l) => e(F) && e(F)(...l))
259
+ }, " Clear all ", 2)
260
+ ])
261
+ ], 512)) : v("", !0),
262
+ t.searchable ? (n(), i("div", {
263
+ key: 1,
264
+ class: r([{ "mt-3": t.multiple }])
265
+ }, [
266
+ R(Me, {
267
+ ref_key: "inputSearch",
268
+ ref: A,
269
+ modelValue: e(f),
270
+ "onUpdate:modelValue": s[4] || (s[4] = (l) => Ae(f) ? f.value = l : null),
271
+ size: t.size,
272
+ placeholder: t.placeholderSearch
273
+ }, null, 8, ["modelValue", "size", "placeholder"])
274
+ ], 2)) : v("", !0)
275
+ ])) : v("", !0),
276
+ a("div", {
277
+ ref_key: "virtualizerRef",
278
+ ref: O,
279
+ style: S(B.value),
280
+ class: r(["overflow-y-auto", { "mt-3": t.multiple || t.searchable }])
281
+ }, [
282
+ a("div", {
283
+ class: "relative w-full",
284
+ "p-select-list-options": "",
285
+ style: S({ height: `${e(j).getTotalSize()}px` }),
286
+ onMousemove: s[5] || (s[5] = //@ts-ignore
287
+ (...l) => e(E) && e(E)(...l))
288
+ }, [
289
+ (n(!0), i(U, null, Z(e(j).getVirtualItems(), (l) => (n(), i("div", {
290
+ key: l.index,
291
+ class: "absolute left-0 top-0 w-full",
292
+ "p-select-list-option": "",
293
+ role: "option",
294
+ style: S({ height: `${l.size}px`, transform: `translateY(${l.start}px)` })
295
+ }, [
296
+ W((n(), i("div", {
297
+ class: r([e(se), { [e(oe)]: e(z)(e(g)(l.index)) }]),
298
+ "p-select-list-option-item": "",
299
+ style: S(_.value),
300
+ onClick: (M) => e(ce)(M, e(g)(l.index))
301
+ }, [
302
+ a("div", {
303
+ class: r(["flex items-center", { [e(L)[t.size]]: !t.itemSize }])
304
+ }, [
305
+ V(o.$slots, "item", {
306
+ item: e(w)[l.index],
307
+ isItemSelected: e(z)(e(g)(l.index)),
308
+ itemTextSplit: e(Y)(e($)(e(I)(l.index)), e(f))
309
+ }, () => [
310
+ a("div", {
311
+ class: "truncate text-p-purple-60",
312
+ title: e($)(e(I)(l.index))
313
+ }, [
314
+ (n(!0), i(U, null, Z(e(Y)(e($)(e(I)(l.index)), e(f)), (M, H) => (n(), i("span", {
315
+ key: `${e(g)(l.index)}_${H}`,
316
+ class: r({ "bg-p-blue-20": H === 1 })
317
+ }, y(M), 3))), 128))
318
+ ], 8, He)
319
+ ]),
320
+ e(z)(e(g)(l.index)) ? (n(), i("img", Re)) : v("", !0)
321
+ ], 2)
322
+ ], 14, Fe)), [
323
+ [c, !t.multiple]
324
+ ])
325
+ ], 4))), 128))
326
+ ], 36),
327
+ e(w).length ? v("", !0) : V(o.$slots, "no-items", { key: 0 }, () => [
328
+ a("div", {
329
+ class: r(["flex items-center justify-center", e(L)[t.size]])
330
+ }, "No items found", 2)
331
+ ])
332
+ ], 6)
333
+ ], 16)
334
+ ]),
335
+ default: q(() => [
336
+ a("button", T(ye.value, {
337
+ ref: "button",
338
+ type: "button",
339
+ class: ["w-full", e(te), p.value ? "border-primary" : ""],
340
+ role: "button",
341
+ "aria-haspopup": "listbox",
342
+ onClick: s[0] || (s[0] = (l) => p.value = !p.value)
343
+ }), [
344
+ !e(ae).length || !e(u).length ? (n(), i("div", Be, y(t.placeholder || " "), 1)) : V(o.$slots, "selected-item", {
345
+ key: 1,
346
+ item: t.multiple ? e(u) : e(u)[0]
347
+ }, () => [
348
+ a("div", De, y(t.multiple && e(u).length > 1 ? `${e(u).length} option${e(u).length > 1 ? "s" : ""} selected` : e(u)[0][t.itemText]), 1)
349
+ ])
350
+ ], 16)
351
+ ]),
352
+ _: 3
353
+ }, 16, ["shown"]),
354
+ W(a("div", {
355
+ class: r(e(le))
356
+ }, y(t.errorMsg), 3), [
357
+ [Ie, t.errorMsg]
358
+ ])
359
+ ], 14, Ne);
360
+ };
361
+ }
362
+ });
363
+ export {
364
+ $e as _,
365
+ Xe as a
366
+ };
@@ -0,0 +1,45 @@
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",
8
+ __name: "p-input-percent",
9
+ props: {
10
+ modelValue: {
11
+ type: [Number, String],
12
+ default: null
13
+ },
14
+ size: {
15
+ type: String,
16
+ default: "md"
17
+ }
18
+ },
19
+ emits: ["update:modelValue"],
20
+ setup(t, { emit: a }) {
21
+ const n = {
22
+ sm: "text-sm h-8 left-2",
23
+ md: "text-base h-10 left-3",
24
+ 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)
28
+ });
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"]));
41
+ }
42
+ });
43
+ export {
44
+ C as _
45
+ };
@@ -0,0 +1,61 @@
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 = {
4
+ key: 1,
5
+ class: "text-sm font-medium text-p-gray-40"
6
+ }, S = /* @__PURE__ */ m({
7
+ name: "PPaginationInfo",
8
+ __name: "p-pagination-info",
9
+ props: {
10
+ /**
11
+ * The current page.
12
+ */
13
+ currentPage: {
14
+ type: Number,
15
+ default: 0
16
+ },
17
+ /**
18
+ * The amount of data pagination iterates through.
19
+ */
20
+ count: {
21
+ type: Number,
22
+ default: 0
23
+ },
24
+ /**
25
+ * The amount of data to be displayed at 1 page. Used to calculate the `from` and `to` limits.
26
+ */
27
+ pageSize: {
28
+ type: Number,
29
+ default: 0
30
+ },
31
+ /**
32
+ * Whether the pagination is loading.
33
+ */
34
+ loading: {
35
+ type: Boolean,
36
+ default: !1
37
+ }
38
+ },
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;
46
+ });
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
+ ]));
57
+ }
58
+ });
59
+ export {
60
+ S as _
61
+ };
@@ -0,0 +1,93 @@
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 = {
5
+ key: 1,
6
+ 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",
13
+ __name: "p-pagination",
14
+ props: {
15
+ /**
16
+ * The current page.
17
+ */
18
+ modelValue: {
19
+ type: Number,
20
+ default: null
21
+ },
22
+ /**
23
+ * The amount of data pagination should iterate through.
24
+ */
25
+ count: {
26
+ type: Number,
27
+ default: 0
28
+ },
29
+ /**
30
+ * The amount of data to be displayed at 1 page. Used to calculate the length of pagination.
31
+ */
32
+ pageSize: {
33
+ type: Number,
34
+ default: 10
35
+ },
36
+ /**
37
+ * The amount of pages to be displayed before and after the current page.
38
+ */
39
+ pageOffset: {
40
+ type: Number,
41
+ default: 2
42
+ },
43
+ /**
44
+ * Whether the pagination is loading.
45
+ */
46
+ loading: {
47
+ type: Boolean,
48
+ default: !1
49
+ }
50
+ },
51
+ 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);
55
+ };
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
+ }
90
+ });
91
+ export {
92
+ F as _
93
+ };
@@ -0,0 +1,59 @@
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",
5
+ __name: "p-ring-loader",
6
+ props: {
7
+ size: {
8
+ type: Number,
9
+ default: 80
10
+ },
11
+ color: {
12
+ type: String,
13
+ default: $("primary")
14
+ },
15
+ duration: {
16
+ type: String,
17
+ default: "1.2s",
18
+ validator(t) {
19
+ return /^\d*\.?\d+(s|ms)$/.test(t);
20
+ }
21
+ }
22
+ },
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));
55
+ }
56
+ });
57
+ export {
58
+ _
59
+ };