@leavepulse/ui 0.12.0 → 0.14.4
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/assets/LpCommandPalette-D315B47-.css +16 -0
- package/dist/chunks/LayoutCanvas-Dd20boUG.js +50 -0
- package/dist/chunks/LayoutNode-DGpZA9LX.js +225 -0
- package/dist/chunks/LpAlert-BAYHDSS1.js +69 -0
- package/dist/chunks/LpAppShell-C22642JK.js +170 -0
- package/dist/chunks/LpAutocomplete-B9uoCs4t.js +196 -0
- package/dist/chunks/LpAvatar-B1Ez0ZAx.js +88 -0
- package/dist/chunks/LpBadge-CXzBPnwO.js +42 -0
- package/dist/chunks/LpBreadcrumbs-B7Aqatzw.js +42 -0
- package/dist/chunks/LpButton-5VXXCjwF.js +101 -0
- package/dist/chunks/LpCalendar-B7ZL0ty3.js +150 -0
- package/dist/chunks/LpCard-1yvWT9fx.js +66 -0
- package/dist/chunks/LpCheckbox-BO0zuuPh.js +55 -0
- package/dist/chunks/LpCodeBlock-CSiOSPs8.js +253 -0
- package/dist/chunks/LpConfirmDialog-CnHtHWHm.js +62 -0
- package/dist/chunks/LpContextMenu-D0mzXqA7.js +151 -0
- package/dist/chunks/LpDatePicker-dY2q4dr4.js +122 -0
- package/dist/chunks/LpDisclosure-DP6yfgfM.js +76 -0
- package/dist/chunks/LpDivider-CUX46KR0.js +43 -0
- package/dist/chunks/LpDrawer-CBNVhkg0.js +310 -0
- package/dist/chunks/LpDropdownMenu-DJpoqRCb.js +65 -0
- package/dist/chunks/LpEmptyState-CrfyRJUG.js +47 -0
- package/dist/chunks/LpFormField-Bn-ZwC6z.js +47 -0
- package/dist/chunks/LpIcon-CCnX5_2j.js +41 -0
- package/dist/chunks/LpInfraNode-C_PHcthC.js +99 -0
- package/dist/chunks/LpInput-BauZRyzm.js +136 -0
- package/dist/chunks/LpLaneNode-HtnQf2FF.js +33 -0
- package/dist/chunks/LpLink-DHwOEp4e.js +36 -0
- package/dist/chunks/LpLogViewer-CDBjhXl6.js +469 -0
- package/dist/chunks/LpModal-D17Bocq7.js +128 -0
- package/dist/chunks/LpNotificationBell-Bm51SkgV.js +232 -0
- package/dist/chunks/LpNumberField-C5ar-OwE.js +55 -0
- package/dist/chunks/LpOtpInput-DqaT0Z75.js +65 -0
- package/dist/chunks/LpPagination-CeGuNe_q.js +132 -0
- package/dist/chunks/LpPasswordInput-DIHFw4u0.js +64 -0
- package/dist/chunks/LpPhoneInput-LQvVFGMw.js +199 -0
- package/dist/chunks/LpPopover-8268UmlC.js +54 -0
- package/dist/chunks/LpProgress-BhI0IbjC.js +37 -0
- package/dist/chunks/LpRadio-CL-pI0_O.js +39 -0
- package/dist/chunks/LpRadioGroup-B4yDTmi6.js +52 -0
- package/dist/chunks/LpScrollArea-CcHul_XS.js +67 -0
- package/dist/chunks/LpSegmented-BmpanyAo.js +74 -0
- package/dist/chunks/LpSelect-DznhPEWX.js +222 -0
- package/dist/chunks/LpServiceNode-Dc-Ut5RS.js +51 -0
- package/dist/chunks/LpSidebar-CTUdtX7W.js +152 -0
- package/dist/chunks/LpSidebarNav-BRwovIc8.js +126 -0
- package/dist/chunks/LpSkeleton-eSFIo4kD.js +22 -0
- package/dist/chunks/LpSlider-B1SF3pRV.js +53 -0
- package/dist/chunks/LpStat-CdbEFOvn.js +88 -0
- package/dist/chunks/LpStepper-5dFTrW21.js +53 -0
- package/dist/chunks/LpSwitch-v6fnccSM.js +28 -0
- package/dist/chunks/LpTable-PHE6UKor.js +229 -0
- package/dist/chunks/LpTableOfContents-CjvxPMpU.js +155 -0
- package/dist/chunks/LpTabs-D7aTVPOb.js +115 -0
- package/dist/chunks/LpTextarea-CRAkhemZ.js +44 -0
- package/dist/chunks/LpThemeSwitcher-BgWwfkxs.js +601 -0
- package/dist/chunks/LpTilt-DuyKbpkA.js +49 -0
- package/dist/chunks/LpToaster-gDB1EaU3.js +196 -0
- package/dist/chunks/LpTooltip-CIwoRCag.js +49 -0
- package/dist/chunks/LpTopologyCanvas-DVwyQfKa.js +237 -0
- package/dist/chunks/LpUptimeBar-CB366k0O.js +127 -0
- package/dist/component-names.d.ts +1 -1
- package/dist/components/LayoutCanvas.vue.js +4 -0
- package/dist/components/LayoutNode.vue.js +4 -0
- package/dist/components/LpAlert.vue.js +4 -0
- package/dist/components/LpAppShell.vue.js +4 -0
- package/dist/components/LpAutocomplete.vue.js +4 -0
- package/dist/components/LpAvatar.vue.js +4 -0
- package/dist/components/LpBadge.vue.js +4 -0
- package/dist/components/LpBreadcrumbs.vue.js +4 -0
- package/dist/components/LpButton.vue.js +4 -0
- package/dist/components/LpCalendar.vue.js +4 -0
- package/dist/components/LpCard.vue.js +4 -0
- package/dist/components/LpCheckbox.vue.js +4 -0
- package/dist/components/LpCodeBlock.vue.js +4 -0
- package/dist/components/LpCommandPalette.vue.js +310 -0
- package/dist/components/LpConfirmDialog.vue.js +4 -0
- package/dist/components/LpContextMenu.vue.d.ts +7 -0
- package/dist/components/LpContextMenu.vue.js +4 -0
- package/dist/components/LpDatePicker.vue.js +4 -0
- package/dist/components/LpDisclosure.vue.js +4 -0
- package/dist/components/LpDivider.vue.js +4 -0
- package/dist/components/LpDrawer.vue.d.ts +8 -0
- package/dist/components/LpDrawer.vue.js +4 -0
- package/dist/components/LpDropdownMenu.vue.js +4 -0
- package/dist/components/LpEmptyState.vue.js +4 -0
- package/dist/components/LpFormField.vue.js +4 -0
- package/dist/components/LpIcon.vue.js +4 -0
- package/dist/components/LpInfraNode.vue.js +4 -0
- package/dist/components/LpInput.vue.js +4 -0
- package/dist/components/LpLaneNode.vue.js +4 -0
- package/dist/components/LpLink.vue.js +4 -0
- package/dist/components/LpLogViewer.vue.js +4 -0
- package/dist/components/LpModal.vue.js +4 -0
- package/dist/components/LpNotificationBell.vue.js +4 -0
- package/dist/components/LpNumberField.vue.js +4 -0
- package/dist/components/LpOtpInput.vue.js +4 -0
- package/dist/components/LpPagination.vue.js +4 -0
- package/dist/components/LpPasswordInput.vue.js +4 -0
- package/dist/components/LpPhoneInput.vue.js +4 -0
- package/dist/components/LpPopover.vue.js +4 -0
- package/dist/components/LpProgress.vue.js +4 -0
- package/dist/components/LpRadio.vue.js +4 -0
- package/dist/components/LpRadioGroup.vue.js +4 -0
- package/dist/components/LpScrollArea.vue.js +4 -0
- package/dist/components/LpSegmented.vue.js +4 -0
- package/dist/components/LpSelect.vue.d.ts +2 -0
- package/dist/components/LpSelect.vue.js +4 -0
- package/dist/components/LpServiceNode.vue.js +4 -0
- package/dist/components/LpSidebar.vue.js +4 -0
- package/dist/components/LpSidebarNav.vue.js +4 -0
- package/dist/components/LpSkeleton.vue.js +4 -0
- package/dist/components/LpSlider.vue.js +4 -0
- package/dist/components/LpStat.vue.js +4 -0
- package/dist/components/LpStepper.vue.js +4 -0
- package/dist/components/LpSwitch.vue.js +4 -0
- package/dist/components/LpTable.vue.js +4 -0
- package/dist/components/LpTableOfContents.vue.js +4 -0
- package/dist/components/LpTabs.vue.d.ts +4 -2
- package/dist/components/LpTabs.vue.js +4 -0
- package/dist/components/LpTextarea.vue.js +4 -0
- package/dist/components/LpThemeSwitcher.vue.js +4 -0
- package/dist/components/LpTilt.vue.d.ts +31 -0
- package/dist/components/LpTilt.vue.js +4 -0
- package/dist/components/LpToaster.vue.js +4 -0
- package/dist/components/LpTooltip.vue.js +4 -0
- package/dist/components/LpTopologyCanvas.vue.js +4 -0
- package/dist/components/LpUptimeBar.vue.js +4 -0
- package/dist/components/codeHighlight.js +230 -0
- package/dist/{countries-data-9rgqJWHo.js → components/countries-data.js} +2 -2
- package/dist/components/countries.js +38 -0
- package/dist/components/dropdown.js +14 -0
- package/dist/components/sidebar.js +1 -0
- package/dist/composables/useInputFilter.js +44 -0
- package/dist/composables/usePillTransition.js +11 -0
- package/dist/composables/useTilt.d.ts +23 -0
- package/dist/composables/useTilt.js +57 -0
- package/dist/composables/useToast.d.ts +2 -0
- package/dist/composables/useToast.js +49 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +197 -17596
- package/dist/layout/registry.js +10 -0
- package/dist/layout/tree.js +192 -0
- package/dist/layout/useLayout.js +61 -0
- package/package.json +5 -3
- package/src/component-names.ts +1 -0
- package/src/components/LpContextMenu.vue +14 -4
- package/src/components/LpDrawer.vue +29 -1
- package/src/components/LpLogViewer.vue +161 -31
- package/src/components/LpSelect.vue +0 -0
- package/src/components/LpSidebar.vue +5 -2
- package/src/components/LpTabs.vue +19 -6
- package/src/components/LpThemeSwitcher.vue +13 -2
- package/src/components/LpTilt.vue +61 -0
- package/src/components/LpToaster.vue +11 -4
- package/src/composables/useTilt.ts +103 -0
- package/src/composables/useToast.ts +2 -0
- package/src/index.ts +3 -0
- package/src/nuxt.ts +10 -1
- package/dist/index.css +0 -1
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { defineComponent, useModel, computed, openBlock, createBlock, withCtx, createElementVNode, toDisplayString, createElementBlock, createCommentVNode, Fragment, renderList, resolveDynamicComponent, normalizeClass, createVNode, createTextVNode, mergeModels } from "vue";
|
|
2
|
+
import { _ as _sfc_main$7 } from "./LpBadge-CXzBPnwO.js";
|
|
3
|
+
import { _ as _sfc_main$6 } from "./LpButton-5VXXCjwF.js";
|
|
4
|
+
import { _ as _sfc_main$4 } from "./LpContextMenu-D0mzXqA7.js";
|
|
5
|
+
import { _ as _sfc_main$2 } from "./LpEmptyState-CrfyRJUG.js";
|
|
6
|
+
import { _ as _sfc_main$5 } from "./LpIcon-CCnX5_2j.js";
|
|
7
|
+
import { _ as _sfc_main$1 } from "./LpPopover-8268UmlC.js";
|
|
8
|
+
import { _ as _sfc_main$3 } from "./LpScrollArea-CcHul_XS.js";
|
|
9
|
+
const _hoisted_1 = { class: "flex items-center justify-between gap-2 px-3 py-2.5" };
|
|
10
|
+
const _hoisted_2 = { class: "text-sm font-semibold" };
|
|
11
|
+
const _hoisted_3 = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "space-y-1.5 px-2 pb-2"
|
|
14
|
+
};
|
|
15
|
+
const _hoisted_4 = { class: "min-w-0 flex-1" };
|
|
16
|
+
const _hoisted_5 = { class: "flex items-center gap-1.5" };
|
|
17
|
+
const _hoisted_6 = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "size-1.5 shrink-0 rounded-full bg-brand"
|
|
20
|
+
};
|
|
21
|
+
const _hoisted_7 = {
|
|
22
|
+
key: 0,
|
|
23
|
+
class: "mt-0.5 line-clamp-2 block text-xs text-muted"
|
|
24
|
+
};
|
|
25
|
+
const _hoisted_8 = {
|
|
26
|
+
key: 1,
|
|
27
|
+
class: "mt-0.5 block text-[11px] text-muted/70"
|
|
28
|
+
};
|
|
29
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
30
|
+
__name: "LpNotificationBell",
|
|
31
|
+
props: /* @__PURE__ */ mergeModels({
|
|
32
|
+
items: { default: () => [] },
|
|
33
|
+
unreadCount: {},
|
|
34
|
+
loading: { type: Boolean },
|
|
35
|
+
emptyLabel: {},
|
|
36
|
+
title: {},
|
|
37
|
+
maxBadge: { default: 9 },
|
|
38
|
+
menuItems: {}
|
|
39
|
+
}, {
|
|
40
|
+
"open": { type: Boolean, ...{ default: false } },
|
|
41
|
+
"openModifiers": {}
|
|
42
|
+
}),
|
|
43
|
+
emits: /* @__PURE__ */ mergeModels(["markRead", "markUnread", "markAllRead", "dismiss", "select"], ["update:open"]),
|
|
44
|
+
setup(__props, { emit: __emit }) {
|
|
45
|
+
const props = __props;
|
|
46
|
+
const open = useModel(__props, "open");
|
|
47
|
+
const emit = __emit;
|
|
48
|
+
const unread = computed(
|
|
49
|
+
() => props.unreadCount ?? props.items.filter((n) => !n.read).length
|
|
50
|
+
);
|
|
51
|
+
const badgeLabel = computed(
|
|
52
|
+
() => unread.value > props.maxBadge ? `${props.maxBadge}+` : String(unread.value)
|
|
53
|
+
);
|
|
54
|
+
const hasUnread = computed(() => unread.value > 0);
|
|
55
|
+
const contextMenu = computed(
|
|
56
|
+
() => props.menuItems ?? [
|
|
57
|
+
{
|
|
58
|
+
label: "Mark all read",
|
|
59
|
+
icon: "lucide:check-check",
|
|
60
|
+
disabled: !hasUnread.value,
|
|
61
|
+
onSelect: () => emit("markAllRead")
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
);
|
|
65
|
+
function onSelect(item) {
|
|
66
|
+
if (!item.read) emit("markRead", item.id);
|
|
67
|
+
emit("select", item);
|
|
68
|
+
}
|
|
69
|
+
function rowMenu(item) {
|
|
70
|
+
const actions = [];
|
|
71
|
+
if (item.read) {
|
|
72
|
+
actions.push({
|
|
73
|
+
label: "Mark as unread",
|
|
74
|
+
icon: "lucide:dot",
|
|
75
|
+
onSelect: () => emit("markUnread", item.id)
|
|
76
|
+
});
|
|
77
|
+
} else {
|
|
78
|
+
actions.push({
|
|
79
|
+
label: "Mark as read",
|
|
80
|
+
icon: "lucide:check",
|
|
81
|
+
onSelect: () => emit("markRead", item.id)
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (item.link) {
|
|
85
|
+
actions.push({
|
|
86
|
+
label: "Open",
|
|
87
|
+
icon: "lucide:external-link",
|
|
88
|
+
onSelect: () => emit("select", item)
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
actions.push({
|
|
92
|
+
label: "Dismiss",
|
|
93
|
+
icon: "lucide:x",
|
|
94
|
+
danger: true,
|
|
95
|
+
separatorBefore: true,
|
|
96
|
+
onSelect: () => emit("dismiss", item.id)
|
|
97
|
+
});
|
|
98
|
+
return actions;
|
|
99
|
+
}
|
|
100
|
+
function timeAgo(iso) {
|
|
101
|
+
if (!iso) return "";
|
|
102
|
+
const then = new Date(iso).getTime();
|
|
103
|
+
if (Number.isNaN(then)) return "";
|
|
104
|
+
const secs = Math.max(0, Math.round((Date.now() - then) / 1e3));
|
|
105
|
+
if (secs < 45) return "just now";
|
|
106
|
+
const mins = Math.round(secs / 60);
|
|
107
|
+
if (mins < 60) return `${mins}m`;
|
|
108
|
+
const hrs = Math.round(mins / 60);
|
|
109
|
+
if (hrs < 24) return `${hrs}h`;
|
|
110
|
+
const days = Math.round(hrs / 24);
|
|
111
|
+
if (days < 7) return `${days}d`;
|
|
112
|
+
return new Date(then).toLocaleDateString();
|
|
113
|
+
}
|
|
114
|
+
return (_ctx, _cache) => {
|
|
115
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
116
|
+
open: open.value,
|
|
117
|
+
"onUpdate:open": _cache[2] || (_cache[2] = ($event) => open.value = $event),
|
|
118
|
+
side: "bottom",
|
|
119
|
+
align: "end",
|
|
120
|
+
"side-offset": 8,
|
|
121
|
+
"panel-class": "w-80 p-0"
|
|
122
|
+
}, {
|
|
123
|
+
trigger: withCtx(() => [
|
|
124
|
+
createVNode(_sfc_main$4, { items: contextMenu.value }, {
|
|
125
|
+
default: withCtx(() => [
|
|
126
|
+
createVNode(_sfc_main$6, {
|
|
127
|
+
variant: "ghost",
|
|
128
|
+
size: "sm",
|
|
129
|
+
class: "relative",
|
|
130
|
+
"aria-label": "Notifications",
|
|
131
|
+
onClick: _cache[0] || (_cache[0] = ($event) => open.value = !open.value)
|
|
132
|
+
}, {
|
|
133
|
+
default: withCtx(() => [
|
|
134
|
+
createVNode(_sfc_main$5, {
|
|
135
|
+
name: "lucide:bell",
|
|
136
|
+
size: 18
|
|
137
|
+
}),
|
|
138
|
+
hasUnread.value ? (openBlock(), createBlock(_sfc_main$7, {
|
|
139
|
+
key: 0,
|
|
140
|
+
tone: "danger",
|
|
141
|
+
class: "absolute -right-1 -top-1 min-w-4 justify-center px-1 py-0 text-[10px] leading-4"
|
|
142
|
+
}, {
|
|
143
|
+
default: withCtx(() => [
|
|
144
|
+
createTextVNode(toDisplayString(badgeLabel.value), 1)
|
|
145
|
+
]),
|
|
146
|
+
_: 1
|
|
147
|
+
})) : createCommentVNode("", true)
|
|
148
|
+
]),
|
|
149
|
+
_: 1
|
|
150
|
+
})
|
|
151
|
+
]),
|
|
152
|
+
_: 1
|
|
153
|
+
}, 8, ["items"])
|
|
154
|
+
]),
|
|
155
|
+
default: withCtx(() => [
|
|
156
|
+
createElementVNode("header", _hoisted_1, [
|
|
157
|
+
createElementVNode("span", _hoisted_2, toDisplayString(__props.title ?? "Notifications"), 1),
|
|
158
|
+
hasUnread.value ? (openBlock(), createElementBlock("button", {
|
|
159
|
+
key: 0,
|
|
160
|
+
type: "button",
|
|
161
|
+
class: "rounded-md px-1.5 py-0.5 text-xs font-medium text-brand outline-none transition-colors hover:bg-brand-soft focus-visible:bg-brand-soft",
|
|
162
|
+
onClick: _cache[1] || (_cache[1] = ($event) => emit("markAllRead"))
|
|
163
|
+
}, " Mark all read ")) : createCommentVNode("", true)
|
|
164
|
+
]),
|
|
165
|
+
__props.loading ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
166
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(4, (i) => {
|
|
167
|
+
return createElementVNode("div", {
|
|
168
|
+
key: i,
|
|
169
|
+
class: "h-12 animate-pulse rounded-control bg-surface-soft"
|
|
170
|
+
});
|
|
171
|
+
}), 64))
|
|
172
|
+
])) : !__props.items.length ? (openBlock(), createBlock(_sfc_main$2, {
|
|
173
|
+
key: 1,
|
|
174
|
+
icon: "lucide:bell-off",
|
|
175
|
+
title: __props.emptyLabel ?? "No notifications",
|
|
176
|
+
class: "px-3 py-10"
|
|
177
|
+
}, null, 8, ["title"])) : (openBlock(), createBlock(_sfc_main$3, {
|
|
178
|
+
key: 2,
|
|
179
|
+
class: "max-h-96",
|
|
180
|
+
"content-class": "flex flex-col gap-0.5 px-2 pb-2"
|
|
181
|
+
}, {
|
|
182
|
+
default: withCtx(() => [
|
|
183
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
|
|
184
|
+
return openBlock(), createBlock(_sfc_main$4, {
|
|
185
|
+
key: item.id,
|
|
186
|
+
items: rowMenu(item)
|
|
187
|
+
}, {
|
|
188
|
+
default: withCtx(() => [
|
|
189
|
+
(openBlock(), createBlock(resolveDynamicComponent(item.link ? "a" : "button"), {
|
|
190
|
+
href: item.link || void 0,
|
|
191
|
+
type: item.link ? void 0 : "button",
|
|
192
|
+
class: normalizeClass(["group/notif flex w-full items-start gap-2.5 rounded-control px-2 py-2 text-left outline-none transition-colors hover:bg-white/[0.05] focus-visible:bg-white/[0.05]", item.read ? "" : "bg-brand-soft/35"]),
|
|
193
|
+
onClick: ($event) => onSelect(item)
|
|
194
|
+
}, {
|
|
195
|
+
default: withCtx(() => [
|
|
196
|
+
createElementVNode("span", {
|
|
197
|
+
class: normalizeClass(["grid size-7 shrink-0 place-items-center rounded-control", item.read ? "bg-surface-soft text-muted" : "bg-brand-soft text-brand"])
|
|
198
|
+
}, [
|
|
199
|
+
createVNode(_sfc_main$5, {
|
|
200
|
+
name: item.icon || "lucide:bell",
|
|
201
|
+
size: 15
|
|
202
|
+
}, null, 8, ["name"])
|
|
203
|
+
], 2),
|
|
204
|
+
createElementVNode("span", _hoisted_4, [
|
|
205
|
+
createElementVNode("span", _hoisted_5, [
|
|
206
|
+
createElementVNode("span", {
|
|
207
|
+
class: normalizeClass(["truncate text-sm font-medium", item.read ? "text-muted-strong" : "text-ink"])
|
|
208
|
+
}, toDisplayString(item.title), 3),
|
|
209
|
+
!item.read ? (openBlock(), createElementBlock("span", _hoisted_6)) : createCommentVNode("", true)
|
|
210
|
+
]),
|
|
211
|
+
item.body ? (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(item.body), 1)) : createCommentVNode("", true),
|
|
212
|
+
item.createdAt ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(timeAgo(item.createdAt)), 1)) : createCommentVNode("", true)
|
|
213
|
+
])
|
|
214
|
+
]),
|
|
215
|
+
_: 2
|
|
216
|
+
}, 1032, ["href", "type", "class", "onClick"]))
|
|
217
|
+
]),
|
|
218
|
+
_: 2
|
|
219
|
+
}, 1032, ["items"]);
|
|
220
|
+
}), 128))
|
|
221
|
+
]),
|
|
222
|
+
_: 1
|
|
223
|
+
}))
|
|
224
|
+
]),
|
|
225
|
+
_: 1
|
|
226
|
+
}, 8, ["open"]);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
export {
|
|
231
|
+
_sfc_main as _
|
|
232
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createBlock, unref, withCtx, createVNode } from "vue";
|
|
2
|
+
import { NumberFieldRoot, NumberFieldDecrement, NumberFieldInput, NumberFieldIncrement } from "reka-ui";
|
|
3
|
+
import { _ as _sfc_main$1 } from "./LpIcon-CCnX5_2j.js";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "LpNumberField",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: {},
|
|
8
|
+
min: {},
|
|
9
|
+
max: {},
|
|
10
|
+
step: {},
|
|
11
|
+
disabled: { type: Boolean }
|
|
12
|
+
},
|
|
13
|
+
emits: ["update:modelValue"],
|
|
14
|
+
setup(__props) {
|
|
15
|
+
return (_ctx, _cache) => {
|
|
16
|
+
return openBlock(), createBlock(unref(NumberFieldRoot), {
|
|
17
|
+
"model-value": __props.modelValue ?? void 0,
|
|
18
|
+
min: __props.min,
|
|
19
|
+
max: __props.max,
|
|
20
|
+
step: __props.step,
|
|
21
|
+
disabled: __props.disabled,
|
|
22
|
+
class: "flex h-(--size-control-md) w-full items-center rounded-control border border-line bg-surface-soft transition-colors duration-[var(--duration-fast)] focus-within:border-brand focus-within:ring-2 focus-within:ring-ring data-[disabled]:cursor-not-allowed data-[disabled]:opacity-55",
|
|
23
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = (v) => _ctx.$emit("update:modelValue", v ?? null))
|
|
24
|
+
}, {
|
|
25
|
+
default: withCtx(() => [
|
|
26
|
+
createVNode(unref(NumberFieldDecrement), { class: "group grid h-full w-8 place-items-center text-muted transition-colors duration-[var(--duration-fast)] hover:text-ink disabled:opacity-40" }, {
|
|
27
|
+
default: withCtx(() => [
|
|
28
|
+
createVNode(_sfc_main$1, {
|
|
29
|
+
name: "lucide:minus",
|
|
30
|
+
size: 15,
|
|
31
|
+
class: "transition-transform duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] group-active:scale-75 motion-reduce:group-active:scale-100"
|
|
32
|
+
})
|
|
33
|
+
]),
|
|
34
|
+
_: 1
|
|
35
|
+
}),
|
|
36
|
+
createVNode(unref(NumberFieldInput), { class: "min-w-0 flex-1 bg-transparent text-center text-sm text-ink outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none" }),
|
|
37
|
+
createVNode(unref(NumberFieldIncrement), { class: "group grid h-full w-8 place-items-center text-muted transition-colors duration-[var(--duration-fast)] hover:text-ink disabled:opacity-40" }, {
|
|
38
|
+
default: withCtx(() => [
|
|
39
|
+
createVNode(_sfc_main$1, {
|
|
40
|
+
name: "lucide:plus",
|
|
41
|
+
size: 15,
|
|
42
|
+
class: "transition-transform duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] group-active:scale-75 motion-reduce:group-active:scale-100"
|
|
43
|
+
})
|
|
44
|
+
]),
|
|
45
|
+
_: 1
|
|
46
|
+
})
|
|
47
|
+
]),
|
|
48
|
+
_: 1
|
|
49
|
+
}, 8, ["model-value", "min", "max", "step", "disabled"]);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
_sfc_main as _
|
|
55
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createElementBlock, Fragment, renderList, normalizeClass } from "vue";
|
|
2
|
+
import { PinInputRoot, PinInputInput } from "reka-ui";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "LpOtpInput",
|
|
5
|
+
props: {
|
|
6
|
+
modelValue: {},
|
|
7
|
+
length: { default: 6 },
|
|
8
|
+
disabled: { type: Boolean },
|
|
9
|
+
mask: { type: Boolean },
|
|
10
|
+
alphanumeric: { type: Boolean, default: false },
|
|
11
|
+
invalid: { type: Boolean },
|
|
12
|
+
size: { default: "md" }
|
|
13
|
+
},
|
|
14
|
+
emits: ["update:modelValue", "complete"],
|
|
15
|
+
setup(__props, { emit: __emit }) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
const emit = __emit;
|
|
18
|
+
const cells = computed({
|
|
19
|
+
get: () => (props.modelValue ?? "").split("").slice(0, props.length),
|
|
20
|
+
set: (arr) => emit("update:modelValue", arr.join(""))
|
|
21
|
+
});
|
|
22
|
+
function onComplete(arr) {
|
|
23
|
+
emit("complete", arr.join(""));
|
|
24
|
+
}
|
|
25
|
+
const cellSize = {
|
|
26
|
+
sm: "size-9 text-base",
|
|
27
|
+
md: "size-11 text-lg",
|
|
28
|
+
lg: "size-13 text-xl"
|
|
29
|
+
};
|
|
30
|
+
return (_ctx, _cache) => {
|
|
31
|
+
return openBlock(), createBlock(unref(PinInputRoot), {
|
|
32
|
+
modelValue: cells.value,
|
|
33
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => cells.value = $event),
|
|
34
|
+
type: __props.alphanumeric ? "text" : "number",
|
|
35
|
+
mask: __props.mask,
|
|
36
|
+
disabled: __props.disabled,
|
|
37
|
+
otp: "",
|
|
38
|
+
class: "flex items-center gap-2",
|
|
39
|
+
onComplete
|
|
40
|
+
}, {
|
|
41
|
+
default: withCtx(() => [
|
|
42
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.length, (i) => {
|
|
43
|
+
return openBlock(), createBlock(unref(PinInputInput), {
|
|
44
|
+
key: i,
|
|
45
|
+
index: i - 1,
|
|
46
|
+
"aria-invalid": __props.invalid || void 0,
|
|
47
|
+
class: normalizeClass([
|
|
48
|
+
cellSize[__props.size],
|
|
49
|
+
"rounded-control border bg-surface-soft text-center font-semibold text-ink caret-brand",
|
|
50
|
+
"outline-none transition-colors duration-[var(--duration-fast)]",
|
|
51
|
+
"focus:border-brand focus:ring-2 focus:ring-ring",
|
|
52
|
+
"disabled:cursor-not-allowed disabled:opacity-55",
|
|
53
|
+
__props.invalid ? "border-danger focus:border-danger focus:ring-danger-soft" : "border-line"
|
|
54
|
+
])
|
|
55
|
+
}, null, 8, ["index", "aria-invalid", "class"]);
|
|
56
|
+
}), 128))
|
|
57
|
+
]),
|
|
58
|
+
_: 1
|
|
59
|
+
}, 8, ["modelValue", "type", "mask", "disabled"]);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
export {
|
|
64
|
+
_sfc_main as _
|
|
65
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { defineComponent, computed, useId, openBlock, createElementBlock, createElementVNode, normalizeClass, createVNode, Fragment, renderList, createBlock, unref, createCommentVNode, toDisplayString } from "vue";
|
|
2
|
+
import { Motion } from "motion-v";
|
|
3
|
+
import { usePillTransition } from "../composables/usePillTransition.js";
|
|
4
|
+
import { _ as _sfc_main$1 } from "./LpIcon-CCnX5_2j.js";
|
|
5
|
+
const _hoisted_1 = {
|
|
6
|
+
class: "flex items-center gap-1.5",
|
|
7
|
+
"aria-label": "Pagination"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_2 = ["disabled"];
|
|
10
|
+
const _hoisted_3 = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "flex size-(--size-control-sm) items-center justify-center text-sm text-muted select-none",
|
|
13
|
+
"aria-hidden": "true"
|
|
14
|
+
};
|
|
15
|
+
const _hoisted_4 = ["disabled", "aria-current", "onClick"];
|
|
16
|
+
const _hoisted_5 = { class: "relative z-10" };
|
|
17
|
+
const _hoisted_6 = ["disabled"];
|
|
18
|
+
const navBase = "relative flex size-(--size-control-sm) items-center justify-center rounded-control text-sm outline-none transition-[color,border-color,scale] duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] active:scale-95 motion-reduce:active:scale-100 focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-45 disabled:active:scale-100";
|
|
19
|
+
const navArrow = "border border-line text-muted hover:border-line-strong hover:text-ink disabled:hover:border-line disabled:hover:text-muted";
|
|
20
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
21
|
+
__name: "LpPagination",
|
|
22
|
+
props: {
|
|
23
|
+
page: { default: 1 },
|
|
24
|
+
total: {},
|
|
25
|
+
pageSize: { default: 10 },
|
|
26
|
+
pageCount: {},
|
|
27
|
+
siblings: { default: 1 },
|
|
28
|
+
disabled: { type: Boolean }
|
|
29
|
+
},
|
|
30
|
+
emits: ["update:page", "change"],
|
|
31
|
+
setup(__props, { emit: __emit }) {
|
|
32
|
+
const props = __props;
|
|
33
|
+
const emit = __emit;
|
|
34
|
+
const count = computed(() => {
|
|
35
|
+
if (props.pageCount != null) return Math.max(1, props.pageCount);
|
|
36
|
+
if (props.total != null) return Math.max(1, Math.ceil(props.total / props.pageSize));
|
|
37
|
+
return 1;
|
|
38
|
+
});
|
|
39
|
+
const current = computed(() => Math.min(Math.max(1, props.page), count.value));
|
|
40
|
+
const slots = computed(() => {
|
|
41
|
+
const c = count.value;
|
|
42
|
+
const cur = current.value;
|
|
43
|
+
const inner = props.siblings * 2 + 1;
|
|
44
|
+
const total = inner + 4;
|
|
45
|
+
if (c <= total) {
|
|
46
|
+
return Array.from({ length: c }, (_, i) => ({ kind: "page", page: i + 1 }));
|
|
47
|
+
}
|
|
48
|
+
let lo = cur - props.siblings;
|
|
49
|
+
let hi = cur + props.siblings;
|
|
50
|
+
if (lo < 3) {
|
|
51
|
+
hi += 3 - lo;
|
|
52
|
+
lo = 3;
|
|
53
|
+
}
|
|
54
|
+
if (hi > c - 2) {
|
|
55
|
+
lo -= hi - (c - 2);
|
|
56
|
+
hi = c - 2;
|
|
57
|
+
}
|
|
58
|
+
const out = [{ kind: "page", page: 1 }];
|
|
59
|
+
out.push(lo > 3 ? { kind: "gap" } : { kind: "page", page: 2 });
|
|
60
|
+
for (let p = lo; p <= hi; p++) out.push({ kind: "page", page: p });
|
|
61
|
+
out.push(hi < c - 2 ? { kind: "gap" } : { kind: "page", page: c - 1 });
|
|
62
|
+
out.push({ kind: "page", page: c });
|
|
63
|
+
return out;
|
|
64
|
+
});
|
|
65
|
+
function go(p) {
|
|
66
|
+
if (props.disabled) return;
|
|
67
|
+
const next = Math.min(Math.max(1, p), count.value);
|
|
68
|
+
if (next === current.value) return;
|
|
69
|
+
emit("update:page", next);
|
|
70
|
+
emit("change", next);
|
|
71
|
+
}
|
|
72
|
+
const pillId = `lp-page-indicator-${useId()}`;
|
|
73
|
+
const pillTransition = usePillTransition();
|
|
74
|
+
return (_ctx, _cache) => {
|
|
75
|
+
return openBlock(), createElementBlock("nav", _hoisted_1, [
|
|
76
|
+
createElementVNode("button", {
|
|
77
|
+
type: "button",
|
|
78
|
+
class: normalizeClass([navBase, navArrow]),
|
|
79
|
+
disabled: __props.disabled || current.value === 1,
|
|
80
|
+
"aria-label": "Previous page",
|
|
81
|
+
onClick: _cache[0] || (_cache[0] = ($event) => go(current.value - 1))
|
|
82
|
+
}, [
|
|
83
|
+
createVNode(_sfc_main$1, {
|
|
84
|
+
name: "lucide:chevron-left",
|
|
85
|
+
size: 16
|
|
86
|
+
})
|
|
87
|
+
], 10, _hoisted_2),
|
|
88
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(slots.value, (slot, i) => {
|
|
89
|
+
return openBlock(), createElementBlock(Fragment, {
|
|
90
|
+
key: `slot-${i}`
|
|
91
|
+
}, [
|
|
92
|
+
slot.kind === "gap" ? (openBlock(), createElementBlock("span", _hoisted_3, "…")) : (openBlock(), createElementBlock("button", {
|
|
93
|
+
key: 1,
|
|
94
|
+
type: "button",
|
|
95
|
+
class: normalizeClass([
|
|
96
|
+
navBase,
|
|
97
|
+
"min-w-(--size-control-sm) px-2",
|
|
98
|
+
slot.page === current.value ? "text-ink-inverse" : "border border-line text-muted hover:border-line-strong hover:text-ink"
|
|
99
|
+
]),
|
|
100
|
+
disabled: __props.disabled,
|
|
101
|
+
"aria-current": slot.page === current.value ? "page" : void 0,
|
|
102
|
+
onClick: ($event) => go(slot.page)
|
|
103
|
+
}, [
|
|
104
|
+
slot.page === current.value ? (openBlock(), createBlock(unref(Motion), {
|
|
105
|
+
key: 0,
|
|
106
|
+
"layout-id": pillId,
|
|
107
|
+
transition: unref(pillTransition),
|
|
108
|
+
class: "absolute inset-0 z-0 rounded-control bg-brand"
|
|
109
|
+
}, null, 8, ["transition"])) : createCommentVNode("", true),
|
|
110
|
+
createElementVNode("span", _hoisted_5, toDisplayString(slot.page), 1)
|
|
111
|
+
], 10, _hoisted_4))
|
|
112
|
+
], 64);
|
|
113
|
+
}), 128)),
|
|
114
|
+
createElementVNode("button", {
|
|
115
|
+
type: "button",
|
|
116
|
+
class: normalizeClass([navBase, navArrow]),
|
|
117
|
+
disabled: __props.disabled || current.value === count.value,
|
|
118
|
+
"aria-label": "Next page",
|
|
119
|
+
onClick: _cache[1] || (_cache[1] = ($event) => go(current.value + 1))
|
|
120
|
+
}, [
|
|
121
|
+
createVNode(_sfc_main$1, {
|
|
122
|
+
name: "lucide:chevron-right",
|
|
123
|
+
size: 16
|
|
124
|
+
})
|
|
125
|
+
], 10, _hoisted_6)
|
|
126
|
+
]);
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
export {
|
|
131
|
+
_sfc_main as _
|
|
132
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { defineComponent, ref, openBlock, createBlock, createSlots, withCtx, createElementVNode, createVNode, renderSlot } from "vue";
|
|
2
|
+
import { _ as _sfc_main$2 } from "./LpIcon-CCnX5_2j.js";
|
|
3
|
+
import { _ as _sfc_main$1 } from "./LpInput-BauZRyzm.js";
|
|
4
|
+
const _hoisted_1 = ["aria-label"];
|
|
5
|
+
const __default__ = { inheritAttrs: false };
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
...__default__,
|
|
8
|
+
__name: "LpPasswordInput",
|
|
9
|
+
props: {
|
|
10
|
+
modelValue: {},
|
|
11
|
+
placeholder: {},
|
|
12
|
+
invalid: { type: Boolean },
|
|
13
|
+
disabled: { type: Boolean }
|
|
14
|
+
},
|
|
15
|
+
emits: ["update:modelValue"],
|
|
16
|
+
setup(__props, { expose: __expose }) {
|
|
17
|
+
const visible = ref(false);
|
|
18
|
+
const inner = ref(null);
|
|
19
|
+
__expose({
|
|
20
|
+
focus: (options) => inner.value?.focus(options),
|
|
21
|
+
blur: () => inner.value?.blur(),
|
|
22
|
+
select: () => inner.value?.select()
|
|
23
|
+
});
|
|
24
|
+
return (_ctx, _cache) => {
|
|
25
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
26
|
+
ref_key: "inner",
|
|
27
|
+
ref: inner,
|
|
28
|
+
"model-value": __props.modelValue,
|
|
29
|
+
type: visible.value ? "text" : "password",
|
|
30
|
+
placeholder: __props.placeholder,
|
|
31
|
+
invalid: __props.invalid,
|
|
32
|
+
disabled: __props.disabled,
|
|
33
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = (v) => _ctx.$emit("update:modelValue", v))
|
|
34
|
+
}, createSlots({
|
|
35
|
+
trailing: withCtx(() => [
|
|
36
|
+
createElementVNode("button", {
|
|
37
|
+
type: "button",
|
|
38
|
+
class: "group rounded-md p-1 text-muted outline-none transition-colors duration-[var(--duration-fast)] hover:text-ink focus-visible:text-ink",
|
|
39
|
+
"aria-label": visible.value ? "Hide password" : "Show password",
|
|
40
|
+
onClick: _cache[0] || (_cache[0] = ($event) => visible.value = !visible.value)
|
|
41
|
+
}, [
|
|
42
|
+
createVNode(_sfc_main$2, {
|
|
43
|
+
name: visible.value ? "lucide:eye-off" : "lucide:eye",
|
|
44
|
+
size: 16,
|
|
45
|
+
class: "transition-transform duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] group-active:scale-90 motion-reduce:group-active:scale-100"
|
|
46
|
+
}, null, 8, ["name"])
|
|
47
|
+
], 8, _hoisted_1)
|
|
48
|
+
]),
|
|
49
|
+
_: 2
|
|
50
|
+
}, [
|
|
51
|
+
_ctx.$slots.leading ? {
|
|
52
|
+
name: "leading",
|
|
53
|
+
fn: withCtx(() => [
|
|
54
|
+
renderSlot(_ctx.$slots, "leading")
|
|
55
|
+
]),
|
|
56
|
+
key: "0"
|
|
57
|
+
} : void 0
|
|
58
|
+
]), 1032, ["model-value", "type", "placeholder", "invalid", "disabled"]);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
export {
|
|
63
|
+
_sfc_main as _
|
|
64
|
+
};
|