@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
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { defineComponent, useSlots, computed, useAttrs, watch, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, withDirectives, renderSlot, createBlock, createCommentVNode, unref, toDisplayString, mergeProps, vShow } from "vue";
|
|
2
|
+
import { S as SIZES } from "./p-btn.types.js";
|
|
3
|
+
import { _ as _sfc_main$1 } from "./p-info-icon.js";
|
|
4
|
+
import { useInputClasses } from "../useInputClasses.js";
|
|
5
|
+
import { toNumberOrNull } from "../number.js";
|
|
6
|
+
import { kebabCase } from "lodash-es";
|
|
7
|
+
import { useCurrencyInput } from "vue-currency-input";
|
|
8
|
+
const _hoisted_1 = ["data-has-error"];
|
|
9
|
+
const _hoisted_2 = { class: "flex flex-row items-center" };
|
|
10
|
+
const _hoisted_3 = { class: "relative w-full" };
|
|
11
|
+
const _hoisted_4 = { key: 0 };
|
|
12
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
+
...{
|
|
14
|
+
name: "PInputNumber",
|
|
15
|
+
inheritAttrs: false
|
|
16
|
+
},
|
|
17
|
+
__name: "p-input-number",
|
|
18
|
+
props: {
|
|
19
|
+
modelValue: {
|
|
20
|
+
type: [Number, String],
|
|
21
|
+
default: null
|
|
22
|
+
},
|
|
23
|
+
label: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: ""
|
|
26
|
+
},
|
|
27
|
+
errorMsg: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: ""
|
|
30
|
+
},
|
|
31
|
+
required: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
size: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "md",
|
|
38
|
+
validator(value) {
|
|
39
|
+
return SIZES.includes(value);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
selectOnClick: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: true
|
|
45
|
+
},
|
|
46
|
+
tooltipText: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: ""
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
emits: ["update:modelValue", "change"],
|
|
52
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
53
|
+
const ALL_OPTIONS = [
|
|
54
|
+
"locale",
|
|
55
|
+
"currency",
|
|
56
|
+
"currencyDisplay",
|
|
57
|
+
"hideGroupingSeparatorOnFocus",
|
|
58
|
+
"hideCurrencySymbolOnFocus",
|
|
59
|
+
"hideNegligibleDecimalDigitsOnFocus",
|
|
60
|
+
"precision",
|
|
61
|
+
"autoDecimalDigits",
|
|
62
|
+
"valueRange",
|
|
63
|
+
"useGrouping",
|
|
64
|
+
"valueScaling"
|
|
65
|
+
];
|
|
66
|
+
const emit = __emit;
|
|
67
|
+
const props = __props;
|
|
68
|
+
const slots = useSlots();
|
|
69
|
+
const { labelClasses, inputClasses, errorMsgClasses } = useInputClasses(
|
|
70
|
+
computed(() => ({
|
|
71
|
+
...props,
|
|
72
|
+
prefix: !!slots.prefix,
|
|
73
|
+
suffix: !!slots.suffix
|
|
74
|
+
}))
|
|
75
|
+
);
|
|
76
|
+
const attrs = useAttrs();
|
|
77
|
+
const DEFAULTS = {
|
|
78
|
+
locale: "en-US",
|
|
79
|
+
currency: "USD",
|
|
80
|
+
precision: 0,
|
|
81
|
+
currencyDisplay: "hidden"
|
|
82
|
+
};
|
|
83
|
+
const inputCurrencyOptions = computed(() => {
|
|
84
|
+
ALL_OPTIONS.forEach((key) => {
|
|
85
|
+
const attr = attrs[kebabCase(key)];
|
|
86
|
+
if (attr && typeof attr !== "undefined") {
|
|
87
|
+
DEFAULTS[key] = attr;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return DEFAULTS;
|
|
91
|
+
});
|
|
92
|
+
const { inputRef, numberValue, setValue } = useCurrencyInput(
|
|
93
|
+
inputCurrencyOptions.value,
|
|
94
|
+
false
|
|
95
|
+
);
|
|
96
|
+
watch(numberValue, (value) => {
|
|
97
|
+
emit("update:modelValue", toNumberOrNull(value));
|
|
98
|
+
});
|
|
99
|
+
watch(
|
|
100
|
+
() => props.modelValue,
|
|
101
|
+
(value) => {
|
|
102
|
+
setValue(toNumberOrNull(value));
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
const computedAttrs = computed(() => {
|
|
106
|
+
const { class: classes, style: style2, ...rest } = attrs;
|
|
107
|
+
return rest;
|
|
108
|
+
});
|
|
109
|
+
const style = computed(() => {
|
|
110
|
+
return attrs.style;
|
|
111
|
+
});
|
|
112
|
+
const focus = () => {
|
|
113
|
+
props.selectOnClick && inputRef.value.select();
|
|
114
|
+
};
|
|
115
|
+
__expose({ setValue });
|
|
116
|
+
return (_ctx, _cache) => {
|
|
117
|
+
return openBlock(), createElementBlock("div", {
|
|
118
|
+
class: normalizeClass([{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]),
|
|
119
|
+
"data-has-error": !!__props.errorMsg,
|
|
120
|
+
style: normalizeStyle(style.value)
|
|
121
|
+
}, [
|
|
122
|
+
createElementVNode("div", _hoisted_2, [
|
|
123
|
+
renderSlot(_ctx.$slots, "label", {
|
|
124
|
+
label: __props.label,
|
|
125
|
+
labelClasses: unref(labelClasses)
|
|
126
|
+
}, () => [
|
|
127
|
+
__props.label ? (openBlock(), createElementBlock("label", {
|
|
128
|
+
key: 0,
|
|
129
|
+
class: normalizeClass(unref(labelClasses))
|
|
130
|
+
}, toDisplayString(__props.label), 3)) : createCommentVNode("", true)
|
|
131
|
+
]),
|
|
132
|
+
__props.tooltipText ? (openBlock(), createBlock(_sfc_main$1, {
|
|
133
|
+
key: 0,
|
|
134
|
+
text: __props.tooltipText,
|
|
135
|
+
class: "ml-1"
|
|
136
|
+
}, null, 8, ["text"])) : createCommentVNode("", true)
|
|
137
|
+
]),
|
|
138
|
+
createElementVNode("div", _hoisted_3, [
|
|
139
|
+
!!_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
140
|
+
renderSlot(_ctx.$slots, "prefix")
|
|
141
|
+
])) : createCommentVNode("", true),
|
|
142
|
+
createElementVNode("input", mergeProps({
|
|
143
|
+
ref_key: "inputRef",
|
|
144
|
+
ref: inputRef,
|
|
145
|
+
type: "text"
|
|
146
|
+
}, computedAttrs.value, {
|
|
147
|
+
class: unref(inputClasses),
|
|
148
|
+
onFocus: focus
|
|
149
|
+
}), null, 16)
|
|
150
|
+
]),
|
|
151
|
+
withDirectives(createElementVNode("div", {
|
|
152
|
+
class: normalizeClass(unref(errorMsgClasses))
|
|
153
|
+
}, toDisplayString(__props.errorMsg), 3), [
|
|
154
|
+
[vShow, __props.errorMsg]
|
|
155
|
+
])
|
|
156
|
+
], 14, _hoisted_1);
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
export {
|
|
161
|
+
_sfc_main as _
|
|
162
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, computed, createBlock, openBlock, withCtx, createElementVNode, normalizeClass } from "vue";
|
|
2
|
-
import
|
|
2
|
+
import { _ as _sfc_main$1 } from "./p-input-number.js";
|
|
3
3
|
import { isNumber } from "lodash-es";
|
|
4
4
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
5
|
...{
|
|
@@ -30,7 +30,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
30
30
|
set: (nV) => emit("update:modelValue", isNumber(nV) ? nV / 100 : nV)
|
|
31
31
|
});
|
|
32
32
|
return (_ctx, _cache) => {
|
|
33
|
-
return openBlock(), createBlock(
|
|
33
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
34
34
|
modelValue: convertedValue.value,
|
|
35
35
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => convertedValue.value = $event),
|
|
36
36
|
size: __props.size
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { defineComponent, useSlots, computed, useAttrs, createElementBlock, openBlock, normalizeStyle, normalizeClass, renderSlot, createElementVNode, withDirectives, unref, createCommentVNode, toDisplayString, mergeProps, vShow } from "vue";
|
|
2
|
+
import { S as SIZES } from "./p-btn.types.js";
|
|
3
|
+
import { useInputClasses } from "../useInputClasses.js";
|
|
4
|
+
const _hoisted_1 = ["data-has-error"];
|
|
5
|
+
const _hoisted_2 = { class: "relative w-full" };
|
|
6
|
+
const _hoisted_3 = { key: 0 };
|
|
7
|
+
const _hoisted_4 = ["type", "value"];
|
|
8
|
+
const _hoisted_5 = { key: 1 };
|
|
9
|
+
const INPUT_TYPES = { TEXT: "text", PASSWORD: "password" };
|
|
10
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
|
+
...{
|
|
12
|
+
name: "PInput",
|
|
13
|
+
inheritAttrs: false
|
|
14
|
+
},
|
|
15
|
+
__name: "p-input",
|
|
16
|
+
props: {
|
|
17
|
+
modelValue: {
|
|
18
|
+
type: [String, Number, Boolean, null],
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
type: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: INPUT_TYPES.TEXT,
|
|
24
|
+
validator(value) {
|
|
25
|
+
return Object.values(INPUT_TYPES).includes(value);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
label: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ""
|
|
31
|
+
},
|
|
32
|
+
errorMsg: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ""
|
|
35
|
+
},
|
|
36
|
+
required: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
size: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: "md",
|
|
43
|
+
validator(value) {
|
|
44
|
+
return SIZES.includes(value);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
rounded: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
emits: ["update:modelValue"],
|
|
53
|
+
setup(__props) {
|
|
54
|
+
const props = __props;
|
|
55
|
+
const slots = useSlots();
|
|
56
|
+
const { labelClasses, inputClasses, errorMsgClasses } = useInputClasses(
|
|
57
|
+
computed(() => ({
|
|
58
|
+
...props,
|
|
59
|
+
prefix: !!slots.prefix,
|
|
60
|
+
suffix: !!slots.suffix
|
|
61
|
+
}))
|
|
62
|
+
);
|
|
63
|
+
const allAttrs = useAttrs();
|
|
64
|
+
const attrs = computed(() => {
|
|
65
|
+
const { class: classes, style: style2, ...rest } = allAttrs;
|
|
66
|
+
return rest;
|
|
67
|
+
});
|
|
68
|
+
const style = computed(() => {
|
|
69
|
+
return allAttrs.style;
|
|
70
|
+
});
|
|
71
|
+
return (_ctx, _cache) => {
|
|
72
|
+
return openBlock(), createElementBlock("div", {
|
|
73
|
+
class: normalizeClass([{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]),
|
|
74
|
+
"data-has-error": !!__props.errorMsg,
|
|
75
|
+
style: normalizeStyle(style.value)
|
|
76
|
+
}, [
|
|
77
|
+
renderSlot(_ctx.$slots, "label", {
|
|
78
|
+
label: __props.label,
|
|
79
|
+
labelClasses: unref(labelClasses)
|
|
80
|
+
}, () => [
|
|
81
|
+
__props.label ? (openBlock(), createElementBlock("label", {
|
|
82
|
+
key: 0,
|
|
83
|
+
class: normalizeClass(unref(labelClasses))
|
|
84
|
+
}, toDisplayString(__props.label), 3)) : createCommentVNode("", true)
|
|
85
|
+
]),
|
|
86
|
+
createElementVNode("div", _hoisted_2, [
|
|
87
|
+
!!_ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
88
|
+
renderSlot(_ctx.$slots, "prefix")
|
|
89
|
+
])) : createCommentVNode("", true),
|
|
90
|
+
createElementVNode("input", mergeProps({
|
|
91
|
+
type: __props.type,
|
|
92
|
+
value: __props.modelValue
|
|
93
|
+
}, attrs.value, {
|
|
94
|
+
class: unref(inputClasses),
|
|
95
|
+
onInput: _cache[0] || (_cache[0] = (event) => _ctx.$emit("update:modelValue", event.target.value))
|
|
96
|
+
}), null, 16, _hoisted_4),
|
|
97
|
+
!!_ctx.$slots.suffix ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
98
|
+
renderSlot(_ctx.$slots, "suffix")
|
|
99
|
+
])) : createCommentVNode("", true)
|
|
100
|
+
]),
|
|
101
|
+
withDirectives(createElementVNode("div", {
|
|
102
|
+
class: normalizeClass(unref(errorMsgClasses))
|
|
103
|
+
}, toDisplayString(__props.errorMsg), 3), [
|
|
104
|
+
[vShow, __props.errorMsg]
|
|
105
|
+
])
|
|
106
|
+
], 14, _hoisted_1);
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
export {
|
|
111
|
+
_sfc_main as _
|
|
112
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineComponent, resolveDirective, createElementBlock, openBlock, Fragment, renderList, withDirectives, normalizeStyle } from "vue";
|
|
2
|
+
const _hoisted_1 = {
|
|
3
|
+
class: "flex justify-start overflow-hidden rounded bg-p-blue-20",
|
|
4
|
+
role: "progressbar"
|
|
5
|
+
};
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
...{
|
|
8
|
+
name: "PProgressBar"
|
|
9
|
+
},
|
|
10
|
+
__name: "p-progress-bar",
|
|
11
|
+
props: {
|
|
12
|
+
total: {},
|
|
13
|
+
items: {}
|
|
14
|
+
},
|
|
15
|
+
setup(__props) {
|
|
16
|
+
return (_ctx, _cache) => {
|
|
17
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
18
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
19
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (item) => {
|
|
20
|
+
return withDirectives((openBlock(), createElementBlock("div", {
|
|
21
|
+
key: `progress-value-${item.color}`,
|
|
22
|
+
class: "h-full",
|
|
23
|
+
style: normalizeStyle({ width: `${item.value / _ctx.total * 100}%`, background: item.color })
|
|
24
|
+
}, null, 4)), [
|
|
25
|
+
[
|
|
26
|
+
_directive_tooltip,
|
|
27
|
+
item.label,
|
|
28
|
+
void 0,
|
|
29
|
+
{ top: true }
|
|
30
|
+
]
|
|
31
|
+
]);
|
|
32
|
+
}), 128))
|
|
33
|
+
]);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
_sfc_main as _
|
|
39
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { defineComponent, resolveDirective, createElementBlock, openBlock,
|
|
1
|
+
import { defineComponent, resolveDirective, createElementBlock, openBlock, Fragment, renderList, withDirectives, normalizeClass, createVNode, withCtx, renderSlot, createTextVNode, toDisplayString } from "vue";
|
|
2
2
|
import { _ as _sfc_main$1 } from "./p-btn.js";
|
|
3
|
+
const _hoisted_1 = { class: "flex" };
|
|
3
4
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
5
|
...{
|
|
5
6
|
name: "PSelectBtn"
|
|
@@ -57,9 +58,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
57
58
|
};
|
|
58
59
|
return (_ctx, _cache) => {
|
|
59
60
|
const _directive_tooltip = resolveDirective("tooltip");
|
|
60
|
-
return openBlock(), createElementBlock("div",
|
|
61
|
-
class: normalizeClass({ flex: _ctx.grow })
|
|
62
|
-
}, [
|
|
61
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
63
62
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (item, index) => {
|
|
64
63
|
return withDirectives((openBlock(), createElementBlock("div", {
|
|
65
64
|
key: String(item[_ctx.itemValue]),
|
|
@@ -94,7 +93,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
94
93
|
[_directive_tooltip, { content: tooltipText(item) }]
|
|
95
94
|
]);
|
|
96
95
|
}), 128))
|
|
97
|
-
]
|
|
96
|
+
]);
|
|
98
97
|
};
|
|
99
98
|
}
|
|
100
99
|
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { defineComponent, computed, useAttrs, createElementBlock, openBlock, normalizeStyle, normalizeClass, renderSlot, createElementVNode, withDirectives, unref, createCommentVNode, toDisplayString, mergeProps, vShow } from "vue";
|
|
2
|
+
import { S as SIZES } from "./p-btn.types.js";
|
|
3
|
+
import { useInputClasses } from "../useInputClasses.js";
|
|
4
|
+
const _hoisted_1 = ["data-has-error"];
|
|
5
|
+
const _hoisted_2 = ["value"];
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
...{
|
|
8
|
+
name: "PTextarea",
|
|
9
|
+
inheritAttrs: false
|
|
10
|
+
},
|
|
11
|
+
__name: "p-textarea",
|
|
12
|
+
props: {
|
|
13
|
+
modelValue: {
|
|
14
|
+
type: [String, Number, null],
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
label: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
errorMsg: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: ""
|
|
24
|
+
},
|
|
25
|
+
required: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false
|
|
28
|
+
},
|
|
29
|
+
size: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "md",
|
|
32
|
+
validator(value) {
|
|
33
|
+
return SIZES.includes(value);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
emits: ["update:modelValue"],
|
|
38
|
+
setup(__props, { emit: __emit }) {
|
|
39
|
+
const emit = __emit;
|
|
40
|
+
const props = __props;
|
|
41
|
+
const { labelClasses, textareaClasses, errorMsgClasses } = useInputClasses(
|
|
42
|
+
computed(() => ({
|
|
43
|
+
required: props.required,
|
|
44
|
+
errorMsg: props.errorMsg,
|
|
45
|
+
size: props.size
|
|
46
|
+
}))
|
|
47
|
+
);
|
|
48
|
+
const allAttrs = useAttrs();
|
|
49
|
+
const attrs = computed(() => {
|
|
50
|
+
const { class: classes, style: style2, ...rest } = allAttrs;
|
|
51
|
+
return rest;
|
|
52
|
+
});
|
|
53
|
+
const style = computed(() => {
|
|
54
|
+
return allAttrs.style;
|
|
55
|
+
});
|
|
56
|
+
const updateValue = (e) => {
|
|
57
|
+
const target = e.target;
|
|
58
|
+
emit("update:modelValue", target.value);
|
|
59
|
+
};
|
|
60
|
+
return (_ctx, _cache) => {
|
|
61
|
+
return openBlock(), createElementBlock("div", {
|
|
62
|
+
class: normalizeClass([{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]),
|
|
63
|
+
"data-has-error": !!__props.errorMsg,
|
|
64
|
+
style: normalizeStyle(style.value)
|
|
65
|
+
}, [
|
|
66
|
+
renderSlot(_ctx.$slots, "label", {
|
|
67
|
+
label: __props.label,
|
|
68
|
+
labelClasses: unref(labelClasses)
|
|
69
|
+
}, () => [
|
|
70
|
+
__props.label ? (openBlock(), createElementBlock("label", {
|
|
71
|
+
key: 0,
|
|
72
|
+
class: normalizeClass(unref(labelClasses))
|
|
73
|
+
}, toDisplayString(__props.label), 3)) : createCommentVNode("", true)
|
|
74
|
+
]),
|
|
75
|
+
createElementVNode("textarea", mergeProps({ value: __props.modelValue }, attrs.value, {
|
|
76
|
+
class: unref(textareaClasses),
|
|
77
|
+
onInput: updateValue
|
|
78
|
+
}), " ", 16, _hoisted_2),
|
|
79
|
+
withDirectives(createElementVNode("div", {
|
|
80
|
+
class: normalizeClass(unref(errorMsgClasses))
|
|
81
|
+
}, toDisplayString(__props.errorMsg), 3), [
|
|
82
|
+
[vShow, __props.errorMsg]
|
|
83
|
+
])
|
|
84
|
+
], 14, _hoisted_1);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
export {
|
|
89
|
+
_sfc_main as _
|
|
90
|
+
};
|