@pequity/squirrel 5.2.3 → 5.3.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 (112) hide show
  1. package/dist/cjs/chunks/p-action-bar.js +2320 -0
  2. package/dist/cjs/component.js +5 -0
  3. package/dist/cjs/index.js +182 -2473
  4. package/dist/cjs/p-action-bar.js +2 -0
  5. package/dist/cjs/p-loading.js +4 -7
  6. package/dist/cjs/string.js +2 -0
  7. package/dist/es/chunks/p-action-bar.js +2321 -0
  8. package/dist/es/chunks/p-dropdown-select.js +2 -2
  9. package/dist/es/component.js +5 -0
  10. package/dist/es/index.js +54 -2345
  11. package/dist/es/p-action-bar.js +4 -1
  12. package/dist/es/p-dropdown-select.js +1 -1
  13. package/dist/es/p-loading.js +4 -7
  14. package/dist/es/string.js +2 -0
  15. package/dist/squirrel/squirrel/components/index.d.ts +53 -0
  16. package/dist/squirrel/squirrel/components/p-action-bar/p-action-bar.spec.d.ts +1 -0
  17. package/dist/squirrel/{components → squirrel/components}/p-action-bar/p-action-bar.types.d.ts +3 -2
  18. package/dist/squirrel/{components → squirrel/components}/p-action-bar/p-action-bar.vue.d.ts +1 -1
  19. package/dist/squirrel/squirrel/components/p-avatar/p-avatar.spec.d.ts +1 -0
  20. package/dist/squirrel/{components → squirrel/components}/p-btn/p-btn.vue.d.ts +1 -1
  21. package/dist/squirrel/{components → squirrel/components}/p-dropdown/p-dropdown.vue.d.ts +1 -1
  22. package/dist/squirrel/{components → squirrel/components}/p-dropdown-select/p-dropdown-select.vue.d.ts +1 -1
  23. package/dist/squirrel/{components → squirrel/components}/p-file-upload/p-file-upload.vue.d.ts +1 -1
  24. package/dist/squirrel/{components → squirrel/components}/p-icon/p-icon.vue.d.ts +1 -1
  25. package/dist/squirrel/{components → squirrel/components}/p-input-percent/p-input-percent.vue.d.ts +1 -1
  26. package/dist/squirrel/{components → squirrel/components}/p-input-search/p-input-search.vue.d.ts +1 -1
  27. package/dist/squirrel/{components → squirrel/components}/p-select/p-select.vue.d.ts +1 -1
  28. package/dist/squirrel/{components → squirrel/components}/p-select-btn/p-select-btn.vue.d.ts +1 -1
  29. package/dist/squirrel/{components → squirrel/components}/p-select-list/p-select-list.utils.d.ts +1 -1
  30. package/dist/squirrel/{components → squirrel/components}/p-select-list/p-select-list.vue.d.ts +1 -1
  31. package/dist/squirrel/{components → squirrel/components}/p-select-list/useSelectList.d.ts +1 -1
  32. package/dist/squirrel/{components → squirrel/components}/p-table/p-table.vue.d.ts +1 -1
  33. package/dist/squirrel/{components → squirrel/components}/p-table-sort/p-table-sort.vue.d.ts +1 -1
  34. package/dist/squirrel/squirrel/composables/index.d.ts +2 -0
  35. package/dist/squirrel/{composables → squirrel/composables}/useInputClasses.d.ts +1 -1
  36. package/dist/squirrel/squirrel/index.d.ts +5 -0
  37. package/dist/squirrel/squirrel/utils/component.d.ts +2 -0
  38. package/dist/squirrel/squirrel/utils/component.spec.d.ts +1 -0
  39. package/dist/squirrel/{utils → squirrel/utils}/index.d.ts +12 -12
  40. package/dist/squirrel/{utils → squirrel/utils}/inputClassesMixin.d.ts +1 -1
  41. package/dist/squirrel/squirrel/utils/string.d.ts +2 -0
  42. package/dist/squirrel/squirrel/utils/string.spec.d.ts +1 -0
  43. package/dist/squirrel/tests/vitest.helpers.d.ts +12 -0
  44. package/dist/style.css +134 -134
  45. package/package.json +3 -3
  46. package/squirrel/components/p-action-bar/{p-action-bar.spec.js → p-action-bar.spec.ts} +46 -14
  47. package/squirrel/components/p-action-bar/p-action-bar.stories.js +6 -0
  48. package/squirrel/components/p-action-bar/p-action-bar.types.ts +4 -2
  49. package/squirrel/components/p-action-bar/p-action-bar.vue +9 -3
  50. package/squirrel/components/p-avatar/{p-avatar.spec.js → p-avatar.spec.ts} +15 -0
  51. package/squirrel/components/p-icon/p-icon.spec.js +0 -1
  52. package/squirrel/components/p-loading/p-loading.vue +2 -7
  53. package/squirrel/components/p-table-td/p-table-td.spec.js +0 -1
  54. package/squirrel/utils/component.spec.ts +29 -0
  55. package/squirrel/utils/component.ts +5 -0
  56. package/squirrel/utils/{string.spec.js → string.spec.ts} +19 -1
  57. package/squirrel/utils/string.ts +2 -0
  58. package/dist/squirrel/components/index.d.ts +0 -53
  59. package/dist/squirrel/composables/index.d.ts +0 -2
  60. package/dist/squirrel/index.d.ts +0 -5
  61. package/dist/squirrel/utils/string.d.ts +0 -1
  62. /package/dist/squirrel/{components → squirrel/components}/p-alert/p-alert.vue.d.ts +0 -0
  63. /package/dist/squirrel/{components → squirrel/components}/p-avatar/p-avatar.vue.d.ts +0 -0
  64. /package/dist/squirrel/{components → squirrel/components}/p-btn/p-btn.types.d.ts +0 -0
  65. /package/dist/squirrel/{components → squirrel/components}/p-card/p-card.vue.d.ts +0 -0
  66. /package/dist/squirrel/{components → squirrel/components}/p-checkbox/p-checkbox.vue.d.ts +0 -0
  67. /package/dist/squirrel/{components → squirrel/components}/p-chips/p-chips.vue.d.ts +0 -0
  68. /package/dist/squirrel/{components → squirrel/components}/p-close-btn/p-close-btn.vue.d.ts +0 -0
  69. /package/dist/squirrel/{components → squirrel/components}/p-date-picker/p-date-picker.vue.d.ts +0 -0
  70. /package/dist/squirrel/{components → squirrel/components}/p-drawer/p-drawer.vue.d.ts +0 -0
  71. /package/dist/squirrel/{components → squirrel/components}/p-file-upload/p-file-upload.types.d.ts +0 -0
  72. /package/dist/squirrel/{components → squirrel/components}/p-file-upload/p-file-upload.utils.d.ts +0 -0
  73. /package/dist/squirrel/{components → squirrel/components}/p-icon/p-icon.types.d.ts +0 -0
  74. /package/dist/squirrel/{components → squirrel/components}/p-info-icon/p-info-icon.vue.d.ts +0 -0
  75. /package/dist/squirrel/{components → squirrel/components}/p-inline-date-picker/p-inline-date-picker.vue.d.ts +0 -0
  76. /package/dist/squirrel/{components → squirrel/components}/p-input/p-input.vue.d.ts +0 -0
  77. /package/dist/squirrel/{components → squirrel/components}/p-input-number/p-input-number.vue.d.ts +0 -0
  78. /package/dist/squirrel/{components → squirrel/components}/p-link/p-link.vue.d.ts +0 -0
  79. /package/dist/squirrel/{components → squirrel/components}/p-loading/p-loading.vue.d.ts +0 -0
  80. /package/dist/squirrel/{components → squirrel/components}/p-loading/usePLoading.d.ts +0 -0
  81. /package/dist/squirrel/{components → squirrel/components}/p-modal/p-modal.vue.d.ts +0 -0
  82. /package/dist/squirrel/{components → squirrel/components}/p-modal/usePModal.d.ts +0 -0
  83. /package/dist/squirrel/{components → squirrel/components}/p-pagination/p-pagination.vue.d.ts +0 -0
  84. /package/dist/squirrel/{components → squirrel/components}/p-pagination-info/p-pagination-info.vue.d.ts +0 -0
  85. /package/dist/squirrel/{components → squirrel/components}/p-progress-bar/p-progress-bar.vue.d.ts +0 -0
  86. /package/dist/squirrel/{components → squirrel/components}/p-ring-loader/p-ring-loader.vue.d.ts +0 -0
  87. /package/dist/squirrel/{components → squirrel/components}/p-select-list/p-select-list.types.d.ts +0 -0
  88. /package/dist/squirrel/{components → squirrel/components}/p-select-pill/p-select-pill.vue.d.ts +0 -0
  89. /package/dist/squirrel/{components → squirrel/components}/p-skeleton-loader/p-skeleton-loader.vue.d.ts +0 -0
  90. /package/dist/squirrel/{components → squirrel/components}/p-table/p-table.types.d.ts +0 -0
  91. /package/dist/squirrel/{components → squirrel/components}/p-table/usePTableColResize.d.ts +0 -0
  92. /package/dist/squirrel/{components → squirrel/components}/p-table/usePTableRowVirtualizer.d.ts +0 -0
  93. /package/dist/squirrel/{components → squirrel/components}/p-table-header-cell/p-table-filter-icon.vue.d.ts +0 -0
  94. /package/dist/squirrel/{components → squirrel/components}/p-table-header-cell/p-table-header-cell.vue.d.ts +0 -0
  95. /package/dist/squirrel/{components → squirrel/components}/p-table-loader/p-table-loader.vue.d.ts +0 -0
  96. /package/dist/squirrel/{components → squirrel/components}/p-table-sort/p-table-sort.config.d.ts +0 -0
  97. /package/dist/squirrel/{components → squirrel/components}/p-table-td/p-table-td.vue.d.ts +0 -0
  98. /package/dist/squirrel/{components → squirrel/components}/p-tabs/p-tabs.vue.d.ts +0 -0
  99. /package/dist/squirrel/{components → squirrel/components}/p-textarea/p-textarea.vue.d.ts +0 -0
  100. /package/dist/squirrel/{components → squirrel/components}/p-toggle/p-toggle.vue.d.ts +0 -0
  101. /package/dist/squirrel/{tailwind → squirrel/tailwind}/config.d.ts +0 -0
  102. /package/dist/squirrel/{utils → squirrel/utils}/currency.d.ts +0 -0
  103. /package/dist/squirrel/{utils → squirrel/utils}/dom.d.ts +0 -0
  104. /package/dist/squirrel/{utils → squirrel/utils}/inputClassesShared.d.ts +0 -0
  105. /package/dist/squirrel/{utils → squirrel/utils}/link.d.ts +0 -0
  106. /package/dist/squirrel/{utils → squirrel/utils}/listKeyboardNavigation.d.ts +0 -0
  107. /package/dist/squirrel/{utils → squirrel/utils}/number.d.ts +0 -0
  108. /package/dist/squirrel/{utils → squirrel/utils}/object.d.ts +0 -0
  109. /package/dist/squirrel/{utils → squirrel/utils}/pagination.d.ts +0 -0
  110. /package/dist/squirrel/{utils → squirrel/utils}/sanitization.d.ts +0 -0
  111. /package/dist/squirrel/{utils → squirrel/utils}/tailwind.d.ts +0 -0
  112. /package/dist/squirrel/{utils → squirrel/utils}/text.d.ts +0 -0
