@pequity/squirrel 8.3.0 → 8.3.2

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 (35) hide show
  1. package/dist/cjs/index.js +69 -18
  2. package/dist/cjs/p-modal.js +9 -5
  3. package/dist/cjs/p-steps.js +0 -2
  4. package/dist/es/chunks/p-dropdown-select.js +2 -2
  5. package/dist/es/index.js +102 -51
  6. package/dist/es/p-dropdown-select.js +1 -1
  7. package/dist/es/p-modal.js +9 -5
  8. package/dist/es/p-steps.js +1 -4
  9. package/dist/squirrel/components/index.d.ts +2 -1
  10. package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +9 -0
  11. package/dist/squirrel/components/p-steps/p-steps.types.d.ts +5 -0
  12. package/dist/squirrel/components/p-steps/p-steps.vue.d.ts +14 -15
  13. package/dist/squirrel.css +88 -88
  14. package/package.json +5 -5
  15. package/squirrel/components/index.ts +2 -0
  16. package/squirrel/components/p-drawer/p-drawer.stories.js +4 -6
  17. package/squirrel/components/p-dropdown/p-dropdown.stories.js +5 -7
  18. package/squirrel/components/p-dropdown-select/p-dropdown-select.stories.js +8 -14
  19. package/squirrel/components/p-input-percent/p-input-percent.stories.js +7 -12
  20. package/squirrel/components/p-modal/p-modal-basic.spec.js +32 -0
  21. package/squirrel/components/p-modal/p-modal.stories.js +22 -0
  22. package/squirrel/components/p-modal/p-modal.vue +7 -4
  23. package/squirrel/components/p-pagination/p-pagination.stories.js +4 -6
  24. package/squirrel/components/p-select/p-select.stories.js +2 -2
  25. package/squirrel/components/p-select-btn/p-select-btn.stories.js +15 -26
  26. package/squirrel/components/p-select-pill/p-select-pill.stories.js +12 -20
  27. package/squirrel/components/p-steps/__snapshots__/{p-steps.spec.js.snap → p-steps.spec.ts.snap} +5 -5
  28. package/squirrel/components/p-steps/p-steps.spec.ts +203 -0
  29. package/squirrel/components/p-steps/p-steps.stories.js +32 -4
  30. package/squirrel/components/p-steps/p-steps.types.ts +5 -0
  31. package/squirrel/components/p-steps/p-steps.vue +30 -21
  32. package/squirrel/components/p-table-sort/p-table-sort.stories.js +4 -6
  33. package/dist/cjs/chunks/p-steps.js +0 -55
  34. package/dist/es/chunks/p-steps.js +0 -56
  35. package/squirrel/components/p-steps/p-steps.spec.js +0 -126
