react-better-html 1.1.267 → 1.1.269
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.d.mts +10 -4
- package/dist/index.d.ts +10 -4
- package/dist/index.js +25 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2116,7 +2116,10 @@ var ButtonElement = styled6.button.withConfig({
|
|
|
2116
2116
|
${(props) => props.hoverStyle}
|
|
2117
2117
|
}
|
|
2118
2118
|
`;
|
|
2119
|
-
var ButtonComponent = function Button(
|
|
2119
|
+
var ButtonComponent = function Button({
|
|
2120
|
+
fromSubcomponent,
|
|
2121
|
+
...buttonProps
|
|
2122
|
+
}) {
|
|
2120
2123
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2121
2124
|
const {
|
|
2122
2125
|
href,
|
|
@@ -2142,7 +2145,7 @@ var ButtonComponent = function Button(buttonProps) {
|
|
|
2142
2145
|
onClickWithValue,
|
|
2143
2146
|
...props
|
|
2144
2147
|
} = useComponentsPropsMerger(
|
|
2145
|
-
!
|
|
2148
|
+
!fromSubcomponent ? betterHtmlContextInternal.components.button?.style?.default : {},
|
|
2146
2149
|
buttonProps
|
|
2147
2150
|
);
|
|
2148
2151
|
const theme2 = useTheme9();
|
|
@@ -2362,6 +2365,9 @@ import {
|
|
|
2362
2365
|
} from "react-better-core";
|
|
2363
2366
|
import styled7 from "styled-components";
|
|
2364
2367
|
import { Fragment, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2368
|
+
var isAlertModalProps = {
|
|
2369
|
+
isAlert: true
|
|
2370
|
+
};
|
|
2365
2371
|
var DialogStylesElement = styled7.dialog.withConfig({
|
|
2366
2372
|
shouldForwardProp: (prop) => !["theme", "colorTheme", "opacity"].includes(prop)
|
|
2367
2373
|
})`
|
|
@@ -2418,10 +2424,11 @@ var ModalComponent = forwardRef7(function Modal({
|
|
|
2418
2424
|
defaultIsOpened = false,
|
|
2419
2425
|
onOpen,
|
|
2420
2426
|
onClose,
|
|
2427
|
+
isAlert,
|
|
2421
2428
|
children
|
|
2422
2429
|
}, ref) {
|
|
2423
2430
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
2424
|
-
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
2431
|
+
const urlQuery = reactRouterDomPlugin2 && !isAlert ? useUrlQuery() : void 0;
|
|
2425
2432
|
const theme2 = useTheme10();
|
|
2426
2433
|
const { app } = useBetterHtmlContextInternal();
|
|
2427
2434
|
const { colorTheme } = useBetterCoreContext4();
|
|
@@ -2927,7 +2934,7 @@ function Alert2({ alert }) {
|
|
|
2927
2934
|
const animation = `${isRemoved ? getAnimationOutName(pluginConfig.position ?? defaultAlertsPluginOptions.position)[pluginConfig.align ?? defaultAlertsPluginOptions.align] : getAnimationInName(pluginConfig.position ?? defaultAlertsPluginOptions.position)[pluginConfig.align ?? defaultAlertsPluginOptions.align]} ${theme2.styles.transition}`;
|
|
2928
2935
|
const alertTitle = alert.title ?? alertData[alert.type].title;
|
|
2929
2936
|
return defaultAlertDisplay === "prominent" ? /* @__PURE__ */ jsx10(
|
|
2930
|
-
|
|
2937
|
+
ModalComponent,
|
|
2931
2938
|
{
|
|
2932
2939
|
defaultIsOpened: true,
|
|
2933
2940
|
icon: alertData[alert.type].icon,
|
|
@@ -2939,6 +2946,7 @@ function Alert2({ alert }) {
|
|
|
2939
2946
|
headerBackgroundColor: alertData[alert.type].backgroundColor,
|
|
2940
2947
|
withoutCloseButton: true,
|
|
2941
2948
|
ref: modalRef,
|
|
2949
|
+
...isAlertModalProps,
|
|
2942
2950
|
children: /* @__PURE__ */ jsx10(Div_default.row, { width: "100%", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx10(
|
|
2943
2951
|
Button_default,
|
|
2944
2952
|
{
|
|
@@ -7836,7 +7844,7 @@ var useSideMenuContext = () => {
|
|
|
7836
7844
|
}
|
|
7837
7845
|
return context;
|
|
7838
7846
|
};
|
|
7839
|
-
var
|
|
7847
|
+
var MenuItemTypeItem = memo27(function MenuItemTypeItem2({
|
|
7840
7848
|
item,
|
|
7841
7849
|
backgroundColor,
|
|
7842
7850
|
activeItemColor,
|
|
@@ -7864,8 +7872,8 @@ var MenuItemComponent = memo27(function MenuItemComponent2({
|
|
|
7864
7872
|
}
|
|
7865
7873
|
}, [onClick, item, isCollapsed]);
|
|
7866
7874
|
const childrenHaveDot = useMemo12(
|
|
7867
|
-
() => item.children?.some((child) => child.withDot) ?? false,
|
|
7868
|
-
[item
|
|
7875
|
+
() => item.children?.some((child) => child.type === "item" && child.withDot) ?? false,
|
|
7876
|
+
[item]
|
|
7869
7877
|
);
|
|
7870
7878
|
const isActive = activeItem && item.href && activeItem.href === item.href;
|
|
7871
7879
|
const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
|
|
@@ -7970,7 +7978,7 @@ var MenuItemComponent = memo27(function MenuItemComponent2({
|
|
|
7970
7978
|
useEffect16(() => {
|
|
7971
7979
|
if (!item.children) return;
|
|
7972
7980
|
const toBeOpened = item.children.some(
|
|
7973
|
-
(child) => child.href ? location.pathname === "/" ? location.pathname === child.href : location.pathname.startsWith(child.href) && child.href !== "/" : false
|
|
7981
|
+
(child) => child.type === "item" ? child.href ? location.pathname === "/" ? location.pathname === child.href : location.pathname.startsWith(child.href) && child.href !== "/" : false : false
|
|
7974
7982
|
);
|
|
7975
7983
|
if (!isCollapsed) setIsOpened.setState(toBeOpened);
|
|
7976
7984
|
}, [item, isCollapsed]);
|
|
@@ -7979,7 +7987,7 @@ var MenuItemComponent = memo27(function MenuItemComponent2({
|
|
|
7979
7987
|
setIsOpened.setFalse();
|
|
7980
7988
|
}, [isCollapsed]);
|
|
7981
7989
|
const LinkComponentTag = components.button?.tagReplacement?.linkComponent ?? "a";
|
|
7982
|
-
return /* @__PURE__ */ jsxs24(
|
|
7990
|
+
return /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
7983
7991
|
item.href ? /* @__PURE__ */ jsx27(LinkComponentTag, { to: item.href, href: item.href, onClick: onClickElement, children: content }) : content,
|
|
7984
7992
|
item.children && /* @__PURE__ */ jsxs24(
|
|
7985
7993
|
Div_default.column,
|
|
@@ -7993,7 +8001,7 @@ var MenuItemComponent = memo27(function MenuItemComponent2({
|
|
|
7993
8001
|
transition: `max-height ${theme2.styles.transition}, margin-top ${theme2.styles.transition}`,
|
|
7994
8002
|
children: [
|
|
7995
8003
|
item.children.map((child) => /* @__PURE__ */ jsx27(
|
|
7996
|
-
|
|
8004
|
+
MenuItemComponent,
|
|
7997
8005
|
{
|
|
7998
8006
|
item: child,
|
|
7999
8007
|
backgroundColor: readyBackgroundColor,
|
|
@@ -8045,6 +8053,13 @@ var MenuItemComponent = memo27(function MenuItemComponent2({
|
|
|
8045
8053
|
)
|
|
8046
8054
|
] });
|
|
8047
8055
|
});
|
|
8056
|
+
var MenuItemTypeDivider = memo27(function MenuItemTypeDivider2({ item }) {
|
|
8057
|
+
const theme2 = useTheme29();
|
|
8058
|
+
return /* @__PURE__ */ jsx27(Div_default.row, { paddingTop: theme2.styles.space, paddingInline: theme2.styles.gap, children: /* @__PURE__ */ jsx27(Text_default, { fontSize: 12, fontWeight: 700, textTransform: "uppercase", color: theme2.colors.textSecondary, children: item.text }) });
|
|
8059
|
+
});
|
|
8060
|
+
var MenuItemComponent = memo27(function MenuItemComponent2({ item, ...props }) {
|
|
8061
|
+
return /* @__PURE__ */ jsx27(Div_default, { width: "100%", children: item.type === "item" ? /* @__PURE__ */ jsx27(MenuItemTypeItem, { item, ...props }) : item.type === "divider" ? /* @__PURE__ */ jsx27(MenuItemTypeDivider, { item }) : void 0 });
|
|
8062
|
+
});
|
|
8048
8063
|
var SideMenuComponent = function SideMenu({
|
|
8049
8064
|
items,
|
|
8050
8065
|
bottomItems,
|