@pequity/squirrel 1.0.20-beta.3 → 1.0.20

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/squirrel.cjs.js +5 -0
  2. package/dist/squirrel.es.js +8220 -0
  3. package/dist/style.css +1 -2124
  4. package/package.json +20 -22
  5. package/dist/cjs/chunks/_plugin-vue_export-helper.js +0 -9
  6. package/dist/cjs/chunks/p-action-bar.js +0 -60
  7. package/dist/cjs/chunks/p-card.js +0 -28
  8. package/dist/cjs/chunks/p-checkbox.js +0 -24
  9. package/dist/cjs/chunks/p-dropdown-select.js +0 -414
  10. package/dist/cjs/chunks/p-input-percent.js +0 -53
  11. package/dist/cjs/chunks/p-pagination-info.js +0 -66
  12. package/dist/cjs/chunks/p-pagination.js +0 -122
  13. package/dist/cjs/chunks/p-ring-loader.js +0 -81
  14. package/dist/cjs/chunks/p-select-btn.js +0 -97
  15. package/dist/cjs/chunks/p-select.js +0 -123
  16. package/dist/cjs/chunks/p-table-loader.js +0 -70
  17. package/dist/cjs/chunks/p-tabs.js +0 -52
  18. package/dist/cjs/config.js +0 -105
  19. package/dist/cjs/currency.js +0 -9
  20. package/dist/cjs/dom.js +0 -27
  21. package/dist/cjs/index.js +0 -976
  22. package/dist/cjs/inputClassesMixin.js +0 -50
  23. package/dist/cjs/inputClassesShared.js +0 -76
  24. package/dist/cjs/listKeyboardNavigation.js +0 -110
  25. package/dist/cjs/number.js +0 -9
  26. package/dist/cjs/object.js +0 -4
  27. package/dist/cjs/p-action-bar.js +0 -3
  28. package/dist/cjs/p-alert.js +0 -65
  29. package/dist/cjs/p-avatar.js +0 -71
  30. package/dist/cjs/p-btn.js +0 -361
  31. package/dist/cjs/p-card.js +0 -3
  32. package/dist/cjs/p-checkbox.js +0 -3
  33. package/dist/cjs/p-chips.js +0 -110
  34. package/dist/cjs/p-close-btn.js +0 -36
  35. package/dist/cjs/p-date-picker.js +0 -139
  36. package/dist/cjs/p-drawer.js +0 -253
  37. package/dist/cjs/p-dropdown-select.js +0 -3
  38. package/dist/cjs/p-dropdown.js +0 -138
  39. package/dist/cjs/p-file-upload.js +0 -21
  40. package/dist/cjs/p-info-icon.js +0 -35
  41. package/dist/cjs/p-inline-date-picker.js +0 -142
  42. package/dist/cjs/p-input-number.js +0 -146
  43. package/dist/cjs/p-input-percent.js +0 -3
  44. package/dist/cjs/p-input-search.js +0 -110
  45. package/dist/cjs/p-input.js +0 -89
  46. package/dist/cjs/p-loading.js +0 -38
  47. package/dist/cjs/p-modal.js +0 -369
  48. package/dist/cjs/p-pagination-info.js +0 -3
  49. package/dist/cjs/p-pagination.js +0 -3
  50. package/dist/cjs/p-progress-bar.js +0 -41
  51. package/dist/cjs/p-ring-loader.js +0 -3
  52. package/dist/cjs/p-select-btn.js +0 -3
  53. package/dist/cjs/p-select-list.js +0 -4
  54. package/dist/cjs/p-select-pill.js +0 -111
  55. package/dist/cjs/p-select.js +0 -3
  56. package/dist/cjs/p-skeleton-loader.js +0 -73
  57. package/dist/cjs/p-table-filter-icon.js +0 -20
  58. package/dist/cjs/p-table-header-cell.js +0 -75
  59. package/dist/cjs/p-table-loader.js +0 -3
  60. package/dist/cjs/p-table-sort.js +0 -8
  61. package/dist/cjs/p-table-td.js +0 -88
  62. package/dist/cjs/p-table.js +0 -12
  63. package/dist/cjs/p-tabs.js +0 -3
  64. package/dist/cjs/p-textarea.js +0 -73
  65. package/dist/cjs/p-toggle.js +0 -114
  66. package/dist/cjs/pagination.js +0 -29
  67. package/dist/cjs/string.js +0 -12
  68. package/dist/cjs/tailwind.js +0 -4353
  69. package/dist/cjs/text.js +0 -16
  70. package/dist/cjs/useInputClasses.js +0 -44
  71. package/dist/cjs/usePLoading.js +0 -35
  72. package/dist/cjs/usePModal.js +0 -21
  73. package/dist/cjs/usePTableColResize.js +0 -81
  74. package/dist/cjs/usePTableRowVirtualizer.js +0 -31
  75. package/dist/cjs/useSelectList.js +0 -256
  76. package/dist/es/chunks/_plugin-vue_export-helper.js +0 -10
  77. package/dist/es/chunks/p-action-bar.js +0 -61
  78. package/dist/es/chunks/p-card.js +0 -29
  79. package/dist/es/chunks/p-checkbox.js +0 -25
  80. package/dist/es/chunks/p-dropdown-select.js +0 -415
  81. package/dist/es/chunks/p-input-percent.js +0 -54
  82. package/dist/es/chunks/p-pagination-info.js +0 -67
  83. package/dist/es/chunks/p-pagination.js +0 -123
  84. package/dist/es/chunks/p-ring-loader.js +0 -82
  85. package/dist/es/chunks/p-select-btn.js +0 -98
  86. package/dist/es/chunks/p-select.js +0 -124
  87. package/dist/es/chunks/p-table-loader.js +0 -71
  88. package/dist/es/chunks/p-tabs.js +0 -53
  89. package/dist/es/config.js +0 -105
  90. package/dist/es/currency.js +0 -9
  91. package/dist/es/dom.js +0 -27
  92. package/dist/es/index.js +0 -978
  93. package/dist/es/inputClassesMixin.js +0 -51
  94. package/dist/es/inputClassesShared.js +0 -76
  95. package/dist/es/listKeyboardNavigation.js +0 -110
  96. package/dist/es/number.js +0 -9
  97. package/dist/es/object.js +0 -4
  98. package/dist/es/p-action-bar.js +0 -4
  99. package/dist/es/p-alert.js +0 -66
  100. package/dist/es/p-avatar.js +0 -72
  101. package/dist/es/p-btn.js +0 -362
  102. package/dist/es/p-card.js +0 -4
  103. package/dist/es/p-checkbox.js +0 -4
  104. package/dist/es/p-chips.js +0 -111
  105. package/dist/es/p-close-btn.js +0 -37
  106. package/dist/es/p-date-picker.js +0 -140
  107. package/dist/es/p-drawer.js +0 -254
  108. package/dist/es/p-dropdown-select.js +0 -4
  109. package/dist/es/p-dropdown.js +0 -139
  110. package/dist/es/p-file-upload.js +0 -21
  111. package/dist/es/p-info-icon.js +0 -36
  112. package/dist/es/p-inline-date-picker.js +0 -143
  113. package/dist/es/p-input-number.js +0 -147
  114. package/dist/es/p-input-percent.js +0 -4
  115. package/dist/es/p-input-search.js +0 -111
  116. package/dist/es/p-input.js +0 -90
  117. package/dist/es/p-loading.js +0 -39
  118. package/dist/es/p-modal.js +0 -370
  119. package/dist/es/p-pagination-info.js +0 -4
  120. package/dist/es/p-pagination.js +0 -4
  121. package/dist/es/p-progress-bar.js +0 -42
  122. package/dist/es/p-ring-loader.js +0 -4
  123. package/dist/es/p-select-btn.js +0 -4
  124. package/dist/es/p-select-list.js +0 -4
  125. package/dist/es/p-select-pill.js +0 -112
  126. package/dist/es/p-select.js +0 -4
  127. package/dist/es/p-skeleton-loader.js +0 -74
  128. package/dist/es/p-table-filter-icon.js +0 -21
  129. package/dist/es/p-table-header-cell.js +0 -76
  130. package/dist/es/p-table-loader.js +0 -4
  131. package/dist/es/p-table-sort.js +0 -8
  132. package/dist/es/p-table-td.js +0 -89
  133. package/dist/es/p-table.js +0 -12
  134. package/dist/es/p-tabs.js +0 -4
  135. package/dist/es/p-textarea.js +0 -74
  136. package/dist/es/p-toggle.js +0 -115
  137. package/dist/es/pagination.js +0 -29
  138. package/dist/es/string.js +0 -12
  139. package/dist/es/tailwind.js +0 -4353
  140. package/dist/es/text.js +0 -16
  141. package/dist/es/useInputClasses.js +0 -44
  142. package/dist/es/usePLoading.js +0 -35
  143. package/dist/es/usePModal.js +0 -21
  144. package/dist/es/usePTableColResize.js +0 -81
  145. package/dist/es/usePTableRowVirtualizer.js +0 -31
  146. package/dist/es/useSelectList.js +0 -256
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@pequity/squirrel",
3
3
  "description": "Squirrel component library",
