@leavepulse/ui 0.78.0 → 0.78.2
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-DXIr0eFz.js → DropzoneLinkField-CyE7TJ5f.js} +1 -1
- package/dist/chunks/FieldLeading-mr81aEAP.js +27 -0
- package/dist/chunks/LpAddressInput-ft8fQOGx.js +401 -0
- package/dist/chunks/{LpAppShell-BNAVTQsY.js → LpAppShell-DkvU6IBB.js} +23 -4
- package/dist/chunks/LpAutocomplete-CrZbd0uv.js +310 -0
- package/dist/chunks/LpCheckbox-CCWCwD0y.js +129 -0
- package/dist/chunks/{LpCodeBlock-DuzmnIHl.js → LpCodeBlock-DBqy4RLd.js} +1 -1
- package/dist/chunks/{LpCodeDisplay-CO8fngxa.js → LpCodeDisplay-D59uPwRb.js} +3 -3
- package/dist/chunks/LpColorPicker-BONURBFN.js +574 -0
- package/dist/chunks/{LpConfirmDialog-6oCIJTDa.js → LpConfirmDialog-CnrmzkuN.js} +1 -1
- package/dist/chunks/{LpConfirmHost-DgHvfT6s.js → LpConfirmHost-CwbObVGH.js} +1 -1
- package/dist/chunks/{LpContextMenu--eMGIql6.js → LpContextMenu-Bx_IhQDS.js} +5 -5
- package/dist/chunks/{LpCopyButton-7EOSIuwa.js → LpCopyButton-sAMvWeLP.js} +1 -1
- package/dist/chunks/{LpDataList-DgBeM01y.js → LpDataList-CaVfsozH.js} +2 -2
- package/dist/chunks/LpDatePicker-C2AOtxgF.js +171 -0
- package/dist/chunks/{LpDateRangePicker-CNQXdTVv.js → LpDateRangePicker-CiXdIAyh.js} +43 -35
- package/dist/chunks/{LpDrawer-Bt9UUqt_.js → LpDrawer-DXNQFpAA.js} +1 -1
- package/dist/chunks/{LpFileTree-BSx1kBoV.js → LpFileTree-CpNurwZp.js} +3 -3
- package/dist/chunks/{LpFileTreeNode-4dVmFHb3.js → LpFileTreeNode-DdF8Cq-s.js} +2 -2
- package/dist/chunks/{LpHoverCard-DanH3Nz1.js → LpHoverCard-CHE9jAJG.js} +6 -6
- package/dist/chunks/{LpInfraNode-BAU40Km2.js → LpInfraNode-Bb5nbuFY.js} +17 -0
- package/dist/chunks/{LpInput-DL6HEJdi.js → LpInput-CbI7z5fQ.js} +21 -25
- package/dist/chunks/{LpInspector-CuoMAhiw.js → LpInspector-DO3fTCQ1.js} +2 -2
- package/dist/chunks/{LpLaneNode-HtnQf2FF.js → LpLaneNode-Bqcdm8Rf.js} +19 -1
- package/dist/chunks/{LpLightbox-xvpQ64MM.js → LpLightbox-CtDTQV01.js} +1 -1
- package/dist/chunks/{LpLogInspector-6cNnXqp4.js → LpLogInspector-CcSJSGan.js} +1 -1
- package/dist/chunks/{LpLogViewer-Dvb1E9_G.js → LpLogViewer-CWu49Dko.js} +4 -4
- package/dist/chunks/{LpMediaGallery-Df-tiWeq.js → LpMediaGallery-BYEwySoF.js} +2 -2
- package/dist/chunks/{LpModal-DrtQ_1A2.js → LpModal-DDvrSAnf.js} +1 -1
- package/dist/chunks/{LpModalNav-DkmGCnZE.js → LpModalNav-DI3BW5ff.js} +2 -2
- package/dist/chunks/{LpNotificationBell-D_wklO1m.js → LpNotificationBell-DUbVyK6R.js} +3 -3
- package/dist/chunks/LpNumberField-C8LfUz_R.js +154 -0
- package/dist/chunks/LpOtpInput-B1X9l9no.js +140 -0
- package/dist/chunks/LpPageScrollbar-D2O0xhJw.js +164 -0
- package/dist/chunks/{LpPaletteTheme-dVtxHx-F.js → LpPaletteTheme-B-xuZiKK.js} +2 -2
- package/dist/chunks/{LpPasswordInput-B-zD6tUS.js → LpPasswordInput-Duc_3wPv.js} +2 -2
- package/dist/chunks/{LpPhoneInput-BSL7NX4z.js → LpPhoneInput-CctcRK9K.js} +124 -118
- package/dist/chunks/{LpPie-9t_guO49.js → LpPie-oVNHjsKD.js} +2 -2
- package/dist/chunks/{LpPipeline-rjXvEDRJ.js → LpPipeline-BSXT6oUJ.js} +1 -1
- package/dist/chunks/LpRadioGroup-DTM0nd9G.js +103 -0
- package/dist/chunks/LpRangeSlider-DJsEZXad.js +97 -0
- package/dist/chunks/{LpRelativeTime-BovUk8MP.js → LpRelativeTime-0zI-44ve.js} +1 -1
- package/dist/chunks/LpRepeater-Czib3rmv.js +193 -0
- package/dist/chunks/{LpScrollArea-ay4Xo_hg.js → LpScrollArea-CqvwfZs2.js} +9 -12
- package/dist/chunks/{LpSecretField-DBvU6iAw.js → LpSecretField-BtlCk3IH.js} +4 -4
- package/dist/chunks/LpSegmented-sskrJKJJ.js +128 -0
- package/dist/chunks/LpSelect-JFZehOkd.js +515 -0
- package/dist/chunks/{LpServiceNode-D8uJ8sGk.js → LpServiceNode-Cln2ntdw.js} +17 -0
- package/dist/chunks/{LpSidebar-kSkpPh3-.js → LpSidebar-CvRvVBTt.js} +4 -4
- package/dist/chunks/{LpSidebarNav-C2mvqrY2.js → LpSidebarNav-CE0jQS8i.js} +2 -2
- package/dist/chunks/{LpSidebarRow-eRP4Q31q.js → LpSidebarRow-DOTg1txp.js} +2 -2
- package/dist/chunks/LpSlider-C4ilCtZX.js +76 -0
- package/dist/chunks/{LpStat-pMNZgFcq.js → LpStat-DPjc6_fX.js} +17 -4
- package/dist/chunks/LpSwitch-DyAYTchz.js +122 -0
- package/dist/chunks/{LpTableFilter-DgARTsA1.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-DzYfE-5k.js → LpThemeStudio-R-wohbCY.js} +3 -3
- package/dist/chunks/{LpThemeSwitcher-CFLkdbBL.js → LpThemeSwitcher-Bzy15MCP.js} +2 -2
- package/dist/chunks/LpTimeField-B5n0m8m0.js +115 -0
- package/dist/chunks/{LpToaster-QFj0P-5m.js → LpToaster-Ct_ZOhCh.js} +1 -1
- package/dist/chunks/{LpTooltip-BJf3lZMq.js → LpTooltip-Bz_rrq5S.js} +5 -5
- package/dist/chunks/{LpTopologyCanvas-BOHHHZ_6.js → LpTopologyCanvas-BNgw9RyZ.js} +14 -9
- package/dist/chunks/{LpTruncate-C6u3gjc6.js → LpTruncate-ellq9RYM.js} +2 -2
- package/dist/chunks/{LpUptimeBar-BnYmR2rj.js → LpUptimeBar-BoxcCDVY.js} +1 -1
- package/dist/chunks/{LpWorkspaceSwitcher-D0e9upAy.js → LpWorkspaceSwitcher-ugv-fyig.js} +2 -2
- package/dist/chunks/{RevealToggle-CCPDE8Mv.js → RevealToggle-D_iyrB8d.js} +1 -1
- package/dist/component-names.d.ts +1 -1
- package/dist/components/DropzoneLinkField.vue.js +1 -1
- package/dist/components/FieldLeading.vue.d.ts +16 -0
- package/dist/components/FieldLeading.vue.js +4 -0
- 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 +16 -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/LpChart.vue.js +1 -1
- package/dist/components/LpCheckbox.vue.d.ts +4 -0
- package/dist/components/LpCheckbox.vue.js +1 -1
- package/dist/components/LpCodeBlock.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/LpCommandPalette.vue.js +1 -1
- package/dist/components/LpConfirmDialog.vue.js +1 -1
- package/dist/components/LpConfirmHost.vue.js +1 -1
- package/dist/components/LpContextMenu.vue.js +1 -1
- package/dist/components/LpCopyButton.vue.js +1 -1
- package/dist/components/LpDataList.vue.js +1 -1
- package/dist/components/LpDatePicker.vue.js +1 -1
- package/dist/components/LpDateRangePicker.vue.js +1 -1
- package/dist/components/LpDock.vue.js +1 -1
- package/dist/components/LpDrawer.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/LpHoverCard.vue.js +1 -1
- package/dist/components/LpImageEditor.vue.d.ts +1 -1
- package/dist/components/LpInfraNode.vue.d.ts +11 -2
- package/dist/components/LpInfraNode.vue.js +1 -1
- package/dist/components/LpInput.vue.js +1 -1
- package/dist/components/LpInspector.vue.js +1 -1
- package/dist/components/LpLaneNode.vue.d.ts +2 -3
- package/dist/components/LpLaneNode.vue.js +1 -1
- package/dist/components/LpLightbox.vue.js +1 -1
- package/dist/components/LpLogInspector.vue.js +1 -1
- package/dist/components/LpLogViewer.vue.js +1 -1
- package/dist/components/LpMediaGallery.vue.js +1 -1
- package/dist/components/LpModal.vue.js +1 -1
- package/dist/components/LpModalNav.vue.js +1 -1
- package/dist/components/LpNotificationBell.vue.js +1 -1
- package/dist/components/LpNumberField.vue.d.ts +17 -2
- 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/LpPageScrollbar.vue.d.ts +10 -0
- package/dist/components/LpPageScrollbar.vue.js +4 -0
- 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/LpPie.vue.js +1 -1
- package/dist/components/LpPipeline.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/LpRelativeTime.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/LpScrollArea.vue.js +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/LpServiceNode.vue.d.ts +8 -2
- package/dist/components/LpServiceNode.vue.js +1 -1
- package/dist/components/LpShinyText.vue.d.ts +1 -1
- package/dist/components/LpShortcutsDialog.vue.js +1 -1
- package/dist/components/LpSidebar.vue.d.ts +1 -1
- package/dist/components/LpSidebar.vue.js +1 -1
- package/dist/components/LpSidebarNav.vue.js +1 -1
- package/dist/components/LpSidebarRow.vue.js +1 -1
- package/dist/components/LpSlider.vue.d.ts +4 -0
- package/dist/components/LpSlider.vue.js +1 -1
- package/dist/components/LpStat.vue.d.ts +16 -0
- package/dist/components/LpStat.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 +5 -5
- package/dist/components/LpTableFilter.vue.js +1 -1
- package/dist/components/LpTabs.vue.d.ts +1 -1
- package/dist/components/LpTabs.vue.js +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/LpToaster.vue.js +1 -1
- package/dist/components/LpTooltip.vue.js +1 -1
- package/dist/components/LpTopologyCanvas.vue.d.ts +2 -2
- package/dist/components/LpTopologyCanvas.vue.js +1 -1
- package/dist/components/LpTruncate.vue.js +1 -1
- package/dist/components/LpUptimeBar.vue.js +1 -1
- package/dist/components/LpWorkspaceSwitcher.vue.js +1 -1
- package/dist/components/RevealToggle.vue.js +1 -1
- package/dist/components/calendar.d.ts +2 -0
- package/dist/components/menuWhen.js +1 -1
- package/dist/components/scrollbar.d.ts +34 -0
- package/dist/components/scrollbar.js +47 -0
- package/dist/composables/propCheck.d.ts +1 -1
- package/dist/composables/propCheck.js +15 -4
- 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/composables/usePaletteCommands.js +4 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +170 -168
- package/package.json +1 -1
- package/src/component-names.ts +1 -0
- package/src/components/FieldLeading.vue +17 -0
- package/src/components/LpAddressInput.vue +8 -4
- package/src/components/LpAppShell.vue +23 -0
- package/src/components/LpAutocomplete.vue +11 -5
- package/src/components/LpCheckbox.vue +8 -6
- package/src/components/LpColorPicker.vue +7 -4
- package/src/components/LpContextMenu.vue +7 -0
- package/src/components/LpDatePicker.vue +8 -4
- package/src/components/LpDateRangePicker.vue +8 -4
- package/src/components/LpHoverCard.vue +7 -0
- package/src/components/LpInfraNode.vue +4 -3
- package/src/components/LpInput.vue +7 -7
- package/src/components/LpLaneNode.vue +5 -1
- package/src/components/LpNumberField.vue +18 -7
- package/src/components/LpOtpInput.vue +8 -6
- package/src/components/LpPageScrollbar.vue +195 -0
- 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/LpScrollArea.vue +27 -23
- package/src/components/LpSegmented.vue +8 -4
- package/src/components/LpSelect.vue +8 -7
- package/src/components/LpServiceNode.vue +4 -2
- package/src/components/LpSlider.vue +8 -4
- package/src/components/LpStat.vue +25 -5
- 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/LpTooltip.vue +7 -0
- package/src/components/LpTopologyCanvas.vue +3 -1
- package/src/components/calendar.ts +2 -0
- package/src/components/scrollbar.ts +71 -0
- package/src/composables/propCheck.ts +20 -5
- package/src/composables/useField.ts +52 -0
- package/src/composables/useMergedClass.ts +11 -5
- package/src/composables/usePaletteCommands.ts +5 -2
- package/src/index.ts +1 -0
- package/dist/chunks/LpAddressInput-ZqoZ-N2Y.js +0 -393
- package/dist/chunks/LpAutocomplete-DkY6CSyD.js +0 -302
- package/dist/chunks/LpCheckbox-D6RuDW4X.js +0 -124
- package/dist/chunks/LpColorPicker-BxAHEnR5.js +0 -567
- package/dist/chunks/LpDatePicker-DwSDY0mt.js +0 -163
- package/dist/chunks/LpNumberField-CNHsmSDZ.js +0 -134
- 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,193 @@
|
|
|
1
|
+
import { defineComponent, useModel, ref, openBlock, createBlock, normalizeProps, guardReactiveProps, unref, withCtx, createElementVNode, mergeProps, createElementBlock, toDisplayString, createCommentVNode, createVNode, createTextVNode, TransitionGroup, Fragment, renderList, renderSlot, mergeModels, nextTick } from "vue";
|
|
2
|
+
import { _ as _sfc_main$1 } from "./FieldWrapper-DnuMTrqW.js";
|
|
3
|
+
import { useOwnField, mergeDescribedBy } from "../composables/useField.js";
|
|
4
|
+
import { useLabels } from "../composables/useLpConfig.js";
|
|
5
|
+
import { useMergedAttrs } from "../composables/useMergedClass.js";
|
|
6
|
+
import { useRepeater } from "../composables/useRepeater.js";
|
|
7
|
+
import { usePrefersReducedMotion } from "../composables/useReducedMotion.js";
|
|
8
|
+
import { _ as _sfc_main$2 } from "./LpButton-DSHioIfD.js";
|
|
9
|
+
import { _ as _sfc_main$3 } from "./LpIcon-C6JpQ5td.js";
|
|
10
|
+
import { _ as _sfc_main$4 } from "./LpShift-DAgS_d2x.js";
|
|
11
|
+
import '../assets/LpRepeater-C1Cw27hj.css';const _hoisted_1 = ["aria-label", "aria-describedby"];
|
|
12
|
+
const _hoisted_2 = { class: "flex items-center justify-between gap-2" };
|
|
13
|
+
const _hoisted_3 = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "text-sm font-medium text-ink"
|
|
16
|
+
};
|
|
17
|
+
const _hoisted_4 = { class: "min-w-0 flex-1" };
|
|
18
|
+
const _hoisted_5 = {
|
|
19
|
+
key: "empty",
|
|
20
|
+
class: "text-xs text-muted"
|
|
21
|
+
};
|
|
22
|
+
const focusable = 'input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), [tabindex="0"], [contenteditable="true"]';
|
|
23
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
24
|
+
...{ inheritAttrs: false },
|
|
25
|
+
__name: "LpRepeater",
|
|
26
|
+
props: /* @__PURE__ */ mergeModels({
|
|
27
|
+
createItem: { type: Function },
|
|
28
|
+
itemKey: { type: Function },
|
|
29
|
+
label: {},
|
|
30
|
+
disabled: { type: Boolean },
|
|
31
|
+
error: {},
|
|
32
|
+
labels: {}
|
|
33
|
+
}, {
|
|
34
|
+
"modelValue": { default: () => [] },
|
|
35
|
+
"modelModifiers": {}
|
|
36
|
+
}),
|
|
37
|
+
emits: ["update:modelValue"],
|
|
38
|
+
setup(__props, { expose: __expose }) {
|
|
39
|
+
const props = __props;
|
|
40
|
+
const model = useModel(__props, "modelValue");
|
|
41
|
+
const { field, wrapper, ownAttrs } = useOwnField(() => ({ error: props.error, disabled: props.disabled }));
|
|
42
|
+
const text = useLabels("repeater", { add: "Add item", remove: "Remove item {index}", empty: "No items" }, () => props.labels);
|
|
43
|
+
const list = useRepeater({
|
|
44
|
+
value: () => model.value,
|
|
45
|
+
set: (items) => {
|
|
46
|
+
model.value = items;
|
|
47
|
+
},
|
|
48
|
+
createItem: () => props.createItem(),
|
|
49
|
+
itemKey: () => props.itemKey,
|
|
50
|
+
disabled: () => field.value.disabled
|
|
51
|
+
});
|
|
52
|
+
const { rows } = list;
|
|
53
|
+
const rowsHost = ref(null);
|
|
54
|
+
const reducedMotion = usePrefersReducedMotion();
|
|
55
|
+
const addButton = ref(null);
|
|
56
|
+
function focusRow(index) {
|
|
57
|
+
rowAt(index)?.querySelector(focusable)?.focus({ preventScroll: true });
|
|
58
|
+
}
|
|
59
|
+
function rowAt(index) {
|
|
60
|
+
return Array.from(rowsHost.value?.children ?? []).filter(
|
|
61
|
+
(node) => node.hasAttribute("data-lp-repeater-row") && !node.hasAttribute("inert")
|
|
62
|
+
)[index];
|
|
63
|
+
}
|
|
64
|
+
function beforeLeave(el) {
|
|
65
|
+
const row = el;
|
|
66
|
+
row.style.width = `${row.offsetWidth}px`;
|
|
67
|
+
row.style.top = `${row.offsetTop}px`;
|
|
68
|
+
row.setAttribute("inert", "");
|
|
69
|
+
row.setAttribute("aria-hidden", "true");
|
|
70
|
+
}
|
|
71
|
+
function beforeEnter(el) {
|
|
72
|
+
const row = el;
|
|
73
|
+
row.removeAttribute("inert");
|
|
74
|
+
row.removeAttribute("aria-hidden");
|
|
75
|
+
row.style.removeProperty("top");
|
|
76
|
+
row.style.removeProperty("width");
|
|
77
|
+
}
|
|
78
|
+
async function add() {
|
|
79
|
+
if (field.value.disabled) return;
|
|
80
|
+
list.add();
|
|
81
|
+
await nextTick();
|
|
82
|
+
focusRow(model.value.length - 1);
|
|
83
|
+
}
|
|
84
|
+
async function remove(index) {
|
|
85
|
+
if (field.value.disabled) return;
|
|
86
|
+
const row = rowAt(index);
|
|
87
|
+
const restore = row?.contains(row.ownerDocument.activeElement);
|
|
88
|
+
list.remove(index);
|
|
89
|
+
if (!restore) return;
|
|
90
|
+
await nextTick();
|
|
91
|
+
if (model.value.length) focusRow(Math.min(index, model.value.length - 1));
|
|
92
|
+
else addButton.value?.$el?.focus({ preventScroll: true });
|
|
93
|
+
}
|
|
94
|
+
__expose({ add, remove, update: list.update });
|
|
95
|
+
const { class: rootClass, attrs: rest } = useMergedAttrs("flex min-w-0 flex-col gap-2", () => ownAttrs());
|
|
96
|
+
return (_ctx, _cache) => {
|
|
97
|
+
return openBlock(), createBlock(_sfc_main$1, normalizeProps(guardReactiveProps(unref(wrapper))), {
|
|
98
|
+
default: withCtx(() => [
|
|
99
|
+
createElementVNode("div", mergeProps(unref(rest), {
|
|
100
|
+
role: "group",
|
|
101
|
+
"aria-label": __props.label || void 0,
|
|
102
|
+
"aria-describedby": unref(mergeDescribedBy)(unref(rest)["aria-describedby"], unref(field).describedBy),
|
|
103
|
+
class: unref(rootClass)
|
|
104
|
+
}), [
|
|
105
|
+
createElementVNode("div", _hoisted_2, [
|
|
106
|
+
__props.label ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(__props.label), 1)) : createCommentVNode("", true),
|
|
107
|
+
createVNode(_sfc_main$2, {
|
|
108
|
+
ref_key: "addButton",
|
|
109
|
+
ref: addButton,
|
|
110
|
+
size: "xs",
|
|
111
|
+
variant: "ghost",
|
|
112
|
+
disabled: unref(field).disabled,
|
|
113
|
+
onClick: add
|
|
114
|
+
}, {
|
|
115
|
+
default: withCtx(() => [
|
|
116
|
+
createVNode(_sfc_main$3, {
|
|
117
|
+
name: "lucide:plus",
|
|
118
|
+
size: 14
|
|
119
|
+
}),
|
|
120
|
+
createTextVNode(toDisplayString(unref(text).add), 1)
|
|
121
|
+
]),
|
|
122
|
+
_: 1
|
|
123
|
+
}, 8, ["disabled"])
|
|
124
|
+
]),
|
|
125
|
+
createVNode(_sfc_main$4, { axis: "height" }, {
|
|
126
|
+
default: withCtx(() => [
|
|
127
|
+
createElementVNode("div", {
|
|
128
|
+
ref_key: "rowsHost",
|
|
129
|
+
ref: rowsHost,
|
|
130
|
+
class: "relative flex min-w-0 flex-col gap-2"
|
|
131
|
+
}, [
|
|
132
|
+
createVNode(TransitionGroup, {
|
|
133
|
+
name: "lp-repeater",
|
|
134
|
+
css: !unref(reducedMotion),
|
|
135
|
+
onBeforeEnter: beforeEnter,
|
|
136
|
+
onBeforeLeave: beforeLeave
|
|
137
|
+
}, {
|
|
138
|
+
default: withCtx(() => [
|
|
139
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), ({ item, key }, index) => {
|
|
140
|
+
return openBlock(), createElementBlock("div", {
|
|
141
|
+
key,
|
|
142
|
+
"data-lp-repeater-row": "",
|
|
143
|
+
class: "flex min-w-0 items-start gap-2"
|
|
144
|
+
}, [
|
|
145
|
+
createElementVNode("div", _hoisted_4, [
|
|
146
|
+
renderSlot(_ctx.$slots, "default", {
|
|
147
|
+
item,
|
|
148
|
+
index,
|
|
149
|
+
disabled: unref(field).disabled,
|
|
150
|
+
update: (next) => unref(list).update(index, next),
|
|
151
|
+
remove: () => remove(index)
|
|
152
|
+
})
|
|
153
|
+
]),
|
|
154
|
+
createVNode(_sfc_main$2, {
|
|
155
|
+
variant: "ghost",
|
|
156
|
+
size: "sm",
|
|
157
|
+
square: "",
|
|
158
|
+
disabled: unref(field).disabled,
|
|
159
|
+
"aria-label": unref(text).remove.replace("{index}", String(index + 1)),
|
|
160
|
+
onClick: ($event) => remove(index)
|
|
161
|
+
}, {
|
|
162
|
+
default: withCtx(() => [
|
|
163
|
+
createVNode(_sfc_main$3, {
|
|
164
|
+
name: "lucide:x",
|
|
165
|
+
size: 14
|
|
166
|
+
})
|
|
167
|
+
]),
|
|
168
|
+
_: 1
|
|
169
|
+
}, 8, ["disabled", "aria-label", "onClick"])
|
|
170
|
+
]);
|
|
171
|
+
}), 128)),
|
|
172
|
+
!unref(rows).length ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
173
|
+
renderSlot(_ctx.$slots, "empty", {}, () => [
|
|
174
|
+
createTextVNode(toDisplayString(unref(text).empty), 1)
|
|
175
|
+
])
|
|
176
|
+
])) : createCommentVNode("", true)
|
|
177
|
+
]),
|
|
178
|
+
_: 3
|
|
179
|
+
}, 8, ["css"])
|
|
180
|
+
], 512)
|
|
181
|
+
]),
|
|
182
|
+
_: 3
|
|
183
|
+
})
|
|
184
|
+
], 16, _hoisted_1)
|
|
185
|
+
]),
|
|
186
|
+
_: 3
|
|
187
|
+
}, 16);
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
export {
|
|
192
|
+
_sfc_main as _
|
|
193
|
+
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, watch, onBeforeUnmount, openBlock, createBlock, unref, normalizeClass, withCtx, createVNode, normalizeStyle, createElementVNode, renderSlot } from "vue";
|
|
2
2
|
import { ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport } from "reka-ui";
|
|
3
|
-
import { prefersReducedMotion } from "../composables/easing.js";
|
|
4
3
|
import { nodeWindow } from "../composables/realm.js";
|
|
5
|
-
|
|
4
|
+
import { SCROLL_HIDE_DELAY_MS, BAR_Y, BAR_FADE, BAR_Y_SIZE, THUMB_Y, THUMB_Y_ROUND, BAR_X, BAR_X_SIZE, THUMB_X, THUMB_X_ROUND, pageToward } from "../components/scrollbar.js";
|
|
6
5
|
const FADE_PX = 14;
|
|
7
6
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
7
|
__name: "LpScrollArea",
|
|
@@ -29,6 +28,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
29
28
|
function onViewportBlur() {
|
|
30
29
|
pointerFocus.value = false;
|
|
31
30
|
}
|
|
31
|
+
const edge = computed(() => props.floating ? "floating" : "wall");
|
|
32
32
|
const dragging = ref(false);
|
|
33
33
|
const atTop = ref(true);
|
|
34
34
|
const atBottom = ref(true);
|
|
@@ -100,10 +100,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
100
100
|
event.preventDefault();
|
|
101
101
|
event.stopImmediatePropagation();
|
|
102
102
|
const rect = thumb.getBoundingClientRect();
|
|
103
|
-
|
|
104
|
-
const step = (axis === "y" ? el.clientHeight : el.clientWidth) * 0.85 * (before ? -1 : 1);
|
|
105
|
-
const behavior = prefersReducedMotion() ? "auto" : "smooth";
|
|
106
|
-
el.scrollBy(axis === "y" ? { top: step, behavior } : { left: step, behavior });
|
|
103
|
+
pageToward(el, axis, axis === "y" ? event.clientY < rect.top : event.clientX < rect.left);
|
|
107
104
|
}
|
|
108
105
|
let stopThumbDrag = null;
|
|
109
106
|
function onThumbPointerDown(event) {
|
|
@@ -126,20 +123,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
126
123
|
return openBlock(), createBlock(unref(ScrollAreaRoot), {
|
|
127
124
|
class: normalizeClass(["relative flex flex-col overflow-hidden", dragging.value ? "select-none" : void 0]),
|
|
128
125
|
type: "hover",
|
|
129
|
-
"scroll-hide-delay":
|
|
126
|
+
"scroll-hide-delay": unref(SCROLL_HIDE_DELAY_MS)
|
|
130
127
|
}, {
|
|
131
128
|
default: withCtx(() => [
|
|
132
129
|
createVNode(unref(ScrollAreaScrollbar), {
|
|
133
130
|
orientation: "vertical",
|
|
134
131
|
"force-mount": "",
|
|
135
|
-
class: normalizeClass(["
|
|
132
|
+
class: normalizeClass(["z-1", [unref(BAR_Y), unref(BAR_FADE), unref(BAR_Y_SIZE)[edge.value]]]),
|
|
136
133
|
style: normalizeStyle(__props.barInsetTop ? { marginTop: __props.barInsetTop } : void 0),
|
|
137
134
|
onPointerdownCapture: _cache[0] || (_cache[0] = ($event) => onTrackPointerDown($event, "y"))
|
|
138
135
|
}, {
|
|
139
136
|
default: withCtx(() => [
|
|
140
137
|
createVNode(unref(ScrollAreaThumb), {
|
|
141
138
|
"data-lp-thumb": "",
|
|
142
|
-
class: normalizeClass(["relative
|
|
139
|
+
class: normalizeClass(["relative", [unref(THUMB_Y), unref(THUMB_Y_ROUND)[edge.value]]]),
|
|
143
140
|
onPointerdown: onThumbPointerDown
|
|
144
141
|
}, null, 8, ["class"])
|
|
145
142
|
]),
|
|
@@ -147,13 +144,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
147
144
|
}, 8, ["class", "style"]),
|
|
148
145
|
createVNode(unref(ScrollAreaScrollbar), {
|
|
149
146
|
orientation: "horizontal",
|
|
150
|
-
class: normalizeClass(["
|
|
147
|
+
class: normalizeClass(["z-1", [unref(BAR_X), unref(BAR_FADE), unref(BAR_X_SIZE)[edge.value]]]),
|
|
151
148
|
onPointerdownCapture: _cache[1] || (_cache[1] = ($event) => onTrackPointerDown($event, "x"))
|
|
152
149
|
}, {
|
|
153
150
|
default: withCtx(() => [
|
|
154
151
|
createVNode(unref(ScrollAreaThumb), {
|
|
155
152
|
"data-lp-thumb": "",
|
|
156
|
-
class: normalizeClass(["relative
|
|
153
|
+
class: normalizeClass(["relative", [unref(THUMB_X), unref(THUMB_X_ROUND)[edge.value]]]),
|
|
157
154
|
onPointerdown: onThumbPointerDown
|
|
158
155
|
}, null, 8, ["class"])
|
|
159
156
|
]),
|
|
@@ -182,7 +179,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
182
179
|
}, 8, ["class", "style"])
|
|
183
180
|
]),
|
|
184
181
|
_: 3
|
|
185
|
-
}, 8, ["class"]);
|
|
182
|
+
}, 8, ["class", "scroll-hide-delay"]);
|
|
186
183
|
};
|
|
187
184
|
}
|
|
188
185
|
});
|
|
@@ -8,12 +8,12 @@ import { useFieldControl } from "../composables/useField.js";
|
|
|
8
8
|
import { mergeClass } from "../composables/useMergedClass.js";
|
|
9
9
|
import { _ as _sfc_main$5 } from "./FieldWrapper-DnuMTrqW.js";
|
|
10
10
|
import { _ as _sfc_main$3 } from "./LpButton-DSHioIfD.js";
|
|
11
|
-
import { _ as _sfc_main$2 } from "./LpCopyButton-
|
|
11
|
+
import { _ as _sfc_main$2 } from "./LpCopyButton-sAMvWeLP.js";
|
|
12
12
|
import { _ as _sfc_main$4 } from "./LpIcon-C6JpQ5td.js";
|
|
13
|
-
import { _ as _sfc_main$1 } from "./LpPasswordInput-
|
|
13
|
+
import { _ as _sfc_main$1 } from "./LpPasswordInput-Duc_3wPv.js";
|
|
14
14
|
import { _ as _sfc_main$6 } from "./LpShift-DAgS_d2x.js";
|
|
15
|
-
import { _ as _sfc_main$8 } from "./LpTooltip-
|
|
16
|
-
import { _ as _sfc_main$7 } from "./RevealToggle-
|
|
15
|
+
import { _ as _sfc_main$8 } from "./LpTooltip-Bz_rrq5S.js";
|
|
16
|
+
import { _ as _sfc_main$7 } from "./RevealToggle-D_iyrB8d.js";
|
|
17
17
|
const _hoisted_1 = ["id", "aria-label"];
|
|
18
18
|
const _hoisted_2 = {
|
|
19
19
|
key: "empty",
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { defineComponent, useId, ref, openBlock, createBlock, normalizeProps, guardReactiveProps, unref, withCtx, createVNode, mergeProps, createElementBlock, Fragment, renderList, normalizeClass, createCommentVNode, toDisplayString } from "vue";
|
|
2
|
+
import { _ as _sfc_main$1 } from "./FieldWrapper-DnuMTrqW.js";
|
|
3
|
+
import { CONTROL_SIZE } from "../components/controlSize.js";
|
|
4
|
+
import { isHTMLElement } from "../composables/realm.js";
|
|
5
|
+
import { usePaletteControl } from "../composables/usePaletteCommands.js";
|
|
6
|
+
import { Motion } from "motion-v";
|
|
7
|
+
import { ToggleGroupRoot, ToggleGroupItem } from "reka-ui";
|
|
8
|
+
import { useOwnField, mergeDescribedBy } from "../composables/useField.js";
|
|
9
|
+
import { useMergedAttrs } from "../composables/useMergedClass.js";
|
|
10
|
+
import { usePillTransition } from "../composables/usePillTransition.js";
|
|
11
|
+
import { _ as _sfc_main$3 } from "./AttentionDot-DCBf4aWg.js";
|
|
12
|
+
import { _ as _sfc_main$2 } from "./LpIcon-C6JpQ5td.js";
|
|
13
|
+
const _hoisted_1 = {
|
|
14
|
+
key: 1,
|
|
15
|
+
class: "relative z-10 inline-flex shrink-0"
|
|
16
|
+
};
|
|
17
|
+
const _hoisted_2 = {
|
|
18
|
+
key: 2,
|
|
19
|
+
class: "relative z-10"
|
|
20
|
+
};
|
|
21
|
+
const __default__ = { inheritAttrs: false };
|
|
22
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
23
|
+
...__default__,
|
|
24
|
+
__name: "LpSegmented",
|
|
25
|
+
props: {
|
|
26
|
+
palette: { type: [Boolean, Object], default: void 0 },
|
|
27
|
+
modelValue: {},
|
|
28
|
+
options: {},
|
|
29
|
+
size: { default: "md" },
|
|
30
|
+
block: { type: Boolean, default: false },
|
|
31
|
+
disabled: { type: Boolean },
|
|
32
|
+
error: {},
|
|
33
|
+
hoverFollow: { type: Boolean, default: true }
|
|
34
|
+
},
|
|
35
|
+
emits: ["update:modelValue"],
|
|
36
|
+
setup(__props, { emit: __emit }) {
|
|
37
|
+
const props = __props;
|
|
38
|
+
const emit = __emit;
|
|
39
|
+
function onChange(v) {
|
|
40
|
+
if (typeof v === "string" && v) emit("update:modelValue", v);
|
|
41
|
+
}
|
|
42
|
+
const sizeCls = CONTROL_SIZE;
|
|
43
|
+
const { class: rootClass, attrs: rest } = useMergedAttrs(() => [
|
|
44
|
+
"inline-flex items-center gap-1 rounded-control border border-line bg-surface-soft p-1",
|
|
45
|
+
sizeCls[props.size],
|
|
46
|
+
// `w-fit`, not left to the parent: in a column a flex item stretches, and
|
|
47
|
+
// the options sat on the left of an empty bar (the theme studio met it).
|
|
48
|
+
props.block ? "flex w-full" : "w-fit"
|
|
49
|
+
].join(" "), () => ownAttrs());
|
|
50
|
+
const { field, wrapper, ownAttrs } = useOwnField(() => ({ error: props.error, disabled: props.disabled }));
|
|
51
|
+
const pillId = `lp-segmented-${useId()}`;
|
|
52
|
+
const pillTransition = usePillTransition();
|
|
53
|
+
const hovered = ref(null);
|
|
54
|
+
function onEnter(opt) {
|
|
55
|
+
if (props.hoverFollow && !opt.disabled && !field.value.disabled) hovered.value = opt.value;
|
|
56
|
+
}
|
|
57
|
+
function pillUnder(value) {
|
|
58
|
+
return hovered.value ? hovered.value === value : value === props.modelValue;
|
|
59
|
+
}
|
|
60
|
+
function releaseFocusAfterPointer(event) {
|
|
61
|
+
const target = event.currentTarget;
|
|
62
|
+
if (isHTMLElement(target)) target.blur();
|
|
63
|
+
}
|
|
64
|
+
usePaletteControl({ disabled: () => field.value.disabled });
|
|
65
|
+
return (_ctx, _cache) => {
|
|
66
|
+
return openBlock(), createBlock(_sfc_main$1, normalizeProps(guardReactiveProps(unref(wrapper))), {
|
|
67
|
+
default: withCtx(() => [
|
|
68
|
+
createVNode(unref(ToggleGroupRoot), mergeProps({
|
|
69
|
+
"model-value": __props.modelValue,
|
|
70
|
+
type: "single",
|
|
71
|
+
disabled: unref(field).disabled,
|
|
72
|
+
"aria-labelledby": unref(field).labelId,
|
|
73
|
+
rovingFocus: true,
|
|
74
|
+
class: unref(rootClass)
|
|
75
|
+
}, unref(rest), {
|
|
76
|
+
"aria-describedby": unref(mergeDescribedBy)(unref(rest)["aria-describedby"], unref(field).describedBy),
|
|
77
|
+
"onUpdate:modelValue": onChange,
|
|
78
|
+
onPointerleave: _cache[0] || (_cache[0] = ($event) => hovered.value = null)
|
|
79
|
+
}), {
|
|
80
|
+
default: withCtx(() => [
|
|
81
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (opt) => {
|
|
82
|
+
return openBlock(), createBlock(unref(ToggleGroupItem), {
|
|
83
|
+
key: opt.value,
|
|
84
|
+
value: opt.value,
|
|
85
|
+
disabled: opt.disabled,
|
|
86
|
+
"aria-label": opt.ariaLabel ?? (opt.label ? void 0 : opt.value),
|
|
87
|
+
class: normalizeClass(["relative inline-flex h-full items-center justify-center gap-1.5 rounded-inner 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" : "", __props.size === "lg" ? "px-4" : "px-3", hovered.value === opt.value ? "text-ink" : ""]]),
|
|
88
|
+
onPointerenter: ($event) => onEnter(opt),
|
|
89
|
+
onPointerup: releaseFocusAfterPointer
|
|
90
|
+
}, {
|
|
91
|
+
default: withCtx(() => [
|
|
92
|
+
pillUnder(opt.value) ? (openBlock(), createBlock(unref(Motion), {
|
|
93
|
+
key: 0,
|
|
94
|
+
"layout-id": pillId,
|
|
95
|
+
transition: unref(pillTransition),
|
|
96
|
+
class: "absolute inset-0 z-0 rounded-inner border border-line bg-surface-raised shadow-sm"
|
|
97
|
+
}, null, 8, ["transition"])) : createCommentVNode("", true),
|
|
98
|
+
opt.icon ? (openBlock(), createElementBlock("span", _hoisted_1, [
|
|
99
|
+
createVNode(_sfc_main$2, {
|
|
100
|
+
name: opt.icon,
|
|
101
|
+
size: __props.size === "lg" ? 16 : 14
|
|
102
|
+
}, null, 8, ["name", "size"]),
|
|
103
|
+
opt.dot && !opt.label ? (openBlock(), createBlock(_sfc_main$3, {
|
|
104
|
+
key: 0,
|
|
105
|
+
corner: ""
|
|
106
|
+
})) : createCommentVNode("", true)
|
|
107
|
+
])) : createCommentVNode("", true),
|
|
108
|
+
opt.label ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(opt.label), 1)) : createCommentVNode("", true),
|
|
109
|
+
opt.dot && opt.label ? (openBlock(), createBlock(_sfc_main$3, {
|
|
110
|
+
key: 3,
|
|
111
|
+
class: "mt-1.5"
|
|
112
|
+
})) : createCommentVNode("", true)
|
|
113
|
+
]),
|
|
114
|
+
_: 2
|
|
115
|
+
}, 1032, ["value", "disabled", "aria-label", "class", "onPointerenter"]);
|
|
116
|
+
}), 128))
|
|
117
|
+
]),
|
|
118
|
+
_: 1
|
|
119
|
+
}, 16, ["model-value", "disabled", "aria-labelledby", "class", "aria-describedby"])
|
|
120
|
+
]),
|
|
121
|
+
_: 1
|
|
122
|
+
}, 16);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
export {
|
|
127
|
+
_sfc_main as _
|
|
128
|
+
};
|