@pequity/squirrel 5.2.2 → 5.3.0

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 (86) hide show
  1. package/dist/cjs/chunks/component.js +4 -0
  2. package/dist/cjs/chunks/p-dropdown-select.js +1 -1
  3. package/dist/cjs/chunks/p-icon.js +2180 -0
  4. package/dist/cjs/chunks/string.js +13 -0
  5. package/dist/cjs/component.js +28 -0
  6. package/dist/cjs/index.js +32 -2188
  7. package/dist/cjs/p-input-search.js +3 -2
  8. package/dist/cjs/p-loading.js +4 -7
  9. package/dist/cjs/p-modal.js +5 -2
  10. package/dist/cjs/string.js +32 -11
  11. package/dist/cjs/useSelectList.js +1 -1
  12. package/dist/es/chunks/component.js +5 -0
  13. package/dist/es/chunks/p-dropdown-select.js +1 -1
  14. package/dist/es/chunks/p-icon.js +2181 -0
  15. package/dist/es/chunks/string.js +14 -0
  16. package/dist/es/component.js +27 -0
  17. package/dist/es/index.js +31 -2187
  18. package/dist/es/p-input-search.js +3 -2
  19. package/dist/es/p-loading.js +4 -7
  20. package/dist/es/p-modal.js +5 -2
  21. package/dist/es/string.js +32 -12
  22. package/dist/es/useSelectList.js +1 -1
  23. package/dist/squirrel/components/p-action-bar/p-action-bar.types.d.ts +3 -2
  24. package/dist/squirrel/utils/component.d.ts +2 -0
  25. package/dist/squirrel/utils/component.spec.d.ts +1 -0
  26. package/dist/squirrel/utils/string.d.ts +1 -0
  27. package/dist/squirrel/utils/string.spec.d.ts +1 -0
  28. package/dist/style.css +33 -33
  29. package/package.json +22 -27
  30. package/squirrel/components/p-action-bar/p-action-bar.spec.js +47 -15
  31. package/squirrel/components/p-action-bar/p-action-bar.stories.js +6 -0
  32. package/squirrel/components/p-action-bar/p-action-bar.types.ts +4 -2
  33. package/squirrel/components/p-action-bar/p-action-bar.vue +9 -3
  34. package/squirrel/components/p-alert/p-alert.spec.js +1 -1
  35. package/squirrel/components/p-avatar/p-avatar.spec.js +16 -1
  36. package/squirrel/components/p-btn/p-btn.spec.js +3 -7
  37. package/squirrel/components/p-card/p-card.spec.js +1 -1
  38. package/squirrel/components/p-checkbox/p-checkbox.spec.js +1 -1
  39. package/squirrel/components/p-chips/p-chips.spec.js +1 -1
  40. package/squirrel/components/p-close-btn/p-close-btn.spec.js +1 -1
  41. package/squirrel/components/p-dropdown/p-dropdown.spec.js +5 -9
  42. package/squirrel/components/p-dropdown-select/p-dropdown-select.spec.js +4 -5
  43. package/squirrel/components/p-file-upload/p-file-upload.spec.js +1 -1
  44. package/squirrel/components/p-icon/p-icon.spec.js +15 -29
  45. package/squirrel/components/p-info-icon/p-info-icon.spec.js +1 -1
  46. package/squirrel/components/p-inline-date-picker/p-inline-date-picker.spec.js +4 -4
  47. package/squirrel/components/p-input/p-input.spec.js +1 -1
  48. package/squirrel/components/p-input-number/p-input-number.spec.js +1 -1
  49. package/squirrel/components/p-input-percent/p-input-percent.spec.js +1 -1
  50. package/squirrel/components/p-input-search/p-input-search.spec.js +1 -1
  51. package/squirrel/components/p-input-search/p-input-search.vue +1 -1
  52. package/squirrel/components/p-link/p-link.spec.js +3 -7
  53. package/squirrel/components/p-loading/p-loading.spec.js +23 -23
  54. package/squirrel/components/p-loading/p-loading.vue +2 -7
  55. package/squirrel/components/p-modal/p-modal-basic.spec.js +1 -1
  56. package/squirrel/components/p-modal/p-modal-events.spec.js +1 -1
  57. package/squirrel/components/p-modal/p-modal-features.spec.js +1 -1
  58. package/squirrel/components/p-modal/p-modal.vue +4 -0
  59. package/squirrel/components/p-pagination/p-pagination.spec.js +1 -1
  60. package/squirrel/components/p-pagination-info/p-pagination-info.spec.js +1 -1
  61. package/squirrel/components/p-progress-bar/p-progess-bar.spec.js +1 -1
  62. package/squirrel/components/p-ring-loader/p-ring-loader.spec.js +1 -1
  63. package/squirrel/components/p-select/p-select.spec.js +1 -1
  64. package/squirrel/components/p-select-btn/p-select-btn.spec.js +1 -1
  65. package/squirrel/components/p-select-list/p-select-list.spec.js +4 -5
  66. package/squirrel/components/p-select-pill/p-select-pill.spec.js +1 -1
  67. package/squirrel/components/p-skeleton-loader/p-skeleton-loader.spec.js +1 -1
  68. package/squirrel/components/p-table/p-table.spec.js +1 -1
  69. package/squirrel/components/p-table-header-cell/p-filter-icon.spec.js +1 -1
  70. package/squirrel/components/p-table-header-cell/p-table-header-cell.spec.js +1 -1
  71. package/squirrel/components/p-table-loader/p-table-loader.spec.js +1 -1
  72. package/squirrel/components/p-table-sort/p-table-sort.spec.js +1 -1
  73. package/squirrel/components/p-table-td/p-table-td.spec.js +35 -1
  74. package/squirrel/components/p-tabs/p-tabs.spec.js +1 -1
  75. package/squirrel/components/p-textarea/p-textarea.spec.js +1 -1
  76. package/squirrel/components/p-toggle/p-toggle.spec.js +1 -1
  77. package/squirrel/composables/useInputClasses.spec.js +41 -0
  78. package/squirrel/index.spec.js +21 -0
  79. package/squirrel/utils/component.spec.ts +29 -0
  80. package/squirrel/utils/component.ts +5 -0
  81. package/squirrel/utils/dom.spec.js +2 -3
  82. package/squirrel/utils/listKeyboardNavigation.spec.js +5 -9
  83. package/squirrel/utils/sanitization.spec.js +1 -1
  84. package/squirrel/utils/{string.spec.js → string.spec.ts} +19 -1
  85. package/squirrel/utils/string.ts +2 -0
  86. package/squirrel/utils/tailwind.spec.js +27 -0
