@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
|
@@ -50,7 +50,7 @@ export interface TooltipProps {
|
|
|
50
50
|
*/
|
|
51
51
|
showPointer?: boolean;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* Enables interactive hover behavior so users can move from trigger to tooltip content before it closes.
|
|
54
54
|
*/
|
|
55
55
|
clickOutsideToClose?: boolean;
|
|
56
56
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface BreadcrumbsArrowProps {
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
declare const BreadcrumbsArrow: React.FC<BreadcrumbsArrowProps>;
|
|
10
|
+
export default BreadcrumbsArrow;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface BreadcrumbsHomeProps {
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
declare const BreadcrumbsHome: React.FC<BreadcrumbsHomeProps>;
|
|
10
|
+
export default BreadcrumbsHome;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface BreadcrumbsSplashProps {
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
declare const BreadcrumbsSplash: React.FC<BreadcrumbsSplashProps>;
|
|
10
|
+
export default BreadcrumbsSplash;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type BreadcrumbSeparator = 'chevron' | 'slash';
|
|
2
|
+
export type BreadcrumbType = 'text' | 'text-with-line' | 'button';
|
|
3
|
+
export interface BreadcrumbItem {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string | undefined;
|
|
6
|
+
href?: string | undefined;
|
|
7
|
+
onClick?: () => void | undefined;
|
|
8
|
+
isDisabled?: boolean | undefined;
|
|
9
|
+
dropdownOptions?: BreadcrumbDropdownOption[] | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface SeparatorProps {
|
|
12
|
+
separator: BreadcrumbSeparator;
|
|
13
|
+
}
|
|
14
|
+
export interface DropdownProps {
|
|
15
|
+
options: BreadcrumbDropdownOption[];
|
|
16
|
+
onClose: () => void;
|
|
17
|
+
anchorRef: React.RefObject<HTMLSpanElement | null>;
|
|
18
|
+
}
|
|
19
|
+
export interface BreadcrumbDropdownOption {
|
|
20
|
+
label: string;
|
|
21
|
+
value: string;
|
|
22
|
+
onClick?: () => void | undefined;
|
|
23
|
+
}
|
|
24
|
+
export interface BreadcrumbsProps {
|
|
25
|
+
crumbs: BreadcrumbItem[];
|
|
26
|
+
type?: BreadcrumbType | undefined;
|
|
27
|
+
separator?: BreadcrumbSeparator | undefined;
|
|
28
|
+
className?: string | undefined;
|
|
29
|
+
activeIndex?: number | undefined;
|
|
30
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BaseCellProps } from 'components/cell';
|
|
2
2
|
import type { MouseEvent, ReactElement } from 'react';
|
|
3
3
|
type ButtonType = 'button' | 'submit' | 'reset';
|
|
4
|
-
type ButtonVariant = 'contained' | 'outlined' | 'text';
|
|
4
|
+
type ButtonVariant = 'contained' | 'outlined' | 'text' | 'unstyled';
|
|
5
5
|
export interface BaseButtonProps extends BaseCellProps<'button', false> {
|
|
6
6
|
title?: ReactElement | string | undefined;
|
|
7
7
|
disabled?: boolean | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentType, JSXElementConstructor, MouseEvent, ReactElement } from 'react';
|
|
2
|
-
export type ButtonVariant = 'primary' | 'secondary' | 'Soft' | 'outlined' | 'ghost';
|
|
2
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'Soft' | 'outlined' | 'ghost' | 'unstyled';
|
|
3
3
|
export type ButtonTextSize = 'sm' | 'md';
|
|
4
4
|
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'auto';
|
|
5
5
|
export interface ButtonProps {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './InlineLoader';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface InlineLoaderProps {
|
|
2
|
+
/**
|
|
3
|
+
* The current state of the inline loader.
|
|
4
|
+
*/
|
|
5
|
+
status: 'loading' | 'success' | 'error';
|
|
6
|
+
/**
|
|
7
|
+
* The optional text label displayed next to the icon.
|
|
8
|
+
*/
|
|
9
|
+
text?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Additional CSS classes.
|
|
12
|
+
*/
|
|
13
|
+
className?: string | undefined;
|
|
14
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type RefObject } from 'react';
|
|
2
1
|
import type { LinkProps } from './types';
|
|
3
|
-
declare const Link: import("react").ForwardRefExoticComponent<LinkProps & import("react").RefAttributes<
|
|
2
|
+
declare const Link: import("react").ForwardRefExoticComponent<LinkProps & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
4
3
|
export default Link;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { HTMLAttributeAnchorTarget } from 'react';
|
|
1
2
|
type LinkSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
export type LinkVariant = 'styled' | 'unstyled';
|
|
2
4
|
export interface LinkProps {
|
|
3
5
|
children: React.ReactNode;
|
|
4
6
|
href: string;
|
|
5
7
|
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
6
|
-
onClick?: () => void;
|
|
8
|
+
onClick?: (e: HTMLAttributeAnchorTarget) => void;
|
|
9
|
+
variant?: LinkVariant;
|
|
7
10
|
size?: LinkSize;
|
|
8
11
|
withIcon?: boolean;
|
|
9
12
|
disabled?: boolean;
|
package/dist/esm/index.js
CHANGED
|
@@ -8445,6 +8445,208 @@ function getChildren(nodes, id) {
|
|
|
8445
8445
|
return allChildren;
|
|
8446
8446
|
}
|
|
8447
8447
|
|
|
8448
|
+
function isPointInPolygon(point, polygon) {
|
|
8449
|
+
const [x, y] = point;
|
|
8450
|
+
let isInside = false;
|
|
8451
|
+
const length = polygon.length;
|
|
8452
|
+
|
|
8453
|
+
for (let i = 0, j = length - 1; i < length; j = i++) {
|
|
8454
|
+
const [xi, yi] = polygon[i] || [0, 0];
|
|
8455
|
+
const [xj, yj] = polygon[j] || [0, 0];
|
|
8456
|
+
const intersect = yi >= y !== yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
8457
|
+
|
|
8458
|
+
if (intersect) {
|
|
8459
|
+
isInside = !isInside;
|
|
8460
|
+
}
|
|
8461
|
+
}
|
|
8462
|
+
|
|
8463
|
+
return isInside;
|
|
8464
|
+
}
|
|
8465
|
+
|
|
8466
|
+
function safePolygon(_temp) {
|
|
8467
|
+
let {
|
|
8468
|
+
restMs = 0,
|
|
8469
|
+
buffer = 0.5,
|
|
8470
|
+
blockPointerEvents = true,
|
|
8471
|
+
debug = null
|
|
8472
|
+
} = _temp === void 0 ? {} : _temp;
|
|
8473
|
+
let timeoutId;
|
|
8474
|
+
let polygonIsDestroyed = false;
|
|
8475
|
+
|
|
8476
|
+
const fn = _ref => {
|
|
8477
|
+
let {
|
|
8478
|
+
x,
|
|
8479
|
+
y,
|
|
8480
|
+
placement,
|
|
8481
|
+
refs,
|
|
8482
|
+
onClose,
|
|
8483
|
+
nodeId,
|
|
8484
|
+
tree,
|
|
8485
|
+
leave = false
|
|
8486
|
+
} = _ref;
|
|
8487
|
+
return function onPointerMove(event) {
|
|
8488
|
+
var _refs$domReference$cu, _refs$floating$curren, _refs$floating$curren2;
|
|
8489
|
+
|
|
8490
|
+
clearTimeout(timeoutId);
|
|
8491
|
+
|
|
8492
|
+
function close() {
|
|
8493
|
+
clearTimeout(timeoutId);
|
|
8494
|
+
onClose();
|
|
8495
|
+
}
|
|
8496
|
+
|
|
8497
|
+
if (event.pointerType && event.pointerType !== 'mouse') {
|
|
8498
|
+
return;
|
|
8499
|
+
}
|
|
8500
|
+
|
|
8501
|
+
const {
|
|
8502
|
+
clientX,
|
|
8503
|
+
clientY
|
|
8504
|
+
} = event;
|
|
8505
|
+
const target = 'composedPath' in event ? event.composedPath()[0] : event.target;
|
|
8506
|
+
const targetNode = target; // If the pointer is over the reference, there is no need to run the logic
|
|
8507
|
+
|
|
8508
|
+
if (event.type === 'pointermove' && (_refs$domReference$cu = refs.domReference.current) != null && _refs$domReference$cu.contains(targetNode)) {
|
|
8509
|
+
return;
|
|
8510
|
+
} // Prevent overlapping floating element from being stuck in an open-close
|
|
8511
|
+
// loop: https://github.com/floating-ui/floating-ui/issues/1910
|
|
8512
|
+
|
|
8513
|
+
|
|
8514
|
+
if (event.type === 'mouseleave' && isElement(event.relatedTarget) && (_refs$floating$curren = refs.floating.current) != null && _refs$floating$curren.contains(event.relatedTarget)) {
|
|
8515
|
+
return;
|
|
8516
|
+
} // If any nested child is open, abort.
|
|
8517
|
+
|
|
8518
|
+
|
|
8519
|
+
if (tree && getChildren(tree.nodesRef.current, nodeId).some(_ref2 => {
|
|
8520
|
+
let {
|
|
8521
|
+
context
|
|
8522
|
+
} = _ref2;
|
|
8523
|
+
return context == null ? void 0 : context.open;
|
|
8524
|
+
})) {
|
|
8525
|
+
return;
|
|
8526
|
+
} // The cursor landed, so we destroy the polygon logic
|
|
8527
|
+
|
|
8528
|
+
|
|
8529
|
+
if ((_refs$floating$curren2 = refs.floating.current) != null && _refs$floating$curren2.contains(targetNode) && !leave) {
|
|
8530
|
+
polygonIsDestroyed = true;
|
|
8531
|
+
return;
|
|
8532
|
+
}
|
|
8533
|
+
|
|
8534
|
+
if (!refs.domReference.current || !refs.floating.current || placement == null || x == null || y == null) {
|
|
8535
|
+
return;
|
|
8536
|
+
}
|
|
8537
|
+
|
|
8538
|
+
const refRect = refs.domReference.current.getBoundingClientRect();
|
|
8539
|
+
const rect = refs.floating.current.getBoundingClientRect();
|
|
8540
|
+
const side = placement.split('-')[0];
|
|
8541
|
+
const cursorLeaveFromRight = x > rect.right - rect.width / 2;
|
|
8542
|
+
const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; // If the pointer is leaving from the opposite side, the "buffer" logic
|
|
8543
|
+
// creates a point where the floating element remains open, but should be
|
|
8544
|
+
// ignored.
|
|
8545
|
+
// A constant of 1 handles floating point rounding errors.
|
|
8546
|
+
|
|
8547
|
+
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) {
|
|
8548
|
+
return close();
|
|
8549
|
+
} // Ignore when the cursor is within the rectangular trough between the
|
|
8550
|
+
// two elements. Since the triangle is created from the cursor point,
|
|
8551
|
+
// which can start beyond the ref element's edge, traversing back and
|
|
8552
|
+
// forth from the ref to the floating element can cause it to close. This
|
|
8553
|
+
// ensures it always remains open in that case.
|
|
8554
|
+
|
|
8555
|
+
|
|
8556
|
+
switch (side) {
|
|
8557
|
+
case 'top':
|
|
8558
|
+
if (clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= refRect.top + 1) {
|
|
8559
|
+
return;
|
|
8560
|
+
}
|
|
8561
|
+
|
|
8562
|
+
break;
|
|
8563
|
+
|
|
8564
|
+
case 'bottom':
|
|
8565
|
+
if (clientX >= rect.left && clientX <= rect.right && clientY >= refRect.bottom - 1 && clientY <= rect.bottom) {
|
|
8566
|
+
return;
|
|
8567
|
+
}
|
|
8568
|
+
|
|
8569
|
+
break;
|
|
8570
|
+
|
|
8571
|
+
case 'left':
|
|
8572
|
+
if (clientX >= rect.left && clientX <= refRect.left + 1 && clientY >= rect.top && clientY <= rect.bottom) {
|
|
8573
|
+
return;
|
|
8574
|
+
}
|
|
8575
|
+
|
|
8576
|
+
break;
|
|
8577
|
+
|
|
8578
|
+
case 'right':
|
|
8579
|
+
if (clientX >= refRect.right - 1 && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom) {
|
|
8580
|
+
return;
|
|
8581
|
+
}
|
|
8582
|
+
|
|
8583
|
+
break;
|
|
8584
|
+
}
|
|
8585
|
+
|
|
8586
|
+
if (polygonIsDestroyed) {
|
|
8587
|
+
return close();
|
|
8588
|
+
}
|
|
8589
|
+
|
|
8590
|
+
function getPolygon(_ref3) {
|
|
8591
|
+
let [x, y] = _ref3;
|
|
8592
|
+
const isFloatingWider = rect.width > refRect.width;
|
|
8593
|
+
const isFloatingTaller = rect.height > refRect.height;
|
|
8594
|
+
|
|
8595
|
+
switch (side) {
|
|
8596
|
+
case 'top':
|
|
8597
|
+
{
|
|
8598
|
+
const cursorPointOne = [isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y + buffer + 1];
|
|
8599
|
+
const cursorPointTwo = [isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y + buffer + 1];
|
|
8600
|
+
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]];
|
|
8601
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
8602
|
+
}
|
|
8603
|
+
|
|
8604
|
+
case 'bottom':
|
|
8605
|
+
{
|
|
8606
|
+
const cursorPointOne = [isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y - buffer];
|
|
8607
|
+
const cursorPointTwo = [isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y - buffer];
|
|
8608
|
+
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]];
|
|
8609
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
8610
|
+
}
|
|
8611
|
+
|
|
8612
|
+
case 'left':
|
|
8613
|
+
{
|
|
8614
|
+
const cursorPointOne = [x + buffer + 1, isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];
|
|
8615
|
+
const cursorPointTwo = [x + buffer + 1, isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];
|
|
8616
|
+
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]];
|
|
8617
|
+
return [...commonPoints, cursorPointOne, cursorPointTwo];
|
|
8618
|
+
}
|
|
8619
|
+
|
|
8620
|
+
case 'right':
|
|
8621
|
+
{
|
|
8622
|
+
const cursorPointOne = [x - buffer, isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];
|
|
8623
|
+
const cursorPointTwo = [x - buffer, isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];
|
|
8624
|
+
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]];
|
|
8625
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
8626
|
+
}
|
|
8627
|
+
}
|
|
8628
|
+
}
|
|
8629
|
+
|
|
8630
|
+
const poly = getPolygon([x, y]);
|
|
8631
|
+
|
|
8632
|
+
if (process.env.NODE_ENV !== "production") {
|
|
8633
|
+
debug == null ? void 0 : debug(poly.slice(0, 4).join(', '));
|
|
8634
|
+
}
|
|
8635
|
+
|
|
8636
|
+
if (!isPointInPolygon([clientX, clientY], poly)) {
|
|
8637
|
+
close();
|
|
8638
|
+
} else if (restMs) {
|
|
8639
|
+
timeoutId = setTimeout(onClose, restMs);
|
|
8640
|
+
}
|
|
8641
|
+
};
|
|
8642
|
+
};
|
|
8643
|
+
|
|
8644
|
+
fn.__options = {
|
|
8645
|
+
blockPointerEvents
|
|
8646
|
+
};
|
|
8647
|
+
return fn;
|
|
8648
|
+
}
|
|
8649
|
+
|
|
8448
8650
|
const DEFAULT_ID = 'floating-ui-root';
|
|
8449
8651
|
const useFloatingPortalNode = function (_temp) {
|
|
8450
8652
|
let {
|
|
@@ -14611,7 +14813,7 @@ var Tooltip = /*#__PURE__*/forwardRef(function (props, propRef) {
|
|
|
14611
14813
|
// Event listeners to change the open state
|
|
14612
14814
|
var hover = useHover(context, {
|
|
14613
14815
|
move: true,
|
|
14614
|
-
|
|
14816
|
+
handleClose: clickOutsideToClose ? safePolygon() : undefined
|
|
14615
14817
|
});
|
|
14616
14818
|
var focus = useFocus(context, {
|
|
14617
14819
|
enabled: !clickOutsideToClose
|