@pequity/squirrel 6.1.1 → 7.0.1
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/index.js +748 -504
- 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 +2 -2
- 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-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/index.js +748 -504
- 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 +2 -2
- 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-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 +8 -248
- 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 +9 -525
- package/dist/squirrel.css +5 -5
- package/package.json +28 -28
- 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 +2 -3
- package/squirrel/components/p-btn/p-btn.vue +2 -2
- 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-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
package/dist/cjs/p-input.js
CHANGED
|
@@ -1,93 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
5
|
-
const INPUT_TYPES = { TEXT: "text", PASSWORD: "password" };
|
|
6
|
-
const _sfc_main = vue.defineComponent({
|
|
7
|
-
name: "PInput",
|
|
8
|
-
mixins: [inputClassesMixin],
|
|
9
|
-
inheritAttrs: false,
|
|
10
|
-
props: {
|
|
11
|
-
modelValue: {
|
|
12
|
-
type: [String, Number],
|
|
13
|
-
default: ""
|
|
14
|
-
},
|
|
15
|
-
type: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: INPUT_TYPES.TEXT,
|
|
18
|
-
validator(value) {
|
|
19
|
-
return Object.values(INPUT_TYPES).includes(value);
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
label: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: ""
|
|
25
|
-
},
|
|
26
|
-
errorMsg: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: ""
|
|
29
|
-
},
|
|
30
|
-
required: {
|
|
31
|
-
type: Boolean,
|
|
32
|
-
default: false
|
|
33
|
-
},
|
|
34
|
-
rounded: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: false
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
emits: ["update:modelValue"],
|
|
40
|
-
computed: {
|
|
41
|
-
attrs() {
|
|
42
|
-
const { class: classes, style, ...rest } = this.$attrs;
|
|
43
|
-
return rest;
|
|
44
|
-
},
|
|
45
|
-
style() {
|
|
46
|
-
return this.$attrs.style;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
const _hoisted_1 = ["data-has-error"];
|
|
51
|
-
const _hoisted_2 = { class: "relative w-full" };
|
|
52
|
-
const _hoisted_3 = { key: 0 };
|
|
53
|
-
const _hoisted_4 = ["type", "value"];
|
|
54
|
-
const _hoisted_5 = { key: 1 };
|
|
55
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
56
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
57
|
-
class: vue.normalizeClass([{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]),
|
|
58
|
-
"data-has-error": !!_ctx.errorMsg,
|
|
59
|
-
style: vue.normalizeStyle(_ctx.style)
|
|
60
|
-
}, [
|
|
61
|
-
vue.renderSlot(_ctx.$slots, "label", {
|
|
62
|
-
label: _ctx.label,
|
|
63
|
-
labelClasses: _ctx.labelClasses
|
|
64
|
-
}, () => [
|
|
65
|
-
_ctx.label ? (vue.openBlock(), vue.createElementBlock("label", {
|
|
66
|
-
key: 0,
|
|
67
|
-
class: vue.normalizeClass(_ctx.labelClasses)
|
|
68
|
-
}, vue.toDisplayString(_ctx.label), 3)) : vue.createCommentVNode("", true)
|
|
69
|
-
]),
|
|
70
|
-
vue.createElementVNode("div", _hoisted_2, [
|
|
71
|
-
!!_ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [
|
|
72
|
-
vue.renderSlot(_ctx.$slots, "prefix")
|
|
73
|
-
])) : vue.createCommentVNode("", true),
|
|
74
|
-
vue.createElementVNode("input", vue.mergeProps({
|
|
75
|
-
type: _ctx.type,
|
|
76
|
-
value: _ctx.modelValue
|
|
77
|
-
}, _ctx.attrs, {
|
|
78
|
-
class: _ctx.inputClasses,
|
|
79
|
-
onInput: _cache[0] || (_cache[0] = (event) => _ctx.$emit("update:modelValue", event.target.value))
|
|
80
|
-
}), null, 16, _hoisted_4),
|
|
81
|
-
!!_ctx.$slots.suffix ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
|
|
82
|
-
vue.renderSlot(_ctx.$slots, "suffix")
|
|
83
|
-
])) : vue.createCommentVNode("", true)
|
|
84
|
-
]),
|
|
85
|
-
vue.withDirectives(vue.createElementVNode("div", {
|
|
86
|
-
class: vue.normalizeClass(_ctx.errorMsgClasses)
|
|
87
|
-
}, vue.toDisplayString(_ctx.errorMsg), 3), [
|
|
88
|
-
[vue.vShow, _ctx.errorMsg]
|
|
89
|
-
])
|
|
90
|
-
], 14, _hoisted_1);
|
|
91
|
-
}
|
|
92
|
-
const PInput = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
93
|
-
module.exports = PInput;
|
|
2
|
+
const pInput_vue_vue_type_script_setup_true_lang = require("./chunks/p-input.js");
|
|
3
|
+
module.exports = pInput_vue_vue_type_script_setup_true_lang._sfc_main;
|
package/dist/cjs/p-modal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const vue = require("vue");
|
|
3
|
-
const
|
|
3
|
+
const pAlert_vue_vue_type_script_setup_true_lang = require("./chunks/p-alert.js");
|
|
4
4
|
const pCloseBtn = require("./p-close-btn.js");
|
|
5
5
|
const usePModal = require("./usePModal.js");
|
|
6
6
|
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
@@ -337,7 +337,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
337
337
|
])
|
|
338
338
|
], true),
|
|
339
339
|
__props.errorMsg ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
|
|
340
|
-
vue.createVNode(
|
|
340
|
+
vue.createVNode(pAlert_vue_vue_type_script_setup_true_lang._sfc_main, { type: "error" }, {
|
|
341
341
|
default: vue.withCtx(() => [
|
|
342
342
|
vue.createTextVNode(vue.toDisplayString(__props.errorMsg), 1)
|
|
343
343
|
]),
|
|
@@ -1,41 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const _sfc_main = vue.defineComponent({
|
|
5
|
-
name: "PProgressBar",
|
|
6
|
-
props: {
|
|
7
|
-
total: {
|
|
8
|
-
type: Number,
|
|
9
|
-
required: true
|
|
10
|
-
},
|
|
11
|
-
items: {
|
|
12
|
-
type: Array,
|
|
13
|
-
required: true
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
const _hoisted_1 = {
|
|
18
|
-
class: "flex justify-start overflow-hidden rounded bg-p-blue-20",
|
|
19
|
-
role: "progressbar"
|
|
20
|
-
};
|
|
21
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
22
|
-
const _directive_tooltip = vue.resolveDirective("tooltip");
|
|
23
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
24
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.items, (item) => {
|
|
25
|
-
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
26
|
-
key: `progress-value-${item.color}`,
|
|
27
|
-
class: "h-full",
|
|
28
|
-
style: vue.normalizeStyle({ width: `${item.value / _ctx.total * 100}%`, background: item.color })
|
|
29
|
-
}, null, 4)), [
|
|
30
|
-
[
|
|
31
|
-
_directive_tooltip,
|
|
32
|
-
item.label,
|
|
33
|
-
void 0,
|
|
34
|
-
{ top: true }
|
|
35
|
-
]
|
|
36
|
-
]);
|
|
37
|
-
}), 128))
|
|
38
|
-
]);
|
|
39
|
-
}
|
|
40
|
-
const pProgressBar = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
41
|
-
module.exports = pProgressBar;
|
|
2
|
+
const pProgressBar_vue_vue_type_script_setup_true_lang = require("./chunks/p-progress-bar.js");
|
|
3
|
+
module.exports = pProgressBar_vue_vue_type_script_setup_true_lang._sfc_main;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const vue = require("vue");
|
|
3
3
|
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
4
|
-
const _sfc_main = vue.defineComponent({
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
5
|
+
...{
|
|
6
|
+
name: "PTableFilterIcon",
|
|
7
|
+
inheritAttrs: false
|
|
8
|
+
},
|
|
9
|
+
__name: "p-table-filter-icon",
|
|
7
10
|
props: {
|
|
8
11
|
active: {
|
|
9
12
|
type: Boolean,
|
|
10
13
|
default: false
|
|
11
14
|
}
|
|
15
|
+
},
|
|
16
|
+
setup(__props) {
|
|
17
|
+
return (_ctx, _cache) => {
|
|
18
|
+
return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
|
|
19
|
+
class: ["h-5 w-5 shrink-0 cursor-pointer filter", { active: __props.active }]
|
|
20
|
+
}, _ctx.$attrs), null, 16);
|
|
21
|
+
};
|
|
12
22
|
}
|
|
13
23
|
});
|
|
14
|
-
|
|
15
|
-
return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
|
|
16
|
-
class: ["h-5 w-5 shrink-0 cursor-pointer filter", { active: _ctx.active }]
|
|
17
|
-
}, _ctx.$attrs), null, 16);
|
|
18
|
-
}
|
|
19
|
-
const PTableFilterIcon = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-cbac2434"]]);
|
|
24
|
+
const PTableFilterIcon = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-84864117"]]);
|
|
20
25
|
module.exports = PTableFilterIcon;
|
package/dist/cjs/p-textarea.js
CHANGED
|
@@ -1,73 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
5
|
-
const _sfc_main = vue.defineComponent({
|
|
6
|
-
name: "PTextarea",
|
|
7
|
-
mixins: [inputClassesMixin],
|
|
8
|
-
inheritAttrs: false,
|
|
9
|
-
props: {
|
|
10
|
-
modelValue: {
|
|
11
|
-
type: [String, Number],
|
|
12
|
-
default: ""
|
|
13
|
-
},
|
|
14
|
-
label: {
|
|
15
|
-
type: String,
|
|
16
|
-
default: ""
|
|
17
|
-
},
|
|
18
|
-
errorMsg: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: ""
|
|
21
|
-
},
|
|
22
|
-
required: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
default: false
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
emits: ["update:modelValue"],
|
|
28
|
-
computed: {
|
|
29
|
-
attrs() {
|
|
30
|
-
const { class: classes, style, ...rest } = this.$attrs;
|
|
31
|
-
return rest;
|
|
32
|
-
},
|
|
33
|
-
style() {
|
|
34
|
-
return this.$attrs.style;
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
methods: {
|
|
38
|
-
updateValue(e) {
|
|
39
|
-
const target = e.target;
|
|
40
|
-
this.$emit("update:modelValue", target.value);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
const _hoisted_1 = ["data-has-error"];
|
|
45
|
-
const _hoisted_2 = ["value"];
|
|
46
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
47
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
48
|
-
class: vue.normalizeClass([{ hidden: _ctx.$attrs.hidden }, _ctx.$attrs.class]),
|
|
49
|
-
"data-has-error": !!_ctx.errorMsg,
|
|
50
|
-
style: vue.normalizeStyle(_ctx.style)
|
|
51
|
-
}, [
|
|
52
|
-
vue.renderSlot(_ctx.$slots, "label", {
|
|
53
|
-
label: _ctx.label,
|
|
54
|
-
labelClasses: _ctx.labelClasses
|
|
55
|
-
}, () => [
|
|
56
|
-
_ctx.label ? (vue.openBlock(), vue.createElementBlock("label", {
|
|
57
|
-
key: 0,
|
|
58
|
-
class: vue.normalizeClass(_ctx.labelClasses)
|
|
59
|
-
}, vue.toDisplayString(_ctx.label), 3)) : vue.createCommentVNode("", true)
|
|
60
|
-
]),
|
|
61
|
-
vue.createElementVNode("textarea", vue.mergeProps({ value: _ctx.modelValue }, _ctx.attrs, {
|
|
62
|
-
class: _ctx.textareaClasses,
|
|
63
|
-
onInput: _cache[0] || (_cache[0] = (...args) => _ctx.updateValue && _ctx.updateValue(...args))
|
|
64
|
-
}), " ", 16, _hoisted_2),
|
|
65
|
-
vue.withDirectives(vue.createElementVNode("div", {
|
|
66
|
-
class: vue.normalizeClass(_ctx.errorMsgClasses)
|
|
67
|
-
}, vue.toDisplayString(_ctx.errorMsg), 3), [
|
|
68
|
-
[vue.vShow, _ctx.errorMsg]
|
|
69
|
-
])
|
|
70
|
-
], 14, _hoisted_1);
|
|
71
|
-
}
|
|
72
|
-
const pTextarea = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
73
|
-
module.exports = pTextarea;
|
|
2
|
+
const pTextarea_vue_vue_type_script_setup_true_lang = require("./chunks/p-textarea.js");
|
|
3
|
+
module.exports = pTextarea_vue_vue_type_script_setup_true_lang._sfc_main;
|
package/dist/cjs/p-toggle.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const inputClassesMixin = require("./inputClassesMixin.js");
|
|
3
2
|
const vue = require("vue");
|
|
3
|
+
const pBtn_types = require("./chunks/p-btn.types.js");
|
|
4
|
+
const useInputClasses = require("./useInputClasses.js");
|
|
4
5
|
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
6
|
+
const _hoisted_1 = ["aria-checked", "data-testid"];
|
|
7
|
+
const _hoisted_2 = ["checked"];
|
|
5
8
|
const TOGGLE_SIZES = {
|
|
6
9
|
sm: `w-7 h-4 after:top-[2px] after:left-[2px] after:h-3 after:w-3`,
|
|
7
10
|
md: `w-11 h-6 after:top-[2px] after:left-[2px] after:h-5 after:w-5`,
|
|
@@ -25,10 +28,12 @@ const TOGGLE_CLASSES = [
|
|
|
25
28
|
"peer-disabled:bg-p-blue-10",
|
|
26
29
|
"peer-disabled:after:border-p-blue-10"
|
|
27
30
|
].join(" ");
|
|
28
|
-
const _sfc_main = vue.defineComponent({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
32
|
+
...{
|
|
33
|
+
name: "PToggle",
|
|
34
|
+
inheritAttrs: false
|
|
35
|
+
},
|
|
36
|
+
__name: "p-toggle",
|
|
32
37
|
props: {
|
|
33
38
|
modelValue: {
|
|
34
39
|
type: Boolean,
|
|
@@ -45,71 +50,78 @@ const _sfc_main = vue.defineComponent({
|
|
|
45
50
|
required: {
|
|
46
51
|
type: Boolean,
|
|
47
52
|
default: false
|
|
53
|
+
},
|
|
54
|
+
size: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: "md",
|
|
57
|
+
validator(value) {
|
|
58
|
+
return pBtn_types.SIZES.includes(value);
|
|
59
|
+
}
|
|
48
60
|
}
|
|
49
61
|
},
|
|
50
62
|
emits: ["update:modelValue"],
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
63
|
+
setup(__props, { emit: __emit }) {
|
|
64
|
+
const emit = __emit;
|
|
65
|
+
const props = __props;
|
|
66
|
+
const allAttrs = vue.useAttrs();
|
|
67
|
+
const { labelClasses, errorMsgClasses } = useInputClasses.useInputClasses(props);
|
|
68
|
+
const toggleClasses = vue.computed(() => {
|
|
69
|
+
const base = `${TOGGLE_CLASSES} ${TOGGLE_SIZES[props.size]}`;
|
|
70
|
+
const res = props.errorMsg ? `${base} border border-on-error` : base;
|
|
55
71
|
return res;
|
|
56
|
-
}
|
|
57
|
-
toggleLabelClasses() {
|
|
58
|
-
return `${
|
|
59
|
-
}
|
|
60
|
-
attrs() {
|
|
61
|
-
const { style, class: classes, "data-testid": dataTestId, ...rest } =
|
|
72
|
+
});
|
|
73
|
+
const toggleLabelClasses = vue.computed(() => {
|
|
74
|
+
return `${labelClasses.value.replace("mb-1", "")} ml-2`;
|
|
75
|
+
});
|
|
76
|
+
const attrs = vue.computed(() => {
|
|
77
|
+
const { style: style2, class: classes, "data-testid": dataTestId, ...rest } = allAttrs;
|
|
62
78
|
return rest;
|
|
63
|
-
}
|
|
64
|
-
style() {
|
|
65
|
-
return
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
methods: {
|
|
69
|
-
change(e) {
|
|
79
|
+
});
|
|
80
|
+
const style = vue.computed(() => {
|
|
81
|
+
return allAttrs.style;
|
|
82
|
+
});
|
|
83
|
+
const change = (e) => {
|
|
70
84
|
const target = e.target;
|
|
71
|
-
|
|
72
|
-
}
|
|
85
|
+
emit("update:modelValue", target.checked);
|
|
86
|
+
};
|
|
87
|
+
return (_ctx, _cache) => {
|
|
88
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
89
|
+
class: vue.normalizeClass(["inline-flex flex-col", _ctx.$attrs.class]),
|
|
90
|
+
style: vue.normalizeStyle(style.value),
|
|
91
|
+
role: "switch",
|
|
92
|
+
"aria-checked": __props.modelValue ? "true" : "false",
|
|
93
|
+
"data-testid": _ctx.$attrs["data-testid"]
|
|
94
|
+
}, [
|
|
95
|
+
vue.createElementVNode("label", {
|
|
96
|
+
class: vue.normalizeClass(["relative inline-flex items-center", { "cursor-pointer": !_ctx.$attrs.disabled }])
|
|
97
|
+
}, [
|
|
98
|
+
vue.createElementVNode("input", vue.mergeProps({
|
|
99
|
+
type: "checkbox",
|
|
100
|
+
checked: __props.modelValue,
|
|
101
|
+
class: "peer sr-only"
|
|
102
|
+
}, { ...attrs.value, input: () => {
|
|
103
|
+
}, onChange: change }), null, 16, _hoisted_2),
|
|
104
|
+
vue.createElementVNode("div", {
|
|
105
|
+
class: vue.normalizeClass(toggleClasses.value)
|
|
106
|
+
}, null, 2),
|
|
107
|
+
vue.renderSlot(_ctx.$slots, "label", {
|
|
108
|
+
label: __props.label,
|
|
109
|
+
labelClasses: toggleLabelClasses.value
|
|
110
|
+
}, () => [
|
|
111
|
+
__props.label ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
112
|
+
key: 0,
|
|
113
|
+
class: vue.normalizeClass(toggleLabelClasses.value)
|
|
114
|
+
}, vue.toDisplayString(__props.label), 3)) : vue.createCommentVNode("", true)
|
|
115
|
+
], true)
|
|
116
|
+
], 2),
|
|
117
|
+
vue.withDirectives(vue.createElementVNode("div", {
|
|
118
|
+
class: vue.normalizeClass(vue.unref(errorMsgClasses))
|
|
119
|
+
}, vue.toDisplayString(__props.errorMsg), 3), [
|
|
120
|
+
[vue.vShow, __props.errorMsg]
|
|
121
|
+
])
|
|
122
|
+
], 14, _hoisted_1);
|
|
123
|
+
};
|
|
73
124
|
}
|
|
74
125
|
});
|
|
75
|
-
const
|
|
76
|
-
const _hoisted_2 = ["checked"];
|
|
77
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
78
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
79
|
-
class: vue.normalizeClass(["inline-flex flex-col", _ctx.$attrs.class]),
|
|
80
|
-
style: vue.normalizeStyle(_ctx.style),
|
|
81
|
-
role: "switch",
|
|
82
|
-
"aria-checked": _ctx.modelValue ? "true" : "false",
|
|
83
|
-
"data-testid": _ctx.$attrs["data-testid"]
|
|
84
|
-
}, [
|
|
85
|
-
vue.createElementVNode("label", {
|
|
86
|
-
class: vue.normalizeClass(["relative inline-flex items-center", { "cursor-pointer": !_ctx.$attrs.disabled }])
|
|
87
|
-
}, [
|
|
88
|
-
vue.createElementVNode("input", vue.mergeProps({
|
|
89
|
-
type: "checkbox",
|
|
90
|
-
checked: _ctx.modelValue,
|
|
91
|
-
class: "peer sr-only"
|
|
92
|
-
}, { ..._ctx.attrs, input: () => {
|
|
93
|
-
}, onChange: _ctx.change }), null, 16, _hoisted_2),
|
|
94
|
-
vue.createElementVNode("div", {
|
|
95
|
-
class: vue.normalizeClass(_ctx.toggleClasses)
|
|
96
|
-
}, null, 2),
|
|
97
|
-
vue.renderSlot(_ctx.$slots, "label", {
|
|
98
|
-
label: _ctx.label,
|
|
99
|
-
labelClasses: _ctx.toggleLabelClasses
|
|
100
|
-
}, () => [
|
|
101
|
-
_ctx.label ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
102
|
-
key: 0,
|
|
103
|
-
class: vue.normalizeClass(_ctx.toggleLabelClasses)
|
|
104
|
-
}, vue.toDisplayString(_ctx.label), 3)) : vue.createCommentVNode("", true)
|
|
105
|
-
], true)
|
|
106
|
-
], 2),
|
|
107
|
-
vue.withDirectives(vue.createElementVNode("div", {
|
|
108
|
-
class: vue.normalizeClass(_ctx.errorMsgClasses)
|
|
109
|
-
}, vue.toDisplayString(_ctx.errorMsg), 3), [
|
|
110
|
-
[vue.vShow, _ctx.errorMsg]
|
|
111
|
-
])
|
|
112
|
-
], 14, _hoisted_1);
|
|
113
|
-
}
|
|
114
|
-
const pToggle = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-152f5bf8"]]);
|
|
126
|
+
const pToggle = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-be9ecb77"]]);
|
|
115
127
|
module.exports = pToggle;
|
|
@@ -3,36 +3,31 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const inputClasses = require("./inputClasses.js");
|
|
4
4
|
const vue = require("vue");
|
|
5
5
|
const defaults = {
|
|
6
|
-
size:
|
|
7
|
-
errorMsg:
|
|
8
|
-
required:
|
|
9
|
-
prefix:
|
|
10
|
-
suffix:
|
|
11
|
-
rounded:
|
|
6
|
+
size: "md",
|
|
7
|
+
errorMsg: "",
|
|
8
|
+
required: false,
|
|
9
|
+
prefix: false,
|
|
10
|
+
suffix: false,
|
|
11
|
+
rounded: false
|
|
12
12
|
};
|
|
13
13
|
function useInputClasses(props) {
|
|
14
|
-
const opts =
|
|
15
|
-
|
|
14
|
+
const opts = vue.computed(() => {
|
|
15
|
+
const propsValue = vue.toValue(props);
|
|
16
|
+
return { ...defaults, ...propsValue, error: !!propsValue.errorMsg };
|
|
17
|
+
});
|
|
16
18
|
const allClasses = vue.computed(() => {
|
|
17
|
-
const { input, label, errorMessage } = inputClasses.inputClasses(
|
|
18
|
-
size: size.value,
|
|
19
|
-
prefix: prefix.value,
|
|
20
|
-
suffix: suffix.value,
|
|
21
|
-
required: required.value,
|
|
22
|
-
error: !!errorMsg.value,
|
|
23
|
-
rounded: rounded.value
|
|
24
|
-
});
|
|
19
|
+
const { input, label, errorMessage } = inputClasses.inputClasses(opts.value);
|
|
25
20
|
return { input: input(), label: label(), errorMessage: errorMessage() };
|
|
26
21
|
});
|
|
27
22
|
const inputClasses$1 = vue.computed(() => allClasses.value.input);
|
|
28
23
|
const labelClasses = vue.computed(() => allClasses.value.label);
|
|
29
24
|
const errorMsgClasses = vue.computed(() => allClasses.value.errorMessage);
|
|
30
25
|
const selectClasses = vue.computed(() => {
|
|
31
|
-
const { input } = inputClasses.selectClasses(
|
|
26
|
+
const { input } = inputClasses.selectClasses(opts.value);
|
|
32
27
|
return input();
|
|
33
28
|
});
|
|
34
29
|
const textareaClasses = vue.computed(() => {
|
|
35
|
-
const { input } = inputClasses.textareaClasses(
|
|
30
|
+
const { input } = inputClasses.textareaClasses(opts.value);
|
|
36
31
|
return input();
|
|
37
32
|
});
|
|
38
33
|
return {
|