react-better-html 1.1.113 → 1.1.114
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 +56 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6742,6 +6742,45 @@ var FormRow_default = FormRow2;
|
|
|
6742
6742
|
|
|
6743
6743
|
// src/components/ColorThemeSwitch.tsx
|
|
6744
6744
|
import { memo as memo19, useEffect as useEffect8 } from "react";
|
|
6745
|
+
|
|
6746
|
+
// src/utils/variableFunctions.ts
|
|
6747
|
+
var checkBetterHtmlContextValue = (value, functionsName) => {
|
|
6748
|
+
if (value === void 0) {
|
|
6749
|
+
throw new Error(
|
|
6750
|
+
`\`${functionsName}()\` must be used within a \`<BetterHtmlProvider>\`. Make sure to add one at the root of your component tree.`
|
|
6751
|
+
);
|
|
6752
|
+
}
|
|
6753
|
+
return value !== void 0;
|
|
6754
|
+
};
|
|
6755
|
+
var loaderControls = {
|
|
6756
|
+
startLoading: (loaderName) => {
|
|
6757
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "loaderControls.startLoading")) return;
|
|
6758
|
+
externalBetterHtmlContextValue.setLoaders((oldValue) => ({
|
|
6759
|
+
...oldValue,
|
|
6760
|
+
[loaderName.toString()]: true
|
|
6761
|
+
}));
|
|
6762
|
+
},
|
|
6763
|
+
stopLoading: (loaderName) => {
|
|
6764
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "loaderControls.stopLoading")) return;
|
|
6765
|
+
externalBetterHtmlContextValue.setLoaders((oldValue) => ({
|
|
6766
|
+
...oldValue,
|
|
6767
|
+
[loaderName.toString()]: false
|
|
6768
|
+
}));
|
|
6769
|
+
}
|
|
6770
|
+
};
|
|
6771
|
+
var colorThemeControls = {
|
|
6772
|
+
toggleTheme: (theme2) => {
|
|
6773
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "colorThemeControls.toggleTheme")) return;
|
|
6774
|
+
const currentColorTheme = externalBetterHtmlContextValue.colorTheme;
|
|
6775
|
+
const newColorTheme = theme2 ?? (currentColorTheme === "dark" ? "light" : "dark");
|
|
6776
|
+
setTimeout(() => {
|
|
6777
|
+
window.document.body.parentElement?.setAttribute("data-theme", newColorTheme);
|
|
6778
|
+
localStorage.setItem("theme", newColorTheme);
|
|
6779
|
+
}, 0.01 * 1e3);
|
|
6780
|
+
}
|
|
6781
|
+
};
|
|
6782
|
+
|
|
6783
|
+
// src/components/ColorThemeSwitch.tsx
|
|
6745
6784
|
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6746
6785
|
var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
6747
6786
|
withMoon,
|
|
@@ -6754,13 +6793,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
6754
6793
|
}
|
|
6755
6794
|
});
|
|
6756
6795
|
useEffect8(() => {
|
|
6757
|
-
|
|
6758
|
-
window.document.body.parentElement?.setAttribute("data-theme", form.values.darkMode ? "dark" : "light");
|
|
6759
|
-
localStorage.setItem("theme", form.values.darkMode ? "dark" : "light");
|
|
6760
|
-
}, 0.2 * 1e3);
|
|
6761
|
-
return () => {
|
|
6762
|
-
clearTimeout(timeout);
|
|
6763
|
-
};
|
|
6796
|
+
colorThemeControls.toggleTheme(form.values.darkMode ? "dark" : "light");
|
|
6764
6797
|
}, [form.values.darkMode]);
|
|
6765
6798
|
useEffect8(() => {
|
|
6766
6799
|
const html = document.querySelector("html");
|
|
@@ -6848,7 +6881,7 @@ var TableStyledComponent = styled10.table.withConfig({
|
|
|
6848
6881
|
transition: ${props.theme.styles.transition};
|
|
6849
6882
|
|
|
6850
6883
|
&:not(.isHeader):not(.isFooter):not(.withoutHover):hover {
|
|
6851
|
-
filter: brightness(${props.colorTheme === "light" ?
|
|
6884
|
+
filter: brightness(${props.colorTheme === "light" ? 0.95 : 0.7});
|
|
6852
6885
|
}
|
|
6853
6886
|
` : ""}
|
|
6854
6887
|
|
|
@@ -7173,7 +7206,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
7173
7206
|
[]
|
|
7174
7207
|
);
|
|
7175
7208
|
}, [data, openedFilterColumn]);
|
|
7176
|
-
const pageCountInternal = pageCount ?? (pageSize !== void 0 ? Math.ceil(
|
|
7209
|
+
const pageCountInternal = pageCount ?? (pageSize !== void 0 ? Math.ceil(dataAfterFilter.length / pageSize) : 1);
|
|
7177
7210
|
const paginationItems = useMemo7(() => {
|
|
7178
7211
|
const halfRange = Math.floor(maximumVisiblePages / 2);
|
|
7179
7212
|
let startPage = Math.max(1, currentPage - halfRange);
|
|
@@ -7466,11 +7499,18 @@ var TableComponent = forwardRef15(function Table({
|
|
|
7466
7499
|
onClickWithValue: onClickFilterListItem,
|
|
7467
7500
|
children: /* @__PURE__ */ jsxs16(Div_default.row, { alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
7468
7501
|
/* @__PURE__ */ jsx20(Text_default, { children: value.value }),
|
|
7469
|
-
openedFilterColumn.withTotalNumber && /* @__PURE__ */ jsxs16(
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7502
|
+
openedFilterColumn.withTotalNumber && /* @__PURE__ */ jsxs16(
|
|
7503
|
+
Text_default,
|
|
7504
|
+
{
|
|
7505
|
+
fontSize: 14,
|
|
7506
|
+
color: isActive ? theme2.colors.base + "c0" : theme2.colors.textSecondary,
|
|
7507
|
+
children: [
|
|
7508
|
+
"(",
|
|
7509
|
+
value.count,
|
|
7510
|
+
")"
|
|
7511
|
+
]
|
|
7512
|
+
}
|
|
7513
|
+
)
|
|
7474
7514
|
] })
|
|
7475
7515
|
},
|
|
7476
7516
|
value.value
|
|
@@ -7795,32 +7835,6 @@ var Foldable2 = memo22(FoldableComponent);
|
|
|
7795
7835
|
Foldable2.box = FoldableComponent.box;
|
|
7796
7836
|
var Foldable_default = Foldable2;
|
|
7797
7837
|
|
|
7798
|
-
// src/utils/variableFunctions.ts
|
|
7799
|
-
var checkBetterHtmlContextValue = (value, functionsName) => {
|
|
7800
|
-
if (value === void 0) {
|
|
7801
|
-
throw new Error(
|
|
7802
|
-
`\`${functionsName}()\` must be used within a \`<BetterHtmlProvider>\`. Make sure to add one at the root of your component tree.`
|
|
7803
|
-
);
|
|
7804
|
-
}
|
|
7805
|
-
return value !== void 0;
|
|
7806
|
-
};
|
|
7807
|
-
var loaderControls = {
|
|
7808
|
-
startLoading: (loaderName) => {
|
|
7809
|
-
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "loaderControls.startLoading")) return;
|
|
7810
|
-
externalBetterHtmlContextValue.setLoaders((oldValue) => ({
|
|
7811
|
-
...oldValue,
|
|
7812
|
-
[loaderName.toString()]: true
|
|
7813
|
-
}));
|
|
7814
|
-
},
|
|
7815
|
-
stopLoading: (loaderName) => {
|
|
7816
|
-
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "loaderControls.stopLoading")) return;
|
|
7817
|
-
externalBetterHtmlContextValue.setLoaders((oldValue) => ({
|
|
7818
|
-
...oldValue,
|
|
7819
|
-
[loaderName.toString()]: false
|
|
7820
|
-
}));
|
|
7821
|
-
}
|
|
7822
|
-
};
|
|
7823
|
-
|
|
7824
7838
|
// src/plugins/react-router-dom.ts
|
|
7825
7839
|
import { Link as RouterLink, NavLink as RouterNavLink } from "react-router-dom";
|
|
7826
7840
|
var reactRouterDomPlugin = {
|
|
@@ -7856,6 +7870,7 @@ export {
|
|
|
7856
7870
|
Tabs_default as Tabs,
|
|
7857
7871
|
Text_default as Text,
|
|
7858
7872
|
ToggleInput_default as ToggleInput,
|
|
7873
|
+
colorThemeControls,
|
|
7859
7874
|
countries,
|
|
7860
7875
|
darkenColor,
|
|
7861
7876
|
desaturateColor,
|