@agrotools1/at-components 0.6.11 → 0.6.13

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.
@@ -1,42 +1,63 @@
1
- import a from "./Tooltip.vue2.js";
2
- import { resolveComponent as i, openBlock as r, createElementBlock as l, createElementVNode as n, renderSlot as p, createBlock as d, Teleport as m, normalizeClass as c, normalizeStyle as f, createVNode as u, withCtx as v, createTextVNode as h, toDisplayString as y, createCommentVNode as C } from "vue";
1
+ import u from "./Tooltip.vue2.js";
2
+ import { resolveComponent as n, openBlock as l, createElementBlock as s, createElementVNode as r, renderSlot as m, createBlock as f, Teleport as c, normalizeClass as y, normalizeStyle as v, createVNode as a, withCtx as C, createCommentVNode as i } from "vue";
3
3
  import "./Tooltip.vue3.js";
4
- import g from "../_virtual/_plugin-vue_export-helper.js";
5
- const $ = {
4
+ import M from "../_virtual/_plugin-vue_export-helper.js";
5
+ const k = {
6
+ ref: "wrapper",
7
+ class: "at-tooltip-wrapper"
8
+ }, h = {
6
9
  ref: "tooltipChildren",
7
- class: "at-tooltip-content"
8
- };
9
- function k(e, o, w, N, S, V) {
10
- const s = i("AtParagraph");
11
- return r(), l("div", {
10
+ class: "at-slot-content"
11
+ }, w = ["innerHTML"];
12
+ function T(o, e, $, b, S, g) {
13
+ const p = n("AtCopySolidIcon"), d = n("AtParagraph");
14
+ return l(), s("div", {
12
15
  class: "at-tooltip-container",
13
- onMouseenter: o[0] || (o[0] = (...t) => e.show && e.show(...t)),
14
- onMouseleave: o[1] || (o[1] = (...t) => e.hide && e.hide(...t))
16
+ onMouseenter: e[2] || (e[2] = (...t) => o.show && o.show(...t)),
17
+ onMouseleave: e[3] || (e[3] = (...t) => o.handleMouseOut && o.handleMouseOut(...t))
15
18
  }, [
16
- n("div", $, [
17
- p(e.$slots, "default", {}, void 0, !0)
19
+ r("div", k, [
20
+ r("div", h, [
21
+ m(o.$slots, "default", {}, void 0, !0)
22
+ ], 512)
18
23
  ], 512),
19
- (r(), d(m, { to: "body" }, [
20
- e.visible ? (r(), l("div", {
24
+ (l(), f(c, { to: "body" }, [
25
+ o.visible ? (l(), s("div", {
21
26
  key: 0,
22
- class: c(["at-tooltip", e.tooltipClass]),
23
- style: f(e.tooltipStyle)
27
+ ref: "tooltip",
28
+ class: y(["at-tooltip", o.tooltipClass]),
29
+ style: v(o.tooltipStyle),
30
+ onMouseleave: e[1] || (e[1] = (...t) => o.handleMouseOut && o.handleMouseOut(...t))
24
31
  }, [
25
- u(s, {
32
+ a(d, {
26
33
  size: "p3",
27
34
  weight: "regular",
28
35
  class: "m-0"
29
36
  }, {
30
- default: v(() => [
31
- h(y(e.text), 1)
37
+ default: C(() => [
38
+ r("span", {
39
+ class: "at-tooltip-text",
40
+ style: { "word-break": "break-all" },
41
+ innerHTML: o.formatedText
42
+ }, null, 8, w),
43
+ o.copy ? (l(), s("span", {
44
+ key: 0,
45
+ class: "at-tooltip-copy-icon",
46
+ onClick: e[0] || (e[0] = (t) => o.copyText(o.text))
47
+ }, [
48
+ a(p, {
49
+ color: "#FFF",
50
+ size: "16"
51
+ })
52
+ ])) : i("", !0)
32
53
  ]),
33
54
  _: 1
34
55
  })
35
- ], 6)) : C("", !0)
56
+ ], 38)) : i("", !0)
36
57
  ]))
37
58
  ], 32);
38
59
  }
39
- const A = /* @__PURE__ */ g(a, [["render", k], ["__scopeId", "data-v-96e4dc5e"]]);
60
+ const F = /* @__PURE__ */ M(u, [["render", T], ["__scopeId", "data-v-8c854bf1"]]);
40
61
  export {
41
- A as default
62
+ F as default
42
63
  };
@@ -1,9 +1,11 @@
1
- import { defineComponent as z, ref as o, onMounted as B, onBeforeUnmount as T } from "vue";
2
- import { AtTipograph as _ } from "../Tipograph/index.js";
3
- const D = z({
1
+ import { defineComponent as O, ref as n, onMounted as R, onBeforeUnmount as U, computed as j } from "vue";
2
+ import { AtCopySolidIcon as D } from "../node_modules/.pnpm/agrotools-icons@0.2.6/node_modules/agrotools-icons/dist/AtCopySolidIcon/index.js";
3
+ import { AtTipograph as G } from "../Tipograph/index.js";
4
+ const Q = O({
4
5
  name: "AtTooltip",
5
6
  components: {
6
- AtParagraph: _.Paragraph
7
+ AtParagraph: G.Paragraph,
8
+ AtCopySolidIcon: D
7
9
  },
8
10
  props: {
9
11
  text: {
@@ -11,11 +13,21 @@ const D = z({
11
13
  type: String,
12
14
  default: "bottom-left"
13
15
  },
16
+ maxTextLength: {
17
+ required: !1,
18
+ type: Number,
19
+ default: 0
20
+ },
21
+ copy: {
22
+ type: Boolean,
23
+ required: !1,
24
+ default: !1
25
+ },
14
26
  position: {
15
27
  required: !1,
16
28
  type: String,
17
29
  default: "",
18
- validator: (u) => [
30
+ validator: (l) => [
19
31
  "bottom-left",
20
32
  "bottom-center",
21
33
  "bottom-right",
@@ -26,120 +38,121 @@ const D = z({
26
38
  "left-center",
27
39
  "right-bottom",
28
40
  "right-center"
29
- ].includes(u)
41
+ ].includes(l)
30
42
  }
31
43
  },
32
- setup(u) {
33
- const s = o(), t = o(), l = o(0), e = o(), a = o(), n = o(""), r = o(!1), v = () => {
34
- var p, x, f, c, h, y, b, m, d, $, g, w, k, X, Y, C, E, L, P, S, A, q;
35
- switch (e.value = s.value.getBoundingClientRect(), u.position) {
44
+ emits: ["copiedText"],
45
+ setup(l, { emit: z }) {
46
+ const x = n(), f = n(), h = n(), t = n(), o = n(0), e = n(), a = n(), d = n(""), c = n(!1), p = () => {
47
+ var r, u, i, s, v, b, g, $, w, T, k, X, C, L, Y, A, S, P, q, E, B, I;
48
+ switch (e.value = x.value.getBoundingClientRect(), l.position) {
36
49
  case "bottom-left":
37
50
  t.value = {
38
51
  x: e.value.x + 32,
39
- y: e.value.y + e.value.height + 16 + l.value
52
+ y: e.value.y + e.value.height + 16 + o.value
40
53
  }, a.value = {
41
54
  position: "absolute",
42
- top: `${((p = t.value) == null ? void 0 : p.y) || 0}px`,
43
- left: `${((x = t.value) == null ? void 0 : x.x) || 0}px`,
55
+ top: `${((r = t.value) == null ? void 0 : r.y) || 0}px`,
56
+ left: `${((u = t.value) == null ? void 0 : u.x) || 0}px`,
44
57
  transform: "translateX(-100%)"
45
58
  };
46
59
  break;
47
60
  case "bottom-center":
48
61
  t.value = {
49
62
  x: e.value.x + e.value.width / 2,
50
- y: e.value.y + e.value.height + 16 + l.value
63
+ y: e.value.y + e.value.height + 16 + o.value
51
64
  }, a.value = {
52
65
  position: "absolute",
53
- top: `${((f = t.value) == null ? void 0 : f.y) || 0}px`,
54
- left: `${((c = t.value) == null ? void 0 : c.x) || 0}px`,
66
+ top: `${((i = t.value) == null ? void 0 : i.y) || 0}px`,
67
+ left: `${((s = t.value) == null ? void 0 : s.x) || 0}px`,
55
68
  transform: "translateX(-50%)"
56
69
  };
57
70
  break;
58
71
  case "bottom-right":
59
72
  t.value = {
60
73
  x: e.value.x - 32,
61
- y: e.value.y + e.value.height + 16 + l.value
74
+ y: e.value.y + e.value.height + 16 + o.value
62
75
  }, a.value = {
63
76
  position: "absolute",
64
- top: `${((h = t.value) == null ? void 0 : h.y) || 0}px`,
65
- left: `${((y = t.value) == null ? void 0 : y.x) || 0}px`,
77
+ top: `${((v = t.value) == null ? void 0 : v.y) || 0}px`,
78
+ left: `${((b = t.value) == null ? void 0 : b.x) || 0}px`,
66
79
  transform: `translateX(${e.value.width}px)`
67
80
  };
68
81
  break;
69
82
  case "top-left":
70
83
  t.value = {
71
84
  x: e.value.x + 32,
72
- y: e.value.y - e.value.height + 24 + l.value
85
+ y: e.value.y - e.value.height + 24 + o.value
73
86
  }, a.value = {
74
87
  position: "absolute",
75
- top: `${((b = t.value) == null ? void 0 : b.y) || 0}px`,
76
- left: `${((m = t.value) == null ? void 0 : m.x) || 0}px`,
88
+ top: `${((g = t.value) == null ? void 0 : g.y) || 0}px`,
89
+ left: `${(($ = t.value) == null ? void 0 : $.x) || 0}px`,
77
90
  transform: "translateX(-100%) translateY(-100%)"
78
91
  };
79
92
  break;
80
93
  case "top-center":
81
94
  t.value = {
82
95
  x: e.value.x + e.value.width / 2,
83
- y: e.value.y - e.value.height + 24 + l.value
96
+ y: e.value.y - e.value.height + 24 + o.value
84
97
  }, a.value = {
85
98
  position: "absolute",
86
- top: `${((d = t.value) == null ? void 0 : d.y) || 0}px`,
87
- left: `${(($ = t.value) == null ? void 0 : $.x) || 0}px`,
99
+ top: `${((w = t.value) == null ? void 0 : w.y) || 0}px`,
100
+ left: `${((T = t.value) == null ? void 0 : T.x) || 0}px`,
88
101
  transform: "translateX(-50%) translateY(-100%)"
89
102
  };
90
103
  break;
91
104
  case "top-right":
92
105
  t.value = {
93
106
  x: e.value.x - 32,
94
- y: e.value.y - e.value.height + 24 + l.value
107
+ y: e.value.y - e.value.height + 24 + o.value
95
108
  }, a.value = {
96
109
  position: "absolute",
97
- top: `${((g = t.value) == null ? void 0 : g.y) || 0}px`,
98
- left: `${((w = t.value) == null ? void 0 : w.x) || 0}px`,
110
+ top: `${((k = t.value) == null ? void 0 : k.y) || 0}px`,
111
+ left: `${((X = t.value) == null ? void 0 : X.x) || 0}px`,
99
112
  transform: `translateX(${e.value.width}px) translateY(-100%)`
100
113
  };
101
114
  break;
102
115
  case "left-bottom":
103
116
  t.value = {
104
117
  x: e.value.x - 16,
105
- y: e.value.y + l.value
118
+ y: e.value.y + o.value
106
119
  }, a.value = {
107
120
  position: "absolute",
108
- top: `${((k = t.value) == null ? void 0 : k.y) || 0}px`,
109
- left: `${((X = t.value) == null ? void 0 : X.x) || 0}px`,
121
+ top: `${((C = t.value) == null ? void 0 : C.y) || 0}px`,
122
+ left: `${((L = t.value) == null ? void 0 : L.x) || 0}px`,
110
123
  transform: "translateX(-100%)"
111
124
  };
112
125
  break;
113
126
  case "left-center":
114
127
  t.value = {
115
128
  x: e.value.x - 16,
116
- y: e.value.y + e.value.height / 2 + l.value
129
+ y: e.value.y + e.value.height / 2 + o.value
117
130
  }, a.value = {
118
131
  position: "absolute",
119
132
  top: `${((Y = t.value) == null ? void 0 : Y.y) || 0}px`,
120
- left: `${((C = t.value) == null ? void 0 : C.x) || 0}px`,
133
+ left: `${((A = t.value) == null ? void 0 : A.x) || 0}px`,
121
134
  transform: "translateX(-100%) translateY(-50%)"
122
135
  };
123
136
  break;
124
137
  case "right-bottom":
125
138
  t.value = {
126
139
  x: e.value.x + 16,
127
- y: e.value.y + l.value
140
+ y: e.value.y + o.value
128
141
  }, a.value = {
129
142
  position: "absolute",
130
- top: `${((E = t.value) == null ? void 0 : E.y) || 0}px`,
131
- left: `${((L = t.value) == null ? void 0 : L.x) || 0}px`,
143
+ top: `${((S = t.value) == null ? void 0 : S.y) || 0}px`,
144
+ left: `${((P = t.value) == null ? void 0 : P.x) || 0}px`,
132
145
  transform: `translateX(${e.value.width}px)`
133
146
  };
134
147
  break;
135
148
  case "right-center":
136
149
  t.value = {
137
150
  x: e.value.x + 16,
138
- y: e.value.y + e.value.height / 2 + l.value
151
+ y: e.value.y + e.value.height / 2 + o.value
139
152
  }, a.value = {
140
153
  position: "absolute",
141
- top: `${((P = t.value) == null ? void 0 : P.y) || 0}px`,
142
- left: `${((S = t.value) == null ? void 0 : S.x) || 0}px`,
154
+ top: `${((q = t.value) == null ? void 0 : q.y) || 0}px`,
155
+ left: `${((E = t.value) == null ? void 0 : E.x) || 0}px`,
143
156
  transform: `translateX(${e.value.width}px) translateY(-50%)`
144
157
  };
145
158
  break;
@@ -149,35 +162,55 @@ const D = z({
149
162
  y: e.value.y + e.value.height + 16
150
163
  }, a.value = {
151
164
  position: "absolute",
152
- top: `${((A = t.value) == null ? void 0 : A.y) || 0}px`,
153
- left: `${((q = t.value) == null ? void 0 : q.x) || 0}px`,
165
+ top: `${((B = t.value) == null ? void 0 : B.y) || 0}px`,
166
+ left: `${((I = t.value) == null ? void 0 : I.x) || 0}px`,
154
167
  transform: "translateX(-100%)"
155
168
  };
156
169
  break;
157
170
  }
158
- n.value = `at-tooltip-${u.position}`;
159
- }, i = () => {
160
- l.value = window.scrollY, v();
171
+ d.value = `at-tooltip-${l.position}`;
172
+ }, y = () => {
173
+ o.value = window.scrollY, p();
161
174
  };
162
- return B(() => {
163
- window.addEventListener("resize", v), window.addEventListener("scroll", i);
164
- }), T(() => {
165
- window.removeEventListener("resize", v), window.removeEventListener("scroll", i);
166
- }), {
167
- tooltipChildren: s,
175
+ R(() => {
176
+ window.addEventListener("resize", p), window.addEventListener("scroll", y);
177
+ }), U(() => {
178
+ window.removeEventListener("resize", p), window.removeEventListener("scroll", y);
179
+ });
180
+ const M = () => {
181
+ c.value = !0, p();
182
+ }, m = () => {
183
+ c.value = !1;
184
+ }, _ = (r) => {
185
+ var i, s, v;
186
+ const { relatedTarget: u } = r;
187
+ u && ((i = f.value) != null && i.contains(u) || (s = x.value) != null && s.contains(u) || (v = h.value) != null && v.contains(u)) || m();
188
+ }, F = async (r) => {
189
+ if (navigator && navigator.clipboard)
190
+ try {
191
+ await navigator.clipboard.writeText(r), z("copiedText", r);
192
+ } catch (u) {
193
+ console.error("Failed to copy: ", u);
194
+ }
195
+ else
196
+ console.warn("Clipboard API not supported");
197
+ }, N = j(() => !l.maxTextLength || l.text.length <= l.maxTextLength ? l.text : `${l.text.substring(0, l.maxTextLength)}...`);
198
+ return {
199
+ tooltipChildren: x,
168
200
  contentPosition: t,
169
201
  tooltipStyle: a,
170
- tooltipClass: n,
171
- visible: r,
172
- show: () => {
173
- r.value = !0, v();
174
- },
175
- hide: () => {
176
- r.value = !1;
177
- }
202
+ tooltipClass: d,
203
+ visible: c,
204
+ wrapper: f,
205
+ tooltip: h,
206
+ formatedText: N,
207
+ show: M,
208
+ hide: m,
209
+ handleMouseOut: _,
210
+ copyText: F
178
211
  };
179
212
  }
180
213
  });
181
214
  export {
182
- D as default
215
+ Q as default
183
216
  };
@@ -1,4 +1,4 @@
1
- const e = "";
1
+ const _ = "";
2
2
  export {
3
- e as default
3
+ _ as default
4
4
  };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from "./ColorPicker";
7
7
  export * from "./DataTable";
8
8
  export * from "./DatePicker";
9
9
  export * from "./Faq";
10
+ export * from "./Faq/FaqItem";
10
11
  export * from "./Filter";
11
12
  export * from "./Illustration";
12
13
  export * from "./Input";
package/dist/index.js CHANGED
@@ -1,64 +1,66 @@
1
1
  import { default as e } from "./Accordion/Accordion.vue.js";
2
- import { default as a } from "./Avatar/Avatar.vue.js";
2
+ import { default as r } from "./Avatar/Avatar.vue.js";
3
3
  import { default as l } from "./Button/Button.vue.js";
4
4
  import { default as s } from "./CardWithInsights/CardWithInsights.vue.js";
5
- import { default as x } from "./Checkbox/Checkbox.vue.js";
5
+ import { default as m } from "./Checkbox/Checkbox.vue.js";
6
6
  import { default as u } from "./ColorPicker/ColorPicker.vue.js";
7
7
  import { AtDataTable as i } from "./DataTable/index.js";
8
8
  import { default as g } from "./DatePicker/DatePicker.vue.js";
9
9
  import { default as T } from "./Faq/Faq.vue.js";
10
- import { default as b } from "./Filter/components/Filter.vue.js";
11
- import { default as C } from "./Illustration/Illustration.vue.js";
12
- import { AtInput as B } from "./Input/index.js";
13
- import { default as L } from "./Legend/Legend.vue.js";
10
+ import { default as b } from "./Faq/FaqItem/FaqItem.vue.js";
11
+ import { default as C } from "./Filter/components/Filter.vue.js";
12
+ import { default as S } from "./Illustration/Illustration.vue.js";
13
+ import { AtInput as F } from "./Input/index.js";
14
+ import { default as P } from "./Legend/Legend.vue.js";
14
15
  import { default as D } from "./List/components/List.vue.js";
15
- import { default as M } from "./Loading/Loading.vue.js";
16
- import { default as v } from "./Map/Map.vue.js";
17
- import { default as R } from "./Modal/Modal.vue.js";
18
- import { default as W } from "./Notifications/Notifications.vue.js";
19
- import { default as w } from "./ProgressBar/ProgressBar.vue.js";
20
- import { default as z } from "./RadioButton/RadioButton.vue.js";
21
- import { default as G } from "./Search/Search.vue.js";
22
- import { AtSelect as J } from "./Select/index.js";
23
- import { default as O } from "./Skeleton/Skeleton.vue.js";
24
- import { default as V } from "./Stepper/Stepper.vue.js";
25
- import { default as Y } from "./TableConfig/TableConfig.vue.js";
26
- import { default as _ } from "./Tabs/Tabs.vue.js";
27
- import { default as tt } from "./Tag/Tag.vue.js";
28
- import { AtTipograph as et } from "./Tipograph/index.js";
29
- import { default as at } from "./Toggle/Toggle.vue.js";
30
- import { default as lt } from "./Tooltip/Tooltip.vue.js";
31
- import { default as st } from "./Upload/Upload.vue.js";
16
+ import { default as v } from "./Loading/Loading.vue.js";
17
+ import { default as R } from "./Map/Map.vue.js";
18
+ import { default as W } from "./Modal/Modal.vue.js";
19
+ import { default as w } from "./Notifications/Notifications.vue.js";
20
+ import { default as z } from "./ProgressBar/ProgressBar.vue.js";
21
+ import { default as G } from "./RadioButton/RadioButton.vue.js";
22
+ import { default as J } from "./Search/Search.vue.js";
23
+ import { AtSelect as O } from "./Select/index.js";
24
+ import { default as V } from "./Skeleton/Skeleton.vue.js";
25
+ import { default as Y } from "./Stepper/Stepper.vue.js";
26
+ import { default as _ } from "./TableConfig/TableConfig.vue.js";
27
+ import { default as tt } from "./Tabs/Tabs.vue.js";
28
+ import { default as et } from "./Tag/Tag.vue.js";
29
+ import { AtTipograph as rt } from "./Tipograph/index.js";
30
+ import { default as lt } from "./Toggle/Toggle.vue.js";
31
+ import { default as st } from "./Tooltip/Tooltip.vue.js";
32
+ import { default as mt } from "./Upload/Upload.vue.js";
32
33
  export {
33
34
  e as AtAccordion,
34
- a as AtAvatar,
35
+ r as AtAvatar,
35
36
  l as AtButton,
36
37
  s as AtCardWithInsights,
37
- x as AtCheckbox,
38
+ m as AtCheckbox,
38
39
  i as AtDataTable,
39
40
  g as AtDatePicker,
40
- b as AtFilter,
41
- C as AtIllustration,
42
- B as AtInput,
43
- L as AtLegend,
41
+ b as AtFaqItem,
42
+ C as AtFilter,
43
+ S as AtIllustration,
44
+ F as AtInput,
45
+ P as AtLegend,
44
46
  D as AtList,
45
- M as AtLoading,
46
- v as AtMap,
47
- R as AtModal,
48
- W as AtNotifications,
49
- w as AtProgressBar,
50
- z as AtRadioButton,
51
- G as AtSearch,
52
- J as AtSelect,
53
- O as AtSkeleton,
54
- Y as AtTableConfig,
55
- _ as AtTabs,
56
- tt as AtTag,
57
- et as AtTipograph,
58
- at as AtToggle,
59
- lt as AtTooltip,
47
+ v as AtLoading,
48
+ R as AtMap,
49
+ W as AtModal,
50
+ w as AtNotifications,
51
+ z as AtProgressBar,
52
+ G as AtRadioButton,
53
+ J as AtSearch,
54
+ O as AtSelect,
55
+ V as AtSkeleton,
56
+ _ as AtTableConfig,
57
+ tt as AtTabs,
58
+ et as AtTag,
59
+ rt as AtTipograph,
60
+ lt as AtToggle,
61
+ st as AtTooltip,
60
62
  u as ColorPicker,
61
63
  T as Faq,
62
- V as Stepper,
63
- st as Upload
64
+ Y as Stepper,
65
+ mt as Upload
64
66
  };