@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.
Files changed (243) hide show
  1. package/dist/chunks/{DropzoneLinkField-DXIr0eFz.js → DropzoneLinkField-CyE7TJ5f.js} +1 -1
  2. package/dist/chunks/FieldLeading-mr81aEAP.js +27 -0
  3. package/dist/chunks/LpAddressInput-ft8fQOGx.js +401 -0
  4. package/dist/chunks/{LpAppShell-BNAVTQsY.js → LpAppShell-DkvU6IBB.js} +23 -4
  5. package/dist/chunks/LpAutocomplete-CrZbd0uv.js +310 -0
  6. package/dist/chunks/LpCheckbox-CCWCwD0y.js +129 -0
  7. package/dist/chunks/{LpCodeBlock-DuzmnIHl.js → LpCodeBlock-DBqy4RLd.js} +1 -1
  8. package/dist/chunks/{LpCodeDisplay-CO8fngxa.js → LpCodeDisplay-D59uPwRb.js} +3 -3
  9. package/dist/chunks/LpColorPicker-BONURBFN.js +574 -0
  10. package/dist/chunks/{LpConfirmDialog-6oCIJTDa.js → LpConfirmDialog-CnrmzkuN.js} +1 -1
  11. package/dist/chunks/{LpConfirmHost-DgHvfT6s.js → LpConfirmHost-CwbObVGH.js} +1 -1
  12. package/dist/chunks/{LpContextMenu--eMGIql6.js → LpContextMenu-Bx_IhQDS.js} +5 -5
  13. package/dist/chunks/{LpCopyButton-7EOSIuwa.js → LpCopyButton-sAMvWeLP.js} +1 -1
  14. package/dist/chunks/{LpDataList-DgBeM01y.js → LpDataList-CaVfsozH.js} +2 -2
  15. package/dist/chunks/LpDatePicker-C2AOtxgF.js +171 -0
  16. package/dist/chunks/{LpDateRangePicker-CNQXdTVv.js → LpDateRangePicker-CiXdIAyh.js} +43 -35
  17. package/dist/chunks/{LpDrawer-Bt9UUqt_.js → LpDrawer-DXNQFpAA.js} +1 -1
  18. package/dist/chunks/{LpFileTree-BSx1kBoV.js → LpFileTree-CpNurwZp.js} +3 -3
  19. package/dist/chunks/{LpFileTreeNode-4dVmFHb3.js → LpFileTreeNode-DdF8Cq-s.js} +2 -2
  20. package/dist/chunks/{LpHoverCard-DanH3Nz1.js → LpHoverCard-CHE9jAJG.js} +6 -6
  21. package/dist/chunks/{LpInfraNode-BAU40Km2.js → LpInfraNode-Bb5nbuFY.js} +17 -0
  22. package/dist/chunks/{LpInput-DL6HEJdi.js → LpInput-CbI7z5fQ.js} +21 -25
  23. package/dist/chunks/{LpInspector-CuoMAhiw.js → LpInspector-DO3fTCQ1.js} +2 -2
  24. package/dist/chunks/{LpLaneNode-HtnQf2FF.js → LpLaneNode-Bqcdm8Rf.js} +19 -1
  25. package/dist/chunks/{LpLightbox-xvpQ64MM.js → LpLightbox-CtDTQV01.js} +1 -1
  26. package/dist/chunks/{LpLogInspector-6cNnXqp4.js → LpLogInspector-CcSJSGan.js} +1 -1
  27. package/dist/chunks/{LpLogViewer-Dvb1E9_G.js → LpLogViewer-CWu49Dko.js} +4 -4
  28. package/dist/chunks/{LpMediaGallery-Df-tiWeq.js → LpMediaGallery-BYEwySoF.js} +2 -2
  29. package/dist/chunks/{LpModal-DrtQ_1A2.js → LpModal-DDvrSAnf.js} +1 -1
  30. package/dist/chunks/{LpModalNav-DkmGCnZE.js → LpModalNav-DI3BW5ff.js} +2 -2
  31. package/dist/chunks/{LpNotificationBell-D_wklO1m.js → LpNotificationBell-DUbVyK6R.js} +3 -3
  32. package/dist/chunks/LpNumberField-C8LfUz_R.js +154 -0
  33. package/dist/chunks/LpOtpInput-B1X9l9no.js +140 -0
  34. package/dist/chunks/LpPageScrollbar-D2O0xhJw.js +164 -0
  35. package/dist/chunks/{LpPaletteTheme-dVtxHx-F.js → LpPaletteTheme-B-xuZiKK.js} +2 -2
  36. package/dist/chunks/{LpPasswordInput-B-zD6tUS.js → LpPasswordInput-Duc_3wPv.js} +2 -2
  37. package/dist/chunks/{LpPhoneInput-BSL7NX4z.js → LpPhoneInput-CctcRK9K.js} +124 -118
  38. package/dist/chunks/{LpPie-9t_guO49.js → LpPie-oVNHjsKD.js} +2 -2
  39. package/dist/chunks/{LpPipeline-rjXvEDRJ.js → LpPipeline-BSXT6oUJ.js} +1 -1
  40. package/dist/chunks/LpRadioGroup-DTM0nd9G.js +103 -0
  41. package/dist/chunks/LpRangeSlider-DJsEZXad.js +97 -0
  42. package/dist/chunks/{LpRelativeTime-BovUk8MP.js → LpRelativeTime-0zI-44ve.js} +1 -1
  43. package/dist/chunks/LpRepeater-Czib3rmv.js +193 -0
  44. package/dist/chunks/{LpScrollArea-ay4Xo_hg.js → LpScrollArea-CqvwfZs2.js} +9 -12
  45. package/dist/chunks/{LpSecretField-DBvU6iAw.js → LpSecretField-BtlCk3IH.js} +4 -4
  46. package/dist/chunks/LpSegmented-sskrJKJJ.js +128 -0
  47. package/dist/chunks/LpSelect-JFZehOkd.js +515 -0
  48. package/dist/chunks/{LpServiceNode-D8uJ8sGk.js → LpServiceNode-Cln2ntdw.js} +17 -0
  49. package/dist/chunks/{LpSidebar-kSkpPh3-.js → LpSidebar-CvRvVBTt.js} +4 -4
  50. package/dist/chunks/{LpSidebarNav-C2mvqrY2.js → LpSidebarNav-CE0jQS8i.js} +2 -2
  51. package/dist/chunks/{LpSidebarRow-eRP4Q31q.js → LpSidebarRow-DOTg1txp.js} +2 -2
  52. package/dist/chunks/LpSlider-C4ilCtZX.js +76 -0
  53. package/dist/chunks/{LpStat-pMNZgFcq.js → LpStat-DPjc6_fX.js} +17 -4
  54. package/dist/chunks/LpSwitch-DyAYTchz.js +122 -0
  55. package/dist/chunks/{LpTableFilter-DgARTsA1.js → LpTableFilter-CJg5eIcV.js} +2 -2
  56. package/dist/chunks/{LpTagsInput-Dt0mteSj.js → LpTagsInput-CkNxpNYa.js} +4 -3
  57. package/dist/chunks/{LpTextarea-Co0b9PVx.js → LpTextarea-CFK_5QB8.js} +3 -2
  58. package/dist/chunks/{LpThemeStudio-DzYfE-5k.js → LpThemeStudio-R-wohbCY.js} +3 -3
  59. package/dist/chunks/{LpThemeSwitcher-CFLkdbBL.js → LpThemeSwitcher-Bzy15MCP.js} +2 -2
  60. package/dist/chunks/LpTimeField-B5n0m8m0.js +115 -0
  61. package/dist/chunks/{LpToaster-QFj0P-5m.js → LpToaster-Ct_ZOhCh.js} +1 -1
  62. package/dist/chunks/{LpTooltip-BJf3lZMq.js → LpTooltip-Bz_rrq5S.js} +5 -5
  63. package/dist/chunks/{LpTopologyCanvas-BOHHHZ_6.js → LpTopologyCanvas-BNgw9RyZ.js} +14 -9
  64. package/dist/chunks/{LpTruncate-C6u3gjc6.js → LpTruncate-ellq9RYM.js} +2 -2
  65. package/dist/chunks/{LpUptimeBar-BnYmR2rj.js → LpUptimeBar-BoxcCDVY.js} +1 -1
  66. package/dist/chunks/{LpWorkspaceSwitcher-D0e9upAy.js → LpWorkspaceSwitcher-ugv-fyig.js} +2 -2
  67. package/dist/chunks/{RevealToggle-CCPDE8Mv.js → RevealToggle-D_iyrB8d.js} +1 -1
  68. package/dist/component-names.d.ts +1 -1
  69. package/dist/components/DropzoneLinkField.vue.js +1 -1
  70. package/dist/components/FieldLeading.vue.d.ts +16 -0
  71. package/dist/components/FieldLeading.vue.js +4 -0
  72. package/dist/components/LpAddressInput.vue.d.ts +4 -0
  73. package/dist/components/LpAddressInput.vue.js +1 -1
  74. package/dist/components/LpAlert.vue.d.ts +3 -3
  75. package/dist/components/LpAppShell.vue.d.ts +16 -1
  76. package/dist/components/LpAppShell.vue.js +1 -1
  77. package/dist/components/LpAutocomplete.vue.d.ts +4 -0
  78. package/dist/components/LpAutocomplete.vue.js +1 -1
  79. package/dist/components/LpBadge.vue.d.ts +2 -2
  80. package/dist/components/LpChart.vue.d.ts +1 -1
  81. package/dist/components/LpChart.vue.js +1 -1
  82. package/dist/components/LpCheckbox.vue.d.ts +4 -0
  83. package/dist/components/LpCheckbox.vue.js +1 -1
  84. package/dist/components/LpCodeBlock.vue.js +1 -1
  85. package/dist/components/LpCodeDisplay.vue.js +1 -1
  86. package/dist/components/LpCollapse.vue.d.ts +1 -1
  87. package/dist/components/LpColorPicker.vue.d.ts +5 -3
  88. package/dist/components/LpColorPicker.vue.js +1 -1
  89. package/dist/components/LpCommandPalette.vue.js +1 -1
  90. package/dist/components/LpConfirmDialog.vue.js +1 -1
  91. package/dist/components/LpConfirmHost.vue.js +1 -1
  92. package/dist/components/LpContextMenu.vue.js +1 -1
  93. package/dist/components/LpCopyButton.vue.js +1 -1
  94. package/dist/components/LpDataList.vue.js +1 -1
  95. package/dist/components/LpDatePicker.vue.js +1 -1
  96. package/dist/components/LpDateRangePicker.vue.js +1 -1
  97. package/dist/components/LpDock.vue.js +1 -1
  98. package/dist/components/LpDrawer.vue.js +1 -1
  99. package/dist/components/LpDropzone.vue.js +1 -1
  100. package/dist/components/LpFileTree.vue.js +1 -1
  101. package/dist/components/LpFileTreeNode.vue.js +1 -1
  102. package/dist/components/LpHoverCard.vue.js +1 -1
  103. package/dist/components/LpImageEditor.vue.d.ts +1 -1
  104. package/dist/components/LpInfraNode.vue.d.ts +11 -2
  105. package/dist/components/LpInfraNode.vue.js +1 -1
  106. package/dist/components/LpInput.vue.js +1 -1
  107. package/dist/components/LpInspector.vue.js +1 -1
  108. package/dist/components/LpLaneNode.vue.d.ts +2 -3
  109. package/dist/components/LpLaneNode.vue.js +1 -1
  110. package/dist/components/LpLightbox.vue.js +1 -1
  111. package/dist/components/LpLogInspector.vue.js +1 -1
  112. package/dist/components/LpLogViewer.vue.js +1 -1
  113. package/dist/components/LpMediaGallery.vue.js +1 -1
  114. package/dist/components/LpModal.vue.js +1 -1
  115. package/dist/components/LpModalNav.vue.js +1 -1
  116. package/dist/components/LpNotificationBell.vue.js +1 -1
  117. package/dist/components/LpNumberField.vue.d.ts +17 -2
  118. package/dist/components/LpNumberField.vue.js +1 -1
  119. package/dist/components/LpOtpInput.vue.d.ts +4 -0
  120. package/dist/components/LpOtpInput.vue.js +1 -1
  121. package/dist/components/LpPageScrollbar.vue.d.ts +10 -0
  122. package/dist/components/LpPageScrollbar.vue.js +4 -0
  123. package/dist/components/LpPaletteTheme.vue.js +1 -1
  124. package/dist/components/LpPasswordInput.vue.js +1 -1
  125. package/dist/components/LpPhoneInput.vue.d.ts +4 -0
  126. package/dist/components/LpPhoneInput.vue.js +1 -1
  127. package/dist/components/LpPie.vue.js +1 -1
  128. package/dist/components/LpPipeline.vue.js +1 -1
  129. package/dist/components/LpRadioGroup.vue.d.ts +4 -0
  130. package/dist/components/LpRadioGroup.vue.js +1 -1
  131. package/dist/components/LpRangeSlider.vue.d.ts +4 -0
  132. package/dist/components/LpRangeSlider.vue.js +1 -1
  133. package/dist/components/LpRelativeTime.vue.js +1 -1
  134. package/dist/components/LpRepeater.vue.d.ts +2 -0
  135. package/dist/components/LpRepeater.vue.js +1 -1
  136. package/dist/components/LpScrollArea.vue.d.ts +1 -1
  137. package/dist/components/LpScrollArea.vue.js +1 -1
  138. package/dist/components/LpSecretField.vue.js +1 -1
  139. package/dist/components/LpSegmented.vue.d.ts +4 -0
  140. package/dist/components/LpSegmented.vue.js +1 -1
  141. package/dist/components/LpSelect.vue.d.ts +2 -0
  142. package/dist/components/LpSelect.vue.js +1 -1
  143. package/dist/components/LpServiceNode.vue.d.ts +8 -2
  144. package/dist/components/LpServiceNode.vue.js +1 -1
  145. package/dist/components/LpShinyText.vue.d.ts +1 -1
  146. package/dist/components/LpShortcutsDialog.vue.js +1 -1
  147. package/dist/components/LpSidebar.vue.d.ts +1 -1
  148. package/dist/components/LpSidebar.vue.js +1 -1
  149. package/dist/components/LpSidebarNav.vue.js +1 -1
  150. package/dist/components/LpSidebarRow.vue.js +1 -1
  151. package/dist/components/LpSlider.vue.d.ts +4 -0
  152. package/dist/components/LpSlider.vue.js +1 -1
  153. package/dist/components/LpStat.vue.d.ts +16 -0
  154. package/dist/components/LpStat.vue.js +1 -1
  155. package/dist/components/LpSwitch.vue.d.ts +4 -0
  156. package/dist/components/LpSwitch.vue.js +1 -1
  157. package/dist/components/LpTable.vue.js +5 -5
  158. package/dist/components/LpTableFilter.vue.js +1 -1
  159. package/dist/components/LpTabs.vue.d.ts +1 -1
  160. package/dist/components/LpTabs.vue.js +1 -1
  161. package/dist/components/LpTagsInput.vue.js +1 -1
  162. package/dist/components/LpTextarea.vue.js +1 -1
  163. package/dist/components/LpThemeStudio.vue.js +1 -1
  164. package/dist/components/LpThemeSwitcher.vue.js +1 -1
  165. package/dist/components/LpTimeField.vue.d.ts +4 -0
  166. package/dist/components/LpTimeField.vue.js +1 -1
  167. package/dist/components/LpToaster.vue.js +1 -1
  168. package/dist/components/LpTooltip.vue.js +1 -1
  169. package/dist/components/LpTopologyCanvas.vue.d.ts +2 -2
  170. package/dist/components/LpTopologyCanvas.vue.js +1 -1
  171. package/dist/components/LpTruncate.vue.js +1 -1
  172. package/dist/components/LpUptimeBar.vue.js +1 -1
  173. package/dist/components/LpWorkspaceSwitcher.vue.js +1 -1
  174. package/dist/components/RevealToggle.vue.js +1 -1
  175. package/dist/components/calendar.d.ts +2 -0
  176. package/dist/components/menuWhen.js +1 -1
  177. package/dist/components/scrollbar.d.ts +34 -0
  178. package/dist/components/scrollbar.js +47 -0
  179. package/dist/composables/propCheck.d.ts +1 -1
  180. package/dist/composables/propCheck.js +15 -4
  181. package/dist/composables/useField.d.ts +50 -0
  182. package/dist/composables/useField.js +31 -2
  183. package/dist/composables/useMergedClass.d.ts +6 -2
  184. package/dist/composables/useMergedClass.js +6 -6
  185. package/dist/composables/usePaletteCommands.js +4 -2
  186. package/dist/index.d.ts +1 -0
  187. package/dist/index.js +170 -168
  188. package/package.json +1 -1
  189. package/src/component-names.ts +1 -0
  190. package/src/components/FieldLeading.vue +17 -0
  191. package/src/components/LpAddressInput.vue +8 -4
  192. package/src/components/LpAppShell.vue +23 -0
  193. package/src/components/LpAutocomplete.vue +11 -5
  194. package/src/components/LpCheckbox.vue +8 -6
  195. package/src/components/LpColorPicker.vue +7 -4
  196. package/src/components/LpContextMenu.vue +7 -0
  197. package/src/components/LpDatePicker.vue +8 -4
  198. package/src/components/LpDateRangePicker.vue +8 -4
  199. package/src/components/LpHoverCard.vue +7 -0
  200. package/src/components/LpInfraNode.vue +4 -3
  201. package/src/components/LpInput.vue +7 -7
  202. package/src/components/LpLaneNode.vue +5 -1
  203. package/src/components/LpNumberField.vue +18 -7
  204. package/src/components/LpOtpInput.vue +8 -6
  205. package/src/components/LpPageScrollbar.vue +195 -0
  206. package/src/components/LpPhoneInput.vue +11 -6
  207. package/src/components/LpRadioGroup.vue +9 -5
  208. package/src/components/LpRangeSlider.vue +8 -4
  209. package/src/components/LpRepeater.vue +16 -4
  210. package/src/components/LpScrollArea.vue +27 -23
  211. package/src/components/LpSegmented.vue +8 -4
  212. package/src/components/LpSelect.vue +8 -7
  213. package/src/components/LpServiceNode.vue +4 -2
  214. package/src/components/LpSlider.vue +8 -4
  215. package/src/components/LpStat.vue +25 -5
  216. package/src/components/LpSwitch.vue +8 -5
  217. package/src/components/LpTagsInput.vue +4 -3
  218. package/src/components/LpTextarea.vue +3 -2
  219. package/src/components/LpTimeField.vue +8 -6
  220. package/src/components/LpTooltip.vue +7 -0
  221. package/src/components/LpTopologyCanvas.vue +3 -1
  222. package/src/components/calendar.ts +2 -0
  223. package/src/components/scrollbar.ts +71 -0
  224. package/src/composables/propCheck.ts +20 -5
  225. package/src/composables/useField.ts +52 -0
  226. package/src/composables/useMergedClass.ts +11 -5
  227. package/src/composables/usePaletteCommands.ts +5 -2
  228. package/src/index.ts +1 -0
  229. package/dist/chunks/LpAddressInput-ZqoZ-N2Y.js +0 -393
  230. package/dist/chunks/LpAutocomplete-DkY6CSyD.js +0 -302
  231. package/dist/chunks/LpCheckbox-D6RuDW4X.js +0 -124
  232. package/dist/chunks/LpColorPicker-BxAHEnR5.js +0 -567
  233. package/dist/chunks/LpDatePicker-DwSDY0mt.js +0 -163
  234. package/dist/chunks/LpNumberField-CNHsmSDZ.js +0 -134
  235. package/dist/chunks/LpOtpInput-BRpLBbOD.js +0 -132
  236. package/dist/chunks/LpRadioGroup-BrazjLY_.js +0 -95
  237. package/dist/chunks/LpRangeSlider-fz61tzc-.js +0 -89
  238. package/dist/chunks/LpRepeater-BkJHSPI1.js +0 -180
  239. package/dist/chunks/LpSegmented-DbEJhbv-.js +0 -123
  240. package/dist/chunks/LpSelect-Y-iuSymW.js +0 -512
  241. package/dist/chunks/LpSlider-A4ixovgS.js +0 -68
  242. package/dist/chunks/LpSwitch-DnC2-0aV.js +0 -115
  243. package/dist/chunks/LpTimeField-DeOcKWJq.js +0 -110