@@ -1,56 +0,0 @@
1
- import { defineComponent, computed, createElementBlock, openBlock, Fragment, renderList, createElementVNode, createCommentVNode, normalizeClass, toDisplayString, createVNode } from "vue";
2
- import { _ as _sfc_main$1 } from "./p-icon.js";
3
- import { startCase } from "lodash-es";
4
- const _hoisted_1 = { class: "flex items-center gap-2" };
5
- const _hoisted_2 = {
6
- key: 0,
7
- class: "flex items-center"
8
- };
9
- const _sfc_main = /* @__PURE__ */ defineComponent({
10
- ...{
11
- name: "PSteps"
12
- },
13
- __name: "p-steps",
14
- props: {
15
- steps: {},
16
- currentStep: {},
17
- stepTitleMap: {}
18
- },
19
- setup(__props) {
20
- const props = __props;
21
- const currentStepIndex = computed(() => props.steps.findIndex((s) => s === props.currentStep));
22
- const stepClasses = (step, stepIndex) => {
23
- if (step === props.currentStep) {
24
- return "border border-p-blue-50 bg-p-blue-50 text-surface";
25
- }
26
- if (currentStepIndex.value < stepIndex) {
27
- return "border border-p-gray-30 text-p-gray-30";
28
- }
29
- return "border border-p-blue-50 text-p-blue-50";
30
- };
31
- const stepTitle = (step) => {
32
- var _a;
33
- return ((_a = props.stepTitleMap) == null ? void 0 : _a[step]) || startCase(step);
34
- };
35
- return (_ctx, _cache) => {
36
- return openBlock(), createElementBlock("div", _hoisted_1, [
37
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.steps, (step, idx) => {
38
- return openBlock(), createElementBlock(Fragment, { key: step }, [
39
- createElementVNode("div", {
40
- class: normalizeClass(["text-nowrap rounded-full border px-4 py-1 text-sm font-semibold", stepClasses(step, idx)])
41
- }, toDisplayString(stepTitle(step)), 3),
42
- idx < _ctx.steps.length - 1 ? (openBlock(), createElementBlock("div", _hoisted_2, [
43
- createVNode(_sfc_main$1, {
44
- icon: "material-symbols:arrow-right-alt-rounded",
45
- class: normalizeClass([currentStepIndex.value <= idx ? "text-p-gray-30" : "text-p-blue-50"])
46
- }, null, 8, ["class"])
47
- ])) : createCommentVNode("", true)
48
- ], 64);
49
- }), 128))
50
- ]);
51
- };
52
- }
53
- });
54
- export {
55
- _sfc_main as _
56
- };
@@ -1,126 +0,0 @@
1
- import PSteps from '@squirrel/components/p-steps/p-steps.vue';
2
- import { createWrapperFor } from '@tests/vitest.helpers';
3
-
4
- describe('PSteps.vue', () => {
5
- it('renders correctly', () => {
6
- const wrapper = createWrapperFor(PSteps, {
7
- props: {
8
- steps: ['first', 'second', 'third'],
9
- currentStep: 'second',
10
- stepTitleMap: {},
11
- },
12
- });
13
- expect(wrapper.html()).toMatchSnapshot();
14
- });
15
-
16
- it('renders the correct number of steps', () => {
17
- const steps = ['first', 'second', 'third'];
18
- const wrapper = createWrapperFor(PSteps, {
19
- props: {
20
- steps,
21
- currentStep: 'second',
22
- stepTitleMap: {},
23
- },
24
- });
25
-
26
- const stepElements = wrapper.findAll('.rounded-full.border');
27
- expect(stepElements.length).toBe(steps.length);
28
- });
29
-
30
- it('applies correct classes for current step', () => {
31
- const wrapper = createWrapperFor(PSteps, {
32
- props: {
33
- steps: ['first', 'second', 'third'],
34
- currentStep: 'second',
35
- stepTitleMap: {},
36
- },
37
- });
38
-
39
- const stepElements = wrapper.findAll('.rounded-full.border');
40
-
41
- // First step should be completed (blue text)
42
- expect(stepElements[0].classes()).toContain('text-nowrap');
43
- expect(stepElements[0].classes()).toContain('text-p-blue-50');
44
- expect(stepElements[0].classes()).toContain('border-p-blue-50');
45
-
46
- // Second step should be current (blue background)
47
- expect(stepElements[1].classes()).toContain('text-nowrap');
48
- expect(stepElements[1].classes()).toContain('bg-p-blue-50');
49
- expect(stepElements[1].classes()).toContain('text-surface');
50
- expect(stepElements[1].classes()).toContain('border-p-blue-50');
51
-
52
- // Third step should be upcoming (gray)
53
- expect(stepElements[2].classes()).toContain('text-nowrap');
54
- expect(stepElements[2].classes()).toContain('text-p-gray-30');
55
- expect(stepElements[2].classes()).toContain('border-p-gray-30');
56
- });
57
-
58
- it('displays step titles from stepTitleMap when provided', () => {
59
- const wrapper = createWrapperFor(PSteps, {
60
- props: {
61
- steps: ['step1', 'step2', 'step3'],
62
- currentStep: 'step2',
63
- stepTitleMap: {
64
- step1: 'Custom Step 1',
65
- step2: 'Custom Step 2',
66
- step3: 'Custom Step 3',
67
- },
68
- },
69
- });
70
-
71
- const stepElements = wrapper.findAll('.rounded-full.border');
72
- expect(stepElements[0].text()).toBe('Custom Step 1');
73
- expect(stepElements[1].text()).toBe('Custom Step 2');
74
- expect(stepElements[2].text()).toBe('Custom Step 3');
75
- });
76
-
77
- it('uses startCase for step titles when stepTitleMap entry is not provided', () => {
78
- const wrapper = createWrapperFor(PSteps, {
79
- props: {
80
- steps: ['firstStep', 'secondStep', 'thirdStep'],
81
- currentStep: 'secondStep',
82
- stepTitleMap: {
83
- secondStep: 'Custom Second',
84
- },
85
- },
86
- });
87
-
88
- const stepElements = wrapper.findAll('.rounded-full.border');
89
- expect(stepElements[0].text()).toBe('First Step'); // startCase applied
90
- expect(stepElements[1].text()).toBe('Custom Second'); // from map
91
- expect(stepElements[2].text()).toBe('Third Step'); // startCase applied
92
- });
93
-
94
- it('renders the correct number of arrows between steps', () => {
95
- const wrapper = createWrapperFor(PSteps, {
96
- props: {
97
- steps: ['first', 'second', 'third', 'fourth'],
98
- currentStep: 'second',
99
- stepTitleMap: {},
100
- },
101
- });
102
-
103
- // There should be 3 arrows for 4 steps
104
- const arrowElements = wrapper.findAll('[icon="material-symbols:arrow-right-alt-rounded"]');
105
- expect(arrowElements.length).toBe(3);
106
- });
107
-
108
- it('applies the correct classes to arrows based on current step', () => {
109
- const wrapper = createWrapperFor(PSteps, {
110
- props: {
111
- steps: ['first', 'second', 'third', 'fourth'],
112
- currentStep: 'second',
113
- stepTitleMap: {},
114
- },
115
- });
116
-
117
- const arrowElements = wrapper.findAll('[icon="material-symbols:arrow-right-alt-rounded"]');
118
-
119
- // Arrow between first and second step should be colored
120
- expect(arrowElements[0].classes()).toContain('text-p-blue-50');
121
-
122
- // Arrow after current step should be gray
123
- expect(arrowElements[1].classes()).toContain('text-p-gray-30');
124
- expect(arrowElements[2].classes()).toContain('text-p-gray-30');
125
- });
126
- });