4
- "version": "1.0.20-beta.3",
4
+ "version": "1.0.20",
5
5
  "packageManager": "pnpm@8.9.2",
6
- "type": "module",
7
6
  "scripts": {
8
7
  "preinstall": "npx only-allow pnpm",
9
8
  "dev": "vite --host",
@@ -29,14 +28,14 @@
29
28
  "exports": {
30
29
  ".": {
31
30
  "types": "./dist/squirrel/index.d.ts",
32
- "import": "./dist/es/index.js",
33
- "require": "./dist/cjs/index.js"
31
+ "import": "./dist/squirrel.es.js",
32
+ "require": "./dist/squirrel.cjs.js"
34
33
  },
35
34
  "./assets/squirrel.css": "./dist/style.css",
36
35
  "./tailwind": "./dist/tailwind/config.js"
37
36
  },
38
- "main": "./dist/cjs/index.js",
39
- "module": "./dist/es/index.js",
37
+ "main": "./dist/squirrel.cjs.js",
38
+ "module": "./dist/squirrel.es.js",
40
39
  "dependencies": {
41
40
  "@popperjs/core": "2.11.8",
42
41
  "@tanstack/vue-virtual": "3.2.0",
@@ -67,23 +66,23 @@
67
66
  "@pequity/eslint-config": "^0.0.12",
68
67
  "@semantic-release/changelog": "^6.0.3",
69
68
  "@semantic-release/git": "^10.0.1",
70
- "@storybook/addon-a11y": "^8.0.5",
71
- "@storybook/addon-actions": "^8.0.5",
72
- "@storybook/addon-essentials": "^8.0.5",
73
- "@storybook/addon-interactions": "^8.0.5",
74
- "@storybook/addon-links": "^8.0.5",
75
- "@storybook/blocks": "^8.0.5",
69
+ "@storybook/addon-a11y": "^8.0.4",
70
+ "@storybook/addon-actions": "^8.0.4",
71
+ "@storybook/addon-essentials": "^8.0.4",
72
+ "@storybook/addon-interactions": "^8.0.4",
73
+ "@storybook/addon-links": "^8.0.4",
74
+ "@storybook/blocks": "^8.0.4",
76
75
  "@storybook/jest": "^0.2.3",
77
- "@storybook/manager-api": "^8.0.5",
76
+ "@storybook/manager-api": "^8.0.4",
78
77
  "@storybook/test-runner": "^0.17.0",
79
78
  "@storybook/testing-library": "^0.2.2",
80
- "@storybook/theming": "^8.0.5",
81
- "@storybook/vue3": "^8.0.5",
82
- "@storybook/vue3-vite": "^8.0.5",
79
+ "@storybook/theming": "^8.0.4",
80
+ "@storybook/vue3": "^8.0.4",
81
+ "@storybook/vue3-vite": "^8.0.4",
83
82
  "@types/jest": "^29.5.12",
84
83
  "@types/jsdom": "^21.1.6",
85
84
  "@types/lodash-es": "^4.17.12",
86
- "@types/node": "^20.12.2",
85
+ "@types/node": "^20.11.30",
87
86
  "@vitejs/plugin-vue": "^5.0.4",
88
87
  "@vue/compiler-sfc": "3.4.21",
89
88
  "@vue/test-utils": "^2.4.5",
@@ -92,7 +91,6 @@
92
91
  "babel-jest": "^29.7.0",
93
92
  "eslint": "^8.57.0",
94
93
  "eslint-plugin-storybook": "^0.8.0",
95
- "glob": "^10.3.12",
96
94
  "husky": "^9.0.11",
97
95
  "jest": "^29.7.0",
98
96
  "jest-environment-jsdom": "^29.7.0",
@@ -100,17 +98,17 @@
100
98
  "make-coverage-badge": "^1.2.0",
101
99
  "postcss": "^8.4.38",
102
100
  "prettier": "^3.2.5",
103
- "prettier-plugin-tailwindcss": "^0.5.13",
101
+ "prettier-plugin-tailwindcss": "^0.5.12",
104
102
  "resolve-tspaths": "^0.8.18",
105
103
  "rimraf": "^5.0.5",
106
104
  "sass": "^1.72.0",
107
105
  "semantic-release": "^23.0.6",
108
- "storybook": "^8.0.5",
106
+ "storybook": "^8.0.4",
109
107
  "svgo": "^3.2.0",
110
- "tailwindcss": "^3.4.3",
108
+ "tailwindcss": "^3.4.1",
111
109
  "ts-jest": "^29.1.2",
112
110
  "typescript": "5.4.3",
113
- "vite": "^5.2.7",
111
+ "vite": "^5.2.6",
114
112
  "vue-router": "^4.3.0",
115
113
  "vue-tsc": "2.0.7"
116
114
  }
@@ -1,9 +0,0 @@
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;
@@ -1,60 +0,0 @@
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;
@@ -1,28 +0,0 @@
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;
@@ -1,24 +0,0 @@
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;
@@ -1,414 +0,0 @@
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;