@@ -56,7 +56,8 @@ const _sfc_main = vue.defineComponent({
56
56
  clearSearch() {
57
57
  this.query = "";
58
58
  requestAnimationFrame(() => {
59
- this.$refs.searchInput.$el.querySelector("input").focus();
59
+ var _a;
60
+ (_a = this.$refs.searchInput) == null ? void 0 : _a.$el.querySelector("input").focus();
60
61
  });
61
62
  },
62
63
  keydownEnter() {
@@ -107,5 +108,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
107
108
  _: 1
108
109
  }, 16, ["modelValue", "size", "onKeydown"]);
109
110
  }
110
- const PInputSearch = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-7a1e1e82"]]);
111
+ const PInputSearch = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-60b13ffe"]]);
111
112
  module.exports = PInputSearch;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  const vue = require("vue");
3
+ const component = require("./chunks/component.js");
3
4
  const usePLoading = require("./usePLoading.js");
4
5
  const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
5
6
  const _hoisted_1 = {
@@ -33,10 +34,6 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
33
34
  },
34
35
  { flush: "post" }
35
36
  );
36
- const isComponent = (content2) => {
37
- const isComponent2 = typeof content2 === "object" && content2 !== null;
38
- return isComponent2;
39
- };
40
37
  vue.onBeforeUnmount(() => {
41
38
  loadingHide();
42
39
  });
@@ -58,7 +55,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
58
55
  "enter-active-class": "transition duration-500"
59
56
  }, {
60
57
  default: vue.withCtx(() => [
61
- isComponent(vue.unref(content)) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(content)), vue.normalizeProps(vue.mergeProps({ key: 0 }, vue.unref(componentProps))), null, 16)) : (vue.openBlock(), vue.createElementBlock("div", {
58
+ vue.unref(component.isComponent)(vue.unref(content)) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(content)), vue.normalizeProps(vue.mergeProps({ key: 0 }, vue.unref(componentProps))), null, 16)) : (vue.openBlock(), vue.createElementBlock("div", {
62
59
  key: 1,
63
60
  class: vue.normalizeClass(textDivClass)
64
61
  }, vue.toDisplayString(vue.unref(content)), 1))
@@ -75,7 +72,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
75
72
  ref_key: "dimsReference",
76
73
  ref: dimsReference
