react-better-html 1.1.196 → 1.1.198
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 +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +120 -89
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +121 -90
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -704,8 +704,8 @@ declare const ColorThemeSwitch: typeof ColorThemeSwitchComponent & {
|
|
|
704
704
|
|
|
705
705
|
type FilterPreset = "today" | "yesterday" | "tomorrow" | "thisWeek" | "thisMonth" | "thisYear" | "lastWeek" | "lastMonth" | "lastYear" | "nextWeek" | "nextMonth" | "nextYear";
|
|
706
706
|
type ListFilterValue = {
|
|
707
|
+
value: number | string | boolean;
|
|
707
708
|
label?: string;
|
|
708
|
-
value: number | string;
|
|
709
709
|
count: number;
|
|
710
710
|
};
|
|
711
711
|
type TableFilterData = {
|
|
@@ -829,9 +829,11 @@ type TooltipProps = {
|
|
|
829
829
|
content: React.ReactNode;
|
|
830
830
|
contentWidth?: React.CSSProperties["width"];
|
|
831
831
|
contentMinWidth?: React.CSSProperties["minWidth"];
|
|
832
|
+
contentPointerEvents?: React.CSSProperties["pointerEvents"];
|
|
832
833
|
/** @default "fit-content" */
|
|
833
834
|
childrenWrapperWidth?: React.CSSProperties["width"];
|
|
834
835
|
childrenWrapperHeight?: React.CSSProperties["height"];
|
|
836
|
+
disabled?: boolean;
|
|
835
837
|
withArrow?: boolean;
|
|
836
838
|
isSmall?: boolean;
|
|
837
839
|
backgroundColor?: string;
|
|
@@ -967,6 +969,7 @@ type SideMenuProps = {
|
|
|
967
969
|
widthMobileHandle?: boolean;
|
|
968
970
|
absoluteComponent?: React.ReactNode;
|
|
969
971
|
additionalComponent?: React.ReactNode;
|
|
972
|
+
isLoading?: boolean;
|
|
970
973
|
/** @default backgroundContent */
|
|
971
974
|
backgroundColor?: React.CSSProperties["backgroundColor"];
|
|
972
975
|
paddingTop?: React.CSSProperties["paddingTop"];
|
package/dist/index.d.ts
CHANGED
|
@@ -704,8 +704,8 @@ declare const ColorThemeSwitch: typeof ColorThemeSwitchComponent & {
|
|
|
704
704
|
|
|
705
705
|
type FilterPreset = "today" | "yesterday" | "tomorrow" | "thisWeek" | "thisMonth" | "thisYear" | "lastWeek" | "lastMonth" | "lastYear" | "nextWeek" | "nextMonth" | "nextYear";
|
|
706
706
|
type ListFilterValue = {
|
|
707
|
+
value: number | string | boolean;
|
|
707
708
|
label?: string;
|
|
708
|
-
value: number | string;
|
|
709
709
|
count: number;
|
|
710
710
|
};
|
|
711
711
|
type TableFilterData = {
|
|
@@ -829,9 +829,11 @@ type TooltipProps = {
|
|
|
829
829
|
content: React.ReactNode;
|
|
830
830
|
contentWidth?: React.CSSProperties["width"];
|
|
831
831
|
contentMinWidth?: React.CSSProperties["minWidth"];
|
|
832
|
+
contentPointerEvents?: React.CSSProperties["pointerEvents"];
|
|
832
833
|
/** @default "fit-content" */
|
|
833
834
|
childrenWrapperWidth?: React.CSSProperties["width"];
|
|
834
835
|
childrenWrapperHeight?: React.CSSProperties["height"];
|
|
836
|
+
disabled?: boolean;
|
|
835
837
|
withArrow?: boolean;
|
|
836
838
|
isSmall?: boolean;
|
|
837
839
|
backgroundColor?: string;
|
|
@@ -967,6 +969,7 @@ type SideMenuProps = {
|
|
|
967
969
|
widthMobileHandle?: boolean;
|
|
968
970
|
absoluteComponent?: React.ReactNode;
|
|
969
971
|
additionalComponent?: React.ReactNode;
|
|
972
|
+
isLoading?: boolean;
|
|
970
973
|
/** @default backgroundContent */
|
|
971
974
|
backgroundColor?: React.CSSProperties["backgroundColor"];
|
|
972
975
|
paddingTop?: React.CSSProperties["paddingTop"];
|
package/dist/index.js
CHANGED
|
@@ -5924,7 +5924,7 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
5924
5924
|
filter: isFocused2 ? isDisabled ? "brightness(0.95)" : "brightness(0.9)" : void 0,
|
|
5925
5925
|
filterHover: focusedOptionIndex === void 0 && !isDisabled ? "brightness(0.9)" : void 0,
|
|
5926
5926
|
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
5927
|
-
padding: `${theme2.styles.
|
|
5927
|
+
padding: `${theme2.styles.gap}px ${theme2.styles.space}px`,
|
|
5928
5928
|
value: option,
|
|
5929
5929
|
onClickWithValue: onClickOption,
|
|
5930
5930
|
onMouseMove: () => setFocusedOptionIndex(void 0),
|
|
@@ -6840,6 +6840,13 @@ InputFieldComponent.phoneNumber = (0, import_react20.forwardRef)(function PhoneN
|
|
|
6840
6840
|
] }),
|
|
6841
6841
|
[]
|
|
6842
6842
|
);
|
|
6843
|
+
const onChangeDropdown = (0, import_react20.useCallback)(
|
|
6844
|
+
(value2) => {
|
|
6845
|
+
setDropdownValue(value2);
|
|
6846
|
+
onChangeValue?.(value2 ? `+${value2}${inputFieldValue}` : inputFieldValue);
|
|
6847
|
+
},
|
|
6848
|
+
[onChangeValue, inputFieldValue]
|
|
6849
|
+
);
|
|
6843
6850
|
const onChangeValueElement = (0, import_react20.useCallback)(
|
|
6844
6851
|
(value2) => {
|
|
6845
6852
|
const readyValue = value2.replace(/\D/g, "");
|
|
@@ -6904,7 +6911,7 @@ InputFieldComponent.phoneNumber = (0, import_react20.forwardRef)(function PhoneN
|
|
|
6904
6911
|
defaultValue,
|
|
6905
6912
|
value: dropdownValue,
|
|
6906
6913
|
disabled: props.disabled,
|
|
6907
|
-
onChange:
|
|
6914
|
+
onChange: onChangeDropdown,
|
|
6908
6915
|
withoutClearButton: true,
|
|
6909
6916
|
withoutRenderingOptionsWhenClosed: true
|
|
6910
6917
|
}
|
|
@@ -8694,7 +8701,7 @@ var TableComponent = (0, import_react26.forwardRef)(function Table({
|
|
|
8694
8701
|
)
|
|
8695
8702
|
] })
|
|
8696
8703
|
},
|
|
8697
|
-
value.value
|
|
8704
|
+
value.value.toString()
|
|
8698
8705
|
);
|
|
8699
8706
|
}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text_default.unknown, { children: "No values" }) })
|
|
8700
8707
|
] }),
|
|
@@ -8766,11 +8773,11 @@ var tooltipPositionStyle = (props) => ({
|
|
|
8766
8773
|
}
|
|
8767
8774
|
});
|
|
8768
8775
|
var TooltipContainer = import_styled_components14.default.div.withConfig({
|
|
8769
|
-
shouldForwardProp: (prop) => !["theme", "position", "align", "withArrow", "arrowSize", "isOpen", "gap"].includes(prop)
|
|
8776
|
+
shouldForwardProp: (prop) => !["theme", "position", "align", "pointerEvents", "withArrow", "arrowSize", "isOpen", "gap"].includes(prop)
|
|
8770
8777
|
})`
|
|
8771
8778
|
position: absolute;
|
|
8772
8779
|
opacity: ${(props) => props.isOpen ? 1 : 0};
|
|
8773
|
-
pointer-events: ${(props) => props.isOpen ?
|
|
8780
|
+
pointer-events: ${(props) => props.isOpen ? props.pointerEvents : "none"};
|
|
8774
8781
|
transition: ${(props) => props.theme.styles.transition};
|
|
8775
8782
|
z-index: 1000;
|
|
8776
8783
|
|
|
@@ -8853,8 +8860,10 @@ var TooltipComponent = (0, import_react27.forwardRef)(function Tooltip({
|
|
|
8853
8860
|
content,
|
|
8854
8861
|
contentWidth,
|
|
8855
8862
|
contentMinWidth,
|
|
8863
|
+
contentPointerEvents = "auto",
|
|
8856
8864
|
childrenWrapperWidth = "fit-content",
|
|
8857
8865
|
childrenWrapperHeight,
|
|
8866
|
+
disabled,
|
|
8858
8867
|
withArrow,
|
|
8859
8868
|
isSmall,
|
|
8860
8869
|
backgroundColor,
|
|
@@ -8876,6 +8885,7 @@ var TooltipComponent = (0, import_react27.forwardRef)(function Tooltip({
|
|
|
8876
8885
|
const outsideScreenGap = theme2.styles.gap / 2;
|
|
8877
8886
|
const totalGap = arrowSize + gap;
|
|
8878
8887
|
const openTooltip = (0, import_react27.useCallback)(() => {
|
|
8888
|
+
if (disabled) return;
|
|
8879
8889
|
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
8880
8890
|
setIsOpen(true);
|
|
8881
8891
|
setIsOpenLate(true);
|
|
@@ -8898,7 +8908,7 @@ var TooltipComponent = (0, import_react27.forwardRef)(function Tooltip({
|
|
|
8898
8908
|
}
|
|
8899
8909
|
}, 1);
|
|
8900
8910
|
onOpen?.();
|
|
8901
|
-
}, [onOpen, outsideScreenGap, totalGap]);
|
|
8911
|
+
}, [disabled, onOpen, outsideScreenGap, totalGap]);
|
|
8902
8912
|
const closeTooltip = (0, import_react27.useCallback)(() => {
|
|
8903
8913
|
setIsOpen(false);
|
|
8904
8914
|
closeTimerRef.current = setTimeout(() => setIsOpenLate(false), 300);
|
|
@@ -8974,6 +8984,7 @@ var TooltipComponent = (0, import_react27.forwardRef)(function Tooltip({
|
|
|
8974
8984
|
theme: theme2,
|
|
8975
8985
|
position,
|
|
8976
8986
|
align,
|
|
8987
|
+
pointerEvents: contentPointerEvents,
|
|
8977
8988
|
withArrow,
|
|
8978
8989
|
arrowSize,
|
|
8979
8990
|
gap,
|
|
@@ -9454,14 +9465,20 @@ var MenuItemComponent = (0, import_react30.memo)(function MenuItemComponent2({ i
|
|
|
9454
9465
|
const theme2 = useTheme();
|
|
9455
9466
|
const mediaQuery = useMediaQuery();
|
|
9456
9467
|
const location = reactRouterDomPluginConfig.useLocation();
|
|
9457
|
-
const { colorTheme, components, sideMenuIsCollapsed } = useBetterHtmlContextInternal();
|
|
9468
|
+
const { colorTheme, components, sideMenuIsCollapsed, setSideMenuIsCollapsed } = useBetterHtmlContextInternal();
|
|
9458
9469
|
const [isOpened, setIsOpened] = useBooleanState();
|
|
9470
|
+
const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
|
|
9459
9471
|
const onClickElement = (0, import_react30.useCallback)(() => {
|
|
9460
9472
|
if (item.disabled) return;
|
|
9461
|
-
if (item.
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9473
|
+
if (item.children) {
|
|
9474
|
+
setSideMenuIsCollapsed.setFalse();
|
|
9475
|
+
if (isCollapsed) setTimeout(setIsOpened.setTrue, 0.1 * 1e3);
|
|
9476
|
+
else setIsOpened.toggle();
|
|
9477
|
+
} else {
|
|
9478
|
+
if (item.onClickCloseSideMenu !== false) onClick?.();
|
|
9479
|
+
item.onClick?.(item);
|
|
9480
|
+
}
|
|
9481
|
+
}, [onClick, item, isCollapsed]);
|
|
9465
9482
|
const isActive = item.href ? location.pathname === "/" ? location.pathname === item.href : location.pathname.startsWith(item.href) && item.href !== "/" : false;
|
|
9466
9483
|
const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
|
|
9467
9484
|
const iconSize = 16;
|
|
@@ -9471,46 +9488,57 @@ var MenuItemComponent = (0, import_react30.memo)(function MenuItemComponent2({ i
|
|
|
9471
9488
|
const lineHeight = 20;
|
|
9472
9489
|
const lineWidth = 2;
|
|
9473
9490
|
const lineEndRadius = iconSize / 2 + iconGap * 2;
|
|
9474
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime28.
|
|
9475
|
-
|
|
9491
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9492
|
+
Tooltip_default,
|
|
9476
9493
|
{
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
|
|
9486
|
-
|
|
9487
|
-
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
{
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9494
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text_default, { whiteSpace: "nowrap", children: item.text }),
|
|
9495
|
+
contentPointerEvents: "none",
|
|
9496
|
+
withArrow: true,
|
|
9497
|
+
childrenWrapperWidth: "100%",
|
|
9498
|
+
disabled: !isCollapsed,
|
|
9499
|
+
position: "right",
|
|
9500
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
9501
|
+
Div_default.row,
|
|
9502
|
+
{
|
|
9503
|
+
alignItems: "center",
|
|
9504
|
+
gap: iconGap,
|
|
9505
|
+
whiteSpace: "nowrap",
|
|
9506
|
+
backgroundColor: isActive ? colorTheme === "dark" ? lightenColor(theme2.colors.primary, 0.7) : lightenColor(theme2.colors.primary, 0.85) : readyBackgroundColor,
|
|
9507
|
+
borderRadius: theme2.styles.borderRadius,
|
|
9508
|
+
paddingBlock,
|
|
9509
|
+
paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
|
|
9510
|
+
paddingRight: theme2.styles.space,
|
|
9511
|
+
filterHover: `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})`,
|
|
9512
|
+
overflow: isCollapsed ? "hidden" : void 0,
|
|
9513
|
+
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
9514
|
+
opacity: item.disabled ? 0.6 : void 0,
|
|
9515
|
+
onClick: onClickElement,
|
|
9516
|
+
children: [
|
|
9517
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon_default, { name: item.iconName, color: theme2.colors.primary, size: iconSize, flexShrink: 0 }),
|
|
9518
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9519
|
+
Text_default,
|
|
9520
|
+
{
|
|
9521
|
+
flex: 1,
|
|
9522
|
+
lineHeight: `${lineHeight}px`,
|
|
9523
|
+
color: isActive ? theme2.colors.primary : theme2.colors.textPrimary,
|
|
9524
|
+
opacity: isCollapsed ? 0 : void 0,
|
|
9525
|
+
transition: theme2.styles.transition,
|
|
9526
|
+
children: item.text
|
|
9527
|
+
}
|
|
9528
|
+
),
|
|
9529
|
+
item.children && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9530
|
+
Icon_default,
|
|
9531
|
+
{
|
|
9532
|
+
name: "chevronDown",
|
|
9533
|
+
color: theme2.colors.textSecondary,
|
|
9534
|
+
size: 14,
|
|
9535
|
+
transform: isOpened ? "rotate(180deg)" : void 0,
|
|
9536
|
+
transition: theme2.styles.transition
|
|
9537
|
+
}
|
|
9538
|
+
)
|
|
9539
|
+
]
|
|
9540
|
+
}
|
|
9541
|
+
)
|
|
9514
9542
|
}
|
|
9515
9543
|
);
|
|
9516
9544
|
(0, import_react30.useEffect)(() => {
|
|
@@ -9599,6 +9627,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
9599
9627
|
widthMobileHandle,
|
|
9600
9628
|
absoluteComponent,
|
|
9601
9629
|
additionalComponent,
|
|
9630
|
+
isLoading,
|
|
9602
9631
|
backgroundColor,
|
|
9603
9632
|
paddingTop
|
|
9604
9633
|
}) {
|
|
@@ -9671,45 +9700,47 @@ var SideMenuComponent = function SideMenu({
|
|
|
9671
9700
|
) }),
|
|
9672
9701
|
withCloseButton && mediaQuery.size1000 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button_default.icon, { icon: "XMark", marginLeft: "auto", onClick: onClickXButton })
|
|
9673
9702
|
] }),
|
|
9674
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9703
|
+
!isLoading ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
9704
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9705
|
+
Div_default.column,
|
|
9706
|
+
{
|
|
9707
|
+
width: "100%",
|
|
9708
|
+
height: "100%",
|
|
9709
|
+
overflowY: !isCollapsed ? "auto" : void 0,
|
|
9710
|
+
paddingInline: theme2.styles.space,
|
|
9711
|
+
paddingBottom: !isCollapsable && !readyBottomItems ? theme2.styles.space : void 0,
|
|
9712
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Div_default.column, { gap: theme2.styles.gap / 2, children: readyItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9713
|
+
MenuItemComponent,
|
|
9714
|
+
{
|
|
9715
|
+
item,
|
|
9716
|
+
backgroundColor: readyBackgroundColor,
|
|
9717
|
+
onClick: onClickXButton
|
|
9718
|
+
},
|
|
9719
|
+
item.text
|
|
9720
|
+
)) })
|
|
9721
|
+
}
|
|
9722
|
+
),
|
|
9723
|
+
readyBottomItems && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9724
|
+
Div_default.column,
|
|
9725
|
+
{
|
|
9726
|
+
borderTop: mediaQuery.size1000 ? `solid 1px ${theme2.colors.border}` : void 0,
|
|
9727
|
+
gap: theme2.styles.gap / 2,
|
|
9728
|
+
marginTop: "auto",
|
|
9729
|
+
paddingTop: mediaQuery.size1000 ? theme2.styles.space : void 0,
|
|
9730
|
+
paddingInline: theme2.styles.space,
|
|
9731
|
+
paddingBottom: !isCollapsable ? theme2.styles.space : void 0,
|
|
9732
|
+
children: readyBottomItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9733
|
+
MenuItemComponent,
|
|
9734
|
+
{
|
|
9735
|
+
item,
|
|
9736
|
+
backgroundColor: readyBackgroundColor,
|
|
9737
|
+
onClick: onClickXButton
|
|
9738
|
+
},
|
|
9739
|
+
item.text
|
|
9740
|
+
))
|
|
9741
|
+
}
|
|
9742
|
+
)
|
|
9743
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Div_default, { flex: 1, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Loader_default.box, { text: isCollapsed ? "" : void 0 }) }),
|
|
9713
9744
|
additionalComponent,
|
|
9714
9745
|
isCollapsable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9715
9746
|
Div_default,
|