@banyan_cloud/roots 2.0.65 → 2.0.66
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/cjs/index.js +203 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/v2/index.js +222 -5
- package/dist/cjs/v2/index.js.map +1 -1
- package/dist/esm/components/tooltip/types/index.d.ts +1 -1
- package/dist/esm/components/v2/breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/dist/esm/components/v2/breadcrumbs/InteractiveBreadcrumbs.d.ts +7 -0
- package/dist/esm/components/v2/breadcrumbs/assets/breadcrumbsArrow.d.ts +10 -0
- package/dist/esm/components/v2/breadcrumbs/assets/breadcrumbsHome.d.ts +10 -0
- package/dist/esm/components/v2/breadcrumbs/assets/breadcrumbsSplash.d.ts +10 -0
- package/dist/esm/components/v2/breadcrumbs/index.d.ts +2 -0
- package/dist/esm/components/v2/breadcrumbs/types/index.d.ts +30 -0
- package/dist/esm/components/v2/buttons/baseButton/types/index.d.ts +1 -1
- package/dist/esm/components/v2/buttons/button/types/index.d.ts +1 -1
- package/dist/esm/components/v2/inlineLoader/InlineLoader.d.ts +2 -0
- package/dist/esm/components/v2/inlineLoader/index.d.ts +1 -0
- package/dist/esm/components/v2/inlineLoader/types/index.d.ts +14 -0
- package/dist/esm/components/v2/link/Link.d.ts +1 -2
- package/dist/esm/components/v2/link/types/index.d.ts +4 -1
- package/dist/esm/index.js +203 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/v2/index.js +222 -5
- package/dist/esm/v2/index.js.map +1 -1
- package/package.json +1 -1
- package/src/styles/main.css +94 -94
package/dist/cjs/index.js
CHANGED
|
@@ -8466,6 +8466,208 @@ function getChildren(nodes, id) {
|
|
|
8466
8466
|
return allChildren;
|
|
8467
8467
|
}
|
|
8468
8468
|
|
|
8469
|
+
function isPointInPolygon(point, polygon) {
|
|
8470
|
+
const [x, y] = point;
|
|
8471
|
+
let isInside = false;
|
|
8472
|
+
const length = polygon.length;
|
|
8473
|
+
|
|
8474
|
+
for (let i = 0, j = length - 1; i < length; j = i++) {
|
|
8475
|
+
const [xi, yi] = polygon[i] || [0, 0];
|
|
8476
|
+
const [xj, yj] = polygon[j] || [0, 0];
|
|
8477
|
+
const intersect = yi >= y !== yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
8478
|
+
|
|
8479
|
+
if (intersect) {
|
|
8480
|
+
isInside = !isInside;
|
|
8481
|
+
}
|
|
8482
|
+
}
|
|
8483
|
+
|
|
8484
|
+
return isInside;
|
|
8485
|
+
}
|
|
8486
|
+
|
|
8487
|
+
function safePolygon(_temp) {
|
|
8488
|
+
let {
|
|
8489
|
+
restMs = 0,
|
|
8490
|
+
buffer = 0.5,
|
|
8491
|
+
blockPointerEvents = true,
|
|
8492
|
+
debug = null
|
|
8493
|
+
} = _temp === void 0 ? {} : _temp;
|
|
8494
|
+
let timeoutId;
|
|
8495
|
+
let polygonIsDestroyed = false;
|
|
8496
|
+
|
|
8497
|
+
const fn = _ref => {
|
|
8498
|
+
let {
|
|
8499
|
+
x,
|
|
8500
|
+
y,
|
|
8501
|
+
placement,
|
|
8502
|
+
refs,
|
|
8503
|
+
onClose,
|
|
8504
|
+
nodeId,
|
|
8505
|
+
tree,
|
|
8506
|
+
leave = false
|
|
8507
|
+
} = _ref;
|
|
8508
|
+
return function onPointerMove(event) {
|
|
8509
|
+
var _refs$domReference$cu, _refs$floating$curren, _refs$floating$curren2;
|
|
8510
|
+
|
|
8511
|
+
clearTimeout(timeoutId);
|
|
8512
|
+
|
|
8513
|
+
function close() {
|
|
8514
|
+
clearTimeout(timeoutId);
|
|
8515
|
+
onClose();
|
|
8516
|
+
}
|
|
8517
|
+
|
|
8518
|
+
if (event.pointerType && event.pointerType !== 'mouse') {
|
|
8519
|
+
return;
|
|
8520
|
+
}
|
|
8521
|
+
|
|
8522
|
+
const {
|
|
8523
|
+
clientX,
|
|
8524
|
+
clientY
|
|
8525
|
+
} = event;
|
|
8526
|
+
const target = 'composedPath' in event ? event.composedPath()[0] : event.target;
|
|
8527
|
+
const targetNode = target; // If the pointer is over the reference, there is no need to run the logic
|
|
8528
|
+
|
|
8529
|
+
if (event.type === 'pointermove' && (_refs$domReference$cu = refs.domReference.current) != null && _refs$domReference$cu.contains(targetNode)) {
|
|
8530
|
+
return;
|
|
8531
|
+
} // Prevent overlapping floating element from being stuck in an open-close
|
|
8532
|
+
// loop: https://github.com/floating-ui/floating-ui/issues/1910
|
|
8533
|
+
|
|
8534
|
+
|
|
8535
|
+
if (event.type === 'mouseleave' && isElement(event.relatedTarget) && (_refs$floating$curren = refs.floating.current) != null && _refs$floating$curren.contains(event.relatedTarget)) {
|
|
8536
|
+
return;
|
|
8537
|
+
} // If any nested child is open, abort.
|
|
8538
|
+
|
|
8539
|
+
|
|
8540
|
+
if (tree && getChildren(tree.nodesRef.current, nodeId).some(_ref2 => {
|
|
8541
|
+
let {
|
|
8542
|
+
context
|
|
8543
|
+
} = _ref2;
|
|
8544
|
+
return context == null ? void 0 : context.open;
|
|
8545
|
+
})) {
|
|
8546
|
+
return;
|
|
8547
|
+
} // The cursor landed, so we destroy the polygon logic
|
|
8548
|
+
|
|
8549
|
+
|
|
8550
|
+
if ((_refs$floating$curren2 = refs.floating.current) != null && _refs$floating$curren2.contains(targetNode) && !leave) {
|
|
8551
|
+
polygonIsDestroyed = true;
|
|
8552
|
+
return;
|
|
8553
|
+
}
|
|
8554
|
+
|
|
8555
|
+
if (!refs.domReference.current || !refs.floating.current || placement == null || x == null || y == null) {
|
|
8556
|
+
return;
|
|
8557
|
+
}
|
|
8558
|
+
|
|
8559
|
+
const refRect = refs.domReference.current.getBoundingClientRect();
|
|
8560
|
+
const rect = refs.floating.current.getBoundingClientRect();
|
|
8561
|
+
const side = placement.split('-')[0];
|
|
8562
|
+
const cursorLeaveFromRight = x > rect.right - rect.width / 2;
|
|
8563
|
+
const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; // If the pointer is leaving from the opposite side, the "buffer" logic
|
|
8564
|
+
// creates a point where the floating element remains open, but should be
|
|
8565
|
+
// ignored.
|
|
8566
|
+
// A constant of 1 handles floating point rounding errors.
|
|
8567
|
+
|
|
8568
|
+
if (side === 'top' && y >= refRect.bottom - 1 || side === 'bottom' && y <= refRect.top + 1 || side === 'left' && x >= refRect.right - 1 || side === 'right' && x <= refRect.left + 1) {
|
|
8569
|
+
return close();
|
|
8570
|
+
} // Ignore when the cursor is within the rectangular trough between the
|
|
8571
|
+
// two elements. Since the triangle is created from the cursor point,
|
|
8572
|
+
// which can start beyond the ref element's edge, traversing back and
|
|
8573
|
+
// forth from the ref to the floating element can cause it to close. This
|
|
8574
|
+
// ensures it always remains open in that case.
|
|
8575
|
+
|
|
8576
|
+
|
|
8577
|
+
switch (side) {
|
|
8578
|
+
case 'top':
|
|
8579
|
+
if (clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= refRect.top + 1) {
|
|
8580
|
+
return;
|
|
8581
|
+
}
|
|
8582
|
+
|
|
8583
|
+
break;
|
|
8584
|
+
|
|
8585
|
+
case 'bottom':
|
|
8586
|
+
if (clientX >= rect.left && clientX <= rect.right && clientY >= refRect.bottom - 1 && clientY <= rect.bottom) {
|
|
8587
|
+
return;
|
|
8588
|
+
}
|
|
8589
|
+
|
|
8590
|
+
break;
|
|
8591
|
+
|
|
8592
|
+
case 'left':
|
|
8593
|
+
if (clientX >= rect.left && clientX <= refRect.left + 1 && clientY >= rect.top && clientY <= rect.bottom) {
|
|
8594
|
+
return;
|
|
8595
|
+
}
|
|
8596
|
+
|
|
8597
|
+
break;
|
|
8598
|
+
|
|
8599
|
+
case 'right':
|
|
8600
|
+
if (clientX >= refRect.right - 1 && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom) {
|
|
8601
|
+
return;
|
|
8602
|
+
}
|
|
8603
|
+
|
|
8604
|
+
break;
|
|
8605
|
+
}
|
|
8606
|
+
|
|
8607
|
+
if (polygonIsDestroyed) {
|
|
8608
|
+
return close();
|
|
8609
|
+
}
|
|
8610
|
+
|
|
8611
|
+
function getPolygon(_ref3) {
|
|
8612
|
+
let [x, y] = _ref3;
|
|
8613
|
+
const isFloatingWider = rect.width > refRect.width;
|
|
8614
|
+
const isFloatingTaller = rect.height > refRect.height;
|
|
8615
|
+
|
|
8616
|
+
switch (side) {
|
|
8617
|
+
case 'top':
|
|
8618
|
+
{
|
|
8619
|
+
const cursorPointOne = [isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y + buffer + 1];
|
|
8620
|
+
const cursorPointTwo = [isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y + buffer + 1];
|
|
8621
|
+
const commonPoints = [[rect.left, cursorLeaveFromRight ? rect.bottom - buffer : isFloatingWider ? rect.bottom - buffer : rect.top], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.bottom - buffer : rect.top : rect.bottom - buffer]];
|
|
8622
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
8623
|
+
}
|
|
8624
|
+
|
|
8625
|
+
case 'bottom':
|
|
8626
|
+
{
|
|
8627
|
+
const cursorPointOne = [isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y - buffer];
|
|
8628
|
+
const cursorPointTwo = [isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y - buffer];
|
|
8629
|
+
const commonPoints = [[rect.left, cursorLeaveFromRight ? rect.top + buffer : isFloatingWider ? rect.top + buffer : rect.bottom], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.top + buffer : rect.bottom : rect.top + buffer]];
|
|
8630
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
8631
|
+
}
|
|
8632
|
+
|
|
8633
|
+
case 'left':
|
|
8634
|
+
{
|
|
8635
|
+
const cursorPointOne = [x + buffer + 1, isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];
|
|
8636
|
+
const cursorPointTwo = [x + buffer + 1, isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];
|
|
8637
|
+
const commonPoints = [[cursorLeaveFromBottom ? rect.right - buffer : isFloatingTaller ? rect.right - buffer : rect.left, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.right - buffer : rect.left : rect.right - buffer, rect.bottom]];
|
|
8638
|
+
return [...commonPoints, cursorPointOne, cursorPointTwo];
|
|
8639
|
+
}
|
|
8640
|
+
|
|
8641
|
+
case 'right':
|
|
8642
|
+
{
|
|
8643
|
+
const cursorPointOne = [x - buffer, isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];
|
|
8644
|
+
const cursorPointTwo = [x - buffer, isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];
|
|
8645
|
+
const commonPoints = [[cursorLeaveFromBottom ? rect.left + buffer : isFloatingTaller ? rect.left + buffer : rect.right, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.left + buffer : rect.right : rect.left + buffer, rect.bottom]];
|
|
8646
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
8647
|
+
}
|
|
8648
|
+
}
|
|
8649
|
+
}
|
|
8650
|
+
|
|
8651
|
+
const poly = getPolygon([x, y]);
|
|
8652
|
+
|
|
8653
|
+
if (process.env.NODE_ENV !== "production") {
|
|
8654
|
+
debug == null ? void 0 : debug(poly.slice(0, 4).join(', '));
|
|
8655
|
+
}
|
|
8656
|
+
|
|
8657
|
+
if (!isPointInPolygon([clientX, clientY], poly)) {
|
|
8658
|
+
close();
|
|
8659
|
+
} else if (restMs) {
|
|
8660
|
+
timeoutId = setTimeout(onClose, restMs);
|
|
8661
|
+
}
|
|
8662
|
+
};
|
|
8663
|
+
};
|
|
8664
|
+
|
|
8665
|
+
fn.__options = {
|
|
8666
|
+
blockPointerEvents
|
|
8667
|
+
};
|
|
8668
|
+
return fn;
|
|
8669
|
+
}
|
|
8670
|
+
|
|
8469
8671
|
const DEFAULT_ID = 'floating-ui-root';
|
|
8470
8672
|
const useFloatingPortalNode = function (_temp) {
|
|
8471
8673
|
let {
|
|
@@ -14632,7 +14834,7 @@ var Tooltip = /*#__PURE__*/React.forwardRef(function (props, propRef) {
|
|
|
14632
14834
|
// Event listeners to change the open state
|
|
14633
14835
|
var hover = useHover(context, {
|
|
14634
14836
|
move: true,
|
|
14635
|
-
|
|
14837
|
+
handleClose: clickOutsideToClose ? safePolygon() : undefined
|
|
14636
14838
|
});
|
|
14637
14839
|
var focus = useFocus(context, {
|
|
14638
14840
|
enabled: !clickOutsideToClose
|