@kiva/kv-components 9.1.1 → 9.2.0

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 +1 @@
1
- .section[data-v-1d721061]{border-bottom-width:.0625rem;border-top-width:0px;--tw-border-opacity: 1;border-color:rgba(var(--border-tertiary),var(--tw-border-opacity, 1));padding:.5rem;display:block;overflow:hidden}@media print{.section[data-v-1d721061]{page-break-inside:avoid}}.section--lender-info[data-v-1d721061]{padding-top:0}.section--print[data-v-1d721061]{border-bottom:0}.checkout-receipt__headline[data-v-1d721061]{text-align:center;margin-bottom:1.5rem}.checkout-receipt__item-list[data-v-1d721061]{list-style:none;margin:0;width:100%}.loan__name[data-v-1d721061]{margin-bottom:.5rem}.loan__name--inline[data-v-1d721061]{display:inline-block}.loan__amount[data-v-1d721061]{text-align:right}.total[data-v-1d721061]{display:flex;align-items:baseline}.total__header[data-v-1d721061],.total__amount[data-v-1d721061]{text-align:right;flex:1}.total__amount[data-v-1d721061]{flex-grow:.33}.payments[data-v-1d721061]{border-bottom:none}.payments__type[data-v-1d721061]{display:flex;text-align:right}.payments__type-title[data-v-1d721061],.payments__type-amount[data-v-1d721061]{flex:1}.print[data-v-1d721061]{margin:0 auto}
1
+ .section[data-v-e06307e1]{border-bottom-width:.0625rem;border-top-width:0px;--tw-border-opacity: 1;border-color:rgba(var(--border-tertiary),var(--tw-border-opacity, 1));padding:.5rem;display:block;overflow:hidden}@media print{.section[data-v-e06307e1]{page-break-inside:avoid}}.section--lender-info[data-v-e06307e1]{padding-top:0}.section--print[data-v-e06307e1]{border-bottom:0}.checkout-receipt__headline[data-v-e06307e1]{text-align:center;margin-bottom:1.5rem}.checkout-receipt__item-list[data-v-e06307e1]{list-style:none;margin:0;width:100%}.loan__name[data-v-e06307e1]{margin-bottom:.5rem}.loan__name--inline[data-v-e06307e1]{display:inline-block}.loan__amount[data-v-e06307e1]{text-align:right}.total[data-v-e06307e1]{display:flex;align-items:baseline}.total__header[data-v-e06307e1],.total__amount[data-v-e06307e1]{text-align:right;flex:1}.total__amount[data-v-e06307e1]{flex-grow:.33}.payments[data-v-e06307e1]{border-bottom:none}.payments__type[data-v-e06307e1]{display:flex;text-align:right}.payments__type-title[data-v-e06307e1],.payments__type-amount[data-v-e06307e1]{flex:1}.print[data-v-e06307e1]{margin:0 auto}
@@ -1,5 +1,5 @@
1
- import C from "./KvCheckoutReceipt2.js";
2
- import { resolveComponent as _, resolveDirective as f, openBlock as s, createElementBlock as o, createElementVNode as e, toDisplayString as i, createCommentVNode as d, Fragment as c, renderList as k, createTextVNode as l, createVNode as p, withCtx as v, withDirectives as b } from "vue";
1
+ import f from "./KvCheckoutReceipt2.js";
2
+ import { resolveComponent as _, resolveDirective as h, openBlock as s, createElementBlock as o, createElementVNode as e, toDisplayString as i, createCommentVNode as d, Fragment as c, renderList as k, createTextVNode as l, createVNode as p, withCtx as v, withDirectives as b } from "vue";
3
3
  import "./KvCheckoutReceipt.css";
4
4
  import x from "../_virtual/_plugin-vue_export-helper.js";