@@ -1,393 +0,0 @@
1
- import { defineComponent, defineAsyncComponent, computed, watch, ref, onMounted, openBlock, createElementBlock, mergeProps, unref, createVNode, withCtx, createElementVNode, createBlock, createCommentVNode, createTextVNode, toDisplayString, renderSlot, normalizeClass } from "vue";
2
- import { useAsyncTask } from "../composables/useAsyncTask.js";
3
- import { OSM_TILES, createNominatimProvider, emptyAddress, formatAddress } from "../components/address.js";
4
- import { flagEmoji, loadCountries } from "../components/countries.js";
5
- import { _ as _sfc_main$2 } from "./LpAutocomplete-DkY6CSyD.js";
6
- import { _ as _sfc_main$3 } from "./LpButton-DSHioIfD.js";
7
- import { _ as _sfc_main$1 } from "./LpFormField-BKYn9dyP.js";
8
- import { _ as _sfc_main$4 } from "./LpIcon-C6JpQ5td.js";
9
- import { _ as _sfc_main$5 } from "./LpInput-DL6HEJdi.js";
10
- import { _ as _sfc_main$7 } from "./LpModal-DrtQ_1A2.js";
11
- import { _ as _sfc_main$6 } from "./LpSelect-Y-iuSymW.js";
12
- import { useFieldControl, mergeDescribedBy } from "../composables/useField.js";
13
- import { useLabels } from "../composables/useLpConfig.js";
14
- import { useMergedAttrs } from "../composables/useMergedClass.js";
15
- const _hoisted_1 = ["aria-labelledby", "aria-invalid", "aria-describedby"];
16
- const _hoisted_2 = { class: "flex items-stretch gap-2" };
17
- const _hoisted_3 = { class: "grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]" };
18
- const _hoisted_4 = {
19
- key: 1,
20
- class: "flex items-center gap-2"
21
- };
22
- const _hoisted_5 = {
23
- key: 0,
24
- class: "text-xs text-muted"
25
- };
26
- const __default__ = { inheritAttrs: false };
27
- const _sfc_main = /* @__PURE__ */ defineComponent({
28
- ...__default__,
29
- __name: "LpAddressInput",
30
- props: {
31
- modelValue: {},
32
- provider: {},
33
- tiles: { default: () => OSM_TILES },
34
- only: {},
35
- secondLine: { type: Boolean },
36
- minChars: { default: 3 },
37
- debounce: { default: 350 },
38
- language: {},
39
- disabled: { type: Boolean },
40
- invalid: { type: Boolean },
41
- size: { default: "md" },
42
- hideMap: { type: Boolean },
43
- labels: {}
44
- },
45
- emits: ["update:modelValue", "pick"],
46
- setup(__props, { emit: __emit }) {
47
- const LpMapPicker = defineAsyncComponent(() => import("../components/LpMapPicker.vue.js"));
48
- const props = __props;
49
- const emit = __emit;
50
- const DEFAULT_LABELS = {
51
- line: "Street and number",
52
- linePlaceholder: "Baker Street 221B",
53
- secondLine: "Apartment, suite (optional)",
54
- secondLinePlaceholder: "Flat 4",
55
- city: "City",
56
- cityPlaceholder: "London",
57
- postalCode: "Postcode",
58
- postalCodePlaceholder: "NW1 6XE",
59
- country: "Country",
60
- countryPlaceholder: "Select country…",
61
- countrySearch: "Search country…",
62
- pickOnMap: "Pick on map",
63
- mapTitle: "Pick a location",
64
- mapHint: "Click the map to drop a pin, drag to move around.",
65
- use: "Use this address",
66
- cancel: "Cancel",
67
- searching: "Searching…",
68
- noSuggestions: "No suggestions",
69
- nothingHere: "No address found here"
70
- };
71
- const text = useLabels("addressInput", DEFAULT_LABELS, () => props.labels);
72
- const fallbackProvider = createNominatimProvider();
73
- const geocoder = computed(() => props.provider ?? fallbackProvider);
74
- const value = computed(() => props.modelValue ?? emptyAddress());
75
- let latest;
76
- watch(
77
- () => props.modelValue,
78
- () => latest = void 0
79
- );
80
- function patch(changes) {
81
- latest = { ...latest ?? value.value, ...changes };
82
- emit("update:modelValue", latest);
83
- }
84
- function edit(changes) {
85
- patch({ ...changes, lat: void 0, lon: void 0 });
86
- }
87
- const allCountries = ref([]);
88
- const countries = computed(() => {
89
- const only = props.only?.map((code) => code.toUpperCase());
90
- return only?.length ? allCountries.value.filter((c) => only.includes(c.iso2)) : allCountries.value;
91
- });
92
- const countryOptions = computed(
93
- () => countries.value.map((country) => ({
94
- value: country.iso2,
95
- label: `${flagEmoji(country.iso2)} ${country.name}`
96
- }))
97
- );
98
- onMounted(async () => {
99
- allCountries.value = await loadCountries();
100
- });
101
- function useSuggestions(field2) {
102
- const options = ref([]);
103
- const task = useAsyncTask();
104
- function query(term) {
105
- if (term.trim().length < props.minChars) {
106
- task.cancel();
107
- options.value = [];
108
- return;
109
- }
110
- task.run(
111
- (signal) => geocoder.value.search(term.trim(), field2, {
112
- country: value.value.country || void 0,
113
- language: props.language,
114
- signal
115
- }),
116
- {
117
- delay: props.debounce,
118
- apply: (found) => options.value = found,
119
- // Network failure: leave the field usable as free text.
120
- fail: () => options.value = []
121
- }
122
- );
123
- }
124
- return { options, loading: task.pending, query };
125
- }
126
- const lineSuggestions = useSuggestions("line");
127
- const citySuggestions = useSuggestions("city");
128
- function applySuggestion(suggestion, keep) {
129
- const parsed = suggestion.address;
130
- const changes = { lat: suggestion.lat, lon: suggestion.lon };
131
- if (parsed.line && keep !== "line") changes.line = parsed.line;
132
- if (parsed.city) changes.city = parsed.city;
133
- if (parsed.postalCode) changes.postalCode = parsed.postalCode;
134
- if (parsed.country) changes.country = parsed.country;
135
- patch(changes);
136
- }
137
- function onLineSelect(chosen) {
138
- const suggestion = lineSuggestions.options.value.find((option) => option.value === chosen);
139
- if (suggestion) applySuggestion(suggestion, "line");
140
- }
141
- function onCitySelect(chosen) {
142
- const suggestion = citySuggestions.options.value.find((option) => option.value === chosen);
143
- if (suggestion) applySuggestion(suggestion, "city");
144
- }
145
- const mapOpen = ref(false);
146
- const point = ref();
147
- const resolved = ref();
148
- const resolving = ref(false);
149
- computed(
150
- () => countries.value.find((c) => c.iso2 === value.value.country)?.name
151
- );
152
- const preview = computed(() => {
153
- if (resolving.value) return text.value.searching;
154
- if (!point.value) return text.value.mapHint;
155
- if (!resolved.value) return text.value.nothingHere;
156
- const parsed = resolved.value.address;
157
- return formatAddress(
158
- {
159
- line: parsed.line ?? "",
160
- city: parsed.city ?? "",
161
- postalCode: parsed.postalCode ?? "",
162
- country: parsed.country ?? ""
163
- },
164
- countries.value.find((c) => c.iso2 === parsed.country)?.name
165
- );
166
- });
167
- watch(mapOpen, (open) => {
168
- if (!open) return;
169
- point.value = value.value.lat != null && value.value.lon != null ? { lat: value.value.lat, lon: value.value.lon } : void 0;
170
- resolved.value = void 0;
171
- });
172
- const reverse = useAsyncTask();
173
- watch(reverse.pending, (busy) => resolving.value = busy);
174
- function onPick(next) {
175
- point.value = next;
176
- resolved.value = void 0;
177
- reverse.run(
178
- () => geocoder.value.reverse(next.lat, next.lon, { language: props.language }),
179
- {
180
- apply: (found) => resolved.value = found,
181
- fail: () => resolved.value = void 0
182
- }
183
- );
184
- }
185
- function confirmPoint() {
186
- if (!point.value) return;
187
- const parsed = resolved.value?.address ?? {};
188
- patch({
189
- line: parsed.line ?? value.value.line,
190
- city: parsed.city ?? value.value.city,
191
- postalCode: parsed.postalCode ?? value.value.postalCode,
192
- country: parsed.country ?? value.value.country,
193
- lat: point.value.lat,
194
- lon: point.value.lon
195
- });
196
- emit("pick", point.value);
197
- mapOpen.value = false;
198
- }
199
- const field = useFieldControl(() => ({ wrapped: false, invalid: props.invalid, disabled: props.disabled }));
200
- const { class: rootClass, attrs: rest } = useMergedAttrs(
201
- "flex flex-col gap-3"
202
- );
203
- return (_ctx, _cache) => {
204
- return openBlock(), createElementBlock("div", mergeProps({
205
- role: "group",
206
- "aria-labelledby": unref(field).labelId,
207
- "aria-invalid": unref(field).invalid || void 0,
208
- class: unref(rootClass)
209
- }, unref(rest), {
210
- "aria-describedby": unref(mergeDescribedBy)(unref(rest)["aria-describedby"], unref(field).describedBy)
211
- }), [
212
- createVNode(_sfc_main$1, {
213
- label: unref(text).line
214
- }, {
215
- default: withCtx(() => [
216
- createElementVNode("div", _hoisted_2, [
217
- createVNode(_sfc_main$2, {
218
- class: "min-w-0 flex-1",
219
- "model-value": value.value.line,
220
- options: unref(lineSuggestions).options.value,
221
- loading: unref(lineSuggestions).loading.value,
222
- filter: false,
223
- "min-chars": __props.minChars,
224
- disabled: unref(field).disabled,
225
- invalid: unref(field).invalid,
226
- size: __props.size,
227
- placeholder: unref(text).linePlaceholder,
228
- "empty-text": unref(text).noSuggestions,
229
- "loading-text": unref(text).searching,
230
- icon: "lucide:map-pin",
231
- "onUpdate:modelValue": _cache[0] || (_cache[0] = (next) => {
232
- edit({ line: next });
233
- unref(lineSuggestions).query(next);
234
- }),
235
- onSelect: onLineSelect
236
- }, null, 8, ["model-value", "options", "loading", "min-chars", "disabled", "invalid", "size", "placeholder", "empty-text", "loading-text"]),
237
- !__props.hideMap ? (openBlock(), createBlock(_sfc_main$3, {
238
- key: 0,
239
- variant: "soft",
240
- size: __props.size,
241
- square: "",
242
- disabled: unref(field).disabled,
243
- title: unref(text).pickOnMap,
244
- "aria-label": unref(text).pickOnMap,
245
- onClick: _cache[1] || (_cache[1] = ($event) => mapOpen.value = true)
246
- }, {
247
- default: withCtx(() => [
248
- createVNode(_sfc_main$4, {
249
- name: "lucide:map",
250
- size: 16
251
- })
252
- ]),
253
- _: 1
254
- }, 8, ["size", "disabled", "title", "aria-label"])) : createCommentVNode("", true)
255
- ])
256
- ]),
257
- _: 1
258
- }, 8, ["label"]),
259
- __props.secondLine ? (openBlock(), createBlock(_sfc_main$5, {
260
- key: 0,
261
- "model-value": value.value.line2 ?? "",
262
- label: unref(text).secondLine,
263
- placeholder: unref(text).secondLinePlaceholder,
264
- disabled: unref(field).disabled,
265
- invalid: unref(field).invalid,
266
- size: __props.size,
267
- autocomplete: "address-line2",
268
- "onUpdate:modelValue": _cache[2] || (_cache[2] = (next) => patch({ line2: next }))
269
- }, null, 8, ["model-value", "label", "placeholder", "disabled", "invalid", "size"])) : createCommentVNode("", true),
270
- createElementVNode("div", _hoisted_3, [
271
- createVNode(_sfc_main$1, {
272
- label: unref(text).city
273
- }, {
274
- default: withCtx(() => [
275
- createVNode(_sfc_main$2, {
276
- "model-value": value.value.city,
277
- options: unref(citySuggestions).options.value,
278
- loading: unref(citySuggestions).loading.value,
279
- filter: false,
280
- "min-chars": __props.minChars,
281
- disabled: unref(field).disabled,
282
- invalid: unref(field).invalid,
283
- size: __props.size,
284
- placeholder: unref(text).cityPlaceholder,
285
- "empty-text": unref(text).noSuggestions,
286
- "loading-text": unref(text).searching,
287
- "onUpdate:modelValue": _cache[3] || (_cache[3] = (next) => {
288
- edit({ city: next });
289
- unref(citySuggestions).query(next);
290
- }),
291
- onSelect: onCitySelect
292
- }, null, 8, ["model-value", "options", "loading", "min-chars", "disabled", "invalid", "size", "placeholder", "empty-text", "loading-text"])
293
- ]),
294
- _: 1
295
- }, 8, ["label"]),
296
- createVNode(_sfc_main$5, {
297
- "model-value": value.value.postalCode,
298
- label: unref(text).postalCode,
299
- placeholder: unref(text).postalCodePlaceholder,
300
- disabled: unref(field).disabled,
301
- invalid: unref(field).invalid,
302
- size: __props.size,
303
- autocomplete: "postal-code",
304
- "onUpdate:modelValue": _cache[4] || (_cache[4] = (next) => edit({ postalCode: next }))
305
- }, null, 8, ["model-value", "label", "placeholder", "disabled", "invalid", "size"])
306
- ]),
307
- createVNode(_sfc_main$1, {
308
- label: unref(text).country
309
- }, {
310
- default: withCtx(() => [
311
- createVNode(_sfc_main$6, {
312
- "model-value": value.value.country,
313
- options: countryOptions.value,
314
- placeholder: unref(text).countryPlaceholder,
315
- "search-placeholder": unref(text).countrySearch,
316
- disabled: unref(field).disabled,
317
- invalid: unref(field).invalid,
318
- size: __props.size,
319
- searchable: "",
320
- "onUpdate:modelValue": _cache[5] || (_cache[5] = (next) => edit({ country: String(next ?? "") }))
321
- }, null, 8, ["model-value", "options", "placeholder", "search-placeholder", "disabled", "invalid", "size"])
322
- ]),
323
- _: 1
324
- }, 8, ["label"]),
325
- !__props.hideMap ? (openBlock(), createElementBlock("div", _hoisted_4, [
326
- createVNode(_sfc_main$3, {
327
- variant: "soft",
328
- size: __props.size === "lg" ? "md" : "sm",
329
- disabled: unref(field).disabled,
330
- onClick: _cache[6] || (_cache[6] = ($event) => mapOpen.value = true)
331
- }, {
332
- default: withCtx(() => [
333
- createVNode(_sfc_main$4, {
334
- name: "lucide:map",
335
- size: 15
336
- }),
337
- createTextVNode(" " + toDisplayString(unref(text).pickOnMap), 1)
338
- ]),
339
- _: 1
340
- }, 8, ["size", "disabled"]),
341
- value.value.lat != null && value.value.lon != null ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(value.value.lat.toFixed(5)) + ", " + toDisplayString(value.value.lon.toFixed(5)), 1)) : createCommentVNode("", true)
342
- ])) : createCommentVNode("", true),
343
- createVNode(_sfc_main$7, {
344
- open: mapOpen.value,
345
- "onUpdate:open": _cache[8] || (_cache[8] = ($event) => mapOpen.value = $event),
346
- title: unref(text).mapTitle,
347
- size: "2xl"
348
- }, {
349
- footer: withCtx(() => [
350
- createVNode(_sfc_main$3, {
351
- variant: "ghost",
352
- onClick: _cache[7] || (_cache[7] = ($event) => mapOpen.value = false)
353
- }, {
354
- default: withCtx(() => [
355
- createTextVNode(toDisplayString(unref(text).cancel), 1)
356
- ]),
357
- _: 1
358
- }),
359
- createVNode(_sfc_main$3, {
360
- disabled: !point.value,
361
- onClick: confirmPoint
362
- }, {
363
- default: withCtx(() => [
364
- createTextVNode(toDisplayString(unref(text).use), 1)
365
- ]),
366
- _: 1
367
- }, 8, ["disabled"])
368
- ]),
369
- default: withCtx(() => [
370
- renderSlot(_ctx.$slots, "map", {
371
- point: point.value,
372
- setPoint: onPick,
373
- tiles: __props.tiles
374
- }, () => [
375
- createVNode(unref(LpMapPicker), {
376
- "model-value": point.value,
377
- tiles: __props.tiles,
378
- "onUpdate:modelValue": onPick
379
- }, null, 8, ["model-value", "tiles"])
380
- ]),
381
- createElementVNode("p", {
382
- class: normalizeClass(["mt-3 min-h-5 text-sm", resolved.value || resolving.value ? "text-ink" : "text-muted"])
383
- }, toDisplayString(preview.value), 3)
384
- ]),
385
- _: 3
386
- }, 8, ["open", "title"])
387
- ], 16, _hoisted_1);
388
- };
389
- }
390
- });
391
- export {
392
- _sfc_main as _
393
- };