@loafacto/ui 0.12.3 → 0.12.5
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/components/LfIconButton.vue.d.ts +2 -0
- package/dist/components/LfSelect.vue.d.ts +11 -6
- package/dist/components/LfTextField.vue.d.ts +10 -3
- package/dist/composables/useSplitAttrs.d.ts +9 -0
- package/dist/index.js +86 -43
- package/dist/index.js.map +1 -1
- package/dist/loafacto-ui.css +29 -17
- package/dist/types.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LfOption } from '../types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
/**
|
|
4
|
-
options?: (LfOption | string)[];
|
|
3
|
+
/** 문자열·숫자 배열도 받는다 — 값과 표시가 같을 때 `{value,label}` 을 두 번 쓰지 않으려고. */
|
|
4
|
+
options?: (LfOption | string | number)[];
|
|
5
5
|
label?: string;
|
|
6
6
|
hint?: string;
|
|
7
7
|
error?: string;
|
|
@@ -14,16 +14,21 @@ type __VLS_Props = {
|
|
|
14
14
|
size?: 'sm' | 'md';
|
|
15
15
|
};
|
|
16
16
|
type __VLS_ModelProps = {
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* `v-model.number` 를 받는다. 컴포넌트의 v-model 에 붙은 수식어는 브라우저가 아니라
|
|
19
|
+
* 컴포넌트가 처리해야 한다 — 그냥 두면 `<LfTextField v-model.number="n">` 이 문자열을
|
|
20
|
+
* 돌려주고, 저장 직전에야 "1" + 1 = "11" 로 드러난다.
|
|
21
|
+
*/
|
|
22
|
+
modelValue?: string | number | null;
|
|
18
23
|
};
|
|
19
24
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
20
25
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
21
|
-
"update:modelValue": (value: string | number) => any;
|
|
26
|
+
"update:modelValue": (value: string | number | null) => any;
|
|
22
27
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
23
|
-
"onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
|
|
28
|
+
"onUpdate:modelValue"?: ((value: string | number | null) => any) | undefined;
|
|
24
29
|
}>, {
|
|
25
30
|
size: "sm" | "md";
|
|
26
|
-
options: (LfOption | string)[];
|
|
31
|
+
options: (LfOption | string | number)[];
|
|
27
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
33
|
declare const _default: typeof __VLS_export;
|
|
29
34
|
export default _default;
|
|
@@ -16,15 +16,22 @@ type __VLS_Props = {
|
|
|
16
16
|
clearable?: boolean;
|
|
17
17
|
/** 비밀번호 보기 토글. `type="password"` 와 함께 쓴다. */
|
|
18
18
|
revealable?: boolean;
|
|
19
|
+
/** 값 뒤에 붙는 단위. "GB", "ms" 같은 것. */
|
|
20
|
+
suffix?: string;
|
|
19
21
|
};
|
|
20
22
|
type __VLS_ModelProps = {
|
|
21
|
-
|
|
23
|
+
/**
|
|
24
|
+
* `v-model.number` 를 받는다. 컴포넌트의 v-model 에 붙은 수식어는 브라우저가 아니라
|
|
25
|
+
* 컴포넌트가 처리해야 한다 — 그냥 두면 `<LfTextField v-model.number="n">` 이 문자열을
|
|
26
|
+
* 돌려주고, 저장 직전에야 "1" + 1 = "11" 로 드러난다.
|
|
27
|
+
*/
|
|
28
|
+
modelValue?: string | number | null;
|
|
22
29
|
};
|
|
23
30
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
24
31
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
-
"update:modelValue": (value: string | number) => any;
|
|
32
|
+
"update:modelValue": (value: string | number | null) => any;
|
|
26
33
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
27
|
-
"onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
|
|
34
|
+
"onUpdate:modelValue"?: ((value: string | number | null) => any) | undefined;
|
|
28
35
|
}>, {
|
|
29
36
|
size: "sm" | "md";
|
|
30
37
|
type: "text" | "password" | "email" | "search" | "url" | "tel" | "number" | "date" | "datetime-local" | "time";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readonly, ref, openBlock, createElementBlock, createStaticVNode, createElementVNode, defineComponent, computed, watch, onBeforeUnmount, normalizeClass, normalizeStyle, createCommentVNode, Fragment, toDisplayString, createVNode, renderList, renderSlot, unref, onUnmounted, createBlock, Teleport, TransitionGroup, withCtx, withModifiers, Transition, useTemplateRef, onMounted, nextTick, createTextVNode, withDirectives, withKeys, vModelText, resolveDynamicComponent, useModel, useId, mergeProps, vModelDynamic, mergeModels, vModelSelect, vModelCheckbox, vModelRadio, useSlots } from "vue";
|
|
1
|
+
import { readonly, ref, openBlock, createElementBlock, createStaticVNode, createElementVNode, defineComponent, computed, watch, onBeforeUnmount, normalizeClass, normalizeStyle, createCommentVNode, Fragment, toDisplayString, createVNode, renderList, renderSlot, unref, onUnmounted, createBlock, Teleport, TransitionGroup, withCtx, withModifiers, Transition, useTemplateRef, onMounted, nextTick, createTextVNode, withDirectives, withKeys, vModelText, resolveDynamicComponent, useAttrs, useModel, useId, mergeProps, isRef, vModelDynamic, mergeModels, vModelSelect, vModelCheckbox, vModelRadio, useSlots } from "vue";
|
|
2
2
|
import { a as applyTheme, D as DARK_THEME, L as LIGHT_THEME } from "./applyTheme-8AxcQbPB.js";
|
|
3
3
|
import { b, c, d, e, f, h, i, l } from "./applyTheme-8AxcQbPB.js";
|
|
4
4
|
import { defineStore } from "pinia";
|
|
@@ -203,7 +203,7 @@ const _hoisted_1$s = { class: "lf-topbar" };
|
|
|
203
203
|
const _hoisted_2$o = { class: "lf-topbar__inner" };
|
|
204
204
|
const _hoisted_3$j = ["aria-label", "title", "aria-expanded"];
|
|
205
205
|
const _hoisted_4$h = ["href", "aria-label"];
|
|
206
|
-
const _hoisted_5$
|
|
206
|
+
const _hoisted_5$e = ["src"];
|
|
207
207
|
const _hoisted_6$a = { class: "lf-brand__name" };
|
|
208
208
|
const _hoisted_7$8 = ["aria-expanded"];
|
|
209
209
|
const _hoisted_8$3 = {
|
|
@@ -417,7 +417,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
417
417
|
src: __props.logoUrl,
|
|
418
418
|
alt: "",
|
|
419
419
|
class: "lf-brand__logo"
|
|
420
|
-
}, null, 8, _hoisted_5$
|
|
420
|
+
}, null, 8, _hoisted_5$e),
|
|
421
421
|
createElementVNode("span", _hoisted_6$a, toDisplayString(__props.brandName), 1)
|
|
422
422
|
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
423
423
|
createVNode(BrandLockup, { class: "lf-brand__lockup" }),
|
|
@@ -637,7 +637,7 @@ const _hoisted_3$i = {
|
|
|
637
637
|
"aria-hidden": "true"
|
|
638
638
|
};
|
|
639
639
|
const _hoisted_4$g = ["d"];
|
|
640
|
-
const _hoisted_5$
|
|
640
|
+
const _hoisted_5$d = { class: "toast-message" };
|
|
641
641
|
const _hoisted_6$9 = ["onClick"];
|
|
642
642
|
const _hoisted_7$7 = {
|
|
643
643
|
viewBox: "0 0 24 24",
|
|
@@ -692,7 +692,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
692
692
|
fill: "currentColor"
|
|
693
693
|
}, null, 8, _hoisted_4$g)
|
|
694
694
|
])),
|
|
695
|
-
createElementVNode("span", _hoisted_5$
|
|
695
|
+
createElementVNode("span", _hoisted_5$d, toDisplayString(item.message), 1),
|
|
696
696
|
createElementVNode("button", {
|
|
697
697
|
type: "button",
|
|
698
698
|
class: "toast-close",
|
|
@@ -823,7 +823,7 @@ const _hoisted_2$m = {
|
|
|
823
823
|
};
|
|
824
824
|
const _hoisted_3$h = { class: "app-confirm__header" };
|
|
825
825
|
const _hoisted_4$f = { class: "app-confirm__title" };
|
|
826
|
-
const _hoisted_5$
|
|
826
|
+
const _hoisted_5$c = { class: "app-confirm__body" };
|
|
827
827
|
const _hoisted_6$8 = { class: "app-confirm__message" };
|
|
828
828
|
const _hoisted_7$6 = {
|
|
829
829
|
key: 0,
|
|
@@ -862,7 +862,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
862
862
|
createElementVNode("div", _hoisted_3$h, [
|
|
863
863
|
createElementVNode("h3", _hoisted_4$f, toDisplayString(unref(store).title), 1)
|
|
864
864
|
]),
|
|
865
|
-
createElementVNode("div", _hoisted_5$
|
|
865
|
+
createElementVNode("div", _hoisted_5$c, [
|
|
866
866
|
createElementVNode("p", _hoisted_6$8, toDisplayString(unref(store).message), 1),
|
|
867
867
|
unref(store).requireText ? (openBlock(), createElementBlock("label", _hoisted_7$6, [
|
|
868
868
|
createElementVNode("span", _hoisted_8$1, [
|
|
@@ -1085,10 +1085,13 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
1085
1085
|
accent: { type: Boolean },
|
|
1086
1086
|
danger: { type: Boolean },
|
|
1087
1087
|
disabled: { type: Boolean },
|
|
1088
|
+
loading: { type: Boolean },
|
|
1088
1089
|
href: {},
|
|
1089
1090
|
external: { type: Boolean }
|
|
1090
1091
|
},
|
|
1091
1092
|
setup(__props) {
|
|
1093
|
+
const props = __props;
|
|
1094
|
+
const iconSize = computed(() => props.size === "sm" ? "1.125rem" : "1.375rem");
|
|
1092
1095
|
return (_ctx, _cache) => {
|
|
1093
1096
|
return openBlock(), createBlock(resolveDynamicComponent(__props.href ? "a" : "button"), {
|
|
1094
1097
|
class: normalizeClass(["lf-icon-btn", [`lf-icon-btn--${__props.size}`, { "lf-icon-btn--accent": __props.accent, "lf-icon-btn--danger": __props.danger }]]),
|
|
@@ -1096,23 +1099,28 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
1096
1099
|
href: __props.href,
|
|
1097
1100
|
target: __props.href && __props.external ? "_blank" : void 0,
|
|
1098
1101
|
rel: __props.href && __props.external ? "noopener noreferrer" : void 0,
|
|
1099
|
-
disabled: __props.href ? void 0 : __props.disabled,
|
|
1102
|
+
disabled: __props.href ? void 0 : __props.disabled || __props.loading,
|
|
1103
|
+
"aria-busy": __props.loading ? "true" : void 0,
|
|
1100
1104
|
"aria-label": __props.label,
|
|
1101
1105
|
title: __props.label
|
|
1102
1106
|
}, {
|
|
1103
1107
|
default: withCtx(() => [
|
|
1104
|
-
|
|
1108
|
+
__props.loading ? (openBlock(), createBlock(LfSpinner, {
|
|
1109
|
+
key: 0,
|
|
1110
|
+
size: iconSize.value
|
|
1111
|
+
}, null, 8, ["size"])) : (openBlock(), createBlock(LfIcon, {
|
|
1112
|
+
key: 1,
|
|
1105
1113
|
name: __props.icon,
|
|
1106
1114
|
path: __props.iconPath,
|
|
1107
|
-
size:
|
|
1108
|
-
}, null, 8, ["name", "path", "size"])
|
|
1115
|
+
size: iconSize.value
|
|
1116
|
+
}, null, 8, ["name", "path", "size"]))
|
|
1109
1117
|
]),
|
|
1110
1118
|
_: 1
|
|
1111
|
-
}, 8, ["class", "type", "href", "target", "rel", "disabled", "aria-label", "title"]);
|
|
1119
|
+
}, 8, ["class", "type", "href", "target", "rel", "disabled", "aria-busy", "aria-label", "title"]);
|
|
1112
1120
|
};
|
|
1113
1121
|
}
|
|
1114
1122
|
});
|
|
1115
|
-
const LfIconButton = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-
|
|
1123
|
+
const LfIconButton = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-e86ee99c"]]);
|
|
1116
1124
|
const _hoisted_1$l = ["for"];
|
|
1117
1125
|
const _hoisted_2$k = {
|
|
1118
1126
|
key: 0,
|
|
@@ -1157,13 +1165,26 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
1157
1165
|
}
|
|
1158
1166
|
});
|
|
1159
1167
|
const LfField = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-38509e4d"]]);
|
|
1168
|
+
function useSplitAttrs() {
|
|
1169
|
+
const attrs = useAttrs();
|
|
1170
|
+
const rootAttrs = computed(() => ({ class: attrs.class, style: attrs.style }));
|
|
1171
|
+
const controlAttrs = computed(() => {
|
|
1172
|
+
const { class: _class, style: _style, ...rest } = attrs;
|
|
1173
|
+
return rest;
|
|
1174
|
+
});
|
|
1175
|
+
return { rootAttrs, controlAttrs };
|
|
1176
|
+
}
|
|
1160
1177
|
const _hoisted_1$k = { class: "lf-control-wrap" };
|
|
1161
1178
|
const _hoisted_2$j = {
|
|
1162
1179
|
key: 0,
|
|
1163
1180
|
class: "lf-control-wrap__icon lf-control-wrap__icon--left"
|
|
1164
1181
|
};
|
|
1165
1182
|
const _hoisted_3$e = ["id", "type", "placeholder", "disabled", "readonly", "required", "aria-invalid"];
|
|
1166
|
-
const _hoisted_4$d =
|
|
1183
|
+
const _hoisted_4$d = {
|
|
1184
|
+
key: 1,
|
|
1185
|
+
class: "lf-control-wrap__suffix"
|
|
1186
|
+
};
|
|
1187
|
+
const _hoisted_5$b = ["aria-label"];
|
|
1167
1188
|
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
1168
1189
|
...{ inheritAttrs: false },
|
|
1169
1190
|
__name: "LfTextField",
|
|
@@ -1180,15 +1201,25 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
1180
1201
|
icon: {},
|
|
1181
1202
|
iconPath: {},
|
|
1182
1203
|
clearable: { type: Boolean },
|
|
1183
|
-
revealable: { type: Boolean }
|
|
1204
|
+
revealable: { type: Boolean },
|
|
1205
|
+
suffix: {}
|
|
1184
1206
|
}, {
|
|
1185
|
-
"modelValue": {
|
|
1207
|
+
"modelValue": {
|
|
1208
|
+
default: ""
|
|
1209
|
+
},
|
|
1186
1210
|
"modelModifiers": {}
|
|
1187
1211
|
}),
|
|
1188
1212
|
emits: ["update:modelValue"],
|
|
1189
1213
|
setup(__props) {
|
|
1190
1214
|
const props = __props;
|
|
1191
|
-
const model = useModel(__props, "modelValue"
|
|
1215
|
+
const [model, modifiers] = useModel(__props, "modelValue", {
|
|
1216
|
+
set(value) {
|
|
1217
|
+
if (!modifiers.number || value === "" || typeof value === "number") return value;
|
|
1218
|
+
const n = parseFloat(String(value));
|
|
1219
|
+
return Number.isNaN(n) ? value : n;
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
const { rootAttrs, controlAttrs } = useSplitAttrs();
|
|
1192
1223
|
const inputId = useId();
|
|
1193
1224
|
const revealed = ref(false);
|
|
1194
1225
|
const hasTrailing = computed(
|
|
@@ -1198,13 +1229,13 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
1198
1229
|
model.value = typeof model.value === "number" ? 0 : "";
|
|
1199
1230
|
}
|
|
1200
1231
|
return (_ctx, _cache) => {
|
|
1201
|
-
return openBlock(), createBlock(LfField, {
|
|
1232
|
+
return openBlock(), createBlock(LfField, mergeProps(unref(rootAttrs), {
|
|
1202
1233
|
label: __props.label,
|
|
1203
1234
|
hint: __props.hint,
|
|
1204
1235
|
error: __props.error,
|
|
1205
1236
|
required: __props.required,
|
|
1206
1237
|
"html-for": unref(inputId)
|
|
1207
|
-
}, {
|
|
1238
|
+
}), {
|
|
1208
1239
|
default: withCtx(() => [
|
|
1209
1240
|
createElementVNode("div", _hoisted_1$k, [
|
|
1210
1241
|
__props.icon || __props.iconPath ? (openBlock(), createElementBlock("span", _hoisted_2$j, [
|
|
@@ -1214,12 +1245,13 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
1214
1245
|
size: "1.125rem"
|
|
1215
1246
|
}, null, 8, ["name", "path"])
|
|
1216
1247
|
])) : createCommentVNode("", true),
|
|
1217
|
-
withDirectives(createElementVNode("input", mergeProps({ id: unref(inputId) },
|
|
1218
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
1248
|
+
withDirectives(createElementVNode("input", mergeProps({ id: unref(inputId) }, unref(controlAttrs), {
|
|
1249
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
|
|
1219
1250
|
class: ["lf-control", [
|
|
1220
1251
|
{ "lf-control--sm": __props.size === "sm", "lf-control--error": !!__props.error },
|
|
1221
1252
|
(__props.icon || __props.iconPath) && "lf-control--has-left",
|
|
1222
|
-
hasTrailing.value && "lf-control--has-right"
|
|
1253
|
+
hasTrailing.value && "lf-control--has-right",
|
|
1254
|
+
__props.suffix && "lf-control--has-suffix"
|
|
1223
1255
|
]],
|
|
1224
1256
|
type: revealed.value ? "text" : __props.type,
|
|
1225
1257
|
placeholder: __props.placeholder,
|
|
@@ -1228,10 +1260,11 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
1228
1260
|
required: __props.required,
|
|
1229
1261
|
"aria-invalid": __props.error ? "true" : void 0
|
|
1230
1262
|
}), null, 16, _hoisted_3$e), [
|
|
1231
|
-
[vModelDynamic, model
|
|
1263
|
+
[vModelDynamic, unref(model)]
|
|
1232
1264
|
]),
|
|
1265
|
+
__props.suffix ? (openBlock(), createElementBlock("span", _hoisted_4$d, toDisplayString(__props.suffix), 1)) : createCommentVNode("", true),
|
|
1233
1266
|
__props.revealable ? (openBlock(), createElementBlock("button", {
|
|
1234
|
-
key:
|
|
1267
|
+
key: 2,
|
|
1235
1268
|
type: "button",
|
|
1236
1269
|
class: "lf-control-action",
|
|
1237
1270
|
"aria-label": revealed.value ? "비밀번호 가리기" : "비밀번호 보기",
|
|
@@ -1241,8 +1274,8 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
1241
1274
|
name: revealed.value ? "visibility_off" : "visibility",
|
|
1242
1275
|
size: "1.125rem"
|
|
1243
1276
|
}, null, 8, ["name"])
|
|
1244
|
-
], 8,
|
|
1245
|
-
key:
|
|
1277
|
+
], 8, _hoisted_5$b)) : __props.clearable && !!unref(model) && !__props.disabled && !__props.readonly ? (openBlock(), createElementBlock("button", {
|
|
1278
|
+
key: 3,
|
|
1246
1279
|
type: "button",
|
|
1247
1280
|
class: "lf-control-action",
|
|
1248
1281
|
"aria-label": "지우기",
|
|
@@ -1256,11 +1289,11 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
1256
1289
|
])
|
|
1257
1290
|
]),
|
|
1258
1291
|
_: 1
|
|
1259
|
-
},
|
|
1292
|
+
}, 16, ["label", "hint", "error", "required", "html-for"]);
|
|
1260
1293
|
};
|
|
1261
1294
|
}
|
|
1262
1295
|
});
|
|
1263
|
-
const LfTextField = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-
|
|
1296
|
+
const LfTextField = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-e113043f"]]);
|
|
1264
1297
|
const _hoisted_1$j = ["id", "rows", "placeholder", "disabled", "readonly", "required", "maxlength", "aria-invalid"];
|
|
1265
1298
|
const _hoisted_2$i = {
|
|
1266
1299
|
key: 0,
|
|
@@ -1291,6 +1324,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
1291
1324
|
setup(__props) {
|
|
1292
1325
|
const props = __props;
|
|
1293
1326
|
const model = useModel(__props, "modelValue");
|
|
1327
|
+
const { rootAttrs, controlAttrs } = useSplitAttrs();
|
|
1294
1328
|
const inputId = useId();
|
|
1295
1329
|
const el = useTemplateRef("el");
|
|
1296
1330
|
function grow() {
|
|
@@ -1306,19 +1340,19 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
1306
1340
|
if (props.autoGrow) void nextTick(grow);
|
|
1307
1341
|
});
|
|
1308
1342
|
return (_ctx, _cache) => {
|
|
1309
|
-
return openBlock(), createBlock(LfField, {
|
|
1343
|
+
return openBlock(), createBlock(LfField, mergeProps(unref(rootAttrs), {
|
|
1310
1344
|
label: __props.label,
|
|
1311
1345
|
hint: __props.hint,
|
|
1312
1346
|
error: __props.error,
|
|
1313
1347
|
required: __props.required,
|
|
1314
1348
|
"html-for": unref(inputId)
|
|
1315
|
-
}, {
|
|
1349
|
+
}), {
|
|
1316
1350
|
default: withCtx(() => [
|
|
1317
1351
|
withDirectives(createElementVNode("textarea", mergeProps({
|
|
1318
1352
|
id: unref(inputId),
|
|
1319
1353
|
ref_key: "el",
|
|
1320
1354
|
ref: el
|
|
1321
|
-
},
|
|
1355
|
+
}, unref(controlAttrs), {
|
|
1322
1356
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
1323
1357
|
class: ["lf-control lf-textarea", { "lf-control--sm": __props.size === "sm", "lf-control--error": !!__props.error, "lf-textarea--fixed": !__props.resize }],
|
|
1324
1358
|
rows: __props.rows,
|
|
@@ -1335,11 +1369,11 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
1335
1369
|
__props.maxlength && __props.counter ? (openBlock(), createElementBlock("p", _hoisted_2$i, toDisplayString(String(model.value ?? "").length) + " / " + toDisplayString(__props.maxlength), 1)) : createCommentVNode("", true)
|
|
1336
1370
|
]),
|
|
1337
1371
|
_: 1
|
|
1338
|
-
},
|
|
1372
|
+
}, 16, ["label", "hint", "error", "required", "html-for"]);
|
|
1339
1373
|
};
|
|
1340
1374
|
}
|
|
1341
1375
|
});
|
|
1342
|
-
const LfTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-
|
|
1376
|
+
const LfTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-81fbed25"]]);
|
|
1343
1377
|
const _hoisted_1$i = { class: "lf-control-wrap" };
|
|
1344
1378
|
const _hoisted_2$h = ["id", "disabled", "required", "aria-invalid"];
|
|
1345
1379
|
const _hoisted_3$d = ["disabled"];
|
|
@@ -1359,29 +1393,38 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
1359
1393
|
disabled: { type: Boolean },
|
|
1360
1394
|
size: { default: "md" }
|
|
1361
1395
|
}, {
|
|
1362
|
-
"modelValue": {
|
|
1396
|
+
"modelValue": {
|
|
1397
|
+
default: ""
|
|
1398
|
+
},
|
|
1363
1399
|
"modelModifiers": {}
|
|
1364
1400
|
}),
|
|
1365
1401
|
emits: ["update:modelValue"],
|
|
1366
1402
|
setup(__props) {
|
|
1367
1403
|
const props = __props;
|
|
1368
|
-
const model = useModel(__props, "modelValue"
|
|
1404
|
+
const [model, modifiers] = useModel(__props, "modelValue", {
|
|
1405
|
+
set(value) {
|
|
1406
|
+
if (!modifiers.number || value === "" || typeof value === "number") return value;
|
|
1407
|
+
const n = parseFloat(String(value));
|
|
1408
|
+
return Number.isNaN(n) ? value : n;
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1411
|
+
const { rootAttrs, controlAttrs } = useSplitAttrs();
|
|
1369
1412
|
const inputId = useId();
|
|
1370
1413
|
const normalized = computed(
|
|
1371
|
-
() => props.options.map((o) => typeof o === "string" ? { value: o, label: o } : o)
|
|
1414
|
+
() => props.options.map((o) => typeof o === "string" || typeof o === "number" ? { value: o, label: String(o) } : o)
|
|
1372
1415
|
);
|
|
1373
1416
|
return (_ctx, _cache) => {
|
|
1374
|
-
return openBlock(), createBlock(LfField, {
|
|
1417
|
+
return openBlock(), createBlock(LfField, mergeProps(unref(rootAttrs), {
|
|
1375
1418
|
label: __props.label,
|
|
1376
1419
|
hint: __props.hint,
|
|
1377
1420
|
error: __props.error,
|
|
1378
1421
|
required: __props.required,
|
|
1379
1422
|
"html-for": unref(inputId)
|
|
1380
|
-
}, {
|
|
1423
|
+
}), {
|
|
1381
1424
|
default: withCtx(() => [
|
|
1382
1425
|
createElementVNode("div", _hoisted_1$i, [
|
|
1383
|
-
withDirectives(createElementVNode("select", mergeProps({ id: unref(inputId) },
|
|
1384
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
1426
|
+
withDirectives(createElementVNode("select", mergeProps({ id: unref(inputId) }, unref(controlAttrs), {
|
|
1427
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
|
|
1385
1428
|
class: ["lf-control lf-select lf-control--has-right", { "lf-control--sm": __props.size === "sm", "lf-control--error": !!__props.error }],
|
|
1386
1429
|
disabled: __props.disabled,
|
|
1387
1430
|
required: __props.required,
|
|
@@ -1400,7 +1443,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
1400
1443
|
}, toDisplayString(opt.label), 9, _hoisted_4$c);
|
|
1401
1444
|
}), 128))
|
|
1402
1445
|
], 16, _hoisted_2$h), [
|
|
1403
|
-
[vModelSelect, model
|
|
1446
|
+
[vModelSelect, unref(model)]
|
|
1404
1447
|
]),
|
|
1405
1448
|
createElementVNode("span", _hoisted_5$a, [
|
|
1406
1449
|
createVNode(LfIcon, {
|
|
@@ -1411,11 +1454,11 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
1411
1454
|
])
|
|
1412
1455
|
]),
|
|
1413
1456
|
_: 1
|
|
1414
|
-
},
|
|
1457
|
+
}, 16, ["label", "hint", "error", "required", "html-for"]);
|
|
1415
1458
|
};
|
|
1416
1459
|
}
|
|
1417
1460
|
});
|
|
1418
|
-
const LfSelect = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-
|
|
1461
|
+
const LfSelect = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-e0d9d182"]]);
|
|
1419
1462
|
const _hoisted_1$h = ["disabled", "value"];
|
|
1420
1463
|
const _hoisted_2$g = {
|
|
1421
1464
|
class: "lf-check__box",
|