@homebound/beam 3.8.0 → 3.9.1
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/index.cjs +32 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.js +33 -26
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -8574,16 +8574,16 @@ interface SuperDrawerContentProps {
|
|
|
8574
8574
|
*/
|
|
8575
8575
|
declare const SuperDrawerContent: ({ children, actions }: SuperDrawerContentProps) => JSX.Element;
|
|
8576
8576
|
|
|
8577
|
-
|
|
8577
|
+
type Tab<V extends string = string> = {
|
|
8578
8578
|
name: string;
|
|
8579
8579
|
value: V;
|
|
8580
8580
|
icon?: IconKey;
|
|
8581
8581
|
endAdornment?: ReactNode;
|
|
8582
8582
|
/** Whether the Tab is disabled. If a ReactNode, it's treated as a "disabled reason" that's shown in a tooltip. */
|
|
8583
8583
|
disabled?: boolean | ReactNode;
|
|
8584
|
-
}
|
|
8584
|
+
};
|
|
8585
8585
|
type TabsContentXss = Xss<Margin | Padding | "backgroundColor">;
|
|
8586
|
-
|
|
8586
|
+
type TabsProps<V extends string, X> = {
|
|
8587
8587
|
ariaLabel?: string;
|
|
8588
8588
|
selected: V;
|
|
8589
8589
|
tabs: Tab<V>[];
|
|
@@ -8594,26 +8594,26 @@ interface TabsProps<V extends string, X> {
|
|
|
8594
8594
|
alwaysShowAllTabs?: boolean;
|
|
8595
8595
|
includeBottomBorder?: boolean;
|
|
8596
8596
|
right?: ReactNode;
|
|
8597
|
-
}
|
|
8598
|
-
|
|
8597
|
+
};
|
|
8598
|
+
type RouteTabsProps<V extends string, X> = {
|
|
8599
8599
|
tabs: RouteTab<V>[];
|
|
8600
|
-
}
|
|
8601
|
-
|
|
8600
|
+
} & Omit<TabsProps<V, X>, "onChange" | "selected" | "tabs">;
|
|
8601
|
+
type RouteTab<V extends string = string> = {
|
|
8602
8602
|
href: V;
|
|
8603
8603
|
path: string | string[];
|
|
8604
|
-
}
|
|
8605
|
-
|
|
8604
|
+
} & Omit<Tab<V>, "value">;
|
|
8605
|
+
type TabWithContent<V extends string = string> = {
|
|
8606
8606
|
render: () => ReactNode;
|
|
8607
|
-
}
|
|
8608
|
-
|
|
8607
|
+
} & Omit<Tab<V>, "render">;
|
|
8608
|
+
type RouteTabWithContent<V extends string = string> = {
|
|
8609
8609
|
render: () => ReactNode;
|
|
8610
|
-
}
|
|
8611
|
-
|
|
8610
|
+
} & Omit<RouteTab<V>, "render">;
|
|
8611
|
+
type RequiredRenderTabs<V extends string, X> = {
|
|
8612
8612
|
tabs: TabWithContent<V>[];
|
|
8613
|
-
}
|
|
8614
|
-
|
|
8613
|
+
} & Omit<TabsProps<V, X>, "tabs">;
|
|
8614
|
+
type RequiredRenderRouteTabs<V extends string, X> = {
|
|
8615
8615
|
tabs: RouteTabWithContent<V>[];
|
|
8616
|
-
}
|
|
8616
|
+
} & Omit<RouteTabsProps<V, X>, "tabs">;
|
|
8617
8617
|
/**
|
|
8618
8618
|
* Provides a list of tabs and their content.
|
|
8619
8619
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -8574,16 +8574,16 @@ interface SuperDrawerContentProps {
|
|
|
8574
8574
|
*/
|
|
8575
8575
|
declare const SuperDrawerContent: ({ children, actions }: SuperDrawerContentProps) => JSX.Element;
|
|
8576
8576
|
|
|
8577
|
-
|
|
8577
|
+
type Tab<V extends string = string> = {
|
|
8578
8578
|
name: string;
|
|
8579
8579
|
value: V;
|
|
8580
8580
|
icon?: IconKey;
|
|
8581
8581
|
endAdornment?: ReactNode;
|
|
8582
8582
|
/** Whether the Tab is disabled. If a ReactNode, it's treated as a "disabled reason" that's shown in a tooltip. */
|
|
8583
8583
|
disabled?: boolean | ReactNode;
|
|
8584
|
-
}
|
|
8584
|
+
};
|
|
8585
8585
|
type TabsContentXss = Xss<Margin | Padding | "backgroundColor">;
|
|
8586
|
-
|
|
8586
|
+
type TabsProps<V extends string, X> = {
|
|
8587
8587
|
ariaLabel?: string;
|
|
8588
8588
|
selected: V;
|
|
8589
8589
|
tabs: Tab<V>[];
|
|
@@ -8594,26 +8594,26 @@ interface TabsProps<V extends string, X> {
|
|
|
8594
8594
|
alwaysShowAllTabs?: boolean;
|
|
8595
8595
|
includeBottomBorder?: boolean;
|
|
8596
8596
|
right?: ReactNode;
|
|
8597
|
-
}
|
|
8598
|
-
|
|
8597
|
+
};
|
|
8598
|
+
type RouteTabsProps<V extends string, X> = {
|
|
8599
8599
|
tabs: RouteTab<V>[];
|
|
8600
|
-
}
|
|
8601
|
-
|
|
8600
|
+
} & Omit<TabsProps<V, X>, "onChange" | "selected" | "tabs">;
|
|
8601
|
+
type RouteTab<V extends string = string> = {
|
|
8602
8602
|
href: V;
|
|
8603
8603
|
path: string | string[];
|
|
8604
|
-
}
|
|
8605
|
-
|
|
8604
|
+
} & Omit<Tab<V>, "value">;
|
|
8605
|
+
type TabWithContent<V extends string = string> = {
|
|
8606
8606
|
render: () => ReactNode;
|
|
8607
|
-
}
|
|
8608
|
-
|
|
8607
|
+
} & Omit<Tab<V>, "render">;
|
|
8608
|
+
type RouteTabWithContent<V extends string = string> = {
|
|
8609
8609
|
render: () => ReactNode;
|
|
8610
|
-
}
|
|
8611
|
-
|
|
8610
|
+
} & Omit<RouteTab<V>, "render">;
|
|
8611
|
+
type RequiredRenderTabs<V extends string, X> = {
|
|
8612
8612
|
tabs: TabWithContent<V>[];
|
|
8613
|
-
}
|
|
8614
|
-
|
|
8613
|
+
} & Omit<TabsProps<V, X>, "tabs">;
|
|
8614
|
+
type RequiredRenderRouteTabs<V extends string, X> = {
|
|
8615
8615
|
tabs: RouteTabWithContent<V>[];
|
|
8616
|
-
}
|
|
8616
|
+
} & Omit<RouteTabsProps<V, X>, "tabs">;
|
|
8617
8617
|
/**
|
|
8618
8618
|
* Provides a list of tabs and their content.
|
|
8619
8619
|
*
|
package/dist/index.js
CHANGED
|
@@ -8735,8 +8735,7 @@ function Menu(props) {
|
|
|
8735
8735
|
// src/components/internal/MenuItem.tsx
|
|
8736
8736
|
import { useRef as useRef14 } from "react";
|
|
8737
8737
|
import { useHover as useHover7, useMenuItem } from "react-aria";
|
|
8738
|
-
import {
|
|
8739
|
-
import { Link as Link3 } from "react-router-dom";
|
|
8738
|
+
import { Link as Link3, useNavigate } from "react-router-dom";
|
|
8740
8739
|
|
|
8741
8740
|
// src/components/Avatar/Avatar.tsx
|
|
8742
8741
|
import { useState as useState12 } from "react";
|
|
@@ -9771,20 +9770,8 @@ function MenuItemImpl(props) {
|
|
|
9771
9770
|
onClose
|
|
9772
9771
|
} = props;
|
|
9773
9772
|
const menuItem = item.value;
|
|
9774
|
-
if (!menuItem) {
|
|
9775
|
-
return null;
|
|
9776
|
-
}
|
|
9777
|
-
const {
|
|
9778
|
-
disabled,
|
|
9779
|
-
onClick,
|
|
9780
|
-
label,
|
|
9781
|
-
destructive
|
|
9782
|
-
} = menuItem;
|
|
9783
|
-
const isDisabled = Boolean(disabled);
|
|
9784
|
-
const isSelected = state.selectionManager.selectedKeys.has(label);
|
|
9785
|
-
const isFocused = state.selectionManager.focusedKey === item.key;
|
|
9786
9773
|
const ref = useRef14(null);
|
|
9787
|
-
const
|
|
9774
|
+
const navigate = useNavigate();
|
|
9788
9775
|
const {
|
|
9789
9776
|
hoverProps,
|
|
9790
9777
|
isHovered
|
|
@@ -9794,20 +9781,37 @@ function MenuItemImpl(props) {
|
|
|
9794
9781
|
menuItemProps
|
|
9795
9782
|
} = useMenuItem({
|
|
9796
9783
|
key: item.key,
|
|
9797
|
-
isDisabled,
|
|
9784
|
+
isDisabled: Boolean(menuItem?.disabled),
|
|
9798
9785
|
onAction: () => {
|
|
9786
|
+
if (!menuItem) {
|
|
9787
|
+
return;
|
|
9788
|
+
}
|
|
9789
|
+
const {
|
|
9790
|
+
onClick
|
|
9791
|
+
} = menuItem;
|
|
9799
9792
|
if (typeof onClick === "string") {
|
|
9800
9793
|
if (isAbsoluteUrl(onClick)) {
|
|
9801
9794
|
window.open(onClick, "_blank").opener = null;
|
|
9802
9795
|
return;
|
|
9803
9796
|
}
|
|
9804
|
-
|
|
9797
|
+
navigate(onClick);
|
|
9805
9798
|
return;
|
|
9806
9799
|
}
|
|
9807
9800
|
onClick && onClick();
|
|
9808
9801
|
},
|
|
9809
9802
|
onClose
|
|
9810
9803
|
}, state, ref);
|
|
9804
|
+
if (!menuItem) {
|
|
9805
|
+
return null;
|
|
9806
|
+
}
|
|
9807
|
+
const {
|
|
9808
|
+
disabled,
|
|
9809
|
+
label,
|
|
9810
|
+
destructive
|
|
9811
|
+
} = menuItem;
|
|
9812
|
+
const isDisabled = Boolean(disabled);
|
|
9813
|
+
const isSelected = state.selectionManager.selectedKeys.has(label);
|
|
9814
|
+
const isFocused = state.selectionManager.focusedKey === item.key;
|
|
9811
9815
|
return /* @__PURE__ */ jsx41("li", { ...menuItemProps, ...hoverProps, ref, ...trussProps27({
|
|
9812
9816
|
...{
|
|
9813
9817
|
display: "df",
|
|
@@ -21618,7 +21622,7 @@ function visit(rows, fn) {
|
|
|
21618
21622
|
import { camelCase as camelCase5 } from "change-case";
|
|
21619
21623
|
import { useEffect as useEffect33, useMemo as useMemo49, useRef as useRef54, useState as useState48 } from "react";
|
|
21620
21624
|
import { mergeProps as mergeProps26, useFocusRing as useFocusRing15, useHover as useHover19 } from "react-aria";
|
|
21621
|
-
import { matchPath
|
|
21625
|
+
import { matchPath } from "react-router";
|
|
21622
21626
|
import { Link as Link5, useLocation } from "react-router-dom";
|
|
21623
21627
|
import { trussProps as trussProps85, maybeCssVar as maybeCssVar44 } from "@homebound/truss/runtime";
|
|
21624
21628
|
import { Fragment as Fragment40, jsx as jsx171, jsxs as jsxs90 } from "react/jsx-runtime";
|
|
@@ -21644,16 +21648,16 @@ function TabContent(props) {
|
|
|
21644
21648
|
const location = useLocation();
|
|
21645
21649
|
const selectedTab = isRouteTabs(props) ? props.tabs.find((t) => {
|
|
21646
21650
|
const paths = Array.isArray(t.path) ? t.path : [t.path];
|
|
21647
|
-
return paths.some((p) => !!matchPath(
|
|
21651
|
+
return paths.some((p) => !!matchPath({
|
|
21648
21652
|
path: p,
|
|
21649
|
-
|
|
21650
|
-
}));
|
|
21653
|
+
end: true
|
|
21654
|
+
}, location.pathname));
|
|
21651
21655
|
}) || tabs[0] : props.tabs.find((tab) => tab.value === props.selected) || tabs[0];
|
|
21652
21656
|
const uniqueValue = uniqueTabValue(selectedTab);
|
|
21653
21657
|
return (
|
|
21654
21658
|
// Using FullBleed to allow the tab's bgColor to extend to the edges of the <ScrollableContent /> element.
|
|
21655
21659
|
// Omit the padding from `FullBleed` if the caller passes in the `paddingLeft/Right` styles.
|
|
21656
|
-
/* @__PURE__ */ jsx171(FullBleed, { omitPadding: omitFullBleedPadding, children: /* @__PURE__ */ jsx171("div", { "aria-labelledby": `${uniqueValue}-tab`, id: `${uniqueValue}-tabPanel`, role: "tabpanel", tabIndex: 0, ...tid.panel, ...trussProps85(contentXss), children:
|
|
21660
|
+
/* @__PURE__ */ jsx171(FullBleed, { omitPadding: omitFullBleedPadding, children: /* @__PURE__ */ jsx171("div", { "aria-labelledby": `${uniqueValue}-tab`, id: `${uniqueValue}-tabPanel`, role: "tabpanel", tabIndex: 0, ...tid.panel, ...trussProps85(contentXss), children: selectedTab.render() }) })
|
|
21657
21661
|
);
|
|
21658
21662
|
}
|
|
21659
21663
|
function Tabs(props) {
|
|
@@ -21665,10 +21669,13 @@ function Tabs(props) {
|
|
|
21665
21669
|
...others
|
|
21666
21670
|
} = props;
|
|
21667
21671
|
const location = useLocation();
|
|
21668
|
-
const selected = isRouteTabs(props) ? uniqueTabValue(props.tabs.find((t) =>
|
|
21669
|
-
path: t.path
|
|
21670
|
-
|
|
21671
|
-
|
|
21672
|
+
const selected = isRouteTabs(props) ? uniqueTabValue(props.tabs.find((t) => {
|
|
21673
|
+
const paths = Array.isArray(t.path) ? t.path : [t.path];
|
|
21674
|
+
return paths.some((p) => !!matchPath({
|
|
21675
|
+
path: p,
|
|
21676
|
+
end: true
|
|
21677
|
+
}, location.pathname));
|
|
21678
|
+
}) || props.tabs[0]) : props.selected;
|
|
21672
21679
|
const {
|
|
21673
21680
|
isFocusVisible,
|
|
21674
21681
|
focusProps
|