@leavepulse/ui 0.78.1 → 0.78.3
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/chunks/{DropzoneLinkField-CLLhd3WB.js → DropzoneLinkField-CyE7TJ5f.js} +1 -1
- package/dist/chunks/LpAddressInput-ft8fQOGx.js +401 -0
- package/dist/chunks/{LpAppShell-BKbYCHkx.js → LpAppShell-DRHoQtr-.js} +34 -17
- package/dist/chunks/LpAutocomplete-CrZbd0uv.js +310 -0
- package/dist/chunks/LpCheckbox-CCWCwD0y.js +129 -0
- package/dist/chunks/{LpCodeDisplay-D3BUAhV1.js → LpCodeDisplay-D59uPwRb.js} +1 -1
- package/dist/chunks/LpColorPicker-BONURBFN.js +574 -0
- package/dist/chunks/LpDatePicker-C2AOtxgF.js +171 -0
- package/dist/chunks/{LpDateRangePicker-CNQXdTVv.js → LpDateRangePicker-CiXdIAyh.js} +43 -35
- package/dist/chunks/{LpFileTree-C-rJKzEQ.js → LpFileTree-CpNurwZp.js} +2 -2
- package/dist/chunks/{LpFileTreeNode-BgYn4U1J.js → LpFileTreeNode-DdF8Cq-s.js} +1 -1
- package/dist/chunks/{LpInput-D0O6dpuA.js → LpInput-CbI7z5fQ.js} +3 -4
- package/dist/chunks/{LpLogInspector-BdQlX6S-.js → LpLogInspector-CcSJSGan.js} +1 -1
- package/dist/chunks/{LpLogViewer-umCZBapN.js → LpLogViewer-CWu49Dko.js} +2 -2
- package/dist/chunks/{LpModalNav-gOi1Giz1.js → LpModalNav-DI3BW5ff.js} +1 -1
- package/dist/chunks/LpNumberField-C8LfUz_R.js +154 -0
- package/dist/chunks/LpOtpInput-B1X9l9no.js +140 -0
- package/dist/chunks/{LpPaletteTheme-BIXpZLGe.js → LpPaletteTheme-B-xuZiKK.js} +2 -2
- package/dist/chunks/{LpPasswordInput-D4HPhqfV.js → LpPasswordInput-Duc_3wPv.js} +1 -1
- package/dist/chunks/{LpPhoneInput-BSL7NX4z.js → LpPhoneInput-CctcRK9K.js} +124 -118
- package/dist/chunks/LpRadioGroup-DTM0nd9G.js +103 -0
- package/dist/chunks/LpRangeSlider-DJsEZXad.js +97 -0
- package/dist/chunks/LpRepeater-Czib3rmv.js +193 -0
- package/dist/chunks/{LpSecretField-B2roc4Iz.js → LpSecretField-BtlCk3IH.js} +1 -1
- package/dist/chunks/LpSegmented-sskrJKJJ.js +128 -0
- package/dist/chunks/LpSelect-JFZehOkd.js +515 -0
- package/dist/chunks/{LpSidebar-DDNJzb69.js → LpSidebar-CvRvVBTt.js} +1 -1
- package/dist/chunks/LpSlider-C4ilCtZX.js +76 -0
- package/dist/chunks/LpSwitch-DyAYTchz.js +122 -0
- package/dist/chunks/{LpTableFilter-B_XMOeAh.js → LpTableFilter-CJg5eIcV.js} +2 -2
- package/dist/chunks/{LpTagsInput-Dt0mteSj.js → LpTagsInput-CkNxpNYa.js} +4 -3
- package/dist/chunks/{LpTextarea-Co0b9PVx.js → LpTextarea-CFK_5QB8.js} +3 -2
- package/dist/chunks/{LpThemeStudio-ChU0_Ga8.js → LpThemeStudio-R-wohbCY.js} +2 -2
- package/dist/chunks/{LpThemeSwitcher-DmCZ21P_.js → LpThemeSwitcher-Bzy15MCP.js} +1 -1
- package/dist/chunks/LpTimeField-B5n0m8m0.js +115 -0
- package/dist/chunks/{LpTopologyCanvas-jqz1KCq2.js → LpTopologyCanvas-BNgw9RyZ.js} +2 -2
- package/dist/chunks/{LpWorkspaceSwitcher-BeNHCLd5.js → LpWorkspaceSwitcher-ugv-fyig.js} +1 -1
- package/dist/components/DropzoneLinkField.vue.js +1 -1
- package/dist/components/LpAddressInput.vue.d.ts +4 -0
- package/dist/components/LpAddressInput.vue.js +1 -1
- package/dist/components/LpAlert.vue.d.ts +3 -3
- package/dist/components/LpAppShell.vue.d.ts +19 -1
- package/dist/components/LpAppShell.vue.js +1 -1
- package/dist/components/LpAutocomplete.vue.d.ts +4 -0
- package/dist/components/LpAutocomplete.vue.js +1 -1
- package/dist/components/LpBadge.vue.d.ts +2 -2
- package/dist/components/LpChart.vue.d.ts +1 -1
- package/dist/components/LpCheckbox.vue.d.ts +4 -0
- package/dist/components/LpCheckbox.vue.js +1 -1
- package/dist/components/LpCodeDisplay.vue.js +1 -1
- package/dist/components/LpCollapse.vue.d.ts +1 -1
- package/dist/components/LpColorPicker.vue.d.ts +5 -3
- package/dist/components/LpColorPicker.vue.js +1 -1
- package/dist/components/LpDatePicker.vue.js +1 -1
- package/dist/components/LpDateRangePicker.vue.js +1 -1
- package/dist/components/LpDropzone.vue.js +1 -1
- package/dist/components/LpFileTree.vue.js +1 -1
- package/dist/components/LpFileTreeNode.vue.js +1 -1
- package/dist/components/LpImageEditor.vue.d.ts +1 -1
- package/dist/components/LpInput.vue.js +1 -1
- package/dist/components/LpLogInspector.vue.js +1 -1
- package/dist/components/LpLogViewer.vue.js +1 -1
- package/dist/components/LpModalNav.vue.js +1 -1
- package/dist/components/LpNumberField.vue.d.ts +4 -0
- package/dist/components/LpNumberField.vue.js +1 -1
- package/dist/components/LpOtpInput.vue.d.ts +4 -0
- package/dist/components/LpOtpInput.vue.js +1 -1
- package/dist/components/LpPaletteTheme.vue.js +1 -1
- package/dist/components/LpPasswordInput.vue.js +1 -1
- package/dist/components/LpPhoneInput.vue.d.ts +4 -0
- package/dist/components/LpPhoneInput.vue.js +1 -1
- package/dist/components/LpRadioGroup.vue.d.ts +4 -0
- package/dist/components/LpRadioGroup.vue.js +1 -1
- package/dist/components/LpRangeSlider.vue.d.ts +4 -0
- package/dist/components/LpRangeSlider.vue.js +1 -1
- package/dist/components/LpRepeater.vue.d.ts +2 -0
- package/dist/components/LpRepeater.vue.js +1 -1
- package/dist/components/LpScrollArea.vue.d.ts +1 -1
- package/dist/components/LpSecretField.vue.js +1 -1
- package/dist/components/LpSegmented.vue.d.ts +4 -0
- package/dist/components/LpSegmented.vue.js +1 -1
- package/dist/components/LpSelect.vue.d.ts +2 -0
- package/dist/components/LpSelect.vue.js +1 -1
- package/dist/components/LpShinyText.vue.d.ts +1 -1
- package/dist/components/LpSidebar.vue.d.ts +1 -1
- package/dist/components/LpSidebar.vue.js +1 -1
- package/dist/components/LpSlider.vue.d.ts +4 -0
- package/dist/components/LpSlider.vue.js +1 -1
- package/dist/components/LpSwitch.vue.d.ts +4 -0
- package/dist/components/LpSwitch.vue.js +1 -1
- package/dist/components/LpTable.vue.js +2 -2
- package/dist/components/LpTableFilter.vue.js +1 -1
- package/dist/components/LpTabs.vue.d.ts +1 -1
- package/dist/components/LpTagsInput.vue.js +1 -1
- package/dist/components/LpTextarea.vue.js +1 -1
- package/dist/components/LpThemeStudio.vue.js +1 -1
- package/dist/components/LpThemeSwitcher.vue.js +1 -1
- package/dist/components/LpTimeField.vue.d.ts +4 -0
- package/dist/components/LpTimeField.vue.js +1 -1
- package/dist/components/LpTopologyCanvas.vue.js +1 -1
- package/dist/components/LpWorkspaceSwitcher.vue.js +1 -1
- package/dist/components/calendar.d.ts +2 -0
- package/dist/composables/useField.d.ts +50 -0
- package/dist/composables/useField.js +31 -2
- package/dist/composables/useMergedClass.d.ts +6 -2
- package/dist/composables/useMergedClass.js +6 -6
- package/dist/index.js +34 -34
- package/package.json +1 -1
- package/src/components/LpAddressInput.vue +8 -4
- package/src/components/LpAppShell.vue +56 -18
- package/src/components/LpAutocomplete.vue +11 -5
- package/src/components/LpCheckbox.vue +8 -6
- package/src/components/LpColorPicker.vue +7 -4
- package/src/components/LpDatePicker.vue +8 -4
- package/src/components/LpDateRangePicker.vue +8 -4
- package/src/components/LpInput.vue +3 -4
- package/src/components/LpNumberField.vue +11 -6
- package/src/components/LpOtpInput.vue +8 -6
- package/src/components/LpPhoneInput.vue +11 -6
- package/src/components/LpRadioGroup.vue +9 -5
- package/src/components/LpRangeSlider.vue +8 -4
- package/src/components/LpRepeater.vue +16 -4
- package/src/components/LpSegmented.vue +8 -4
- package/src/components/LpSelect.vue +8 -7
- package/src/components/LpSlider.vue +8 -4
- package/src/components/LpSwitch.vue +8 -5
- package/src/components/LpTagsInput.vue +4 -3
- package/src/components/LpTextarea.vue +3 -2
- package/src/components/LpTimeField.vue +8 -6
- package/src/components/calendar.ts +2 -0
- package/src/composables/useField.ts +52 -0
- package/src/composables/useMergedClass.ts +11 -5
- package/dist/chunks/LpAddressInput-BSS49jpm.js +0 -393
- package/dist/chunks/LpAutocomplete-DkY6CSyD.js +0 -302
- package/dist/chunks/LpCheckbox-D6RuDW4X.js +0 -124
- package/dist/chunks/LpColorPicker-COHzV68R.js +0 -567
- package/dist/chunks/LpDatePicker-DwSDY0mt.js +0 -163
- package/dist/chunks/LpNumberField-Csg-1Zh_.js +0 -148
- package/dist/chunks/LpOtpInput-BRpLBbOD.js +0 -132
- package/dist/chunks/LpRadioGroup-BrazjLY_.js +0 -95
- package/dist/chunks/LpRangeSlider-fz61tzc-.js +0 -89
- package/dist/chunks/LpRepeater-BkJHSPI1.js +0 -180
- package/dist/chunks/LpSegmented-DbEJhbv-.js +0 -123
- package/dist/chunks/LpSelect-Y-iuSymW.js +0 -512
- package/dist/chunks/LpSlider-A4ixovgS.js +0 -68
- package/dist/chunks/LpSwitch-DnC2-0aV.js +0 -115
- package/dist/chunks/LpTimeField-DeOcKWJq.js +0 -110
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, useAttrs, openBlock, createBlock, normalizeProps, guardReactiveProps, unref, withCtx, createVNode, mergeProps, createElementVNode, createElementBlock, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
+
import { _ as _sfc_main$1 } from "./FieldWrapper-DnuMTrqW.js";
|
|
3
|
+
import { useOwnField } from "../composables/useField.js";
|
|
4
|
+
import { useLocale } from "../composables/useLocale.js";
|
|
5
|
+
import { useLabels } from "../composables/useLpConfig.js";
|
|
6
|
+
import { defaultDatePresets, dayAllowed } from "../components/dateRange.js";
|
|
7
|
+
import { _ as _sfc_main$3 } from "./LpCalendar-D4-LVjfF.js";
|
|
8
|
+
import { _ as _sfc_main$4 } from "./LpIcon-C6JpQ5td.js";
|
|
9
|
+
import { _ as _sfc_main$2 } from "./PickerField-BM1dyafh.js";
|
|
10
|
+
import { _ as _sfc_main$5 } from "./LpTimeField-B5n0m8m0.js";
|
|
11
|
+
const _hoisted_1 = { class: "flex flex-col" };
|
|
12
|
+
const _hoisted_2 = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "flex items-center gap-2 border-t border-line px-3 py-2"
|
|
15
|
+
};
|
|
16
|
+
const __default__ = { inheritAttrs: false };
|
|
17
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
18
|
+
...__default__,
|
|
19
|
+
__name: "LpDatePicker",
|
|
20
|
+
props: {
|
|
21
|
+
clearable: { type: Boolean },
|
|
22
|
+
disabled: { type: Boolean },
|
|
23
|
+
invalid: { type: Boolean },
|
|
24
|
+
error: {},
|
|
25
|
+
size: { default: "md" },
|
|
26
|
+
locale: {},
|
|
27
|
+
modelValue: {},
|
|
28
|
+
placeholder: {},
|
|
29
|
+
min: {},
|
|
30
|
+
max: {},
|
|
31
|
+
isDisabled: {},
|
|
32
|
+
isDateUnavailable: {},
|
|
33
|
+
presets: { type: [Array, Boolean] },
|
|
34
|
+
format: { default: () => ({ year: "numeric", month: "short", day: "numeric" }) },
|
|
35
|
+
time: { type: Boolean },
|
|
36
|
+
defaultTime: { default: "00:00" },
|
|
37
|
+
doneLabel: {},
|
|
38
|
+
labels: {}
|
|
39
|
+
},
|
|
40
|
+
emits: ["update:modelValue", "blur"],
|
|
41
|
+
setup(__props, { emit: __emit }) {
|
|
42
|
+
const props = __props;
|
|
43
|
+
const emit = __emit;
|
|
44
|
+
const open = ref(false);
|
|
45
|
+
const day = computed(() => (props.modelValue || "").slice(0, 10));
|
|
46
|
+
const minute = computed(() => {
|
|
47
|
+
const at = (props.modelValue || "").slice(11, 16);
|
|
48
|
+
return /^\d{2}:\d{2}$/.test(at) ? at : "";
|
|
49
|
+
});
|
|
50
|
+
const locale = useLocale(() => props.locale);
|
|
51
|
+
const display = computed(() => {
|
|
52
|
+
if (!props.modelValue) return "";
|
|
53
|
+
const [y, m, d] = day.value.split("-").map(Number);
|
|
54
|
+
if (!y || !m || !d) return props.modelValue;
|
|
55
|
+
const shown = new Intl.DateTimeFormat(locale.value, props.format).format(new Date(y, m - 1, d));
|
|
56
|
+
return props.time && minute.value ? `${shown}, ${minute.value}` : shown;
|
|
57
|
+
});
|
|
58
|
+
function onPick(picked) {
|
|
59
|
+
const v = picked ?? (day.value || void 0);
|
|
60
|
+
if (!props.time) {
|
|
61
|
+
emit("update:modelValue", v);
|
|
62
|
+
open.value = false;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
emit("update:modelValue", v ? `${v}T${minute.value || props.defaultTime}` : void 0);
|
|
66
|
+
}
|
|
67
|
+
function onTime(at) {
|
|
68
|
+
if (!day.value) return;
|
|
69
|
+
emit("update:modelValue", `${day.value}T${at || props.defaultTime}`);
|
|
70
|
+
}
|
|
71
|
+
function clear() {
|
|
72
|
+
emit("update:modelValue", void 0);
|
|
73
|
+
}
|
|
74
|
+
useAttrs();
|
|
75
|
+
const { field, wrapper, controlAttrs } = useOwnField(() => ({ error: props.error, invalid: props.invalid, disabled: props.disabled }));
|
|
76
|
+
const text = useLabels(
|
|
77
|
+
"datePicker",
|
|
78
|
+
{
|
|
79
|
+
placeholder: "Pick a date",
|
|
80
|
+
clear: "Clear",
|
|
81
|
+
done: "Done",
|
|
82
|
+
presets: "Presets",
|
|
83
|
+
today: "Today",
|
|
84
|
+
tomorrow: "Tomorrow",
|
|
85
|
+
inWeek: "In a week"
|
|
86
|
+
},
|
|
87
|
+
() => props.labels
|
|
88
|
+
);
|
|
89
|
+
const presetList = computed(() => {
|
|
90
|
+
if (Array.isArray(props.presets)) return props.presets;
|
|
91
|
+
return props.presets ? defaultDatePresets(text.value) : [];
|
|
92
|
+
});
|
|
93
|
+
function presetFits(preset) {
|
|
94
|
+
return dayAllowed(preset.date(), props);
|
|
95
|
+
}
|
|
96
|
+
function pickPreset(preset) {
|
|
97
|
+
if (presetFits(preset)) onPick(preset.date());
|
|
98
|
+
}
|
|
99
|
+
const showClear = computed(() => props.clearable && !!props.modelValue && !field.value.disabled);
|
|
100
|
+
const presetOptions = computed(() => presetList.value.map((preset) => ({
|
|
101
|
+
label: preset.label,
|
|
102
|
+
disabled: !presetFits(preset),
|
|
103
|
+
selected: !!day.value && day.value === preset.date(),
|
|
104
|
+
select: () => pickPreset(preset)
|
|
105
|
+
})));
|
|
106
|
+
return (_ctx, _cache) => {
|
|
107
|
+
return openBlock(), createBlock(_sfc_main$1, normalizeProps(guardReactiveProps(unref(wrapper))), {
|
|
108
|
+
default: withCtx(() => [
|
|
109
|
+
createVNode(_sfc_main$2, mergeProps(unref(controlAttrs), {
|
|
110
|
+
open: open.value,
|
|
111
|
+
"onUpdate:open": _cache[2] || (_cache[2] = ($event) => open.value = $event),
|
|
112
|
+
field: unref(field),
|
|
113
|
+
display: display.value,
|
|
114
|
+
placeholder: __props.placeholder ?? unref(text).placeholder,
|
|
115
|
+
icon: "lucide:calendar",
|
|
116
|
+
size: __props.size,
|
|
117
|
+
clearable: showClear.value,
|
|
118
|
+
"clear-label": unref(text).clear,
|
|
119
|
+
"presets-label": unref(text).presets,
|
|
120
|
+
presets: presetOptions.value,
|
|
121
|
+
"presets-class": "sm:w-36",
|
|
122
|
+
onClear: clear,
|
|
123
|
+
onBlur: _cache[3] || (_cache[3] = ($event) => emit("blur", $event))
|
|
124
|
+
}), {
|
|
125
|
+
default: withCtx(() => [
|
|
126
|
+
createElementVNode("div", _hoisted_1, [
|
|
127
|
+
createVNode(_sfc_main$3, {
|
|
128
|
+
"model-value": day.value,
|
|
129
|
+
min: __props.min,
|
|
130
|
+
max: __props.max,
|
|
131
|
+
"is-disabled": __props.isDisabled,
|
|
132
|
+
"is-date-unavailable": __props.isDateUnavailable,
|
|
133
|
+
locale: unref(locale),
|
|
134
|
+
labels: __props.labels,
|
|
135
|
+
class: "border-0 bg-transparent",
|
|
136
|
+
"onUpdate:modelValue": onPick
|
|
137
|
+
}, null, 8, ["model-value", "min", "max", "is-disabled", "is-date-unavailable", "locale", "labels"]),
|
|
138
|
+
__props.time ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
139
|
+
createVNode(_sfc_main$4, {
|
|
140
|
+
name: "lucide:clock",
|
|
141
|
+
size: 15,
|
|
142
|
+
class: "shrink-0 text-muted"
|
|
143
|
+
}),
|
|
144
|
+
createVNode(_sfc_main$5, {
|
|
145
|
+
"model-value": minute.value || void 0,
|
|
146
|
+
disabled: !day.value,
|
|
147
|
+
icon: false,
|
|
148
|
+
locale: unref(locale),
|
|
149
|
+
size: "sm",
|
|
150
|
+
class: "flex-1",
|
|
151
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = (at) => onTime(at || ""))
|
|
152
|
+
}, null, 8, ["model-value", "disabled", "locale"]),
|
|
153
|
+
createElementVNode("button", {
|
|
154
|
+
type: "button",
|
|
155
|
+
class: "shrink-0 rounded-control px-2 py-1 text-xs text-muted transition-colors hover:text-ink",
|
|
156
|
+
onClick: _cache[1] || (_cache[1] = ($event) => open.value = false)
|
|
157
|
+
}, toDisplayString(__props.doneLabel ?? unref(text).done), 1)
|
|
158
|
+
])) : createCommentVNode("", true)
|
|
159
|
+
])
|
|
160
|
+
]),
|
|
161
|
+
_: 1
|
|
162
|
+
}, 16, ["open", "field", "display", "placeholder", "size", "clearable", "clear-label", "presets-label", "presets"])
|
|
163
|
+
]),
|
|
164
|
+
_: 1
|
|
165
|
+
}, 16);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
export {
|
|
170
|
+
_sfc_main as _
|
|
171
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, openBlock, createBlock,
|
|
2
|
-
import {
|
|
1
|
+
import { defineComponent, ref, computed, useAttrs, openBlock, createBlock, normalizeProps, guardReactiveProps, unref, withCtx, createVNode, mergeProps } from "vue";
|
|
2
|
+
import { _ as _sfc_main$1 } from "./FieldWrapper-DnuMTrqW.js";
|
|
3
|
+
import { useOwnField } from "../composables/useField.js";
|
|
3
4
|
import { useLocale } from "../composables/useLocale.js";
|
|
4
5
|
import { useLabels } from "../composables/useLpConfig.js";
|
|
5
6
|
import { useMediaQuery } from "../composables/useMediaQuery.js";
|
|
6
7
|
import { normalizeRange, formatRange, defaultRangePresets, sameRange, allowedRange } from "../components/dateRange.js";
|
|
7
|
-
import { _ as _sfc_main$
|
|
8
|
-
import { _ as _sfc_main$
|
|
8
|
+
import { _ as _sfc_main$2 } from "./PickerField-BM1dyafh.js";
|
|
9
|
+
import { _ as _sfc_main$3 } from "./LpRangeCalendar-BrqlGZzE.js";
|
|
9
10
|
const __default__ = { inheritAttrs: false };
|
|
10
11
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
12
|
...__default__,
|
|
@@ -14,6 +15,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
14
15
|
clearable: { type: Boolean },
|
|
15
16
|
disabled: { type: Boolean },
|
|
16
17
|
invalid: { type: Boolean },
|
|
18
|
+
error: {},
|
|
17
19
|
size: { default: "md" },
|
|
18
20
|
locale: {},
|
|
19
21
|
modelValue: {},
|
|
@@ -71,7 +73,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
71
73
|
return !!allowedRange(preset.range(), rules.value);
|
|
72
74
|
}
|
|
73
75
|
const wide = useMediaQuery("(min-width: 640px)");
|
|
74
|
-
|
|
76
|
+
useAttrs();
|
|
77
|
+
const { field, wrapper, controlAttrs } = useOwnField(() => ({ error: props.error, invalid: props.invalid, disabled: props.disabled }));
|
|
75
78
|
const showClear = computed(() => props.clearable && !!value.value && !field.value.disabled);
|
|
76
79
|
const presetOptions = computed(() => presetList.value.map((preset) => ({
|
|
77
80
|
label: preset.label,
|
|
@@ -80,39 +83,44 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
80
83
|
select: () => pickPreset(preset)
|
|
81
84
|
})));
|
|
82
85
|
return (_ctx, _cache) => {
|
|
83
|
-
return openBlock(), createBlock(_sfc_main$1,
|
|
84
|
-
open: open.value,
|
|
85
|
-
"onUpdate:open": _cache[0] || (_cache[0] = ($event) => open.value = $event),
|
|
86
|
-
field: unref(field),
|
|
87
|
-
display: display.value,
|
|
88
|
-
placeholder: __props.placeholder || unref(text).placeholder,
|
|
89
|
-
icon: "lucide:calendar-range",
|
|
90
|
-
size: __props.size,
|
|
91
|
-
clearable: showClear.value,
|
|
92
|
-
"clear-label": unref(text).clear,
|
|
93
|
-
"presets-label": unref(text).presets,
|
|
94
|
-
presets: presetOptions.value,
|
|
95
|
-
"presets-class": "sm:w-40",
|
|
96
|
-
onClear: _cache[1] || (_cache[1] = ($event) => emit("update:modelValue", void 0)),
|
|
97
|
-
onBlur: _cache[2] || (_cache[2] = ($event) => emit("blur", $event))
|
|
98
|
-
}), {
|
|
86
|
+
return openBlock(), createBlock(_sfc_main$1, normalizeProps(guardReactiveProps(unref(wrapper))), {
|
|
99
87
|
default: withCtx(() => [
|
|
100
|
-
createVNode(_sfc_main$2, {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
"
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
88
|
+
createVNode(_sfc_main$2, mergeProps(unref(controlAttrs), {
|
|
89
|
+
open: open.value,
|
|
90
|
+
"onUpdate:open": _cache[0] || (_cache[0] = ($event) => open.value = $event),
|
|
91
|
+
field: unref(field),
|
|
92
|
+
display: display.value,
|
|
93
|
+
placeholder: __props.placeholder || unref(text).placeholder,
|
|
94
|
+
icon: "lucide:calendar-range",
|
|
95
|
+
size: __props.size,
|
|
96
|
+
clearable: showClear.value,
|
|
97
|
+
"clear-label": unref(text).clear,
|
|
98
|
+
"presets-label": unref(text).presets,
|
|
99
|
+
presets: presetOptions.value,
|
|
100
|
+
"presets-class": "sm:w-40",
|
|
101
|
+
onClear: _cache[1] || (_cache[1] = ($event) => emit("update:modelValue", void 0)),
|
|
102
|
+
onBlur: _cache[2] || (_cache[2] = ($event) => emit("blur", $event))
|
|
103
|
+
}), {
|
|
104
|
+
default: withCtx(() => [
|
|
105
|
+
createVNode(_sfc_main$3, {
|
|
106
|
+
"model-value": value.value,
|
|
107
|
+
min: __props.min,
|
|
108
|
+
max: __props.max,
|
|
109
|
+
"is-disabled": __props.isDisabled,
|
|
110
|
+
"is-date-unavailable": __props.isDateUnavailable,
|
|
111
|
+
"maximum-days": __props.maximumDays,
|
|
112
|
+
months: unref(wide) ? 2 : 1,
|
|
113
|
+
locale: unref(locale),
|
|
114
|
+
labels: __props.labels,
|
|
115
|
+
class: "border-0 bg-transparent",
|
|
116
|
+
"onUpdate:modelValue": pick
|
|
117
|
+
}, null, 8, ["model-value", "min", "max", "is-disabled", "is-date-unavailable", "maximum-days", "months", "locale", "labels"])
|
|
118
|
+
]),
|
|
119
|
+
_: 1
|
|
120
|
+
}, 16, ["open", "field", "display", "placeholder", "size", "clearable", "clear-label", "presets-label", "presets"])
|
|
113
121
|
]),
|
|
114
122
|
_: 1
|
|
115
|
-
}, 16
|
|
123
|
+
}, 16);
|
|
116
124
|
};
|
|
117
125
|
}
|
|
118
126
|
});
|
|
@@ -5,8 +5,8 @@ import { isElement } from "../composables/realm.js";
|
|
|
5
5
|
import { withLoadedChildren, computeStats, formatSize, isFilterEmpty, filterTree, sortNodes, flattenVisible, rowWindow, renameProblem, nodeTrail, subtreeIds, rangeIds, topmostIds, canDrop, ancestorIds } from "../components/fileTree.js";
|
|
6
6
|
import { _ as _sfc_main$4 } from "./LpBreadcrumbs-CIIBsygI.js";
|
|
7
7
|
import { _ as _sfc_main$2 } from "./LpEmptyState-DurPF001.js";
|
|
8
|
-
import { _ as _sfc_main$6 } from "./LpFileTreeNode-
|
|
9
|
-
import { _ as _sfc_main$3 } from "./LpInput-
|
|
8
|
+
import { _ as _sfc_main$6 } from "./LpFileTreeNode-DdF8Cq-s.js";
|
|
9
|
+
import { _ as _sfc_main$3 } from "./LpInput-CbI7z5fQ.js";
|
|
10
10
|
import { _ as _sfc_main$5 } from "./LpScrollArea-CqvwfZs2.js";
|
|
11
11
|
import { _ as _sfc_main$1 } from "./LpSkeleton-BB6XIV-w.js";
|
|
12
12
|
import { usePersisted } from "../composables/usePersisted.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, computed, ref, watch, nextTick, resolveComponent, openBlock, createElementBlock, mergeProps, unref, createVNode, withCtx, createElementVNode, withModifiers, normalizeStyle, normalizeClass, createBlock, createCommentVNode, renderSlot, createTextVNode, toDisplayString, Fragment, renderList } from "vue";
|
|
2
2
|
import { sortNodes, formatSize, formatModified, renameSelectionEnd, fileIcon } from "../components/fileTree.js";
|
|
3
3
|
import { _ as _sfc_main$5 } from "./LpBadge-D5QQdDQ_.js";
|
|
4
|
-
import { _ as _sfc_main$4 } from "./LpCheckbox-
|
|
4
|
+
import { _ as _sfc_main$4 } from "./LpCheckbox-CCWCwD0y.js";
|
|
5
5
|
import { _ as _sfc_main$6 } from "./LpCollapse-DrAw5DBZ.js";
|
|
6
6
|
import { _ as _sfc_main$1 } from "./LpContextMenu-Bx_IhQDS.js";
|
|
7
7
|
import { _ as _sfc_main$3 } from "./LpIcon-C6JpQ5td.js";
|
|
@@ -2,7 +2,7 @@ import { defineComponent, computed, useSlots, useAttrs, ref, openBlock, createBl
|
|
|
2
2
|
import { CONTROL_SIZE } from "../components/controlSize.js";
|
|
3
3
|
import { usePaletteControl } from "../composables/usePaletteCommands.js";
|
|
4
4
|
import { tv } from "tailwind-variants";
|
|
5
|
-
import { useFieldControl, isAttrOn, fieldWrapperBinds, mergeDescribedBy } from "../composables/useField.js";
|
|
5
|
+
import { useField, wrapsItself, useFieldControl, isAttrOn, fieldWrapperBinds, mergeDescribedBy } from "../composables/useField.js";
|
|
6
6
|
import { useLabels } from "../composables/useLpConfig.js";
|
|
7
7
|
import { useInputFilter } from "../composables/useInputFilter.js";
|
|
8
8
|
import { useInputMask, DEFAULT_MASK_TOKENS } from "../composables/useInputMask.js";
|
|
@@ -94,9 +94,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
94
94
|
const attrs = useAttrs();
|
|
95
95
|
const hasLeading = computed(() => !!slots.leading || !!props.icon);
|
|
96
96
|
const hasTrailing = computed(() => !!slots.trailing || showClear.value);
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
);
|
|
97
|
+
const outerFieldOf = useField();
|
|
98
|
+
const hasField = computed(() => wrapsItself(props, outerFieldOf));
|
|
100
99
|
const field = useFieldControl(() => ({
|
|
101
100
|
wrapped: hasField.value,
|
|
102
101
|
hasMessage: !!props.error || !!props.hint,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, unref, Fragment, createVNode, toDisplayString, renderList, normalizeStyle, createElementVNode, normalizeClass, createTextVNode } from "vue";
|
|
2
2
|
import { _ as _sfc_main$2 } from "./LpIcon-C6JpQ5td.js";
|
|
3
|
-
import { _ as _sfc_main$1 } from "./LpInput-
|
|
3
|
+
import { _ as _sfc_main$1 } from "./LpInput-CbI7z5fQ.js";
|
|
4
4
|
import { useLabels } from "../composables/useLpConfig.js";
|
|
5
5
|
import { structuredPayload, jsonRows, stackLines } from "../components/logTools.js";
|
|
6
6
|
const _hoisted_1 = ["aria-label"];
|
|
@@ -9,7 +9,7 @@ import { _ as _sfc_main$6 } from "./LpContextMenu-Bx_IhQDS.js";
|
|
|
9
9
|
import { _ as _sfc_main$4 } from "./LpEmptyState-DurPF001.js";
|
|
10
10
|
import { _ as _sfc_main$2 } from "./LpIcon-C6JpQ5td.js";
|
|
11
11
|
import { _ as _sfc_main$5 } from "./LpLoader-Bf1yZwaU.js";
|
|
12
|
-
import { _ as _sfc_main$1 } from "./LpInput-
|
|
12
|
+
import { _ as _sfc_main$1 } from "./LpInput-CbI7z5fQ.js";
|
|
13
13
|
import { _ as _sfc_main$3 } from "./LpScrollArea-CqvwfZs2.js";
|
|
14
14
|
import { useMergedAttrs } from "../composables/useMergedClass.js";
|
|
15
15
|
import { useLabels } from "../composables/useLpConfig.js";
|
|
@@ -18,7 +18,7 @@ import { inTextField } from "../composables/textEntry.js";
|
|
|
18
18
|
import { nodeWindow, isElement } from "../composables/realm.js";
|
|
19
19
|
import { ringWindow, matchPositions, countLevels, stepMatch } from "../components/logSearch.js";
|
|
20
20
|
import { downloadFile } from "../components/exportData.js";
|
|
21
|
-
import { _ as _sfc_main$8 } from "./LpLogInspector-
|
|
21
|
+
import { _ as _sfc_main$8 } from "./LpLogInspector-CcSJSGan.js";
|
|
22
22
|
import { compilePattern, inTimeRange, patternPositions, groupRepeats, rowSpan, exportLines, nearestByTime, termRanges, messageParts, findIds } from "../components/logTools.js";
|
|
23
23
|
import { TONES, toneLook } from "../components/tone.js";
|
|
24
24
|
import '../assets/LpLogViewer-BDNW6P52.css';const _hoisted_1 = {
|
|
@@ -4,7 +4,7 @@ import { useLabels } from "../composables/useLpConfig.js";
|
|
|
4
4
|
import { _ as _sfc_main$2 } from "./LpButton-DSHioIfD.js";
|
|
5
5
|
import { _ as _sfc_main$3 } from "./LpIcon-C6JpQ5td.js";
|
|
6
6
|
import { _ as _sfc_main$1 } from "./LpModal-DDvrSAnf.js";
|
|
7
|
-
import { _ as _sfc_main$4 } from "./LpSidebar-
|
|
7
|
+
import { _ as _sfc_main$4 } from "./LpSidebar-CvRvVBTt.js";
|
|
8
8
|
const _hoisted_1 = { class: "flex items-center gap-2" };
|
|
9
9
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
10
|
__name: "LpModalNav",
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { defineComponent, useId, useAttrs, computed, openBlock, createBlock, normalizeProps, guardReactiveProps, unref, withCtx, createVNode, normalizeStyle, normalizeClass, createSlots, renderSlot, createCommentVNode, mergeProps, createElementBlock, toDisplayString } from "vue";
|
|
2
|
+
import { _ as _sfc_main$1 } from "./FieldWrapper-DnuMTrqW.js";
|
|
3
|
+
import { CONTROL_SIZE } from "../components/controlSize.js";
|
|
4
|
+
import { usePaletteControl } from "../composables/usePaletteCommands.js";
|
|
5
|
+
import { NumberFieldRoot, NumberFieldDecrement, NumberFieldInput, NumberFieldIncrement } from "reka-ui";
|
|
6
|
+
import { _ as _sfc_main$2 } from "./FieldLeading-mr81aEAP.js";
|
|
7
|
+
import { _ as _sfc_main$3 } from "./LpIcon-C6JpQ5td.js";
|
|
8
|
+
import { useOwnField, mergeDescribedBy, focusLeft } from "../composables/useField.js";
|
|
9
|
+
import { useLabels } from "../composables/useLpConfig.js";
|
|
10
|
+
import { useMergedClass } from "../composables/useMergedClass.js";
|
|
11
|
+
const _hoisted_1 = ["id"];
|
|
12
|
+
const __default__ = { inheritAttrs: false };
|
|
13
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
14
|
+
...__default__,
|
|
15
|
+
__name: "LpNumberField",
|
|
16
|
+
props: {
|
|
17
|
+
palette: { type: [Boolean, Object], default: void 0 },
|
|
18
|
+
modelValue: {},
|
|
19
|
+
min: {},
|
|
20
|
+
max: {},
|
|
21
|
+
step: {},
|
|
22
|
+
stepSnapping: { type: Boolean, default: true },
|
|
23
|
+
formatOptions: {},
|
|
24
|
+
locale: {},
|
|
25
|
+
readonly: { type: Boolean },
|
|
26
|
+
disableWheelChange: { type: Boolean },
|
|
27
|
+
invertWheelChange: { type: Boolean },
|
|
28
|
+
focusOnChange: { type: Boolean, default: true },
|
|
29
|
+
steppers: { type: Boolean, default: true },
|
|
30
|
+
disabled: { type: Boolean },
|
|
31
|
+
unit: {},
|
|
32
|
+
icon: {},
|
|
33
|
+
invalid: { type: Boolean },
|
|
34
|
+
error: {},
|
|
35
|
+
size: { default: "md" },
|
|
36
|
+
labels: {}
|
|
37
|
+
},
|
|
38
|
+
emits: ["update:modelValue", "blur"],
|
|
39
|
+
setup(__props, { emit: __emit }) {
|
|
40
|
+
const props = __props;
|
|
41
|
+
const emit = __emit;
|
|
42
|
+
const unitId = useId();
|
|
43
|
+
const text = useLabels(
|
|
44
|
+
"numberField",
|
|
45
|
+
{ increase: "Increase", decrease: "Decrease" },
|
|
46
|
+
() => props.labels
|
|
47
|
+
);
|
|
48
|
+
const SIZE = CONTROL_SIZE;
|
|
49
|
+
const attrs = useAttrs();
|
|
50
|
+
const { field, wrapper, ownAttrs } = useOwnField(() => ({ error: props.error, invalid: props.invalid, disabled: props.disabled }));
|
|
51
|
+
const describedBy = computed(
|
|
52
|
+
() => mergeDescribedBy(attrs["aria-describedby"], field.value.describedBy, props.unit ? unitId : void 0)
|
|
53
|
+
);
|
|
54
|
+
const inputAttrs = computed(() => {
|
|
55
|
+
const { class: _c, style: _s, id: _i, name: _n, ...rest } = attrs;
|
|
56
|
+
return rest;
|
|
57
|
+
});
|
|
58
|
+
function onFocusOut(event) {
|
|
59
|
+
if (focusLeft(event)) emit("blur", event);
|
|
60
|
+
}
|
|
61
|
+
const rootClass = useMergedClass(() => [
|
|
62
|
+
"@container flex w-full items-center rounded-control border bg-surface-soft transition-colors duration-[var(--duration-fast)] focus-within:ring-2 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-55",
|
|
63
|
+
SIZE[props.size],
|
|
64
|
+
field.value.invalid ? "border-danger focus-within:border-danger focus-within:ring-danger-soft" : "border-line focus-within:border-brand focus-within:ring-ring"
|
|
65
|
+
].join(" "), () => ownAttrs());
|
|
66
|
+
usePaletteControl({ disabled: () => field.value.disabled, invalid: () => field.value.invalid });
|
|
67
|
+
return (_ctx, _cache) => {
|
|
68
|
+
return openBlock(), createBlock(_sfc_main$1, normalizeProps(guardReactiveProps(unref(wrapper))), {
|
|
69
|
+
default: withCtx(() => [
|
|
70
|
+
createVNode(unref(NumberFieldRoot), {
|
|
71
|
+
"model-value": __props.modelValue ?? void 0,
|
|
72
|
+
min: __props.min,
|
|
73
|
+
max: __props.max,
|
|
74
|
+
step: __props.step,
|
|
75
|
+
"step-snapping": __props.stepSnapping,
|
|
76
|
+
readonly: __props.readonly,
|
|
77
|
+
"disable-wheel-change": __props.disableWheelChange,
|
|
78
|
+
"invert-wheel-change": __props.invertWheelChange,
|
|
79
|
+
"focus-on-change": __props.focusOnChange,
|
|
80
|
+
"format-options": __props.formatOptions,
|
|
81
|
+
locale: __props.locale,
|
|
82
|
+
disabled: unref(field).disabled,
|
|
83
|
+
required: unref(field).required,
|
|
84
|
+
"data-lp-ring-owner": "",
|
|
85
|
+
class: normalizeClass(unref(rootClass)),
|
|
86
|
+
style: normalizeStyle(unref(ownAttrs)() ? unref(attrs).style : void 0),
|
|
87
|
+
name: typeof unref(attrs).name === "string" ? unref(attrs).name : void 0,
|
|
88
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = (v) => emit("update:modelValue", Number.isNaN(v) ? null : v ?? null)),
|
|
89
|
+
onFocusout: onFocusOut
|
|
90
|
+
}, {
|
|
91
|
+
default: withCtx(() => [
|
|
92
|
+
createVNode(_sfc_main$2, {
|
|
93
|
+
icon: __props.icon,
|
|
94
|
+
class: "pl-2.5"
|
|
95
|
+
}, createSlots({ _: 2 }, [
|
|
96
|
+
_ctx.$slots.leading ? {
|
|
97
|
+
name: "default",
|
|
98
|
+
fn: withCtx(() => [
|
|
99
|
+
renderSlot(_ctx.$slots, "leading")
|
|
100
|
+
]),
|
|
101
|
+
key: "0"
|
|
102
|
+
} : void 0
|
|
103
|
+
]), 1032, ["icon"]),
|
|
104
|
+
__props.steppers ? (openBlock(), createBlock(unref(NumberFieldDecrement), {
|
|
105
|
+
key: 0,
|
|
106
|
+
"aria-label": unref(text).decrease,
|
|
107
|
+
class: "group grid h-full w-8 shrink-0 place-items-center @max-[8.5rem]:hidden text-muted transition-colors duration-[var(--duration-fast)] hover:text-ink disabled:opacity-40"
|
|
108
|
+
}, {
|
|
109
|
+
default: withCtx(() => [
|
|
110
|
+
createVNode(_sfc_main$3, {
|
|
111
|
+
name: "lucide:minus",
|
|
112
|
+
size: 15,
|
|
113
|
+
class: "transition-transform duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] group-active:scale-75 motion-reduce:group-active:scale-100"
|
|
114
|
+
})
|
|
115
|
+
]),
|
|
116
|
+
_: 1
|
|
117
|
+
}, 8, ["aria-label"])) : createCommentVNode("", true),
|
|
118
|
+
createVNode(unref(NumberFieldInput), mergeProps(inputAttrs.value, {
|
|
119
|
+
id: unref(field).id,
|
|
120
|
+
"aria-describedby": describedBy.value,
|
|
121
|
+
"aria-invalid": unref(field).invalid || void 0,
|
|
122
|
+
class: ["min-w-0 flex-1 bg-transparent text-ink outline-none placeholder:text-muted [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none", __props.steppers ? "text-center @max-[8.5rem]:px-3 @max-[8.5rem]:text-left" : __props.icon || _ctx.$slots.leading ? "pl-2 pr-3" : "px-3"]
|
|
123
|
+
}), null, 16, ["id", "aria-describedby", "aria-invalid", "class"]),
|
|
124
|
+
__props.unit ? (openBlock(), createElementBlock("span", {
|
|
125
|
+
key: 1,
|
|
126
|
+
id: unref(unitId),
|
|
127
|
+
class: normalizeClass(["shrink-0 pr-1 text-xs text-muted", !__props.steppers && "pr-3"])
|
|
128
|
+
}, toDisplayString(__props.unit), 11, _hoisted_1)) : createCommentVNode("", true),
|
|
129
|
+
__props.steppers ? (openBlock(), createBlock(unref(NumberFieldIncrement), {
|
|
130
|
+
key: 2,
|
|
131
|
+
"aria-label": unref(text).increase,
|
|
132
|
+
class: "group grid h-full w-8 shrink-0 place-items-center @max-[8.5rem]:hidden text-muted transition-colors duration-[var(--duration-fast)] hover:text-ink disabled:opacity-40"
|
|
133
|
+
}, {
|
|
134
|
+
default: withCtx(() => [
|
|
135
|
+
createVNode(_sfc_main$3, {
|
|
136
|
+
name: "lucide:plus",
|
|
137
|
+
size: 15,
|
|
138
|
+
class: "transition-transform duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] group-active:scale-75 motion-reduce:group-active:scale-100"
|
|
139
|
+
})
|
|
140
|
+
]),
|
|
141
|
+
_: 1
|
|
142
|
+
}, 8, ["aria-label"])) : createCommentVNode("", true)
|
|
143
|
+
]),
|
|
144
|
+
_: 3
|
|
145
|
+
}, 8, ["model-value", "min", "max", "step", "step-snapping", "readonly", "disable-wheel-change", "invert-wheel-change", "focus-on-change", "format-options", "locale", "disabled", "required", "class", "style", "name"])
|
|
146
|
+
]),
|
|
147
|
+
_: 3
|
|
148
|
+
}, 16);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
export {
|
|
153
|
+
_sfc_main as _
|
|
154
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, watch, openBlock, createBlock, normalizeProps, guardReactiveProps, unref, withCtx, createVNode, mergeProps, createElementBlock, Fragment, renderList, normalizeClass, createCommentVNode } from "vue";
|
|
2
|
+
import { _ as _sfc_main$1 } from "./FieldWrapper-DnuMTrqW.js";
|
|
3
|
+
import { PinInputRoot, PinInputInput } from "reka-ui";
|
|
4
|
+
import { useOwnField, mergeDescribedBy } from "../composables/useField.js";
|
|
5
|
+
import { useMergedAttrs } from "../composables/useMergedClass.js";
|
|
6
|
+
import { splitCode, upperCells, joinCells, groupBreaks } from "../components/otp.js";
|
|
7
|
+
const _hoisted_1 = {
|
|
8
|
+
key: 0,
|
|
9
|
+
"aria-hidden": "true",
|
|
10
|
+
class: "h-0.5 w-2 shrink-0 rounded-full bg-muted opacity-60"
|
|
11
|
+
};
|
|
12
|
+
const __default__ = { inheritAttrs: false };
|
|
13
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
14
|
+
...__default__,
|
|
15
|
+
__name: "LpOtpInput",
|
|
16
|
+
props: {
|
|
17
|
+
modelValue: {},
|
|
18
|
+
length: { default: 6 },
|
|
19
|
+
disabled: { type: Boolean },
|
|
20
|
+
mask: { type: Boolean },
|
|
21
|
+
alphanumeric: { type: Boolean, default: false },
|
|
22
|
+
uppercase: { type: Boolean, default: void 0 },
|
|
23
|
+
group: {},
|
|
24
|
+
invalid: { type: Boolean },
|
|
25
|
+
error: {},
|
|
26
|
+
size: { default: "md" }
|
|
27
|
+
},
|
|
28
|
+
emits: ["update:modelValue", "complete"],
|
|
29
|
+
setup(__props, { emit: __emit }) {
|
|
30
|
+
const props = __props;
|
|
31
|
+
const emit = __emit;
|
|
32
|
+
const upper = computed(() => props.alphanumeric && (props.uppercase ?? true));
|
|
33
|
+
const local = ref(splitCode(props.modelValue, props.length));
|
|
34
|
+
let emitted = props.modelValue ?? "";
|
|
35
|
+
watch(
|
|
36
|
+
() => props.modelValue ?? "",
|
|
37
|
+
(value) => {
|
|
38
|
+
if (value === emitted) return;
|
|
39
|
+
emitted = value;
|
|
40
|
+
local.value = splitCode(value, props.length);
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
watch(
|
|
44
|
+
() => props.length,
|
|
45
|
+
(length) => {
|
|
46
|
+
local.value = local.value.slice(0, length);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
const cells = computed({
|
|
50
|
+
get: () => local.value,
|
|
51
|
+
set: (arr) => {
|
|
52
|
+
local.value = upper.value ? upperCells(arr) : arr;
|
|
53
|
+
emitted = joinCells(local.value);
|
|
54
|
+
emit("update:modelValue", emitted);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const { field, wrapper, ownAttrs } = useOwnField(() => ({
|
|
58
|
+
error: props.error,
|
|
59
|
+
invalid: props.invalid,
|
|
60
|
+
disabled: props.disabled
|
|
61
|
+
}));
|
|
62
|
+
function onComplete(arr) {
|
|
63
|
+
emit("complete", joinCells(upper.value ? upperCells(arr) : arr));
|
|
64
|
+
}
|
|
65
|
+
const breaks = computed(() => groupBreaks(props.length, props.group));
|
|
66
|
+
const root = ref(null);
|
|
67
|
+
function onBeforeInput(event, index) {
|
|
68
|
+
if (event.inputType !== "deleteContentBackward") return;
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
const target = event.target;
|
|
71
|
+
const next = [...local.value];
|
|
72
|
+
let clear = index;
|
|
73
|
+
if (!target.value && index > 0) {
|
|
74
|
+
clear = index - 1;
|
|
75
|
+
root.value?.$el.querySelectorAll("input")[clear]?.focus();
|
|
76
|
+
}
|
|
77
|
+
next[clear] = props.alphanumeric ? "" : void 0;
|
|
78
|
+
cells.value = next;
|
|
79
|
+
}
|
|
80
|
+
const cellSize = {
|
|
81
|
+
sm: "max-w-9 text-base",
|
|
82
|
+
md: "max-w-11 text-lg",
|
|
83
|
+
lg: "max-w-13 text-xl"
|
|
84
|
+
};
|
|
85
|
+
const { class: rootClass, attrs: rest } = useMergedAttrs(
|
|
86
|
+
"flex min-w-0 max-w-full items-center gap-1.5 sm:gap-2",
|
|
87
|
+
() => ownAttrs()
|
|
88
|
+
);
|
|
89
|
+
return (_ctx, _cache) => {
|
|
90
|
+
return openBlock(), createBlock(_sfc_main$1, normalizeProps(guardReactiveProps(unref(wrapper))), {
|
|
91
|
+
default: withCtx(() => [
|
|
92
|
+
createVNode(unref(PinInputRoot), mergeProps({
|
|
93
|
+
ref_key: "root",
|
|
94
|
+
ref: root,
|
|
95
|
+
modelValue: cells.value,
|
|
96
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => cells.value = $event),
|
|
97
|
+
type: __props.alphanumeric ? "text" : "number",
|
|
98
|
+
mask: __props.mask,
|
|
99
|
+
disabled: unref(field).disabled,
|
|
100
|
+
required: unref(field).required,
|
|
101
|
+
otp: "",
|
|
102
|
+
class: unref(rootClass)
|
|
103
|
+
}, unref(rest), { onComplete }), {
|
|
104
|
+
default: withCtx(() => [
|
|
105
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.length, (i) => {
|
|
106
|
+
return openBlock(), createElementBlock(Fragment, { key: i }, [
|
|
107
|
+
createVNode(unref(PinInputInput), {
|
|
108
|
+
index: i - 1,
|
|
109
|
+
id: i === 1 ? unref(field).id : void 0,
|
|
110
|
+
"aria-invalid": unref(field).invalid || void 0,
|
|
111
|
+
"aria-describedby": unref(mergeDescribedBy)(unref(rest)["aria-describedby"], unref(field).describedBy),
|
|
112
|
+
autocapitalize: upper.value ? "characters" : "none",
|
|
113
|
+
autocorrect: "off",
|
|
114
|
+
spellcheck: false,
|
|
115
|
+
class: normalizeClass([
|
|
116
|
+
cellSize[__props.size],
|
|
117
|
+
"aspect-square h-auto min-w-0 flex-1 basis-0 p-0",
|
|
118
|
+
"rounded-control border bg-surface-soft text-center font-semibold text-ink caret-brand",
|
|
119
|
+
"outline-none transition-colors duration-[var(--duration-fast)]",
|
|
120
|
+
"focus:border-brand focus:ring-2 focus:ring-ring",
|
|
121
|
+
"disabled:cursor-not-allowed disabled:opacity-55",
|
|
122
|
+
unref(field).invalid ? "border-danger focus:border-danger focus:ring-danger-soft" : "border-line"
|
|
123
|
+
]),
|
|
124
|
+
onBeforeinput: ($event) => onBeforeInput($event, i - 1)
|
|
125
|
+
}, null, 8, ["index", "id", "aria-invalid", "aria-describedby", "autocapitalize", "class", "onBeforeinput"]),
|
|
126
|
+
breaks.value.has(i - 1) ? (openBlock(), createElementBlock("span", _hoisted_1)) : createCommentVNode("", true)
|
|
127
|
+
], 64);
|
|
128
|
+
}), 128))
|
|
129
|
+
]),
|
|
130
|
+
_: 1
|
|
131
|
+
}, 16, ["modelValue", "type", "mask", "disabled", "required", "class"])
|
|
132
|
+
]),
|
|
133
|
+
_: 1
|
|
134
|
+
}, 16);
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
export {
|
|
139
|
+
_sfc_main as _
|
|
140
|
+
};
|