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.d.mts
CHANGED
|
@@ -164,7 +164,7 @@ declare const InputField: typeof InputFieldComponent & {
|
|
|
164
164
|
color: typeof InputFieldComponent.color;
|
|
165
165
|
};
|
|
166
166
|
|
|
167
|
-
type TextAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "label";
|
|
167
|
+
type TextAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "label" | "li";
|
|
168
168
|
type TextProps<As extends TextAs = "p"> = {
|
|
169
169
|
/** @default "p" */
|
|
170
170
|
as?: As;
|
|
@@ -694,7 +694,7 @@ type IconComponent = {
|
|
|
694
694
|
};
|
|
695
695
|
declare const _default: IconComponent;
|
|
696
696
|
|
|
697
|
-
type
|
|
697
|
+
type InternalModalProps = {
|
|
698
698
|
/**
|
|
699
699
|
* If you want to have a small modal, you can use 660px as it looks good on most screens.
|
|
700
700
|
*
|
|
@@ -717,8 +717,10 @@ type ModalProps = {
|
|
|
717
717
|
defaultIsOpened?: boolean;
|
|
718
718
|
onOpen?: () => void;
|
|
719
719
|
onClose?: () => void;
|
|
720
|
+
isAlert?: boolean;
|
|
720
721
|
children?: React.ReactNode;
|
|
721
722
|
};
|
|
723
|
+
type ModalProps = OmitProps<InternalModalProps, "isAlert">;
|
|
722
724
|
type ModalRef = {
|
|
723
725
|
isOpened: boolean;
|
|
724
726
|
open: () => void;
|
|
@@ -1074,16 +1076,20 @@ declare const Foldable: typeof FoldableComponent & {
|
|
|
1074
1076
|
|
|
1075
1077
|
type SideMenuItem = {
|
|
1076
1078
|
text: string;
|
|
1079
|
+
hidden?: boolean;
|
|
1080
|
+
} & ({
|
|
1081
|
+
type: "item";
|
|
1077
1082
|
iconName: IconName | AnyOtherString;
|
|
1078
1083
|
href?: string;
|
|
1079
1084
|
disabled?: boolean;
|
|
1080
|
-
hidden?: boolean;
|
|
1081
1085
|
withDot?: boolean;
|
|
1082
1086
|
children?: SideMenuItem[];
|
|
1083
1087
|
/** @default true */
|
|
1084
1088
|
onClickCloseSideMenu?: boolean;
|
|
1085
1089
|
onClick?: (item: SideMenuItem) => void;
|
|
1086
|
-
}
|
|
1090
|
+
} | {
|
|
1091
|
+
type: "divider";
|
|
1092
|
+
});
|
|
1087
1093
|
type SideMenuProps = {
|
|
1088
1094
|
items: SideMenuItem[];
|
|
1089
1095
|
bottomItems?: SideMenuItem[];
|
package/dist/index.d.ts
CHANGED
|
@@ -164,7 +164,7 @@ declare const InputField: typeof InputFieldComponent & {
|
|
|
164
164
|
color: typeof InputFieldComponent.color;
|
|
165
165
|
};
|
|
166
166
|
|
|
167
|
-
type TextAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "label";
|
|
167
|
+
type TextAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "label" | "li";
|
|
168
168
|
type TextProps<As extends TextAs = "p"> = {
|
|
169
169
|
/** @default "p" */
|
|
170
170
|
as?: As;
|
|
@@ -694,7 +694,7 @@ type IconComponent = {
|
|
|
694
694
|
};
|
|
695
695
|
declare const _default: IconComponent;
|
|
696
696
|
|
|
697
|
-
type
|
|
697
|
+
type InternalModalProps = {
|
|
698
698
|
/**
|
|
699
699
|
* If you want to have a small modal, you can use 660px as it looks good on most screens.
|
|
700
700
|
*
|
|
@@ -717,8 +717,10 @@ type ModalProps = {
|
|
|
717
717
|
defaultIsOpened?: boolean;
|
|
718
718
|
onOpen?: () => void;
|
|
719
719
|
onClose?: () => void;
|
|
720
|
+
isAlert?: boolean;
|
|
720
721
|
children?: React.ReactNode;
|
|
721
722
|
};
|
|
723
|
+
type ModalProps = OmitProps<InternalModalProps, "isAlert">;
|
|
722
724
|
type ModalRef = {
|
|
723
725
|
isOpened: boolean;
|
|
724
726
|
open: () => void;
|
|
@@ -1074,16 +1076,20 @@ declare const Foldable: typeof FoldableComponent & {
|
|
|
1074
1076
|
|
|
1075
1077
|
type SideMenuItem = {
|
|
1076
1078
|
text: string;
|
|
1079
|
+
hidden?: boolean;
|
|
1080
|
+
} & ({
|
|
1081
|
+
type: "item";
|
|
1077
1082
|
iconName: IconName | AnyOtherString;
|
|
1078
1083
|
href?: string;
|
|
1079
1084
|
disabled?: boolean;
|
|
1080
|
-
hidden?: boolean;
|
|
1081
1085
|
withDot?: boolean;
|
|
1082
1086
|
children?: SideMenuItem[];
|
|
1083
1087
|
/** @default true */
|
|
1084
1088
|
onClickCloseSideMenu?: boolean;
|
|
1085
1089
|
onClick?: (item: SideMenuItem) => void;
|
|
1086
|
-
}
|
|
1090
|
+
} | {
|
|
1091
|
+
type: "divider";
|
|
1092
|
+
});
|
|
1087
1093
|
type SideMenuProps = {
|
|
1088
1094
|
items: SideMenuItem[];
|
|
1089
1095
|
bottomItems?: SideMenuItem[];
|
package/dist/index.js
CHANGED
|
@@ -2183,7 +2183,10 @@ var ButtonElement = import_styled_components6.default.button.withConfig({
|
|
|
2183
2183
|
${(props) => props.hoverStyle}
|
|
2184
2184
|
}
|
|
2185
2185
|
`;
|
|
2186
|
-
var ButtonComponent = function Button(
|
|
2186
|
+
var ButtonComponent = function Button({
|
|
2187
|
+
fromSubcomponent,
|
|
2188
|
+
...buttonProps
|
|
2189
|
+
}) {
|
|
2187
2190
|
const betterHtmlContextInternal = useBetterHtmlContextInternal();
|
|
2188
2191
|
const {
|
|
2189
2192
|
href,
|
|
@@ -2209,7 +2212,7 @@ var ButtonComponent = function Button(buttonProps) {
|
|
|
2209
2212
|
onClickWithValue,
|
|
2210
2213
|
...props
|
|
2211
2214
|
} = useComponentsPropsMerger(
|
|
2212
|
-
!
|
|
2215
|
+
!fromSubcomponent ? betterHtmlContextInternal.components.button?.style?.default : {},
|
|
2213
2216
|
buttonProps
|
|
2214
2217
|
);
|
|
2215
2218
|
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
@@ -2425,6 +2428,9 @@ var import_react_dom = require("react-dom");
|
|
|
2425
2428
|
var import_react_better_core10 = require("react-better-core");
|
|
2426
2429
|
var import_styled_components7 = __toESM(require("styled-components"));
|
|
2427
2430
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2431
|
+
var isAlertModalProps = {
|
|
2432
|
+
isAlert: true
|
|
2433
|
+
};
|
|
2428
2434
|
var DialogStylesElement = import_styled_components7.default.dialog.withConfig({
|
|
2429
2435
|
shouldForwardProp: (prop) => !["theme", "colorTheme", "opacity"].includes(prop)
|
|
2430
2436
|
})`
|
|
@@ -2481,10 +2487,11 @@ var ModalComponent = (0, import_react11.forwardRef)(function Modal({
|
|
|
2481
2487
|
defaultIsOpened = false,
|
|
2482
2488
|
onOpen,
|
|
2483
2489
|
onClose,
|
|
2490
|
+
isAlert,
|
|
2484
2491
|
children
|
|
2485
2492
|
}, ref) {
|
|
2486
2493
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
2487
|
-
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
2494
|
+
const urlQuery = reactRouterDomPlugin2 && !isAlert ? useUrlQuery() : void 0;
|
|
2488
2495
|
const theme2 = (0, import_react_better_core10.useTheme)();
|
|
2489
2496
|
const { app } = useBetterHtmlContextInternal();
|
|
2490
2497
|
const { colorTheme } = (0, import_react_better_core10.useBetterCoreContext)();
|
|
@@ -2990,7 +2997,7 @@ function Alert2({ alert }) {
|
|
|
2990
2997
|
const animation = `${isRemoved ? getAnimationOutName(pluginConfig.position ?? defaultAlertsPluginOptions.position)[pluginConfig.align ?? defaultAlertsPluginOptions.align] : getAnimationInName(pluginConfig.position ?? defaultAlertsPluginOptions.position)[pluginConfig.align ?? defaultAlertsPluginOptions.align]} ${theme2.styles.transition}`;
|
|
2991
2998
|
const alertTitle = alert.title ?? alertData[alert.type].title;
|
|
2992
2999
|
return defaultAlertDisplay === "prominent" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2993
|
-
|
|
3000
|
+
ModalComponent,
|
|
2994
3001
|
{
|
|
2995
3002
|
defaultIsOpened: true,
|
|
2996
3003
|
icon: alertData[alert.type].icon,
|
|
@@ -3002,6 +3009,7 @@ function Alert2({ alert }) {
|
|
|
3002
3009
|
headerBackgroundColor: alertData[alert.type].backgroundColor,
|
|
3003
3010
|
withoutCloseButton: true,
|
|
3004
3011
|
ref: modalRef,
|
|
3012
|
+
...isAlertModalProps,
|
|
3005
3013
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Div_default.row, { width: "100%", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3006
3014
|
Button_default,
|
|
3007
3015
|
{
|
|
@@ -7869,7 +7877,7 @@ var useSideMenuContext = () => {
|
|
|
7869
7877
|
}
|
|
7870
7878
|
return context;
|
|
7871
7879
|
};
|
|
7872
|
-
var
|
|
7880
|
+
var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
|
|
7873
7881
|
item,
|
|
7874
7882
|
backgroundColor,
|
|
7875
7883
|
activeItemColor,
|
|
@@ -7897,8 +7905,8 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
|
|
|
7897
7905
|
}
|
|
7898
7906
|
}, [onClick, item, isCollapsed]);
|
|
7899
7907
|
const childrenHaveDot = (0, import_react31.useMemo)(
|
|
7900
|
-
() => item.children?.some((child) => child.withDot) ?? false,
|
|
7901
|
-
[item
|
|
7908
|
+
() => item.children?.some((child) => child.type === "item" && child.withDot) ?? false,
|
|
7909
|
+
[item]
|
|
7902
7910
|
);
|
|
7903
7911
|
const isActive = activeItem && item.href && activeItem.href === item.href;
|
|
7904
7912
|
const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
|
|
@@ -8003,7 +8011,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
|
|
|
8003
8011
|
(0, import_react31.useEffect)(() => {
|
|
8004
8012
|
if (!item.children) return;
|
|
8005
8013
|
const toBeOpened = item.children.some(
|
|
8006
|
-
(child) => child.href ? location.pathname === "/" ? location.pathname === child.href : location.pathname.startsWith(child.href) && child.href !== "/" : false
|
|
8014
|
+
(child) => child.type === "item" ? child.href ? location.pathname === "/" ? location.pathname === child.href : location.pathname.startsWith(child.href) && child.href !== "/" : false : false
|
|
8007
8015
|
);
|
|
8008
8016
|
if (!isCollapsed) setIsOpened.setState(toBeOpened);
|
|
8009
8017
|
}, [item, isCollapsed]);
|
|
@@ -8012,7 +8020,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
|
|
|
8012
8020
|
setIsOpened.setFalse();
|
|
8013
8021
|
}, [isCollapsed]);
|
|
8014
8022
|
const LinkComponentTag = components.button?.tagReplacement?.linkComponent ?? "a";
|
|
8015
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
8023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
8016
8024
|
item.href ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LinkComponentTag, { to: item.href, href: item.href, onClick: onClickElement, children: content }) : content,
|
|
8017
8025
|
item.children && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
8018
8026
|
Div_default.column,
|
|
@@ -8026,7 +8034,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
|
|
|
8026
8034
|
transition: `max-height ${theme2.styles.transition}, margin-top ${theme2.styles.transition}`,
|
|
8027
8035
|
children: [
|
|
8028
8036
|
item.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
8029
|
-
|
|
8037
|
+
MenuItemComponent,
|
|
8030
8038
|
{
|
|
8031
8039
|
item: child,
|
|
8032
8040
|
backgroundColor: readyBackgroundColor,
|
|
@@ -8078,6 +8086,13 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
|
|
|
8078
8086
|
)
|
|
8079
8087
|
] });
|
|
8080
8088
|
});
|
|
8089
|
+
var MenuItemTypeDivider = (0, import_react31.memo)(function MenuItemTypeDivider2({ item }) {
|
|
8090
|
+
const theme2 = (0, import_react_better_core29.useTheme)();
|
|
8091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Div_default.row, { paddingTop: theme2.styles.space, paddingInline: theme2.styles.gap, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text_default, { fontSize: 12, fontWeight: 700, textTransform: "uppercase", color: theme2.colors.textSecondary, children: item.text }) });
|
|
8092
|
+
});
|
|
8093
|
+
var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ item, ...props }) {
|
|
8094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Div_default, { width: "100%", children: item.type === "item" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(MenuItemTypeItem, { item, ...props }) : item.type === "divider" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(MenuItemTypeDivider, { item }) : void 0 });
|
|
8095
|
+
});
|
|
8081
8096
|
var SideMenuComponent = function SideMenu({
|
|
8082
8097
|
items,
|
|
8083
8098
|
bottomItems,
|