@topvisor/ui 0.0.14 → 0.0.16

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 (67) hide show
  1. package/.chunks/core-97b070be.amd.js +2 -0
  2. package/.chunks/core-97b070be.amd.js.map +1 -0
  3. package/.chunks/core-c3afa109.es.js +121 -0
  4. package/.chunks/core-c3afa109.es.js.map +1 -0
  5. package/.chunks/forms-6a6b0b80.es.js +436 -0
  6. package/.chunks/forms-6a6b0b80.es.js.map +1 -0
  7. package/.chunks/forms-7119886a.amd.js +3 -0
  8. package/.chunks/forms-7119886a.amd.js.map +1 -0
  9. package/.chunks/popup-6d1d8097.amd.js +342 -0
  10. package/.chunks/popup-6d1d8097.amd.js.map +1 -0
  11. package/.chunks/popup-95d27020.es.js +720 -0
  12. package/.chunks/popup-95d27020.es.js.map +1 -0
  13. package/README.md +62 -62
  14. package/common/common.amd.js +1 -21
  15. package/common/common.amd.js.map +1 -1
  16. package/common/common.js +8 -11
  17. package/common/common.js.map +1 -1
  18. package/core/core.amd.js +2 -0
  19. package/core/core.amd.js.map +1 -0
  20. package/core/core.js +7 -0
  21. package/core/core.js.map +1 -0
  22. package/core.css +1 -645
  23. package/dark.css +1 -128
  24. package/editArea/editArea.amd.js +3 -0
  25. package/editArea/editArea.amd.js.map +1 -0
  26. package/editArea/editArea.js +111 -0
  27. package/editArea/editArea.js.map +1 -0
  28. package/editArea.css +1 -0
  29. package/forms/forms.amd.js +1 -10
  30. package/forms/forms.amd.js.map +1 -1
  31. package/forms/forms.js +9 -7
  32. package/forms/helpers.amd.js +2 -0
  33. package/{helpers → forms}/helpers.amd.js.map +1 -1
  34. package/forms/helpers.js +6 -0
  35. package/forms.css +1 -408
  36. package/icomoon/demo-files/Read Me.txt +7 -7
  37. package/icomoon/demo-files/demo.css +161 -161
  38. package/icomoon/demo-files/demo.js +30 -30
  39. package/icomoon/demo.html +2931 -2931
  40. package/icomoon/fonts/Topvisor-2.svg +231 -231
  41. package/icomoon/style.css +644 -644
  42. package/light.css +1 -128
  43. package/package.json +19 -19
  44. package/popup/popup.amd.js +3 -0
  45. package/popup/popup.amd.js.map +1 -0
  46. package/popup/popup.js +146 -0
  47. package/popup/popup.js.map +1 -0
  48. package/popup/worker.amd.js +2 -0
  49. package/popup/worker.amd.js.map +1 -0
  50. package/popup/worker.js +158 -0
  51. package/popup/worker.js.map +1 -0
  52. package/popup.css +1 -0
  53. package/utils/device.amd.js +2 -0
  54. package/utils/device.amd.js.map +1 -0
  55. package/utils/device.js +34 -0
  56. package/utils/device.js.map +1 -0
  57. package/utils/dom.amd.js +2 -0
  58. package/utils/dom.amd.js.map +1 -0
  59. package/utils/dom.js +64 -0
  60. package/utils/dom.js.map +1 -0
  61. package/.chunks/forms-1b3f76e9.es.js +0 -410
  62. package/.chunks/forms-1b3f76e9.es.js.map +0 -1
  63. package/.chunks/forms-512abfa7.amd.js +0 -413
  64. package/.chunks/forms-512abfa7.amd.js.map +0 -1
  65. package/helpers/helpers.amd.js +0 -6
  66. package/helpers/helpers.js +0 -6
  67. /package/{helpers → forms}/helpers.js.map +0 -0
