@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,199 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, onMounted, openBlock, createElementBlock, normalizeClass, createVNode, unref, withCtx, createElementVNode, toDisplayString, createTextVNode, Fragment, renderList, createBlock, withModifiers, normalizeStyle } from "vue";
|
|
2
|
+
import { ComboboxRoot, ComboboxAnchor, ComboboxTrigger, ComboboxPortal, ComboboxContent, ComboboxInput, ComboboxViewport, ComboboxEmpty, ComboboxItem } from "reka-ui";
|
|
3
|
+
import { useInputFilter } from "../composables/useInputFilter.js";
|
|
4
|
+
import { matchCountryByValue, loadCountries, flagEmoji } from "../components/countries.js";
|
|
5
|
+
import { POPOVER_PANEL, OPTION_ITEM } from "../components/dropdown.js";
|
|
6
|
+
import { _ as _sfc_main$1 } from "./LpIcon-CCnX5_2j.js";
|
|
7
|
+
const _hoisted_1 = { class: "text-base leading-none" };
|
|
8
|
+
const _hoisted_2 = { class: "border-b border-line p-2" };
|
|
9
|
+
const _hoisted_3 = { class: "text-base leading-none" };
|
|
10
|
+
const _hoisted_4 = { class: "min-w-0 flex-1 truncate" };
|
|
11
|
+
const _hoisted_5 = { class: "shrink-0 text-xs text-muted" };
|
|
12
|
+
const _hoisted_6 = ["value", "placeholder", "disabled", "aria-invalid"];
|
|
13
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
14
|
+
__name: "LpPhoneInput",
|
|
15
|
+
props: {
|
|
16
|
+
modelValue: {},
|
|
17
|
+
only: {},
|
|
18
|
+
defaultCountry: {},
|
|
19
|
+
placeholder: { default: "Phone number" },
|
|
20
|
+
disabled: { type: Boolean },
|
|
21
|
+
invalid: { type: Boolean },
|
|
22
|
+
size: { default: "md" },
|
|
23
|
+
emptyText: { default: "No country" },
|
|
24
|
+
searchPlaceholder: { default: "Search country…" }
|
|
25
|
+
},
|
|
26
|
+
emits: ["update:modelValue", "change"],
|
|
27
|
+
setup(__props, { emit: __emit }) {
|
|
28
|
+
const props = __props;
|
|
29
|
+
const emit = __emit;
|
|
30
|
+
const PHONE_CHARS = /[\d+()\-\s]/;
|
|
31
|
+
const { onBeforeInput, onPaste } = useInputFilter({ restrict: () => PHONE_CHARS });
|
|
32
|
+
const allCountries = ref([]);
|
|
33
|
+
const countries = computed(() => {
|
|
34
|
+
if (!props.only?.length) return allCountries.value;
|
|
35
|
+
const set = new Set(props.only.map((c) => c.toUpperCase()));
|
|
36
|
+
return allCountries.value.filter((c) => set.has(c.iso2));
|
|
37
|
+
});
|
|
38
|
+
const fallback = computed(() => {
|
|
39
|
+
const iso = props.defaultCountry?.toUpperCase();
|
|
40
|
+
return iso ? countries.value.find((c) => c.iso2 === iso) : void 0;
|
|
41
|
+
});
|
|
42
|
+
const activeCountry = computed(
|
|
43
|
+
() => matchCountryByValue(props.modelValue ?? "", countries.value) ?? fallback.value
|
|
44
|
+
);
|
|
45
|
+
const open = ref(false);
|
|
46
|
+
const query = ref("");
|
|
47
|
+
const filtered = computed(() => {
|
|
48
|
+
const q = query.value.trim().toLowerCase();
|
|
49
|
+
if (!q) return countries.value;
|
|
50
|
+
return countries.value.filter(
|
|
51
|
+
(c) => c.name.toLowerCase().includes(q) || c.dial.includes(q.replace(/\D/g, ""))
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
function parse(value) {
|
|
55
|
+
const country = matchCountryByValue(value, countries.value);
|
|
56
|
+
const digits = value.replace(/[^\d]/g, "");
|
|
57
|
+
if (country) {
|
|
58
|
+
return { country, dialCode: country.dial, number: digits.slice(country.dial.length) };
|
|
59
|
+
}
|
|
60
|
+
return { country: void 0, dialCode: "", number: digits };
|
|
61
|
+
}
|
|
62
|
+
function setValue(value) {
|
|
63
|
+
emit("update:modelValue", value);
|
|
64
|
+
emit("change", parse(value));
|
|
65
|
+
}
|
|
66
|
+
function onInput(e) {
|
|
67
|
+
setValue(e.target.value);
|
|
68
|
+
}
|
|
69
|
+
function chooseCountry(c) {
|
|
70
|
+
const detail = parse(props.modelValue ?? "");
|
|
71
|
+
const national = detail.number;
|
|
72
|
+
setValue(`+${c.dial}${national ? " " + national : ""}`);
|
|
73
|
+
open.value = false;
|
|
74
|
+
query.value = "";
|
|
75
|
+
}
|
|
76
|
+
onMounted(async () => {
|
|
77
|
+
allCountries.value = await loadCountries();
|
|
78
|
+
if (!props.modelValue && fallback.value) {
|
|
79
|
+
emit("update:modelValue", `+${fallback.value.dial} `);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const sizeClass = {
|
|
83
|
+
sm: "h-(--size-control-sm) text-xs",
|
|
84
|
+
md: "h-(--size-control-md) text-sm",
|
|
85
|
+
lg: "h-(--size-control-lg) text-sm"
|
|
86
|
+
};
|
|
87
|
+
return (_ctx, _cache) => {
|
|
88
|
+
return openBlock(), createElementBlock("div", {
|
|
89
|
+
class: normalizeClass(["flex w-full items-stretch rounded-control border bg-surface-soft text-ink transition-colors duration-[var(--duration-fast)] focus-within:ring-2 focus-within:ring-ring", [
|
|
90
|
+
sizeClass[__props.size],
|
|
91
|
+
__props.invalid ? "border-danger focus-within:border-danger focus-within:ring-danger-soft" : "border-line focus-within:border-brand",
|
|
92
|
+
__props.disabled ? "cursor-not-allowed opacity-55" : ""
|
|
93
|
+
]])
|
|
94
|
+
}, [
|
|
95
|
+
createVNode(unref(ComboboxRoot), {
|
|
96
|
+
open: open.value,
|
|
97
|
+
"onUpdate:open": _cache[1] || (_cache[1] = ($event) => open.value = $event),
|
|
98
|
+
"ignore-filter": true,
|
|
99
|
+
disabled: __props.disabled,
|
|
100
|
+
class: "flex"
|
|
101
|
+
}, {
|
|
102
|
+
default: withCtx(() => [
|
|
103
|
+
createVNode(unref(ComboboxAnchor), { "as-child": "" }, {
|
|
104
|
+
default: withCtx(() => [
|
|
105
|
+
createVNode(unref(ComboboxTrigger), {
|
|
106
|
+
type: "button",
|
|
107
|
+
disabled: __props.disabled,
|
|
108
|
+
class: "flex shrink-0 items-center gap-1 rounded-l-control border-r border-line px-2.5 outline-none hover:bg-white/[0.04] data-[state=open]:bg-white/[0.04]",
|
|
109
|
+
"aria-label": "Select country"
|
|
110
|
+
}, {
|
|
111
|
+
default: withCtx(() => [
|
|
112
|
+
createElementVNode("span", _hoisted_1, toDisplayString(activeCountry.value ? unref(flagEmoji)(activeCountry.value.iso2) : "🌐"), 1),
|
|
113
|
+
createVNode(_sfc_main$1, {
|
|
114
|
+
name: "lucide:chevron-down",
|
|
115
|
+
size: 14,
|
|
116
|
+
class: "text-muted transition-transform data-[state=open]:rotate-180"
|
|
117
|
+
})
|
|
118
|
+
]),
|
|
119
|
+
_: 1
|
|
120
|
+
}, 8, ["disabled"])
|
|
121
|
+
]),
|
|
122
|
+
_: 1
|
|
123
|
+
}),
|
|
124
|
+
createVNode(unref(ComboboxPortal), null, {
|
|
125
|
+
default: withCtx(() => [
|
|
126
|
+
createVNode(unref(ComboboxContent), {
|
|
127
|
+
position: "popper",
|
|
128
|
+
align: "start",
|
|
129
|
+
"side-offset": 6,
|
|
130
|
+
class: normalizeClass([unref(POPOVER_PANEL), "z-(--z-popover) max-h-72 w-72 overflow-hidden"])
|
|
131
|
+
}, {
|
|
132
|
+
default: withCtx(() => [
|
|
133
|
+
createElementVNode("div", _hoisted_2, [
|
|
134
|
+
createVNode(unref(ComboboxInput), {
|
|
135
|
+
"model-value": query.value,
|
|
136
|
+
placeholder: __props.searchPlaceholder,
|
|
137
|
+
"auto-focus": "",
|
|
138
|
+
class: "h-(--size-control-sm) w-full rounded-md border border-line bg-surface-soft px-2.5 text-sm text-ink outline-none placeholder:text-muted focus:border-brand",
|
|
139
|
+
onInput: _cache[0] || (_cache[0] = ($event) => query.value = $event.target.value)
|
|
140
|
+
}, null, 8, ["model-value", "placeholder"])
|
|
141
|
+
]),
|
|
142
|
+
createVNode(unref(ComboboxViewport), { class: "max-h-56 overflow-y-auto p-1" }, {
|
|
143
|
+
default: withCtx(() => [
|
|
144
|
+
createVNode(unref(ComboboxEmpty), { class: "px-3 py-4 text-center text-sm italic text-muted" }, {
|
|
145
|
+
default: withCtx(() => [
|
|
146
|
+
createTextVNode(toDisplayString(__props.emptyText), 1)
|
|
147
|
+
]),
|
|
148
|
+
_: 1
|
|
149
|
+
}),
|
|
150
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(filtered.value, (c, i) => {
|
|
151
|
+
return openBlock(), createBlock(unref(ComboboxItem), {
|
|
152
|
+
key: c.iso2,
|
|
153
|
+
value: c.iso2,
|
|
154
|
+
style: normalizeStyle({ animationDelay: `${Math.min(i, 12) * 22}ms` }),
|
|
155
|
+
class: normalizeClass([unref(OPTION_ITEM), "gap-2.5"]),
|
|
156
|
+
onSelect: withModifiers(($event) => chooseCountry(c), ["prevent"])
|
|
157
|
+
}, {
|
|
158
|
+
default: withCtx(() => [
|
|
159
|
+
createElementVNode("span", _hoisted_3, toDisplayString(unref(flagEmoji)(c.iso2)), 1),
|
|
160
|
+
createElementVNode("span", _hoisted_4, toDisplayString(c.name), 1),
|
|
161
|
+
createElementVNode("span", _hoisted_5, "+" + toDisplayString(c.dial), 1)
|
|
162
|
+
]),
|
|
163
|
+
_: 2
|
|
164
|
+
}, 1032, ["value", "style", "class", "onSelect"]);
|
|
165
|
+
}), 128))
|
|
166
|
+
]),
|
|
167
|
+
_: 1
|
|
168
|
+
})
|
|
169
|
+
]),
|
|
170
|
+
_: 1
|
|
171
|
+
}, 8, ["class"])
|
|
172
|
+
]),
|
|
173
|
+
_: 1
|
|
174
|
+
})
|
|
175
|
+
]),
|
|
176
|
+
_: 1
|
|
177
|
+
}, 8, ["open", "disabled"]),
|
|
178
|
+
createElementVNode("input", {
|
|
179
|
+
value: __props.modelValue,
|
|
180
|
+
placeholder: __props.placeholder,
|
|
181
|
+
disabled: __props.disabled,
|
|
182
|
+
"aria-invalid": __props.invalid || void 0,
|
|
183
|
+
type: "tel",
|
|
184
|
+
inputmode: "tel",
|
|
185
|
+
autocomplete: "tel",
|
|
186
|
+
class: "min-w-0 flex-1 bg-transparent px-3 outline-none placeholder:text-muted",
|
|
187
|
+
onBeforeinput: _cache[2] || (_cache[2] = //@ts-ignore
|
|
188
|
+
(...args) => unref(onBeforeInput) && unref(onBeforeInput)(...args)),
|
|
189
|
+
onPaste: _cache[3] || (_cache[3] = //@ts-ignore
|
|
190
|
+
(...args) => unref(onPaste) && unref(onPaste)(...args)),
|
|
191
|
+
onInput
|
|
192
|
+
}, null, 40, _hoisted_6)
|
|
193
|
+
], 2);
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
export {
|
|
198
|
+
_sfc_main as _
|
|
199
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineComponent, useModel, openBlock, createBlock, unref, withCtx, createVNode, renderSlot, normalizeClass, mergeModels } from "vue";
|
|
2
|
+
import { PopoverRoot, PopoverTrigger, PopoverPortal, PopoverContent } from "reka-ui";
|
|
3
|
+
import { POPOVER_PANEL } from "../components/dropdown.js";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "LpPopover",
|
|
6
|
+
props: /* @__PURE__ */ mergeModels({
|
|
7
|
+
side: { default: "bottom" },
|
|
8
|
+
align: { default: "center" },
|
|
9
|
+
sideOffset: { default: 6 },
|
|
10
|
+
panelClass: {}
|
|
11
|
+
}, {
|
|
12
|
+
"open": { type: Boolean },
|
|
13
|
+
"openModifiers": {}
|
|
14
|
+
}),
|
|
15
|
+
emits: ["update:open"],
|
|
16
|
+
setup(__props) {
|
|
17
|
+
const open = useModel(__props, "open");
|
|
18
|
+
return (_ctx, _cache) => {
|
|
19
|
+
return openBlock(), createBlock(unref(PopoverRoot), {
|
|
20
|
+
open: open.value,
|
|
21
|
+
"onUpdate:open": _cache[0] || (_cache[0] = ($event) => open.value = $event)
|
|
22
|
+
}, {
|
|
23
|
+
default: withCtx(() => [
|
|
24
|
+
createVNode(unref(PopoverTrigger), { "as-child": "" }, {
|
|
25
|
+
default: withCtx(() => [
|
|
26
|
+
renderSlot(_ctx.$slots, "trigger")
|
|
27
|
+
]),
|
|
28
|
+
_: 3
|
|
29
|
+
}),
|
|
30
|
+
createVNode(unref(PopoverPortal), null, {
|
|
31
|
+
default: withCtx(() => [
|
|
32
|
+
createVNode(unref(PopoverContent), {
|
|
33
|
+
side: __props.side,
|
|
34
|
+
align: __props.align,
|
|
35
|
+
"side-offset": __props.sideOffset,
|
|
36
|
+
class: normalizeClass([unref(POPOVER_PANEL), "z-(--z-popover) w-64 rounded-card p-3 text-sm text-ink outline-none", __props.panelClass])
|
|
37
|
+
}, {
|
|
38
|
+
default: withCtx(() => [
|
|
39
|
+
renderSlot(_ctx.$slots, "default")
|
|
40
|
+
]),
|
|
41
|
+
_: 3
|
|
42
|
+
}, 8, ["side", "align", "side-offset", "class"])
|
|
43
|
+
]),
|
|
44
|
+
_: 3
|
|
45
|
+
})
|
|
46
|
+
]),
|
|
47
|
+
_: 3
|
|
48
|
+
}, 8, ["open"]);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
_sfc_main as _
|
|
54
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createVNode, normalizeStyle, normalizeClass } from "vue";
|
|
2
|
+
import { ProgressRoot, ProgressIndicator } from "reka-ui";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "LpProgress",
|
|
5
|
+
props: {
|
|
6
|
+
value: { default: 0 },
|
|
7
|
+
max: { default: 100 },
|
|
8
|
+
tone: { default: "brand" }
|
|
9
|
+
},
|
|
10
|
+
setup(__props) {
|
|
11
|
+
const props = __props;
|
|
12
|
+
const pct = computed(() => Math.max(0, Math.min(100, props.value / props.max * 100)));
|
|
13
|
+
const bar = {
|
|
14
|
+
brand: "bg-brand",
|
|
15
|
+
action: "bg-action",
|
|
16
|
+
danger: "bg-danger"
|
|
17
|
+
};
|
|
18
|
+
return (_ctx, _cache) => {
|
|
19
|
+
return openBlock(), createBlock(unref(ProgressRoot), {
|
|
20
|
+
"model-value": __props.value,
|
|
21
|
+
max: __props.max,
|
|
22
|
+
class: "h-1.5 w-full overflow-hidden rounded-pill bg-surface-soft"
|
|
23
|
+
}, {
|
|
24
|
+
default: withCtx(() => [
|
|
25
|
+
createVNode(unref(ProgressIndicator), {
|
|
26
|
+
class: normalizeClass(["h-full rounded-pill transition-[width] duration-slow ease-[var(--ease-emphasized)]", bar[__props.tone]]),
|
|
27
|
+
style: normalizeStyle({ width: `${pct.value}%` })
|
|
28
|
+
}, null, 8, ["class", "style"])
|
|
29
|
+
]),
|
|
30
|
+
_: 1
|
|
31
|
+
}, 8, ["model-value", "max"]);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
export {
|
|
36
|
+
_sfc_main as _
|
|
37
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, normalizeClass, createVNode, unref, withCtx, createElementVNode, renderSlot, createTextVNode, toDisplayString } from "vue";
|
|
2
|
+
import { RadioGroupItem, RadioGroupIndicator } from "reka-ui";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "LpRadio",
|
|
5
|
+
props: {
|
|
6
|
+
value: {},
|
|
7
|
+
label: {},
|
|
8
|
+
disabled: { type: Boolean }
|
|
9
|
+
},
|
|
10
|
+
setup(__props) {
|
|
11
|
+
return (_ctx, _cache) => {
|
|
12
|
+
return openBlock(), createElementBlock("label", {
|
|
13
|
+
class: normalizeClass(["group inline-flex cursor-pointer items-center gap-2 text-sm text-ink", __props.disabled && "cursor-not-allowed opacity-55"])
|
|
14
|
+
}, [
|
|
15
|
+
createVNode(unref(RadioGroupItem), {
|
|
16
|
+
value: __props.value,
|
|
17
|
+
disabled: __props.disabled,
|
|
18
|
+
class: "flex size-[18px] shrink-0 items-center justify-center rounded-full border border-line-strong bg-surface-soft outline-none transition-[color,border-color,box-shadow,scale] duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] not-data-[state=checked]:group-hover:border-brand active:scale-90 motion-reduce:active:scale-100 focus-visible:ring-2 focus-visible:ring-ring data-[state=checked]:border-brand disabled:cursor-not-allowed disabled:opacity-55"
|
|
19
|
+
}, {
|
|
20
|
+
default: withCtx(() => [
|
|
21
|
+
createVNode(unref(RadioGroupIndicator), { class: "flex data-[state=checked]:animate-[indicator-in_140ms_var(--ease-emphasized)]" }, {
|
|
22
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
23
|
+
createElementVNode("span", { class: "size-2 rounded-full bg-brand" }, null, -1)
|
|
24
|
+
])]),
|
|
25
|
+
_: 1
|
|
26
|
+
})
|
|
27
|
+
]),
|
|
28
|
+
_: 1
|
|
29
|
+
}, 8, ["value", "disabled"]),
|
|
30
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
31
|
+
createTextVNode(toDisplayString(__props.label), 1)
|
|
32
|
+
])
|
|
33
|
+
], 2);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
_sfc_main as _
|
|
39
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createBlock, unref, withCtx, renderSlot, createElementBlock, Fragment, renderList, createVNode, createElementVNode, createTextVNode, toDisplayString } from "vue";
|
|
2
|
+
import { RadioGroupRoot, RadioGroupItem, RadioGroupIndicator } from "reka-ui";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "LpRadioGroup",
|
|
5
|
+
props: {
|
|
6
|
+
modelValue: {},
|
|
7
|
+
options: {},
|
|
8
|
+
disabled: { type: Boolean }
|
|
9
|
+
},
|
|
10
|
+
emits: ["update:modelValue"],
|
|
11
|
+
setup(__props) {
|
|
12
|
+
return (_ctx, _cache) => {
|
|
13
|
+
return openBlock(), createBlock(unref(RadioGroupRoot), {
|
|
14
|
+
"model-value": __props.modelValue,
|
|
15
|
+
disabled: __props.disabled,
|
|
16
|
+
class: "flex flex-col gap-2",
|
|
17
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = (v) => _ctx.$emit("update:modelValue", v))
|
|
18
|
+
}, {
|
|
19
|
+
default: withCtx(() => [
|
|
20
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
21
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (opt) => {
|
|
22
|
+
return openBlock(), createElementBlock("label", {
|
|
23
|
+
key: opt.value,
|
|
24
|
+
class: "group inline-flex cursor-pointer items-center gap-2 text-sm text-ink"
|
|
25
|
+
}, [
|
|
26
|
+
createVNode(unref(RadioGroupItem), {
|
|
27
|
+
value: opt.value,
|
|
28
|
+
class: "flex size-[18px] items-center justify-center rounded-full border border-line-strong bg-surface-soft outline-none transition-[color,border-color,box-shadow,scale] duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] not-data-[state=checked]:group-hover:border-brand active:scale-90 motion-reduce:active:scale-100 focus-visible:ring-2 focus-visible:ring-ring data-[state=checked]:border-brand disabled:cursor-not-allowed disabled:opacity-55"
|
|
29
|
+
}, {
|
|
30
|
+
default: withCtx(() => [
|
|
31
|
+
createVNode(unref(RadioGroupIndicator), { class: "flex data-[state=checked]:animate-[indicator-in_140ms_var(--ease-emphasized)]" }, {
|
|
32
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
33
|
+
createElementVNode("span", { class: "size-2 rounded-full bg-brand" }, null, -1)
|
|
34
|
+
])]),
|
|
35
|
+
_: 1
|
|
36
|
+
})
|
|
37
|
+
]),
|
|
38
|
+
_: 1
|
|
39
|
+
}, 8, ["value"]),
|
|
40
|
+
createTextVNode(" " + toDisplayString(opt.label), 1)
|
|
41
|
+
]);
|
|
42
|
+
}), 128))
|
|
43
|
+
])
|
|
44
|
+
]),
|
|
45
|
+
_: 3
|
|
46
|
+
}, 8, ["model-value", "disabled"]);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
export {
|
|
51
|
+
_sfc_main as _
|
|
52
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, openBlock, createBlock, unref, withCtx, createVNode, normalizeClass, createElementVNode, renderSlot, normalizeStyle } from "vue";
|
|
2
|
+
import { ScrollAreaRoot, ScrollAreaViewport, ScrollAreaScrollbar, ScrollAreaThumb } from "reka-ui";
|
|
3
|
+
const barFade = "data-[state=visible]:animate-[fade-in_180ms_ease] data-[state=hidden]:animate-[fade-out_240ms_ease]";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "LpScrollArea",
|
|
6
|
+
props: {
|
|
7
|
+
fade: { type: Boolean },
|
|
8
|
+
contentClass: {},
|
|
9
|
+
barInsetTop: {}
|
|
10
|
+
},
|
|
11
|
+
emits: ["scroll"],
|
|
12
|
+
setup(__props, { expose: __expose }) {
|
|
13
|
+
const viewportRef = ref(null);
|
|
14
|
+
const viewportEl = computed(
|
|
15
|
+
() => viewportRef.value?.viewportElement ?? null
|
|
16
|
+
);
|
|
17
|
+
__expose({ viewportEl });
|
|
18
|
+
return (_ctx, _cache) => {
|
|
19
|
+
return openBlock(), createBlock(unref(ScrollAreaRoot), {
|
|
20
|
+
class: "relative overflow-hidden",
|
|
21
|
+
type: "hover",
|
|
22
|
+
"scroll-hide-delay": 500
|
|
23
|
+
}, {
|
|
24
|
+
default: withCtx(() => [
|
|
25
|
+
createVNode(unref(ScrollAreaViewport), {
|
|
26
|
+
ref_key: "viewportRef",
|
|
27
|
+
ref: viewportRef,
|
|
28
|
+
class: normalizeClass(["size-full min-w-0 [&>div]:!block [&>div]:!min-w-0", __props.fade ? "[mask-image:linear-gradient(to_bottom,transparent_0,black_14px,black_calc(100%-14px),transparent_100%)]" : ""]),
|
|
29
|
+
onScrollPassive: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("scroll", $event))
|
|
30
|
+
}, {
|
|
31
|
+
default: withCtx(() => [
|
|
32
|
+
createElementVNode("div", {
|
|
33
|
+
class: normalizeClass(__props.contentClass)
|
|
34
|
+
}, [
|
|
35
|
+
renderSlot(_ctx.$slots, "default")
|
|
36
|
+
], 2)
|
|
37
|
+
]),
|
|
38
|
+
_: 3
|
|
39
|
+
}, 8, ["class"]),
|
|
40
|
+
createVNode(unref(ScrollAreaScrollbar), {
|
|
41
|
+
orientation: "vertical",
|
|
42
|
+
class: normalizeClass(["group flex w-1 touch-none select-none p-px transition-[width] duration-[var(--duration-fast)] hover:w-1.5", barFade]),
|
|
43
|
+
style: normalizeStyle(__props.barInsetTop ? { marginTop: __props.barInsetTop } : void 0)
|
|
44
|
+
}, {
|
|
45
|
+
default: withCtx(() => [
|
|
46
|
+
createVNode(unref(ScrollAreaThumb), { class: "flex-1 rounded-l-pill bg-brand/40 transition-colors group-hover:bg-brand" })
|
|
47
|
+
]),
|
|
48
|
+
_: 1
|
|
49
|
+
}, 8, ["style"]),
|
|
50
|
+
createVNode(unref(ScrollAreaScrollbar), {
|
|
51
|
+
orientation: "horizontal",
|
|
52
|
+
class: normalizeClass(["group flex h-1 flex-col touch-none select-none p-px transition-[height] duration-[var(--duration-fast)] hover:h-1.5", barFade])
|
|
53
|
+
}, {
|
|
54
|
+
default: withCtx(() => [
|
|
55
|
+
createVNode(unref(ScrollAreaThumb), { class: "flex-1 rounded-t-pill bg-brand/40 transition-colors group-hover:bg-brand" })
|
|
56
|
+
]),
|
|
57
|
+
_: 1
|
|
58
|
+
})
|
|
59
|
+
]),
|
|
60
|
+
_: 3
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
export {
|
|
66
|
+
_sfc_main as _
|
|
67
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineComponent, useId, openBlock, createBlock, unref, normalizeClass, withCtx, createElementBlock, Fragment, renderList, createCommentVNode, toDisplayString } from "vue";
|
|
2
|
+
import { Motion } from "motion-v";
|
|
3
|
+
import { ToggleGroupRoot, ToggleGroupItem } from "reka-ui";
|
|
4
|
+
import { usePillTransition } from "../composables/usePillTransition.js";
|
|
5
|
+
import { _ as _sfc_main$1 } from "./LpIcon-CCnX5_2j.js";
|
|
6
|
+
const _hoisted_1 = {
|
|
7
|
+
key: 2,
|
|
8
|
+
class: "relative z-10"
|
|
9
|
+
};
|
|
10
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
|
+
__name: "LpSegmented",
|
|
12
|
+
props: {
|
|
13
|
+
modelValue: {},
|
|
14
|
+
options: {},
|
|
15
|
+
size: { default: "md" },
|
|
16
|
+
block: { type: Boolean, default: false },
|
|
17
|
+
disabled: { type: Boolean }
|
|
18
|
+
},
|
|
19
|
+
emits: ["update:modelValue"],
|
|
20
|
+
setup(__props, { emit: __emit }) {
|
|
21
|
+
const emit = __emit;
|
|
22
|
+
function onChange(v) {
|
|
23
|
+
if (typeof v === "string" && v) emit("update:modelValue", v);
|
|
24
|
+
}
|
|
25
|
+
const sizeCls = {
|
|
26
|
+
sm: "h-(--size-control-sm) text-xs",
|
|
27
|
+
md: "h-(--size-control-md) text-sm"
|
|
28
|
+
};
|
|
29
|
+
const pillId = `lp-segmented-${useId()}`;
|
|
30
|
+
const pillTransition = usePillTransition();
|
|
31
|
+
return (_ctx, _cache) => {
|
|
32
|
+
return openBlock(), createBlock(unref(ToggleGroupRoot), {
|
|
33
|
+
"model-value": __props.modelValue,
|
|
34
|
+
type: "single",
|
|
35
|
+
disabled: __props.disabled,
|
|
36
|
+
rovingFocus: true,
|
|
37
|
+
class: normalizeClass(["inline-flex items-center gap-1 rounded-control border border-line bg-surface-soft p-1", [sizeCls[__props.size], __props.block ? "flex w-full" : ""]]),
|
|
38
|
+
"onUpdate:modelValue": onChange
|
|
39
|
+
}, {
|
|
40
|
+
default: withCtx(() => [
|
|
41
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (opt) => {
|
|
42
|
+
return openBlock(), createBlock(unref(ToggleGroupItem), {
|
|
43
|
+
key: opt.value,
|
|
44
|
+
value: opt.value,
|
|
45
|
+
"aria-label": opt.label ? void 0 : opt.value,
|
|
46
|
+
class: normalizeClass(["relative inline-flex h-full items-center justify-center gap-1.5 rounded-md px-3 font-medium outline-none transition-colors duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] focus-visible:ring-2 focus-visible:ring-ring data-[state=on]:text-ink data-[state=off]:text-muted data-[state=off]:hover:text-ink disabled:cursor-not-allowed disabled:opacity-55", __props.block ? "flex-1" : ""])
|
|
47
|
+
}, {
|
|
48
|
+
default: withCtx(() => [
|
|
49
|
+
opt.value === __props.modelValue ? (openBlock(), createBlock(unref(Motion), {
|
|
50
|
+
key: 0,
|
|
51
|
+
"layout-id": pillId,
|
|
52
|
+
transition: unref(pillTransition),
|
|
53
|
+
class: "absolute inset-0 z-0 rounded-md border border-line bg-surface-raised shadow-sm"
|
|
54
|
+
}, null, 8, ["transition"])) : createCommentVNode("", true),
|
|
55
|
+
opt.icon ? (openBlock(), createBlock(_sfc_main$1, {
|
|
56
|
+
key: 1,
|
|
57
|
+
name: opt.icon,
|
|
58
|
+
size: 14,
|
|
59
|
+
class: "relative z-10 shrink-0"
|
|
60
|
+
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
61
|
+
opt.label ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(opt.label), 1)) : createCommentVNode("", true)
|
|
62
|
+
]),
|
|
63
|
+
_: 2
|
|
64
|
+
}, 1032, ["value", "aria-label", "class"]);
|
|
65
|
+
}), 128))
|
|
66
|
+
]),
|
|
67
|
+
_: 1
|
|
68
|
+
}, 8, ["model-value", "disabled", "class"]);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
export {
|
|
73
|
+
_sfc_main as _
|
|
74
|
+
};
|