@pequity/squirrel 1.0.20 → 1.0.21-beta.1

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 +9 -0
  2. package/dist/cjs/chunks/p-action-bar.js +60 -0
  3. package/dist/cjs/chunks/p-card.js +28 -0
  4. package/dist/cjs/chunks/p-checkbox.js +24 -0
  5. package/dist/cjs/chunks/p-dropdown-select.js +414 -0
  6. package/dist/cjs/chunks/p-input-percent.js +53 -0
  7. package/dist/cjs/chunks/p-pagination-info.js +66 -0
  8. package/dist/cjs/chunks/p-pagination.js +122 -0
  9. package/dist/cjs/chunks/p-ring-loader.js +81 -0
  10. package/dist/cjs/chunks/p-select-btn.js +97 -0
  11. package/dist/cjs/chunks/p-select.js +123 -0
  12. package/dist/cjs/chunks/p-table-loader.js +70 -0
  13. package/dist/cjs/chunks/p-tabs.js +52 -0
  14. package/dist/cjs/config.js +105 -0
  15. package/dist/cjs/currency.js +9 -0
  16. package/dist/cjs/dom.js +27 -0
  17. package/dist/cjs/index.js +976 -0
  18. package/dist/cjs/inputClassesMixin.js +50 -0
  19. package/dist/cjs/inputClassesShared.js +76 -0
  20. package/dist/cjs/listKeyboardNavigation.js +110 -0
  21. package/dist/cjs/number.js +9 -0
  22. package/dist/cjs/object.js +4 -0
  23. package/dist/cjs/p-action-bar.js +3 -0
  24. package/dist/cjs/p-alert.js +65 -0
  25. package/dist/cjs/p-avatar.js +71 -0
  26. package/dist/cjs/p-btn.js +361 -0
  27. package/dist/cjs/p-card.js +3 -0
  28. package/dist/cjs/p-checkbox.js +3 -0
  29. package/dist/cjs/p-chips.js +110 -0
  30. package/dist/cjs/p-close-btn.js +36 -0
  31. package/dist/cjs/p-date-picker.js +139 -0
  32. package/dist/cjs/p-drawer.js +253 -0
  33. package/dist/cjs/p-dropdown-select.js +3 -0
  34. package/dist/cjs/p-dropdown.js +138 -0
  35. package/dist/cjs/p-file-upload.js +21 -0
  36. package/dist/cjs/p-info-icon.js +35 -0
  37. package/dist/cjs/p-inline-date-picker.js +142 -0
  38. package/dist/cjs/p-input-number.js +146 -0
  39. package/dist/cjs/p-input-percent.js +3 -0
  40. package/dist/cjs/p-input-search.js +110 -0
  41. package/dist/cjs/p-input.js +89 -0
  42. package/dist/cjs/p-loading.js +38 -0
  43. package/dist/cjs/p-modal.js +369 -0
  44. package/dist/cjs/p-pagination-info.js +3 -0
  45. package/dist/cjs/p-pagination.js +3 -0
  46. package/dist/cjs/p-progress-bar.js +41 -0
  47. package/dist/cjs/p-ring-loader.js +3 -0
  48. package/dist/cjs/p-select-btn.js +3 -0
  49. package/dist/cjs/p-select-list.js +4 -0
  50. package/dist/cjs/p-select-pill.js +111 -0
  51. package/dist/cjs/p-select.js +3 -0
  52. package/dist/cjs/p-skeleton-loader.js +73 -0
  53. package/dist/cjs/p-table-filter-icon.js +20 -0
  54. package/dist/cjs/p-table-header-cell.js +75 -0
  55. package/dist/cjs/p-table-loader.js +3 -0
  56. package/dist/cjs/p-table-sort.js +8 -0
  57. package/dist/cjs/p-table-td.js +88 -0
  58. package/dist/cjs/p-table.js +12 -0
  59. package/dist/cjs/p-tabs.js +3 -0
  60. package/dist/cjs/p-textarea.js +73 -0
  61. package/dist/cjs/p-toggle.js +114 -0
  62. package/dist/cjs/pagination.js +29 -0
  63. package/dist/cjs/string.js +12 -0
  64. package/dist/cjs/tailwind.js +4353 -0
  65. package/dist/cjs/text.js +16 -0
  66. package/dist/cjs/useInputClasses.js +44 -0
  67. package/dist/cjs/usePLoading.js +35 -0
  68. package/dist/cjs/usePModal.js +21 -0
  69. package/dist/cjs/usePTableColResize.js +81 -0
  70. package/dist/cjs/usePTableRowVirtualizer.js +31 -0
  71. package/dist/cjs/useSelectList.js +256 -0
  72. package/dist/es/chunks/_plugin-vue_export-helper.js +10 -0
  73. package/dist/es/chunks/p-action-bar.js +61 -0
  74. package/dist/es/chunks/p-card.js +29 -0
  75. package/dist/es/chunks/p-checkbox.js +25 -0
  76. package/dist/es/chunks/p-dropdown-select.js +415 -0
  77. package/dist/es/chunks/p-input-percent.js +54 -0
  78. package/dist/es/chunks/p-pagination-info.js +67 -0
  79. package/dist/es/chunks/p-pagination.js +123 -0
  80. package/dist/es/chunks/p-ring-loader.js +82 -0
  81. package/dist/es/chunks/p-select-btn.js +98 -0
  82. package/dist/es/chunks/p-select.js +124 -0
  83. package/dist/es/chunks/p-table-loader.js +71 -0
  84. package/dist/es/chunks/p-tabs.js +53 -0
  85. package/dist/es/config.js +105 -0
  86. package/dist/es/currency.js +9 -0
  87. package/dist/es/dom.js +27 -0
  88. package/dist/es/index.js +978 -0
  89. package/dist/es/inputClassesMixin.js +51 -0
  90. package/dist/es/inputClassesShared.js +76 -0
  91. package/dist/es/listKeyboardNavigation.js +110 -0
  92. package/dist/es/number.js +9 -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 +66 -0
  96. package/dist/es/p-avatar.js +72 -0
  97. package/dist/es/p-btn.js +362 -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 +111 -0
  101. package/dist/es/p-close-btn.js +37 -0
  102. package/dist/es/p-date-picker.js +140 -0
  103. package/dist/es/p-drawer.js +254 -0
  104. package/dist/es/p-dropdown-select.js +4 -0
  105. package/dist/es/p-dropdown.js +139 -0
  106. package/dist/es/p-file-upload.js +21 -0
  107. package/dist/es/p-info-icon.js +36 -0
  108. package/dist/es/p-inline-date-picker.js +143 -0
  109. package/dist/es/p-input-number.js +147 -0
  110. package/dist/es/p-input-percent.js +4 -0
  111. package/dist/es/p-input-search.js +111 -0
  112. package/dist/es/p-input.js +90 -0
  113. package/dist/es/p-loading.js +39 -0
  114. package/dist/es/p-modal.js +370 -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 +42 -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 +112 -0
  122. package/dist/es/p-select.js +4 -0
  123. package/dist/es/p-skeleton-loader.js +74 -0
  124. package/dist/es/p-table-filter-icon.js +21 -0
  125. package/dist/es/p-table-header-cell.js +76 -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 +89 -0
  129. package/dist/es/p-table.js +12 -0
  130. package/dist/es/p-tabs.js +4 -0
  131. package/dist/es/p-textarea.js +74 -0
  132. package/dist/es/p-toggle.js +115 -0
  133. package/dist/es/pagination.js +29 -0
  134. package/dist/es/string.js +12 -0
  135. package/dist/es/tailwind.js +4353 -0
  136. package/dist/es/text.js +16 -0
  137. package/dist/es/useInputClasses.js +44 -0
  138. package/dist/es/usePLoading.js +35 -0
  139. package/dist/es/usePModal.js +21 -0
  140. package/dist/es/usePTableColResize.js +81 -0
  141. package/dist/es/usePTableRowVirtualizer.js +31 -0
  142. package/dist/es/useSelectList.js +256 -0
  143. package/dist/style.css +2124 -1
  144. package/package.json +26 -24
  145. package/dist/squirrel.cjs.js +0 -5
  146. package/dist/squirrel.es.js +0 -8220
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ const _export_sfc = (sfc, props) => {
3
+ const target = sfc.__vccOpts || sfc;
4
+ for (const [key, val] of props) {
5
+ target[key] = val;
6
+ }
7
+ return target;
8
+ };
9
+ exports._export_sfc = _export_sfc;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ const vue = require("vue");
3
+ const pBtn = require("../p-btn.js");
4
+ const pCloseBtn = require("../p-close-btn.js");
5
+ const _hoisted_1 = {
6
+ class: "fixed bottom-6 left-1/2 flex h-12 -translate-x-1/2 select-none flex-row items-center rounded-lg bg-p-purple-60 px-2 text-sm font-medium text-white",
7
+ role: "alertdialog"
8
+ };
9
+ const _hoisted_2 = { class: "px-3" };
10
+ const _hoisted_3 = /* @__PURE__ */ vue.createElementVNode("div", { class: "mx-4 h-9 w-0.5 rounded bg-p-purple-50" }, null, -1);
11
+ const _hoisted_4 = { class: "flex" };
12
+ const _hoisted_5 = { class: "flex items-center gap-2 px-1 py-0.5" };
13
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
14
+ __name: "p-action-bar",
15
+ props: {
16
+ label: {
17
+ type: String,
18
+ required: true
19
+ },
20
+ actions: {
21
+ type: Array,
22
+ required: true
23
+ }
24
+ },
25
+ emits: ["click:dismiss", "click:action"],
26
+ setup(__props) {
27
+ return (_ctx, _cache) => {
28
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
29
+ vue.createVNode(pCloseBtn, {
30
+ variant: "dark",
31
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click:dismiss"))
32
+ }),
33
+ vue.createElementVNode("p", _hoisted_2, vue.toDisplayString(__props.label), 1),
34
+ _hoisted_3,
35
+ vue.createElementVNode("div", _hoisted_4, [
36
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.actions, (action) => {
37
+ return vue.openBlock(), vue.createBlock(pBtn, {
38
+ key: `action-${action.name}`,
39
+ size: "sm",
40
+ type: "secondary-ghost-dark",
41
+ onClick: ($event) => _ctx.$emit("click:action", action.name)
42
+ }, {
43
+ default: vue.withCtx(() => [
44
+ vue.createElementVNode("div", _hoisted_5, [
45
+ action.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(action.icon), {
46
+ key: 0,
47
+ class: "h-4 w-4"
48
+ })) : vue.createCommentVNode("", true),
49
+ vue.createElementVNode("div", null, vue.toDisplayString(action.label), 1)
50
+ ])
51
+ ]),
52
+ _: 2
53
+ }, 1032, ["onClick"]);
54
+ }), 128))
55
+ ])
56
+ ]);
57
+ };
58
+ }
59
+ });
60
+ exports._sfc_main = _sfc_main;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ const vue = require("vue");
3
+ const _hoisted_1 = { class: "border border-p-gray-30 bg-surface px-6 pt-6" };
4
+ const titleClass = "text-xl font-medium leading-none text-p-purple-60";
5
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
6
+ ...{ name: "PCard" },
7
+ __name: "p-card",
8
+ props: {
9
+ title: {
10
+ type: String,
11
+ default: ""
12
+ }
13
+ },
14
+ setup(__props) {
15
+ return (_ctx, _cache) => {
16
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
17
+ vue.renderSlot(_ctx.$slots, "title", { titleClass }, () => [
18
+ __props.title ? (vue.openBlock(), vue.createElementBlock("div", {
19
+ key: 0,
20
+ class: vue.normalizeClass(titleClass)
21
+ }, vue.toDisplayString(__props.title), 1)) : vue.createCommentVNode("", true)
22
+ ]),
23
+ vue.renderSlot(_ctx.$slots, "default")
24
+ ]);
25
+ };
26
+ }
27
+ });
28
+ exports._sfc_main = _sfc_main;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ const vue = require("vue");
3
+ const _hoisted_1 = ["checked"];
4
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
5
+ __name: "p-checkbox",
6
+ props: {
7
+ modelValue: {
8
+ type: Boolean,
9
+ default: false
10
+ }
11
+ },
12
+ emits: ["update:modelValue"],
13
+ setup(__props) {
14
+ return (_ctx, _cache) => {
15
+ return vue.openBlock(), vue.createElementBlock("input", {
16
+ type: "checkbox",
17
+ class: "cursor-pointer accent-p-blue-50",
18
+ checked: __props.modelValue,
19
+ onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event.target.checked))
20
+ }, null, 40, _hoisted_1);
21
+ };
22
+ }
23
+ });
24
+ exports._sfc_main = _sfc_main;
@@ -0,0 +1,414 @@
1
+ "use strict";
2
+ const vue = require("vue");
3
+ const pDropdown = require("../p-dropdown.js");
4
+ const pInputSearch = require("../p-input-search.js");
5
+ const pSelectList = require("../p-select-list.js");
6
+ const lodashEs = require("lodash-es");
7
+ const text = require("../text.js");
8
+ const string = require("../string.js");
9
+ const useInputClasses = require("../useInputClasses.js");
10
+ const useSelectList = require("../useSelectList.js");
11
+ const _imports_0 = "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";
12
+ const _hoisted_1 = ["data-has-error"];
13
+ const _hoisted_2 = {
14
+ key: 0,
15
+ class: "truncate text-left text-p-gray-40"
16
+ };
17
+ const _hoisted_3 = { class: "truncate text-left" };
18
+ const _hoisted_4 = {
19
+ key: 0,
20
+ class: "mt-3 px-3"
21
+ };
22
+ const _hoisted_5 = { class: "text-p-purple-60" };
23
+ const _hoisted_6 = { class: "flex flex-row" };
24
+ const _hoisted_7 = /* @__PURE__ */ vue.createElementVNode("span", { class: "px-1 leading-none" }, ".", -1);
25
+ const _hoisted_8 = ["onClick"];
26
+ const _hoisted_9 = ["title"];
27
+ const _hoisted_10 = {
28
+ key: 0,
29
+ class: "ml-auto fill-p-purple-60 pl-2",
30
+ src: _imports_0
31
+ };
32
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
33
+ ...{
34
+ name: "PDropdownSelect",
35
+ inheritAttrs: false
36
+ },
37
+ __name: "p-dropdown-select",
38
+ props: {
39
+ modelValue: {
40
+ type: [String, Number, Boolean, Array, Object],
41
+ default: null
42
+ },
43
+ /**
44
+ * `p-dropdown-select v-model normally works with a string or an array of strings (for multiple mode).
45
+ * Setting this prop to `true` will switch the behavior to an object (or array of objects) for the v-model value.
46
+ * e.g `:value="{ value: 1, text: 'option text' }"`
47
+ */
48
+ valueIsObject: {
49
+ type: Boolean,
50
+ default: false
51
+ },
52
+ /**
53
+ * Can be an array of objects or array of strings. When using objects, will look for a text - value pair.
54
+ * This can be changed using the item-text, item-value props.
55
+ */
56
+ items: {
57
+ type: Array,
58
+ default: () => []
59
+ },
60
+ label: {
61
+ type: String,
62
+ default: ""
63
+ },
64
+ errorMsg: {
65
+ type: String,
66
+ default: ""
67
+ },
68
+ required: {
69
+ type: Boolean,
70
+ default: false
71
+ },
72
+ size: {
73
+ type: String,
74
+ default: "md",
75
+ validator(value) {
76
+ return Object.keys(pSelectList.SIZES).includes(value);
77
+ }
78
+ },
79
+ /**
80
+ * Set property of **items**’s text value
81
+ */
82
+ itemText: {
83
+ type: String,
84
+ default: "text"
85
+ },
86
+ /**
87
+ * Set property of **items**’s value - must be primitive.
88
+ */
89
+ itemValue: {
90
+ type: [String, Number],
91
+ default: "value"
92
+ },
93
+ /**
94
+ * itemSize sets the list item's height and it's REQUIRED if a custom item template is used
95
+ * https://github.com/Akryum/vue-virtual-scroller/tree/v1/packages/vue-virtual-scroller#props
96
+ */
97
+ itemSize: {
98
+ type: Number,
99
+ default: null
100
+ },
101
+ /**
102
+ * The number of items visible in the list
103
+ */
104
+ itemsVisible: {
105
+ type: Number,
106
+ default: 7
107
+ },
108
+ dropdownMenuAttrs: {
109
+ type: Object,
110
+ default: () => ({})
111
+ },
112
+ dropdownMenuClass: {
113
+ type: String,
114
+ default: "overflow-x-hidden"
115
+ },
116
+ dropdownMenuStyle: {
117
+ type: Object,
118
+ default: () => ({})
119
+ },
120
+ pDropdownProps: {
121
+ type: Object,
122
+ default: () => ({})
123
+ },
124
+ searchable: {
125
+ type: Boolean,
126
+ default: false
127
+ },
128
+ /**
129
+ * Enables multiple selection
130
+ */
131
+ multiple: {
132
+ type: Boolean,
133
+ default: false
134
+ },
135
+ /**
136
+ * Dropdown button text
137
+ */
138
+ placeholder: {
139
+ type: String,
140
+ default: ""
141
+ },
142
+ /**
143
+ * Placeholder for the search field
144
+ */
145
+ placeholderSearch: {
146
+ type: String,
147
+ default: ""
148
+ },
149
+ /**
150
+ * Setting it to `true` will display the selected options at the top of the list
151
+ */
152
+ selectedTopShown: {
153
+ type: Boolean,
154
+ default: false
155
+ }
156
+ },
157
+ emits: ["update:modelValue", "select"],
158
+ setup(__props, { emit: __emit }) {
159
+ const emit = __emit;
160
+ const props = __props;
161
+ const nextFrame = () => new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve)));
162
+ const nextLoop = (ms) => new Promise((resolve) => setTimeout(resolve, ms || 0));
163
+ const P_DROPDOWN_DEFAULTS = {
164
+ triggerStyle: { display: "block" },
165
+ triggers: [],
166
+ distance: 2,
167
+ placement: "bottom-end",
168
+ noAutoFocus: true,
169
+ enableArrowNavigation: false
170
+ };
171
+ const width = vue.ref("auto");
172
+ const listItemStyle = vue.ref({ paddingTop: 0, paddingBottom: 0 });
173
+ const dropdownShow = vue.ref(false);
174
+ let observer = null;
175
+ const scrollerStyle = vue.ref({ maxHeight: "none" });
176
+ const formControl = vue.ref(null);
177
+ const inputSearch = vue.ref(null);
178
+ const actionsContainer = vue.ref(null);
179
+ const $attrs = vue.useAttrs();
180
+ const virtualizerRef = vue.ref(null);
181
+ const { labelClasses, selectClasses, errorMsgClasses } = useInputClasses.useInputClasses(props);
182
+ const {
183
+ LIST_ITEM_CLASS,
184
+ LIST_ITEM_ACTIVE_CLASS,
185
+ selectedItems,
186
+ computedItems,
187
+ computedItemSize,
188
+ computedInsideSelected,
189
+ internalItems,
190
+ internalValue,
191
+ search,
192
+ rowVirtualizer,
193
+ getValue,
194
+ getText,
195
+ isSelected,
196
+ setupNavigationSvc,
197
+ destroyNavigationSvc,
198
+ select,
199
+ onMousemove,
200
+ scrollToActiveItem,
201
+ putSelectedItemsOnTop,
202
+ selectAll,
203
+ clearAll
204
+ } = useSelectList.useSelectList(props, inputSearch, virtualizerRef, emit);
205
+ const menuAttrs = vue.computed(() => lodashEs.omit(props.dropdownMenuAttrs, ["class", "style"]));
206
+ const menuStyle = vue.computed(() => ({ ...props.dropdownMenuStyle, width: width.value }));
207
+ const attrs = vue.computed(() => {
208
+ const { class: classes, style: style2, ...rest } = $attrs;
209
+ return rest;
210
+ });
211
+ const style = vue.computed(() => $attrs.style);
212
+ vue.watch(
213
+ dropdownShow,
214
+ (nV) => {
215
+ nV && putSelectedItemsOnTop();
216
+ },
217
+ {
218
+ immediate: true
219
+ }
220
+ );
221
+ vue.onMounted(() => {
222
+ observer = new ResizeObserver((entries) => {
223
+ entries.forEach((entry) => {
224
+ const rect = entry.contentRect;
225
+ width.value = rect.width + "px" || "auto";
226
+ });
227
+ });
228
+ observer.observe(formControl.value);
229
+ });
230
+ vue.onUnmounted(() => {
231
+ formControl.value && observer && observer.unobserve(formControl.value);
232
+ });
233
+ const onShow = async () => {
234
+ var _a, _b;
235
+ const actionsContainerHeight = ((_a = actionsContainer.value) == null ? void 0 : _a.clientHeight) || 0;
236
+ scrollerStyle.value = { maxHeight: `${computedItemSize.value * props.itemsVisible - actionsContainerHeight}px` };
237
+ search.value = "";
238
+ setupNavigationSvc();
239
+ if (props.searchable) {
240
+ await nextLoop();
241
+ await nextFrame();
242
+ (_b = inputSearch.value) == null ? void 0 : _b.$el.querySelector("input").focus();
243
+ }
244
+ scrollToActiveItem();
245
+ };
246
+ const onHide = () => {
247
+ var _a;
248
+ dropdownShow.value = false;
249
+ destroyNavigationSvc();
250
+ ((_a = formControl.value) == null ? void 0 : _a.querySelector("button")).focus();
251
+ };
252
+ return (_ctx, _cache) => {
253
+ const _directive_close_popper = vue.resolveDirective("close-popper");
254
+ return vue.openBlock(), vue.createElementBlock("div", {
255
+ ref_key: "formControl",
256
+ ref: formControl,
257
+ class: vue.normalizeClass([{ hidden: vue.unref($attrs).hidden }, vue.unref($attrs).class]),
258
+ "data-has-error": !!__props.errorMsg,
259
+ style: vue.normalizeStyle(style.value),
260
+ "aria-label": "Dropdown select"
261
+ }, [
262
+ __props.label ? (vue.openBlock(), vue.createElementBlock("label", {
263
+ key: 0,
264
+ class: vue.normalizeClass(vue.unref(labelClasses))
265
+ }, vue.toDisplayString(__props.label), 3)) : vue.createCommentVNode("", true),
266
+ vue.createVNode(pDropdown, vue.mergeProps({ shown: dropdownShow.value }, { ...P_DROPDOWN_DEFAULTS, ...__props.pDropdownProps }, {
267
+ class: "relative flex w-full items-center justify-center",
268
+ onApplyShow: onShow,
269
+ onApplyHide: onHide
270
+ }), {
271
+ popper: vue.withCtx(() => [
272
+ vue.createElementVNode("div", vue.mergeProps(menuAttrs.value, {
273
+ class: __props.dropdownMenuClass,
274
+ style: menuStyle.value,
275
+ "p-select-list": "",
276
+ role: "listbox"
277
+ }), [
278
+ __props.multiple || __props.searchable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [
279
+ __props.multiple ? (vue.openBlock(), vue.createElementBlock("div", {
280
+ key: 0,
281
+ ref_key: "actionsContainer",
282
+ ref: actionsContainer,
283
+ class: "flex flex-row justify-between text-xs font-semibold text-primary"
284
+ }, [
285
+ vue.createElementVNode("p", _hoisted_5, vue.toDisplayString(vue.unref(computedItems).length) + " items", 1),
286
+ vue.createElementVNode("div", _hoisted_6, [
287
+ vue.unref(computedItems).length === vue.unref(internalItems).length ? (vue.openBlock(), vue.createElementBlock("a", {
288
+ key: 0,
289
+ class: vue.normalizeClass([
290
+ vue.unref(selectedItems).length !== vue.unref(internalItems).length ? "cursor-pointer" : "pointer-events-none opacity-50"
291
+ ]),
292
+ onClick: _cache[1] || (_cache[1] = //@ts-ignore
293
+ (...args) => vue.unref(selectAll) && vue.unref(selectAll)(...args))
294
+ }, " Select all ", 2)) : (vue.openBlock(), vue.createElementBlock("a", {
295
+ key: 1,
296
+ class: vue.normalizeClass([vue.unref(computedInsideSelected) ? "pointer-events-none opacity-50" : "cursor-pointer"]),
297
+ onClick: _cache[2] || (_cache[2] = //@ts-ignore
298
+ (...args) => vue.unref(selectAll) && vue.unref(selectAll)(...args))
299
+ }, " Select all filtered ", 2)),
300
+ _hoisted_7,
301
+ vue.createElementVNode("a", {
302
+ class: vue.normalizeClass([vue.unref(selectedItems).length ? "cursor-pointer" : "pointer-events-none opacity-50"]),
303
+ onClick: _cache[3] || (_cache[3] = //@ts-ignore
304
+ (...args) => vue.unref(clearAll) && vue.unref(clearAll)(...args))
305
+ }, " Clear all ", 2)
306
+ ])
307
+ ], 512)) : vue.createCommentVNode("", true),
308
+ __props.searchable ? (vue.openBlock(), vue.createElementBlock("div", {
309
+ key: 1,
310
+ class: vue.normalizeClass([{ "mt-3": __props.multiple }])
311
+ }, [
312
+ vue.createVNode(pInputSearch, {
313
+ ref_key: "inputSearch",
314
+ ref: inputSearch,
315
+ modelValue: vue.unref(search),
316
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(search) ? search.value = $event : null),
317
+ size: __props.size,
318
+ placeholder: __props.placeholderSearch
319
+ }, null, 8, ["modelValue", "size", "placeholder"])
320
+ ], 2)) : vue.createCommentVNode("", true)
321
+ ])) : vue.createCommentVNode("", true),
322
+ vue.createElementVNode("div", {
323
+ ref_key: "virtualizerRef",
324
+ ref: virtualizerRef,
325
+ style: vue.normalizeStyle(scrollerStyle.value),
326
+ class: vue.normalizeClass(["overflow-y-auto", { "mt-3": __props.multiple || __props.searchable }])
327
+ }, [
328
+ vue.createElementVNode("div", {
329
+ class: "relative w-full",
330
+ "p-select-list-options": "",
331
+ style: vue.normalizeStyle({ height: `${vue.unref(rowVirtualizer).getTotalSize()}px` }),
332
+ onMousemove: _cache[5] || (_cache[5] = //@ts-ignore
333
+ (...args) => vue.unref(onMousemove) && vue.unref(onMousemove)(...args))
334
+ }, [
335
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rowVirtualizer).getVirtualItems(), (row) => {
336
+ return vue.openBlock(), vue.createElementBlock("div", {
337
+ key: row.index,
338
+ class: "absolute left-0 top-0 w-full",
339
+ "p-select-list-option": "",
340
+ role: "option",
341
+ style: vue.normalizeStyle({ height: `${row.size}px`, transform: `translateY(${row.start}px)` })
342
+ }, [
343
+ vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
344
+ class: vue.normalizeClass([vue.unref(LIST_ITEM_CLASS), { [vue.unref(LIST_ITEM_ACTIVE_CLASS)]: vue.unref(isSelected)(vue.unref(getValue)(row.index)) }]),
345
+ "p-select-list-option-item": "",
346
+ style: vue.normalizeStyle(listItemStyle.value),
347
+ onClick: ($event) => vue.unref(select)($event, vue.unref(getValue)(row.index))
348
+ }, [
349
+ vue.createElementVNode("div", {
350
+ class: vue.normalizeClass(["flex items-center", { [vue.unref(pSelectList.SIZES)[__props.size]]: !__props.itemSize }])
351
+ }, [
352
+ vue.renderSlot(_ctx.$slots, "item", {
353
+ item: vue.unref(computedItems)[row.index],
354
+ isItemSelected: vue.unref(isSelected)(vue.unref(getValue)(row.index)),
355
+ itemTextSplit: vue.unref(text.splitStringForHighlight)(vue.unref(string.toString)(vue.unref(getText)(row.index)), vue.unref(search))
356
+ }, () => [
357
+ vue.createElementVNode("div", {
358
+ class: "truncate text-p-purple-60",
359
+ title: vue.unref(string.toString)(vue.unref(getText)(row.index))
360
+ }, [
361
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(text.splitStringForHighlight)(vue.unref(string.toString)(vue.unref(getText)(row.index)), vue.unref(search)), (str, index) => {
362
+ return vue.openBlock(), vue.createElementBlock("span", {
363
+ key: `${vue.unref(getValue)(row.index)}_${index}`,
364
+ class: vue.normalizeClass({ "bg-p-blue-20": index === 1 })
365
+ }, vue.toDisplayString(str), 3);
366
+ }), 128))
367
+ ], 8, _hoisted_9)
368
+ ]),
369
+ vue.unref(isSelected)(vue.unref(getValue)(row.index)) ? (vue.openBlock(), vue.createElementBlock("img", _hoisted_10)) : vue.createCommentVNode("", true)
370
+ ], 2)
371
+ ], 14, _hoisted_8)), [
372
+ [_directive_close_popper, !__props.multiple]
373
+ ])
374
+ ], 4);
375
+ }), 128))
376
+ ], 36),
377
+ !vue.unref(computedItems).length ? vue.renderSlot(_ctx.$slots, "no-items", { key: 0 }, () => [
378
+ vue.createElementVNode("div", {
379
+ class: vue.normalizeClass(["flex items-center justify-center", vue.unref(pSelectList.SIZES)[__props.size]])
380
+ }, "No items found", 2)
381
+ ]) : vue.createCommentVNode("", true)
382
+ ], 6)
383
+ ], 16)
384
+ ]),
385
+ default: vue.withCtx(() => [
386
+ vue.createElementVNode("button", vue.mergeProps(attrs.value, {
387
+ ref: "button",
388
+ type: "button",
389
+ class: ["w-full", vue.unref(selectClasses), dropdownShow.value ? "border-primary" : ""],
390
+ role: "button",
391
+ "aria-haspopup": "listbox",
392
+ onClick: _cache[0] || (_cache[0] = ($event) => dropdownShow.value = !dropdownShow.value)
393
+ }), [
394
+ !vue.unref(internalValue).length || !vue.unref(selectedItems).length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, vue.toDisplayString(__props.placeholder || " "), 1)) : vue.renderSlot(_ctx.$slots, "selected-item", {
395
+ key: 1,
396
+ item: __props.multiple ? vue.unref(selectedItems) : vue.unref(selectedItems)[0]
397
+ }, () => [
398
+ vue.createElementVNode("div", _hoisted_3, vue.toDisplayString(__props.multiple && vue.unref(selectedItems).length > 1 ? `${vue.unref(selectedItems).length} option${vue.unref(selectedItems).length > 1 ? "s" : ""} selected` : vue.unref(selectedItems)[0][__props.itemText]), 1)
399
+ ])
400
+ ], 16)
401
+ ]),
402
+ _: 3
403
+ }, 16, ["shown"]),
404
+ vue.withDirectives(vue.createElementVNode("div", {
405
+ class: vue.normalizeClass(vue.unref(errorMsgClasses))
406
+ }, vue.toDisplayString(__props.errorMsg), 3), [
407
+ [vue.vShow, __props.errorMsg]
408
+ ])
409
+ ], 14, _hoisted_1);
410
+ };
411
+ }
412
+ });
413
+ exports._imports_0 = _imports_0;
414
+ exports._sfc_main = _sfc_main;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ const vue = require("vue");
3
+ const pInputNumber = require("../p-input-number.js");
4
+ const lodashEs = require("lodash-es");
5
+ const _hoisted_1 = /* @__PURE__ */ vue.createElementVNode("div", null, "%", -1);
6
+ const _hoisted_2 = [
7
+ _hoisted_1
8
+ ];
9
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
10
+ ...{
11
+ name: "PInputPercent"
12
+ },
13
+ __name: "p-input-percent",
14
+ props: {
15
+ modelValue: {
16
+ type: [Number, String],
17
+ default: null
18
+ },
19
+ size: {
20
+ type: String,
21
+ default: "md"
22
+ }
23
+ },
24
+ emits: ["update:modelValue"],
25
+ setup(__props, { emit: __emit }) {
26
+ const prefixClasses = {
27
+ sm: "text-sm h-8 left-2",
28
+ md: "text-base h-10 left-3",
29
+ lg: "text-lg h-12 left-5"
30
+ };
31
+ const props = __props;
32
+ const emit = __emit;
33
+ const convertedValue = vue.computed({
34
+ get: () => lodashEs.isNumber(props.modelValue) ? props.modelValue * 100 : props.modelValue,
35
+ set: (nV) => emit("update:modelValue", lodashEs.isNumber(nV) ? nV / 100 : nV)
36
+ });
37
+ return (_ctx, _cache) => {
38
+ return vue.openBlock(), vue.createBlock(pInputNumber, {
39
+ modelValue: convertedValue.value,
40
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => convertedValue.value = $event),
41
+ size: __props.size
42
+ }, {
43
+ prefix: vue.withCtx(() => [
44
+ vue.createElementVNode("div", {
45
+ class: vue.normalizeClass(["absolute flex items-center", prefixClasses[__props.size]])
46
+ }, _hoisted_2, 2)
47
+ ]),
48
+ _: 1
49
+ }, 8, ["modelValue", "size"]);
50
+ };
51
+ }
52
+ });
53
+ exports._sfc_main = _sfc_main;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ const vue = require("vue");
3
+ const pSkeletonLoader = require("../p-skeleton-loader.js");
4
+ const _hoisted_1 = {
5
+ key: 1,
6
+ class: "text-sm font-medium text-p-gray-40"
7
+ };
8
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
9
+ ...{ name: "PPaginationInfo" },
10
+ __name: "p-pagination-info",
11
+ props: {
12
+ /**
13
+ * The current page.
14
+ */
15
+ currentPage: {
16
+ type: Number,
17
+ default: 0
18
+ },
19
+ /**
20
+ * The amount of data pagination iterates through.
21
+ */
22
+ count: {
23
+ type: Number,
24
+ default: 0
25
+ },
26
+ /**
27
+ * The amount of data to be displayed at 1 page. Used to calculate the `from` and `to` limits.
28
+ */
29
+ pageSize: {
30
+ type: Number,
31
+ default: 0
32
+ },
33
+ /**
34
+ * Whether the pagination is loading.
35
+ */
36
+ loading: {
37
+ type: Boolean,
38
+ default: false
39
+ }
40
+ },
41
+ setup(__props) {
42
+ const props = __props;
43
+ const from = vue.computed(() => {
44
+ const maxNumOfPages = Math.ceil(props.count / props.pageSize);
45
+ const currentPage = props.currentPage > maxNumOfPages ? maxNumOfPages : props.currentPage;
46
+ return (currentPage - 1) * props.pageSize + 1;
47
+ });
48
+ const to = vue.computed(() => {
49
+ const to2 = props.currentPage * props.pageSize;
50
+ return to2 >= props.count ? props.count : to2;
51
+ });
52
+ return (_ctx, _cache) => {
53
+ return __props.loading ? (vue.openBlock(), vue.createBlock(pSkeletonLoader, {
54
+ key: 0,
55
+ class: "h-6 w-56"
56
+ })) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
57
+ __props.count ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
58
+ vue.createTextVNode("Showing " + vue.toDisplayString(from.value) + " to " + vue.toDisplayString(to.value) + " of " + vue.toDisplayString(__props.count) + " results", 1)
59
+ ], 64)) : vue.renderSlot(_ctx.$slots, "no-results", { key: 1 }, () => [
60
+ vue.createTextVNode("No results found")
61
+ ])
62
+ ]));
63
+ };
64
+ }
65
+ });
66
+ exports._sfc_main = _sfc_main;