77
74
  }, [
78
- isComponent(vue.unref(content)) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(content)), vue.normalizeProps(vue.mergeProps({ key: 0 }, vue.unref(componentProps))), null, 16)) : (vue.openBlock(), vue.createElementBlock("div", {
75
+ vue.unref(component.isComponent)(vue.unref(content)) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(content)), vue.normalizeProps(vue.mergeProps({ key: 0 }, vue.unref(componentProps))), null, 16)) : (vue.openBlock(), vue.createElementBlock("div", {
79
76
  key: 1,
80
77
  class: vue.normalizeClass(textDivClass)
81
78
  }, vue.toDisplayString(vue.unref(content)), 1))
@@ -85,5 +82,5 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
85
82
  };
86
83
  }
87
84
  });
88
- const pLoading = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-f0f6bdd4"]]);
85
+ const pLoading = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-980d32e1"]]);
89
86
  module.exports = pLoading;
@@ -111,7 +111,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
111
111
  ],
112
112
  setup(__props, { emit: __emit }) {
113
113
  vue.useCssVars((_ctx) => ({
114
- "4d751ed2": __props.maxWidth
114
+ "4046568f": __props.maxWidth
115
115
  }));
116
116
  let animatingZIndex = 0;
117
117
  const emit = __emit;
@@ -195,6 +195,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
195
195
  }, 0);
196
196
  };
197
197
  const handleFocus = (wrapper) => {
198
+ if (!wrapper) {
199
+ return;
200
+ }
198
201
  const autofocus = wrapper.querySelector("[autofocus]");
199
202
  if (autofocus) {
200
203
  autofocus.focus();
@@ -365,5 +368,5 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
365
368
  };
366
369
  }
367
370
  });
368
- const pModal = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-fb5dbd9f"]]);
371
+ const pModal = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-7e6a0b8d"]]);
369
372
  module.exports = pModal;
@@ -1,12 +1,33 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const toString = (value) => {
4
- if (typeof value === "number" && (!isFinite(value) || isNaN(value))) {
5
- return "";
6
- }
7
- if (typeof value !== "string" && typeof value !== "number") {
8
- return "";
9
- }
10
- return String(value);
11
- };
12
- exports.toString = toString;
2
+ const string = require("./chunks/string.js");
3
+ describe("toString", () => {
4
+ it.each(["", /* @__PURE__ */ new Date(), NaN, Infinity, {}, [], true, false, null, void 0])(
5
+ "returns an empty string if input is %s",
6
+ (val) => {
7
+ expect(string.toString(val)).toBe("");
8
+ }
9
+ );
10
+ it("returns a string when the value is a string", () => {
11
+ expect(string.toString("test")).toBe("test");
12
+ });
13
+ it("converts the value to a string when the value is a number", () => {
14
+ expect(string.toString(290349822e-2)).toBe("2903498.22");
15
+ });
16
+ });
17
+ describe("isString", () => {
18
+ it("should return true for a string", () => {
19
+ expect(string.isString("hello")).toBe(true);
20
+ });
21
+ it.each([
22
+ [123, false],
23
+ [{}, false],
24
+ [[], false],
25
+ [null, false],
26
+ [void 0, false],
27
+ [true, false],
28
+ [() => {
29
+ }, false]
30
+ ])("should return %s for %p", (input, expected) => {
31
+ expect(string.isString(input)).toBe(expected);
32
+ });
33
+ });
@@ -4,7 +4,7 @@ const vue = require("vue");
4
4
  const listKeyboardNavigation = require("./listKeyboardNavigation.js");
5
5
  const lodashEs = require("lodash-es");
6
6
  const object = require("./object.js");
7
- const string = require("./string.js");
7
+ const string = require("./chunks/string.js");
8
8
  const vueVirtual = require("@tanstack/vue-virtual");
9
9
  const createInternalItems = (items) => {
10
10
  let arr = Array.isArray(items) ? items.slice() : [];
@@ -0,0 +1,5 @@
1
+ import { isPlainObject } from "lodash-es";
2
+ const isComponent = (val) => isPlainObject(val);
3
+ export {
4
+ isComponent as i
5
+ };
@@ -4,7 +4,7 @@ import PInputSearch from "../p-input-search.js";
4
4
  import { SIZES } from "../p-select-list.js";
5
5
  import { omit } from "lodash-es";
6
6
  import { splitStringForHighlight } from "../text.js";
7
- import { toString } from "../string.js";
7
+ import { t as toString } from "./string.js";
8
8
  import { useInputClasses } from "../useInputClasses.js";
9
9
  import { useSelectList } from "../useSelectList.js";
10
10
  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";