react-better-html 1.1.172 → 1.1.174
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 +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +23 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -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
|
|
|
@@ -3603,14 +3603,15 @@ var ModalComponent = forwardRef7(function Modal({
|
|
|
3603
3603
|
marginTop: 1,
|
|
3604
3604
|
iconColor: titleColor,
|
|
3605
3605
|
onClick: onClickClose,
|
|
3606
|
-
transition: theme2.styles.transition
|
|
3606
|
+
transition: theme2.styles.transition,
|
|
3607
|
+
zIndex: 10
|
|
3607
3608
|
}
|
|
3608
3609
|
)
|
|
3609
3610
|
]
|
|
3610
3611
|
}
|
|
3611
3612
|
),
|
|
3612
3613
|
/* @__PURE__ */ jsx12(Divider_default.horizontal, {})
|
|
3613
|
-
] }) : /* @__PURE__ */ jsx12(Fragment2, { children: !withoutCloseButton && /* @__PURE__ */ jsx12(Div_default, { position: "absolute", top: theme2.styles.space, right: theme2.styles.space, children: /* @__PURE__ */ jsx12(Button_default.icon, { icon: "XMark", onClick: onClickClose }) }) }),
|
|
3614
|
+
] }) : /* @__PURE__ */ jsx12(Fragment2, { children: !withoutCloseButton && /* @__PURE__ */ jsx12(Div_default, { position: "absolute", top: theme2.styles.space, right: theme2.styles.space, zIndex: 10, children: /* @__PURE__ */ jsx12(Button_default.icon, { icon: "XMark", onClick: onClickClose }) }) }),
|
|
3614
3615
|
/* @__PURE__ */ jsx12(Div_default, { padding: title ? theme2.styles.space : void 0, children })
|
|
3615
3616
|
]
|
|
3616
3617
|
}
|
|
@@ -8230,7 +8231,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
8230
8231
|
disabled: data.length === 0,
|
|
8231
8232
|
onChange: onClickAllCheckboxesElement
|
|
8232
8233
|
}
|
|
8233
|
-
) : column.label ? /* @__PURE__ */ jsx22(Text_default, { children: column.label }) : void 0,
|
|
8234
|
+
) : column.label ? column.renderLabel ? column.renderLabel(column.label) : /* @__PURE__ */ jsx22(Text_default, { children: column.label }) : void 0,
|
|
8234
8235
|
column.filter && /* @__PURE__ */ jsx22(
|
|
8235
8236
|
Button_default.icon,
|
|
8236
8237
|
{
|
|
@@ -8370,7 +8371,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
8370
8371
|
/* @__PURE__ */ jsx22(
|
|
8371
8372
|
Modal_default,
|
|
8372
8373
|
{
|
|
8373
|
-
title: `Filter ${openedFilterColumn?.label}`,
|
|
8374
|
+
title: `Filter ${openedFilterColumn?.label ?? ""}`,
|
|
8374
8375
|
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" : "",
|
|
8375
8376
|
onClose: onCloseFilterModal,
|
|
8376
8377
|
ref: filterModalRef,
|