@loafacto/ui 0.23.2 → 0.24.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/LfSegmented-D2zAGi24.js +182 -0
- package/dist/LfSegmented-D2zAGi24.js.map +1 -0
- package/dist/{LfSegmented-CvGl-0vv.js → LfSelect-BrK4QbUk.js} +137 -116
- package/dist/LfSelect-BrK4QbUk.js.map +1 -0
- package/dist/LfSwitch-BD05yyB3.js +119 -0
- package/dist/LfSwitch-BD05yyB3.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +152 -456
- package/dist/index.js.map +1 -1
- package/dist/loafacto-ui.css +967 -414
- package/dist/map-editor/LfMapEditor.vue.d.ts +126 -0
- package/dist/map-editor/MapEditorCanvas.vue.d.ts +19 -0
- package/dist/map-editor/doc.d.ts +134 -0
- package/dist/map-editor/editor.d.ts +149 -0
- package/dist/map-editor.d.ts +19 -0
- package/dist/map-editor.js +2096 -0
- package/dist/map-editor.js.map +1 -0
- package/dist/map3d/LfModelEditor.vue.d.ts +19 -0
- package/dist/map3d/LfModelViewer.vue.d.ts +28 -0
- package/dist/map3d/MapScene.d.ts +9 -0
- package/dist/map3d/ModelScene.d.ts +43 -0
- package/dist/map3d/model.d.ts +54 -0
- package/dist/map3d/types.d.ts +81 -1
- package/dist/map3d.d.ts +5 -1
- package/dist/map3d.js +1208 -31
- package/dist/map3d.js.map +1 -1
- package/package.json +5 -1
- package/dist/LfSegmented-CvGl-0vv.js.map +0 -1
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot, createVNode, toDisplayString, createCommentVNode, createTextVNode, createBlock, useModel, computed, useTemplateRef, ref, watch, nextTick, onMounted, onBeforeUnmount, normalizeStyle, Fragment, renderList, mergeProps, mergeModels } from "vue";
|
|
2
|
+
import { L as LfIcon, b as LfIconButton, _ as _export_sfc, c as LF_ICONS } from "./LfSelect-BrK4QbUk.js";
|
|
3
|
+
const _hoisted_1$1 = ["role"];
|
|
4
|
+
const _hoisted_2$1 = {
|
|
5
|
+
class: "lf-alert__badge",
|
|
6
|
+
"aria-hidden": "true"
|
|
7
|
+
};
|
|
8
|
+
const _hoisted_3$1 = { class: "lf-alert__body" };
|
|
9
|
+
const _hoisted_4$1 = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "lf-alert__title"
|
|
12
|
+
};
|
|
13
|
+
const _hoisted_5 = {
|
|
14
|
+
key: 2,
|
|
15
|
+
class: "lf-alert__actions"
|
|
16
|
+
};
|
|
17
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
18
|
+
__name: "LfAlert",
|
|
19
|
+
props: {
|
|
20
|
+
tone: { default: "info" },
|
|
21
|
+
title: {},
|
|
22
|
+
message: {},
|
|
23
|
+
icon: {},
|
|
24
|
+
iconPath: {},
|
|
25
|
+
closable: { type: Boolean },
|
|
26
|
+
closeLabel: { default: "닫기" },
|
|
27
|
+
dense: { type: Boolean }
|
|
28
|
+
},
|
|
29
|
+
emits: ["close"],
|
|
30
|
+
setup(__props, { emit: __emit }) {
|
|
31
|
+
const emit = __emit;
|
|
32
|
+
const TONE_ICON = {
|
|
33
|
+
info: "info",
|
|
34
|
+
success: "check_circle",
|
|
35
|
+
warning: "warning",
|
|
36
|
+
error: "error"
|
|
37
|
+
};
|
|
38
|
+
return (_ctx, _cache) => {
|
|
39
|
+
return openBlock(), createElementBlock("div", {
|
|
40
|
+
class: normalizeClass(["lf-alert", [`lf-alert--${__props.tone}`, { "lf-alert--dense": __props.dense }]]),
|
|
41
|
+
role: __props.tone === "error" ? "alert" : "status"
|
|
42
|
+
}, [
|
|
43
|
+
createElementVNode("span", _hoisted_2$1, [
|
|
44
|
+
renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
45
|
+
createVNode(LfIcon, {
|
|
46
|
+
name: __props.icon ?? TONE_ICON[__props.tone],
|
|
47
|
+
path: __props.iconPath,
|
|
48
|
+
size: __props.dense ? "0.9375rem" : "1.0625rem"
|
|
49
|
+
}, null, 8, ["name", "path", "size"])
|
|
50
|
+
], true)
|
|
51
|
+
]),
|
|
52
|
+
createElementVNode("div", _hoisted_3$1, [
|
|
53
|
+
__props.title ? (openBlock(), createElementBlock("p", _hoisted_4$1, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
|
|
54
|
+
__props.message || _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
|
|
55
|
+
key: 1,
|
|
56
|
+
class: normalizeClass(["lf-alert__text", { "lf-alert__text--titled": __props.title }])
|
|
57
|
+
}, [
|
|
58
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
59
|
+
createTextVNode(toDisplayString(__props.message), 1)
|
|
60
|
+
], true)
|
|
61
|
+
], 2)) : createCommentVNode("", true),
|
|
62
|
+
_ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
63
|
+
renderSlot(_ctx.$slots, "actions", {}, void 0, true)
|
|
64
|
+
])) : createCommentVNode("", true)
|
|
65
|
+
]),
|
|
66
|
+
__props.closable ? (openBlock(), createBlock(LfIconButton, {
|
|
67
|
+
key: 0,
|
|
68
|
+
class: "lf-alert__close",
|
|
69
|
+
icon: "close",
|
|
70
|
+
size: "sm",
|
|
71
|
+
label: __props.closeLabel,
|
|
72
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
|
|
73
|
+
}, null, 8, ["label"])) : createCommentVNode("", true)
|
|
74
|
+
], 10, _hoisted_1$1);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
const LfAlert = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-62839786"]]);
|
|
79
|
+
const _hoisted_1 = ["aria-label"];
|
|
80
|
+
const _hoisted_2 = ["aria-checked", "aria-label", "title", "disabled", "onClick"];
|
|
81
|
+
const _hoisted_3 = {
|
|
82
|
+
key: 1,
|
|
83
|
+
class: "lf-seg__label"
|
|
84
|
+
};
|
|
85
|
+
const _hoisted_4 = {
|
|
86
|
+
key: 2,
|
|
87
|
+
class: "lf-seg__badge"
|
|
88
|
+
};
|
|
89
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
90
|
+
__name: "LfSegmented",
|
|
91
|
+
props: /* @__PURE__ */ mergeModels({
|
|
92
|
+
options: { default: () => [] },
|
|
93
|
+
size: { default: "md" },
|
|
94
|
+
labelHidden: { type: Boolean },
|
|
95
|
+
block: { type: Boolean },
|
|
96
|
+
disabled: { type: Boolean },
|
|
97
|
+
ariaLabel: {}
|
|
98
|
+
}, {
|
|
99
|
+
"modelValue": { required: true },
|
|
100
|
+
"modelModifiers": {}
|
|
101
|
+
}),
|
|
102
|
+
emits: ["update:modelValue"],
|
|
103
|
+
setup(__props) {
|
|
104
|
+
const props = __props;
|
|
105
|
+
const model = useModel(__props, "modelValue");
|
|
106
|
+
const normalized = computed(
|
|
107
|
+
() => props.options.map((o) => typeof o === "string" ? { value: o, label: o } : o)
|
|
108
|
+
);
|
|
109
|
+
const root = useTemplateRef("root");
|
|
110
|
+
const thumb = ref(null);
|
|
111
|
+
const instant = ref(true);
|
|
112
|
+
let lastEl = null;
|
|
113
|
+
function measure() {
|
|
114
|
+
var _a;
|
|
115
|
+
const el = ((_a = root.value) == null ? void 0 : _a.querySelector(".lf-seg__btn--on")) ?? null;
|
|
116
|
+
const next = el && el.offsetWidth ? { x: el.offsetLeft, w: el.offsetWidth } : null;
|
|
117
|
+
const cur = thumb.value;
|
|
118
|
+
if (cur && next && cur.x === next.x && cur.w === next.w) return;
|
|
119
|
+
instant.value = !lastEl || el === lastEl || !cur;
|
|
120
|
+
if (next) lastEl = el;
|
|
121
|
+
thumb.value = next;
|
|
122
|
+
}
|
|
123
|
+
watch(() => [model.value, normalized.value.length], () => {
|
|
124
|
+
void nextTick(measure);
|
|
125
|
+
});
|
|
126
|
+
let ro = null;
|
|
127
|
+
onMounted(() => {
|
|
128
|
+
measure();
|
|
129
|
+
if (typeof ResizeObserver !== "undefined" && root.value) {
|
|
130
|
+
ro = new ResizeObserver(() => measure());
|
|
131
|
+
ro.observe(root.value);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
onBeforeUnmount(() => ro == null ? void 0 : ro.disconnect());
|
|
135
|
+
function iconOf(opt) {
|
|
136
|
+
if (!opt.icon) return {};
|
|
137
|
+
return opt.icon in LF_ICONS ? { name: opt.icon } : { path: opt.icon };
|
|
138
|
+
}
|
|
139
|
+
return (_ctx, _cache) => {
|
|
140
|
+
return openBlock(), createElementBlock("div", {
|
|
141
|
+
ref_key: "root",
|
|
142
|
+
ref: root,
|
|
143
|
+
class: normalizeClass(["lf-seg", [`lf-seg--${__props.size}`, { "lf-seg--block": __props.block, "lf-seg--thumb": thumb.value }]]),
|
|
144
|
+
role: "radiogroup",
|
|
145
|
+
"aria-label": __props.ariaLabel
|
|
146
|
+
}, [
|
|
147
|
+
thumb.value ? (openBlock(), createElementBlock("span", {
|
|
148
|
+
key: 0,
|
|
149
|
+
class: normalizeClass(["lf-seg__thumb", { "lf-seg__thumb--instant": instant.value }]),
|
|
150
|
+
style: normalizeStyle({ transform: `translateX(${thumb.value.x}px)`, width: `${thumb.value.w}px` }),
|
|
151
|
+
"aria-hidden": "true"
|
|
152
|
+
}, null, 6)) : createCommentVNode("", true),
|
|
153
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(normalized.value, (opt) => {
|
|
154
|
+
return openBlock(), createElementBlock("button", {
|
|
155
|
+
key: String(opt.value),
|
|
156
|
+
type: "button",
|
|
157
|
+
class: normalizeClass(["lf-seg__btn", { "lf-seg__btn--on": opt.value === model.value }]),
|
|
158
|
+
role: "radio",
|
|
159
|
+
"aria-checked": opt.value === model.value ? "true" : "false",
|
|
160
|
+
"aria-label": __props.labelHidden ? opt.label : void 0,
|
|
161
|
+
title: __props.labelHidden ? opt.label : void 0,
|
|
162
|
+
disabled: __props.disabled || opt.disabled,
|
|
163
|
+
onClick: ($event) => model.value = opt.value
|
|
164
|
+
}, [
|
|
165
|
+
opt.icon ? (openBlock(), createBlock(LfIcon, mergeProps({
|
|
166
|
+
key: 0,
|
|
167
|
+
ref_for: true
|
|
168
|
+
}, iconOf(opt), { class: "lf-seg__icon" }), null, 16)) : createCommentVNode("", true),
|
|
169
|
+
!__props.labelHidden ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(opt.label), 1)) : createCommentVNode("", true),
|
|
170
|
+
opt.badge !== void 0 && opt.badge !== "" ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(opt.badge), 1)) : createCommentVNode("", true)
|
|
171
|
+
], 10, _hoisted_2);
|
|
172
|
+
}), 128))
|
|
173
|
+
], 10, _hoisted_1);
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
const LfSegmented = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-10fad8e3"]]);
|
|
178
|
+
export {
|
|
179
|
+
LfAlert as L,
|
|
180
|
+
LfSegmented as a
|
|
181
|
+
};
|
|
182
|
+
//# sourceMappingURL=LfSegmented-D2zAGi24.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LfSegmented-D2zAGi24.js","sources":["../src/components/LfAlert.vue","../src/components/LfSegmented.vue"],"sourcesContent":["<!--\n 안내 한 덩이 — 알림, 경고, 오류, 결과. hub 의 `v-alert`·`AppErrorBanner`,\n macro 의 `Notice` 를 함께 대체한다.\n\n **면 전체를 상태 색으로 채우지 않는다.** 화면에 안내가 하나뿐일 때는 채운 쪽이 눈에\n 잘 띄지만, 카드가 여럿 놓인 화면에서는 그 한 덩이만 다른 재질로 튀어 보인다 —\n 종이 위에 형광색 스티커를 붙인 모양이다. macro 가 v-alert 를 걷어내며 내린 판단이고,\n 플랫폼 표준을 그쪽으로 맞췄다.\n\n 그래서 다른 카드와 **같은 종이**를 쓴다(LfCard·LfStatCard 와 같은 배경·테두리·그림자).\n 상태는 왼쪽 3px 색 띠와 아이콘 배지가 말한다. 색은 여전히 분명하지만 면적이 작아서,\n 안내가 화면의 주인이 되지 않으면서도 지나칠 수 없다.\n\n 토스트(AppToast)와 나누는 기준: **읽고 나면 사라져야 하면 토스트, 상태가 유지되는\n 동안 남아 있어야 하면 알림이다.** \"저장했습니다\"는 토스트, \"점검 중\"은 알림.\n-->\n<template>\n <div\n class=\"lf-alert\"\n :class=\"[`lf-alert--${tone}`, { 'lf-alert--dense': dense }]\"\n :role=\"tone === 'error' ? 'alert' : 'status'\"\n >\n <span class=\"lf-alert__badge\" aria-hidden=\"true\">\n <slot name=\"icon\">\n <LfIcon :name=\"icon ?? TONE_ICON[tone]\" :path=\"iconPath\" :size=\"dense ? '0.9375rem' : '1.0625rem'\" />\n </slot>\n </span>\n\n <div class=\"lf-alert__body\">\n <p v-if=\"title\" class=\"lf-alert__title\">{{ title }}</p>\n <div v-if=\"message || $slots.default\" class=\"lf-alert__text\" :class=\"{ 'lf-alert__text--titled': title }\">\n <slot>{{ message }}</slot>\n </div>\n <!-- 안내에 딸린 조치. \"러너 내려받기\"처럼 다음 걸음이 있는 안내가 실제로 많다. -->\n <div v-if=\"$slots.actions\" class=\"lf-alert__actions\"><slot name=\"actions\" /></div>\n </div>\n\n <LfIconButton\n v-if=\"closable\"\n class=\"lf-alert__close\"\n icon=\"close\"\n size=\"sm\"\n :label=\"closeLabel\"\n @click=\"emit('close')\"\n />\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport LfIcon from './LfIcon.vue'\nimport LfIconButton from './LfIconButton.vue'\nimport type { LfIconName } from '../icons'\n\nwithDefaults(\n defineProps<{\n tone?: 'info' | 'success' | 'warning' | 'error'\n /** 제목은 선택이다. 한 줄짜리 안내에 굵은 제목을 붙이면 그 한 줄이 화면의 주인공이 된다. */\n title?: string\n /** 본문. 기본 슬롯을 쓰면 이 값은 무시된다. */\n message?: string\n /** 톤 기본 아이콘 대신 쓸 아이콘. */\n icon?: LfIconName\n iconPath?: string\n closable?: boolean\n closeLabel?: string\n /** 여백을 줄인다. 모달 안이나 카드 안에 넣을 때. */\n dense?: boolean\n }>(),\n { tone: 'info', closeLabel: '닫기' },\n)\n\nconst emit = defineEmits<{ close: [] }>()\n\nconst TONE_ICON: Record<string, LfIconName> = {\n info: 'info',\n success: 'check_circle',\n warning: 'warning',\n error: 'error',\n}\n</script>\n\n<style scoped>\n.lf-alert {\n display: flex;\n align-items: flex-start;\n gap: 0.625rem;\n padding: 0.75rem 0.875rem;\n border-radius: 0.75rem;\n background: var(--admin-surface, #1b1f27);\n border: 1px solid var(--admin-border, rgba(255, 255, 255, 0.09));\n box-shadow: var(--admin-card-shadow, 0 1px 3px rgba(0, 0, 0, 0.3));\n /* 상태를 말하는 것은 이 3px 과 아이콘 배지뿐이다. */\n border-left: 3px solid rgb(var(--lf-tone));\n font-size: var(--page-body, 0.875rem);\n color: var(--admin-text-body, #e5e7eb);\n}\n.lf-alert--dense {\n padding: 0.5625rem 0.6875rem;\n gap: 0.5rem;\n border-radius: 0.625rem;\n}\n\n/* 상태 색은 변수 하나로 모아 둔다 — 띠와 배지가 어긋나지 않게. */\n.lf-alert--info {\n --lf-tone: var(--admin-status-info-rgb, 96, 165, 250);\n}\n.lf-alert--success {\n --lf-tone: var(--admin-status-success-rgb, 74, 222, 128);\n}\n.lf-alert--warning {\n --lf-tone: var(--admin-status-warning-rgb, 251, 191, 36);\n}\n.lf-alert--error {\n --lf-tone: var(--admin-status-error-rgb, 248, 113, 113);\n}\n\n.lf-alert__badge {\n display: grid;\n place-items: center;\n flex: none;\n width: 1.75rem;\n height: 1.75rem;\n border-radius: 0.5rem;\n background: rgb(var(--lf-tone), 0.12);\n color: rgb(var(--lf-tone));\n}\n.lf-alert--dense .lf-alert__badge {\n width: 1.5rem;\n height: 1.5rem;\n border-radius: 0.4375rem;\n}\n\n.lf-alert__body {\n flex: 1;\n /* 없으면 flex 항목이 안쪽 글자 길이만큼 버텨서 줄바꿈이 일어나지 않는다. */\n min-width: 0;\n /* 배지와 첫 줄의 중심을 맞춘다. */\n padding-top: 0.1875rem;\n}\n.lf-alert--dense .lf-alert__body {\n padding-top: 0.125rem;\n}\n\n.lf-alert__title {\n margin: 0;\n font-size: var(--page-body, 0.875rem);\n font-weight: 600;\n letter-spacing: 0.01em;\n line-height: 1.5;\n color: var(--admin-text-heading, #f9fafb);\n}\n.lf-alert__text {\n font-size: var(--page-body-sm, 0.8125rem);\n line-height: 1.6;\n color: var(--admin-text-muted, #9ca3af);\n /* 안내문은 읽으라고 쓰는 글이다 — 좁은 화면에서 잘리는 것보다 줄이 느는 편이 낫다. */\n overflow-wrap: anywhere;\n}\n.lf-alert__text--titled {\n margin-top: 0.0625rem;\n}\n.lf-alert__actions {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin-top: 0.625rem;\n}\n.lf-alert__close {\n flex: none;\n margin: -0.125rem -0.25rem 0 0;\n opacity: 0.5;\n}\n.lf-alert__close:hover {\n opacity: 0.9;\n}\n</style>\n","<!--\n 세그먼트 컨트롤 — 몇 개 안 되는 보기 중 하나를 고른다(주간/목록, 전체/내 PC/빌린 기기).\n 콘솔의 사용량 그래프가 쓰던 `.uc__seg` 를 그대로 옮겼다: 안쪽으로 파인 홈에 고른 칸만\n 떠오른다. Vuetify 의 `v-btn-toggle` 을 대체한다.\n\n 라디오처럼 **늘 하나는 골라져 있다.** 「아무것도 안 고름」이 필요한 자리는 필터가 아니라\n 체크박스다.\n\n <LfSegmented v-model=\"view\" :options=\"[{ value: 'week', label: '주간', icon: mdiCalendarWeek }, …]\" />\n\n 아이콘만 두고 싶으면 `label-hidden` — 라벨은 접근성 이름과 툴팁으로 남는다.\n-->\n<template>\n <div ref=\"root\" class=\"lf-seg\" :class=\"[`lf-seg--${size}`, { 'lf-seg--block': block, 'lf-seg--thumb': thumb }]\" role=\"radiogroup\" :aria-label=\"ariaLabel\">\n <!-- 고른 칸 표시 — 칸마다 배경을 켜고 끄지 않고 하나가 미끄러져 간다(0.16.0). 재기 전(첫 그림)에는 칸 배경으로 보인다. -->\n <span v-if=\"thumb\" class=\"lf-seg__thumb\" :class=\"{ 'lf-seg__thumb--instant': instant }\" :style=\"{ transform: `translateX(${thumb.x}px)`, width: `${thumb.w}px` }\" aria-hidden=\"true\" />\n <button\n v-for=\"opt in normalized\"\n :key=\"String(opt.value)\"\n type=\"button\"\n class=\"lf-seg__btn\"\n :class=\"{ 'lf-seg__btn--on': opt.value === model }\"\n role=\"radio\"\n :aria-checked=\"opt.value === model ? 'true' : 'false'\"\n :aria-label=\"labelHidden ? opt.label : undefined\"\n :title=\"labelHidden ? opt.label : undefined\"\n :disabled=\"disabled || opt.disabled\"\n @click=\"model = opt.value as T\"\n >\n <LfIcon v-if=\"opt.icon\" v-bind=\"iconOf(opt)\" class=\"lf-seg__icon\" />\n <span v-if=\"!labelHidden\" class=\"lf-seg__label\">{{ opt.label }}</span>\n <span v-if=\"opt.badge !== undefined && opt.badge !== ''\" class=\"lf-seg__badge\">{{ opt.badge }}</span>\n </button>\n </div>\n</template>\n\n<script setup lang=\"ts\" generic=\"T extends string | number | null = string\">\nimport { computed, nextTick, onBeforeUnmount, onMounted, ref, useTemplateRef, watch } from 'vue'\nimport LfIcon from './LfIcon.vue'\nimport { LF_ICONS, type LfIconName } from '../icons'\nimport type { LfOption } from '../types'\n\nconst props = withDefaults(\n defineProps<{\n options?: (LfOption | string)[]\n size?: 'sm' | 'md'\n /** 아이콘만 보인다. 라벨은 aria-label·title 로 남는다. */\n labelHidden?: boolean\n /** 부모 폭을 채우고 칸을 같은 폭으로 나눈다. */\n block?: boolean\n disabled?: boolean\n /** 묶음의 접근성 이름. 「보기 방식」처럼 무엇을 고르는 자리인지. */\n ariaLabel?: string\n }>(),\n { options: () => [], size: 'md' },\n)\n\n// 제네릭이라 'week' | 'list' 같은 좁은 타입의 ref 에 v-model 을 바로 걸 수 있다.\nconst model = defineModel<T>({ required: true })\n\nconst normalized = computed<LfOption[]>(() =>\n props.options.map((o) => (typeof o === 'string' ? { value: o, label: o } : o)),\n)\n\n/* 고른 칸의 자리와 폭 — 고를 때·칸 크기가 바뀔 때(글자 폭·창 크기) 다시 잰다. */\nconst root = useTemplateRef<HTMLElement>('root')\nconst thumb = ref<{ x: number; w: number } | null>(null)\n/* 미끄러지는 것은 고른 칸이 바뀔 때만 — 같은 칸인데 폭만 바뀐 것(창 크기·글자 늦게 옴)은 바로 옮긴다(옆 메뉴와 같은 규칙, 0.16.4). */\nconst instant = ref(true)\nlet lastEl: HTMLElement | null = null\nfunction measure() {\n const el = root.value?.querySelector<HTMLElement>('.lf-seg__btn--on') ?? null\n const next = el && el.offsetWidth ? { x: el.offsetLeft, w: el.offsetWidth } : null\n const cur = thumb.value\n if (cur && next && cur.x === next.x && cur.w === next.w) return\n instant.value = !lastEl || el === lastEl || !cur\n if (next) lastEl = el\n thumb.value = next\n}\nwatch(() => [model.value, normalized.value.length], () => { void nextTick(measure) })\nlet ro: ResizeObserver | null = null\nonMounted(() => {\n measure()\n if (typeof ResizeObserver !== 'undefined' && root.value) { ro = new ResizeObserver(() => measure()); ro.observe(root.value) }\n})\nonBeforeUnmount(() => ro?.disconnect())\n\n/** LfOption.icon 은 레지스트리 이름일 수도, 직접 넘긴 path 데이터일 수도 있다. */\nfunction iconOf(opt: LfOption) {\n if (!opt.icon) return {}\n return opt.icon in LF_ICONS ? { name: opt.icon as LfIconName } : { path: opt.icon }\n}\n</script>\n\n<style scoped>\n.lf-seg {\n position: relative;\n display: inline-flex;\n padding: 0.15rem;\n gap: 0.125rem;\n background: var(--admin-input-bg, rgba(0, 0, 0, 0.3));\n border: 1px solid var(--admin-border, rgba(255, 255, 255, 0.1));\n border-radius: 0.625rem;\n vertical-align: middle;\n}\n.lf-seg--block {\n display: flex;\n width: 100%;\n}\n.lf-seg--block .lf-seg__btn {\n flex: 1;\n justify-content: center;\n}\n.lf-seg__btn {\n display: inline-flex;\n align-items: center;\n gap: 0.375rem;\n padding: 0 0.75rem;\n height: 1.75rem;\n font: inherit;\n font-size: var(--page-body, 0.875rem);\n font-weight: 500;\n white-space: nowrap;\n color: var(--admin-text-muted, #9ca3af);\n background: transparent;\n border: 0;\n border-radius: 0.475rem;\n cursor: pointer;\n transition: background var(--lf-dur-fast, 0.15s), color var(--lf-dur-fast, 0.15s);\n position: relative;\n z-index: 1;\n}\n.lf-seg__thumb {\n position: absolute;\n top: 0.15rem;\n bottom: 0.15rem;\n left: 0;\n border-radius: 0.475rem;\n background: var(--admin-surface, rgba(255, 255, 255, 0.08));\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 2px 6px -2px rgba(0, 0, 0, 0.12);\n transition: transform var(--lf-dur, 0.22s) var(--lf-ease, ease), width var(--lf-dur, 0.22s) var(--lf-ease, ease);\n}\n.lf-seg__thumb--instant {\n transition: none !important;\n}\n.lf-seg--sm .lf-seg__thumb {\n border-radius: 0.375rem;\n}\n/* 표시가 미끄러져 다니면 칸 자체의 배경은 끈다(두 겹이 된다). */\n.lf-seg--thumb .lf-seg__btn--on {\n background: transparent;\n box-shadow: none;\n}\n.lf-seg--sm .lf-seg__btn {\n height: 1.25rem;\n padding: 0 0.5rem;\n font-size: var(--page-body-sm, 0.75rem);\n border-radius: 0.375rem;\n}\n.lf-seg__btn:hover:not(:disabled):not(.lf-seg__btn--on) {\n color: var(--admin-text-body, #d1d5db);\n}\n.lf-seg__btn--on {\n color: var(--admin-text-heading, #fff);\n font-weight: 600;\n background: var(--admin-surface, rgba(255, 255, 255, 0.08));\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);\n}\n.lf-seg__btn:focus-visible {\n outline: 2px solid var(--admin-accent, #34d399);\n outline-offset: 1px;\n}\n.lf-seg__btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n.lf-seg__icon {\n font-size: 1.125em;\n}\n.lf-seg__badge {\n font-size: 0.85em;\n font-variant-numeric: tabular-nums;\n color: var(--admin-text-muted, #9ca3af);\n}\n</style>\n"],"names":["_createElementBlock","_normalizeClass","_createElementVNode","_hoisted_2","_renderSlot","_createVNode","_hoisted_3","_hoisted_4","_toDisplayString","$slots","_openBlock","_createBlock","_useModel","_Fragment","_renderList","_mergeProps"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, toDisplayString, createCommentVNode, createElementVNode, createBlock, resolveDynamicComponent, normalizeClass, withCtx, createTextVNode, renderSlot, useAttrs, useModel, useId, mergeProps, unref, withDirectives, isRef,
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, toDisplayString, createCommentVNode, createElementVNode, createBlock, resolveDynamicComponent, normalizeClass, withCtx, createTextVNode, renderSlot, useAttrs, useModel, useId, ref, mergeProps, unref, createVNode, withDirectives, isRef, vModelDynamic, mergeModels, Fragment, renderList, vModelSelect } from "vue";
|
|
2
2
|
const LF_ICONS = {
|
|
3
3
|
close: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",
|
|
4
4
|
search: "M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19 15.5 14zm-6 0A4.5 4.5 0 1 1 14 9.5 4.5 4.5 0 0 1 9.5 14z",
|
|
@@ -384,11 +384,131 @@ function useSplitAttrs() {
|
|
|
384
384
|
return { rootAttrs, controlAttrs };
|
|
385
385
|
}
|
|
386
386
|
const _hoisted_1$1 = { class: "lf-control-wrap" };
|
|
387
|
-
const _hoisted_2$1 =
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
387
|
+
const _hoisted_2$1 = {
|
|
388
|
+
key: 0,
|
|
389
|
+
class: "lf-control-wrap__icon lf-control-wrap__icon--left"
|
|
390
|
+
};
|
|
391
|
+
const _hoisted_3$1 = ["id", "type", "placeholder", "disabled", "readonly", "required", "aria-invalid"];
|
|
392
|
+
const _hoisted_4$1 = {
|
|
393
|
+
key: 1,
|
|
394
|
+
class: "lf-control-wrap__suffix"
|
|
395
|
+
};
|
|
396
|
+
const _hoisted_5$1 = ["aria-label"];
|
|
391
397
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
398
|
+
...{ inheritAttrs: false },
|
|
399
|
+
__name: "LfTextField",
|
|
400
|
+
props: /* @__PURE__ */ mergeModels({
|
|
401
|
+
label: {},
|
|
402
|
+
hint: {},
|
|
403
|
+
error: {},
|
|
404
|
+
required: { type: Boolean },
|
|
405
|
+
placeholder: {},
|
|
406
|
+
disabled: { type: Boolean },
|
|
407
|
+
readonly: { type: Boolean },
|
|
408
|
+
type: { default: "text" },
|
|
409
|
+
size: { default: "md" },
|
|
410
|
+
icon: {},
|
|
411
|
+
iconPath: {},
|
|
412
|
+
clearable: { type: Boolean },
|
|
413
|
+
revealable: { type: Boolean },
|
|
414
|
+
suffix: {}
|
|
415
|
+
}, {
|
|
416
|
+
"modelValue": {
|
|
417
|
+
default: ""
|
|
418
|
+
},
|
|
419
|
+
"modelModifiers": {}
|
|
420
|
+
}),
|
|
421
|
+
emits: ["update:modelValue"],
|
|
422
|
+
setup(__props) {
|
|
423
|
+
const props = __props;
|
|
424
|
+
const [model, modifiers] = useModel(__props, "modelValue", {
|
|
425
|
+
set(value) {
|
|
426
|
+
if (!modifiers.number || value === "" || typeof value === "number") return value;
|
|
427
|
+
const n = parseFloat(String(value));
|
|
428
|
+
return Number.isNaN(n) ? value : n;
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
const { rootAttrs, controlAttrs } = useSplitAttrs();
|
|
432
|
+
const inputId = useId();
|
|
433
|
+
const revealed = ref(false);
|
|
434
|
+
const hasTrailing = computed(
|
|
435
|
+
() => props.revealable || props.clearable && !!model.value && !props.disabled && !props.readonly
|
|
436
|
+
);
|
|
437
|
+
function clear() {
|
|
438
|
+
model.value = typeof model.value === "number" ? 0 : "";
|
|
439
|
+
}
|
|
440
|
+
return (_ctx, _cache) => {
|
|
441
|
+
return openBlock(), createBlock(LfField, mergeProps(unref(rootAttrs), {
|
|
442
|
+
label: __props.label,
|
|
443
|
+
hint: __props.hint,
|
|
444
|
+
error: __props.error,
|
|
445
|
+
required: __props.required,
|
|
446
|
+
"html-for": unref(inputId)
|
|
447
|
+
}), {
|
|
448
|
+
default: withCtx(() => [
|
|
449
|
+
createElementVNode("div", _hoisted_1$1, [
|
|
450
|
+
__props.icon || __props.iconPath ? (openBlock(), createElementBlock("span", _hoisted_2$1, [
|
|
451
|
+
createVNode(LfIcon, {
|
|
452
|
+
name: __props.icon,
|
|
453
|
+
path: __props.iconPath,
|
|
454
|
+
size: "1.125rem"
|
|
455
|
+
}, null, 8, ["name", "path"])
|
|
456
|
+
])) : createCommentVNode("", true),
|
|
457
|
+
withDirectives(createElementVNode("input", mergeProps({ id: unref(inputId) }, unref(controlAttrs), {
|
|
458
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
|
|
459
|
+
class: ["lf-control", [
|
|
460
|
+
{ "lf-control--sm": __props.size === "sm", "lf-control--error": !!__props.error },
|
|
461
|
+
(__props.icon || __props.iconPath) && "lf-control--has-left",
|
|
462
|
+
hasTrailing.value && "lf-control--has-right",
|
|
463
|
+
__props.suffix && "lf-control--has-suffix"
|
|
464
|
+
]],
|
|
465
|
+
type: revealed.value ? "text" : __props.type,
|
|
466
|
+
placeholder: __props.placeholder,
|
|
467
|
+
disabled: __props.disabled,
|
|
468
|
+
readonly: __props.readonly,
|
|
469
|
+
required: __props.required,
|
|
470
|
+
"aria-invalid": __props.error ? "true" : void 0
|
|
471
|
+
}), null, 16, _hoisted_3$1), [
|
|
472
|
+
[vModelDynamic, unref(model)]
|
|
473
|
+
]),
|
|
474
|
+
__props.suffix ? (openBlock(), createElementBlock("span", _hoisted_4$1, toDisplayString(__props.suffix), 1)) : createCommentVNode("", true),
|
|
475
|
+
__props.revealable ? (openBlock(), createElementBlock("button", {
|
|
476
|
+
key: 2,
|
|
477
|
+
type: "button",
|
|
478
|
+
class: "lf-control-action",
|
|
479
|
+
"aria-label": revealed.value ? "비밀번호 가리기" : "비밀번호 보기",
|
|
480
|
+
onClick: _cache[1] || (_cache[1] = ($event) => revealed.value = !revealed.value)
|
|
481
|
+
}, [
|
|
482
|
+
createVNode(LfIcon, {
|
|
483
|
+
name: revealed.value ? "visibility_off" : "visibility",
|
|
484
|
+
size: "1.125rem"
|
|
485
|
+
}, null, 8, ["name"])
|
|
486
|
+
], 8, _hoisted_5$1)) : __props.clearable && !!unref(model) && !__props.disabled && !__props.readonly ? (openBlock(), createElementBlock("button", {
|
|
487
|
+
key: 3,
|
|
488
|
+
type: "button",
|
|
489
|
+
class: "lf-control-action",
|
|
490
|
+
"aria-label": "지우기",
|
|
491
|
+
onClick: clear
|
|
492
|
+
}, [
|
|
493
|
+
createVNode(LfIcon, {
|
|
494
|
+
name: "close",
|
|
495
|
+
size: "1.125rem"
|
|
496
|
+
})
|
|
497
|
+
])) : createCommentVNode("", true)
|
|
498
|
+
])
|
|
499
|
+
]),
|
|
500
|
+
_: 1
|
|
501
|
+
}, 16, ["label", "hint", "error", "required", "html-for"]);
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
const LfTextField = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-e113043f"]]);
|
|
506
|
+
const _hoisted_1 = { class: "lf-control-wrap" };
|
|
507
|
+
const _hoisted_2 = ["id", "disabled", "required", "aria-invalid"];
|
|
508
|
+
const _hoisted_3 = ["disabled"];
|
|
509
|
+
const _hoisted_4 = ["value", "disabled"];
|
|
510
|
+
const _hoisted_5 = { class: "lf-control-wrap__icon lf-control-wrap__icon--right" };
|
|
511
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
392
512
|
...{ inheritAttrs: false },
|
|
393
513
|
__name: "LfSelect",
|
|
394
514
|
props: /* @__PURE__ */ mergeModels({
|
|
@@ -431,7 +551,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
431
551
|
"html-for": unref(inputId)
|
|
432
552
|
}), {
|
|
433
553
|
default: withCtx(() => [
|
|
434
|
-
createElementVNode("div", _hoisted_1
|
|
554
|
+
createElementVNode("div", _hoisted_1, [
|
|
435
555
|
withDirectives(createElementVNode("select", mergeProps({ id: unref(inputId) }, unref(controlAttrs), {
|
|
436
556
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
|
|
437
557
|
class: ["lf-control lf-select lf-control--has-right", { "lf-control--sm": __props.size === "sm", "lf-control--error": !!__props.error }],
|
|
@@ -443,15 +563,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
443
563
|
key: 0,
|
|
444
564
|
value: "",
|
|
445
565
|
disabled: !__props.clearable
|
|
446
|
-
}, toDisplayString(__props.placeholder), 9, _hoisted_3
|
|
566
|
+
}, toDisplayString(__props.placeholder), 9, _hoisted_3)) : createCommentVNode("", true),
|
|
447
567
|
(openBlock(true), createElementBlock(Fragment, null, renderList(normalized.value, (opt) => {
|
|
448
568
|
return openBlock(), createElementBlock("option", {
|
|
449
569
|
key: String(opt.value),
|
|
450
570
|
value: opt.value,
|
|
451
571
|
disabled: opt.disabled
|
|
452
|
-
}, toDisplayString(opt.label), 9, _hoisted_4
|
|
572
|
+
}, toDisplayString(opt.label), 9, _hoisted_4);
|
|
453
573
|
}), 128))
|
|
454
|
-
], 16, _hoisted_2
|
|
574
|
+
], 16, _hoisted_2), [
|
|
455
575
|
[vModelSelect, unref(model)]
|
|
456
576
|
]),
|
|
457
577
|
createElementVNode("span", _hoisted_5, [
|
|
@@ -467,115 +587,16 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
467
587
|
};
|
|
468
588
|
}
|
|
469
589
|
});
|
|
470
|
-
const LfSelect = /* @__PURE__ */ _export_sfc(_sfc_main
|
|
471
|
-
const _hoisted_1 = ["aria-label"];
|
|
472
|
-
const _hoisted_2 = ["aria-checked", "aria-label", "title", "disabled", "onClick"];
|
|
473
|
-
const _hoisted_3 = {
|
|
474
|
-
key: 1,
|
|
475
|
-
class: "lf-seg__label"
|
|
476
|
-
};
|
|
477
|
-
const _hoisted_4 = {
|
|
478
|
-
key: 2,
|
|
479
|
-
class: "lf-seg__badge"
|
|
480
|
-
};
|
|
481
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
482
|
-
__name: "LfSegmented",
|
|
483
|
-
props: /* @__PURE__ */ mergeModels({
|
|
484
|
-
options: { default: () => [] },
|
|
485
|
-
size: { default: "md" },
|
|
486
|
-
labelHidden: { type: Boolean },
|
|
487
|
-
block: { type: Boolean },
|
|
488
|
-
disabled: { type: Boolean },
|
|
489
|
-
ariaLabel: {}
|
|
490
|
-
}, {
|
|
491
|
-
"modelValue": { required: true },
|
|
492
|
-
"modelModifiers": {}
|
|
493
|
-
}),
|
|
494
|
-
emits: ["update:modelValue"],
|
|
495
|
-
setup(__props) {
|
|
496
|
-
const props = __props;
|
|
497
|
-
const model = useModel(__props, "modelValue");
|
|
498
|
-
const normalized = computed(
|
|
499
|
-
() => props.options.map((o) => typeof o === "string" ? { value: o, label: o } : o)
|
|
500
|
-
);
|
|
501
|
-
const root = useTemplateRef("root");
|
|
502
|
-
const thumb = ref(null);
|
|
503
|
-
const instant = ref(true);
|
|
504
|
-
let lastEl = null;
|
|
505
|
-
function measure() {
|
|
506
|
-
var _a;
|
|
507
|
-
const el = ((_a = root.value) == null ? void 0 : _a.querySelector(".lf-seg__btn--on")) ?? null;
|
|
508
|
-
const next = el && el.offsetWidth ? { x: el.offsetLeft, w: el.offsetWidth } : null;
|
|
509
|
-
const cur = thumb.value;
|
|
510
|
-
if (cur && next && cur.x === next.x && cur.w === next.w) return;
|
|
511
|
-
instant.value = !lastEl || el === lastEl || !cur;
|
|
512
|
-
if (next) lastEl = el;
|
|
513
|
-
thumb.value = next;
|
|
514
|
-
}
|
|
515
|
-
watch(() => [model.value, normalized.value.length], () => {
|
|
516
|
-
void nextTick(measure);
|
|
517
|
-
});
|
|
518
|
-
let ro = null;
|
|
519
|
-
onMounted(() => {
|
|
520
|
-
measure();
|
|
521
|
-
if (typeof ResizeObserver !== "undefined" && root.value) {
|
|
522
|
-
ro = new ResizeObserver(() => measure());
|
|
523
|
-
ro.observe(root.value);
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
onBeforeUnmount(() => ro == null ? void 0 : ro.disconnect());
|
|
527
|
-
function iconOf(opt) {
|
|
528
|
-
if (!opt.icon) return {};
|
|
529
|
-
return opt.icon in LF_ICONS ? { name: opt.icon } : { path: opt.icon };
|
|
530
|
-
}
|
|
531
|
-
return (_ctx, _cache) => {
|
|
532
|
-
return openBlock(), createElementBlock("div", {
|
|
533
|
-
ref_key: "root",
|
|
534
|
-
ref: root,
|
|
535
|
-
class: normalizeClass(["lf-seg", [`lf-seg--${__props.size}`, { "lf-seg--block": __props.block, "lf-seg--thumb": thumb.value }]]),
|
|
536
|
-
role: "radiogroup",
|
|
537
|
-
"aria-label": __props.ariaLabel
|
|
538
|
-
}, [
|
|
539
|
-
thumb.value ? (openBlock(), createElementBlock("span", {
|
|
540
|
-
key: 0,
|
|
541
|
-
class: normalizeClass(["lf-seg__thumb", { "lf-seg__thumb--instant": instant.value }]),
|
|
542
|
-
style: normalizeStyle({ transform: `translateX(${thumb.value.x}px)`, width: `${thumb.value.w}px` }),
|
|
543
|
-
"aria-hidden": "true"
|
|
544
|
-
}, null, 6)) : createCommentVNode("", true),
|
|
545
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(normalized.value, (opt) => {
|
|
546
|
-
return openBlock(), createElementBlock("button", {
|
|
547
|
-
key: String(opt.value),
|
|
548
|
-
type: "button",
|
|
549
|
-
class: normalizeClass(["lf-seg__btn", { "lf-seg__btn--on": opt.value === model.value }]),
|
|
550
|
-
role: "radio",
|
|
551
|
-
"aria-checked": opt.value === model.value ? "true" : "false",
|
|
552
|
-
"aria-label": __props.labelHidden ? opt.label : void 0,
|
|
553
|
-
title: __props.labelHidden ? opt.label : void 0,
|
|
554
|
-
disabled: __props.disabled || opt.disabled,
|
|
555
|
-
onClick: ($event) => model.value = opt.value
|
|
556
|
-
}, [
|
|
557
|
-
opt.icon ? (openBlock(), createBlock(LfIcon, mergeProps({
|
|
558
|
-
key: 0,
|
|
559
|
-
ref_for: true
|
|
560
|
-
}, iconOf(opt), { class: "lf-seg__icon" }), null, 16)) : createCommentVNode("", true),
|
|
561
|
-
!__props.labelHidden ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(opt.label), 1)) : createCommentVNode("", true),
|
|
562
|
-
opt.badge !== void 0 && opt.badge !== "" ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(opt.badge), 1)) : createCommentVNode("", true)
|
|
563
|
-
], 10, _hoisted_2);
|
|
564
|
-
}), 128))
|
|
565
|
-
], 10, _hoisted_1);
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
});
|
|
569
|
-
const LfSegmented = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-10fad8e3"]]);
|
|
590
|
+
const LfSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-01fa2b3e"]]);
|
|
570
591
|
export {
|
|
571
592
|
LfIcon as L,
|
|
572
593
|
_export_sfc as _,
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
594
|
+
LfField as a,
|
|
595
|
+
LfIconButton as b,
|
|
596
|
+
LF_ICONS as c,
|
|
597
|
+
LfSpinner as d,
|
|
598
|
+
LfSelect as e,
|
|
599
|
+
LfTextField as f,
|
|
579
600
|
useSplitAttrs as u
|
|
580
601
|
};
|
|
581
|
-
//# sourceMappingURL=
|
|
602
|
+
//# sourceMappingURL=LfSelect-BrK4QbUk.js.map
|