react-better-html 1.1.171 → 1.1.173
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/README.md +1 -1
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +33 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -2528,54 +2528,53 @@ function BetterHtmlProviderContent({ children }) {
|
|
|
2528
2528
|
alertsPlugin2 && /* @__PURE__ */ jsx8(AlertsHolder_default, {})
|
|
2529
2529
|
] });
|
|
2530
2530
|
}
|
|
2531
|
-
function BetterHtmlProvider({
|
|
2531
|
+
function BetterHtmlProvider({ config, plugins, children }) {
|
|
2532
2532
|
const [colorTheme, setColorTheme] = useState2(
|
|
2533
|
-
localStorage.getItem("theme") === "dark" ? "dark" :
|
|
2533
|
+
localStorage.getItem("theme") === "dark" ? "dark" : config?.colorTheme ?? "light"
|
|
2534
2534
|
);
|
|
2535
|
-
const [loaders, setLoaders] = useState2(
|
|
2536
|
-
const [plugins] = useState2(pluginsToUse ?? []);
|
|
2535
|
+
const [loaders, setLoaders] = useState2(config?.loaders ?? {});
|
|
2537
2536
|
const [alerts, setAlerts] = useState2([]);
|
|
2538
2537
|
const [tabGroups, setTabGroups] = useState2([]);
|
|
2539
2538
|
const [tabsWithDots, setTabsWithDots] = useState2([]);
|
|
2540
|
-
const
|
|
2539
|
+
const readyConfig = useMemo2(
|
|
2541
2540
|
() => ({
|
|
2542
2541
|
app: {
|
|
2543
2542
|
...appConfig,
|
|
2544
|
-
...
|
|
2543
|
+
...config?.app
|
|
2545
2544
|
},
|
|
2546
2545
|
theme: {
|
|
2547
2546
|
styles: {
|
|
2548
2547
|
...theme.styles,
|
|
2549
|
-
...
|
|
2548
|
+
...config?.theme?.styles
|
|
2550
2549
|
},
|
|
2551
2550
|
colors: {
|
|
2552
2551
|
light: {
|
|
2553
2552
|
...theme.colors.light,
|
|
2554
|
-
...
|
|
2553
|
+
...config?.theme?.colors?.light
|
|
2555
2554
|
},
|
|
2556
2555
|
dark: {
|
|
2557
2556
|
...theme.colors.dark,
|
|
2558
|
-
...
|
|
2557
|
+
...config?.theme?.colors?.dark
|
|
2559
2558
|
}
|
|
2560
2559
|
}
|
|
2561
2560
|
},
|
|
2562
2561
|
colorTheme,
|
|
2563
2562
|
icons: {
|
|
2564
2563
|
...icons,
|
|
2565
|
-
...
|
|
2564
|
+
...config?.icons
|
|
2566
2565
|
},
|
|
2567
2566
|
assets: {
|
|
2568
2567
|
...assets,
|
|
2569
|
-
...
|
|
2568
|
+
...config?.assets
|
|
2570
2569
|
},
|
|
2571
2570
|
loaders,
|
|
2572
2571
|
setLoaders,
|
|
2573
2572
|
alerts,
|
|
2574
2573
|
setAlerts,
|
|
2575
2574
|
components: {
|
|
2576
|
-
...
|
|
2575
|
+
...config?.components
|
|
2577
2576
|
},
|
|
2578
|
-
plugins,
|
|
2577
|
+
plugins: plugins ?? [],
|
|
2579
2578
|
componentsState: {
|
|
2580
2579
|
tabs: {
|
|
2581
2580
|
tabGroups,
|
|
@@ -2585,20 +2584,21 @@ function BetterHtmlProvider({ value, plugins: pluginsToUse, children }) {
|
|
|
2585
2584
|
}
|
|
2586
2585
|
}
|
|
2587
2586
|
}),
|
|
2588
|
-
[
|
|
2587
|
+
[config, colorTheme, loaders, alerts, tabGroups, tabsWithDots]
|
|
2589
2588
|
);
|
|
2590
2589
|
useEffect4(() => {
|
|
2590
|
+
if (!plugins) return;
|
|
2591
2591
|
plugins.forEach((plugin) => {
|
|
2592
2592
|
plugin.initialize?.();
|
|
2593
2593
|
});
|
|
2594
|
-
}, [
|
|
2594
|
+
}, []);
|
|
2595
2595
|
useEffect4(() => {
|
|
2596
2596
|
const html = document.querySelector("html");
|
|
2597
2597
|
if (!html) return;
|
|
2598
2598
|
const observer = new MutationObserver((mutations) => {
|
|
2599
2599
|
mutations.forEach((mutation) => {
|
|
2600
2600
|
if (mutation.type === "attributes") {
|
|
2601
|
-
setColorTheme(html.getAttribute("data-theme") === "dark" ? "dark" :
|
|
2601
|
+
setColorTheme(html.getAttribute("data-theme") === "dark" ? "dark" : config?.colorTheme ?? "light");
|
|
2602
2602
|
}
|
|
2603
2603
|
});
|
|
2604
2604
|
});
|
|
@@ -2609,8 +2609,8 @@ function BetterHtmlProvider({ value, plugins: pluginsToUse, children }) {
|
|
|
2609
2609
|
observer.disconnect();
|
|
2610
2610
|
};
|
|
2611
2611
|
}, []);
|
|
2612
|
-
externalBetterHtmlContextValue =
|
|
2613
|
-
return /* @__PURE__ */ jsx8(betterHtmlContext.Provider, { value:
|
|
2612
|
+
externalBetterHtmlContextValue = readyConfig;
|
|
2613
|
+
return /* @__PURE__ */ jsx8(betterHtmlContext.Provider, { value: readyConfig, children: /* @__PURE__ */ jsx8(BetterHtmlProviderContent, { children }) });
|
|
2614
2614
|
}
|
|
2615
2615
|
var BetterHtmlProvider_default = memo8(BetterHtmlProvider);
|
|
2616
2616
|
|
|
@@ -3622,7 +3622,7 @@ var ModalComponent = forwardRef7(function Modal({
|
|
|
3622
3622
|
document.body
|
|
3623
3623
|
);
|
|
3624
3624
|
});
|
|
3625
|
-
ModalComponent.confirmation = forwardRef7(function Confirmation({ message, continueButtonLoaderName, onContinue, onCancel, ...props }, ref) {
|
|
3625
|
+
ModalComponent.confirmation = forwardRef7(function Confirmation({ message, continueButtonText = "Continue", continueButtonLoaderName, onContinue, onCancel, ...props }, ref) {
|
|
3626
3626
|
const theme2 = useTheme();
|
|
3627
3627
|
const modalRef = useRef3(null);
|
|
3628
3628
|
const onCancelElement = useCallback6(() => {
|
|
@@ -3645,13 +3645,21 @@ ModalComponent.confirmation = forwardRef7(function Confirmation({ message, conti
|
|
|
3645
3645
|
marginTop: theme2.styles.space * 2,
|
|
3646
3646
|
children: [
|
|
3647
3647
|
/* @__PURE__ */ jsx12(Button_default.secondary, { text: "Cancel", onClick: onCancelElement }),
|
|
3648
|
-
/* @__PURE__ */ jsx12(Button_default, { text:
|
|
3648
|
+
/* @__PURE__ */ jsx12(Button_default, { text: continueButtonText, loaderName: continueButtonLoaderName, onClick: onContinueElement })
|
|
3649
3649
|
]
|
|
3650
3650
|
}
|
|
3651
3651
|
)
|
|
3652
3652
|
] });
|
|
3653
3653
|
});
|
|
3654
|
-
ModalComponent.destructive = forwardRef7(function Destructive2({
|
|
3654
|
+
ModalComponent.destructive = forwardRef7(function Destructive2({
|
|
3655
|
+
message,
|
|
3656
|
+
deleteButtonText = "Delete",
|
|
3657
|
+
deleteButtonIconName = "trash",
|
|
3658
|
+
deleteButtonLoaderName,
|
|
3659
|
+
onDelete,
|
|
3660
|
+
onCancel,
|
|
3661
|
+
...props
|
|
3662
|
+
}, ref) {
|
|
3655
3663
|
const theme2 = useTheme();
|
|
3656
3664
|
const modalRef = useRef3(null);
|
|
3657
3665
|
const onCancelElement = useCallback6(() => {
|
|
@@ -3677,8 +3685,8 @@ ModalComponent.destructive = forwardRef7(function Destructive2({ message, delete
|
|
|
3677
3685
|
/* @__PURE__ */ jsx12(
|
|
3678
3686
|
Button_default.destructive,
|
|
3679
3687
|
{
|
|
3680
|
-
icon:
|
|
3681
|
-
text:
|
|
3688
|
+
icon: deleteButtonIconName,
|
|
3689
|
+
text: deleteButtonText,
|
|
3682
3690
|
loaderName: deleteButtonLoaderName,
|
|
3683
3691
|
onClick: onDeleteElement
|
|
3684
3692
|
}
|
|
@@ -8222,7 +8230,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
8222
8230
|
disabled: data.length === 0,
|
|
8223
8231
|
onChange: onClickAllCheckboxesElement
|
|
8224
8232
|
}
|
|
8225
|
-
) : column.label ? /* @__PURE__ */ jsx22(Text_default, { children: column.label }) : void 0,
|
|
8233
|
+
) : column.label ? column.renderLabel ? column.renderLabel(column.label) : /* @__PURE__ */ jsx22(Text_default, { children: column.label }) : void 0,
|
|
8226
8234
|
column.filter && /* @__PURE__ */ jsx22(
|
|
8227
8235
|
Button_default.icon,
|
|
8228
8236
|
{
|
|
@@ -8362,7 +8370,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
8362
8370
|
/* @__PURE__ */ jsx22(
|
|
8363
8371
|
Modal_default,
|
|
8364
8372
|
{
|
|
8365
|
-
title: `Filter ${openedFilterColumn?.label}`,
|
|
8373
|
+
title: `Filter ${openedFilterColumn?.label ?? ""}`,
|
|
8366
8374
|
description: openedFilterColumn?.filter === "number" ? "Enter minimum and maximum values to filter" : openedFilterColumn?.filter === "date" || openedFilterColumn?.filter === "date-time" ? "Enter minimum and maximum dates to filter" : openedFilterColumn?.filter === "list" ? "Select values to filter from the list bellow" : "",
|
|
8367
8375
|
onClose: onCloseFilterModal,
|
|
8368
8376
|
ref: filterModalRef,
|