@@ -0,0 +1,2 @@
1
+ var g=Object.defineProperty;var v=(s,t,n)=>t in s?g(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n;var a=(s,t,n)=>(v(s,typeof t!="symbol"?t+"":t,n),n);define(["exports","vue","../utils/device.amd"],function(s,t,n){"use strict";let m;const c=new Map,d={width:window.innerWidth,height:window.innerHeight};function f(o){c.set(o,o)}function b(o){c.delete(o)}function z(o){clearTimeout(m),m=setTimeout(function(){o.topEvent={widthDiff:d.width-window.innerWidth,hightDiff:d.height-window.innerHeight},d.width=window.innerWidth,d.height=window.innerHeight,c.forEach(e=>e(o))},100)}window.addEventListener("resize",z);const M={addOnReize:f,removeOnResize:b},u={widthForMobile:900},R={isMobile:!1,isMobileUA:!1,isRetina:!1,isApp:!1,isLandscape:!0,isPortrait:!1,size:0},h=window,i=class i{static appendStyle(e,w){let l="all";w==="m"&&(l="(max-width: "+this.options.widthForMobile+"px)"),w==="pc"&&(l="(min-width: "+this.options.widthForMobile+"px)");const p=document.createElement("style");p.innerHTML=e,p.media=l,document.head.append(p)}static install(e,w){i.defineOptions(w),e.provide("top-core",i)}static defineOptions(e){e.widthForMobile&&(this.options.widthForMobile=e.widthForMobile),i.setState()}static setState(){i.matchMediaIsMobile=window.matchMedia(`(max-width: ${i.options.widthForMobile}px)`),i.state.isMobileUA=n.isMobile(),i.state.isRetina=n.isRetina(),i.state.isApp=n.isApp(),i.setStateByWindowSize(),M.addOnReize(i.onResize),i.onResize(),i.saveToCookie()}static onResize(){i.setStateByWindowSize(),document.documentElement.style.setProperty("--100vh",window.innerHeight+"px")}static setStateByWindowSize(){var e;i.state.isMobile=!!((e=i.matchMediaIsMobile)!=null&&e.matches),i.state.isLandscape=window.innerWidth>window.innerHeight,i.state.isPortrait=!i.state.isLandscape,i.state.size=window.innerWidth>window.innerHeight?window.innerWidth:window.innerHeight,i.saveToCookie()}static saveToCookie(){const e=[1,window.innerWidth,window.innerHeight,window.devicePixelRatio,Number(i.state.isMobile),Number(i.state.isRetina)];document.cookie="device="+e.join(",")+"; path=/;"}};a(i,"page",(h==null?void 0:h.page)||{}),a(i,"options",u),a(i,"state",t.reactive({...R})),a(i,"matchMediaIsMobile");let r=i;s.Core=r,s.Events=M});
2
+ //# sourceMappingURL=core-97b070be.amd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-97b070be.amd.js","sources":["../../src/core/core/events.ts","../../src/core/core/options.ts","../../src/core/core/state.ts","../../src/core/core/core.ts"],"sourcesContent":["const onResizeDelay = 100;\n\nlet onResizeTimer: NodeJS.Timeout;\n\ntype TopEvent = Event & { topEvent: { widthDiff: number, hightDiff: number } }\n\n/**\n * Установленные обрабочики на событие изменения размеров окна\n */\nconst onResizeListeners: Map<(ev: TopEvent) => any, (ev: TopEvent) => any> = new Map();\n\n// зафиксированное состояние размеров окна\nconst windowSize = {\n\twidth: window.innerWidth,\n\theight: window.innerHeight,\n};\n\n/**\n * Добавить обработчик на событие изменения размеров экрана\n * вызов таких обработчиков будет опмизирован и объединен в одно событие\n */\nfunction addOnReize (listener: (this: Element, ev: TopEvent) => any) {\n\tonResizeListeners.set(listener, listener);\n}\n\n/**\n * Удаление обработчика на событие изменений размеров экрана\n */\nfunction removeOnResize (listener: (this: Element, ev: TopEvent) => any) {\n\tonResizeListeners.delete(listener);\n}\n\nfunction onResize (e: any) {\n\tclearTimeout(onResizeTimer);\n\n\tonResizeTimer = setTimeout(function () {\n\t\te.topEvent = {\n\t\t\twidthDiff: windowSize.width - window.innerWidth,\n\t\t\thightDiff: windowSize.height - window.innerHeight,\n\t\t};\n\n\t\twindowSize.width = window.innerWidth;\n\t\twindowSize.height = window.innerHeight;\n\n\t\tonResizeListeners.forEach((callback) => callback(e));\n\t}, onResizeDelay);\n}\n\nwindow.addEventListener('resize', onResize);\n\nexport default {\n\taddOnReize,\n\tremoveOnResize,\n};\n","/**\n * Конфигурация UI\n * Можно переопределить при подклчюении UI во Vue приложение через app.use(Core, options)\n */\nconst options = {\n\twidthForMobile: 900,\n};\n\nexport default options;","/**\n * State UI для взаимодейсвтиями с приложениями Vue\n */\nconst state = {\n\t/**\n\t * Device by size\n\t * @see widthForMobile\n\t */\n\tisMobile: false,\n\n\t/**\n\t * Device by user agent\n\t */\n\tisMobileUA: false,\n\n\t/**\n\t * true, если плотность пикселей экрана больше 1\n\t */\n\tisRetina: false,\n\n\t/**\n\t * true, елси это приложение\n\t */\n\tisApp: false,\n\n\t/**\n\t * true при горизонтальном расположении устройства\n\t */\n\tisLandscape: true,\n\n\t/**\n\t * true при вертикальном расположении устройства\n\t */\n\tisPortrait: false,\n\tsize: 0,\n};\n\nexport default state;","import { reactive } from 'vue';\nimport Device from '@/core/utils/device';\nimport DOM from '@/core/utils/dom';\nimport Events from '@/core/core/events';\nimport options from '@/core/core/options';\nimport state from '@/core/core/state';\n\nconst _window: any = window;\n\nclass Core {\n\n\tstatic page = _window?.page || {};\n\n\tstatic options = options;\n\n\tstatic state = reactive({ ...state });\n\n\tstatic matchMediaIsMobile?: MediaQueryList;\n\n\t/**\n\t * Добавить на страницу стили, используется для загрузки стилей из js\n\t *\n\t * Условная загрузка стилей m и pc отключена в пользу производительсности, стили грузятся всегда, но применяются по условию\n\t * @param style - css стили в строке\n\t * @param type - если указать 'm' или 'pc', то стили будут применяться по условию в зависимости от настройки this.options.widthForMobile\n\t */\n\tstatic appendStyle (style: string, type: '' | 'm' | 'pc'): void {\n\t\tlet media = 'all';\n\n\t\tif (type === 'm') {\n\t\t\tmedia = '(max-width: ' + this.options.widthForMobile + 'px)';\n\t\t}\n\n\t\tif (type === 'pc') {\n\t\t\tmedia = '(min-width: ' + this.options.widthForMobile + 'px)';\n\t\t}\n\n\t\tconst elStyle = document.createElement('style');\n\t\telStyle.innerHTML = style;\n\t\telStyle.media = media;\n\n\t\tdocument.head.append(elStyle);\n\t}\n\n\t/**\n\t * Установить как плагин в прилоежнии Vue\n\t * Core.state является общим для всех приложений Vue на странице\n\t * Core.options является общим для всех приложений Vue на странице\n\t * @param app - Vue App\n\t * @param {typeof options} options - параметры UI\n\t */\n\tstatic install (app: any, options: typeof this.options) {\n\t\tCore.defineOptions(options);\n\n\t\tapp.provide('top-core', Core);\n\t}\n\n\t/**\n\t * Установить конфигурацию UI\n\t * @param {typeof options} options\n\t */\n\tstatic defineOptions (options: typeof this.options) {\n\t\tif (options.widthForMobile) {\n\t\t\tthis.options.widthForMobile = options.widthForMobile;\n\t\t}\n\n\t\tCore.setState();\n\t}\n\n\tstatic setState () {\n\t\tCore.matchMediaIsMobile = window.matchMedia(`(max-width: ${Core.options.widthForMobile}px)`);\n\n\t\tCore.state.isMobileUA = Device.isMobile();\n\t\tCore.state.isRetina = Device.isRetina();\n\t\tCore.state.isApp = Device.isApp();\n\n\t\tCore.setStateByWindowSize();\n\n\t\t// пересчет значений, зависящих от рамзеров окна\n\t\tEvents.addOnReize(Core.onResize);\n\n\t\tCore.onResize();\n\n\t\tCore.saveToCookie();\n\t}\n\n\tstatic onResize () {\n\t\tCore.setStateByWindowSize();\n\n\t\t// честный vh\n\t\tdocument.documentElement.style.setProperty('--100vh', window.innerHeight + 'px');\n\t}\n\n\tstatic setStateByWindowSize () {\n\t\tCore.state.isMobile = !!Core.matchMediaIsMobile?.matches;\n\t\tCore.state.isLandscape = (window.innerWidth > window.innerHeight);\n\t\tCore.state.isPortrait = !Core.state.isLandscape;\n\t\tCore.state.size = (window.innerWidth > window.innerHeight) ? window.innerWidth : window.innerHeight;\n\n\t\tCore.saveToCookie();\n\t}\n\n\t/**\n\t * Сохранить информацию об устройстве в cookie\n\t */\n\tstatic saveToCookie () {\n\t\tconst device = [\n\t\t\t1,\n\t\t\twindow.innerWidth,\n\t\t\twindow.innerHeight,\n\t\t\twindow.devicePixelRatio,\n\t\t\tNumber(Core.state.isMobile),\n\t\t\tNumber(Core.state.isRetina),\n\t\t];\n\n\t\tdocument.cookie = 'device=' + device.join(',') + '; path=/;';\n\t}\n\n}\n\nexport default Core;"],"names":["onResizeTimer","onResizeListeners","windowSize","addOnReize","listener","removeOnResize","onResize","e","callback","Events","options","state","_window","_Core","style","type","media","elStyle","app","Device","_a","device","__publicField","reactive","Core"],"mappings":"oPAEA,IAAIA,EAOJ,MAAMC,MAA2E,IAG3EC,EAAa,CAClB,MAAO,OAAO,WACd,OAAQ,OAAO,WAChB,EAMA,SAASC,EAAYC,EAAgD,CAClDH,EAAA,IAAIG,EAAUA,CAAQ,CACzC,CAKA,SAASC,EAAgBD,EAAgD,CACxEH,EAAkB,OAAOG,CAAQ,CAClC,CAEA,SAASE,EAAUC,EAAQ,CAC1B,aAAaP,CAAa,EAE1BA,EAAgB,WAAW,UAAY,CACtCO,EAAE,SAAW,CACZ,UAAWL,EAAW,MAAQ,OAAO,WACrC,UAAWA,EAAW,OAAS,OAAO,WAAA,EAGvCA,EAAW,MAAQ,OAAO,WAC1BA,EAAW,OAA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,CAEA,OAAO,sBAAwB,OAC9BA,EAAK,MAAM,SAAW,CAAC,GAACO,EAAAP,EAAK,qBAAL,MAAAO,EAAyB,SACjDP,EAAK,MAAM,YAAe,OAAO,WAAa,OAAO,YACrDA,EAAK,MAAM,WAAa,CAACA,EAAK,MAAM,YAC/BA,EAAA,MAAM,KAAQ,OAAO,WAAa,OAAO,YAAe,OAAO,WAAa,OAAO,YAExFA,EAAK,aAAa,CACnB,CAKA,OAAO,cAAgB,CACtB,MAAMQ,EAAS,CACd,EACA,OAAO,WACP,OAAO,YACP,OAAO,iBACP,OAAOR,EAAK,MAAM,QAAQ,EAC1B,OAAOA,EAAK,MAAM,QAAQ,CAAA,EAG3B,SAAS,OAAS,UAAYQ,EAAO,KAAK,GAAG,EAAI,WAClD,CAED,EA3GCC,EAFKT,EAEE,QAAOD,GAAA,YAAAA,EAAS,OAAQ,IAE/BU,EAJKT,EAIE,UAAUH,GAEjBY,EANKT,EAME,QAAQU,EAAA,SAAS,CAAE,GAAGZ,CAAO,CAAA,GAEpCW,EARKT,EAQE,sBARR,IAAMW,EAANX"}
@@ -0,0 +1,121 @@
1
+ var p = Object.defineProperty;
2
+ var m = (t, e, n) => e in t ? p(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var o = (t, e, n) => (m(t, typeof e != "symbol" ? e + "" : e, n), n);
4
+ import { reactive as M } from "vue";
5
+ import w from "../utils/device.js";
6
+ const f = 100;
7
+ let r;
8
+ const h = /* @__PURE__ */ new Map(), s = {
9
+ width: window.innerWidth,
10
+ height: window.innerHeight
11
+ };
12
+ function b(t) {
13
+ h.set(t, t);
14
+ }
15
+ function z(t) {
16
+ h.delete(t);
17
+ }
18
+ function R(t) {
19
+ clearTimeout(r), r = setTimeout(function() {
20
+ t.topEvent = {
21
+ widthDiff: s.width - window.innerWidth,
22
+ hightDiff: s.height - window.innerHeight
23
+ }, s.width = window.innerWidth, s.height = window.innerHeight, h.forEach((e) => e(t));
24
+ }, f);
25
+ }
26
+ window.addEventListener("resize", R);
27
+ const g = {
28
+ addOnReize: b,
29
+ removeOnResize: z
30
+ }, u = {
31
+ widthForMobile: 900
32
+ }, v = {
33
+ /**
34
+ * Device by size
35
+ * @see widthForMobile
36
+ */
37
+ isMobile: !1,
38
+ /**
39
+ * Device by user agent
40
+ */
41
+ isMobileUA: !1,
42
+ /**
43
+ * true, если плотность пикселей экрана больше 1
44
+ */
45
+ isRetina: !1,
46
+ /**
47
+ * true, елси это приложение
48
+ */
49
+ isApp: !1,
50
+ /**
51
+ * true при горизонтальном расположении устройства
52
+ */
53
+ isLandscape: !0,
54
+ /**
55
+ * true при вертикальном расположении устройства
56
+ */
57
+ isPortrait: !1,
58
+ size: 0
59
+ }, c = window, i = class i {
60
+ /**
61
+ * Добавить на страницу стили, используется для загрузки стилей из js
62
+ *
63
+ * Условная загрузка стилей m и pc отключена в пользу производительсности, стили грузятся всегда, но применяются по условию
64
+ * @param style - css стили в строке
65
+ * @param type - если указать 'm' или 'pc', то стили будут применяться по условию в зависимости от настройки this.options.widthForMobile
66
+ */
67
+ static appendStyle(e, n) {
68
+ let a = "all";
69
+ n === "m" && (a = "(max-width: " + this.options.widthForMobile + "px)"), n === "pc" && (a = "(min-width: " + this.options.widthForMobile + "px)");
70
+ const d = document.createElement("style");
71
+ d.innerHTML = e, d.media = a, document.head.append(d);
72
+ }
73
+ /**
74
+ * Установить как плагин в прилоежнии Vue
75
+ * Core.state является общим для всех приложений Vue на странице
76
+ * Core.options является общим для всех приложений Vue на странице
77
+ * @param app - Vue App
78
+ * @param {typeof options} options - параметры UI
79
+ */
80
+ static install(e, n) {
81
+ i.defineOptions(n), e.provide("top-core", i);
82
+ }
83
+ /**
84
+ * Установить конфигурацию UI
85
+ * @param {typeof options} options
86
+ */
87
+ static defineOptions(e) {
88
+ e.widthForMobile && (this.options.widthForMobile = e.widthForMobile), i.setState();
89
+ }
90
+ static setState() {
91
+ i.matchMediaIsMobile = window.matchMedia(`(max-width: ${i.options.widthForMobile}px)`), i.state.isMobileUA = w.isMobile(), i.state.isRetina = w.isRetina(), i.state.isApp = w.isApp(), i.setStateByWindowSize(), g.addOnReize(i.onResize), i.onResize(), i.saveToCookie();
92
+ }
93
+ static onResize() {
94
+ i.setStateByWindowSize(), document.documentElement.style.setProperty("--100vh", window.innerHeight + "px");
95
+ }
96
+ static setStateByWindowSize() {
97
+ var e;
98
+ i.state.isMobile = !!((e = i.matchMediaIsMobile) != null && e.matches), i.state.isLandscape = window.innerWidth > window.innerHeight, i.state.isPortrait = !i.state.isLandscape, i.state.size = window.innerWidth > window.innerHeight ? window.innerWidth : window.innerHeight, i.saveToCookie();
99
+ }
100
+ /**
101
+ * Сохранить информацию об устройстве в cookie
102
+ */
103
+ static saveToCookie() {
104
+ const e = [
105
+ 1,
106
+ window.innerWidth,
107
+ window.innerHeight,
108
+ window.devicePixelRatio,
109
+ Number(i.state.isMobile),
110
+ Number(i.state.isRetina)
111
+ ];
112
+ document.cookie = "device=" + e.join(",") + "; path=/;";
113
+ }
114
+ };
115
+ o(i, "page", (c == null ? void 0 : c.page) || {}), o(i, "options", u), o(i, "state", M({ ...v })), o(i, "matchMediaIsMobile");
116
+ let l = i;
117
+ export {
118
+ l as C,
119
+ g as E
120
+ };
121
+ //# sourceMappingURL=core-c3afa109.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-c3afa109.es.js","sources":["../../src/core/core/events.ts","../../src/core/core/options.ts","../../src/core/core/state.ts","../../src/core/core/core.ts"],"sourcesContent":["const onResizeDelay = 100;\n\nlet onResizeTimer: NodeJS.Timeout;\n\ntype TopEvent = Event & { topEvent: { widthDiff: number, hightDiff: number } }\n\n/**\n * Установленные обрабочики на событие изменения размеров окна\n */\nconst onResizeListeners: Map<(ev: TopEvent) => any, (ev: TopEvent) => any> = new Map();\n\n// зафиксированное состояние размеров окна\nconst windowSize = {\n\twidth: window.innerWidth,\n\theight: window.innerHeight,\n};\n\n/**\n * Добавить обработчик на событие изменения размеров экрана\n * вызов таких обработчиков будет опмизирован и объединен в одно событие\n */\nfunction addOnReize (listener: (this: Element, ev: TopEvent) => any) {\n\tonResizeListeners.set(listener, listener);\n}\n\n/**\n * Удаление обработчика на событие изменений размеров экрана\n */\nfunction removeOnResize (listener: (this: Element, ev: TopEvent) => any) {\n\tonResizeListeners.delete(listener);\n}\n\nfunction onResize (e: any) {\n\tclearTimeout(onResizeTimer);\n\n\tonResizeTimer = setTimeout(function () {\n\t\te.topEvent = {\n\t\t\twidthDiff: windowSize.width - window.innerWidth,\n\t\t\thightDiff: windowSize.height - window.innerHeight,\n\t\t};\n\n\t\twindowSize.width = window.innerWidth;\n\t\twindowSize.height = window.innerHeight;\n\n\t\tonResizeListeners.forEach((callback) => callback(e));\n\t}, onResizeDelay);\n}\n\nwindow.addEventListener('resize', onResize);\n\nexport default {\n\taddOnReize,\n\tremoveOnResize,\n};\n","/**\n * Конфигурация UI\n * Можно переопределить при подклчюении UI во Vue приложение через app.use(Core, options)\n */\nconst options = {\n\twidthForMobile: 900,\n};\n\nexport default options;","/**\n * State UI для взаимодейсвтиями с приложениями Vue\n */\nconst state = {\n\t/**\n\t * Device by size\n\t * @see widthForMobile\n\t */\n\tisMobile: false,\n\n\t/**\n\t * Device by user agent\n\t */\n\tisMobileUA: false,\n\n\t/**\n\t * true, если плотность пикселей экрана больше 1\n\t */\n\tisRetina: false,\n\n\t/**\n\t * true, елси это приложение\n\t */\n\tisApp: false,\n\n\t/**\n\t * true при горизонтальном расположении устройства\n\t */\n\tisLandscape: true,\n\n\t/**\n\t * true при вертикальном расположении устройства\n\t */\n\tisPortrait: false,\n\tsize: 0,\n};\n\nexport default state;","import { reactive } from 'vue';\nimport Device from '@/core/utils/device';\nimport DOM from '@/core/utils/dom';\nimport Events from '@/core/core/events';\nimport options from '@/core/core/options';\nimport state from '@/core/core/state';\n\nconst _window: any = window;\n\nclass Core {\n\n\tstatic page = _window?.page || {};\n\n\tstatic options = options;\n\n\tstatic state = reactive({ ...state });\n\n\tstatic matchMediaIsMobile?: MediaQueryList;\n\n\t/**\n\t * Добавить на страницу стили, используется для загрузки стилей из js\n\t *\n\t * Условная загрузка стилей m и pc отключена в пользу производительсности, стили грузятся всегда, но применяются по условию\n\t * @param style - css стили в строке\n\t * @param type - если указать 'm' или 'pc', то стили будут применяться по условию в зависимости от настройки this.options.widthForMobile\n\t */\n\tstatic appendStyle (style: string, type: '' | 'm' | 'pc'): void {\n\t\tlet media = 'all';\n\n\t\tif (type === 'm') {\n\t\t\tmedia = '(max-width: ' + this.options.widthForMobile + 'px)';\n\t\t}\n\n\t\tif (type === 'pc') {\n\t\t\tmedia = '(min-width: ' + this.options.widthForMobile + 'px)';\n\t\t}\n\n\t\tconst elStyle = document.createElement('style');\n\t\telStyle.innerHTML = style;\n\t\telStyle.media = media;\n\n\t\tdocument.head.append(elStyle);\n\t}\n\n\t/**\n\t * Установить как плагин в прилоежнии Vue\n\t * Core.state является общим для всех приложений Vue на странице\n\t * Core.options является общим для всех приложений Vue на странице\n\t * @param app - Vue App\n\t * @param {typeof options} options - параметры UI\n\t */\n\tstatic install (app: any, options: typeof this.options) {\n\t\tCore.defineOptions(options);\n\n\t\tapp.provide('top-core', Core);\n\t}\n\n\t/**\n\t * Установить конфигурацию UI\n\t * @param {typeof options} options\n\t */\n\tstatic defineOptions (options: typeof this.options) {\n\t\tif (options.widthForMobile) {\n\t\t\tthis.options.widthForMobile = options.widthForMobile;\n\t\t}\n\n\t\tCore.setState();\n\t}\n\n\tstatic setState () {\n\t\tCore.matchMediaIsMobile = window.matchMedia(`(max-width: ${Core.options.widthForMobile}px)`);\n\n\t\tCore.state.isMobileUA = Device.isMobile();\n\t\tCore.state.isRetina = Device.isRetina();\n\t\tCore.state.isApp = Device.isApp();\n\n\t\tCore.setStateByWindowSize();\n\n\t\t// пересчет значений, зависящих от рамзеров окна\n\t\tEvents.addOnReize(Core.onResize);\n\n\t\tCore.onResize();\n\n\t\tCore.saveToCookie();\n\t}\n\n\tstatic onResize () {\n\t\tCore.setStateByWindowSize();\n\n\t\t// честный vh\n\t\tdocument.documentElement.style.setProperty('--100vh', window.innerHeight + 'px');\n\t}\n\n\tstatic setStateByWindowSize () {\n\t\tCore.state.isMobile = !!Core.matchMediaIsMobile?.matches;\n\t\tCore.state.isLandscape = (window.innerWidth > window.innerHeight);\n\t\tCore.state.isPortrait = !Core.state.isLandscape;\n\t\tCore.state.size = (window.innerWidth > window.innerHeight) ? window.innerWidth : window.innerHeight;\n\n\t\tCore.saveToCookie();\n\t}\n\n\t/**\n\t * Сохранить информацию об устройстве в cookie\n\t */\n\tstatic saveToCookie () {\n\t\tconst device = [\n\t\t\t1,\n\t\t\twindow.innerWidth,\n\t\t\twindow.innerHeight,\n\t\t\twindow.devicePixelRatio,\n\t\t\tNumber(Core.state.isMobile),\n\t\t\tNumber(Core.state.isRetina),\n\t\t];\n\n\t\tdocument.cookie = 'device=' + device.join(',') + '; path=/;';\n\t}\n\n}\n\nexport default Core;"],"names":["onResizeDelay","onResizeTimer","onResizeListeners","windowSize","addOnReize","listener","removeOnResize","onResize","e","callback","Events","options","state","_window","_Core","style","type","media","elStyle","app","Device","_a","device","__publicField","reactive","Core"],"mappings":";;;;;AAAA,MAAMA,IAAgB;AAEtB,IAAIC;AAOJ,MAAMC,wBAA2E,OAG3EC,IAAa;AAAA,EAClB,OAAO,OAAO;AAAA,EACd,QAAQ,OAAO;AAChB;AAMA,SAASC,EAAYC,GAAgD;AAClD,EAAAH,EAAA,IAAIG,GAAUA,CAAQ;AACzC;AAKA,SAASC,EAAgBD,GAAgD;AACxE,EAAAH,EAAkB,OAAOG,CAAQ;AAClC;AAEA,SAASE,EAAUC,GAAQ;AAC1B,eAAaP,CAAa,GAE1BA,IAAgB,WAAW,WAAY;AACtC,IAAAO,EAAE,WAAW;AAAA,MACZ,WAAWL,EAAW,QAAQ,OAAO;AAAA,MACrC,WAAWA,EAAW,SAAS,OAAO;AAAA,IAAA,GAGvCA,EAAW,QAAQ,OAAO,YAC1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Block as v, resolveDynamicComponent as V, normalizeClass as i, withCtx as z, renderSlot as k, createTextVNode as S, toDisplayString as f, createElementBlock as n, useCssVars as L, resolveDirective as N, withDirectives as $, createElementVNode as h, mergeProps as T, vModelText as w, createCommentVNode as p, unref as _, withKeys as D } from "vue";
2
+ var B = /* @__PURE__ */ ((t) => (t.S = "s", t.L = "l", t.XL = "xl", t))(B || {}), E = /* @__PURE__ */ ((t) => (t.Theme = "theme", t.Blue = "blue", t.Green = "green", t.Orange = "orange", t.Red = "red", t.Pink = "pink", t))(E || {}), M = /* @__PURE__ */ ((t) => (t.Regular = "", t.Outline = "outline", t.Soft = "soft", t.Transparent = "transparent", t))(M || {});
3
+ const P = /* @__PURE__ */ d({
4
+ __name: "button",
5
+ props: {
6
+ color: { default: E.Blue },
7
+ styling: { default: M.Regular },
8
+ size: { default: B.S },
9
+ name: {},
10
+ title: {},
11
+ icon: {},
12
+ icon2: {},
13
+ href: {},
14
+ disabled: { type: Boolean },
15
+ isSubmit: { type: Boolean },
16
+ isActive: { type: Boolean },
17
+ isProgress: { type: Boolean }
18
+ },
19
+ setup(t) {
20
+ const e = t, a = y(() => e.href ? "a" : "button"), l = y(() => e.isSubmit ? "submit" : void 0);
21
+ return (o, c) => (r(), v(V(a.value), {
22
+ class: i({
23
+ "top-active": o.isActive,
24
+ "top-disabled": o.disabled,
25
+ "top-forms-focusable": !o.disabled,
26
+ "top-button": !0,
27
+ "top-button-progress": o.isProgress,
28
+ [`top-size_${o.size}`]: !!o.size,
29
+ [`top-color_${o.color}`]: !0,
30
+ [`top-style_${o.styling}`]: !!o.styling
31
+ }),
32
+ name: o.name,
33
+ title: o.title,
34
+ href: o.href,
35
+ type: l.value,
36
+ "data-top-icon": o.icon || void 0,
37
+ "data-top-icon2": o.icon2 || void 0,
38
+ disabled: o.disabled || void 0,
39
+ inProgress: o.isProgress
40
+ }, {
41
+ default: z(() => [
42
+ k(o.$slots, "default", {}, () => [
43
+ S(f(o.icon ? "" : "Button"), 1)
44
+ ])
45
+ ]),
46
+ _: 3
47
+ }, 8, ["class", "name", "title", "href", "type", "data-top-icon", "data-top-icon2", "disabled", "inProgress"]));
48
+ }
49
+ }), W = "_progress_1hqxk_1", H = {
50
+ "top-button": "top-button",
51
+ "top-active": "top-active",
52
+ "top-button-progress": "top-button-progress",
53
+ progress: W,
54
+ "top-color_blue": "top-color_blue",
55
+ "top-color_green": "top-color_green",
56
+ "top-color_orange": "top-color_orange",
57
+ "top-color_red": "top-color_red",
58
+ "top-color_pink": "top-color_pink",
59
+ "top-color_theme": "top-color_theme",
60
+ "top-style_outline": "top-style_outline",
61
+ "top-style_soft": "top-style_soft",
62
+ "top-style_transparent": "top-style_transparent",
63
+ "top-size_l": "top-size_l",
64
+ "top-size_xl": "top-size_xl"
65
+ }, u = (t, e) => {
66
+ const a = t.__vccOpts || t;
67
+ for (const [l, o] of e)
68
+ a[l] = o;
69
+ return a;
70
+ }, K = {
71
+ $style: H
72
+ }, _e = /* @__PURE__ */ u(P, [["__cssModules", K]]), U = ["title"], q = /* @__PURE__ */ d({
73
+ __name: "hint",
74
+ props: {
75
+ hint: {}
76
+ },
77
+ setup(t) {
78
+ return (e, a) => (r(), n("span", {
79
+ class: "top-hint",
80
+ "data-top-icon": "",
81
+ title: e.hint
82
+ }, null, 8, U));
83
+ }
84
+ }), X = {
85
+ "top-hint": "top-hint"
86
+ }, j = {
87
+ $style: X
88
+ }, A = /* @__PURE__ */ u(q, [["__cssModules", j]]), F = ["name", "placeholder", "disabled", "readonly", "rows"], J = {
89
+ key: 0,
90
+ class: "top-textarea_pseudoContent"
91
+ }, Q = /* @__PURE__ */ d({
92
+ __name: "textarea",
93
+ props: {
94
+ modelValue: {},
95
+ name: {},
96
+ placeholder: {},
97
+ rows: { default: 5 },
98
+ minHeight: { default: 120 },
99
+ expandable: { type: Boolean },
100
+ disabled: { type: Boolean },
101
+ readonly: { type: Boolean },
102
+ isError: { type: Boolean },
103
+ hint: {}
104
+ },
105
+ emits: ["update:modelValue"],
106
+ setup(t, { emit: e }) {
107
+ const a = t;
108
+ L((o) => ({
109
+ bcf6b9ae: o.minHeight + "px"
110
+ }));
111
+ const l = y({
112
+ get() {
113
+ return a.modelValue;
114
+ },
115
+ set(o) {
116
+ e("update:modelValue", o);
117
+ }
118
+ });
119
+ return (o, c) => {
120
+ const s = N("tv-tooltip");
121
+ return r(), n("label", {
122
+ class: i({
123
+ "top-textarea": !0,
124
+ ["top-textarea-" + o.name]: o.name,
125
+ "top-disabled": o.disabled
126
+ })
127
+ }, [
128
+ $(h("textarea", T({
129
+ type: "text",
130
+ class: {
131
+ "top-forms-focusable": !o.disabled,
132
+ "top-textarea_textarea": !0,
133
+ "top-textarea_textarea-expandable": o.expandable,
134
+ "top-error": o.isError
135
+ },
136
+ autocomplete: "off_always",
137
+ name: o.name,
138
+ placeholder: o.placeholder,
139
+ disabled: o.disabled,
140
+ readonly: o.readonly,
141
+ rows: o.expandable ? void 0 : o.rows
142
+ }, o.$attrs, {
143
+ "onUpdate:modelValue": c[0] || (c[0] = (b) => l.value = b)
144
+ }), null, 16, F), [
145
+ [w, l.value]
146
+ ]),
147
+ o.expandable ? (r(), n("div", J, f(l.value + " "), 1)) : p("", !0),
148
+ o.hint ? $((r(), v(A, {
149
+ key: 1,
150
+ class: "top-textarea_hint",
151
+ hint: o.hint
152
+ }, null, 8, ["hint"])), [
153
+ [s]
154
+ ]) : p("", !0)
155
+ ], 2);
156
+ };
157
+ }
158
+ }), G = {
159
+ "top-textarea": "top-textarea",
160
+ "top-textarea_textarea": "top-textarea_textarea",
161
+ "top-textarea_textarea-expandable": "top-textarea_textarea-expandable",
162
+ "top-textarea_pseudoContent": "top-textarea_pseudoContent",
163
+ "top-textarea_hint": "top-textarea_hint"
164
+ }, O = {
165
+ $style: G
166
+ }, ke = /* @__PURE__ */ u(Q, [["__cssModules", O]]), R = { class: "top-forms-optionLabel" }, Z = {
167
+ key: 0,
168
+ class: "top-forms-optionLabel_description"
169
+ }, Y = /* @__PURE__ */ d({
170
+ __name: "controlLabel",
171
+ props: {
172
+ title: {},
173
+ description: {},
174
+ disabled: { type: Boolean }
175
+ },
176
+ setup(t) {
177
+ return (e, a) => (r(), n("div", R, [
178
+ h("div", {
179
+ class: i({
180
+ "top-forms-optionLabel_title": !0,
181
+ "top-forms-optionLabel_title-disabled": e.disabled
182
+ })
183
+ }, f(e.title), 3),
184
+ e.description ? (r(), n("div", Z, f(e.description), 1)) : p("", !0)
185
+ ]));
186
+ }
187
+ }), I = {
188
+ "top-forms-optionLabel": "top-forms-optionLabel",
189
+ "top-forms-optionLabel_title": "top-forms-optionLabel_title",
190
+ "top-forms-optionLabel_title-disabled": "top-forms-optionLabel_title-disabled",
191
+ "top-forms-optionLabel_description": "top-forms-optionLabel_description"
192
+ }, x = {
193
+ $style: I
194
+ }, g = /* @__PURE__ */ u(Y, [["__cssModules", x]]), ee = ["name", "value", "checked", "indeterminate", "disabled"], oe = /* @__PURE__ */ d({
195
+ __name: "checkbox",
196
+ props: {
197
+ name: {},
198
+ value: {},
199
+ title: {},
200
+ description: {},
201
+ checked: { type: Boolean },
202
+ disabled: { type: Boolean },
203
+ indeterminate: { type: Boolean },
204
+ isError: { type: Boolean }
205
+ },
206
+ setup(t) {
207
+ return (e, a) => (r(), n("label", {
208
+ class: i({
209
+ "top-forms-optionWrapper": !0,
210
+ "top-checkbox": !0,
211
+ ["top-checkbox_" + e.name]: e.name !== "",
212
+ "top-active": e.checked,
213
+ "top-disabled": e.disabled,
214
+ "top-error": e.isError && !e.disabled
215
+ })
216
+ }, [
217
+ h("input", {
218
+ type: "checkbox",
219
+ class: i({
220
+ "top-forms-focusable": !e.disabled,
221
+ "top-forms-option": !0,
222
+ "top-checkbox_input": !0,
223
+ "top-error": e.isError && !e.disabled
224
+ }),
225
+ name: e.name,
226
+ value: e.value,
227
+ checked: e.checked,
228
+ indeterminate: e.indeterminate,
229
+ disabled: e.disabled
230
+ }, null, 10, ee),
231
+ e.title ? (r(), v(g, {
232
+ key: 0,
233
+ title: e.title,
234
+ description: e.description,
235
+ disabled: e.disabled
236
+ }, null, 8, ["title", "description", "disabled"])) : p("", !0)
237
+ ], 2));
238
+ }
239
+ }), te = {
240
+ "top-checkbox": "top-checkbox",
241
+ "top-checkbox_input": "top-checkbox_input",
242
+ "top-error": "top-error"
243
+ }, se = {
244
+ $style: te
245
+ }, $e = /* @__PURE__ */ u(oe, [["__cssModules", se]]);
246
+ var m = /* @__PURE__ */ ((t) => (t.NONE = "", t.SLIDE = "slide", t.TOP = "top", t))(m || {});
247
+ const ae = ["data-top-icon"], re = ["name", "title", "placeholder", "disabled", "readonly"], le = {
248
+ key: 2,
249
+ class: "top-formsCaption"
250
+ }, ne = /* @__PURE__ */ d({
251
+ __name: "input",
252
+ props: {
253
+ modelValue: {},
254
+ name: {},
255
+ disabled: { type: Boolean },
256
+ readonly: { type: Boolean },
257
+ title: {},
258
+ captionType: { default: m.NONE },
259
+ size: { default: B.S },
260
+ icon: {},
261
+ addCleaner: { type: Boolean },
262
+ isError: { type: Boolean }
263
+ },
264
+ emits: ["update:modelValue"],
265
+ setup(t, { emit: e }) {
266
+ const a = t, l = y({
267
+ get() {
268
+ return a.modelValue;
269
+ },
270
+ set(s) {
271
+ e("update:modelValue", s);
272
+ }
273
+ }), o = y(() => a.addCleaner && !a.title || a.captionType !== m.NONE ? "" : a.title), c = () => {
274
+ e("update:modelValue", "");
275
+ };
276
+ return (s, b) => (r(), n("label", {
277
+ class: i({
278
+ "top-input": !0,
279
+ ["top-input-" + s.name]: s.name,
280
+ ["top-size_" + s.size]: !0,
281
+ "top-disabled": s.disabled,
282
+ "top-input-withCleaner": s.addCleaner,
283
+ "top-formsCaptionWrapper": s.captionType !== _(m).NONE,
284
+ "top-formsCaptionWrapper-always": s.captionType === _(m).TOP,
285
+ "top-input-withButton": !!s.$slots.btn
286
+ }),
287
+ "data-top-icon": s.icon
288
+ }, [
289
+ $(h("input", {
290
+ type: "text",
291
+ class: i({
292
+ "top-forms-focusable": !s.disabled,
293
+ "top-input_input": !0,
294
+ "top-error": s.isError
295
+ }),
296
+ autocomplete: "off_always",
297
+ name: s.name,
298
+ "onUpdate:modelValue": b[0] || (b[0] = (C) => l.value = C),
299
+ title: s.title,
300
+ placeholder: o.value,
301
+ disabled: s.disabled,
302
+ readonly: s.readonly,
303
+ onKeydown: b[1] || (b[1] = D(() => (s.addCleaner || !!s.$slots.btn) && c(), ["esc"]))
304
+ }, null, 42, re), [
305
+ [w, l.value]
306
+ ]),
307
+ s.addCleaner && l.value ? (r(), n("span", {
308
+ key: 0,
309
+ class: "top-input_cleaner top-cleaner",
310
+ "data-top-icon": "",
311
+ onClick: c
312
+ })) : p("", !0),
313
+ l.value ? k(s.$slots, "btn", { key: 1 }) : p("", !0),
314
+ k(s.$slots, "default"),
315
+ s.captionType !== _(m).NONE ? (r(), n("span", le, f(s.title), 1)) : p("", !0)
316
+ ], 10, ae));
317
+ }
318
+ }), ie = {
319
+ "top-input": "top-input",
320
+ "top-input_input": "top-input_input",
321
+ "top-input-withCleaner": "top-input-withCleaner"
322
+ }, pe = {
323
+ $style: ie
324
+ }, Be = /* @__PURE__ */ u(ne, [["__cssModules", pe]]), de = ["name", "value", "checked", "disabled"], ue = /* @__PURE__ */ d({
325
+ __name: "radio",
326
+ props: {
327
+ name: {},
328
+ value: {},
329
+ title: {},
330
+ description: {},
331
+ checked: { type: Boolean },
332
+ disabled: { type: Boolean },
333
+ isError: { type: Boolean }
334
+ },
335
+ setup(t) {
336
+ return (e, a) => (r(), n("label", {
337
+ class: i({
338
+ "top-forms-optionWrapper": !0,
339
+ "top-radio": !0,
340
+ ["top-radio_" + e.name]: e.name !== "",
341
+ "top-active": e.checked,
342
+ "top-disabled": e.disabled,
343
+ "top-error": e.isError && !e.disabled
344
+ })
345
+ }, [
346
+ h("input", {
347
+ type: "radio",
348
+ class: i({
349
+ "top-forms-focusable": !e.disabled,
350
+ "top-forms-option": !0,
351
+ "top-radio_input": !0,
352
+ "top-error": e.isError && !e.disabled
353
+ }),
354
+ name: e.name,
355
+ value: e.value,
356
+ checked: e.checked,
357
+ disabled: e.disabled
358
+ }, null, 10, de),
359
+ e.title ? (r(), v(g, {
360
+ key: 0,
361
+ title: e.title,
362
+ description: e.description,
363
+ disabled: e.disabled
364
+ }, null, 8, ["title", "description", "disabled"])) : p("", !0)
365
+ ], 2));
366
+ }
367
+ }), ce = {
368
+ "top-radio": "top-radio",
369
+ "top-radio_input": "top-radio_input",
370
+ "top-error": "top-error"
371
+ }, be = {
372
+ $style: ce
373
+ }, ge = /* @__PURE__ */ u(ue, [["__cssModules", be]]), me = ["name", "value", "checked", "disabled"], he = /* @__PURE__ */ d({
374
+ __name: "switcher",
375
+ props: {
376
+ name: {},
377
+ value: {},
378
+ title: {},
379
+ description: {},
380
+ checked: { type: Boolean },
381
+ disabled: { type: Boolean },
382
+ isError: { type: Boolean },
383
+ isSwitcher: { type: Boolean }
384
+ },
385
+ setup(t) {
386
+ return (e, a) => (r(), n("label", {
387
+ class: i({
388
+ "top-forms-optionWrapper": !0,
389
+ "top-checkboxSwitcher": !0,
390
+ "top-active": e.checked,
391
+ "top-disabled": e.disabled,
392
+ "top-error": e.isError && !e.disabled
393
+ })
394
+ }, [
395
+ h("input", {
396
+ type: "checkbox",
397
+ class: i({
398
+ "top-forms-focusable": !e.disabled,
399
+ "top-forms-option": !0,
400
+ "top-checkboxSwitcher_input": !0,
401
+ "top-error": e.isError && !e.disabled
402
+ }),
403
+ name: e.name,
404
+ value: e.value,
405
+ checked: e.checked,
406
+ disabled: e.disabled
407
+ }, null, 10, me),
408
+ e.title ? (r(), v(g, {
409
+ key: 0,
410
+ title: e.title,
411
+ description: e.description,
412
+ disabled: e.disabled
413
+ }, null, 8, ["title", "description", "disabled"])) : p("", !0)
414
+ ], 2));
415
+ }
416
+ }), ye = {
417
+ "top-checkboxSwitcher": "top-checkboxSwitcher",
418
+ "top-checkboxSwitcher_input": "top-checkboxSwitcher_input",
419
+ "top-error": "top-error"
420
+ }, fe = {
421
+ $style: ye
422
+ }, we = /* @__PURE__ */ u(he, [["__cssModules", fe]]);
423
+ export {
424
+ _e as B,
425
+ E as C,
426
+ A as H,
427
+ B as S,
428
+ ke as T,
429
+ u as _,
430
+ g as a,
431
+ $e as c,
432
+ Be as i,
433
+ ge as r,
434
+ we as s
435
+ };
436
+ //# sourceMappingURL=forms-6a6b0b80.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forms-6a6b0b80.es.js","sources":["../../src/components/forms/helpers.ts","../../src/components/forms/button/button.ts","../../src/components/forms/button/button.vue","../../src/components/forms/textarea/textarea.vue","../../src/components/forms/input/input.ts","../../src/components/forms/input/input.vue"],"sourcesContent":["/**\n * Размеры\n */\nexport enum SIZE {\n\tS = 's',\n\tL = 'l',\n\tXL = 'xl',\n}","import type { VNode } from 'vue';\nimport { SIZE } from '@/components/forms/helpers';\n\n/**\n * Определение параметров\n */\nexport interface Props {\n\tcolor?: COLOR\n\tstyling?: STYLING // bug: name = style init with object type\n\tsize?: SIZE\n\n\tname?: string\n\ttitle?: string\n\ticon?: string\n\ticon2?: string\n\n\thref?: string // если установлена ссылка, isSubmit не может быть true\n\t// value?: string\n\n\tdisabled?: boolean\n\tisSubmit?: boolean\n\tisActive?: boolean\n\tisProgress?: boolean\n}\n\n// /**\n// * Определение слотов\n// */\n// export interface Slots {\n// \t/**\n// \t * Слот с проивзольным содержимым\n// \t */\n// \tdefault(): VNode[];\n// }\n\n/**\n * Определение событий\n */\nexport interface Emits { }\n\n/**\n * Цвета\n */\nexport enum COLOR {\n\tTheme = 'theme',\n\tBlue = 'blue',\n\tGreen = 'green',\n\tOrange = 'orange',\n\tRed = 'red',\n\tPink = 'pink',\n}\n\n/**\n * Стили\n */\nexport enum STYLING {\n\tRegular = '',\n\tOutline = 'outline',\n\tSoft = 'soft',\n\tTransparent = 'transparent',\n}\n\nexport { SIZE };","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { Props } from './button';\nimport { COLOR, STYLING, SIZE } from './button';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tcolor: COLOR.Blue,\n\tstyling: STYLING.Regular,\n\tsize: SIZE.S,\n});\n\nconst tagName = computed(() => props.href ? 'a' : 'button');\n\nconst type = computed(() => props.isSubmit ? 'submit' : undefined);\n</script>\n\n<template>\n\t<component\n\t\t:is=\"tagName\"\n\t\t:class=\"{\n\t\t\t['top-active']: isActive,\n\t\t\t['top-disabled']: disabled,\n\t\t\t['top-forms-focusable']: !disabled,\n\t\t\t['top-button']: true,\n\t\t\t['top-button-progress']: isProgress,\n\t\t\t[`top-size_${size}`]: !!size,\n\t\t\t[`top-color_${color}`]: true,\n\t\t\t[`top-style_${styling}`]: !!styling,\n\t\t}\"\n\t\t:name=\"name\"\n\t\t:title=\"title\"\n\t\t:href=\"href\"\n\t\t:type=\"type\"\n\t\t:data-top-icon=\"icon || undefined\"\n\t\t:data-top-icon2=\"icon2 || undefined\"\n\t\t:disabled=\"disabled || undefined\"\n\t\t:inProgress=\"isProgress\"\n\t>\n\t\t<!-- @slot Текст или HTML в кнопке -->\n\t\t<slot>\n\t\t\t{{ !icon ? 'Button' : '' }}\n\t\t</slot>\n\t</component>\n</template>\n\n<style module>\n@import \"./style/button.css\";\n@import \"./style/style-outline.css\";\n@import \"./style/style-soft.css\";\n@import \"./style/style-transparent.css\";\n\n.top-button {\n\t--top-button-color: var(--color-white);\n\t--top-button-background-color: transparent;\n\t--top-button-background-color-hover: var(--top-button-background-color);\n\t--top-button-background-color-active: var(--top-button-background-color-hover);\n\t--top-button-background-color-selected: var(--top-button-background-color-hover);\n\t--top-button-box-shadow: none;\n\t--top-button-box-shadow-hover: var(--top-shadow-darken-2);\n\t--top-button-box-shadow-active: var(--top-shadow-darken-3);\n\t--top-button-box-shadow-selected: var(--top-shadow-darken-3);\n\t--top-forms-border-width: 0px;\n\t--top-icon-width: calc(var(--top-icon-size) + var(--top-forms-padding));\n\t--top-icon2-width: calc(var(--top-icon2-size) + var(--top-forms-padding));\n}\n\n.top-button.top-size_l {\n\t--top-forms-padding: var(--top-forms-padding_l);\n\t--top-forms-base-height: var(--top-forms-base-height_l);\n}\n\n.top-button.top-size_xl {\n\t--top-forms-padding: var(--top-forms-padding_xl);\n\t--top-forms-base-height: var(--top-forms-base-height_xl);\n}\n</style>","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport Hint from '@/components/forms/hint/hint.vue';\nimport type { Props, Emits } from './textarea';\n\nconst props = withDefaults(defineProps<Props>(), {\n\trows: 5,\n\tminHeight: 120,\n});\n\nconst emit = defineEmits<Emits>();\n\nconst value = computed({\n\tget () {\n\t\treturn props.modelValue;\n\t},\n\tset (value) {\n\t\temit('update:modelValue', value);\n\t},\n});\n</script>\n\n<template>\n\t<label\n\t\t:class=\"{\n\t\t\t['top-textarea']: true,\n\t\t\t['top-textarea-' + name]: name,\n\t\t\t['top-disabled']: disabled,\n\t\t}\"\n\t>\n\t\t<textarea\n\t\t\ttype=\"text\"\n\t\t\t:class=\"{\n\t\t\t\t['top-forms-focusable']: !disabled,\n\t\t\t\t['top-textarea_textarea']: true,\n\t\t\t\t['top-textarea_textarea-expandable']: expandable,\n\t\t\t\t['top-error']: isError,\n\t\t\t}\"\n\t\t\tautocomplete=\"off_always\"\n\t\t\t:name=\"name\"\n\t\t\t:placeholder=\"placeholder\"\n\t\t\t:disabled=\"disabled\"\n\t\t\t:readonly=\"readonly\"\n\t\t\t:rows=\"!expandable ? rows : undefined\"\n\t\t\t:=\"$attrs\"\n\t\t\tv-model=\"value\"\n\t\t/>\n\n\t\t<div\n\t\t\tv-if=\"expandable\"\n\t\t\tclass=\"top-textarea_pseudoContent\"\n\t\t>\n\t\t\t{{ value + ' ' }}\n\t\t</div>\n\n\t\t<Hint\n\t\t\tv-if=\"hint\"\n\t\t\tclass=\"top-textarea_hint\"\n\t\t\t:hint=\"hint\"\n\t\t\tv-tv-tooltip\n\t\t/>\n\t</label>\n</template>\n\n<style module>\n.top-textarea {\n\twidth: 180px;\n\tdisplay: inline-flex;\n\talign-items: center;\n\tposition: relative;\n}\n\n.top-textarea_textarea {\n\tbackground: var(--top-forms-background-color);\n\twidth: 100%;\n\tpadding: var(--top-forms-padding);\n\tresize: none;\n}\n\n.top-textarea_textarea:hover {\n\tbackground: var(--top-forms-background-color-hover);\n}\n\n.top-textarea_textarea:focus {\n\toutline-color: var(--color-theme-75);\n\toutline-offset: 0px;\n}\n\n.top-textarea_textarea.top-textarea_textarea-expandable {\n\twidth: 100%;\n\theight: 100%;\n\toverflow: hidden;\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n}\n\n.top-textarea_pseudoContent {\n\tbox-sizing: border-box;\n\tmin-height: v-bind(minHeight + 'px');\n\tpadding: var(--top-forms-padding);\n\tfont-size: 14px;\n\twhite-space: pre-wrap;\n\toverflow-wrap: anywhere;\n\tpointer-events: none;\n\topacity: 0;\n\tz-index: -1;\n}\n\n.top-textarea_hint {\n\tposition: absolute;\n\ttop: 2px;\n\tright: 2px;\n}\n</style>","import type { VNode } from 'vue';\nimport { SIZE } from '@/components/forms/helpers';\n\n/**\n * Определение параметров\n */\nexport interface Props {\n\tmodelValue?: string\n\n\tname?: string\n\tdisabled?: boolean\n\treadonly?: boolean\n\n\ttitle?: string\n\tcaptionType?: CAPTION_TYPE\n\n\tsize?: SIZE\n\ticon?: string\n\taddCleaner?: boolean\n\tisError?: boolean\n}\n\n/**\n * Определение слотов\n */\nexport interface Slots {\n\t/**\n\t * Cлот с проивзольным содержимым\n\t */\n\tdefault(): VNode[];\n\tbtn(): VNode[];\n}\n\n/**\n * Определение событий\n */\nexport interface Emits {\n\t(e: 'update:modelValue', value?: string): void\n}\n\n/**\n * Типы заголовка\n */\nexport enum CAPTION_TYPE {\n\tNONE = '',\n\tSLIDE = 'slide',\n\tTOP = 'top',\n}\n\nexport { SIZE };","<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { Props, Emits } from './input';\nimport { SIZE, CAPTION_TYPE } from './input';\n\nconst props = withDefaults(defineProps<Props>(), {\n\tsize: SIZE.S,\n\tcaptionType: CAPTION_TYPE.NONE,\n});\n\nconst emit = defineEmits<Emits>();\n\nconst value = computed({\n\tget () {\n\t\treturn props.modelValue;\n\t},\n\tset (value) {\n\t\temit('update:modelValue', value);\n\t},\n});\n\nconst placeholder = computed(() => {\n\tif (props.addCleaner && !props.title) {\n\t\treturn '';\n\t}\n\tif (props.captionType !== CAPTION_TYPE.NONE) {\n\t\treturn '';\n\t}\n\n\treturn props.title;\n});\n\nconst clean = () => {\n\temit('update:modelValue', '');\n};\n</script>\n\n<template>\n\t<label\n\t\t:class=\"{\n\t\t\t['top-input']: true,\n\t\t\t['top-input-' + name]: name,\n\t\t\t['top-size_' + size]: true,\n\t\t\t['top-disabled']: disabled,\n\t\t\t['top-input-withCleaner']: addCleaner,\n\t\t\t['top-formsCaptionWrapper']: captionType !== CAPTION_TYPE.NONE,\n\t\t\t['top-formsCaptionWrapper-always']: captionType === CAPTION_TYPE.TOP,\n\t\t\t['top-input-withButton']: !!$slots.btn,\n\t\t}\"\n\t\t:data-top-icon=\"icon\"\n\t>\n\t\t<input\n\t\t\ttype=\"text\"\n\t\t\t:class=\"{\n\t\t\t\t['top-forms-focusable']: !disabled,\n\t\t\t\t['top-input_input']: true,\n\t\t\t\t['top-error']: isError,\n\t\t\t}\"\n\t\t\tautocomplete=\"off_always\"\n\t\t\t:name=\"name\"\n\t\t\tv-model=\"value\"\n\t\t\t:title=\"title\"\n\t\t\t:placeholder=\"placeholder\"\n\t\t\t:disabled=\"disabled\"\n\t\t\t:readonly=\"readonly\"\n\t\t\t@keydown.esc=\"() => (addCleaner || !!$slots.btn) && clean()\"\n\t\t>\n\n\t\t<span\n\t\t\tv-if=\"addCleaner && value\"\n\t\t\tclass=\"top-input_cleaner top-cleaner\"\n\t\t\tdata-top-icon=\"\"\n\t\t\t@click=\"clean\"\n\t\t></span>\n\n\t\t<!-- TODO: кнопка должна отоборажаться только при изменении value -->\n\t\t<!-- TODO: до нажатия на кнопку, изменеине не должно применяться -->\n\t\t<!-- TODO: при отмене состояние должно возвращаться к первоначальному -->\n\t\t<slot\n\t\t\tv-if=\"value\"\n\t\t\tname=\"btn\"\n\t\t/>\n\n\t\t<slot></slot>\n\n\t\t<span\n\t\t\tv-if=\"captionType !== CAPTION_TYPE.NONE\"\n\t\t\tclass=\"top-formsCaption\"\n\t\t>\n\t\t\t{{ title }}\n\t\t</span>\n\t</label>\n</template>\n\n<style module>\n.top-input {\n\twidth: 180px;\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: var(--top-gap-1);\n}\n\n.top-input_input {\n\tbackground: var(--top-forms-background-color);\n}\n\n.top-input_input:hover {\n\tbackground: var(--top-forms-background-color-hover);\n}\n\n.top-input_input:focus {\n\toutline-color: var(--color-theme-75);\n\toutline-offset: 0px;\n}\n\n.top-input-withCleaner .top-input_input:not(:placeholder-shown) {\n\t--top-forms_clear-width: 24px;\n}\n\n/* TODO: перенести в inputsRange */\n.top-input_input {\n\twidth: 50%;\n\tflex-grow: 1;\n}\n\n.top-input[data-top-icon]:before {\n\t--top-icon-color: var(--color-text-secondary);\n}\n</style>"],"names":["SIZE","COLOR","STYLING","tagName","computed","props","type","value","emit","CAPTION_TYPE","placeholder","clean"],"mappings":";AAGY,IAAAA,sBAAAA,OACXA,EAAA,IAAI,KACJA,EAAA,IAAI,KACJA,EAAA,KAAK,MAHMA,IAAAA,KAAA,CAAA,CAAA,GCwCAC,sBAAAA,OACXA,EAAA,QAAQ,SACRA,EAAA,OAAO,QACPA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,MAAM,OACNA,EAAA,OAAO,QANIA,IAAAA,KAAA,CAAA,CAAA,GAYAC,sBAAAA,OACXA,EAAA,UAAU,IACVA,EAAA,UAAU,WACVA,EAAA,OAAO,QACPA,EAAA,cAAc,eAJHA,IAAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;iBC5CNC,IAAUC,EAAS,MAAMC,EAAM,OAAO,MAAM,QAAQ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