@pequity/squirrel 8.0.1 → 8.1.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 (42) hide show
  1. package/dist/cjs/chunks/p-action-bar.js +6 -9
  2. package/dist/cjs/chunks/p-steps.js +52 -0
  3. package/dist/cjs/index.js +2 -0
  4. package/dist/cjs/p-steps.js +3 -0
  5. package/dist/cjs/usePLoading.js +7 -1
  6. package/dist/es/chunks/p-action-bar.js +6 -9
  7. package/dist/es/chunks/p-steps.js +53 -0
  8. package/dist/es/index.js +8 -6
  9. package/dist/es/p-steps.js +4 -0
  10. package/dist/es/usePLoading.js +7 -1
  11. package/dist/squirrel/components/index.d.ts +2 -1
  12. package/dist/squirrel/components/p-alert/p-alert.vue.d.ts +3 -2
  13. package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +1 -1
  14. package/dist/squirrel/components/p-card/p-card.vue.d.ts +2 -19
  15. package/dist/squirrel/components/p-checkbox/p-checkbox.vue.d.ts +2 -37
  16. package/dist/squirrel/components/p-drawer/p-drawer.vue.d.ts +3 -2
  17. package/dist/squirrel/components/p-info-icon/p-info-icon.vue.d.ts +2 -9
  18. package/dist/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue.d.ts +3 -33
  19. package/dist/squirrel/components/p-input/p-input.vue.d.ts +6 -4
  20. package/dist/squirrel/components/p-input-number/p-input-number.vue.d.ts +3 -107
  21. package/dist/squirrel/components/p-link/p-link.vue.d.ts +3 -11
  22. package/dist/squirrel/components/p-loading/usePLoading.d.ts +1 -0
  23. package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +2 -227
  24. package/dist/squirrel/components/p-pagination-info/p-pagination-info.vue.d.ts +2 -74
  25. package/dist/squirrel/components/p-select/p-select.vue.d.ts +3 -110
  26. package/dist/squirrel/components/p-select-btn/p-select-btn.vue.d.ts +2 -29
  27. package/dist/squirrel/components/p-steps/p-steps.vue.d.ts +17 -0
  28. package/dist/squirrel/components/p-table/p-table.vue.d.ts +10 -5
  29. package/dist/squirrel/components/p-table-header-cell/p-table-header-cell.vue.d.ts +1 -1
  30. package/dist/squirrel/components/p-table-td/p-table-td.vue.d.ts +2 -19
  31. package/dist/squirrel/components/p-textarea/p-textarea.vue.d.ts +3 -72
  32. package/dist/squirrel/components/p-toggle/p-toggle.vue.d.ts +2 -2
  33. package/package.json +14 -14
  34. package/squirrel/components/index.ts +2 -0
  35. package/squirrel/components/p-action-bar/p-action-bar.spec.ts +17 -11
  36. package/squirrel/components/p-action-bar/p-action-bar.vue +6 -6
  37. package/squirrel/components/p-loading/p-loading.spec.js +35 -2
  38. package/squirrel/components/p-loading/usePLoading.ts +10 -1
  39. package/squirrel/components/p-steps/__snapshots__/p-steps.spec.js.snap +16 -0
  40. package/squirrel/components/p-steps/p-steps.spec.js +126 -0
  41. package/squirrel/components/p-steps/p-steps.stories.js +31 -0
  42. package/squirrel/components/p-steps/p-steps.vue +47 -0
@@ -0,0 +1,47 @@
1
+ <template>
2
+ <div class="flex items-center gap-2">
3
+ <template v-for="(step, idx) in steps" :key="step">
4
+ <div class="text-nowrap rounded-full border px-4 py-1 text-sm font-semibold" :class="stepClasses(step, idx)">
5
+ {{ stepTitle(step) }}
6
+ </div>
7
+ <div v-if="idx < steps.length - 1" class="flex items-center">
8
+ <PIcon
9
+ icon="material-symbols:arrow-right-alt-rounded"
10
+ :class="[currentStepIndex <= idx ? 'text-p-gray-30' : 'text-p-blue-50']"
11
+ />
12
+ </div>
13
+ </template>
14
+ </div>
15
+ </template>
16
+
17
+ <script setup lang="ts" generic="T extends readonly string[]">
18
+ import PIcon from '@squirrel/components/p-icon/p-icon.vue';
19
+ import { startCase } from 'lodash-es';
20
+ import { computed } from 'vue';
21
+
22
+ type Props = {
23
+ steps: T;
24
+ currentStep: T[number];
25
+ stepTitleMap?: Partial<Record<T[number], string>>;
26
+ };
27
+
28
+ const props = defineProps<Props>();
29
+
30
+ const currentStepIndex = computed(() => props.steps.findIndex((s) => s === props.currentStep));
31
+
32
+ const stepClasses = (step: T[number], stepIndex: number) => {
33
+ if (step === props.currentStep) {
34
+ return 'border border-p-blue-50 bg-p-blue-50 text-surface';
35
+ }
36
+
37
+ if (currentStepIndex.value < stepIndex) {
38
+ return 'border border-p-gray-30 text-p-gray-30';
39
+ }
40
+
41
+ return 'border border-p-blue-50 text-p-blue-50';
42
+ };
43
+
44
+ const stepTitle = (step: T[number]) => {
45
+ return props.stepTitleMap?.[step] || startCase(step);
46
+ };
47
+ </script>