@pequity/squirrel 6.1.0 → 7.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-alert.js +52 -0
- package/dist/cjs/chunks/p-avatar.js +65 -0
- package/dist/cjs/chunks/p-btn.js +4 -4
- package/dist/cjs/chunks/p-date-picker.js +2 -2
- package/dist/cjs/chunks/p-input-number.js +161 -0
- package/dist/cjs/chunks/p-input-percent.js +2 -2
- package/dist/cjs/chunks/p-input.js +111 -0
- package/dist/cjs/chunks/p-progress-bar.js +38 -0
- package/dist/cjs/chunks/p-select-btn.js +3 -4
- package/dist/cjs/chunks/p-textarea.js +89 -0
- package/dist/cjs/index.js +69 -76
- package/dist/cjs/inputClasses.js +8 -2
- package/dist/cjs/p-alert.js +2 -64
- package/dist/cjs/p-avatar.js +2 -70
- package/dist/cjs/p-drawer.js +2 -2
- package/dist/cjs/p-input-number.js +2 -145
- package/dist/cjs/p-input-search.js +2 -2
- package/dist/cjs/p-input.js +2 -92
- package/dist/cjs/p-modal.js +2 -2
- package/dist/cjs/p-progress-bar.js +2 -40
- package/dist/cjs/p-table-filter-icon.js +14 -9
- package/dist/cjs/p-textarea.js +2 -72
- package/dist/cjs/p-toggle.js +76 -64
- package/dist/cjs/useInputClasses.js +13 -18
- package/dist/es/chunks/p-alert.js +53 -0
- package/dist/es/chunks/p-avatar.js +66 -0
- package/dist/es/chunks/p-btn.js +4 -4
- package/dist/es/chunks/p-date-picker.js +2 -2
- package/dist/es/chunks/p-input-number.js +162 -0
- package/dist/es/chunks/p-input-percent.js +2 -2
- package/dist/es/chunks/p-input.js +112 -0
- package/dist/es/chunks/p-progress-bar.js +39 -0
- package/dist/es/chunks/p-select-btn.js +4 -5
- package/dist/es/chunks/p-textarea.js +90 -0
- package/dist/es/index.js +119 -126
- package/dist/es/inputClasses.js +8 -2
- package/dist/es/p-alert.js +2 -64
- package/dist/es/p-avatar.js +2 -70
- package/dist/es/p-drawer.js +2 -2
- package/dist/es/p-input-number.js +2 -145
- package/dist/es/p-input-search.js +2 -2
- package/dist/es/p-input.js +2 -92
- package/dist/es/p-modal.js +2 -2
- package/dist/es/p-progress-bar.js +2 -40
- package/dist/es/p-table-filter-icon.js +14 -9
- package/dist/es/p-textarea.js +2 -72
- package/dist/es/p-toggle.js +77 -65
- package/dist/es/useInputClasses.js +14 -19
- package/dist/squirrel/components/p-alert/p-alert.vue.d.ts +27 -10
- package/dist/squirrel/components/p-avatar/p-avatar.vue.d.ts +9 -10
- package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +28 -28
- package/dist/squirrel/components/p-date-picker/p-date-picker.vue.d.ts +2 -2
- package/dist/squirrel/components/p-drawer/p-drawer.vue.d.ts +37 -13
- package/dist/squirrel/components/p-inline-date-picker/p-inline-date-picker.vue.d.ts +2 -2
- package/dist/squirrel/components/p-input/p-input.vue.d.ts +30 -61
- package/dist/squirrel/components/p-input-number/p-input-number.vue.d.ts +101 -65
- package/dist/squirrel/components/p-input-search/p-input-search.vue.d.ts +113 -83
- package/dist/squirrel/components/p-modal/p-modal.vue.d.ts +2 -2
- package/dist/squirrel/components/p-progress-bar/p-progress-bar.vue.d.ts +5 -20
- package/dist/squirrel/components/p-table-header-cell/p-table-header-cell.vue.d.ts +1 -1
- package/dist/squirrel/components/p-table-loader/p-table-loader.vue.d.ts +1 -1
- package/dist/squirrel/components/p-table-sort/p-table-sort.vue.d.ts +3 -7
- package/dist/squirrel/components/p-textarea/p-textarea.vue.d.ts +79 -42
- package/dist/squirrel/components/p-toggle/p-toggle.vue.d.ts +25 -62
- package/dist/squirrel/composables/useInputClasses.d.ts +2 -1
- package/dist/squirrel/utils/index.d.ts +1 -3
- package/dist/squirrel/utils/inputClasses.d.ts +12 -0
- package/dist/squirrel.css +5 -5
- package/package.json +19 -19
- package/squirrel/components/p-alert/p-alert.spec.js +9 -8
- package/squirrel/components/p-alert/p-alert.vue +19 -31
- package/squirrel/components/p-avatar/p-avatar.spec.ts +10 -3
- package/squirrel/components/p-avatar/p-avatar.vue +40 -42
- package/squirrel/components/p-btn/p-btn.spec.js +7 -7
- package/squirrel/components/p-btn/p-btn.vue +4 -4
- package/squirrel/components/p-input/p-input.vue +63 -40
- package/squirrel/components/p-input-number/p-input-number.vue +101 -86
- package/squirrel/components/p-progress-bar/p-progress-bar.vue +9 -14
- package/squirrel/components/p-select-btn/p-select-btn.spec.js +24 -5
- package/squirrel/components/p-select-btn/p-select-btn.vue +1 -1
- package/squirrel/components/p-table-header-cell/p-table-filter-icon.vue +8 -9
- package/squirrel/components/p-table-sort/p-table-sort.vue +13 -16
- package/squirrel/components/p-textarea/p-textarea.vue +55 -37
- package/squirrel/components/p-toggle/p-toggle.vue +59 -43
- package/squirrel/composables/useInputClasses.spec.js +50 -13
- package/squirrel/composables/useInputClasses.ts +18 -24
- package/squirrel/utils/index.ts +0 -7
- package/squirrel/utils/inputClasses.ts +8 -2
- package/dist/cjs/inputClassesMixin.js +0 -58
- package/dist/cjs/tailwind.js +0 -25
- package/dist/es/inputClassesMixin.js +0 -59
- package/dist/es/tailwind.js +0 -25
- package/dist/squirrel/utils/inputClassesMixin.d.ts +0 -56
- package/dist/squirrel/utils/tailwind.d.ts +0 -8
- package/squirrel/utils/inputClassesMixin.spec.js +0 -241
- package/squirrel/utils/inputClassesMixin.ts +0 -60
- package/squirrel/utils/tailwind.spec.js +0 -27
- package/squirrel/utils/tailwind.ts +0 -28
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useInputClasses } from '@squirrel/composables/useInputClasses';
|
|
2
|
-
import {
|
|
2
|
+
import { expect } from '@storybook/test';
|
|
3
|
+
import { reactive, ref } from 'vue';
|
|
3
4
|
|
|
4
5
|
const baseInputClassesMd = () => [
|
|
5
6
|
'text-night',
|
|
@@ -54,6 +55,42 @@ const baseInputClassesLg = () => {
|
|
|
54
55
|
const baseLabelClassesMd = ['block', 'mb-1', 'font-medium', 'text-sm'];
|
|
55
56
|
|
|
56
57
|
describe('useInputClasses', () => {
|
|
58
|
+
it('accepts a non-reactive object', () => {
|
|
59
|
+
const props = { size: 'lg' };
|
|
60
|
+
|
|
61
|
+
const { inputClasses, labelClasses, selectClasses, textareaClasses, errorMsgClasses } = useInputClasses(props);
|
|
62
|
+
|
|
63
|
+
expect(inputClasses.value).toContain('text-lg');
|
|
64
|
+
expect(labelClasses.value).toContain('text-base');
|
|
65
|
+
expect(selectClasses.value).toContain('text-lg');
|
|
66
|
+
expect(textareaClasses.value).toContain('text-lg');
|
|
67
|
+
expect(errorMsgClasses.value).toContain('text-on-error');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('reacts to changes when props is a reactive object', () => {
|
|
71
|
+
const props = reactive({ size: 'md' });
|
|
72
|
+
|
|
73
|
+
const { inputClasses } = useInputClasses(props);
|
|
74
|
+
|
|
75
|
+
expect(inputClasses.value).toContain('text-base');
|
|
76
|
+
|
|
77
|
+
props.size = 'lg';
|
|
78
|
+
|
|
79
|
+
expect(inputClasses.value).toContain('text-lg');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('reacts to changes when props is a ref', () => {
|
|
83
|
+
const props = ref({ size: 'md' });
|
|
84
|
+
|
|
85
|
+
const { inputClasses } = useInputClasses(props);
|
|
86
|
+
|
|
87
|
+
expect(inputClasses.value).toContain('text-base');
|
|
88
|
+
|
|
89
|
+
props.value.size = 'lg';
|
|
90
|
+
|
|
91
|
+
expect(inputClasses.value).toContain('text-lg');
|
|
92
|
+
});
|
|
93
|
+
|
|
57
94
|
it('generates input classes md', () => {
|
|
58
95
|
const props = reactive({ size: 'md' });
|
|
59
96
|
|
|
@@ -177,26 +214,26 @@ describe('useInputClasses', () => {
|
|
|
177
214
|
expect(selectClasses.value.split(' ')).toEqual(expect.arrayContaining(res));
|
|
178
215
|
});
|
|
179
216
|
|
|
180
|
-
it('generates textarea classes
|
|
181
|
-
const props = reactive({ size: '
|
|
217
|
+
it('generates textarea classes sm', () => {
|
|
218
|
+
const props = reactive({ size: 'sm' });
|
|
182
219
|
|
|
183
220
|
const { textareaClasses } = useInputClasses(props);
|
|
184
|
-
const baseInputClasses =
|
|
185
|
-
return !['pl-3', 'pr-3', 'h-
|
|
221
|
+
const baseInputClasses = baseInputClassesSm().filter((item) => {
|
|
222
|
+
return !['pl-3', 'pr-3', 'h-8'].includes(item);
|
|
186
223
|
});
|
|
187
|
-
const res = baseInputClasses.concat(['resize-y', '
|
|
224
|
+
const res = baseInputClasses.concat(['resize-y', 'py-2', 'overflow-auto', 'h-auto']);
|
|
188
225
|
|
|
189
226
|
expect(textareaClasses.value.split(' ')).toEqual(expect.arrayContaining(res));
|
|
190
227
|
});
|
|
191
228
|
|
|
192
|
-
it('generates textarea classes
|
|
193
|
-
const props = reactive({ size: '
|
|
229
|
+
it('generates textarea classes md', () => {
|
|
230
|
+
const props = reactive({ size: 'md' });
|
|
194
231
|
|
|
195
232
|
const { textareaClasses } = useInputClasses(props);
|
|
196
|
-
const baseInputClasses =
|
|
197
|
-
return !['
|
|
233
|
+
const baseInputClasses = baseInputClassesMd().filter((item) => {
|
|
234
|
+
return !['pl-4', 'pr-4', 'h-10'].includes(item);
|
|
198
235
|
});
|
|
199
|
-
const res = baseInputClasses.concat(['resize-y', '
|
|
236
|
+
const res = baseInputClasses.concat(['resize-y', 'py-3', 'overflow-auto', 'h-auto']);
|
|
200
237
|
|
|
201
238
|
expect(textareaClasses.value.split(' ')).toEqual(expect.arrayContaining(res));
|
|
202
239
|
});
|
|
@@ -206,9 +243,9 @@ describe('useInputClasses', () => {
|
|
|
206
243
|
|
|
207
244
|
const { textareaClasses } = useInputClasses(props);
|
|
208
245
|
const baseInputClasses = baseInputClassesLg().filter((item) => {
|
|
209
|
-
return !['pr-5', 'pl-5', 'h-12'
|
|
246
|
+
return !['pr-5', 'pl-5', 'h-12'].includes(item);
|
|
210
247
|
});
|
|
211
|
-
const res = baseInputClasses.concat(['resize-y', '
|
|
248
|
+
const res = baseInputClasses.concat(['resize-y', 'py-4', 'overflow-auto', 'h-auto']);
|
|
212
249
|
|
|
213
250
|
expect(textareaClasses.value.split(' ')).toEqual(expect.arrayContaining(res));
|
|
214
251
|
});
|
|
@@ -4,16 +4,7 @@ import {
|
|
|
4
4
|
selectClasses as tvSelectClasses,
|
|
5
5
|
textareaClasses as tvTextareaClasses,
|
|
6
6
|
} from '@squirrel/utils/inputClasses';
|
|
7
|
-
import { computed,
|
|
8
|
-
|
|
9
|
-
const defaults = {
|
|
10
|
-
size: ref<Size>('md'),
|
|
11
|
-
errorMsg: ref(''),
|
|
12
|
-
required: ref(false),
|
|
13
|
-
prefix: ref(false),
|
|
14
|
-
suffix: ref(false),
|
|
15
|
-
rounded: ref(false),
|
|
16
|
-
};
|
|
7
|
+
import { computed, type MaybeRefOrGetter, toValue } from 'vue';
|
|
17
8
|
|
|
18
9
|
type Props = {
|
|
19
10
|
size: Size;
|
|
@@ -24,21 +15,24 @@ type Props = {
|
|
|
24
15
|
rounded: boolean;
|
|
25
16
|
};
|
|
26
17
|
|
|
27
|
-
|
|
18
|
+
const defaults: Props = {
|
|
19
|
+
size: 'md',
|
|
20
|
+
errorMsg: '',
|
|
21
|
+
required: false,
|
|
22
|
+
prefix: false,
|
|
23
|
+
suffix: false,
|
|
24
|
+
rounded: false,
|
|
25
|
+
} as const;
|
|
28
26
|
|
|
29
|
-
export function useInputClasses(props: Partial<Props
|
|
30
|
-
const opts =
|
|
31
|
-
|
|
27
|
+
export function useInputClasses(props: MaybeRefOrGetter<Partial<Props>>) {
|
|
28
|
+
const opts = computed(() => {
|
|
29
|
+
const propsValue = toValue(props);
|
|
30
|
+
|
|
31
|
+
return { ...defaults, ...propsValue, error: !!propsValue.errorMsg };
|
|
32
|
+
});
|
|
32
33
|
|
|
33
34
|
const allClasses = computed(() => {
|
|
34
|
-
const { input, label, errorMessage } = tvInputClasses(
|
|
35
|
-
size: size.value,
|
|
36
|
-
prefix: prefix.value,
|
|
37
|
-
suffix: suffix.value,
|
|
38
|
-
required: required.value,
|
|
39
|
-
error: !!errorMsg.value,
|
|
40
|
-
rounded: rounded.value,
|
|
41
|
-
});
|
|
35
|
+
const { input, label, errorMessage } = tvInputClasses(opts.value);
|
|
42
36
|
|
|
43
37
|
return { input: input(), label: label(), errorMessage: errorMessage() };
|
|
44
38
|
});
|
|
@@ -50,13 +44,13 @@ export function useInputClasses(props: Partial<Props>) {
|
|
|
50
44
|
const errorMsgClasses = computed(() => allClasses.value.errorMessage);
|
|
51
45
|
|
|
52
46
|
const selectClasses = computed(() => {
|
|
53
|
-
const { input } = tvSelectClasses(
|
|
47
|
+
const { input } = tvSelectClasses(opts.value);
|
|
54
48
|
|
|
55
49
|
return input();
|
|
56
50
|
});
|
|
57
51
|
|
|
58
52
|
const textareaClasses = computed(() => {
|
|
59
|
-
const { input } = tvTextareaClasses(
|
|
53
|
+
const { input } = tvTextareaClasses(opts.value);
|
|
60
54
|
|
|
61
55
|
return input();
|
|
62
56
|
});
|
package/squirrel/utils/index.ts
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
import { type Size, SIZES } from '@squirrel/components/p-btn/p-btn.types';
|
|
2
2
|
import { CURRENCY_INPUT_DEFAULTS } from '@squirrel/utils/currency';
|
|
3
3
|
import { getNextActiveElement, isElement, isVisible } from '@squirrel/utils/dom';
|
|
4
|
-
import inputClassesMixin from '@squirrel/utils/inputClassesMixin';
|
|
5
4
|
import { setupListKeyboardNavigation } from '@squirrel/utils/listKeyboardNavigation';
|
|
6
5
|
import { toNumberOrNull } from '@squirrel/utils/number';
|
|
7
6
|
import { isObject } from '@squirrel/utils/object';
|
|
8
7
|
import { createPagingRange } from '@squirrel/utils/pagination';
|
|
9
8
|
import { sanitizeUrl } from '@squirrel/utils/sanitization';
|
|
10
9
|
import { toString } from '@squirrel/utils/string';
|
|
11
|
-
import { type Color, getColor, getColorDeep, getScreen } from '@squirrel/utils/tailwind';
|
|
12
10
|
import { splitStringForHighlight } from '@squirrel/utils/text';
|
|
13
11
|
|
|
14
12
|
export {
|
|
15
|
-
Color,
|
|
16
13
|
createPagingRange,
|
|
17
14
|
CURRENCY_INPUT_DEFAULTS,
|
|
18
|
-
getColor,
|
|
19
|
-
getColorDeep,
|
|
20
15
|
getNextActiveElement,
|
|
21
|
-
getScreen,
|
|
22
|
-
inputClassesMixin,
|
|
23
16
|
isElement,
|
|
24
17
|
isObject,
|
|
25
18
|
isVisible,
|
|
@@ -96,12 +96,18 @@ const inputClasses = tv({
|
|
|
96
96
|
const textareaClasses = tv({
|
|
97
97
|
extend: inputClasses,
|
|
98
98
|
slots: {
|
|
99
|
-
input: 'resize-y overflow-auto
|
|
99
|
+
input: 'resize-y overflow-auto',
|
|
100
100
|
},
|
|
101
101
|
variants: {
|
|
102
102
|
size: {
|
|
103
|
+
sm: {
|
|
104
|
+
input: 'h-auto py-2',
|
|
105
|
+
},
|
|
103
106
|
md: {
|
|
104
|
-
input: 'h-auto',
|
|
107
|
+
input: 'h-auto py-3',
|
|
108
|
+
},
|
|
109
|
+
lg: {
|
|
110
|
+
input: 'h-auto py-4',
|
|
105
111
|
},
|
|
106
112
|
},
|
|
107
113
|
},
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const pBtn_types = require("./chunks/p-btn.types.js");
|
|
3
|
-
const inputClasses = require("./inputClasses.js");
|
|
4
|
-
const vue = require("vue");
|
|
5
|
-
const inputClassesMixin = vue.defineComponent({
|
|
6
|
-
props: {
|
|
7
|
-
size: {
|
|
8
|
-
type: String,
|
|
9
|
-
default: "md",
|
|
10
|
-
validator(value) {
|
|
11
|
-
return pBtn_types.SIZES.includes(value);
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
errorMsg: {
|
|
15
|
-
type: String,
|
|
16
|
-
default: ""
|
|
17
|
-
},
|
|
18
|
-
required: {
|
|
19
|
-
type: Boolean,
|
|
20
|
-
default: false
|
|
21
|
-
},
|
|
22
|
-
rounded: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
default: false
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
computed: {
|
|
28
|
-
allClasses() {
|
|
29
|
-
const { input, label, errorMessage } = inputClasses.inputClasses({
|
|
30
|
-
size: this.size,
|
|
31
|
-
prefix: !!this.$slots.prefix,
|
|
32
|
-
suffix: !!this.$slots.suffix,
|
|
33
|
-
required: this.required,
|
|
34
|
-
error: !!this.errorMsg,
|
|
35
|
-
rounded: this.rounded
|
|
36
|
-
});
|
|
37
|
-
return { input: input(), label: label(), errorMessage: errorMessage() };
|
|
38
|
-
},
|
|
39
|
-
inputClasses() {
|
|
40
|
-
return this.allClasses.input;
|
|
41
|
-
},
|
|
42
|
-
labelClasses() {
|
|
43
|
-
return this.allClasses.label;
|
|
44
|
-
},
|
|
45
|
-
errorMsgClasses() {
|
|
46
|
-
return this.allClasses.errorMessage;
|
|
47
|
-
},
|
|
48
|
-
selectClasses() {
|
|
49
|
-
const { input } = inputClasses.selectClasses({ size: this.size, required: this.required, error: !!this.errorMsg });
|
|
50
|
-
return input();
|
|
51
|
-
},
|
|
52
|
-
textareaClasses() {
|
|
53
|
-
const { input } = inputClasses.textareaClasses({ required: this.required, error: !!this.errorMsg });
|
|
54
|
-
return input();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
module.exports = inputClassesMixin;
|
package/dist/cjs/tailwind.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const config$1 = require("./config.js");
|
|
5
|
-
const lodashEs = require("lodash-es");
|
|
6
|
-
const resolveConfig = require("tailwindcss/resolveConfig");
|
|
7
|
-
const config = resolveConfig(config$1.squirrelTailwindConfig);
|
|
8
|
-
const theme = config.theme;
|
|
9
|
-
const colors = theme == null ? void 0 : theme.colors;
|
|
10
|
-
(_a = theme == null ? void 0 : theme.extend) == null ? void 0 : _a.colors;
|
|
11
|
-
const screens = theme == null ? void 0 : theme.screens;
|
|
12
|
-
const getColor = (name) => {
|
|
13
|
-
return colors == null ? void 0 : colors[name];
|
|
14
|
-
};
|
|
15
|
-
const getColorDeep = (color) => {
|
|
16
|
-
const baseColor = color.split("-").slice(0, -1).join("-");
|
|
17
|
-
const colorNumber = String(color.split("-").pop());
|
|
18
|
-
return lodashEs.get(getColor(baseColor), colorNumber);
|
|
19
|
-
};
|
|
20
|
-
const getScreen = (size) => {
|
|
21
|
-
return screens == null ? void 0 : screens[size];
|
|
22
|
-
};
|
|
23
|
-
exports.getColor = getColor;
|
|
24
|
-
exports.getColorDeep = getColorDeep;
|
|
25
|
-
exports.getScreen = getScreen;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { S as SIZES } from "./chunks/p-btn.types.js";
|
|
2
|
-
import { textareaClasses, selectClasses, inputClasses } from "./inputClasses.js";
|
|
3
|
-
import { defineComponent } from "vue";
|
|
4
|
-
const inputClassesMixin = defineComponent({
|
|
5
|
-
props: {
|
|
6
|
-
size: {
|
|
7
|
-
type: String,
|
|
8
|
-
default: "md",
|
|
9
|
-
validator(value) {
|
|
10
|
-
return SIZES.includes(value);
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
errorMsg: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: ""
|
|
16
|
-
},
|
|
17
|
-
required: {
|
|
18
|
-
type: Boolean,
|
|
19
|
-
default: false
|
|
20
|
-
},
|
|
21
|
-
rounded: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: false
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
computed: {
|
|
27
|
-
allClasses() {
|
|
28
|
-
const { input, label, errorMessage } = inputClasses({
|
|
29
|
-
size: this.size,
|
|
30
|
-
prefix: !!this.$slots.prefix,
|
|
31
|
-
suffix: !!this.$slots.suffix,
|
|
32
|
-
required: this.required,
|
|
33
|
-
error: !!this.errorMsg,
|
|
34
|
-
rounded: this.rounded
|
|
35
|
-
});
|
|
36
|
-
return { input: input(), label: label(), errorMessage: errorMessage() };
|
|
37
|
-
},
|
|
38
|
-
inputClasses() {
|
|
39
|
-
return this.allClasses.input;
|
|
40
|
-
},
|
|
41
|
-
labelClasses() {
|
|
42
|
-
return this.allClasses.label;
|
|
43
|
-
},
|
|
44
|
-
errorMsgClasses() {
|
|
45
|
-
return this.allClasses.errorMessage;
|
|
46
|
-
},
|
|
47
|
-
selectClasses() {
|
|
48
|
-
const { input } = selectClasses({ size: this.size, required: this.required, error: !!this.errorMsg });
|
|
49
|
-
return input();
|
|
50
|
-
},
|
|
51
|
-
textareaClasses() {
|
|
52
|
-
const { input } = textareaClasses({ required: this.required, error: !!this.errorMsg });
|
|
53
|
-
return input();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
export {
|
|
58
|
-
inputClassesMixin as default
|
|
59
|
-
};
|
package/dist/es/tailwind.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var _a;
|
|
2
|
-
import { squirrelTailwindConfig } from "./config.js";
|
|
3
|
-
import { get } from "lodash-es";
|
|
4
|
-
import resolveConfig from "tailwindcss/resolveConfig";
|
|
5
|
-
const config = resolveConfig(squirrelTailwindConfig);
|
|
6
|
-
const theme = config.theme;
|
|
7
|
-
const colors = theme == null ? void 0 : theme.colors;
|
|
8
|
-
(_a = theme == null ? void 0 : theme.extend) == null ? void 0 : _a.colors;
|
|
9
|
-
const screens = theme == null ? void 0 : theme.screens;
|
|
10
|
-
const getColor = (name) => {
|
|
11
|
-
return colors == null ? void 0 : colors[name];
|
|
12
|
-
};
|
|
13
|
-
const getColorDeep = (color) => {
|
|
14
|
-
const baseColor = color.split("-").slice(0, -1).join("-");
|
|
15
|
-
const colorNumber = String(color.split("-").pop());
|
|
16
|
-
return get(getColor(baseColor), colorNumber);
|
|
17
|
-
};
|
|
18
|
-
const getScreen = (size) => {
|
|
19
|
-
return screens == null ? void 0 : screens[size];
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
getColor,
|
|
23
|
-
getColorDeep,
|
|
24
|
-
getScreen
|
|
25
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { type Size } from '../components/p-btn/p-btn.types';
|
|
2
|
-
import { type PropType } from 'vue';
|
|
3
|
-
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
-
size: {
|
|
5
|
-
type: PropType<Size>;
|
|
6
|
-
default: string;
|
|
7
|
-
validator(value: Size): boolean;
|
|
8
|
-
};
|
|
9
|
-
errorMsg: {
|
|
10
|
-
type: StringConstructor;
|
|
11
|
-
default: string;
|
|
12
|
-
};
|
|
13
|
-
required: {
|
|
14
|
-
type: BooleanConstructor;
|
|
15
|
-
default: boolean;
|
|
16
|
-
};
|
|
17
|
-
rounded: {
|
|
18
|
-
type: BooleanConstructor;
|
|
19
|
-
default: boolean;
|
|
20
|
-
};
|
|
21
|
-
}>, {}, {}, {
|
|
22
|
-
allClasses(): {
|
|
23
|
-
input: string;
|
|
24
|
-
label: string;
|
|
25
|
-
errorMessage: string;
|
|
26
|
-
};
|
|
27
|
-
inputClasses(): string;
|
|
28
|
-
labelClasses(): string;
|
|
29
|
-
errorMsgClasses(): string;
|
|
30
|
-
selectClasses(): string;
|
|
31
|
-
textareaClasses(): string;
|
|
32
|
-
}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
33
|
-
size: {
|
|
34
|
-
type: PropType<Size>;
|
|
35
|
-
default: string;
|
|
36
|
-
validator(value: Size): boolean;
|
|
37
|
-
};
|
|
38
|
-
errorMsg: {
|
|
39
|
-
type: StringConstructor;
|
|
40
|
-
default: string;
|
|
41
|
-
};
|
|
42
|
-
required: {
|
|
43
|
-
type: BooleanConstructor;
|
|
44
|
-
default: boolean;
|
|
45
|
-
};
|
|
46
|
-
rounded: {
|
|
47
|
-
type: BooleanConstructor;
|
|
48
|
-
default: boolean;
|
|
49
|
-
};
|
|
50
|
-
}>> & Readonly<{}>, {
|
|
51
|
-
size: "sm" | "md" | "lg";
|
|
52
|
-
required: boolean;
|
|
53
|
-
rounded: boolean;
|
|
54
|
-
errorMsg: string;
|
|
55
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
56
|
-
export default _default;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare const colors: import("tailwindcss/types/config").ResolvableTo<import("tailwindcss/types/config").RecursiveKeyValuePair<string, string>> | undefined;
|
|
2
|
-
declare const extendedColors: import("tailwindcss/types/config").ResolvableTo<import("tailwindcss/types/config").RecursiveKeyValuePair<string, string>> | undefined;
|
|
3
|
-
declare const screens: import("tailwindcss/types/config").ResolvableTo<import("tailwindcss/types/config").ScreensConfig> | undefined;
|
|
4
|
-
export type Color = keyof typeof colors | keyof typeof extendedColors;
|
|
5
|
-
export declare const getColor: (name: Color) => undefined;
|
|
6
|
-
export declare const getColorDeep: (color: string) => undefined;
|
|
7
|
-
export declare const getScreen: (size: keyof typeof screens) => undefined;
|
|
8
|
-
export {};
|