@pequity/squirrel 8.4.1 → 8.4.3

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 (55) hide show
  1. package/dist/cjs/chunks/index.js +3 -4
  2. package/dist/cjs/chunks/p-dropdown-select.js +12 -10
  3. package/dist/cjs/chunks/p-icon.js +13 -16
  4. package/dist/cjs/chunks/p-steps.js +58 -0
  5. package/dist/cjs/dom.js +1 -2
  6. package/dist/cjs/index.js +36 -89
  7. package/dist/cjs/listKeyboardNavigation.js +2 -2
  8. package/dist/cjs/p-dropdown.js +1 -2
  9. package/dist/cjs/p-file-upload.js +1 -2
  10. package/dist/cjs/p-input-search.js +1 -2
  11. package/dist/cjs/p-modal.js +4 -7
  12. package/dist/cjs/p-skeleton-loader.js +1 -4
  13. package/dist/cjs/p-steps.js +2 -0
  14. package/dist/cjs/usePLoading.js +2 -8
  15. package/dist/cjs/usePTableColResize.js +1 -2
  16. package/dist/cjs/usePTableRowVirtualizer.js +9 -6
  17. package/dist/cjs/useSelectList.js +13 -21
  18. package/dist/es/chunks/index.js +3 -4
  19. package/dist/es/chunks/p-dropdown-select.js +14 -12
  20. package/dist/es/chunks/p-icon.js +13 -16
  21. package/dist/es/chunks/p-steps.js +59 -0
  22. package/dist/es/dom.js +1 -2
  23. package/dist/es/index.js +69 -122
  24. package/dist/es/listKeyboardNavigation.js +2 -2
  25. package/dist/es/p-dropdown-select.js +1 -1
  26. package/dist/es/p-dropdown.js +1 -2
  27. package/dist/es/p-file-upload.js +1 -2
  28. package/dist/es/p-input-search.js +1 -2
  29. package/dist/es/p-modal.js +4 -7
  30. package/dist/es/p-skeleton-loader.js +1 -4
  31. package/dist/es/p-steps.js +4 -1
  32. package/dist/es/usePLoading.js +2 -8
  33. package/dist/es/usePTableColResize.js +1 -2
  34. package/dist/es/usePTableRowVirtualizer.js +10 -7
  35. package/dist/es/useSelectList.js +13 -21
  36. package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +2 -2
  37. package/dist/squirrel/components/p-info-icon/p-info-icon.vue.d.ts +2 -2
  38. package/dist/squirrel/components/p-input/p-input.vue.d.ts +1 -1
  39. package/dist/squirrel/components/p-input-number/p-input-number.vue.d.ts +2 -2
  40. package/dist/squirrel/components/p-link/p-link.vue.d.ts +2 -2
  41. package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +6 -6
  42. package/dist/squirrel/components/p-pagination-info/p-pagination-info.vue.d.ts +2 -2
  43. package/dist/squirrel/components/p-table/p-table.vue.d.ts +1 -1
  44. package/dist/squirrel/components/p-table/usePTableRowVirtualizer.d.ts +7 -7
  45. package/dist/squirrel.css +74 -74
  46. package/package.json +21 -24
  47. package/squirrel/components/p-action-bar/p-action-bar.stories.js +4 -3
  48. package/squirrel/components/p-dropdown-select/p-dropdown-select.spec.js +26 -4
  49. package/squirrel/components/p-dropdown-select/p-dropdown-select.vue +3 -2
  50. package/squirrel/components/p-input-number/p-input-number.stories.js +2 -1
  51. package/squirrel/components/p-select-list/p-select-list.spec.js +22 -4
  52. package/squirrel/components/p-select-list/p-select-list.vue +3 -2
  53. package/squirrel/components/p-select-list/useSelectList.ts +2 -2
  54. package/squirrel/components/p-table/usePTableRowVirtualizer.ts +10 -6
  55. package/squirrel/components/p-tabs/p-tabs.stories.js +2 -1
@@ -332,6 +332,20 @@ describe('PSelectList.vue', () => {
332
332
  cleanup(wrapper);
333
333
  });
334
334
 
