@retailcrm/embed-ui-v1-components 0.4.1-beta.1 → 0.4.1-beta.3

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/host.cjs CHANGED
@@ -60,7 +60,7 @@ var VARIANT = /* @__PURE__ */ ((VARIANT2) => {
60
60
  VARIANT2["DANGER"] = "danger";
61
61
  return VARIANT2;
62
62
  })(VARIANT || {});
63
- const _sfc_main$c = vue.defineComponent({
63
+ const _sfc_main$d = vue.defineComponent({
64
64
  props: {
65
65
  /** Устанавливает тип кнопки */
66
66
  type: {
@@ -161,7 +161,7 @@ var ALIGN = /* @__PURE__ */ ((ALIGN2) => {
161
161
  ALIGN2["RIGHT"] = "right";
162
162
  return ALIGN2;
163
163
  })(ALIGN || {});
164
- const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
164
+ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
165
165
  __name: "UiError",
166
166
  props: {
167
167
  /** Тест, разметка ошибки */
@@ -200,12 +200,12 @@ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
200
200
  };
201
201
  }
202
202
  });
203
- const _hoisted_1$6 = {
203
+ const _hoisted_1$7 = {
204
204
  xmlns: "http://www.w3.org/2000/svg",
205
205
  viewBox: "0 0 24 24"
206
206
  };
207
207
  function render$3(_ctx, _cache) {
208
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$6, _cache[0] || (_cache[0] = [
208
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$7, _cache[0] || (_cache[0] = [
209
209
  vue.createElementVNode("path", {
210
210
  fill: "currentColor",
211
211
  d: "m6.844 17.854-.7-.703a.5.5 0 0 1 0-.704l8.48-8.456-6.212.007a.49.49 0 0 1-.496-.5l.007-.991a.5.5 0 0 1 .496-.5L16.994 6c.196 0 .385.078.524.218l.265.267c.137.142.215.33.217.528l-.007 8.633a.5.5 0 0 1-.496.5h-.992a.48.48 0 0 1-.49-.493l.007-6.255-8.48 8.456a.49.49 0 0 1-.698 0"
@@ -231,7 +231,7 @@ var SIZE$3 = /* @__PURE__ */ ((SIZE2) => {
231
231
  SIZE2["TITLE02"] = "title-02";
232
232
  return SIZE2;
233
233
  })(SIZE$3 || {});
234
- const _hoisted_1$5 = ["href", "target"];
234
+ const _hoisted_1$6 = ["href", "target"];
235
235
  const _hoisted_2$2 = {
236
236
  key: 0,
237
237
  class: "ui-v1-link__inner"
@@ -240,7 +240,7 @@ const _hoisted_3$2 = {
240
240
  key: 2,
241
241
  class: "ui-v1-link__icon"
242
242
  };
243
- const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
243
+ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
244
244
  __name: "UiLink",
245
245
  props: {
246
246
  /** Атрибут ссылки */
@@ -314,11 +314,11 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
314
314
  vue.createVNode(vue.unref(IconOpenInNew), { class: "ui-v1-link__icon-sprite" })
315
315
  ])
316
316
  ])) : vue.createCommentVNode("", true)
317
- ], 16, _hoisted_1$5);
317
+ ], 16, _hoisted_1$6);
318
318
  };
319
319
  }
320
320
  });
321
- const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
321
+ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
322
322
  __name: "UiTransition",
323
323
  props: {
324
324
  /** Наименование анимации перехода */
@@ -346,7 +346,7 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
346
346
  };
347
347
  }
348
348
  });
349
- const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
349
+ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
350
350
  __name: "UiLoader",
351
351
  props: {
352
352
  /** Диаметр (размер) окружности индикатора */
@@ -378,7 +378,7 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
378
378
  },
