bitboss-ui 2.1.123 → 2.1.125

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index343.js CHANGED
@@ -6,12 +6,12 @@ import { extractDomContainer as i } from "./index45.js";
6
6
  import { useUntil as a } from "./index50.js";
7
7
  import o from "./index60.js";
8
8
  import { parseWidthString as s } from "./index231.js";
9
- import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createVNode as m, defineComponent as h, mergeModels as g, mergeProps as _, normalizeProps as v, normalizeStyle as y, onBeforeUnmount as b, openBlock as x, ref as S, renderSlot as C, unref as w, useModel as T, useTemplateRef as E, watch as D, withCtx as O } from "vue";
9
+ import { Comment as c, Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createTextVNode as ee, createVNode as h, defineComponent as g, mergeModels as _, mergeProps as v, normalizeProps as y, normalizeStyle as te, onBeforeUnmount as ne, onMounted as b, openBlock as x, ref as S, renderSlot as C, toDisplayString as w, unref as re, useModel as ie, useSlots as T, useTemplateRef as E, watch as D, withCtx as O } from "vue";
10
10
  //#region src/components/BbTooltip/BbTooltip.vue?vue&type=script&setup=true&lang.ts
11
- var k = /* @__PURE__ */ h({
11
+ var k = /* @__PURE__ */ g({
12
12
  inheritAttrs: !1,
13
13
  __name: "BbTooltip",
14
- props: /* @__PURE__ */ g({
14
+ props: /* @__PURE__ */ _({
15
15
  arrowPadding: { default: 10 },
16
16
  block: { type: Boolean },
17
17
  disabled: { type: Boolean },
@@ -23,6 +23,7 @@ var k = /* @__PURE__ */ h({
23
23
  type: Boolean,
24
24
  default: !0
25
25
  },
26
+ text: {},
26
27
  theme: { default: "default" },
27
28
  transitionDuration: { default: 250 },
28
29
  activator: {},
@@ -37,104 +38,130 @@ var k = /* @__PURE__ */ h({
37
38
  modelModifiers: {}
38
39
  }),
39
40
  emits: ["update:modelValue"],
40
- setup(h) {
41
- let g = h, { t: k } = r(), A = `bb_${g.id ?? e().id.value}`, j = S(), M = l(() => g.activator != null), N = E("popover"), P = l(() => i(N.value)), F = S(!0), I = T(h, "modelValue"), L = a(I), R = (e) => {
41
+ setup(g) {
42
+ let _ = g, k = T(), { t: A } = r(), j = `bb_${_.id ?? e().id.value}`, M = `${j}_desc`, N = (e) => {
43
+ if (!e) return "";
44
+ let t = "";
45
+ for (let n of e) {
46
+ if (n.type === c) continue;
47
+ let e = n.children;
48
+ typeof e == "string" ? t += e : Array.isArray(e) && (t += N(e));
49
+ }
50
+ return t;
51
+ }, P = S(!1), F = u(() => (_.text ?? (P.value ? N(k.default?.({})) : "")).replace(/\s+/g, " ").trim()), I = S(), L = u(() => _.activator != null), R = E("popover"), z = u(() => i(R.value)), B = S(!0), V = ie(g, "modelValue"), H = a(V), U = (e) => {
42
52
  let t = i(e);
43
- t && (j.value = t);
44
- }, z, B, V = () => {
45
- clearTimeout(B);
46
- }, H = () => {
47
- clearTimeout(z), clearTimeout(B), document.removeEventListener("keydown", G), I.value = !1;
48
- }, U = () => {
49
- clearTimeout(z), clearTimeout(B), B = setTimeout(H, 50);
50
- }, W = () => {
51
- V(), !(I.value || g.disabled || !F.value) && (z = setTimeout(() => {
52
- I.value = !0, document.addEventListener("keydown", G, { passive: !0 });
53
- }, g.timeout));
54
- }, G = (e) => {
55
- e.key === "Escape" && H();
56
- }, K = () => {
57
- F.value = !1, H();
53
+ t && (I.value = t);
54
+ }, W, G, K = () => {
55
+ clearTimeout(G);
56
+ }, q = () => {
57
+ clearTimeout(W), clearTimeout(G), document.removeEventListener("keydown", X), V.value = !1;
58
+ }, J = () => {
59
+ clearTimeout(W), clearTimeout(G), G = setTimeout(q, 50);
60
+ }, Y = () => {
61
+ K(), !(V.value || _.disabled || !B.value) && (W = setTimeout(() => {
62
+ V.value = !0, document.addEventListener("keydown", X, { passive: !0 });
63
+ }, _.timeout));
64
+ }, X = (e) => {
65
+ e.key === "Escape" && q();
66
+ }, ae = () => {
67
+ B.value = !1, q();
58
68
  };
59
- D(() => g.activator, (e) => {
60
- e && R(e);
69
+ D(() => _.activator, (e) => {
70
+ e && U(e);
61
71
  }, { immediate: !0 });
62
- let q = null;
63
- D(j, (e) => {
64
- q &&= (q(), null), e && (e.addEventListener("mouseenter", W, { passive: !0 }), e.addEventListener("mouseleave", U, { passive: !0 }), e.addEventListener("focus", W, { passive: !0 }), e.addEventListener("blur", H, { passive: !0 }), q = () => {
65
- e.removeEventListener("mouseenter", W), e.removeEventListener("mouseleave", U), e.removeEventListener("focus", W), e.removeEventListener("blur", H);
72
+ let Z = null;
73
+ D(I, (e) => {
74
+ Z &&= (Z(), null), e && (e.addEventListener("mouseenter", Y, { passive: !0 }), e.addEventListener("mouseleave", J, { passive: !0 }), e.addEventListener("focus", Y, { passive: !0 }), e.addEventListener("blur", q, { passive: !0 }), Z = () => {
75
+ e.removeEventListener("mouseenter", Y), e.removeEventListener("mouseleave", J), e.removeEventListener("focus", Y), e.removeEventListener("blur", q);
66
76
  });
67
77
  }, { immediate: !0 });
68
- let J = null;
69
- D(P, (e) => {
70
- J &&= (J(), null), e && (e.addEventListener("mouseenter", V, { passive: !0 }), e.addEventListener("mouseleave", U, { passive: !0 }), J = () => {
71
- e.removeEventListener("mouseenter", V), e.removeEventListener("mouseleave", U);
78
+ let Q = null;
79
+ D(z, (e) => {
80
+ Q &&= (Q(), null), e && (e.addEventListener("mouseenter", K, { passive: !0 }), e.addEventListener("mouseleave", J, { passive: !0 }), Q = () => {
81
+ e.removeEventListener("mouseenter", K), e.removeEventListener("mouseleave", J);
72
82
  });
73
- }, { immediate: !0 }), D([j, L], ([e, t]) => {
74
- e && t && e.setAttribute("aria-describedby", A);
75
- }, { immediate: !0 }), b(() => {
76
- q?.(), J?.(), j.value && j.value.removeAttribute("aria-describedby"), H();
83
+ }, { immediate: !0 });
84
+ let $ = () => {
85
+ let e = I.value;
86
+ e && (F.value ? e.setAttribute("aria-describedby", M) : H.value && e.setAttribute("aria-describedby", j));
87
+ };
88
+ b(() => {
89
+ $(), P.value = !0;
90
+ }), D([
91
+ I,
92
+ H,
93
+ F
94
+ ], $, { flush: "post" }), ne(() => {
95
+ Z?.(), Q?.(), I.value && I.value.removeAttribute("aria-describedby"), q();
77
96
  });
78
- let { width: Y } = t(j, {
97
+ let { width: oe } = t(I, {
79
98
  width: 0,
80
99
  height: 0
81
- }, { box: "border-box" }), X = l(() => {
82
- if (g.width) {
83
- let { value: e, unit: t } = s(g.width);
84
- return t === "%" ? j.value ? `${Y.value * (e / 100)}px` : "0px" : `${e}px`;
100
+ }, { box: "border-box" }), se = u(() => {
101
+ if (_.width) {
102
+ let { value: e, unit: t } = s(_.width);
103
+ return t === "%" ? I.value ? `${oe.value * (e / 100)}px` : "0px" : `${e}px`;
85
104
  }
86
105
  });
87
- return (e, t) => (x(), f(c, null, [M.value ? d("", !0) : C(e.$slots, "activator", v(_({ key: 0 }, {
88
- props: { ref: R },
89
- disabled: e.disabled,
90
- open: I.value,
91
- placement: e.placement
92
- }))), m(o, _({
93
- ref: "popover",
94
- modelValue: I.value,
95
- "onUpdate:modelValue": t[0] ||= (e) => I.value = e,
96
- anchor: j.value,
97
- "arrow-padding": e.arrowPadding,
98
- boundary: e.boundary,
99
- class: ["bb-tooltip", { [`bb-tooltip--${e.theme}`]: !0 }],
100
- padding: e.padding,
101
- placement: e.placement,
102
- "transition-duration": e.transitionDuration
103
- }, e.$attrs), {
104
- default: O(() => [p("span", {
105
- id: A,
106
- class: "bb-tooltip__content",
107
- style: y({ width: X.value })
108
- }, [e.showClose ? (x(), u(n, {
106
+ return (e, t) => (x(), p(l, null, [
107
+ F.value ? (x(), p("span", {
109
108
  key: 0,
110
- "aria-label": w(k)("common.closeLabel").value,
111
- class: "bb-tooltip__close",
112
- tabindex: "-1",
113
- onClick: K
114
- }, {
115
- default: O(() => t[1] ||= [p("svg", {
116
- fill: "none",
117
- viewBox: "0 0 24 24",
118
- xmlns: "http://www.w3.org/2000/svg"
119
- }, [p("path", {
120
- d: "M23 23L1 1M23 1L1 23",
121
- stroke: "currentColor",
122
- "stroke-linecap": "round",
123
- "stroke-width": "2"
124
- })], -1)]),
125
- _: 1
126
- }, 8, ["aria-label"])) : d("", !0), C(e.$slots, "default")], 4)]),
127
- _: 3
128
- }, 16, [
129
- "modelValue",
130
- "anchor",
131
- "arrow-padding",
132
- "boundary",
133
- "class",
134
- "padding",
135
- "placement",
136
- "transition-duration"
137
- ])], 64));
109
+ id: M,
110
+ class: "sr-only"
111
+ }, w(F.value), 1)) : f("", !0),
112
+ L.value ? f("", !0) : C(e.$slots, "activator", y(v({ key: 1 }, {
113
+ props: { ref: U },
114
+ disabled: e.disabled,
115
+ open: V.value,
116
+ placement: e.placement
117
+ }))),
118
+ h(o, v({
119
+ ref: "popover",
120
+ modelValue: V.value,
121
+ "onUpdate:modelValue": t[0] ||= (e) => V.value = e,
122
+ anchor: I.value,
123
+ "arrow-padding": e.arrowPadding,
124
+ boundary: e.boundary,
125
+ class: ["bb-tooltip", { [`bb-tooltip--${e.theme}`]: !0 }],
126
+ padding: e.padding,
127
+ placement: e.placement,
128
+ "transition-duration": e.transitionDuration
129
+ }, e.$attrs), {
130
+ default: O(() => [m("span", {
131
+ id: j,
132
+ class: "bb-tooltip__content",
133
+ style: te({ width: se.value })
134
+ }, [e.showClose ? (x(), d(n, {
135
+ key: 0,
136
+ "aria-label": re(A)("common.closeLabel").value,
137
+ class: "bb-tooltip__close",
138
+ tabindex: "-1",
139
+ onClick: ae
140
+ }, {
141
+ default: O(() => t[1] ||= [m("svg", {
142
+ fill: "none",
143
+ viewBox: "0 0 24 24",
144
+ xmlns: "http://www.w3.org/2000/svg"
145
+ }, [m("path", {
146
+ d: "M23 23L1 1M23 1L1 23",
147
+ stroke: "currentColor",
148
+ "stroke-linecap": "round",
149
+ "stroke-width": "2"
150
+ })], -1)]),
151
+ _: 1
152
+ }, 8, ["aria-label"])) : f("", !0), C(e.$slots, "default", {}, () => [ee(w(e.text), 1)])], 4)]),
153
+ _: 3
154
+ }, 16, [
155
+ "modelValue",
156
+ "anchor",
157
+ "arrow-padding",
158
+ "boundary",
159
+ "class",
160
+ "padding",
161
+ "placement",
162
+ "transition-duration"
163
+ ])
164
+ ], 64));
138
165
  }
139
166
  });
140
167
  //#endregion