5
5
  const g = { class: "checkout-receipt" }, T = { class: "checkout-receipt__wrapper tw-bg-primary tw-p-4 tw-rounded-xs tw-border tw-border-tertiary" }, j = {
@@ -33,24 +33,24 @@ const g = { class: "checkout-receipt" }, T = { class: "checkout-receipt__wrapper
33
33
  }, B = {
34
34
  "data-testid": "kcard",
35
35
  class: "loan kcard"
36
- }, L = {
36
+ }, U = {
37
37
  class: "loan__details data-hj-suppress",
38
38
  "data-testid": "kcard-details"
39
- }, U = {
39
+ }, q = {
40
40
  key: 0,
41
41
  "data-testid": "kcard-details",
42
42
  class: "loan__details data-hj-suppress"
43
- }, q = {
43
+ }, z = {
44
44
  class: "loan__details data-hj-suppress",
45
45
  "data-testid": "kcard-details"
46
- }, z = {
46
+ }, L = {
47
47
  class: "loan__amount tw-text-title",
48
48
  "data-testid": "kcard-amount"
49
- }, G = {
49
+ }, S = {
50
50
  key: 0,
51
51
  "data-testid": "kcard-portfolio",
52
52
  class: "section tw-text-center print:!tw-hidden"
53
- }, S = { href: "/portfolio/kiva-cards" }, W = { class: "checkout-receipt__item-list" }, Y = { class: "section" }, H = {
53
+ }, W = { href: "/portfolio/kiva-cards" }, Y = { class: "checkout-receipt__item-list" }, G = { class: "section" }, H = {
54
54
  class: "loan",
55
55
  "data-testid": "donation"
56
56
  }, J = {
@@ -103,7 +103,7 @@ const g = { class: "checkout-receipt" }, T = { class: "checkout-receipt__wrapper
103
103
  "data-testid": "amount-charged-payment-amount"
104
104
  }, ct = { class: "section section--print print:!tw-hidden" };
105
105
  function pt(_t, t, n, m, mt, r) {
106
- const u = _("kv-material-icon"), y = _("kv-tooltip"), w = _("kv-button"), h = f("kv-track-event");
106
+ const u = _("kv-material-icon"), y = _("kv-tooltip"), w = _("kv-button"), C = h("kv-track-event");
107
107
  return s(), o("div", g, [
108
108
  t[25] || (t[25] = e("h2", { class: "checkout-receipt__headline" }, " Order Confirmation ", -1)),
109
109
  e("div", T, [
@@ -167,8 +167,7 @@ function pt(_t, t, n, m, mt, r) {
167
167
  }, null, 8, ["id", "icon"]),
168
168
  p(y, {
169
169
  "data-testid": "kcard-tool-tip-text",
170
- controller: `print-card-${a.id}`,
171
- theme: "ecoGreenLight"
170
+ controller: `print-card-${a.id}`
172
171
  }, {
173
172
  default: v(() => t[2] || (t[2] = [
174
173
  l(" You can print this card now. We'll also send it to you in an email so you can print it later. ")
@@ -193,7 +192,7 @@ function pt(_t, t, n, m, mt, r) {
193
192
  class: "loan__name tw-text-title",
194
193
  "data-testid": "kcard-type-postal"
195
194
  }, " Postal delivery Kiva Card ", -1)),
196
- e("div", L, [
195
+ e("div", U, [
197
196
  l(" For: " + i(a.kivaCardObject.mailingInfo.firstName) + " " + i(a.kivaCardObject.mailingInfo.lastName), 1),
198
197
  t[6] || (t[6] = e("br", null, null, -1)),
199
198
  l(" " + i(a.kivaCardObject.mailingInfo.address), 1),
@@ -209,13 +208,13 @@ function pt(_t, t, n, m, mt, r) {
209
208
  class: "loan__name tw-text-title",
210
209
  "data-testid": "kcard-type-lender"
211
210
  }, " Kiva Card ", -1)),
212
- a.kivaCardObject.recipient.name ? (s(), o("div", U, " For: " + i(a.kivaCardObject.recipient.name), 1)) : d("", !0)
211
+ a.kivaCardObject.recipient.name ? (s(), o("div", q, " For: " + i(a.kivaCardObject.recipient.name), 1)) : d("", !0)
213
212
  ], 64)) : a.kivaCardObject.deliveryType === "email" ? (s(), o(c, { key: 3 }, [
214
213
  t[11] || (t[11] = e("h3", {
215
214
  class: "loan__name tw-text-title",
216
215
  "data-testid": "kcard-type-email"
217
216
  }, " Email delivery Kiva Card ", -1)),
218
- e("div", q, [
217
+ e("div", z, [
219
218
  t[10] || (t[10] = l(" For: ")),
220
219
  a.kivaCardObject.recipient.name ? (s(), o(c, { key: 0 }, [
221
220
  l(i(a.kivaCardObject.recipient.name) + " – ", 1)
@@ -223,23 +222,23 @@ function pt(_t, t, n, m, mt, r) {
223
222
  l(" " + i(a.kivaCardObject.recipient.email), 1)
224
223
  ])
225
224
  ], 64)) : d("", !0),
226
- e("div", z, " $" + i(a.price), 1)
225
+ e("div", L, " $" + i(a.price), 1)
227
226
  ])
228
227
  ]))), 128)),
229
- r.kivaCards.length > 0 ? (s(), o("li", G, [
228
+ r.kivaCards.length > 0 ? (s(), o("li", S, [
230
229
  t[13] || (t[13] = l(" For more details about all your Kiva Card purchases, please visit your ")),
231
- b((s(), o("a", S, t[12] || (t[12] = [
230
+ b((s(), o("a", W, t[12] || (t[12] = [
232
231
  l(" Kiva portfolio ")
233
232
  ]))), [
234
- [h, ["Thanks", "click", "kiva-card-portfolio"]]
233
+ [C, ["Thanks", "click", "kiva-card-portfolio"]]
235
234
  ]),
236
235
  t[14] || (t[14] = l(". "))
237
236
  ])) : d("", !0)
238
237
  ])
239
238
  ]),
240
239
  e("section", null, [
241
- e("ul", W, [
242
- e("li", Y, [
240
+ e("ul", Y, [
241
+ e("li", G, [
243
242
  e("div", H, [
244
243
  t[15] || (t[15] = e("h3", { class: "loan__name tw-text-title" }, " Donation to Kiva ", -1)),
245
244
  n.receipt.totals.donationTotal > 0 ? (s(), o("a", {
@@ -307,7 +306,7 @@ function pt(_t, t, n, m, mt, r) {
307
306
  ])
308
307
  ]);
309
308
  }
310
- const wt = /* @__PURE__ */ x(C, [["render", pt], ["__scopeId", "data-v-1d721061"]]);
309
+ const wt = /* @__PURE__ */ x(f, [["render", pt], ["__scopeId", "data-v-e06307e1"]]);
311
310
  export {
312
311
  wt as default
313
312
  };
@@ -1,6 +1,6 @@
1
1
  import h from "./KvLoanTag2.js";
2
2
  import { KV_LOAN_TAG_FRAGMENT as L } from "./KvLoanTag2.js";
3
- import { resolveComponent as d, openBlock as e, createElementBlock as r, normalizeStyle as _, normalizeClass as w, Fragment as l, createTextVNode as m, toDisplayString as a, createElementVNode as o, createVNode as p, withCtx as y, renderList as f, createBlock as k, createCommentVNode as s } from "vue";
3
+ import { resolveComponent as d, openBlock as e, createElementBlock as r, normalizeStyle as _, normalizeClass as w, Fragment as o, createTextVNode as m, toDisplayString as a, createElementVNode as l, createVNode as p, withCtx as y, renderList as k, createBlock as f, createCommentVNode as s } from "vue";
4
4
  import x from "../_virtual/_plugin-vue_export-helper.js";
5
5
  const v = ["id"], M = { class: "tw-whitespace-nowrap tw-pb-0.5" };
6
6
  function N(b, i, c, C, T, t) {
@@ -10,30 +10,29 @@ function N(b, i, c, C, T, t) {
10
10
  class: w(["tw-text-small tw-font-medium tw-pt-0.5", { "tw-line-clamp-1": !t.isMultipleMatch }]),
11
11
  style: _({ color: t.tagColor })
12
12
  }, [
13
- t.isMultipleMatch ? (e(), r(l, { key: 0 }, [
13
+ t.isMultipleMatch ? (e(), r(o, { key: 0 }, [
14
14
  m(a(t.totalMatchRatio) + "x match by ", 1),
15
- o("span", {
15
+ l("span", {
16
16
  id: `matching-orgs-${c.loan.id}`,
17
17
  class: "tw-underline tw-decoration-dotted tw-cursor-pointer"
18
18
  }, a(t.multiMatchingOrgs.length) + " organizations", 9, v),
19
19
  p(u, {
20
20
  controller: `matching-orgs-${c.loan.id}`,
21
- "max-width": "320px",
22
- theme: "default"
21
+ "max-width": "320px"
23
22
  }, {
24
23
  default: y(() => [
25
- o("p", M, " Your contribution is matched by " + a(t.multiMatchingOrgs.length) + " partners ", 1),
26
- i[0] || (i[0] = o("hr", { class: "tw-border-caution-highlight tw-py-0.5" }, null, -1)),
27
- (e(!0), r(l, null, f(t.multiMatchingOrgs, (n) => (e(), r("p", {
24
+ l("p", M, " Your contribution is matched by " + a(t.multiMatchingOrgs.length) + " partners ", 1),
25
+ i[0] || (i[0] = l("hr", { class: "tw-border-caution-highlight tw-py-0.5" }, null, -1)),
26
+ (e(!0), r(o, null, k(t.multiMatchingOrgs, (n) => (e(), r("p", {
28
27
  key: n.managedAccountId,
29
28
  class: "tw-m-0"
30
29
  }, a(n.ratio) + ":1 matching by " + a(t.orgDisplayName(n)), 1))), 128))
31
30
  ]),
32
31
  _: 1
33
32
  }, 8, ["controller"])
34
- ], 64)) : (e(), r(l, { key: 1 }, [
33
+ ], 64)) : (e(), r(o, { key: 1 }, [
35
34
  m(a(t.tagText) + " ", 1),
36
- t.variation === "ending-soon" ? (e(), k(g, {
35
+ t.variation === "ending-soon" ? (e(), f(g, {
37
36
  key: 0,
38
37
  deadline: t.deadline
39
38
  }, null, 8, ["deadline"])) : s("", !0)
@@ -23,17 +23,28 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
23
23
  type: ObjectConstructor;
24
24
  default: () => void;
25
25
  };
26
+ persistent: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
26
30
  }>, {}, {
27
31
  popper: any;
28
32
  popperPromise: any;
29
33
  styles: {};
30
34
  show: boolean;
31
35
  timeout: any;
36
+ suppressOpen: boolean;
32
37
  }, {
33
38
  reference(): any;
39
+ hitTargets(): any[];
34
40
  }, {
35
41
  open(): void;
36
42
  close(): void;
43
+ closeOnLeave(): void;
44
+ hide(): void;
45
+ outsideHandler(e: any): void;
46
+ dismiss(): void;
47
+ keyupHandler(e: any): void;
37
48
  toggle(): void;
38
49
  update(): void;
39
50
  initPopper(): any;
@@ -70,11 +81,16 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
70
81
  type: ObjectConstructor;
71
82
  default: () => void;
72
83
  };
84
+ persistent: {
85
+ type: BooleanConstructor;
86
+ default: boolean;
87
+ };
73
88
  }>> & Readonly<{}>, {
74
89
  openDelay: number;
75
90
  closeDelay: number;
76
91
  transitionType: string;
77
92
  popperPlacement: string;
78
93
  popperModifiers: Record<string, any>;
94
+ persistent: boolean;
79
95
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
80
96
  export default _default;
@@ -1,4 +1,4 @@
1
- import { offBodyTouchstart as r, onBodyTouchstart as o, isTargetElement as i } from "../utils/touchEvents.js";
1
+ import { offBodyTouchstart as i, onBodyTouchstart as o, isTargetElement as r } from "../utils/touchEvents.js";
2
2
  const h = {
3
3
  name: "KvPopper",
4
4
  props: {
@@ -14,7 +14,13 @@ const h = {
14
14
  transitionType: { type: String, default: "" },
15
15
  popperPlacement: { type: String, default: "bottom-start" },
16
16
  popperModifiers: { type: Object, default: () => {
17
- } }
17
+ } },
18
+ /**
19
+ * Stay open once shown, rather than closing when the pointer or focus leaves the
20
+ * controller. Escape and an outside click still close it. Use for poppers holding
21
+ * something interactive, which the user has to be able to reach and act on.
22
+ */
23
+ persistent: { type: Boolean, default: !1 }
18
24
  },
19
25
  data() {
20
26
  return {
@@ -22,12 +28,18 @@ const h = {
22
28
  popperPromise: null,
23
29
  styles: {},
24
30
  show: !1,
25
- timeout: null
31
+ timeout: null,
32
+ suppressOpen: !1
26
33
  };
27
34
  },
28
35
  computed: {
29
36
  reference() {
30
37
  return typeof this.controller == "string" ? document.getElementById(this.controller) : this.controller;
38
+ },
39
+ // reference resolves by id on every read, so it is null once the controller leaves
40
+ // the DOM while this popper is still mounted.
41
+ hitTargets() {
42
+ return [this.reference, this.$el].filter(Boolean);
31
43
  }
32
44
  },
33
45
  watch: {
@@ -46,7 +58,7 @@ const h = {
46
58
  },
47
59
  methods: {
48
60
  open() {
49
- this.initPopper().then(() => {
61
+ this.suppressOpen || this.initPopper().then(() => {
50
62
  this.setTimeout(() => {
51
63
  this.show = !0, this.popper.scheduleUpdate(), this.attachBodyEvents();
52
64
  }, this.openDelay);
@@ -57,6 +69,27 @@ const h = {
57
69
  this.show = !1, this.removeBodyEvents();
58
70
  }, this.closeDelay);
59
71
  },
72
+ // Persistent content has to stay reachable, so leaving the controller must not close
73
+ // it — by pointer or by tabbing in. Checked here so the prop can change after mount.
74
+ closeOnLeave() {
75
+ this.persistent || this.close();
76
+ },
77
+ // Close now, skipping closeDelay, for dismissals the user asked for directly.
78
+ hide() {
79
+ window.clearTimeout(this.timeout), this.show = !1, this.removeBodyEvents();
80
+ },
81
+ outsideHandler(e) {
82
+ r(e, this.hitTargets) || this.hide();
83
+ },
84
+ // Ends the current viewing. Returns focus only if it was inside, so it is not
85
+ // stranded on content that just went away.
86
+ dismiss() {
87
+ const e = this.$el.contains(document.activeElement);
88
+ this.hide(), e && this.reference && (this.suppressOpen = !0, this.reference.focus(), this.suppressOpen = !1);
89
+ },
90
+ keyupHandler(e) {
91
+ e.key === "Escape" && (e.stopPropagation(), this.dismiss());
92
+ },
60
93
  toggle() {
61
94
  this.show ? this.close() : this.open();
62
95
  },
@@ -80,22 +113,22 @@ const h = {
80
113
  }), this.popperPromise);
81
114
  },
82
115
  bodyTouchHandler(e) {
83
- i(e, [this.reference, this.$el]) || (this.show = !1, this.removeBodyEvents());
116
+ r(e, this.hitTargets) || (this.show = !1, this.removeBodyEvents());
84
117
  },
85
118
  referenceTapHandler(e) {
86
119
  e.preventDefault(), this.toggle();
87
120
  },
88
121
  attachEvents() {
89
- this.reference.addEventListener("mouseover", this.open), this.reference.addEventListener("focus", this.open), this.reference.addEventListener("mouseout", this.close), this.reference.addEventListener("blur", this.close), this.$el.addEventListener("mouseover", this.open), this.$el.addEventListener("mouseout", this.close), this.reference.addEventListener("touchstart", this.referenceTapHandler);
122
+ this.reference.addEventListener("mouseover", this.open), this.reference.addEventListener("focus", this.open), this.reference.addEventListener("touchstart", this.referenceTapHandler), this.reference.addEventListener("mouseout", this.closeOnLeave), this.reference.addEventListener("blur", this.closeOnLeave), this.$el.addEventListener("mouseover", this.open), this.$el.addEventListener("mouseout", this.closeOnLeave);
90
123
  },
91
124
  attachBodyEvents() {
92
- o(this.bodyTouchHandler);
125
+ o(this.bodyTouchHandler), document.addEventListener("click", this.outsideHandler), document.addEventListener("keyup", this.keyupHandler, !0);
93
126
  },
94
127
  removeEvents() {
95
- this.removeBodyEvents(), this.reference.removeEventListener("touchstart", this.referenceTapHandler), this.reference.removeEventListener("mouseover", this.open), this.reference.removeEventListener("mouseout", this.close), this.$el.removeEventListener("mouseover", this.open), this.$el.removeEventListener("mouseout", this.close);
128
+ this.removeBodyEvents(), this.reference.removeEventListener("touchstart", this.referenceTapHandler), this.reference.removeEventListener("mouseover", this.open), this.reference.removeEventListener("focus", this.open), this.reference.removeEventListener("mouseout", this.closeOnLeave), this.reference.removeEventListener("blur", this.closeOnLeave), this.$el.removeEventListener("mouseover", this.open), this.$el.removeEventListener("mouseout", this.closeOnLeave);
96
129
  },
97
130
  removeBodyEvents() {
98
- r(this.bodyTouchHandler);
131
+ i(this.bodyTouchHandler), document.removeEventListener("click", this.outsideHandler), document.removeEventListener("keyup", this.keyupHandler, !0);
99
132
  },
100
133
  setAttributes(e) {
101
134
  Object.keys(e).forEach((t) => {
@@ -1 +1 @@
1
- .tooltip-pane[data-v-d5f691f8],.tooltip-arrow[data-v-d5f691f8]{box-shadow:0 4px 12px #00000014}.tooltip-arrow[data-v-d5f691f8]{margin:.5rem;border-color:rgba(var(--bg-primary),var(--tw-bg-opacity, 1))}.tooltip-pane[x-placement^=top][data-v-d5f691f8]{margin-bottom:.5rem}.tooltip-pane[x-placement^=top] .tooltip-arrow[data-v-d5f691f8]{border-width:8px 8px 0 8px;border-left-color:transparent;border-right-color:transparent;border-bottom-color:transparent;left:calc(50% - 8px);bottom:-.5rem;margin-top:0;margin-bottom:0}.tooltip-pane[x-placement^=bottom][data-v-d5f691f8]{margin-top:.5rem}.tooltip-pane[x-placement^=bottom] .tooltip-arrow[data-v-d5f691f8]{border-width:0 8px 8px 8px;border-left-color:transparent;border-right-color:transparent;border-top-color:transparent;left:calc(50% - 8px);top:-.5rem;margin-bottom:0;margin-top:0}.tooltip-pane[x-placement^=right][data-v-d5f691f8]{margin-left:.5rem}.tooltip-pane[x-placement^=right] .tooltip-arrow[data-v-d5f691f8]{border-width:8px 8px 8px 0;border-left-color:transparent;border-top-color:transparent;border-bottom-color:transparent;top:calc(50% - 8px);left:-.5rem;margin-left:0;margin-right:0}.tooltip-pane[x-placement^=left][data-v-d5f691f8]{margin-right:.5rem}.tooltip-pane[x-placement^=left] .tooltip-arrow[data-v-d5f691f8]{border-width:8px 0 8px 8px;border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;top:calc(50% - 8px);right:-.5rem;margin-left:0;margin-right:0}
1
+ .tooltip-pane[data-v-eed4fc1b],.tooltip-arrow[data-v-eed4fc1b]{box-shadow:0 4px 12px #00000014}.tooltip-arrow[data-v-eed4fc1b]{margin:.5rem}.tooltip-pane--light .tooltip-arrow[data-v-eed4fc1b]{border-color:#fff}.tooltip-pane--dark .tooltip-arrow[data-v-eed4fc1b]{border-color:#212121}.tooltip-pane--dark[data-v-eed4fc1b] .tw-text-link{color:#78c79f}.tooltip-pane--dark[data-v-eed4fc1b] .tw-text-link:hover,.tooltip-pane--dark[data-v-eed4fc1b] .tw-text-link:focus{color:#fff}.tooltip-pane[x-placement^=top][data-v-eed4fc1b]{margin-bottom:.5rem}.tooltip-pane[x-placement^=top] .tooltip-arrow[data-v-eed4fc1b]{border-width:8px 8px 0 8px;border-left-color:transparent;border-right-color:transparent;border-bottom-color:transparent;left:calc(50% - 8px);bottom:-.5rem;margin-top:0;margin-bottom:0}.tooltip-pane[x-placement^=bottom][data-v-eed4fc1b]{margin-top:.5rem}.tooltip-pane[x-placement^=bottom] .tooltip-arrow[data-v-eed4fc1b]{border-width:0 8px 8px 8px;border-left-color:transparent;border-right-color:transparent;border-top-color:transparent;left:calc(50% - 8px);top:-.5rem;margin-bottom:0;margin-top:0}.tooltip-pane[x-placement^=right][data-v-eed4fc1b]{margin-left:.5rem}.tooltip-pane[x-placement^=right] .tooltip-arrow[data-v-eed4fc1b]{border-width:8px 8px 8px 0;border-left-color:transparent;border-top-color:transparent;border-bottom-color:transparent;top:calc(50% - 8px);left:-.5rem;margin-left:0;margin-right:0}.tooltip-pane[x-placement^=left][data-v-eed4fc1b]{margin-right:.5rem}.tooltip-pane[x-placement^=left] .tooltip-arrow[data-v-eed4fc1b]{border-width:8px 0 8px 8px;border-top-color:transparent;border-right-color:transparent;border-bottom-color:transparent;top:calc(50% - 8px);right:-.5rem;margin-left:0;margin-right:0}
@@ -1,52 +1,52 @@
1
1
  import f from "./KvTooltip2.js";
2
- import { resolveComponent as l, openBlock as p, createBlock as v, withCtx as n, createVNode as c, createElementVNode as i, normalizeStyle as w, createElementBlock as _, renderSlot as d, createCommentVNode as u } from "vue";
2
+ import { resolveComponent as c, openBlock as l, createBlock as v, normalizeClass as w, withCtx as u, createElementVNode as i, normalizeStyle as n, createElementBlock as p, renderSlot as s, createCommentVNode as a } from "vue";
3
3
  import "./KvTooltip.css";
4
4
  import k from "../_virtual/_plugin-vue_export-helper.js";
5
5
  const y = {
6
6
  key: 0,
7
- class: "tw-text-primary tw-font-medium tw-mb-1.5"
8
- }, h = { class: "tw-text-primary" };
9
- function b(o, e, r, t, x, V) {
10
- const s = l("kv-popper"), a = l("kv-theme-provider");
11
- return p(), v(a, {
12
- theme: t.themeStyle,
13
- class: "kv-tailwind"
7
+ class: "tw-font-medium tw-mb-1.5"
8
+ };
9
+ function b(e, t, r, o, C, h) {
10
+ const d = c("kv-popper");
11
+ return l(), v(d, {
12
+ ref: "popperRef",
13
+ controller: r.controller,
14
+ "popper-modifiers": o.popperModifiers,
15
+ "popper-placement": r.placement,
16
+ persistent: !!e.$slots.action,
17
+ "transition-type": "kvfastfade",
18
+ class: w(["tooltip-pane tw-absolute tw-rounded tw-z-popover", o.paneClass]),
19
+ onHide: t[0] || (t[0] = (m) => o.handleKvPopperVisibility(!1)),
20
+ onShow: t[1] || (t[1] = (m) => o.handleKvPopperVisibility(!0))
14
21
  }, {
15
- default: n(() => [
16
- c(s, {
17
- ref: "popperRef",
18
- controller: r.controller,
19
- "popper-modifiers": t.popperModifiers,
20
- "popper-placement": r.placement,
21
- "transition-type": "kvfastfade",
22
- class: "tooltip-pane tw-absolute tw-bg-primary tw-rounded tw-z-popover",
23
- onHide: e[0] || (e[0] = (m) => t.handleKvPopperVisibility(!1)),
24
- onShow: e[1] || (e[1] = (m) => t.handleKvPopperVisibility(!0))
25
- }, {
26
- default: n(() => [
27
- i("div", {
28
- class: "tw-p-2.5",
29
- style: w({ maxWidth: r.maxWidth })
30
- }, [
31
- o.$slots.title ? (p(), _("div", y, [
32
- d(o.$slots, "title", {}, void 0, !0)
33
- ])) : u("", !0),
34
- i("div", h, [
35
- d(o.$slots, "default", {}, void 0, !0)
36
- ])
37
- ], 4),
38
- e[2] || (e[2] = i("div", {
39
- class: "tooltip-arrow tw-absolute tw-w-0 tw-h-0 tw-border-solid",
40
- "x-arrow": ""
41
- }, null, -1))
22
+ default: u(() => [
23
+ i("div", {
24
+ class: "tw-p-2.5",
25
+ style: n({ maxWidth: r.maxWidth })
26
+ }, [
27
+ e.$slots.title ? (l(), p("div", y, [
28
+ s(e.$slots, "title", {}, void 0, !0)
29
+ ])) : a("", !0),
30
+ i("div", null, [
31
+ s(e.$slots, "default", {}, void 0, !0)
42
32
  ]),
43
- _: 3
44
- }, 8, ["controller", "popper-modifiers", "popper-placement"])
33
+ e.$slots.action ? (l(), p("div", {
34
+ key: 1,
35
+ class: "tooltip-action tw-mt-1.5",
36
+ style: n(o.defaultTheme)
37
+ }, [
38
+ s(e.$slots, "action", { close: o.dismiss }, void 0, !0)
39
+ ], 4)) : a("", !0)
40
+ ], 4),
41
+ t[2] || (t[2] = i("div", {
42
+ class: "tooltip-arrow tw-absolute tw-w-0 tw-h-0 tw-border-solid",
43
+ "x-arrow": ""
44
+ }, null, -1))
45
45
  ]),
46
46
  _: 3
47
- }, 8, ["theme"]);
47
+ }, 8, ["controller", "popper-modifiers", "popper-placement", "persistent", "class"]);
48
48
  }
49
- const N = /* @__PURE__ */ k(f, [["render", b], ["__scopeId", "data-v-d5f691f8"]]);
49
+ const K = /* @__PURE__ */ k(f, [["render", b], ["__scopeId", "data-v-eed4fc1b"]]);
50
50
  export {
51
- N as default
51
+ K as default
52
52
  };
@@ -1,12 +1,16 @@
1
- import { toRefs as L, computed as i, ref as w, watch as b } from "vue";
2
- import { stoneLightTheme as l, marigoldLightTheme as p, greenDarkTheme as a, greenLightTheme as f, defaultTheme as m } from "@kiva/kv-tokens";
3
- import M from "./KvPopper.js";
4
- import S from "./KvThemeProvider.js";
5
- const K = {
1
+ import { toRefs as y, computed as n, ref as b, watch as E } from "vue";
2
+ import { defaultTheme as T } from "@kiva/kv-tokens";
3
+ import S from "./KvPopper.js";
4
+ const x = ["light", "dark"], p = {
5
+ default: "light",
6
+ ecoGreenLight: "light",
7
+ ecoGreenDark: "dark",
8
+ ecoLightMarigold: "light",
9
+ ecoStoneLight: "light"
10
+ }, L = {
6
11
  name: "KvTooltip",
7
12
  components: {
8
- KvPopper: M,
9
- KvThemeProvider: S
13
+ KvPopper: S
10
14
  },
11
15
  props: {
12
16
  controller: {
@@ -32,63 +36,69 @@ const K = {
32
36
  type: Boolean,
33
37
  default: !1
34
38
  },
39
+ /**
40
+ * Fixed neutral color of the tooltip. Defaults to `light`.
41
+ * Use `dark` over light surfaces and `light` over dark surfaces.
42
+ */
43
+ variant: {
44
+ type: String,
45
+ default: void 0,
46
+ validator(e) {
47
+ return e === void 0 || x.indexOf(e) !== -1;
48
+ }
49
+ },
50
+ /**
51
+ * @deprecated Use `variant` instead. Themed tooltips are being removed:
52
+ * `ecoGreenDark` maps to `dark`, every other value maps to `light`.
53
+ */
35
54
  theme: {
36
55
  type: String,
37
- default: "default",
56
+ default: void 0,
38
57
  validator(e) {
39
- return [
40
- "default",
41
- "ecoGreenLight",
42
- "ecoGreenDark",
43
- "ecoLightMarigold",
44
- "ecoStoneLight"
45
- ].indexOf(e) !== -1;
58
+ return Object.keys(p).indexOf(e) !== -1;
46
59
  }
47
60
  }
48
61
  },
49
- emits: ["tool-tip-visible"],
50
- setup(e, { emit: u }) {
62
+ emits: ["tool-tip-visible", "dismiss"],
63
+ setup(e, { emit: l }) {
51
64
  const {
52
- modifiers: r,
53
- showTooltip: s,
54
- theme: c
55
- } = L(e), d = i(() => ({
56
- ...r.value,
65
+ modifiers: s,
66
+ showTooltip: f,
67
+ theme: a,
68
+ variant: d
69
+ } = y(e), c = n(() => ({
70
+ ...s.value,
57
71
  preventOverflow: {
58
- ...r.value.preventOverflow,
72
+ ...s.value.preventOverflow,
59
73
  padding: 10
60
74
  }
61
- })), h = w(null), g = () => typeof e.controller == "string" ? document.getElementById(e.controller) : e.controller, v = (t) => {
62
- u("tool-tip-visible", t);
63
- }, o = (t = !0) => {
64
- const n = g();
65
- if (n) {
66
- const T = t ? "mouseover" : "mouseout";
67
- n.dispatchEvent(new MouseEvent(T, { bubbles: !0 }));
75
+ })), r = b(null), v = () => typeof e.controller == "string" ? document.getElementById(e.controller) : e.controller, m = (t) => {
76
+ l("tool-tip-visible", t);
77
+ }, g = (t = !0) => {
78
+ const o = v();
79
+ if (o) {
80
+ const i = t ? "mouseover" : "mouseout";
81
+ o.dispatchEvent(new MouseEvent(i, { bubbles: !0 }));
68
82
  }
69
- }, y = i(() => ({
70
- default: m,
71
- ecoGreenLight: f,
72
- ecoGreenDark: a,
73
- ecoLightMarigold: p,
74
- ecoStoneLight: l
75
- })[c.value]);
76
- return b(s, (t) => {
77
- o(!!t);
83
+ }, h = () => {
84
+ var t;
85
+ (t = r.value) == null || t.dismiss(), l("dismiss");
86
+ }, u = n(() => d.value ? d.value : a.value ? p[a.value] : "light"), w = n(() => u.value === "dark" ? "tooltip-pane--dark tw-bg-gray-800 tw-text-white" : "tooltip-pane--light tw-bg-white tw-text-gray-800");
87
+ return E(f, (t) => {
88
+ var o, i;
89
+ t ? (o = r.value) == null || o.open() : (i = r.value) == null || i.dismiss();
78
90
  }), {
79
- defaultTheme: m,
80
- greenLightTheme: f,
81
- greenDarkTheme: a,
82
- marigoldLightTheme: p,
83
- stoneLightTheme: l,
84
- handleKvPopperVisibility: v,
85
- popperModifiers: d,
86
- popperRef: h,
87
- themeStyle: y,
88
- triggerHover: o
91
+ defaultTheme: T,
92
+ dismiss: h,
93
+ handleKvPopperVisibility: m,
94
+ paneClass: w,
95
+ popperModifiers: c,
96
+ popperRef: r,
97
+ resolvedVariant: u,
98
+ triggerHover: g
89
99
  };
90
100
  }
91
101
  };
92
102
  export {
93
- K as default
103
+ L as default
94
104
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "9.1.1",
3
+ "version": "9.2.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -112,5 +112,5 @@
112
112
  "dependencies": {
113
113
  "fuse.js": "^7.1.0"
114
114
  },
115
- "gitHead": "b8e2d2c7bb4a12f0151226fea982f696ab77856b"
115
+ "gitHead": "2404a1d7fe3ab1021c8080cafb05a7952b40a3c5"
116
116
  }