335
+ it('displays a spacer on non-selected items', async () => {
336
+ useVirtualizer.mockImplementation(() => createMockedVirtualizer(20));
337
+
338
+ const wrapper = createWrapper({ selected: [] }, { multiple: true });
339
+
340
+ const checkIcons = wrapper.findAll('[p-select-list-option-item] img');
341
+ const spacers = wrapper.findAll('[p-select-list-option-item] .w-\\[26px\\].pl-2');
342
+
343
+ expect(checkIcons.length).toBe(0);
344
+ expect(spacers.length).toBe(20);
345
+
346
+ cleanup(wrapper);
347
+ });
348
+
335
349
  it('works with an object for v-model', async () => {
336
350
  useVirtualizer.mockImplementation(() => createMockedVirtualizer(20));
337
351
 
@@ -531,9 +545,11 @@ describe('PSelectList.vue', () => {
531
545
 
532
546
  listItems.forEach((item, i) => {
533
547
  if (i === 0 || i === 1) {
534
- expect(item.classes()).toContain('pointer-events-none');
548
+ expect(item.classes()).toContain('cursor-default');
549
+ expect(item.classes()).not.toContain('cursor-pointer');
535
550
  } else {
536
- expect(item.classes()).not.toContain('pointer-events-none');
551
+ expect(item.classes()).toContain('cursor-pointer');
552
+ expect(item.classes()).not.toContain('cursor-default');
537
553
  }
538
554
  });
539
555
 
@@ -553,9 +569,11 @@ describe('PSelectList.vue', () => {
553
569
 
554
570
  listItems.forEach((item, i) => {
555
571
  if (i === 0 || i === 1) {
556
- expect(item.classes()).toContain('pointer-events-none');
572
+ expect(item.classes()).toContain('cursor-default');
573
+ expect(item.classes()).not.toContain('cursor-pointer');
557
574
  } else {
558
- expect(item.classes()).not.toContain('pointer-events-none');
575
+ expect(item.classes()).toContain('cursor-pointer');
576
+ expect(item.classes()).not.toContain('cursor-default');
559
577
  }
560
578
  });
561
579
 
@@ -75,12 +75,12 @@
75
75
  LIST_ITEM_CLASS,
76
76
  {
77
77
  [LIST_ITEM_ACTIVE_CLASS]: isSelected(getValue(row.index)),
78
- [LIST_ITEM_DISABLED_CLASS]: isDisabled(computedItems[row.index]),
79
78
  },
79
+ isDisabled(computedItems[row.index]) ? LIST_ITEM_DISABLED_CLASS : 'cursor-pointer',
80
80
  ]"
81
81
  p-select-list-option-item
82
82
  :style="listItemStyle"
83
- @click="select($event, getValue(row.index))"
83
+ @click="!isDisabled(computedItems[row.index]) && select($event, getValue(row.index))"
84
84
  >
85
85
  <div :class="['flex items-center', { [SIZES[size]]: !itemSize }]">
86
86
  <slot
@@ -104,6 +104,7 @@
104
104
  class="ml-auto fill-p-purple-60 pl-2"
105
105
  src="@squirrel/assets/select-check.svg"
106
106
  />
107
+ <div v-else class="ml-auto h-4 w-[26px] pl-2"></div>
107
108
  </div>
108
109
  </div>
109
110
  </div>
@@ -44,9 +44,9 @@ const nextLoop = (ms?: number) => new Promise((resolve) => setTimeout(resolve, m
44
44
  // Constants
45
45
  const LIST_ITEM_SIZES = { sm: 32, md: 40, lg: 48 };
46
46
  const LIST_ITEM_CLASS =
47
- 'clear-both block w-full cursor-pointer whitespace-nowrap py-1 px-3 text-left text-sm font-medium hover:bg-p-blue-10';
47
+ 'clear-both block w-full whitespace-nowrap py-1 px-3 text-left text-sm font-medium hover:bg-p-blue-10';
48
48
  const LIST_ITEM_ACTIVE_CLASS = 'selected';
49
- const LIST_ITEM_DISABLED_CLASS = 'opacity-30 pointer-events-none';
49
+ const LIST_ITEM_DISABLED_CLASS = 'opacity-30 cursor-default';
50
50
 
51
51
  export const useSelectList = (props: Props, inputSearch: InputSearch, virtualizerRef: VirtualizerRef, emit: Emits) => {
52
52
  // Data
@@ -1,5 +1,5 @@
1
1
  import { useVirtualizer } from '@tanstack/vue-virtual';
2
- import { type ComponentPublicInstance, computed, type ComputedRef, isRef, nextTick, type Ref, ref, unref } from 'vue';
2
+ import { type ComponentPublicInstance, computed, type ComputedRef, nextTick, ref } from 'vue';
3
3
 
4
4
  type Options = ComputedRef<{
5
5
  count: number;
@@ -16,7 +16,7 @@ export const usePTableRowVirtualizer = (options: Options) => {
16
16
  virtualRows: ref([{ key: 0, index: 0 }]),
17
17
  paddingTop: ref(0),
18
18
  paddingBottom: ref(0),
19
- measureElement: () => ref(undefined),
19
+ measureElement: () => undefined,
20
20
  };
21
21
  }
22
22
 
@@ -32,15 +32,19 @@ export const usePTableRowVirtualizer = (options: Options) => {
32
32
  : 0
33
33
  );
34
34
 
35
- const measureElement = (cmp: ComponentPublicInstance | Ref<HTMLElement>) => {
36
- const el = isRef(cmp) ? unref(cmp) : cmp?.$el;
35
+ const measureElement = (el: Element | ComponentPublicInstance | null) => {
36
+ if (!el) {
37
+ return;
38
+ }
39
+
40
+ const element = el instanceof Element ? el : el.$el;
37
41
 
38
42
  nextTick(() => {
39
- if (!el) {
43
+ if (!element || !(element instanceof HTMLElement)) {
40
44
  return;
41
45
  }
42
46
 
43
- virtualizer.value.measureElement(el);
47
+ virtualizer.value.measureElement(element);
44
48
  });
45
49
 
46
50
  return undefined;
@@ -1,6 +1,7 @@
1
1
  import PaginateRightIcon from '@squirrel/assets/pagination-right-icon.svg?inline';
2
2
  import PTabs from '@squirrel/components/p-tabs/p-tabs.vue';
3
3
  import { action } from 'storybook/actions';
4
+ import { markRaw } from 'vue';
4
5
 
5
6
  export default {
6
7
  title: 'Components/PTabs',
@@ -34,7 +35,7 @@ export const Default = {
34
35
  {
35
36
  title: 'Tab 2',
36
37
  name: 'tab2',
37
- icon: PaginateRightIcon,
38
+ icon: markRaw(PaginateRightIcon),
38
39
  },
39
40
  {
40
41
  title: 'Tab 3',