bj-web-components 0.2.12 → 0.2.14
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/README.md +38 -0
- package/dist/index.d.ts +585 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +45 -26
- package/dist/style.css +1 -1
- package/dist/web/BasicInput/BInput.js +1 -0
- package/dist/web/BasicInput/BInput.mjs +177 -0
- package/dist/web/BasicInput/utils.js +1 -0
- package/dist/web/BasicInput/utils.mjs +37 -0
- package/dist/web/CheckBox/BCheckBox.js +1 -0
- package/dist/web/CheckBox/BCheckBox.mjs +101 -0
- package/dist/web/CheckBox/Group.js +1 -0
- package/dist/web/CheckBox/Group.mjs +67 -0
- package/dist/web/CheckBox/context.js +1 -0
- package/dist/web/CheckBox/context.mjs +5 -0
- package/dist/web/CheckBox/index.js +1 -0
- package/dist/web/CheckBox/index.mjs +8 -0
- package/dist/web/Dropdown/BDropdown.js +1 -0
- package/dist/web/Dropdown/BDropdown.mjs +160 -0
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.js +1 -0
- package/dist/web/OverlayScrollbar/BOverlayScrollbar.mjs +152 -0
- package/dist/web/Pagination/Pagination.js +1 -1
- package/dist/web/Pagination/Pagination.mjs +1 -1
- package/dist/web/ProductField/ProductField.mjs +12 -12
- package/dist/web/SkuInputCard/SkuInputCard.mjs +26 -26
- package/dist/web/Table/BTable.js +1 -0
- package/dist/web/Table/BTable.mjs +612 -0
- package/dist/web/Table/Column.js +1 -0
- package/dist/web/Table/Column.mjs +6 -0
- package/dist/web/Table/ColumnGroup.js +1 -0
- package/dist/web/Table/ColumnGroup.mjs +6 -0
- package/dist/web/Table/utils/columns.js +1 -0
- package/dist/web/Table/utils/columns.mjs +43 -0
- package/dist/web/Table/utils/sortFilter.js +1 -0
- package/dist/web/Table/utils/sortFilter.mjs +63 -0
- package/dist/web/Tabs/BTabs.js +1 -0
- package/dist/web/Tabs/BTabs.mjs +130 -0
- package/dist/web/Tabs/TabPane.js +1 -0
- package/dist/web/Tabs/TabPane.mjs +7 -0
- package/dist/web/Tooltip/ContentTooltip.js +1 -1
- package/dist/web/Tooltip/ContentTooltip.mjs +56 -20
- package/dist/web.d.ts +585 -4
- package/dist/web.js +1 -1
- package/dist/web.mjs +45 -26
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function a(t,n){return t.key!==void 0&&t.key!==null?t.key:t.dataIndex!==void 0?Array.isArray(t.dataIndex)?t.dataIndex.join("."):t.dataIndex:n}function x(t,n){return typeof t=="function"?t(n):t}function S(t,n=["ascend","descend",null]){const o=n.indexOf(t),i=n[o+1];return i===void 0?n[0]??null:i}function l(t){if(typeof t.sorter=="function")return t.sorter;if(t.sorter&&typeof t.sorter=="object")return t.sorter.compare}function g(t){return t.sorter&&typeof t.sorter=="object"?t.sorter.multiple??0:0}function p(t,n,o,i="children"){const f=n.map((e,r)=>({column:e,key:a(e,r)})).filter(({column:e,key:r})=>!("children"in e)&&l(e)&&o.get(r)).sort((e,r)=>g(r.column)-g(e.column));return f.length===0?[...t]:[...t].sort((e,r)=>{for(const{column:s,key:c}of f){const u=o.get(c),d=l(s);if(u&&d){const y=d(e,r,u);if(y!==0)return u==="ascend"?y:-y}}return 0}).map(e=>{const r=e[i];return Array.isArray(r)?{...e,[i]:p(r,n,o,i)}:e})}function k(t,n,o){return n.reduce((i,f,e)=>{const r=f,s=o.get(a(r,e));return!r.onFilter||!(s!=null&&s.length)?i:i.filter(c=>s.some(u=>{var d;return(d=r.onFilter)==null?void 0:d.call(r,u,c)}))},[...t])}function v(t,n){const o=t.flatMap((i,f)=>{const e=i,r=a(e,f),s=n.get(r);return s?[{column:e,order:s,field:e.dataIndex,columnKey:r}]:[]});return o.length<=1?o[0]??{}:o}exports.filterRecords=k;exports.getColumnKey=a;exports.getNextSortOrder=S;exports.getSorterResult=v;exports.renderColumnTitle=x;exports.sortRecords=p;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
function y(t, n) {
|
|
2
|
+
return t.key !== void 0 && t.key !== null ? t.key : t.dataIndex !== void 0 ? Array.isArray(t.dataIndex) ? t.dataIndex.join(".") : t.dataIndex : n;
|
|
3
|
+
}
|
|
4
|
+
function x(t, n) {
|
|
5
|
+
return typeof t == "function" ? t(n) : t;
|
|
6
|
+
}
|
|
7
|
+
function k(t, n = ["ascend", "descend", null]) {
|
|
8
|
+
const o = n.indexOf(t), i = n[o + 1];
|
|
9
|
+
return i === void 0 ? n[0] ?? null : i;
|
|
10
|
+
}
|
|
11
|
+
function p(t) {
|
|
12
|
+
if (typeof t.sorter == "function")
|
|
13
|
+
return t.sorter;
|
|
14
|
+
if (t.sorter && typeof t.sorter == "object")
|
|
15
|
+
return t.sorter.compare;
|
|
16
|
+
}
|
|
17
|
+
function g(t) {
|
|
18
|
+
return t.sorter && typeof t.sorter == "object" ? t.sorter.multiple ?? 0 : 0;
|
|
19
|
+
}
|
|
20
|
+
function l(t, n, o, i = "children") {
|
|
21
|
+
const s = n.map((r, e) => ({
|
|
22
|
+
column: r,
|
|
23
|
+
key: y(r, e)
|
|
24
|
+
})).filter(({ column: r, key: e }) => !("children" in r) && p(r) && o.get(e)).sort((r, e) => g(e.column) - g(r.column));
|
|
25
|
+
return s.length === 0 ? [...t] : [...t].sort((r, e) => {
|
|
26
|
+
for (const { column: f, key: d } of s) {
|
|
27
|
+
const u = o.get(d), a = p(f);
|
|
28
|
+
if (u && a) {
|
|
29
|
+
const c = a(r, e, u);
|
|
30
|
+
if (c !== 0)
|
|
31
|
+
return u === "ascend" ? c : -c;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return 0;
|
|
35
|
+
}).map((r) => {
|
|
36
|
+
const e = r[i];
|
|
37
|
+
return Array.isArray(e) ? { ...r, [i]: l(e, n, o, i) } : r;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function I(t, n, o) {
|
|
41
|
+
return n.reduce((i, s, r) => {
|
|
42
|
+
const e = s, f = o.get(y(e, r));
|
|
43
|
+
return !e.onFilter || !(f != null && f.length) ? i : i.filter((d) => f.some((u) => {
|
|
44
|
+
var a;
|
|
45
|
+
return (a = e.onFilter) == null ? void 0 : a.call(e, u, d);
|
|
46
|
+
}));
|
|
47
|
+
}, [...t]);
|
|
48
|
+
}
|
|
49
|
+
function v(t, n) {
|
|
50
|
+
const o = t.flatMap((i, s) => {
|
|
51
|
+
const r = i, e = y(r, s), f = n.get(e);
|
|
52
|
+
return f ? [{ column: r, order: f, field: r.dataIndex, columnKey: e }] : [];
|
|
53
|
+
});
|
|
54
|
+
return o.length <= 1 ? o[0] ?? {} : o;
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
I as filterRecords,
|
|
58
|
+
y as getColumnKey,
|
|
59
|
+
k as getNextSortOrder,
|
|
60
|
+
v as getSorterResult,
|
|
61
|
+
x as renderColumnTitle,
|
|
62
|
+
l as sortRecords
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),c=require("react"),M=require("./TabPane.js");;/* empty css */function I(...s){return s.filter(Boolean).join(" ")}function P(s,n){const[t,a]=c.useState(s);return[n===void 0?t:n,a]}function D(s,n){return c.useMemo(()=>s?s.filter(t=>!!(t&&typeof t=="object"&&"key"in t)):c.Children.toArray(n).flatMap(t=>{if(!c.isValidElement(t))return[];const{tab:a,tabKey:b,...y}=t.props,i=b??t.key;return i===null?[]:[{...y,key:String(i),label:a}]}),[n,s])}function E({active:s,id:n,item:t,onClick:a,onKeyDown:b,tabCount:y,tabIndex:i}){return r.jsxs("button",{"aria-controls":`${n}-panel-${t.key}`,"aria-disabled":t.disabled,"aria-selected":s,className:I("bj-tabs__tab",s&&"bj-tabs__tab--active",t.disabled&&"bj-tabs__tab--disabled"),disabled:t.disabled,id:`${n}-tab-${t.key}`,onClick:a,onKeyDown:b,role:"tab",tabIndex:t.disabled?-1:s?0:-1,type:"button",children:[r.jsx("span",{className:"bj-tabs__tab-btn",children:t.label}),r.jsx("span",{className:"bj-tabs__sr-only",children:`Tab ${i+1} of ${y}`})]})}function L({activeKey:s,id:n,items:t}){return r.jsx("div",{className:"bj-tabs__content-holder",children:r.jsx("div",{className:"bj-tabs__content",children:t.map(a=>{const b=a.key===s;return!b&&!a.forceRender?null:r.jsx("div",{"aria-hidden":!b,"aria-labelledby":`${n}-tab-${a.key}`,className:I("bj-tabs__tabpane",b&&"bj-tabs__tabpane--active",a.className),id:`${n}-panel-${a.key}`,role:"tabpanel",style:a.style,tabIndex:b?0:-1,children:a.children},a.key)})})})}function m({activeKey:s,children:n,centered:t,className:a,defaultActiveKey:b,id:y,items:i,onChange:f,onTabClick:_,style:w,tabBarGutter:F,tabBarStyle:S,tabPosition:x="top",type:K="line"}){const l=D(i,n),B=c.useRef(`bj-tabs-${Math.random().toString(36).slice(2,10)}`),p=y??B.current,[o,v]=P(()=>{var e;return b??((e=l[0])==null?void 0:e.key)},s),[$,R]=c.useState(()=>l.findIndex(e=>e.key===o));c.useEffect(()=>{var d;let e=l.findIndex(u=>u.key===o);e===-1&&(e=Math.max(0,Math.min($,l.length-1)),v((d=l[e])==null?void 0:d.key)),R(e)},[$,o,v,l]);const T=(e,d)=>{_==null||_(e,d),e!==o&&(v(e),f==null||f(e))},V=(e,d)=>{var N;const g=x==="left"||x==="right"?e.key==="ArrowDown"?1:e.key==="ArrowUp"?-1:0:e.key==="ArrowRight"?1:e.key==="ArrowLeft"?-1:0;if(!g)return;e.preventDefault();const j=l.filter(h=>!h.disabled),q=j.findIndex(h=>{var A;return h.key===((A=l[d])==null?void 0:A.key)}),k=j[(q+g+j.length)%j.length];(N=document.getElementById(`${p}-tab-${k==null?void 0:k.key}`))==null||N.focus()};return r.jsxs("div",{className:I("bj-tabs",`bj-tabs--${x}`,`bj-tabs--${K}`,t&&"bj-tabs--centered",a),style:w,children:[r.jsx("div",{className:"bj-tabs__nav",role:"tablist",style:S,children:r.jsx("div",{className:"bj-tabs__nav-wrap",children:r.jsx("div",{className:"bj-tabs__nav-list",children:l.map((e,d)=>r.jsx(E,{active:e.key===o,id:p,item:e,onClick:u=>T(e.key,u),onKeyDown:u=>V(u,d),tabCount:l.length,tabIndex:d},e.key))})})}),r.jsx(L,{activeKey:o,id:p,items:l})]})}m.TabPane=M;exports.TabPane=M;exports.default=m;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsxs as g, jsx as b } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as E, useState as A, useEffect as L, useMemo as T, Children as P, isValidElement as F } from "react";
|
|
3
|
+
import G from "./TabPane.mjs";
|
|
4
|
+
/* empty css */
|
|
5
|
+
function I(...n) {
|
|
6
|
+
return n.filter(Boolean).join(" ");
|
|
7
|
+
}
|
|
8
|
+
function U(n, s) {
|
|
9
|
+
const [t, a] = A(n);
|
|
10
|
+
return [s === void 0 ? t : s, a];
|
|
11
|
+
}
|
|
12
|
+
function q(n, s) {
|
|
13
|
+
return T(() => n ? n.filter((t) => !!(t && typeof t == "object" && "key" in t)) : P.toArray(s).flatMap((t) => {
|
|
14
|
+
if (!F(t)) return [];
|
|
15
|
+
const { tab: a, tabKey: l, ...u } = t.props, c = l ?? t.key;
|
|
16
|
+
return c === null ? [] : [{ ...u, key: String(c), label: a }];
|
|
17
|
+
}), [s, n]);
|
|
18
|
+
}
|
|
19
|
+
function z({
|
|
20
|
+
active: n,
|
|
21
|
+
id: s,
|
|
22
|
+
item: t,
|
|
23
|
+
onClick: a,
|
|
24
|
+
onKeyDown: l,
|
|
25
|
+
tabCount: u,
|
|
26
|
+
tabIndex: c
|
|
27
|
+
}) {
|
|
28
|
+
return /* @__PURE__ */ g(
|
|
29
|
+
"button",
|
|
30
|
+
{
|
|
31
|
+
"aria-controls": `${s}-panel-${t.key}`,
|
|
32
|
+
"aria-disabled": t.disabled,
|
|
33
|
+
"aria-selected": n,
|
|
34
|
+
className: I("bj-tabs__tab", n && "bj-tabs__tab--active", t.disabled && "bj-tabs__tab--disabled"),
|
|
35
|
+
disabled: t.disabled,
|
|
36
|
+
id: `${s}-tab-${t.key}`,
|
|
37
|
+
onClick: a,
|
|
38
|
+
onKeyDown: l,
|
|
39
|
+
role: "tab",
|
|
40
|
+
tabIndex: t.disabled ? -1 : n ? 0 : -1,
|
|
41
|
+
type: "button",
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ b("span", { className: "bj-tabs__tab-btn", children: t.label }),
|
|
44
|
+
/* @__PURE__ */ b("span", { className: "bj-tabs__sr-only", children: `Tab ${c + 1} of ${u}` })
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
function H({ activeKey: n, id: s, items: t }) {
|
|
50
|
+
return /* @__PURE__ */ b("div", { className: "bj-tabs__content-holder", children: /* @__PURE__ */ b("div", { className: "bj-tabs__content", children: t.map((a) => {
|
|
51
|
+
const l = a.key === n;
|
|
52
|
+
return !l && !a.forceRender ? null : /* @__PURE__ */ b(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
"aria-hidden": !l,
|
|
56
|
+
"aria-labelledby": `${s}-tab-${a.key}`,
|
|
57
|
+
className: I("bj-tabs__tabpane", l && "bj-tabs__tabpane--active", a.className),
|
|
58
|
+
id: `${s}-panel-${a.key}`,
|
|
59
|
+
role: "tabpanel",
|
|
60
|
+
style: a.style,
|
|
61
|
+
tabIndex: l ? 0 : -1,
|
|
62
|
+
children: a.children
|
|
63
|
+
},
|
|
64
|
+
a.key
|
|
65
|
+
);
|
|
66
|
+
}) }) });
|
|
67
|
+
}
|
|
68
|
+
function J({
|
|
69
|
+
activeKey: n,
|
|
70
|
+
children: s,
|
|
71
|
+
centered: t,
|
|
72
|
+
className: a,
|
|
73
|
+
defaultActiveKey: l,
|
|
74
|
+
id: u,
|
|
75
|
+
items: c,
|
|
76
|
+
onChange: f,
|
|
77
|
+
onTabClick: p,
|
|
78
|
+
style: w,
|
|
79
|
+
tabBarGutter: O,
|
|
80
|
+
tabBarStyle: M,
|
|
81
|
+
tabPosition: _ = "top",
|
|
82
|
+
type: K = "line"
|
|
83
|
+
}) {
|
|
84
|
+
const r = q(c, s), B = E(`bj-tabs-${Math.random().toString(36).slice(2, 10)}`), j = u ?? B.current, [o, k] = U(
|
|
85
|
+
() => {
|
|
86
|
+
var e;
|
|
87
|
+
return l ?? ((e = r[0]) == null ? void 0 : e.key);
|
|
88
|
+
},
|
|
89
|
+
n
|
|
90
|
+
), [$, V] = A(() => r.findIndex((e) => e.key === o));
|
|
91
|
+
L(() => {
|
|
92
|
+
var d;
|
|
93
|
+
let e = r.findIndex((i) => i.key === o);
|
|
94
|
+
e === -1 && (e = Math.max(0, Math.min($, r.length - 1)), k((d = r[e]) == null ? void 0 : d.key)), V(e);
|
|
95
|
+
}, [$, o, k, r]);
|
|
96
|
+
const R = (e, d) => {
|
|
97
|
+
p == null || p(e, d), e !== o && (k(e), f == null || f(e));
|
|
98
|
+
}, S = (e, d) => {
|
|
99
|
+
var m;
|
|
100
|
+
const x = _ === "left" || _ === "right" ? e.key === "ArrowDown" ? 1 : e.key === "ArrowUp" ? -1 : 0 : e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0;
|
|
101
|
+
if (!x) return;
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
const y = r.filter((h) => !h.disabled), D = y.findIndex((h) => {
|
|
104
|
+
var N;
|
|
105
|
+
return h.key === ((N = r[d]) == null ? void 0 : N.key);
|
|
106
|
+
}), v = y[(D + x + y.length) % y.length];
|
|
107
|
+
(m = document.getElementById(`${j}-tab-${v == null ? void 0 : v.key}`)) == null || m.focus();
|
|
108
|
+
};
|
|
109
|
+
return /* @__PURE__ */ g("div", { className: I("bj-tabs", `bj-tabs--${_}`, `bj-tabs--${K}`, t && "bj-tabs--centered", a), style: w, children: [
|
|
110
|
+
/* @__PURE__ */ b("div", { className: "bj-tabs__nav", role: "tablist", style: M, children: /* @__PURE__ */ b("div", { className: "bj-tabs__nav-wrap", children: /* @__PURE__ */ b("div", { className: "bj-tabs__nav-list", children: r.map((e, d) => /* @__PURE__ */ b(
|
|
111
|
+
z,
|
|
112
|
+
{
|
|
113
|
+
active: e.key === o,
|
|
114
|
+
id: j,
|
|
115
|
+
item: e,
|
|
116
|
+
onClick: (i) => R(e.key, i),
|
|
117
|
+
onKeyDown: (i) => S(i, d),
|
|
118
|
+
tabCount: r.length,
|
|
119
|
+
tabIndex: d
|
|
120
|
+
},
|
|
121
|
+
e.key
|
|
122
|
+
)) }) }) }),
|
|
123
|
+
/* @__PURE__ */ b(H, { activeKey: o, id: j, items: r })
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
J.TabPane = G;
|
|
127
|
+
export {
|
|
128
|
+
G as TabPane,
|
|
129
|
+
J as default
|
|
130
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function a(e){return null}a.displayName="BTabs.TabPane";module.exports=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),a=require("react"),q=require("react-dom");;/* empty css */const R=require("./useAutoPlacement.js");function B({placement:v="top",content:p="这里是提示内容,可以包含更多详细信息。",variant:c="default",className:N,style:w,getPopupContainer:o,getAnchorElement:s,color:e,fontColor:r}){const[u,d]=R.useAutoPlacement(v),i=a.useRef(null),[f,S]=a.useState(),x=["tooltip-popup","tooltip-popup--content",`tooltip-popup--${u}`,c!=="default"?`tooltip-popup--${c}`:"",N].filter(Boolean).join(" "),m=["tooltip-arrow",`tooltip-arrow--${u}`,c==="tinted"?"tooltip-arrow--tinted-bg":""].filter(Boolean).join(" "),y={...w,...e?{backgroundColor:e}:{},...r?{color:r}:{}},j=e?{backgroundColor:e,borderColor:e}:void 0,b=r?{color:r}:void 0,h=t.jsxs("div",{ref:d,className:x,style:y,children:[t.jsx("div",{className:m,style:j}),t.jsx("div",{className:"bu-tooltip-content__text",style:b,children:p})]});if(a.useLayoutEffect(()=>{if(!o||!i.current)return;const l=(s==null?void 0:s())??i.current.parentElement;if(!l)return;const n=l.getBoundingClientRect();S({position:"fixed",left:n.left+n.width/2,top:n.top,right:"auto",bottom:"auto",transform:"translate(-50%, calc(-100% - 16px))"})},[s,o]),o&&typeof document<"u"){const l=o();return t.jsxs(t.Fragment,{children:[t.jsx("span",{ref:i,className:"tooltip-portal-anchor"}),f&&q.createPortal(t.jsxs("div",{ref:d,className:x,style:{...y,...f},children:[t.jsx("div",{className:m,style:j}),t.jsx("div",{className:"bu-tooltip-content__text",style:b,children:p})]}),l)]})}return h}module.exports=B;
|
|
@@ -1,29 +1,65 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
1
|
+
import { jsxs as c, Fragment as B, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as R, useState as _, useLayoutEffect as $ } from "react";
|
|
3
|
+
import { createPortal as k } from "react-dom";
|
|
2
4
|
/* empty css */
|
|
3
|
-
import { useAutoPlacement as
|
|
4
|
-
function
|
|
5
|
-
placement:
|
|
6
|
-
content:
|
|
7
|
-
variant:
|
|
8
|
-
className:
|
|
9
|
-
style:
|
|
5
|
+
import { useAutoPlacement as P } from "./useAutoPlacement.mjs";
|
|
6
|
+
function z({
|
|
7
|
+
placement: N = "top",
|
|
8
|
+
content: n = "这里是提示内容,可以包含更多详细信息。",
|
|
9
|
+
variant: i = "default",
|
|
10
|
+
className: w,
|
|
11
|
+
style: S,
|
|
12
|
+
getPopupContainer: e,
|
|
13
|
+
getAnchorElement: r,
|
|
14
|
+
color: t,
|
|
15
|
+
fontColor: l
|
|
10
16
|
}) {
|
|
11
|
-
const [
|
|
17
|
+
const [u, d] = P(N), p = R(null), [f, h] = _(), m = [
|
|
12
18
|
"tooltip-popup",
|
|
13
19
|
"tooltip-popup--content",
|
|
14
|
-
`tooltip-popup--${
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
].filter(Boolean).join(" "),
|
|
20
|
+
`tooltip-popup--${u}`,
|
|
21
|
+
i !== "default" ? `tooltip-popup--${i}` : "",
|
|
22
|
+
w
|
|
23
|
+
].filter(Boolean).join(" "), y = [
|
|
18
24
|
"tooltip-arrow",
|
|
19
|
-
`tooltip-arrow--${
|
|
20
|
-
|
|
21
|
-
].filter(Boolean).join(" ")
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
`tooltip-arrow--${u}`,
|
|
26
|
+
i === "tinted" ? "tooltip-arrow--tinted-bg" : ""
|
|
27
|
+
].filter(Boolean).join(" "), b = {
|
|
28
|
+
...S,
|
|
29
|
+
...t ? { backgroundColor: t } : {},
|
|
30
|
+
...l ? { color: l } : {}
|
|
31
|
+
}, v = t ? { backgroundColor: t, borderColor: t } : void 0, x = l ? { color: l } : void 0, j = /* @__PURE__ */ c("div", { ref: d, className: m, style: b, children: [
|
|
32
|
+
/* @__PURE__ */ o("div", { className: y, style: v }),
|
|
33
|
+
/* @__PURE__ */ o("div", { className: "bu-tooltip-content__text", style: x, children: n })
|
|
25
34
|
] });
|
|
35
|
+
if ($(() => {
|
|
36
|
+
if (!e || !p.current) return;
|
|
37
|
+
const s = (r == null ? void 0 : r()) ?? p.current.parentElement;
|
|
38
|
+
if (!s) return;
|
|
39
|
+
const a = s.getBoundingClientRect();
|
|
40
|
+
h({
|
|
41
|
+
position: "fixed",
|
|
42
|
+
left: a.left + a.width / 2,
|
|
43
|
+
top: a.top,
|
|
44
|
+
right: "auto",
|
|
45
|
+
bottom: "auto",
|
|
46
|
+
transform: "translate(-50%, calc(-100% - 16px))"
|
|
47
|
+
});
|
|
48
|
+
}, [r, e]), e && typeof document < "u") {
|
|
49
|
+
const s = e();
|
|
50
|
+
return /* @__PURE__ */ c(B, { children: [
|
|
51
|
+
/* @__PURE__ */ o("span", { ref: p, className: "tooltip-portal-anchor" }),
|
|
52
|
+
f && k(
|
|
53
|
+
/* @__PURE__ */ c("div", { ref: d, className: m, style: { ...b, ...f }, children: [
|
|
54
|
+
/* @__PURE__ */ o("div", { className: y, style: v }),
|
|
55
|
+
/* @__PURE__ */ o("div", { className: "bu-tooltip-content__text", style: x, children: n })
|
|
56
|
+
] }),
|
|
57
|
+
s
|
|
58
|
+
)
|
|
59
|
+
] });
|
|
60
|
+
}
|
|
61
|
+
return j;
|
|
26
62
|
}
|
|
27
63
|
export {
|
|
28
|
-
|
|
64
|
+
z as default
|
|
29
65
|
};
|