@@ -1,7 +1,6 @@
1
1
  import PIcon from '@squirrel/components/p-icon/p-icon.vue';
2
2
  import { P_ICON_ALIASES } from '@squirrel/components/p-icon/p-icon.types';
3
3
  import { createWrapperFor } from '@tests/vitest.helpers';
4
- import { expect } from 'vitest';
5
4
 
6
5
  const createWrapper = (props, attrs) => {
7
6
  return createWrapperFor(PIcon, {
@@ -28,7 +28,8 @@
28
28
  </template>
29
29
 
30
30
  <script setup lang="ts">
31
- import { type Component, onBeforeUnmount, ref, toValue, watch } from 'vue';
31
+ import { isComponent } from '@squirrel/utils/component';
32
+ import { onBeforeUnmount, ref, toValue, watch } from 'vue';
32
33
  import { usePLoading } from '@squirrel/components/p-loading/usePLoading';
33
34
 
34
35
  const textDivClass = `overflow-hidden whitespace-nowrap px-4 pt-1 h-8 text-center text-sm font-semibold text-p-purple-60`;
@@ -53,12 +54,6 @@ watch(
53
54
  { flush: 'post' }
54
55
  );
55
56
 
56
- const isComponent = (content: unknown): content is Component => {
57
- const isComponent = typeof content === 'object' && content !== null;
58
-
59
- return isComponent;
60
- };
61
-
62
57
  onBeforeUnmount(() => {
63
58
  loadingHide();
64
59
  });
@@ -6,7 +6,6 @@ import {
6
6
  isLastColFixedInjectionKey,
7
7
  } from '@squirrel/components/p-table/p-table.types';
8
8
  import { createWrapperFor } from '@tests/vitest.helpers';
9
- import { expect } from 'vitest';
10
9
  import { ref } from 'vue';
11
10
 
12
11
  const DEFAULT_TD_CLASSES = [
@@ -0,0 +1,29 @@
1
+ import PIcon from '@squirrel/components/p-icon/p-icon.vue';
2
+ import { isComponent } from '@squirrel/utils/component';
3
+
4
+ describe('isComponent', () => {
5
+ it('should return true for a valid component object', () => {
6
+ expect(isComponent(PIcon)).toBe(true);
7
+ });
8
+
9
+ it('should return false for null', () => {
10
+ expect(isComponent(null)).toBe(false);
11
+ });
12
+
13
+ it.each([
14
+ ['string', 'string'],
15
+ ['number', 123],
16
+ ['boolean', true],
17
+ ['undefined', undefined],
18
+ ['symbol', Symbol('symbol')],
19
+ ['function', () => {}],
20
+ ['array', []],
21
+ ['date', new Date()],
22
+ ['regexp', /regex/],
23
+ ['error', new Error('error')],
24
+ ['map', new Map()],
25
+ ['set', new Set()],
26
+ ])('should return false for a non-component object: %s', (_, value) => {
27
+ expect(isComponent(value)).toBe(false);
28
+ });
29
+ });
@@ -0,0 +1,5 @@
1
+ import { type Component } from 'vue';
2
+ import { isPlainObject } from 'lodash-es';
3
+
4
+ // Vue produces a different type of object in dev and prod mode, so we cannot check for e.g `typeof val.render === 'function`
5
+ export const isComponent = (val: unknown): val is Component => isPlainObject(val);
@@ -1,4 +1,4 @@
1
- import { toString } from '@squirrel/utils/string';
1
+ import { isString, toString } from '@squirrel/utils/string';
2
2
 
3
3
  describe('toString', () => {
4
4
  it.each(['', new Date(), NaN, Infinity, {}, [], true, false, null, undefined])(
@@ -16,3 +16,21 @@ describe('toString', () => {
16
16
  expect(toString(2903498.22)).toBe('2903498.22');
17
17
  });
18
18
  });
19
+
20
+ describe('isString', () => {
21
+ it('should return true for a string', () => {
22
+ expect(isString('hello')).toBe(true);
23
+ });
24
+
25
+ it.each([
26
+ [123, false],
27
+ [{}, false],
28
+ [[], false],
29
+ [null, false],
30
+ [undefined, false],
31
+ [true, false],
32
+ [() => {}, false],
33
+ ])('should return %s for %p', (input, expected) => {
34
+ expect(isString(input)).toBe(expected);
35
+ });
36
+ });
@@ -1,3 +1,5 @@
1
+ export const isString = (val: unknown): val is string => typeof val === 'string';
2
+
1
3
  export const toString = (value: unknown): string => {
2
4
  if (typeof value === 'number' && (!isFinite(value) || isNaN(value))) {
3
5
  return '';
@@ -1,53 +0,0 @@
1
- import PActionBar from './p-action-bar/p-action-bar.vue';
2
- import PAlert from './p-alert/p-alert.vue';
3
- import PAvatar from './p-avatar/p-avatar.vue';
4
- import PBtn from './p-btn/p-btn.vue';
5
- import PCard from './p-card/p-card.vue';
6
- import PCheckbox from './p-checkbox/p-checkbox.vue';
7
- import PChips from './p-chips/p-chips.vue';
8
- import PCloseBtn from './p-close-btn/p-close-btn.vue';
9
- import PDatePicker from './p-date-picker/p-date-picker.vue';
10
- import PDrawer from './p-drawer/p-drawer.vue';
11
- import PDropdown from './p-dropdown/p-dropdown.vue';
12
- import PDropdownSelect from './p-dropdown-select/p-dropdown-select.vue';
13
- import PFileUpload from './p-file-upload/p-file-upload.vue';
14
- import PFilterIcon from './p-table-header-cell/p-table-filter-icon.vue';
15
- import PIcon from './p-icon/p-icon.vue';
16
- import PInfoIcon from './p-info-icon/p-info-icon.vue';
17
- import PInlineDatePicker from './p-inline-date-picker/p-inline-date-picker.vue';
18
- import PInput from './p-input/p-input.vue';
19
- import PInputNumber from './p-input-number/p-input-number.vue';
20
- import PInputPercent from './p-input-percent/p-input-percent.vue';
21
- import PInputSearch from './p-input-search/p-input-search.vue';
22
- import PLink from './p-link/p-link.vue';
23
- import PLoading from './p-loading/p-loading.vue';
24
- import PModal from './p-modal/p-modal.vue';
25
- import PPagination from './p-pagination/p-pagination.vue';
26
- import PPaginationInfo from './p-pagination-info/p-pagination-info.vue';
27
- import PProgressBar from './p-progress-bar/p-progress-bar.vue';
28
- import PRingLoader from './p-ring-loader/p-ring-loader.vue';
29
- import PSelect from './p-select/p-select.vue';
30
- import PSelectBtn from './p-select-btn/p-select-btn.vue';
31
- import PSelectList from './p-select-list/p-select-list.vue';
32
- import PSelectPill from './p-select-pill/p-select-pill.vue';
33
- import PSkeletonLoader from './p-skeleton-loader/p-skeleton-loader.vue';
34
- import PTable from './p-table/p-table.vue';
35
- import PTableHeaderCell from './p-table-header-cell/p-table-header-cell.vue';
36
- import PTableLoader from './p-table-loader/p-table-loader.vue';
37
- import PTableSort from './p-table-sort/p-table-sort.vue';
38
- import PTableTd from './p-table-td/p-table-td.vue';
39
- import PTabs from './p-tabs/p-tabs.vue';
40
- import PTextarea from './p-textarea/p-textarea.vue';
41
- import PToggle from './p-toggle/p-toggle.vue';
42
- import { type FileUploadFile } from './p-file-upload/p-file-upload.types';
43
- import { type HeaderCellAttrs, MIN_WIDTH_COL_RESIZE, type TableCol, type ThAttrs, colsInjectionKey, isColsResizableInjectionKey, isFirstColFixedInjectionKey, isLastColFixedInjectionKey } from './p-table/p-table.types';
44
- import { type PActionBarAction } from './p-action-bar/p-action-bar.types';
45
- import { type PIconAlias, P_ICON_ALIASES } from './p-icon/p-icon.types';
46
- import { SORTING_TYPES, type SortingType, type SortingTypeWithoutNoSorting } from './p-table-sort/p-table-sort.config';
47
- import { type Size } from './p-btn/p-btn.types';
48
- import { usePLoading } from './p-loading/usePLoading';
49
- import { usePModal } from './p-modal/usePModal';
50
- import { usePTableColResize } from './p-table/usePTableColResize';
51
- import { usePTableRowVirtualizer } from './p-table/usePTableRowVirtualizer';
52
- import { useSelectList } from './p-select-list/useSelectList';
53
- export { PActionBar, PActionBarAction, PAlert, PAvatar, PBtn, PCard, PCheckbox, PChips, PCloseBtn, PDatePicker, PDrawer, PDropdown, PDropdownSelect, PFileUpload, PFilterIcon, PIcon, PInfoIcon, PInlineDatePicker, PInput, PInputNumber, PInputPercent, PInputSearch, PLink, PLoading, PModal, PPagination, PPaginationInfo, PProgressBar, PRingLoader, PSelect, PSelectBtn, PSelectList, PSelectPill, PSkeletonLoader, PTable, PTableHeaderCell, PTableLoader, PTableSort, PTableTd, PTabs, PTextarea, PToggle, SORTING_TYPES, MIN_WIDTH_COL_RESIZE, P_ICON_ALIASES, colsInjectionKey, isColsResizableInjectionKey, isFirstColFixedInjectionKey, isLastColFixedInjectionKey, usePModal, usePTableColResize, usePTableRowVirtualizer, useSelectList, usePLoading, SortingType, SortingTypeWithoutNoSorting, Size, FileUploadFile, HeaderCellAttrs, TableCol, ThAttrs, PIconAlias, };
@@ -1,2 +0,0 @@
1
- import { useInputClasses } from './useInputClasses';
2
- export { useInputClasses };
@@ -1,5 +0,0 @@
1
- import './assets/squirrel.css';
2
- export * from './tailwind/config';
3
- export * from './components';
4
- export * from './composables';
5
- export * from './utils';
@@ -1 +0,0 @@
1
- export declare const toString: (value: unknown) => string;