@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Teleport } from "vue";
|
|
1
2
|
const KIT_COMPONENT = /^Lp[A-Z]/;
|
|
2
3
|
const ALWAYS_ALLOWED = /^(data-|aria-|on[A-Z])/;
|
|
3
4
|
const GLOBAL_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
@@ -46,11 +47,21 @@ function unknownAttributes(attributes, elements, ignore = []) {
|
|
|
46
47
|
return !elements.some((el) => propertiesOf(el).has(key));
|
|
47
48
|
});
|
|
48
49
|
}
|
|
50
|
+
function rootElements(vnode, out = []) {
|
|
51
|
+
if (!vnode || vnode.type === Teleport) return out;
|
|
52
|
+
if (vnode.component) return rootElements(vnode.component.subTree, out);
|
|
53
|
+
const el = vnode.el;
|
|
54
|
+
if (el?.nodeType === 1) {
|
|
55
|
+
out.push(el);
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
if (Array.isArray(vnode.children)) {
|
|
59
|
+
for (const child of vnode.children) if (child && typeof child === "object") rootElements(child, out);
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
49
63
|
function renderedElements(instance) {
|
|
50
|
-
|
|
51
|
-
if (root?.nodeType !== 1) return [];
|
|
52
|
-
const el = root;
|
|
53
|
-
return [el, ...el.querySelectorAll(FORWARD_TARGETS)];
|
|
64
|
+
return rootElements(instance.$.subTree).flatMap((el) => [el, ...el.querySelectorAll(FORWARD_TARGETS)]);
|
|
54
65
|
}
|
|
55
66
|
const lpPropCheck = {
|
|
56
67
|
install(app, options = {}) {
|
|
@@ -80,6 +80,56 @@ export declare function fieldWrapperBinds(wrapped: boolean, field: {
|
|
|
80
80
|
class: unknown;
|
|
81
81
|
style: unknown;
|
|
82
82
|
};
|
|
83
|
+
/**
|
|
84
|
+
* Whether a control with these props draws its own LpFormField. A label or a
|
|
85
|
+
* hint is its own; an error alone is, except inside an outer LpFormField, which
|
|
86
|
+
* owns the label (its `for` points at the control) and the message line: a
|
|
87
|
+
* second field in it showed the message twice and took the label's control id.
|
|
88
|
+
* There the error only marks the control invalid.
|
|
89
|
+
*/
|
|
90
|
+
export declare function wrapsItself(own: {
|
|
91
|
+
label?: string;
|
|
92
|
+
hint?: string;
|
|
93
|
+
error?: string;
|
|
94
|
+
}, outer: ComputedRef<FieldContext> | null): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* A control that takes `label`, `hint` and `error` the way LpInput does: given
|
|
97
|
+
* any of them it wraps itself in LpFormField (FieldWrapper, bound to
|
|
98
|
+
* `wrapper`), an error marks it invalid, and the consumer's class and style lay
|
|
99
|
+
* out that field instead of the control (`ownAttrs` says whether the control's
|
|
100
|
+
* root still takes them). Without them it is the bare control, as before. So
|
|
101
|
+
* `v-bind="form.field('x')"`, which hands every control `error`, shows the
|
|
102
|
+
* message on any of them.
|
|
103
|
+
* Inside an outer LpFormField an error alone does not wrap (wrapsItself).
|
|
104
|
+
*/
|
|
105
|
+
export declare function useOwnField(state: () => {
|
|
106
|
+
label?: string;
|
|
107
|
+
hint?: string;
|
|
108
|
+
error?: string;
|
|
109
|
+
required?: boolean;
|
|
110
|
+
invalid?: boolean;
|
|
111
|
+
disabled?: boolean;
|
|
112
|
+
id?: string;
|
|
113
|
+
}): {
|
|
114
|
+
wrapped: ComputedRef<boolean>;
|
|
115
|
+
field: ComputedRef<Omit<FieldContext, "id"> & {
|
|
116
|
+
id?: string;
|
|
117
|
+
}>;
|
|
118
|
+
wrapper: ComputedRef<{
|
|
119
|
+
wrapped: boolean;
|
|
120
|
+
id: string | undefined;
|
|
121
|
+
label: string | undefined;
|
|
122
|
+
hint: string | undefined;
|
|
123
|
+
error: string | undefined;
|
|
124
|
+
required: boolean | undefined;
|
|
125
|
+
class: unknown;
|
|
126
|
+
style: unknown;
|
|
127
|
+
}>;
|
|
128
|
+
controlAttrs: ComputedRef<{
|
|
129
|
+
[x: string]: unknown;
|
|
130
|
+
}>;
|
|
131
|
+
ownAttrs: () => boolean;
|
|
132
|
+
};
|
|
83
133
|
/** The state of a control that takes its id from the app and draws no wrapper of its own. */
|
|
84
134
|
export declare function useAttrsField(state: () => {
|
|
85
135
|
invalid?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useId, computed, provide,
|
|
1
|
+
import { inject, useId, computed, provide, useAttrs, onScopeDispose } from "vue";
|
|
2
2
|
import { isElement } from "./realm.js";
|
|
3
3
|
const LP_FIELD = /* @__PURE__ */ Symbol.for("lp-field");
|
|
4
4
|
function provideField(context) {
|
|
@@ -74,6 +74,33 @@ function fieldWrapperBinds(wrapped, field, props, attrs) {
|
|
|
74
74
|
const { label, hint, error, required } = props;
|
|
75
75
|
return { wrapped, id: field.id, label, hint, error, required, class: attrs.class, style: attrs.style };
|
|
76
76
|
}
|
|
77
|
+
function wrapsItself(own, outer) {
|
|
78
|
+
if (own.label || own.hint) return true;
|
|
79
|
+
return !!own.error && !outer?.value;
|
|
80
|
+
}
|
|
81
|
+
function useOwnField(state) {
|
|
82
|
+
const attrs = useAttrs();
|
|
83
|
+
const outer = useField();
|
|
84
|
+
const wrapped = computed(() => wrapsItself(state(), outer));
|
|
85
|
+
const field = useFieldControl(() => {
|
|
86
|
+
const own = state();
|
|
87
|
+
return {
|
|
88
|
+
wrapped: wrapped.value,
|
|
89
|
+
hasMessage: !!own.error || !!own.hint,
|
|
90
|
+
id: own.id ?? (typeof attrs.id === "string" ? attrs.id : void 0),
|
|
91
|
+
invalid: !!own.invalid || !!own.error,
|
|
92
|
+
required: own.required,
|
|
93
|
+
disabled: own.disabled
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
const wrapper = computed(() => fieldWrapperBinds(wrapped.value, field.value, state(), attrs));
|
|
97
|
+
const controlAttrs = computed(() => {
|
|
98
|
+
if (!wrapped.value) return attrs;
|
|
99
|
+
const { class: _class, style: _style, ...rest } = attrs;
|
|
100
|
+
return rest;
|
|
101
|
+
});
|
|
102
|
+
return { wrapped, field, wrapper, controlAttrs, ownAttrs: () => !wrapped.value };
|
|
103
|
+
}
|
|
77
104
|
function useAttrsField(state) {
|
|
78
105
|
const attrs = useAttrs();
|
|
79
106
|
const field = useFieldControl(() => ({
|
|
@@ -94,5 +121,7 @@ export {
|
|
|
94
121
|
useAttrsField,
|
|
95
122
|
useField,
|
|
96
123
|
useFieldBlur,
|
|
97
|
-
useFieldControl
|
|
124
|
+
useFieldControl,
|
|
125
|
+
useOwnField,
|
|
126
|
+
wrapsItself
|
|
98
127
|
};
|
|
@@ -13,7 +13,9 @@ import { type ComputedRef, type MaybeRefOrGetter } from "vue";
|
|
|
13
13
|
* Pair it with `inheritAttrs: false` (and bind the rest of `$attrs` yourself)
|
|
14
14
|
* so the raw `class` does not land on the element a second time, unmerged.
|
|
15
15
|
*/
|
|
16
|
-
export declare function useMergedClass(own: MaybeRefOrGetter<string | undefined
|
|
16
|
+
export declare function useMergedClass(own: MaybeRefOrGetter<string | undefined>,
|
|
17
|
+
/** False while something else takes the consumer's class (a field wrapper). */
|
|
18
|
+
takesAttrs?: () => boolean): ComputedRef<string>;
|
|
17
19
|
/**
|
|
18
20
|
* `useMergedClass` plus the rest of `$attrs`, for the common `inheritAttrs:
|
|
19
21
|
* false` shape: bind `class` and `attrs` and the consumer's `class` lands once,
|
|
@@ -30,7 +32,9 @@ export declare function useMergedClass(own: MaybeRefOrGetter<string | undefined>
|
|
|
30
32
|
* Vue appends that second `class` to the merged one, and stylesheet order —
|
|
31
33
|
* not the caller — decides which wins.
|
|
32
34
|
*/
|
|
33
|
-
export declare function useMergedAttrs(own: MaybeRefOrGetter<string | undefined
|
|
35
|
+
export declare function useMergedAttrs(own: MaybeRefOrGetter<string | undefined>,
|
|
36
|
+
/** False while a field wrapper takes the consumer's class and style (useOwnField's `ownAttrs`). */
|
|
37
|
+
takesAttrs?: () => boolean): {
|
|
34
38
|
class: ComputedRef<string>;
|
|
35
39
|
attrs: ComputedRef<Record<string, unknown>>;
|
|
36
40
|
};
|
|
@@ -14,17 +14,17 @@ function merge(...classes) {
|
|
|
14
14
|
const joined = cx(...classes);
|
|
15
15
|
return joined ? kitMerge(joined) : "";
|
|
16
16
|
}
|
|
17
|
-
function useMergedClass(own) {
|
|
17
|
+
function useMergedClass(own, takesAttrs = () => true) {
|
|
18
18
|
const attrs = useAttrs();
|
|
19
|
-
return computed(() => merge(toValue(own), attrs.class));
|
|
19
|
+
return computed(() => merge(toValue(own), takesAttrs() ? attrs.class : void 0));
|
|
20
20
|
}
|
|
21
|
-
function useMergedAttrs(own) {
|
|
21
|
+
function useMergedAttrs(own, takesAttrs = () => true) {
|
|
22
22
|
const attrs = useAttrs();
|
|
23
23
|
return {
|
|
24
|
-
class: useMergedClass(own),
|
|
24
|
+
class: useMergedClass(own, takesAttrs),
|
|
25
25
|
attrs: computed(() => {
|
|
26
|
-
const { class: _omitted, ...rest } = attrs;
|
|
27
|
-
return rest;
|
|
26
|
+
const { class: _omitted, style, ...rest } = attrs;
|
|
27
|
+
return takesAttrs() ? { ...rest, ...style === void 0 ? {} : { style } } : rest;
|
|
28
28
|
})
|
|
29
29
|
};
|
|
30
30
|
}
|
|
@@ -194,8 +194,10 @@ function usePaletteControl(options = {}) {
|
|
|
194
194
|
autofocus: void 0,
|
|
195
195
|
palette: false,
|
|
196
196
|
disabled: options.disabled?.() || !writable(),
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
// Only to a control that declares them: elsewhere they fell through
|
|
198
|
+
// as attributes onto its root (a switch's button took `required`).
|
|
199
|
+
..."invalid" in instance.props ? { invalid: options.invalid?.() } : {},
|
|
200
|
+
..."required" in instance.props ? { required: field?.value.required ?? instance.props.required } : {},
|
|
199
201
|
"aria-label": label(),
|
|
200
202
|
class: "w-full",
|
|
201
203
|
style: void 0
|
package/dist/index.d.ts
CHANGED
|
@@ -133,6 +133,7 @@ export { default as LpRadioGroup } from "./components/LpRadioGroup.vue";
|
|
|
133
133
|
export type { RadioOption } from "./components/LpRadioGroup.vue";
|
|
134
134
|
export { default as LpRollingText } from "./components/LpRollingText.vue";
|
|
135
135
|
export { default as LpScrollArea } from "./components/LpScrollArea.vue";
|
|
136
|
+
export { default as LpPageScrollbar } from "./components/LpPageScrollbar.vue";
|
|
136
137
|
export { default as LpSegmented } from "./components/LpSegmented.vue";
|
|
137
138
|
export type { SegmentedOption } from "./components/LpSegmented.vue";
|
|
138
139
|
export { default as LpSection } from "./components/LpSection.vue";
|