@versaur/react 1.0.11 → 1.0.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.
- package/dist/blocks.d.ts +38 -13
- package/dist/blocks.js +68 -65
- package/dist/primitive.d.ts +4 -6
- package/dist/primitive.js +2 -2
- package/dist/tooltip-_eEMRSo8.js +268 -0
- package/package.json +2 -2
- package/dist/tooltip-Zuq8gd0f.js +0 -210
package/dist/blocks.d.ts
CHANGED
|
@@ -748,7 +748,7 @@ export declare interface MenuProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
|
748
748
|
children: ReactNode;
|
|
749
749
|
/**
|
|
750
750
|
* Placement relative to trigger button
|
|
751
|
-
* @default "
|
|
751
|
+
* @default "undefined" (auto placement by Tooltip)
|
|
752
752
|
*/
|
|
753
753
|
placement?: MenuPlacement;
|
|
754
754
|
/**
|
|
@@ -756,11 +756,6 @@ export declare interface MenuProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
|
756
756
|
* @default 400
|
|
757
757
|
*/
|
|
758
758
|
maxHeight?: number;
|
|
759
|
-
/**
|
|
760
|
-
* Minimum width of the menu list in pixels
|
|
761
|
-
* @default 160
|
|
762
|
-
*/
|
|
763
|
-
minWidth?: number;
|
|
764
759
|
/**
|
|
765
760
|
* Maximum width of the menu list in pixels
|
|
766
761
|
* @default 320
|
|
@@ -1208,7 +1203,33 @@ declare const TableCheckbox: ForwardRefExoticComponent<TableCheckboxProps & RefA
|
|
|
1208
1203
|
/**
|
|
1209
1204
|
* Table.Checkbox - built-in checkbox for row selection
|
|
1210
1205
|
*/
|
|
1211
|
-
export declare
|
|
1206
|
+
export declare type TableCheckboxProps = {
|
|
1207
|
+
/**
|
|
1208
|
+
* Whether this is the select-all checkbox in the header
|
|
1209
|
+
*/
|
|
1210
|
+
isMain: true;
|
|
1211
|
+
/**
|
|
1212
|
+
* Unique row identifier (not needed for main checkbox)
|
|
1213
|
+
*/
|
|
1214
|
+
rowId?: never;
|
|
1215
|
+
/**
|
|
1216
|
+
* Whether checkbox is checked (optional - managed by Table context)
|
|
1217
|
+
*/
|
|
1218
|
+
checked?: boolean;
|
|
1219
|
+
/**
|
|
1220
|
+
* Indeterminate state (e.g., for select-all checkbox)
|
|
1221
|
+
*/
|
|
1222
|
+
indeterminate?: boolean;
|
|
1223
|
+
/**
|
|
1224
|
+
* Callback when checkbox state changes (optional - managed by Table context)
|
|
1225
|
+
*/
|
|
1226
|
+
onChange?: (checked: boolean) => void;
|
|
1227
|
+
} | {
|
|
1228
|
+
/**
|
|
1229
|
+
* Whether this is the select-all checkbox in the header
|
|
1230
|
+
* @default false
|
|
1231
|
+
*/
|
|
1232
|
+
isMain?: false;
|
|
1212
1233
|
/**
|
|
1213
1234
|
* Unique row identifier
|
|
1214
1235
|
*/
|
|
@@ -1218,14 +1239,14 @@ export declare interface TableCheckboxProps {
|
|
|
1218
1239
|
*/
|
|
1219
1240
|
checked?: boolean;
|
|
1220
1241
|
/**
|
|
1221
|
-
* Indeterminate state (e.g., for
|
|
1242
|
+
* Indeterminate state (e.g., for select-all checkbox)
|
|
1222
1243
|
*/
|
|
1223
1244
|
indeterminate?: boolean;
|
|
1224
1245
|
/**
|
|
1225
1246
|
* Callback when checkbox state changes (optional - managed by Table context)
|
|
1226
1247
|
*/
|
|
1227
1248
|
onChange?: (checked: boolean) => void;
|
|
1228
|
-
}
|
|
1249
|
+
};
|
|
1229
1250
|
|
|
1230
1251
|
/**
|
|
1231
1252
|
* TableCol - polymorphic cell with grid area support
|
|
@@ -1324,18 +1345,22 @@ declare interface TableSelectionData {
|
|
|
1324
1345
|
}
|
|
1325
1346
|
|
|
1326
1347
|
/**
|
|
1327
|
-
* TableToolbar - renders toolbar content with optional render
|
|
1348
|
+
* TableToolbar - renders toolbar content with optional render functions for left and right slots
|
|
1328
1349
|
*/
|
|
1329
1350
|
declare const TableToolbar: ForwardRefExoticComponent<TableToolbarProps & RefAttributes<HTMLDivElement>>;
|
|
1330
1351
|
|
|
1331
1352
|
/**
|
|
1332
|
-
* Table.Toolbar - generic slot for action controls with optional render
|
|
1353
|
+
* Table.Toolbar - generic slot for action controls with optional render functions
|
|
1333
1354
|
*/
|
|
1334
1355
|
export declare interface TableToolbarProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
1335
1356
|
/**
|
|
1336
|
-
* Render function receives selected row IDs Set
|
|
1357
|
+
* Render function for left-aligned content (receives selected row IDs Set)
|
|
1358
|
+
*/
|
|
1359
|
+
leftContent?: ReactNode | ((selectedIds: Set<string | number>) => ReactNode);
|
|
1360
|
+
/**
|
|
1361
|
+
* Render function for right-aligned content (receives selected row IDs Set)
|
|
1337
1362
|
*/
|
|
1338
|
-
|
|
1363
|
+
rightContent?: ReactNode | ((selectedIds: Set<string | number>) => ReactNode);
|
|
1339
1364
|
}
|
|
1340
1365
|
|
|
1341
1366
|
/**
|
package/dist/blocks.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as y, jsx as o, Fragment as Tt } from "react/jsx-runtime";
|
|
2
|
-
import { accordionStyles as D, avatarGroupStyles as St, tabsStyles as G, noResultsStyles as F, attributeListStyles as
|
|
2
|
+
import { accordionStyles as D, avatarGroupStyles as St, tabsStyles as G, noResultsStyles as F, attributeListStyles as Bt, badgeGroupStyles as wt, cardStyles as C, menuStyles as H, tableStyles as w, buttonGroupStyles as At, topBarStyles as L, navStyles as j, sidebarStyles as T, bottomBarStyles as $, appLayoutStyles as x, formGroupStyles as X, featuresStyles as W, drawerStyles as Rt, modalStyles as It, bottomSheetStyles as Lt } from "@versaur/core/blocks";
|
|
3
3
|
import { ChevronDownIcon as Z, XIcon as q } from "@versaur/icons";
|
|
4
4
|
import xt, { createContext as A, forwardRef as n, useRef as M, useState as P, useEffect as z, useContext as R, useLayoutEffect as Ft, useId as O, useCallback as Dt } from "react";
|
|
5
5
|
import { u as v } from "./use-data-attrs-iPFyfiKN.js";
|
|
6
6
|
import { c as d } from "./cx-B9vmfsc1.js";
|
|
7
|
-
import { c as ee, I as E, T as I, B as V, H as Mt } from "./tooltip-
|
|
7
|
+
import { c as ee, I as E, T as I, B as V, H as Mt } from "./tooltip-_eEMRSo8.js";
|
|
8
8
|
import { checkboxStyles as k } from "@versaur/core/forms";
|
|
9
|
-
import { overlayPartsStyles as
|
|
9
|
+
import { overlayPartsStyles as B } from "@versaur/core/utils";
|
|
10
10
|
import { c as J, a as te, O as K, b as Ht } from "./overlay-parts-Zq9CuT31.js";
|
|
11
11
|
const ae = A(void 0);
|
|
12
12
|
function Gt() {
|
|
@@ -212,7 +212,7 @@ const ce = n(
|
|
|
212
212
|
"dl",
|
|
213
213
|
{
|
|
214
214
|
ref: m,
|
|
215
|
-
className: d(
|
|
215
|
+
className: d(Bt["attribute-list"], r),
|
|
216
216
|
...u,
|
|
217
217
|
style: {
|
|
218
218
|
"--_columns": t,
|
|
@@ -268,7 +268,7 @@ const ma = Object.assign(ce, {
|
|
|
268
268
|
"div",
|
|
269
269
|
{
|
|
270
270
|
ref: u,
|
|
271
|
-
className: d(
|
|
271
|
+
className: d(wt["badge-group"], i),
|
|
272
272
|
role: "group",
|
|
273
273
|
"aria-label": r,
|
|
274
274
|
...c,
|
|
@@ -319,33 +319,31 @@ const ua = Object.assign(de, {
|
|
|
319
319
|
}), be = A(void 0), Ne = n(
|
|
320
320
|
({
|
|
321
321
|
id: e,
|
|
322
|
-
placement: t
|
|
322
|
+
placement: t,
|
|
323
323
|
maxHeight: a = 400,
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
const b = {
|
|
324
|
+
maxWidth: s = 320,
|
|
325
|
+
gap: r = 8,
|
|
326
|
+
value: l,
|
|
327
|
+
onChange: i,
|
|
328
|
+
closeOnClick: m = !1,
|
|
329
|
+
children: u,
|
|
330
|
+
...c
|
|
331
|
+
}, p) => {
|
|
332
|
+
const N = {
|
|
334
333
|
id: e,
|
|
335
|
-
closeOnClick:
|
|
336
|
-
onChange:
|
|
337
|
-
value:
|
|
334
|
+
closeOnClick: m,
|
|
335
|
+
onChange: i,
|
|
336
|
+
value: l
|
|
338
337
|
};
|
|
339
|
-
return /* @__PURE__ */ o("div", { ref:
|
|
338
|
+
return /* @__PURE__ */ o("div", { ref: p, ...c, children: /* @__PURE__ */ o(be.Provider, { value: N, children: /* @__PURE__ */ o(I, { id: e, placement: t, gap: r, type: "persisted", children: /* @__PURE__ */ o(
|
|
340
339
|
"div",
|
|
341
340
|
{
|
|
342
341
|
className: H["menu-list"],
|
|
343
342
|
style: {
|
|
344
343
|
"--_max-height": `${a}px`,
|
|
345
|
-
"--_max-width": `${
|
|
346
|
-
"--_min-width": `${s}px`
|
|
344
|
+
"--_max-width": `${s}px`
|
|
347
345
|
},
|
|
348
|
-
children:
|
|
346
|
+
children: u
|
|
349
347
|
}
|
|
350
348
|
) }) }) });
|
|
351
349
|
}
|
|
@@ -402,20 +400,25 @@ function fe() {
|
|
|
402
400
|
throw new Error("useTableProvider must be used within a Table component");
|
|
403
401
|
return e;
|
|
404
402
|
}
|
|
405
|
-
const he = n(
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
403
|
+
const he = n(
|
|
404
|
+
({ leftContent: e, rightContent: t, className: a, ...s }, r) => {
|
|
405
|
+
const l = fe(), i = typeof e == "function" ? e(l.selectedRows) : e, m = typeof t == "function" ? t(l.selectedRows) : t;
|
|
406
|
+
return /* @__PURE__ */ y("div", { ref: r, className: d(w.toolbar, a), ...s, children: [
|
|
407
|
+
/* @__PURE__ */ o("div", { children: i }),
|
|
408
|
+
/* @__PURE__ */ o("div", { children: m })
|
|
409
|
+
] });
|
|
410
|
+
}
|
|
411
|
+
);
|
|
409
412
|
he.displayName = "Table.Toolbar";
|
|
410
|
-
const ge = n(({ className: e, ...t }, a) => /* @__PURE__ */ o("div", { ref: a, className: d(
|
|
413
|
+
const ge = n(({ className: e, ...t }, a) => /* @__PURE__ */ o("div", { ref: a, className: d(w.header, e), ...t }));
|
|
411
414
|
ge.displayName = "Table.Header";
|
|
412
|
-
const Te = n(({ className: e, ...t }, a) => /* @__PURE__ */ o("div", { ref: a, className: d(
|
|
415
|
+
const Te = n(({ className: e, ...t }, a) => /* @__PURE__ */ o("div", { ref: a, className: d(w.body, e), ...t }));
|
|
413
416
|
Te.displayName = "Table.Body";
|
|
414
|
-
const Se = n(({ className: e, ...t }, a) => /* @__PURE__ */ o("div", { ref: a, className: d(
|
|
417
|
+
const Se = n(({ className: e, ...t }, a) => /* @__PURE__ */ o("div", { ref: a, className: d(w.footer, e), ...t }));
|
|
415
418
|
Se.displayName = "Table.Footer";
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
const
|
|
419
|
+
const Be = n(({ className: e, ...t }, a) => /* @__PURE__ */ o("div", { ref: a, className: d(w.row, e), ...t }));
|
|
420
|
+
Be.displayName = "Table.Row";
|
|
421
|
+
const we = n(
|
|
419
422
|
({ as: e = "div", area: t, variant: a, className: s, style: r, ...l }, i) => {
|
|
420
423
|
const m = v({
|
|
421
424
|
variant: a
|
|
@@ -424,7 +427,7 @@ const Be = n(
|
|
|
424
427
|
e,
|
|
425
428
|
{
|
|
426
429
|
ref: i,
|
|
427
|
-
className: d(
|
|
430
|
+
className: d(w.col, s),
|
|
428
431
|
style: {
|
|
429
432
|
"--_area": t,
|
|
430
433
|
...r
|
|
@@ -435,26 +438,26 @@ const Be = n(
|
|
|
435
438
|
);
|
|
436
439
|
}
|
|
437
440
|
);
|
|
438
|
-
|
|
441
|
+
we.displayName = "Table.Col";
|
|
439
442
|
const Ae = n(
|
|
440
|
-
({ rowId: e,
|
|
441
|
-
const
|
|
442
|
-
!
|
|
443
|
+
({ rowId: e, isMain: t = !1, checked: a, indeterminate: s, onChange: r }, l) => {
|
|
444
|
+
const i = fe(), m = t ? i.selectedRows.size === i.allRowIds.size && i.allRowIds.size > 0 : e !== void 0 && i.selectedRows.has(e);
|
|
445
|
+
!t && e !== void 0 && i.registerRowId(e);
|
|
443
446
|
const u = (p) => {
|
|
444
|
-
|
|
445
|
-
}, c =
|
|
447
|
+
t ? i.onSelectAll(Array.from(i.allRowIds), p.target.checked) : e !== void 0 && i.onSelectionChange(e, p.target.checked), r == null || r(p.target.checked);
|
|
448
|
+
}, c = t && i.selectedRows.size > 0 && i.selectedRows.size < i.allRowIds.size;
|
|
446
449
|
return /* @__PURE__ */ y("label", { className: k.checkbox, children: [
|
|
447
450
|
/* @__PURE__ */ o(
|
|
448
451
|
"input",
|
|
449
452
|
{
|
|
450
453
|
ref: (p) => {
|
|
451
|
-
p && (p.indeterminate = c ||
|
|
454
|
+
p && (p.indeterminate = c || s || !1, typeof l == "function" ? l(p) : l && (l.current = p));
|
|
452
455
|
},
|
|
453
456
|
type: "checkbox",
|
|
454
457
|
className: k.input,
|
|
455
|
-
checked:
|
|
458
|
+
checked: a !== void 0 ? a : m,
|
|
456
459
|
onChange: u,
|
|
457
|
-
"aria-label":
|
|
460
|
+
"aria-label": t ? "Select all rows" : `Select row ${e}`
|
|
458
461
|
}
|
|
459
462
|
),
|
|
460
463
|
/* @__PURE__ */ o("span", { className: k.indicator })
|
|
@@ -463,9 +466,9 @@ const Ae = n(
|
|
|
463
466
|
);
|
|
464
467
|
Ae.displayName = "Table.Checkbox";
|
|
465
468
|
const Re = n(
|
|
466
|
-
({ as: e = "div", title: t, subtitle: a, size: s = "md", className: r, ...l }, i) => /* @__PURE__ */ y(e, { ref: i, className: d(
|
|
467
|
-
/* @__PURE__ */ o("div", { className:
|
|
468
|
-
/* @__PURE__ */ o("div", { className:
|
|
469
|
+
({ as: e = "div", title: t, subtitle: a, size: s = "md", className: r, ...l }, i) => /* @__PURE__ */ y(e, { ref: i, className: d(w.col, r), "data-variant": "double-line", ...l, children: [
|
|
470
|
+
/* @__PURE__ */ o("div", { className: w["double-line-title"], "data-size": s, children: t }),
|
|
471
|
+
/* @__PURE__ */ o("div", { className: w["double-line-subtitle"], "data-size": s, children: a })
|
|
469
472
|
] })
|
|
470
473
|
);
|
|
471
474
|
Re.displayName = "Table.DoubleLine";
|
|
@@ -473,14 +476,14 @@ const Ie = _.Item;
|
|
|
473
476
|
Ie.displayName = "Table.ActionItem";
|
|
474
477
|
const Le = n(({ icon: e, children: t }, a) => {
|
|
475
478
|
const s = O(), r = _.getTriggerProps({ id: s });
|
|
476
|
-
return /* @__PURE__ */ y("div", { ref: a, className: d(
|
|
479
|
+
return /* @__PURE__ */ y("div", { ref: a, className: d(w.action), children: [
|
|
477
480
|
/* @__PURE__ */ o(
|
|
478
481
|
V,
|
|
479
482
|
{
|
|
480
483
|
...r,
|
|
481
484
|
as: e,
|
|
482
485
|
variant: "ghost",
|
|
483
|
-
className: d(
|
|
486
|
+
className: d(w["action-trigger"]),
|
|
484
487
|
"aria-label": "Actions",
|
|
485
488
|
onClick: (l) => {
|
|
486
489
|
l.stopPropagation();
|
|
@@ -520,7 +523,7 @@ const xe = n(({ columns: e, children: t, className: a, style: s, onSelectionChan
|
|
|
520
523
|
"div",
|
|
521
524
|
{
|
|
522
525
|
ref: i,
|
|
523
|
-
className: d(
|
|
526
|
+
className: d(w.table, a),
|
|
524
527
|
style: {
|
|
525
528
|
"--_columns": e,
|
|
526
529
|
...s
|
|
@@ -536,8 +539,8 @@ const pa = Object.assign(xe, {
|
|
|
536
539
|
Header: ge,
|
|
537
540
|
Body: Te,
|
|
538
541
|
Footer: Se,
|
|
539
|
-
Row:
|
|
540
|
-
Col:
|
|
542
|
+
Row: Be,
|
|
543
|
+
Col: we,
|
|
541
544
|
Checkbox: Ae,
|
|
542
545
|
DoubleLine: Re,
|
|
543
546
|
Action: Le,
|
|
@@ -957,7 +960,7 @@ const Y = lt, it = A(void 0), Ut = () => {
|
|
|
957
960
|
className: d(e && Rt.drawer, r),
|
|
958
961
|
...m,
|
|
959
962
|
...l,
|
|
960
|
-
children: /* @__PURE__ */ o("div", { className:
|
|
963
|
+
children: /* @__PURE__ */ o("div", { className: B.content, children: s })
|
|
961
964
|
}
|
|
962
965
|
) });
|
|
963
966
|
}
|
|
@@ -975,7 +978,7 @@ const nt = n(({ onClick: e, ...t }, a) => {
|
|
|
975
978
|
onClick: (l) => {
|
|
976
979
|
s(), e == null || e(l);
|
|
977
980
|
},
|
|
978
|
-
className:
|
|
981
|
+
className: B.closeButton,
|
|
979
982
|
...t
|
|
980
983
|
}
|
|
981
984
|
);
|
|
@@ -986,15 +989,15 @@ const dt = n(
|
|
|
986
989
|
"div",
|
|
987
990
|
{
|
|
988
991
|
ref: l,
|
|
989
|
-
className: d(
|
|
992
|
+
className: d(B.header, s),
|
|
990
993
|
...r,
|
|
991
994
|
...e && { "data-action": "" },
|
|
992
995
|
...a && { "data-tabs": "" },
|
|
993
996
|
children: [
|
|
994
997
|
e ? /* @__PURE__ */ y(Tt, { children: [
|
|
995
|
-
/* @__PURE__ */ o("div", { className:
|
|
996
|
-
t && /* @__PURE__ */ o("div", { className:
|
|
997
|
-
] }) : /* @__PURE__ */ o("div", { className:
|
|
998
|
+
/* @__PURE__ */ o("div", { className: B.headerTop, children: e }),
|
|
999
|
+
t && /* @__PURE__ */ o("div", { className: B.headerContent, children: t })
|
|
1000
|
+
] }) : /* @__PURE__ */ o("div", { className: B.headerTop, children: t }),
|
|
998
1001
|
a
|
|
999
1002
|
]
|
|
1000
1003
|
}
|
|
@@ -1025,7 +1028,7 @@ const Ta = Object.assign(ct, {
|
|
|
1025
1028
|
"data-modal": "",
|
|
1026
1029
|
...u,
|
|
1027
1030
|
...i,
|
|
1028
|
-
children: /* @__PURE__ */ o("div", { className:
|
|
1031
|
+
children: /* @__PURE__ */ o("div", { className: B.content, children: r })
|
|
1029
1032
|
}
|
|
1030
1033
|
) });
|
|
1031
1034
|
}
|
|
@@ -1043,13 +1046,13 @@ const pt = n(({ onClick: e, ...t }, a) => {
|
|
|
1043
1046
|
onClick: (l) => {
|
|
1044
1047
|
s(), e == null || e(l);
|
|
1045
1048
|
},
|
|
1046
|
-
className:
|
|
1049
|
+
className: B.closeButton,
|
|
1047
1050
|
...t
|
|
1048
1051
|
}
|
|
1049
1052
|
);
|
|
1050
1053
|
});
|
|
1051
1054
|
pt.displayName = "Modal.CloseButton";
|
|
1052
|
-
const bt = n(({ action: e, children: t, className: a, ...s }, r) => /* @__PURE__ */ y("div", { ref: r, className: d(
|
|
1055
|
+
const bt = n(({ action: e, children: t, className: a, ...s }, r) => /* @__PURE__ */ y("div", { ref: r, className: d(B.header, "modal-header", a), "data-modal-header": "", ...s, children: [
|
|
1053
1056
|
/* @__PURE__ */ o("div", { children: t }),
|
|
1054
1057
|
e && /* @__PURE__ */ o("div", { className: "modal-header-action", children: e })
|
|
1055
1058
|
] }));
|
|
@@ -1059,7 +1062,7 @@ const Nt = n(
|
|
|
1059
1062
|
"div",
|
|
1060
1063
|
{
|
|
1061
1064
|
ref: r,
|
|
1062
|
-
className: d(
|
|
1065
|
+
className: d(B.footer, "modal-footer", a),
|
|
1063
1066
|
"data-modal-footer": "",
|
|
1064
1067
|
"data-align": e,
|
|
1065
1068
|
...s,
|
|
@@ -1088,7 +1091,7 @@ const Sa = Object.assign(ut, {
|
|
|
1088
1091
|
onOpenChange: t,
|
|
1089
1092
|
className: d(Lt.bottomSheet, s),
|
|
1090
1093
|
...r,
|
|
1091
|
-
children: /* @__PURE__ */ o("div", { className:
|
|
1094
|
+
children: /* @__PURE__ */ o("div", { className: B.content, children: a })
|
|
1092
1095
|
}
|
|
1093
1096
|
) })
|
|
1094
1097
|
);
|
|
@@ -1106,14 +1109,14 @@ const ft = n(
|
|
|
1106
1109
|
onClick: (l) => {
|
|
1107
1110
|
s(), e == null || e(l);
|
|
1108
1111
|
},
|
|
1109
|
-
className:
|
|
1112
|
+
className: B.closeButton,
|
|
1110
1113
|
...t
|
|
1111
1114
|
}
|
|
1112
1115
|
);
|
|
1113
1116
|
}
|
|
1114
1117
|
);
|
|
1115
1118
|
ft.displayName = "BottomSheet.CloseButton";
|
|
1116
|
-
const
|
|
1119
|
+
const Ba = Object.assign(vt, {
|
|
1117
1120
|
Body: K,
|
|
1118
1121
|
CloseButton: ft,
|
|
1119
1122
|
Footer: te,
|
|
@@ -1127,7 +1130,7 @@ export {
|
|
|
1127
1130
|
zt as AvatarGroup,
|
|
1128
1131
|
Ct as BadgeGroup,
|
|
1129
1132
|
va as BottomBar,
|
|
1130
|
-
|
|
1133
|
+
Ba as BottomSheet,
|
|
1131
1134
|
Xt as ButtonGroup,
|
|
1132
1135
|
ua as Card,
|
|
1133
1136
|
Y as Dialog,
|
package/dist/primitive.d.ts
CHANGED
|
@@ -528,10 +528,6 @@ declare interface TooltipGetTriggerPropsOptions {
|
|
|
528
528
|
* Unique identifier matching the Tooltip's id
|
|
529
529
|
*/
|
|
530
530
|
id: string;
|
|
531
|
-
/**
|
|
532
|
-
* Gap between tooltip and trigger in pixels
|
|
533
|
-
*/
|
|
534
|
-
gap?: number;
|
|
535
531
|
[key: string]: any;
|
|
536
532
|
}
|
|
537
533
|
|
|
@@ -555,9 +551,11 @@ export declare interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
555
551
|
*/
|
|
556
552
|
gap?: number;
|
|
557
553
|
/**
|
|
558
|
-
*
|
|
554
|
+
* Tooltip interaction type:
|
|
555
|
+
* - "hover" (default): Show on hover, hide on hover away (100ms grace period)
|
|
556
|
+
* - "persisted": Show on click, persists until user clicks outside or presses Escape
|
|
559
557
|
*/
|
|
560
|
-
|
|
558
|
+
type?: "hover" | "persisted";
|
|
561
559
|
}
|
|
562
560
|
|
|
563
561
|
/**
|
package/dist/primitive.js
CHANGED
|
@@ -4,8 +4,8 @@ import { LoaderIcon as T, UserIcon as U, XIcon as X } from "@versaur/icons";
|
|
|
4
4
|
import { forwardRef as u, useState as q } from "react";
|
|
5
5
|
import { u as b } from "./use-data-attrs-iPFyfiKN.js";
|
|
6
6
|
import { c as p } from "./cx-B9vmfsc1.js";
|
|
7
|
-
import { I as B, B as F } from "./tooltip-
|
|
8
|
-
import { H as nt, T as lt } from "./tooltip-
|
|
7
|
+
import { I as B, B as F } from "./tooltip-_eEMRSo8.js";
|
|
8
|
+
import { H as nt, T as lt } from "./tooltip-_eEMRSo8.js";
|
|
9
9
|
const G = u(
|
|
10
10
|
({
|
|
11
11
|
variant: a = "primary",
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { iconStyles as _, hrStyles as k, buttonIconStyles as F, tooltipStyles as A } from "@versaur/core/primitive";
|
|
3
|
+
import B, { forwardRef as E, useRef as b, useEffect as y } from "react";
|
|
4
|
+
import { u as w } from "./use-data-attrs-iPFyfiKN.js";
|
|
5
|
+
import { c as T } from "./cx-B9vmfsc1.js";
|
|
6
|
+
import { LoaderIcon as C } from "@versaur/icons";
|
|
7
|
+
const L = B.forwardRef(function({ intent: t = "inherit", size: n = "inherit", as: o, className: c, ...a }, s) {
|
|
8
|
+
const r = w({ intent: t, size: n });
|
|
9
|
+
return /* @__PURE__ */ f(o, { ref: s, className: T(_.icon, c), ...r, ...a });
|
|
10
|
+
});
|
|
11
|
+
L.displayName = "Icon";
|
|
12
|
+
const H = E(
|
|
13
|
+
({ orientation: e, variant: t, size: n, spacing: o, className: c, ...a }, s) => {
|
|
14
|
+
const r = w({
|
|
15
|
+
orientation: e,
|
|
16
|
+
size: n,
|
|
17
|
+
spacing: o,
|
|
18
|
+
variant: t
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ f(
|
|
21
|
+
"hr",
|
|
22
|
+
{
|
|
23
|
+
ref: s,
|
|
24
|
+
className: T(k.hr, c),
|
|
25
|
+
role: "separator",
|
|
26
|
+
"aria-orientation": e === "vertical" ? "vertical" : void 0,
|
|
27
|
+
...r,
|
|
28
|
+
...a
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
H.displayName = "Hr";
|
|
34
|
+
const M = E(
|
|
35
|
+
({
|
|
36
|
+
as: e,
|
|
37
|
+
variant: t = "primary",
|
|
38
|
+
size: n = "medium",
|
|
39
|
+
loading: o = !1,
|
|
40
|
+
disabled: c = !1,
|
|
41
|
+
pressed: a = !1,
|
|
42
|
+
type: s = "button",
|
|
43
|
+
onClick: r,
|
|
44
|
+
iconProps: i = {},
|
|
45
|
+
"aria-label": l,
|
|
46
|
+
className: u,
|
|
47
|
+
...p
|
|
48
|
+
}, d) => {
|
|
49
|
+
const h = w({
|
|
50
|
+
disabled: c || o,
|
|
51
|
+
loading: o,
|
|
52
|
+
size: n,
|
|
53
|
+
variant: t
|
|
54
|
+
}), g = (v) => {
|
|
55
|
+
if (c || o) {
|
|
56
|
+
v.preventDefault();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
r == null || r(v);
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ f(
|
|
62
|
+
"button",
|
|
63
|
+
{
|
|
64
|
+
ref: d,
|
|
65
|
+
type: s,
|
|
66
|
+
className: T(F["button-icon"], u),
|
|
67
|
+
"aria-label": l,
|
|
68
|
+
"aria-pressed": a ? "true" : void 0,
|
|
69
|
+
"aria-busy": o ? "true" : void 0,
|
|
70
|
+
"aria-disabled": c || o ? "true" : void 0,
|
|
71
|
+
...h,
|
|
72
|
+
...p,
|
|
73
|
+
onClick: g,
|
|
74
|
+
children: o ? /* @__PURE__ */ f(L, { as: C, "aria-label": "Loading", "data-loading-icon": "loader" }) : /* @__PURE__ */ f(L, { as: e, ...i })
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
M.displayName = "ButtonIcon";
|
|
80
|
+
function $(...e) {
|
|
81
|
+
return (t) => {
|
|
82
|
+
e.forEach((n) => {
|
|
83
|
+
if (typeof n == "function")
|
|
84
|
+
n(t);
|
|
85
|
+
else if (n && "current" in n)
|
|
86
|
+
try {
|
|
87
|
+
n.current = t;
|
|
88
|
+
} catch {
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const j = 100, m = 16;
|
|
94
|
+
function q(e, t) {
|
|
95
|
+
let n = e.parentElement;
|
|
96
|
+
for (; n; ) {
|
|
97
|
+
const o = n.querySelector(`[data-tooltip-trigger="${t}"]`);
|
|
98
|
+
if (o) return o;
|
|
99
|
+
if (n === document.body) break;
|
|
100
|
+
n = n.parentElement;
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
function D(e, t, n = j) {
|
|
105
|
+
const o = window.innerWidth, c = window.innerHeight, a = {
|
|
106
|
+
top: e.top,
|
|
107
|
+
bottom: c - e.bottom,
|
|
108
|
+
left: e.left,
|
|
109
|
+
right: o - e.right
|
|
110
|
+
};
|
|
111
|
+
if (a.bottom >= n)
|
|
112
|
+
return "bottom";
|
|
113
|
+
if (t) {
|
|
114
|
+
const s = e.left + e.width / 2, r = e.top + e.height / 2, i = [], l = e.bottom + t.height + m <= c && s - t.width / 2 >= m && s + t.width / 2 <= o - m;
|
|
115
|
+
i.push(["bottom", a.bottom, l]);
|
|
116
|
+
const u = e.top - t.height - m >= 0 && s - t.width / 2 >= m && s + t.width / 2 <= o - m;
|
|
117
|
+
i.push(["top", a.top, u]);
|
|
118
|
+
const p = e.right + t.width + m <= o && r - t.height / 2 >= m && r + t.height / 2 <= c - m;
|
|
119
|
+
i.push(["right", a.right, p]);
|
|
120
|
+
const d = e.left - t.width - m >= 0 && r - t.height / 2 >= m && r + t.height / 2 <= c - m;
|
|
121
|
+
i.push(["left", a.left, d]);
|
|
122
|
+
const h = i.filter(([g, v, x]) => x);
|
|
123
|
+
if (h.length > 0)
|
|
124
|
+
return h.reduce(
|
|
125
|
+
(g, v) => v[1] > g[1] ? v : g
|
|
126
|
+
)[0];
|
|
127
|
+
}
|
|
128
|
+
return Object.entries(a).reduce(
|
|
129
|
+
(s, r) => r[1] > s[1] ? r : s
|
|
130
|
+
)[0];
|
|
131
|
+
}
|
|
132
|
+
function O(e, t, n) {
|
|
133
|
+
let o = null;
|
|
134
|
+
const c = () => new Promise((i) => {
|
|
135
|
+
requestAnimationFrame(() => {
|
|
136
|
+
const l = e.getBoundingClientRect(), u = { width: l.width, height: l.height }, p = n || D(t.getBoundingClientRect(), u);
|
|
137
|
+
i(p);
|
|
138
|
+
});
|
|
139
|
+
}), a = async () => {
|
|
140
|
+
r();
|
|
141
|
+
const i = await c();
|
|
142
|
+
e.dataset.placement = i, e.matches(":popover-open") || e.showPopover();
|
|
143
|
+
}, s = (i) => {
|
|
144
|
+
o && (clearTimeout(o), o = null), i ? o = setTimeout(() => {
|
|
145
|
+
e.matches(":popover-open") && e.hidePopover(), o = null;
|
|
146
|
+
}, 100) : e.matches(":popover-open") && e.hidePopover();
|
|
147
|
+
}, r = () => {
|
|
148
|
+
o && (clearTimeout(o), o = null);
|
|
149
|
+
};
|
|
150
|
+
return { showTooltip: a, hideTooltip: s, cancelHide: r, cleanup: () => clearTimeout(o ?? void 0) };
|
|
151
|
+
}
|
|
152
|
+
function G({
|
|
153
|
+
id: e,
|
|
154
|
+
tooltipRef: t,
|
|
155
|
+
placement: n,
|
|
156
|
+
type: o
|
|
157
|
+
}) {
|
|
158
|
+
const c = b(null), a = b(null);
|
|
159
|
+
y(() => {
|
|
160
|
+
const s = t.current;
|
|
161
|
+
if (!s || !e)
|
|
162
|
+
return;
|
|
163
|
+
const r = q(s, e);
|
|
164
|
+
if (r)
|
|
165
|
+
return a.current = r, c.current = O(s, r, n), () => {
|
|
166
|
+
var i;
|
|
167
|
+
(i = c.current) == null || i.cleanup(), c.current = null;
|
|
168
|
+
};
|
|
169
|
+
}, [e, n, t]), y(() => {
|
|
170
|
+
if (o !== "hover" || !c.current || !a.current) return;
|
|
171
|
+
const s = a.current, r = c.current, i = t.current;
|
|
172
|
+
if (!i) return;
|
|
173
|
+
const l = () => {
|
|
174
|
+
r.showTooltip();
|
|
175
|
+
}, u = () => {
|
|
176
|
+
r.hideTooltip(!0);
|
|
177
|
+
}, p = () => {
|
|
178
|
+
r.cancelHide();
|
|
179
|
+
}, d = () => {
|
|
180
|
+
r.hideTooltip(!0);
|
|
181
|
+
};
|
|
182
|
+
return s.addEventListener("mouseenter", l), s.addEventListener("mouseleave", u), i.addEventListener("mouseenter", p), i.addEventListener("mouseleave", d), () => {
|
|
183
|
+
s.removeEventListener("mouseenter", l), s.removeEventListener("mouseleave", u), i.removeEventListener("mouseenter", p), i.removeEventListener("mouseleave", d);
|
|
184
|
+
};
|
|
185
|
+
}, [o, t]), y(() => {
|
|
186
|
+
if (o !== "persisted" || !c.current || !a.current) return;
|
|
187
|
+
const s = a.current, r = c.current, i = t.current;
|
|
188
|
+
if (!i) return;
|
|
189
|
+
const l = (d) => {
|
|
190
|
+
d.stopPropagation(), i.matches(":popover-open") ? r.hideTooltip(!1) : r.showTooltip();
|
|
191
|
+
}, u = (d) => {
|
|
192
|
+
const h = d.target;
|
|
193
|
+
i.matches(":popover-open") && !s.contains(h) && !i.contains(h) && r.hideTooltip(!1);
|
|
194
|
+
}, p = (d) => {
|
|
195
|
+
d.key === "Escape" && i.matches(":popover-open") && r.hideTooltip(!1);
|
|
196
|
+
};
|
|
197
|
+
return s.addEventListener("click", l), document.addEventListener("click", u), document.addEventListener("keydown", p), () => {
|
|
198
|
+
s.removeEventListener("click", l), document.removeEventListener("click", u), document.removeEventListener("keydown", p);
|
|
199
|
+
};
|
|
200
|
+
}, [o, t]);
|
|
201
|
+
}
|
|
202
|
+
const U = 8, I = E(
|
|
203
|
+
({ id: e, children: t, placement: n, gap: o = U, type: c = "hover", style: a, className: s, ...r }, i) => {
|
|
204
|
+
const l = b(null), u = w({
|
|
205
|
+
placement: n
|
|
206
|
+
});
|
|
207
|
+
return G({
|
|
208
|
+
id: e,
|
|
209
|
+
placement: n,
|
|
210
|
+
tooltipRef: l,
|
|
211
|
+
type: c
|
|
212
|
+
}), /* @__PURE__ */ f(
|
|
213
|
+
"div",
|
|
214
|
+
{
|
|
215
|
+
ref: $(l, i),
|
|
216
|
+
id: e,
|
|
217
|
+
className: T(A.tooltip, s),
|
|
218
|
+
...u,
|
|
219
|
+
style: {
|
|
220
|
+
"--_gap": `${o}px`,
|
|
221
|
+
positionAnchor: `--tooltip-${e}`,
|
|
222
|
+
...a
|
|
223
|
+
},
|
|
224
|
+
...r,
|
|
225
|
+
popover: "auto",
|
|
226
|
+
children: t
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
I.displayName = "Tooltip";
|
|
232
|
+
const N = E(
|
|
233
|
+
({ children: e, maxWidth: t, maxLines: n = 2, style: o, className: c, ...a }, s) => {
|
|
234
|
+
const r = {
|
|
235
|
+
"--_lines": n,
|
|
236
|
+
"--_max-width": t,
|
|
237
|
+
...o
|
|
238
|
+
};
|
|
239
|
+
return /* @__PURE__ */ f("div", { ref: s, className: T(A["tooltip-text"], c), style: r, ...a, children: e });
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
N.displayName = "Tooltip.Text";
|
|
243
|
+
function W(e) {
|
|
244
|
+
const { id: t, ...n } = e;
|
|
245
|
+
return {
|
|
246
|
+
"data-tooltip-trigger": t,
|
|
247
|
+
style: { anchorName: `--tooltip-${t}` },
|
|
248
|
+
...Object.fromEntries(Object.entries(n).map(([o, c]) => [o, String(c)]))
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function X(e) {
|
|
252
|
+
const { id: t } = e, n = document.getElementById(t);
|
|
253
|
+
n && n.matches(":popover-open") && requestAnimationFrame(() => {
|
|
254
|
+
const o = document.querySelector(`[data-tooltip-trigger="${t}"]`);
|
|
255
|
+
o && document.activeElement === o && o.blur(), n.matches(":popover-open") && n.hidePopover();
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
const P = I;
|
|
259
|
+
P.Text = N;
|
|
260
|
+
P.getTooltipTriggerProps = W;
|
|
261
|
+
P.close = X;
|
|
262
|
+
export {
|
|
263
|
+
M as B,
|
|
264
|
+
H,
|
|
265
|
+
L as I,
|
|
266
|
+
P as T,
|
|
267
|
+
$ as c
|
|
268
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versaur/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "React components for Versaur Design System",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"react": "^18.0.0 || ^19.0.0",
|
|
51
51
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
52
|
-
"@versaur/core": "0.0.
|
|
52
|
+
"@versaur/core": "0.0.9",
|
|
53
53
|
"@versaur/icons": "1.0.0"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
package/dist/tooltip-Zuq8gd0f.js
DELETED
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
-
import { iconStyles as _, hrStyles as j, buttonIconStyles as H, tooltipStyles as x } from "@versaur/core/primitive";
|
|
3
|
-
import M, { forwardRef as b, useEffect as k, useRef as D } from "react";
|
|
4
|
-
import { u as T } from "./use-data-attrs-iPFyfiKN.js";
|
|
5
|
-
import { c as f } from "./cx-B9vmfsc1.js";
|
|
6
|
-
import { LoaderIcon as F } from "@versaur/icons";
|
|
7
|
-
const y = M.forwardRef(function({ intent: a = "inherit", size: n = "inherit", as: i, className: o, ...t }, e) {
|
|
8
|
-
const r = T({ intent: a, size: n });
|
|
9
|
-
return /* @__PURE__ */ u(i, { ref: e, className: f(_.icon, o), ...r, ...t });
|
|
10
|
-
});
|
|
11
|
-
y.displayName = "Icon";
|
|
12
|
-
const O = b(
|
|
13
|
-
({ orientation: s, variant: a, size: n, spacing: i, className: o, ...t }, e) => {
|
|
14
|
-
const r = T({
|
|
15
|
-
orientation: s,
|
|
16
|
-
size: n,
|
|
17
|
-
spacing: i,
|
|
18
|
-
variant: a
|
|
19
|
-
});
|
|
20
|
-
return /* @__PURE__ */ u(
|
|
21
|
-
"hr",
|
|
22
|
-
{
|
|
23
|
-
ref: e,
|
|
24
|
-
className: f(j.hr, o),
|
|
25
|
-
role: "separator",
|
|
26
|
-
"aria-orientation": s === "vertical" ? "vertical" : void 0,
|
|
27
|
-
...r,
|
|
28
|
-
...t
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
O.displayName = "Hr";
|
|
34
|
-
const U = b(
|
|
35
|
-
({
|
|
36
|
-
as: s,
|
|
37
|
-
variant: a = "primary",
|
|
38
|
-
size: n = "medium",
|
|
39
|
-
loading: i = !1,
|
|
40
|
-
disabled: o = !1,
|
|
41
|
-
pressed: t = !1,
|
|
42
|
-
type: e = "button",
|
|
43
|
-
onClick: r,
|
|
44
|
-
iconProps: p = {},
|
|
45
|
-
"aria-label": c,
|
|
46
|
-
className: m,
|
|
47
|
-
...v
|
|
48
|
-
}, h) => {
|
|
49
|
-
const E = T({
|
|
50
|
-
disabled: o || i,
|
|
51
|
-
loading: i,
|
|
52
|
-
size: n,
|
|
53
|
-
variant: a
|
|
54
|
-
}), L = (d) => {
|
|
55
|
-
if (o || i) {
|
|
56
|
-
d.preventDefault();
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
r == null || r(d);
|
|
60
|
-
};
|
|
61
|
-
return /* @__PURE__ */ u(
|
|
62
|
-
"button",
|
|
63
|
-
{
|
|
64
|
-
ref: h,
|
|
65
|
-
type: e,
|
|
66
|
-
className: f(H["button-icon"], m),
|
|
67
|
-
"aria-label": c,
|
|
68
|
-
"aria-pressed": t ? "true" : void 0,
|
|
69
|
-
"aria-busy": i ? "true" : void 0,
|
|
70
|
-
"aria-disabled": o || i ? "true" : void 0,
|
|
71
|
-
...E,
|
|
72
|
-
...v,
|
|
73
|
-
onClick: L,
|
|
74
|
-
children: i ? /* @__PURE__ */ u(y, { as: F, "aria-label": "Loading", "data-loading-icon": "loader" }) : /* @__PURE__ */ u(y, { as: s, ...p })
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
U.displayName = "ButtonIcon";
|
|
80
|
-
function C({ id: s, tooltipRef: a, placement: n, gap: i, triggerType: o }) {
|
|
81
|
-
k(() => {
|
|
82
|
-
const t = a.current;
|
|
83
|
-
if (!t || !s)
|
|
84
|
-
return;
|
|
85
|
-
let e = null;
|
|
86
|
-
if (t.parentElement && (e = t.parentElement.querySelector(`[data-tooltip-trigger="${s}"]`)), !e) {
|
|
87
|
-
let l = t.parentElement;
|
|
88
|
-
for (; l && !e && (e = l.querySelector(`[data-tooltip-trigger="${s}"]`), !(e || l.classList.contains("sbdocs-story") || l.classList.contains("docblock-storylet"))); )
|
|
89
|
-
l = l.parentElement;
|
|
90
|
-
}
|
|
91
|
-
if (e || (e = document.querySelector(`[data-tooltip-trigger="${s}"]`)), !e)
|
|
92
|
-
return;
|
|
93
|
-
let r = null;
|
|
94
|
-
const p = () => {
|
|
95
|
-
const l = e.getBoundingClientRect(), B = window.innerWidth, $ = window.innerHeight, q = 100, A = {
|
|
96
|
-
top: l.top,
|
|
97
|
-
bottom: $ - l.bottom,
|
|
98
|
-
left: l.left,
|
|
99
|
-
right: B - l.right
|
|
100
|
-
};
|
|
101
|
-
return A.bottom >= q ? "bottom" : Object.entries(A).reduce((I, N) => N[1] > I[1] ? N : I)[0];
|
|
102
|
-
}, c = () => {
|
|
103
|
-
r && (clearTimeout(r), r = null);
|
|
104
|
-
const l = n || p();
|
|
105
|
-
t.dataset.placement = l, t.matches(":popover-open") || t.showPopover();
|
|
106
|
-
}, m = () => {
|
|
107
|
-
r && clearTimeout(r), r = setTimeout(() => {
|
|
108
|
-
t.matches(":popover-open") && t.hidePopover(), r = null;
|
|
109
|
-
}, 100);
|
|
110
|
-
}, v = () => {
|
|
111
|
-
(o === "hover" || o === "all") && c();
|
|
112
|
-
}, h = () => {
|
|
113
|
-
(o === "hover" || o === "all") && m();
|
|
114
|
-
}, E = () => {
|
|
115
|
-
(o === "focus" || o === "all") && c();
|
|
116
|
-
}, L = () => {
|
|
117
|
-
o === "hover" && t.hidePopover();
|
|
118
|
-
}, d = () => {
|
|
119
|
-
o === "focus" && (t.matches(":popover-open") ? t.hidePopover() : c());
|
|
120
|
-
}, S = () => {
|
|
121
|
-
r && (clearTimeout(r), r = null);
|
|
122
|
-
}, w = () => {
|
|
123
|
-
(o === "hover" || o === "all") && m();
|
|
124
|
-
};
|
|
125
|
-
return e.addEventListener("mouseenter", v), e.addEventListener("mouseleave", h), e.addEventListener("focus", E), e.addEventListener("blur", L), e.addEventListener("click", d), t.addEventListener("mouseenter", S), t.addEventListener("mouseleave", w), () => {
|
|
126
|
-
r && clearTimeout(r), e.removeEventListener("mouseenter", v), e.removeEventListener("mouseleave", h), e.removeEventListener("focus", E), e.removeEventListener("blur", L), e.removeEventListener("click", d), t.removeEventListener("mouseenter", S), t.removeEventListener("mouseleave", w);
|
|
127
|
-
};
|
|
128
|
-
}, [s, i, o]);
|
|
129
|
-
}
|
|
130
|
-
function G(...s) {
|
|
131
|
-
return (a) => {
|
|
132
|
-
s.forEach((n) => {
|
|
133
|
-
if (typeof n == "function")
|
|
134
|
-
n(a);
|
|
135
|
-
else if (n && "current" in n)
|
|
136
|
-
try {
|
|
137
|
-
n.current = a;
|
|
138
|
-
} catch {
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
const W = 8, g = b(
|
|
144
|
-
({ id: s, children: a, placement: n, gap: i = W, triggerType: o = "all", style: t, className: e, ...r }, p) => {
|
|
145
|
-
const c = D(null), m = T({
|
|
146
|
-
placement: n
|
|
147
|
-
});
|
|
148
|
-
return C({
|
|
149
|
-
gap: i,
|
|
150
|
-
id: s,
|
|
151
|
-
placement: n,
|
|
152
|
-
tooltipRef: c,
|
|
153
|
-
triggerType: o
|
|
154
|
-
}), /* @__PURE__ */ u(
|
|
155
|
-
"div",
|
|
156
|
-
{
|
|
157
|
-
ref: G(c, p),
|
|
158
|
-
id: s,
|
|
159
|
-
className: f(x.tooltip, e),
|
|
160
|
-
...m,
|
|
161
|
-
style: {
|
|
162
|
-
"--_gap": `${i}px`,
|
|
163
|
-
positionAnchor: `--tooltip-${s}`,
|
|
164
|
-
...t
|
|
165
|
-
},
|
|
166
|
-
...r,
|
|
167
|
-
popover: "auto",
|
|
168
|
-
children: a
|
|
169
|
-
}
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
);
|
|
173
|
-
g.displayName = "Tooltip";
|
|
174
|
-
const R = b(
|
|
175
|
-
({ children: s, maxWidth: a, maxLines: n = 2, style: i, className: o, ...t }, e) => {
|
|
176
|
-
const r = {
|
|
177
|
-
"--_lines": n,
|
|
178
|
-
"--_max-width": a,
|
|
179
|
-
...i
|
|
180
|
-
};
|
|
181
|
-
return /* @__PURE__ */ u("div", { ref: e, className: f(x["tooltip-text"], o), style: r, ...t, children: s });
|
|
182
|
-
}
|
|
183
|
-
);
|
|
184
|
-
R.displayName = "Tooltip.Text";
|
|
185
|
-
function z(s) {
|
|
186
|
-
const { id: a, triggerType: n = "all", ...i } = s, o = {
|
|
187
|
-
"data-tooltip-trigger": a,
|
|
188
|
-
style: { anchorName: `--tooltip-${a}` },
|
|
189
|
-
...Object.fromEntries(Object.entries(i).map(([t, e]) => [t, String(e)]))
|
|
190
|
-
};
|
|
191
|
-
return n !== "focus" && (o.popoverTarget = a), o;
|
|
192
|
-
}
|
|
193
|
-
function J(s) {
|
|
194
|
-
const { id: a } = s, n = document.getElementById(a);
|
|
195
|
-
n && n.matches(":popover-open") && requestAnimationFrame(() => {
|
|
196
|
-
const i = document.querySelector(`[data-tooltip-trigger="${a}"]`);
|
|
197
|
-
i && document.activeElement === i && i.blur(), n.matches(":popover-open") && n.hidePopover();
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
const P = g;
|
|
201
|
-
P.Text = R;
|
|
202
|
-
P.getTooltipTriggerProps = z;
|
|
203
|
-
P.close = J;
|
|
204
|
-
export {
|
|
205
|
-
U as B,
|
|
206
|
-
O as H,
|
|
207
|
-
y as I,
|
|
208
|
-
P as T,
|
|
209
|
-
G as c
|
|
210
|
-
};
|