379
379
  setup(__props) {
380
380
  return (_ctx, _cache) => {
381
- return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(__props.transition ? _sfc_main$9 : "div"), vue.normalizeProps(vue.guardReactiveProps(__props.transition ? {
381
+ return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(__props.transition ? _sfc_main$a : "div"), vue.normalizeProps(vue.guardReactiveProps(__props.transition ? {
382
382
  appear: true,
383
383
  class: "ui-v1-loader-wrapper",
384
384
  name: __props.transition
@@ -1530,7 +1530,7 @@ var PerfectScrollbar$1 = {
1530
1530
  );
1531
1531
  }
1532
1532
  };
1533
- const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1533
+ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
1534
1534
  __name: "UiScrollBox",
1535
1535
  props: {
1536
1536
  /** Наименование тэга-обёртки для нативного скролла */
@@ -1634,12 +1634,12 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1634
1634
  };
1635
1635
  }
1636
1636
  });
1637
- const _hoisted_1$4 = {
1637
+ const _hoisted_1$5 = {
1638
1638
  xmlns: "http://www.w3.org/2000/svg",
1639
1639
  viewBox: "0 0 24 24"
1640
1640
  };
1641
1641
  function render$2(_ctx, _cache) {
1642
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$4, _cache[0] || (_cache[0] = [
1642
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$5, _cache[0] || (_cache[0] = [
1643
1643
  vue.createElementVNode("path", {
1644
1644
  fill: "currentColor",
1645
1645
  d: "M7.113 6.176a.6.6 0 0 1 .848 0L12 10.214l4.038-4.038a.6.6 0 0 1 .849 0l.937.937a.6.6 0 0 1 0 .848L13.785 12l4.04 4.04a.6.6 0 0 1 0 .848l-.937.937a.6.6 0 0 1-.849 0L12 13.784l-4.038 4.04a.6.6 0 0 1-.849 0l-.937-.937a.6.6 0 0 1 0-.848l4.04-4.04-4.039-4.038a.6.6 0 0 1 0-.849z"
@@ -1742,7 +1742,7 @@ var SIZE$2 = /* @__PURE__ */ ((SIZE2) => {
1742
1742
  SIZE2["SM"] = "sm";
1743
1743
  return SIZE2;
1744
1744
  })(SIZE$2 || {});
1745
- const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
1745
+ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1746
1746
  __name: "UiModalSidebar",
1747
1747
  props: {
1748
1748
  /** Атрибут id корневого элемента. Должен быть уникальным на странице */
@@ -1972,7 +1972,7 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
1972
1972
  }))
1973
1973
  ]);
1974
1974
  };
1975
- const renderBody = () => props.scrolling === SCROLLING$1.NONE ? vue.h("div", { class: "ui-v1-modal-sidebar__body-fixed" }, renderSlot("default")) : vue.h(_sfc_main$7, {
1975
+ const renderBody = () => props.scrolling === SCROLLING$1.NONE ? vue.h("div", { class: "ui-v1-modal-sidebar__body-fixed" }, renderSlot("default")) : vue.h(_sfc_main$8, {
1976
1976
  class: "ui-v1-modal-sidebar__body",
1977
1977
  native: props.scrolling === SCROLLING$1.NATIVE,
1978
1978
  showOnMac: true,
@@ -1985,7 +1985,7 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
1985
1985
  const direction = props.direction;
1986
1986
  const size = props.size;
1987
1987
  const setVisibility = (visibility2) => () => visibilityOfSidebar.value = visibility2;
1988
- return vue.h(_sfc_main$9, {
1988
+ return vue.h(_sfc_main$a, {
1989
1989
  name: `slide-${direction}`,
1990
1990
  onBeforeEnter: setVisibility("showing"),
1991
1991
  onAfterEnter: setVisibility("shown"),
@@ -2013,7 +2013,7 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
2013
2013
  const setVisibility = (visibility2) => () => visibilityOfOverlay.value = visibility2;
2014
2014
  return !state.attached ? void 0 : vue.h(vue.Teleport, {
2015
2015
  to: (globals == null ? void 0 : globals.container) ?? document.body
2016
- }, vue.h(_sfc_main$9, {
2016
+ }, vue.h(_sfc_main$a, {
2017
2017
  name: "fade-2",
2018
2018
  onBeforeEnter: setVisibility("showing"),
2019
2019
  onAfterEnter: setVisibility("shown"),
@@ -2071,7 +2071,7 @@ var SCROLLING = /* @__PURE__ */ ((SCROLLING2) => {
2071
2071
  SCROLLING2["NATIVE"] = "native";
2072
2072
  return SCROLLING2;
2073
2073
  })(SCROLLING || {});
2074
- const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2074
+ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
2075
2075
  __name: "UiModalWindowSurface",
2076
2076
  props: {
2077
2077
  /** Атрибут id корневого элемента модального окна. Должен быть уникальным на странице */
@@ -2285,7 +2285,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2285
2285
  const slots = vue.useSlots();
2286
2286
  const renderBody = () => {
2287
2287
  const appearance = props.appearance;
2288
- return vue.h(_sfc_main$9, {
2288
+ return vue.h(_sfc_main$a, {
2289
2289
  name: "zoom",
2290
2290
  onBeforeEnter: () => visibilityOfBody.value = "showing",
2291
2291
  onAfterEnter: () => visibilityOfBody.value = "shown",
@@ -2310,7 +2310,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2310
2310
  };
2311
2311
  const EmbedModalWindowSurface = () => !state.attached ? void 0 : vue.h(vue.Teleport, {
2312
2312
  to: (globals == null ? void 0 : globals.container) ?? document.body
2313
- }, vue.h(_sfc_main$9, {
2313
+ }, vue.h(_sfc_main$a, {
2314
2314
  name: "fade-2",
2315
2315
  onBeforeEnter: () => visibilityOfOverlay.value = "showing",
2316
2316
  onAfterEnter: () => visibilityOfOverlay.value = "shown",
@@ -2327,7 +2327,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2327
2327
  "ui-v1-modal_overlapped": state.overlapped
2328
2328
  }],
2329
2329
  onClick: onOverlayClick
2330
- }, vue.h(_sfc_main$7, {
2330
+ }, vue.h(_sfc_main$8, {
2331
2331
  class: {
2332
2332
  "ui-v1-modal-window-container": true,
2333
2333
  "ui-v1-modal-window-container_fullscreen": props.fullscreen,
@@ -2352,12 +2352,12 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2352
2352
  };
2353
2353
  }
2354
2354
  });
2355
- const _hoisted_1$3 = {
2355
+ const _hoisted_1$4 = {
2356
2356
  xmlns: "http://www.w3.org/2000/svg",
2357
2357
  viewBox: "0 0 24 24"
2358
2358
  };
2359
2359
  function render$1(_ctx, _cache) {
2360
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$3, _cache[0] || (_cache[0] = [
2360
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$4, _cache[0] || (_cache[0] = [
2361
2361
  vue.createElementVNode("path", {
2362
2362
  fill: "currentColor",
2363
2363
  "fill-rule": "evenodd",
@@ -2367,7 +2367,7 @@ function render$1(_ctx, _cache) {
2367
2367
  ]));
2368
2368
  }
2369
2369
  const IconWarning = { render: render$1 };
2370
- const _hoisted_1$2 = {
2370
+ const _hoisted_1$3 = {
2371
2371
  key: 0,
2372
2372
  class: "ui-v1-modal-window__icon"
2373
2373
  };
@@ -2384,7 +2384,7 @@ const _hoisted_5 = {
2384
2384
  key: 0,
2385
2385
  class: "ui-v1-modal-window__footer-text"
2386
2386
  };
2387
- const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
2387
+ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2388
2388
  __name: "UiModalWindow",
2389
2389
  props: {
2390
2390
  /** Атрибут id корневого элемента модального окна. Должен быть уникальным на странице */
@@ -2498,7 +2498,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
2498
2498
  });
2499
2499
  vue.watch(() => props.opened, toggle);
2500
2500
  return (_ctx, _cache) => {
2501
- return vue.openBlock(), vue.createBlock(_sfc_main$5, vue.mergeProps({
2501
+ return vue.openBlock(), vue.createBlock(_sfc_main$6, vue.mergeProps({
2502
2502
  id: __props.id,
2503
2503
  opened: state.opened,
2504
2504
  closable: __props.closable,
@@ -2526,7 +2526,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
2526
2526
  "ui-v1-modal-window__header_pinned": _ctx.$slots.title && state.scrolled && __props.appearance === vue.unref(APPEARANCE).POPUP && !__props.responsive
2527
2527
  })
2528
2528
  }, [
2529
- __props.appearance === vue.unref(APPEARANCE).ALERT ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
2529
+ __props.appearance === vue.unref(APPEARANCE).ALERT ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
2530
2530
  vue.renderSlot(_ctx.$slots, "icon", {
2531
2531
  overlapped: state.overlapped
2532
2532
  }, () => [
@@ -2555,7 +2555,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
2555
2555
  })
2556
2556
  ])) : vue.createCommentVNode("", true)
2557
2557
  ], 2),
2558
- __props.responsive ? (vue.openBlock(), vue.createBlock(_sfc_main$7, {
2558
+ __props.responsive ? (vue.openBlock(), vue.createBlock(_sfc_main$8, {
2559
2559
  key: 0,
2560
2560
  class: "ui-v1-modal-window__content",
2561
2561
  "show-on-mac": "",
@@ -2588,12 +2588,12 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
2588
2588
  };
2589
2589
  }
2590
2590
  });
2591
- const _hoisted_1$1 = {
2591
+ const _hoisted_1$2 = {
2592
2592
  xmlns: "http://www.w3.org/2000/svg",
2593
2593
  viewBox: "0 0 24 24"
2594
2594
  };
2595
2595
  function render(_ctx, _cache) {
2596
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$1, _cache[0] || (_cache[0] = [
2596
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$2, _cache[0] || (_cache[0] = [
2597
2597
  vue.createElementVNode("path", {
2598
2598
  fill: "currentColor",
2599
2599
  d: "m14.675 4.6.544-1.257a.99.99 0 0 0-.04-.911.82.82 0 0 0-.739-.421L9.5 2a.81.81 0 0 0-.704.423.99.99 0 0 0-.047.88l.55 1.26c.155.358.201.762.13 1.15l-.623 3.441a2.8 2.8 0 0 1-.685 1.426l-.875.96a.96.96 0 0 0-.246.646l.025.555c.002.502.373.91.83.912l8.312.025c.458 0 .828-.407.828-.909l.005-.536a.96.96 0 0 0-.248-.646l-.878-.964a2.85 2.85 0 0 1-.691-1.43l-.636-3.443a2 2 0 0 1 .128-1.15M10.967 20.047a3 3 0 0 1-.196-1.079l-.007-3.771 2.424.057.007 3.758a3 3 0 0 1-.193 1.079l-.638 1.632a.415.415 0 0 1-.382.277.42.42 0 0 1-.383-.279z"
@@ -2776,16 +2776,16 @@ const init = (locale, options = null) => localize(
2776
2776
  locale
2777
2777
  );
2778
2778
  const _i18n = {
2779
- fallback: "en-GB",
2779
+ fallback,
2780
2780
  init
2781
2781
  };
2782
- const _hoisted_1 = {
2782
+ const _hoisted_1$1 = {
2783
2783
  key: 0,
2784
2784
  class: "ui-v1-tag__icon"
2785
2785
  };
2786
2786
  const _hoisted_2 = { class: "ui-v1-tag__content-inner" };
2787
2787
  const _hoisted_3 = ["aria-label"];
2788
- const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
2788
+ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
2789
2789
  __name: "UiTag",
2790
2790
  props: {
2791
2791
  /** Рамер */
@@ -2848,7 +2848,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
2848
2848
  style: vue.normalizeStyle(__props.background ? { background: __props.background } : {}),
2849
2849
  onMouseoverOnce: onHover
2850
2850
  }, [
2851
- _ctx.$slots["icon"] || __props.pinned ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
2851
+ _ctx.$slots["icon"] || __props.pinned ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
2852
2852
  vue.renderSlot(_ctx.$slots, "icon", {}, () => [
2853
2853
  vue.createVNode(vue.unref(IconPinned))
2854
2854
  ])
@@ -2890,7 +2890,7 @@ const useToolbarSize = () => vue.inject(ToolbarInjectKeys.size, vue.computed(
2890
2890
  () => "sm"
2891
2891
  /* SM */
2892
2892
  ));
2893
- const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
2893
+ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
2894
2894
  ...{
2895
2895
  inheritAttrs: false
2896
2896
  },
@@ -2909,7 +2909,7 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
2909
2909
  };
2910
2910
  }
2911
2911
  });
2912
- const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
2912
+ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
2913
2913
  ...{
2914
2914
  inheritAttrs: false
2915
2915
  },
@@ -2966,7 +2966,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
2966
2966
  return SIZE$4.SM;
2967
2967
  });
2968
2968
  return (_ctx, _cache) => {
2969
- return vue.openBlock(), vue.createBlock(_sfc_main$c, vue.mergeProps({
2969
+ return vue.openBlock(), vue.createBlock(_sfc_main$d, vue.mergeProps({
2970
2970
  ref_key: "root",
2971
2971
  ref: root,
2972
2972
  href: __props.href,
@@ -2990,7 +2990,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
2990
2990
  };
2991
2991
  }
2992
2992
  });
2993
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
2993
+ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
2994
2994
  ...{
2995
2995
  inheritAttrs: false
2996
2996
  },
@@ -3039,7 +3039,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
3039
3039
  },
3040
3040
  setup(__props) {
3041
3041
  return (_ctx, _cache) => {
3042
- return vue.openBlock(), vue.createBlock(_sfc_main$a, vue.mergeProps({
3042
+ return vue.openBlock(), vue.createBlock(_sfc_main$b, vue.mergeProps({
3043
3043
  href: __props.href,
3044
3044
  external: __props.external,
3045
3045
  appearance: __props.appearance,
@@ -3065,19 +3065,190 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
3065
3065
  };
3066
3066
  }
3067
3067
  });
3068
+ const load = (document2, src) => new Promise((resolve, reject) => {
3069
+ const script = document2.createElement("script");
3070
+ script.async = true;
3071
+ script.src = src;
3072
+ script.onload = (event) => resolve(event);
3073
+ script.onerror = (event, source, lineno, colno, error) => {
3074
+ console.error(`Failed to load script from ${src}`, {
3075
+ event,
3076
+ source,
3077
+ lineno,
3078
+ colno,
3079
+ error
3080
+ });
3081
+ reject(error);
3082
+ };
3083
+ const head = document2.head || document2.getElementsByTagName("head")[0];
3084
+ head.appendChild(script);
3085
+ });
3086
+ const _hoisted_1 = { class: "ui-v1-yandex-map" };
3087
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
3088
+ __name: "UiYandexMap",
3089
+ props: {
3090
+ apiKey: {
3091
+ type: String,
3092
+ required: true
3093
+ },
3094
+ address: {
3095
+ type: String,
3096
+ default: ""
3097
+ }
3098
+ },
3099
+ emits: [
3100
+ "change",
3101
+ "update:address"
3102
+ ],
3103
+ setup(__props, { emit: __emit }) {
3104
+ const props = __props;
3105
+ const emit = __emit;
3106
+ const vueI18n = vue.inject(I18nInjectKey);
3107
+ const iframe = vue.ref(null);
3108
+ const getIFrameDocument = () => {
3109
+ var _a;
3110
+ return ((_a = iframe.value) == null ? void 0 : _a.contentDocument) ?? null;
3111
+ };
3112
+ const getIFrameWindow = () => {
3113
+ var _a;
3114
+ return ((_a = iframe.value) == null ? void 0 : _a.contentWindow) ?? null;
3115
+ };
3116
+ const getIFrameYMaps = () => {
3117
+ const iframeWindow = getIFrameWindow();
3118
+ if (iframeWindow && "ymaps3" in iframeWindow) {
3119
+ return iframeWindow["ymaps3"];
3120
+ }
3121
+ return null;
3122
+ };
3123
+ const LOCATION = {
3124
+ center: [37.64, 55.76],
3125
+ zoom: 10
3126
+ };
3127
+ const waitIFrameContentLoaded = (retry = 5) => {
3128
+ var _a;
3129
+ if ((_a = iframe.value) == null ? void 0 : _a.contentDocument) {
3130
+ return Promise.resolve();
3131
+ }
3132
+ if (retry <= 1) {
3133
+ throw new Error("iframe contentDocument wasn't loaded");
3134
+ }
3135
+ return new Promise((resolve) => setTimeout(async () => {
3136
+ await waitIFrameContentLoaded(retry--);
3137
+ resolve(0);
3138
+ }, 100));
3139
+ };
3140
+ const ready = vue.ref(false);
3141
+ const apiLocale = vue.computed(() => ({
3142
+ "en-GB": "en_US",
3143
+ "es-ES": "en_US",
3144
+ "ru-RU": "ru_RU"
3145
+ })[(vueI18n == null ? void 0 : vueI18n.locale) ?? "en-GB"]);
3146
+ const apiUrl = vue.computed(() => `https://api-maps.yandex.ru/v3/?apikey=${props.apiKey}&lang=${apiLocale.value}`);
3147
+ const apiUrlVersion = vue.ref(0);
3148
+ const getGeocodeApiUrl = (geocode) => `https://geocode-maps.yandex.ru/1.x/?apikey=${props.apiKey}&geocode=${geocode}&lang=${apiLocale.value}&format=json`;
3149
+ function onDragEndHandler(coordinates) {
3150
+ fetchAddressFromCoordinates(coordinates).then((address) => {
3151
+ emit("change", address);
3152
+ emit("update:address", address);
3153
+ });
3154
+ }
3155
+ const fetchAddressFromCoordinates = async (coordinates) => {
3156
+ var _a, _b, _c, _d, _e;
3157
+ const response = await fetch(getGeocodeApiUrl(coordinates.toString()));
3158
+ const result = await response.json();
3159
+ return ((_e = (_d = (_c = (_b = (_a = result.response.GeoObjectCollection.featureMember[0]) == null ? void 0 : _a.GeoObject) == null ? void 0 : _b.metaDataProperty) == null ? void 0 : _c.GeocoderMetaData) == null ? void 0 : _d.Address) == null ? void 0 : _e.formatted) ?? "";
3160
+ };
3161
+ const fetchCoordinatesFromAddress = async (address) => {
3162
+ var _a, _b;
3163
+ const response = await fetch(getGeocodeApiUrl(address));
3164
+ const result = await response.json();
3165
+ return ((_b = (_a = result.response.GeoObjectCollection.featureMember[0]) == null ? void 0 : _a.GeoObject) == null ? void 0 : _b.Point.pos) ?? "";
3166
+ };
3167
+ const loadApi = async () => {
3168
+ var _a;
3169
+ await waitIFrameContentLoaded();
3170
+ const iframeDocument = getIFrameDocument();
3171
+ if (iframeDocument) {
3172
+ const style = iframeDocument.createElement("style");
3173
+ style.innerHTML = "body { margin: 0; }";
3174
+ iframeDocument.head.appendChild(style);
3175
+ await load(iframeDocument, apiUrl.value);
3176
+ await ((_a = getIFrameYMaps()) == null ? void 0 : _a.ready);
3177
+ const el = iframeDocument.createElement("div");
3178
+ el.setAttribute("id", "map");
3179
+ iframeDocument.body.appendChild(el);
3180
+ ready.value = true;
3181
+ const _ymaps3 = getIFrameYMaps();
3182
+ const {
3183
+ YMap,
3184
+ YMapControls,
3185
+ YMapDefaultFeaturesLayer,
3186
+ YMapDefaultSchemeLayer
3187
+ } = _ymaps3;
3188
+ const { YMapZoomControl, YMapGeolocationControl } = await _ymaps3.import("@yandex/ymaps3-controls@0.0.1");
3189
+ const { YMapDefaultMarker } = await _ymaps3.import("@yandex/ymaps3-markers@0.0.1");
3190
+ if (props.address) {
3191
+ const pos = await fetchCoordinatesFromAddress(props.address);
3192
+ if (pos) {
3193
+ LOCATION.center = pos.split(" ").map((c) => Number(c));
3194
+ }
3195
+ }
3196
+ const map = new YMap(el, { location: LOCATION });
3197
+ map.addChild(new YMapDefaultSchemeLayer({}));
3198
+ map.addChild(new YMapControls({ position: "right" }).addChild(new YMapZoomControl({})));
3199
+ map.addChild(new YMapDefaultFeaturesLayer({ id: "features" }));
3200
+ map.addChild(new YMapControls({ position: "left" }).addChild(new YMapGeolocationControl({})));
3201
+ const onDragMoveHandler = (coordinates) => {
3202
+ const longitude = `Longitude: ${coordinates[0].toFixed(2)}`;
3203
+ const latitude = `Latitude: ${coordinates[1].toFixed(2)}`;
3204
+ draggableMarker.update({ coordinates, title: `${longitude} <br> ${latitude}` });
3205
+ };
3206
+ const draggableMarker = new YMapDefaultMarker({
3207
+ coordinates: LOCATION.center,
3208
+ draggable: true,
3209
+ title: `Longitude: ${LOCATION.center[0].toFixed(2)} <br>
3210
+ Latitude ${LOCATION.center[1].toFixed(2)}`,
3211
+ onDragMove: onDragMoveHandler,
3212
+ onDragEnd: onDragEndHandler
3213
+ });
3214
+ map.addChild(draggableMarker);
3215
+ }
3216
+ };
3217
+ vue.watch(apiUrl, async (newUrl, oldUrl) => {
3218
+ if (iframe.value && newUrl !== oldUrl) {
3219
+ ready.value = false;
3220
+ apiUrlVersion.value++;
3221
+ }
3222
+ });
3223
+ return (_ctx, _cache) => {
3224
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
3225
+ !ready.value ? (vue.openBlock(), vue.createBlock(_sfc_main$9, { key: 0 })) : vue.createCommentVNode("", true),
3226
+ vue.withDirectives((vue.openBlock(), vue.createElementBlock("iframe", {
3227
+ ref_key: "iframe",
3228
+ ref: iframe,
3229
+ key: apiUrlVersion.value,
3230
+ onLoad: loadApi
3231
+ }, null, 32)), [
3232
+ [vue.vShow, ready.value]
3233
+ ])
3234
+ ]);
3235
+ };
3236
+ }
3237
+ });
3068
3238
  exports.I18nPlugin = plugin;
3069
3239
  exports.ModalPlugin = plugin$1;
3070
- exports.UiButton = _sfc_main$c;
3071
- exports.UiError = _sfc_main$b;
3072
- exports.UiLink = _sfc_main$a;
3073
- exports.UiLoader = _sfc_main$8;
3074
- exports.UiModalSidebar = _sfc_main$6;
3075
- exports.UiModalWindow = _sfc_main$4;
3076
- exports.UiModalWindowSurface = _sfc_main$5;
3077
- exports.UiScrollBox = _sfc_main$7;
3078
- exports.UiTag = _sfc_main$3;
3079
- exports.UiToolbar = _sfc_main$2;
3080
- exports.UiToolbarButton = _sfc_main$1;
3081
- exports.UiToolbarLink = _sfc_main;
3082
- exports.UiTransition = _sfc_main$9;
3240
+ exports.UiButton = _sfc_main$d;
3241
+ exports.UiError = _sfc_main$c;
3242
+ exports.UiLink = _sfc_main$b;
3243
+ exports.UiLoader = _sfc_main$9;
3244
+ exports.UiModalSidebar = _sfc_main$7;
3245
+ exports.UiModalWindow = _sfc_main$5;
3246
+ exports.UiModalWindowSurface = _sfc_main$6;
3247
+ exports.UiScrollBox = _sfc_main$8;
3248
+ exports.UiTag = _sfc_main$4;
3249
+ exports.UiToolbar = _sfc_main$3;
3250
+ exports.UiToolbarButton = _sfc_main$2;
3251
+ exports.UiToolbarLink = _sfc_main$1;
3252
+ exports.UiTransition = _sfc_main$a;
3253
+ exports.UiYandexMap = _sfc_main;
3083
3254
  exports.VueI18n = VueI18n;
package/dist/host.css CHANGED
@@ -1403,3 +1403,15 @@
1403
1403
  transform: translateX(var(--delta-width));
1404
1404
  }
1405
1405
  }
1406
+ .ui-v1-yandex-map {
1407
+ display: flex;
1408
+ width: 100%;
1409
+ min-height: 360px;
1410
+ position: relative;
1411
+ }
1412
+ .ui-v1-yandex-map iframe {
1413
+ width: 100%;
1414
+ height: 100%;
1415
+ border: none;
1416
+ position: absolute;
1417
+ }
package/dist/host.d.ts CHANGED
@@ -434,6 +434,13 @@ declare type UiTransitionProps = {
434
434
  appear?: boolean;
435
435
  };
436
436
 
437
+ export declare const UiYandexMap: DefineComponent<UiYandexMapProperties>;
438
+
439
+ declare type UiYandexMapProperties = {
440
+ apiKey: string;
441
+ address?: string;
442
+ };
443
+
437
444
  declare enum VARIANT {
438
445
  DEFAULT = "default",
439
446
  SUCCESS = "success",
package/dist/host.js CHANGED
@@ -58,7 +58,7 @@ var VARIANT = /* @__PURE__ */ ((VARIANT2) => {
58
58
  VARIANT2["DANGER"] = "danger";
59
59
  return VARIANT2;
60
60
  })(VARIANT || {});
61
- const _sfc_main$c = defineComponent({
61
+ const _sfc_main$d = defineComponent({
62
62
  props: {
63
63
  /** Устанавливает тип кнопки */
64
64
  type: {
@@ -159,7 +159,7 @@ var ALIGN = /* @__PURE__ */ ((ALIGN2) => {
159
159
  ALIGN2["RIGHT"] = "right";
160
160
  return ALIGN2;
161
161
  })(ALIGN || {});
162
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
162
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
163
163
  __name: "UiError",
164
164
  props: {
165
165
  /** Тест, разметка ошибки */
@@ -198,12 +198,12 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
198
198
  };
199
199
  }
200
200
  });
201
- const _hoisted_1$6 = {
201
+ const _hoisted_1$7 = {
202
202
  xmlns: "http://www.w3.org/2000/svg",
203
203
  viewBox: "0 0 24 24"
204
204
  };
205
205
  function render$3(_ctx, _cache) {
206
- return openBlock(), createElementBlock("svg", _hoisted_1$6, _cache[0] || (_cache[0] = [
206
+ return openBlock(), createElementBlock("svg", _hoisted_1$7, _cache[0] || (_cache[0] = [
207
207
  createElementVNode("path", {
208
208
  fill: "currentColor",
209
209
  d: "m6.844 17.854-.7-.703a.5.5 0 0 1 0-.704l8.48-8.456-6.212.007a.49.49 0 0 1-.496-.5l.007-.991a.5.5 0 0 1 .496-.5L16.994 6c.196 0 .385.078.524.218l.265.267c.137.142.215.33.217.528l-.007 8.633a.5.5 0 0 1-.496.5h-.992a.48.48 0 0 1-.49-.493l.007-6.255-8.48 8.456a.49.49 0 0 1-.698 0"
@@ -229,7 +229,7 @@ var SIZE$3 = /* @__PURE__ */ ((SIZE2) => {
229
229
  SIZE2["TITLE02"] = "title-02";
230
230
  return SIZE2;
231
231
  })(SIZE$3 || {});
232
- const _hoisted_1$5 = ["href", "target"];
232
+ const _hoisted_1$6 = ["href", "target"];
233
233
  const _hoisted_2$2 = {
234
234
  key: 0,
235
235
  class: "ui-v1-link__inner"
@@ -238,7 +238,7 @@ const _hoisted_3$2 = {
238
238
  key: 2,
239
239
  class: "ui-v1-link__icon"
240
240
  };
241
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
241
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
242
242
  __name: "UiLink",
243
243
  props: {
244
244
  /** Атрибут ссылки */
@@ -312,11 +312,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
312
312
  createVNode(unref(IconOpenInNew), { class: "ui-v1-link__icon-sprite" })
313
313
  ])
314
314
  ])) : createCommentVNode("", true)
315
- ], 16, _hoisted_1$5);
315
+ ], 16, _hoisted_1$6);
316
316
  };
317
317
  }
318
318
  });
319
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
319
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
320
320
  __name: "UiTransition",
321
321
  props: {
322
322
  /** Наименование анимации перехода */
@@ -344,7 +344,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
344
344
  };
345
345
  }
346
346
  });
347
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
347
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
348
348
  __name: "UiLoader",
349
349
  props: {
350
350
  /** Диаметр (размер) окружности индикатора */
@@ -376,7 +376,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
376
376
  },
377
377
  setup(__props) {
378
378
  return (_ctx, _cache) => {
379
- return openBlock(), createBlock(resolveDynamicComponent(__props.transition ? _sfc_main$9 : "div"), normalizeProps(guardReactiveProps(__props.transition ? {
379
+ return openBlock(), createBlock(resolveDynamicComponent(__props.transition ? _sfc_main$a : "div"), normalizeProps(guardReactiveProps(__props.transition ? {
380
380
  appear: true,
381
381
  class: "ui-v1-loader-wrapper",
382
382
  name: __props.transition
@@ -1528,7 +1528,7 @@ var PerfectScrollbar$1 = {
1528
1528
  );
1529
1529
  }
1530
1530
  };
1531
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1531
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1532
1532
  __name: "UiScrollBox",
1533
1533
  props: {
1534
1534
  /** Наименование тэга-обёртки для нативного скролла */
@@ -1632,12 +1632,12 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1632
1632
  };
1633
1633
  }
1634
1634
  });
1635
- const _hoisted_1$4 = {
1635
+ const _hoisted_1$5 = {
1636
1636
  xmlns: "http://www.w3.org/2000/svg",
1637
1637
  viewBox: "0 0 24 24"
1638
1638
  };
1639
1639
  function render$2(_ctx, _cache) {
1640
- return openBlock(), createElementBlock("svg", _hoisted_1$4, _cache[0] || (_cache[0] = [
1640
+ return openBlock(), createElementBlock("svg", _hoisted_1$5, _cache[0] || (_cache[0] = [
1641
1641
  createElementVNode("path", {
1642
1642
  fill: "currentColor",
1643
1643
  d: "M7.113 6.176a.6.6 0 0 1 .848 0L12 10.214l4.038-4.038a.6.6 0 0 1 .849 0l.937.937a.6.6 0 0 1 0 .848L13.785 12l4.04 4.04a.6.6 0 0 1 0 .848l-.937.937a.6.6 0 0 1-.849 0L12 13.784l-4.038 4.04a.6.6 0 0 1-.849 0l-.937-.937a.6.6 0 0 1 0-.848l4.04-4.04-4.039-4.038a.6.6 0 0 1 0-.849z"
@@ -1740,7 +1740,7 @@ var SIZE$2 = /* @__PURE__ */ ((SIZE2) => {
1740
1740
  SIZE2["SM"] = "sm";
1741
1741
  return SIZE2;
1742
1742
  })(SIZE$2 || {});
1743
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1743
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1744
1744
  __name: "UiModalSidebar",
1745
1745
  props: {
1746
1746
  /** Атрибут id корневого элемента. Должен быть уникальным на странице */
@@ -1970,7 +1970,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1970
1970
  }))
1971
1971
  ]);
1972
1972
  };
1973
- const renderBody = () => props.scrolling === SCROLLING$1.NONE ? h("div", { class: "ui-v1-modal-sidebar__body-fixed" }, renderSlot2("default")) : h(_sfc_main$7, {
1973
+ const renderBody = () => props.scrolling === SCROLLING$1.NONE ? h("div", { class: "ui-v1-modal-sidebar__body-fixed" }, renderSlot2("default")) : h(_sfc_main$8, {
1974
1974
  class: "ui-v1-modal-sidebar__body",
1975
1975
  native: props.scrolling === SCROLLING$1.NATIVE,
1976
1976
  showOnMac: true,
@@ -1983,7 +1983,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1983
1983
  const direction = props.direction;
1984
1984
  const size = props.size;
1985
1985
  const setVisibility = (visibility2) => () => visibilityOfSidebar.value = visibility2;
1986
- return h(_sfc_main$9, {
1986
+ return h(_sfc_main$a, {
1987
1987
  name: `slide-${direction}`,
1988
1988
  onBeforeEnter: setVisibility("showing"),
1989
1989
  onAfterEnter: setVisibility("shown"),
@@ -2011,7 +2011,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2011
2011
  const setVisibility = (visibility2) => () => visibilityOfOverlay.value = visibility2;
2012
2012
  return !state.attached ? void 0 : h(Teleport, {
2013
2013
  to: (globals == null ? void 0 : globals.container) ?? document.body
2014
- }, h(_sfc_main$9, {
2014
+ }, h(_sfc_main$a, {
2015
2015
  name: "fade-2",
2016
2016
  onBeforeEnter: setVisibility("showing"),
2017
2017
  onAfterEnter: setVisibility("shown"),
@@ -2069,7 +2069,7 @@ var SCROLLING = /* @__PURE__ */ ((SCROLLING2) => {
2069
2069
  SCROLLING2["NATIVE"] = "native";
2070
2070
  return SCROLLING2;
2071
2071
  })(SCROLLING || {});
2072
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2072
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2073
2073
  __name: "UiModalWindowSurface",
2074
2074
  props: {
2075
2075
  /** Атрибут id корневого элемента модального окна. Должен быть уникальным на странице */
@@ -2283,7 +2283,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2283
2283
  const slots = useSlots();
2284
2284
  const renderBody = () => {
2285
2285
  const appearance = props.appearance;
2286
- return h(_sfc_main$9, {
2286
+ return h(_sfc_main$a, {
2287
2287
  name: "zoom",
2288
2288
  onBeforeEnter: () => visibilityOfBody.value = "showing",
2289
2289
  onAfterEnter: () => visibilityOfBody.value = "shown",
@@ -2308,7 +2308,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2308
2308
  };
2309
2309
  const EmbedModalWindowSurface = () => !state.attached ? void 0 : h(Teleport, {
2310
2310
  to: (globals == null ? void 0 : globals.container) ?? document.body
2311
- }, h(_sfc_main$9, {
2311
+ }, h(_sfc_main$a, {
2312
2312
  name: "fade-2",
2313
2313
  onBeforeEnter: () => visibilityOfOverlay.value = "showing",
2314
2314
  onAfterEnter: () => visibilityOfOverlay.value = "shown",
@@ -2325,7 +2325,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2325
2325
  "ui-v1-modal_overlapped": state.overlapped
2326
2326
  }],
2327
2327
  onClick: onOverlayClick
2328
- }, h(_sfc_main$7, {
2328
+ }, h(_sfc_main$8, {
2329
2329
  class: {
2330
2330
  "ui-v1-modal-window-container": true,
2331
2331
  "ui-v1-modal-window-container_fullscreen": props.fullscreen,
@@ -2350,12 +2350,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2350
2350
  };
2351
2351
  }
2352
2352
  });
2353
- const _hoisted_1$3 = {
2353
+ const _hoisted_1$4 = {
2354
2354
  xmlns: "http://www.w3.org/2000/svg",
2355
2355
  viewBox: "0 0 24 24"
2356
2356
  };
2357
2357
  function render$1(_ctx, _cache) {
2358
- return openBlock(), createElementBlock("svg", _hoisted_1$3, _cache[0] || (_cache[0] = [
2358
+ return openBlock(), createElementBlock("svg", _hoisted_1$4, _cache[0] || (_cache[0] = [
2359
2359
  createElementVNode("path", {
2360
2360
  fill: "currentColor",
2361
2361
  "fill-rule": "evenodd",
@@ -2365,7 +2365,7 @@ function render$1(_ctx, _cache) {
2365
2365
  ]));
2366
2366
  }
2367
2367
  const IconWarning = { render: render$1 };
2368
- const _hoisted_1$2 = {
2368
+ const _hoisted_1$3 = {
2369
2369
  key: 0,
2370
2370
  class: "ui-v1-modal-window__icon"
2371
2371
  };
@@ -2382,7 +2382,7 @@ const _hoisted_5 = {
2382
2382
  key: 0,
2383
2383
  class: "ui-v1-modal-window__footer-text"
2384
2384
  };
2385
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2385
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2386
2386
  __name: "UiModalWindow",
2387
2387
  props: {
2388
2388
  /** Атрибут id корневого элемента модального окна. Должен быть уникальным на странице */
@@ -2496,7 +2496,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2496
2496
  });
2497
2497
  watch(() => props.opened, toggle);
2498
2498
  return (_ctx, _cache) => {
2499
- return openBlock(), createBlock(_sfc_main$5, mergeProps({
2499
+ return openBlock(), createBlock(_sfc_main$6, mergeProps({
2500
2500
  id: __props.id,
2501
2501
  opened: state.opened,
2502
2502
  closable: __props.closable,
@@ -2524,7 +2524,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2524
2524
  "ui-v1-modal-window__header_pinned": _ctx.$slots.title && state.scrolled && __props.appearance === unref(APPEARANCE).POPUP && !__props.responsive
2525
2525
  })
2526
2526
  }, [
2527
- __props.appearance === unref(APPEARANCE).ALERT ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
2527
+ __props.appearance === unref(APPEARANCE).ALERT ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
2528
2528
  renderSlot(_ctx.$slots, "icon", {
2529
2529
  overlapped: state.overlapped
2530
2530
  }, () => [
@@ -2553,7 +2553,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2553
2553
  })
2554
2554
  ])) : createCommentVNode("", true)
2555
2555
  ], 2),
2556
- __props.responsive ? (openBlock(), createBlock(_sfc_main$7, {
2556
+ __props.responsive ? (openBlock(), createBlock(_sfc_main$8, {
2557
2557
  key: 0,
2558
2558
  class: "ui-v1-modal-window__content",
2559
2559
  "show-on-mac": "",
@@ -2586,12 +2586,12 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2586
2586
  };
2587
2587
  }
2588
2588
  });
2589
- const _hoisted_1$1 = {
2589
+ const _hoisted_1$2 = {
2590
2590
  xmlns: "http://www.w3.org/2000/svg",
2591
2591
  viewBox: "0 0 24 24"
2592
2592
  };
2593
2593
  function render(_ctx, _cache) {
2594
- return openBlock(), createElementBlock("svg", _hoisted_1$1, _cache[0] || (_cache[0] = [
2594
+ return openBlock(), createElementBlock("svg", _hoisted_1$2, _cache[0] || (_cache[0] = [
2595
2595
  createElementVNode("path", {
2596
2596
  fill: "currentColor",
2597
2597
  d: "m14.675 4.6.544-1.257a.99.99 0 0 0-.04-.911.82.82 0 0 0-.739-.421L9.5 2a.81.81 0 0 0-.704.423.99.99 0 0 0-.047.88l.55 1.26c.155.358.201.762.13 1.15l-.623 3.441a2.8 2.8 0 0 1-.685 1.426l-.875.96a.96.96 0 0 0-.246.646l.025.555c.002.502.373.91.83.912l8.312.025c.458 0 .828-.407.828-.909l.005-.536a.96.96 0 0 0-.248-.646l-.878-.964a2.85 2.85 0 0 1-.691-1.43l-.636-3.443a2 2 0 0 1 .128-1.15M10.967 20.047a3 3 0 0 1-.196-1.079l-.007-3.771 2.424.057.007 3.758a3 3 0 0 1-.193 1.079l-.638 1.632a.415.415 0 0 1-.382.277.42.42 0 0 1-.383-.279z"
@@ -2774,16 +2774,16 @@ const init = (locale, options = null) => localize(
2774
2774
  locale
2775
2775
  );
2776
2776
  const _i18n = {
2777
- fallback: "en-GB",
2777
+ fallback,
2778
2778
  init
2779
2779
  };
2780
- const _hoisted_1 = {
2780
+ const _hoisted_1$1 = {
2781
2781
  key: 0,
2782
2782
  class: "ui-v1-tag__icon"
2783
2783
  };
2784
2784
  const _hoisted_2 = { class: "ui-v1-tag__content-inner" };
2785
2785
  const _hoisted_3 = ["aria-label"];
2786
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2786
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2787
2787
  __name: "UiTag",
2788
2788
  props: {
2789
2789
  /** Рамер */
@@ -2846,7 +2846,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2846
2846
  style: normalizeStyle(__props.background ? { background: __props.background } : {}),
2847
2847
  onMouseoverOnce: onHover
2848
2848
  }, [
2849
- _ctx.$slots["icon"] || __props.pinned ? (openBlock(), createElementBlock("div", _hoisted_1, [
2849
+ _ctx.$slots["icon"] || __props.pinned ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
2850
2850
  renderSlot(_ctx.$slots, "icon", {}, () => [
2851
2851
  createVNode(unref(IconPinned))
2852
2852
  ])
@@ -2888,7 +2888,7 @@ const useToolbarSize = () => inject(ToolbarInjectKeys.size, computed(
2888
2888
  () => "sm"
2889
2889
  /* SM */
2890
2890
  ));
2891
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2891
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2892
2892
  ...{
2893
2893
  inheritAttrs: false
2894
2894
  },
@@ -2907,7 +2907,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2907
2907
  };
2908
2908
  }
2909
2909
  });
2910
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2910
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2911
2911
  ...{
2912
2912
  inheritAttrs: false
2913
2913
  },
@@ -2964,7 +2964,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2964
2964
  return SIZE$4.SM;
2965
2965
  });
2966
2966
  return (_ctx, _cache) => {
2967
- return openBlock(), createBlock(_sfc_main$c, mergeProps({
2967
+ return openBlock(), createBlock(_sfc_main$d, mergeProps({
2968
2968
  ref_key: "root",
2969
2969
  ref: root,
2970
2970
  href: __props.href,
@@ -2988,7 +2988,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2988
2988
  };
2989
2989
  }
2990
2990
  });
2991
- const _sfc_main = /* @__PURE__ */ defineComponent({
2991
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2992
2992
  ...{
2993
2993
  inheritAttrs: false
2994
2994
  },
@@ -3037,7 +3037,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3037
3037
  },
3038
3038
  setup(__props) {
3039
3039
  return (_ctx, _cache) => {
3040
- return openBlock(), createBlock(_sfc_main$a, mergeProps({
3040
+ return openBlock(), createBlock(_sfc_main$b, mergeProps({
3041
3041
  href: __props.href,
3042
3042
  external: __props.external,
3043
3043
  appearance: __props.appearance,
@@ -3063,21 +3063,192 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3063
3063
  };
3064
3064
  }
3065
3065
  });
3066
+ const load = (document2, src) => new Promise((resolve, reject) => {
3067
+ const script = document2.createElement("script");
3068
+ script.async = true;
3069
+ script.src = src;
3070
+ script.onload = (event) => resolve(event);
3071
+ script.onerror = (event, source, lineno, colno, error) => {
3072
+ console.error(`Failed to load script from ${src}`, {
3073
+ event,
3074
+ source,
3075
+ lineno,
3076
+ colno,
3077
+ error
3078
+ });
3079
+ reject(error);
3080
+ };
3081
+ const head = document2.head || document2.getElementsByTagName("head")[0];
3082
+ head.appendChild(script);
3083
+ });
3084
+ const _hoisted_1 = { class: "ui-v1-yandex-map" };
3085
+ const _sfc_main = /* @__PURE__ */ defineComponent({
3086
+ __name: "UiYandexMap",
3087
+ props: {
3088
+ apiKey: {
3089
+ type: String,
3090
+ required: true
3091
+ },
3092
+ address: {
3093
+ type: String,
3094
+ default: ""
3095
+ }
3096
+ },
3097
+ emits: [
3098
+ "change",
3099
+ "update:address"
3100
+ ],
3101
+ setup(__props, { emit: __emit }) {
3102
+ const props = __props;
3103
+ const emit = __emit;
3104
+ const vueI18n = inject(I18nInjectKey);
3105
+ const iframe = ref(null);
3106
+ const getIFrameDocument = () => {
3107
+ var _a;
3108
+ return ((_a = iframe.value) == null ? void 0 : _a.contentDocument) ?? null;
3109
+ };
3110
+ const getIFrameWindow = () => {
3111
+ var _a;
3112
+ return ((_a = iframe.value) == null ? void 0 : _a.contentWindow) ?? null;
3113
+ };
3114
+ const getIFrameYMaps = () => {
3115
+ const iframeWindow = getIFrameWindow();
3116
+ if (iframeWindow && "ymaps3" in iframeWindow) {
3117
+ return iframeWindow["ymaps3"];
3118
+ }
3119
+ return null;
3120
+ };
3121
+ const LOCATION = {
3122
+ center: [37.64, 55.76],
3123
+ zoom: 10
3124
+ };
3125
+ const waitIFrameContentLoaded = (retry = 5) => {
3126
+ var _a;
3127
+ if ((_a = iframe.value) == null ? void 0 : _a.contentDocument) {
3128
+ return Promise.resolve();
3129
+ }
3130
+ if (retry <= 1) {
3131
+ throw new Error("iframe contentDocument wasn't loaded");
3132
+ }
3133
+ return new Promise((resolve) => setTimeout(async () => {
3134
+ await waitIFrameContentLoaded(retry--);
3135
+ resolve(0);
3136
+ }, 100));
3137
+ };
3138
+ const ready = ref(false);
3139
+ const apiLocale = computed(() => ({
3140
+ "en-GB": "en_US",
3141
+ "es-ES": "en_US",
3142
+ "ru-RU": "ru_RU"
3143
+ })[(vueI18n == null ? void 0 : vueI18n.locale) ?? "en-GB"]);
3144
+ const apiUrl = computed(() => `https://api-maps.yandex.ru/v3/?apikey=${props.apiKey}&lang=${apiLocale.value}`);
3145
+ const apiUrlVersion = ref(0);
3146
+ const getGeocodeApiUrl = (geocode) => `https://geocode-maps.yandex.ru/1.x/?apikey=${props.apiKey}&geocode=${geocode}&lang=${apiLocale.value}&format=json`;
3147
+ function onDragEndHandler(coordinates) {
3148
+ fetchAddressFromCoordinates(coordinates).then((address) => {
3149
+ emit("change", address);
3150
+ emit("update:address", address);
3151
+ });
3152
+ }
3153
+ const fetchAddressFromCoordinates = async (coordinates) => {
3154
+ var _a, _b, _c, _d, _e;
3155
+ const response = await fetch(getGeocodeApiUrl(coordinates.toString()));
3156
+ const result = await response.json();
3157
+ return ((_e = (_d = (_c = (_b = (_a = result.response.GeoObjectCollection.featureMember[0]) == null ? void 0 : _a.GeoObject) == null ? void 0 : _b.metaDataProperty) == null ? void 0 : _c.GeocoderMetaData) == null ? void 0 : _d.Address) == null ? void 0 : _e.formatted) ?? "";
3158
+ };
3159
+ const fetchCoordinatesFromAddress = async (address) => {
3160
+ var _a, _b;
3161
+ const response = await fetch(getGeocodeApiUrl(address));
3162
+ const result = await response.json();
3163
+ return ((_b = (_a = result.response.GeoObjectCollection.featureMember[0]) == null ? void 0 : _a.GeoObject) == null ? void 0 : _b.Point.pos) ?? "";
3164
+ };
3165
+ const loadApi = async () => {
3166
+ var _a;
3167
+ await waitIFrameContentLoaded();
3168
+ const iframeDocument = getIFrameDocument();
3169
+ if (iframeDocument) {
3170
+ const style = iframeDocument.createElement("style");
3171
+ style.innerHTML = "body { margin: 0; }";
3172
+ iframeDocument.head.appendChild(style);
3173
+ await load(iframeDocument, apiUrl.value);
3174
+ await ((_a = getIFrameYMaps()) == null ? void 0 : _a.ready);
3175
+ const el = iframeDocument.createElement("div");
3176
+ el.setAttribute("id", "map");
3177
+ iframeDocument.body.appendChild(el);
3178
+ ready.value = true;
3179
+ const _ymaps3 = getIFrameYMaps();
3180
+ const {
3181
+ YMap,
3182
+ YMapControls,
3183
+ YMapDefaultFeaturesLayer,
3184
+ YMapDefaultSchemeLayer
3185
+ } = _ymaps3;
3186
+ const { YMapZoomControl, YMapGeolocationControl } = await _ymaps3.import("@yandex/ymaps3-controls@0.0.1");
3187
+ const { YMapDefaultMarker } = await _ymaps3.import("@yandex/ymaps3-markers@0.0.1");
3188
+ if (props.address) {
3189
+ const pos = await fetchCoordinatesFromAddress(props.address);
3190
+ if (pos) {
3191
+ LOCATION.center = pos.split(" ").map((c) => Number(c));
3192
+ }
3193
+ }
3194
+ const map = new YMap(el, { location: LOCATION });
3195
+ map.addChild(new YMapDefaultSchemeLayer({}));
3196
+ map.addChild(new YMapControls({ position: "right" }).addChild(new YMapZoomControl({})));
3197
+ map.addChild(new YMapDefaultFeaturesLayer({ id: "features" }));
3198
+ map.addChild(new YMapControls({ position: "left" }).addChild(new YMapGeolocationControl({})));
3199
+ const onDragMoveHandler = (coordinates) => {
3200
+ const longitude = `Longitude: ${coordinates[0].toFixed(2)}`;
3201
+ const latitude = `Latitude: ${coordinates[1].toFixed(2)}`;
3202
+ draggableMarker.update({ coordinates, title: `${longitude} <br> ${latitude}` });
3203
+ };
3204
+ const draggableMarker = new YMapDefaultMarker({
3205
+ coordinates: LOCATION.center,
3206
+ draggable: true,
3207
+ title: `Longitude: ${LOCATION.center[0].toFixed(2)} <br>
3208
+ Latitude ${LOCATION.center[1].toFixed(2)}`,
3209
+ onDragMove: onDragMoveHandler,
3210
+ onDragEnd: onDragEndHandler
3211
+ });
3212
+ map.addChild(draggableMarker);
3213
+ }
3214
+ };
3215
+ watch(apiUrl, async (newUrl, oldUrl) => {
3216
+ if (iframe.value && newUrl !== oldUrl) {
3217
+ ready.value = false;
3218
+ apiUrlVersion.value++;
3219
+ }
3220
+ });
3221
+ return (_ctx, _cache) => {
3222
+ return openBlock(), createElementBlock("div", _hoisted_1, [
3223
+ !ready.value ? (openBlock(), createBlock(_sfc_main$9, { key: 0 })) : createCommentVNode("", true),
3224
+ withDirectives((openBlock(), createElementBlock("iframe", {
3225
+ ref_key: "iframe",
3226
+ ref: iframe,
3227
+ key: apiUrlVersion.value,
3228
+ onLoad: loadApi
3229
+ }, null, 32)), [
3230
+ [vShow, ready.value]
3231
+ ])
3232
+ ]);
3233
+ };
3234
+ }
3235
+ });
3066
3236
  export {
3067
3237
  plugin as I18nPlugin,
3068
3238
  plugin$1 as ModalPlugin,
3069
- _sfc_main$c as UiButton,
3070
- _sfc_main$b as UiError,
3071
- _sfc_main$a as UiLink,
3072
- _sfc_main$8 as UiLoader,
3073
- _sfc_main$6 as UiModalSidebar,
3074
- _sfc_main$4 as UiModalWindow,
3075
- _sfc_main$5 as UiModalWindowSurface,
3076
- _sfc_main$7 as UiScrollBox,
3077
- _sfc_main$3 as UiTag,
3078
- _sfc_main$2 as UiToolbar,
3079
- _sfc_main$1 as UiToolbarButton,
3080
- _sfc_main as UiToolbarLink,
3081
- _sfc_main$9 as UiTransition,
3239
+ _sfc_main$d as UiButton,
3240
+ _sfc_main$c as UiError,
3241
+ _sfc_main$b as UiLink,
3242
+ _sfc_main$9 as UiLoader,
3243
+ _sfc_main$7 as UiModalSidebar,
3244
+ _sfc_main$5 as UiModalWindow,
3245
+ _sfc_main$6 as UiModalWindowSurface,
3246
+ _sfc_main$8 as UiScrollBox,
3247
+ _sfc_main$4 as UiTag,
3248
+ _sfc_main$3 as UiToolbar,
3249
+ _sfc_main$2 as UiToolbarButton,
3250
+ _sfc_main$1 as UiToolbarLink,
3251
+ _sfc_main$a as UiTransition,
3252
+ _sfc_main as UiYandexMap,
3082
3253
  VueI18n
3083
3254
  };
package/dist/remote.cjs CHANGED
@@ -150,6 +150,11 @@ const UiToolbarLink = defineRemoteComponent(
150
150
  );
151
151
  const UiTransitionType = "UiTransition";
152
152
  const UiTransition = defineRemoteComponent(UiTransitionType);
153
+ const UiYandexMapType = "UiYandexMap";
154
+ const UiYandexMap = defineRemoteComponent(
155
+ UiYandexMapType,
156
+ ["change"]
157
+ );
153
158
  exports.UiButton = UiButton;
154
159
  exports.UiButtonType = UiButtonType;
155
160
  exports.UiError = UiError;
@@ -174,3 +179,5 @@ exports.UiToolbarLink = UiToolbarLink;
174
179
  exports.UiToolbarLinkType = UiToolbarLinkType;
175
180
  exports.UiTransition = UiTransition;
176
181
  exports.UiTransitionType = UiTransitionType;
182
+ exports.UiYandexMap = UiYandexMap;
183
+ exports.UiYandexMapType = UiYandexMapType;
package/dist/remote.d.ts CHANGED
@@ -389,6 +389,23 @@ declare type UiTransitionProps = {
389
389
 
390
390
  export declare const UiTransitionType: SchemaType_2<"UiTransition", RemoteProperties<UiTransitionProps>, Record<string, never>>;
391
391
 
392
+ export declare const UiYandexMap: Component< {
393
+ [x: string]: unknown;
394
+ }, RemoteProperties<UiYandexMapProperties>, {
395
+ [x: string]: never;
396
+ }, {
397
+ [x: string]: never;
398
+ }, MethodOptions, {
399
+ change: (address: string) => boolean;
400
+ }>;
401
+
402
+ declare type UiYandexMapProperties = {
403
+ apiKey: string;
404
+ address?: string;
405
+ };
406
+
407
+ export declare const UiYandexMapType: SchemaType<"UiYandexMap", RemoteProperties<UiYandexMapProperties>, Record<string, never>>;
408
+
392
409
  declare enum VARIANT {
393
410
  DEFAULT = "default",
394
411
  SUCCESS = "success",
package/dist/remote.js CHANGED
@@ -148,6 +148,11 @@ const UiToolbarLink = defineRemoteComponent(
148
148
  );
149
149
  const UiTransitionType = "UiTransition";
150
150
  const UiTransition = defineRemoteComponent(UiTransitionType);
151
+ const UiYandexMapType = "UiYandexMap";
152
+ const UiYandexMap = defineRemoteComponent(
153
+ UiYandexMapType,
154
+ ["change"]
155
+ );
151
156
  export {
152
157
  UiButton,
153
158
  UiButtonType,
@@ -172,5 +177,7 @@ export {
172
177
  UiToolbarLink,
173
178
  UiToolbarLinkType,
174
179
  UiTransition,
175
- UiTransitionType
180
+ UiTransitionType,
181
+ UiYandexMap,
182
+ UiYandexMapType
176
183
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@retailcrm/embed-ui-v1-components",
3
3
  "type": "module",
4
- "version": "0.4.1-beta.1",
4
+ "version": "0.4.1-beta.3",
5
5
  "license": "MIT",
6
6
  "author": "RetailDriverLLC <integration@retailcrm.ru>",
7
7
  "repository": "git@github.com:retailcrm/embed-ui.git",
@@ -73,6 +73,7 @@
73
73
  "@storybook/vue3-vite": "^8.4.5",
74
74
  "@vitejs/plugin-vue": "^5.1.4",
75
75
  "@vue/compiler-sfc": "^3.5.12",
76
+ "@yandex/ymaps3-types": "^0.0.21",
76
77
  "less": "^4.2.0",
77
78
  "react": "^18.3.1",
78
79
  "react-dom": "^18.3.1",