@pequity/squirrel 7.2.6 → 8.0.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.
- package/dist/cjs/chunks/p-input-number.js +5 -5
- package/dist/es/chunks/p-input-number.js +5 -5
- package/dist/squirrel/components/p-input-number/p-input-number.vue.d.ts +6 -6
- package/package.json +5 -5
- package/squirrel/components/p-input-number/p-input-number.spec.js +29 -2
- package/squirrel/components/p-input-number/p-input-number.vue +7 -5
|
@@ -48,7 +48,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
48
48
|
type: String,
|
|
49
49
|
default: ""
|
|
50
50
|
},
|
|
51
|
-
|
|
51
|
+
prefixString: {
|
|
52
52
|
type: String,
|
|
53
53
|
default: ""
|
|
54
54
|
}
|
|
@@ -79,7 +79,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
79
79
|
const { labelClasses, inputClasses, errorMsgClasses } = useInputClasses.useInputClasses(
|
|
80
80
|
vue.computed(() => ({
|
|
81
81
|
...props,
|
|
82
|
-
prefix: !!slots.prefix || !!props.
|
|
82
|
+
prefix: !!slots.prefix || !!props.prefixString,
|
|
83
83
|
suffix: !!slots.suffix
|
|
84
84
|
}))
|
|
85
85
|
);
|
|
@@ -146,11 +146,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
146
146
|
}, null, 8, ["text"])) : vue.createCommentVNode("", true)
|
|
147
147
|
]),
|
|
148
148
|
vue.createElementVNode("div", _hoisted_3, [
|
|
149
|
-
!!_ctx.$slots.prefix || __props.
|
|
149
|
+
!!_ctx.$slots.prefix || __props.prefixString ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [
|
|
150
150
|
vue.renderSlot(_ctx.$slots, "prefix", {}, () => [
|
|
151
151
|
vue.createElementVNode("div", {
|
|
152
|
-
class: vue.normalizeClass([{ "absolute left-3 flex items-center": __props.
|
|
153
|
-
}, vue.toDisplayString(__props.
|
|
152
|
+
class: vue.normalizeClass([{ "absolute left-3 flex items-center": __props.prefixString }, __props.prefixString ? prefixClasses[__props.size] : ""])
|
|
153
|
+
}, vue.toDisplayString(__props.prefixString), 3)
|
|
154
154
|
])
|
|
155
155
|
])) : vue.createCommentVNode("", true),
|
|
156
156
|
vue.createElementVNode("input", vue.mergeProps({
|
|
@@ -47,7 +47,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
47
47
|
type: String,
|
|
48
48
|
default: ""
|
|
49
49
|
},
|
|
50
|
-
|
|
50
|
+
prefixString: {
|
|
51
51
|
type: String,
|
|
52
52
|
default: ""
|
|
53
53
|
}
|
|
@@ -78,7 +78,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
78
78
|
const { labelClasses, inputClasses, errorMsgClasses } = useInputClasses(
|
|
79
79
|
computed(() => ({
|
|
80
80
|
...props,
|
|
81
|
-
prefix: !!slots.prefix || !!props.
|
|
81
|
+
prefix: !!slots.prefix || !!props.prefixString,
|
|
82
82
|
suffix: !!slots.suffix
|
|
83
83
|
}))
|
|
84
84
|
);
|
|
@@ -145,11 +145,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
145
145
|
}, null, 8, ["text"])) : createCommentVNode("", true)
|
|
146
146
|
]),
|
|
147
147
|
createElementVNode("div", _hoisted_3, [
|
|
148
|
-
!!_ctx.$slots.prefix || __props.
|
|
148
|
+
!!_ctx.$slots.prefix || __props.prefixString ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
149
149
|
renderSlot(_ctx.$slots, "prefix", {}, () => [
|
|
150
150
|
createElementVNode("div", {
|
|
151
|
-
class: normalizeClass([{ "absolute left-3 flex items-center": __props.
|
|
152
|
-
}, toDisplayString(__props.
|
|
151
|
+
class: normalizeClass([{ "absolute left-3 flex items-center": __props.prefixString }, __props.prefixString ? prefixClasses[__props.size] : ""])
|
|
152
|
+
}, toDisplayString(__props.prefixString), 3)
|
|
153
153
|
])
|
|
154
154
|
])) : createCommentVNode("", true),
|
|
155
155
|
createElementVNode("input", mergeProps({
|
|
@@ -49,7 +49,7 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
49
49
|
type: StringConstructor;
|
|
50
50
|
default: string;
|
|
51
51
|
};
|
|
52
|
-
|
|
52
|
+
prefixString: {
|
|
53
53
|
type: StringConstructor;
|
|
54
54
|
default: string;
|
|
55
55
|
};
|
|
@@ -96,7 +96,7 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
96
96
|
type: StringConstructor;
|
|
97
97
|
default: string;
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
prefixString: {
|
|
100
100
|
type: StringConstructor;
|
|
101
101
|
default: string;
|
|
102
102
|
};
|
|
@@ -108,10 +108,10 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
108
108
|
label: string;
|
|
109
109
|
required: boolean;
|
|
110
110
|
modelValue: string | number | null | undefined;
|
|
111
|
-
prefix: string;
|
|
112
111
|
errorMsg: string;
|
|
113
112
|
selectOnClick: boolean;
|
|
114
113
|
tooltipText: string;
|
|
114
|
+
prefixString: string;
|
|
115
115
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
116
116
|
declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
117
117
|
modelValue: {
|
|
@@ -143,7 +143,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
143
143
|
type: StringConstructor;
|
|
144
144
|
default: string;
|
|
145
145
|
};
|
|
146
|
-
|
|
146
|
+
prefixString: {
|
|
147
147
|
type: StringConstructor;
|
|
148
148
|
default: string;
|
|
149
149
|
};
|
|
@@ -182,7 +182,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
182
182
|
type: StringConstructor;
|
|
183
183
|
default: string;
|
|
184
184
|
};
|
|
185
|
-
|
|
185
|
+
prefixString: {
|
|
186
186
|
type: StringConstructor;
|
|
187
187
|
default: string;
|
|
188
188
|
};
|
|
@@ -194,10 +194,10 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
194
194
|
label: string;
|
|
195
195
|
required: boolean;
|
|
196
196
|
modelValue: string | number | null | undefined;
|
|
197
|
-
prefix: string;
|
|
198
197
|
errorMsg: string;
|
|
199
198
|
selectOnClick: boolean;
|
|
200
199
|
tooltipText: string;
|
|
200
|
+
prefixString: string;
|
|
201
201
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
202
202
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
203
203
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pequity/squirrel",
|
|
3
3
|
"description": "Squirrel component library",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "8.0.0",
|
|
5
5
|
"packageManager": "pnpm@10.6.4",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@vue/test-utils": "^2.4.6",
|
|
76
76
|
"@vuepic/vue-datepicker": "11.0.2",
|
|
77
77
|
"autoprefixer": "^10.4.21",
|
|
78
|
-
"eslint": "^9.
|
|
78
|
+
"eslint": "^9.24.0",
|
|
79
79
|
"eslint-plugin-storybook": "^0.12.0",
|
|
80
80
|
"floating-vue": "5.2.2",
|
|
81
81
|
"glob": "^11.0.1",
|
|
@@ -90,12 +90,12 @@
|
|
|
90
90
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
|
91
91
|
"resolve-tspaths": "^0.8.23",
|
|
92
92
|
"rimraf": "^6.0.1",
|
|
93
|
-
"sass": "^1.86.
|
|
93
|
+
"sass": "^1.86.3",
|
|
94
94
|
"semantic-release": "^24.2.3",
|
|
95
95
|
"storybook": "^8.6.12",
|
|
96
96
|
"svgo": "^3.3.2",
|
|
97
97
|
"tailwindcss": "^3.4.17",
|
|
98
|
-
"typescript": "5.8.
|
|
98
|
+
"typescript": "5.8.3",
|
|
99
99
|
"vite": "^6.2.5",
|
|
100
100
|
"vitest": "^3.1.1",
|
|
101
101
|
"vue": "3.5.13",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
},
|
|
110
110
|
"pnpm": {
|
|
111
111
|
"overrides": {
|
|
112
|
-
"typescript": "5.8.
|
|
112
|
+
"typescript": "5.8.3"
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import PInputNumber from '@squirrel/components/p-input-number/p-input-number.vue';
|
|
2
|
+
import { expect } from '@storybook/test';
|
|
2
3
|
import { createWrapperFor } from '@tests/vitest.helpers';
|
|
3
4
|
|
|
4
5
|
const baseClasses = () => [
|
|
@@ -139,10 +140,10 @@ describe('PInputNumber.vue', () => {
|
|
|
139
140
|
expect(wrapper.find('input').classes()).toEqual(expect.arrayContaining(res));
|
|
140
141
|
});
|
|
141
142
|
|
|
142
|
-
it('renders the
|
|
143
|
+
it('renders the prefixString prop content when no slot is provided', () => {
|
|
143
144
|
const wrapper = createWrapperFor(PInputNumber, {
|
|
144
145
|
props: {
|
|
145
|
-
|
|
146
|
+
prefixString: '$',
|
|
146
147
|
label: 'test input',
|
|
147
148
|
},
|
|
148
149
|
});
|
|
@@ -152,6 +153,32 @@ describe('PInputNumber.vue', () => {
|
|
|
152
153
|
expect(prefixDiv.text()).toBe('$');
|
|
153
154
|
});
|
|
154
155
|
|
|
156
|
+
it('works correctly when the component is stubbed', () => {
|
|
157
|
+
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
158
|
+
|
|
159
|
+
const wrapper = createWrapperFor(
|
|
160
|
+
{
|
|
161
|
+
template: `<PInputNumber v-model="numberVal" />`,
|
|
162
|
+
components: { PInputNumber },
|
|
163
|
+
data() {
|
|
164
|
+
return {
|
|
165
|
+
numberVal: null,
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
global: {
|
|
171
|
+
stubs: {
|
|
172
|
+
PInputNumber: true,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
expect(wrapper.findComponent({ name: 'PInputNumber' }).exists()).toBe(true);
|
|
179
|
+
expect(warnSpy).not.toHaveBeenCalled();
|
|
180
|
+
});
|
|
181
|
+
|
|
155
182
|
it('emits a number on input', async () => {
|
|
156
183
|
const wrapper = createWrapperFor({
|
|
157
184
|
template: `<PInputNumber v-model="numberVal" />`,
|
|
@@ -9,10 +9,12 @@
|
|
|
9
9
|
<PInfoIcon v-if="tooltipText" :text="tooltipText" class="ml-1" />
|
|
10
10
|
</div>
|
|
11
11
|
<div class="relative w-full">
|
|
12
|
-
<div v-if="!!$slots.prefix ||
|
|
12
|
+
<div v-if="!!$slots.prefix || prefixString">
|
|
13
13
|
<slot name="prefix">
|
|
14
|
-
<div
|
|
15
|
-
{
|
|
14
|
+
<div
|
|
15
|
+
:class="[{ 'absolute left-3 flex items-center': prefixString }, prefixString ? prefixClasses[size] : '']"
|
|
16
|
+
>
|
|
17
|
+
{{ prefixString }}
|
|
16
18
|
</div>
|
|
17
19
|
</slot>
|
|
18
20
|
</div>
|
|
@@ -90,7 +92,7 @@ const props = defineProps({
|
|
|
90
92
|
type: String,
|
|
91
93
|
default: '',
|
|
92
94
|
},
|
|
93
|
-
|
|
95
|
+
prefixString: {
|
|
94
96
|
type: String,
|
|
95
97
|
default: '',
|
|
96
98
|
},
|
|
@@ -101,7 +103,7 @@ const slots = useSlots();
|
|
|
101
103
|
const { labelClasses, inputClasses, errorMsgClasses } = useInputClasses(
|
|
102
104
|
computed(() => ({
|
|
103
105
|
...props,
|
|
104
|
-
prefix: !!slots.prefix || !!props.
|
|
106
|
+
prefix: !!slots.prefix || !!props.prefixString,
|
|
105
107
|
suffix: !!slots.suffix,
|
|
106
108
|
}))
|
|
107
109
|
);
|