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.d.mts
CHANGED
|
@@ -855,6 +855,9 @@ declare const loaderControls: {
|
|
|
855
855
|
startLoading: (loaderName: LoaderName | AnyOtherString) => void;
|
|
856
856
|
stopLoading: (loaderName: LoaderName | AnyOtherString) => void;
|
|
857
857
|
};
|
|
858
|
+
declare const colorThemeControls: {
|
|
859
|
+
toggleTheme: (theme?: ColorTheme) => void;
|
|
860
|
+
};
|
|
858
861
|
|
|
859
862
|
declare const countries: Country[];
|
|
860
863
|
|
|
@@ -862,4 +865,4 @@ declare const isMobileDevice: boolean;
|
|
|
862
865
|
|
|
863
866
|
declare const reactRouterDomPlugin: BetterHtmlPlugin;
|
|
864
867
|
|
|
865
|
-
export { type AppConfig, type AssetName, type AssetsConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default as BetterHtmlProvider, type BetterHtmlProviderValue, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, type Color, type ColorName, type ColorTheme, ColorThemeSwitch, type ColorThemeSwitchProps, type Colors, type DeepPartialRecord, Div, type DivProps, _default$3 as Divider, Dropdown, type DropdownOption, type DropdownProps, type ExcludeOptions, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$5 as Icon, type IconName, type IconProps, type IconsConfig, _default$4 as Image, type ImageProps, InputField, type InputFieldProps, _default$1 as Label, type LabelProps, Loader, type LoaderConfig, type LoaderName, type LoaderProps, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type Styles, type TabGroup, Table, type TableColumn, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, type Theme, type ThemeConfig, _default$2 as ToggleInput, type ToggleInputProps, type ToggleInputRef, type VerticalDividerProps, countries, darkenColor, desaturateColor, formatPhoneNumber, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, reactRouterDomPlugin, saturateColor, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
|
|
868
|
+
export { type AppConfig, type AssetName, type AssetsConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default as BetterHtmlProvider, type BetterHtmlProviderValue, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, type Color, type ColorName, type ColorTheme, ColorThemeSwitch, type ColorThemeSwitchProps, type Colors, type DeepPartialRecord, Div, type DivProps, _default$3 as Divider, Dropdown, type DropdownOption, type DropdownProps, type ExcludeOptions, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$5 as Icon, type IconName, type IconProps, type IconsConfig, _default$4 as Image, type ImageProps, InputField, type InputFieldProps, _default$1 as Label, type LabelProps, Loader, type LoaderConfig, type LoaderName, type LoaderProps, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type Styles, type TabGroup, Table, type TableColumn, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, type Theme, type ThemeConfig, _default$2 as ToggleInput, type ToggleInputProps, type ToggleInputRef, type VerticalDividerProps, colorThemeControls, countries, darkenColor, desaturateColor, formatPhoneNumber, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, reactRouterDomPlugin, saturateColor, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -855,6 +855,9 @@ declare const loaderControls: {
|
|
|
855
855
|
startLoading: (loaderName: LoaderName | AnyOtherString) => void;
|
|
856
856
|
stopLoading: (loaderName: LoaderName | AnyOtherString) => void;
|
|
857
857
|
};
|
|
858
|
+
declare const colorThemeControls: {
|
|
859
|
+
toggleTheme: (theme?: ColorTheme) => void;
|
|
860
|
+
};
|
|
858
861
|
|
|
859
862
|
declare const countries: Country[];
|
|
860
863
|
|
|
@@ -862,4 +865,4 @@ declare const isMobileDevice: boolean;
|
|
|
862
865
|
|
|
863
866
|
declare const reactRouterDomPlugin: BetterHtmlPlugin;
|
|
864
867
|
|
|
865
|
-
export { type AppConfig, type AssetName, type AssetsConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default as BetterHtmlProvider, type BetterHtmlProviderValue, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, type Color, type ColorName, type ColorTheme, ColorThemeSwitch, type ColorThemeSwitchProps, type Colors, type DeepPartialRecord, Div, type DivProps, _default$3 as Divider, Dropdown, type DropdownOption, type DropdownProps, type ExcludeOptions, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$5 as Icon, type IconName, type IconProps, type IconsConfig, _default$4 as Image, type ImageProps, InputField, type InputFieldProps, _default$1 as Label, type LabelProps, Loader, type LoaderConfig, type LoaderName, type LoaderProps, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type Styles, type TabGroup, Table, type TableColumn, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, type Theme, type ThemeConfig, _default$2 as ToggleInput, type ToggleInputProps, type ToggleInputRef, type VerticalDividerProps, countries, darkenColor, desaturateColor, formatPhoneNumber, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, reactRouterDomPlugin, saturateColor, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
|
|
868
|
+
export { type AppConfig, type AssetName, type AssetsConfig, type BetterHtmlConfig, type BetterHtmlPlugin, _default as BetterHtmlProvider, type BetterHtmlProviderValue, type BrowserName, Button, type ButtonProps, Chip, type ChipProps, type Color, type ColorName, type ColorTheme, ColorThemeSwitch, type ColorThemeSwitchProps, type Colors, type DeepPartialRecord, Div, type DivProps, _default$3 as Divider, Dropdown, type DropdownOption, type DropdownProps, type ExcludeOptions, Foldable, type FoldableProps, type FoldableRef, Form, type FormProps, FormRow, type FormRowProps, type HorizontalDividerProps, _default$5 as Icon, type IconName, type IconProps, type IconsConfig, _default$4 as Image, type ImageProps, InputField, type InputFieldProps, _default$1 as Label, type LabelProps, Loader, type LoaderConfig, type LoaderName, type LoaderProps, Modal, type ModalProps, type ModalRef, type OmitProps, PageHeader, type PageHeaderProps, PageHolder, type PageHolderProps, type PartialRecord, type PickAllRequired, type PickValue, type PluginName, type Styles, type TabGroup, Table, type TableColumn, type TableProps, type TableRef, Tabs, type TabsProps, type TabsRef, Text, type TextAs, type TextProps, type TextareaFieldProps, type Theme, type ThemeConfig, _default$2 as ToggleInput, type ToggleInputProps, type ToggleInputRef, type VerticalDividerProps, colorThemeControls, countries, darkenColor, desaturateColor, formatPhoneNumber, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, reactRouterDomPlugin, saturateColor, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
|
package/dist/index.js
CHANGED
|
@@ -52,6 +52,7 @@ __export(index_exports, {
|
|
|
52
52
|
Tabs: () => Tabs_default,
|
|
53
53
|
Text: () => Text_default,
|
|
54
54
|
ToggleInput: () => ToggleInput_default,
|
|
55
|
+
colorThemeControls: () => colorThemeControls,
|
|
55
56
|
countries: () => countries,
|
|
56
57
|
darkenColor: () => darkenColor,
|
|
57
58
|
desaturateColor: () => desaturateColor,
|
|
@@ -6822,6 +6823,45 @@ var FormRow_default = FormRow2;
|
|
|
6822
6823
|
|
|
6823
6824
|
// src/components/ColorThemeSwitch.tsx
|
|
6824
6825
|
var import_react22 = require("react");
|
|
6826
|
+
|
|
6827
|
+
// src/utils/variableFunctions.ts
|
|
6828
|
+
var checkBetterHtmlContextValue = (value, functionsName) => {
|
|
6829
|
+
if (value === void 0) {
|
|
6830
|
+
throw new Error(
|
|
6831
|
+
`\`${functionsName}()\` must be used within a \`<BetterHtmlProvider>\`. Make sure to add one at the root of your component tree.`
|
|
6832
|
+
);
|
|
6833
|
+
}
|
|
6834
|
+
return value !== void 0;
|
|
6835
|
+
};
|
|
6836
|
+
var loaderControls = {
|
|
6837
|
+
startLoading: (loaderName) => {
|
|
6838
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "loaderControls.startLoading")) return;
|
|
6839
|
+
externalBetterHtmlContextValue.setLoaders((oldValue) => ({
|
|
6840
|
+
...oldValue,
|
|
6841
|
+
[loaderName.toString()]: true
|
|
6842
|
+
}));
|
|
6843
|
+
},
|
|
6844
|
+
stopLoading: (loaderName) => {
|
|
6845
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "loaderControls.stopLoading")) return;
|
|
6846
|
+
externalBetterHtmlContextValue.setLoaders((oldValue) => ({
|
|
6847
|
+
...oldValue,
|
|
6848
|
+
[loaderName.toString()]: false
|
|
6849
|
+
}));
|
|
6850
|
+
}
|
|
6851
|
+
};
|
|
6852
|
+
var colorThemeControls = {
|
|
6853
|
+
toggleTheme: (theme2) => {
|
|
6854
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "colorThemeControls.toggleTheme")) return;
|
|
6855
|
+
const currentColorTheme = externalBetterHtmlContextValue.colorTheme;
|
|
6856
|
+
const newColorTheme = theme2 ?? (currentColorTheme === "dark" ? "light" : "dark");
|
|
6857
|
+
setTimeout(() => {
|
|
6858
|
+
window.document.body.parentElement?.setAttribute("data-theme", newColorTheme);
|
|
6859
|
+
localStorage.setItem("theme", newColorTheme);
|
|
6860
|
+
}, 0.01 * 1e3);
|
|
6861
|
+
}
|
|
6862
|
+
};
|
|
6863
|
+
|
|
6864
|
+
// src/components/ColorThemeSwitch.tsx
|
|
6825
6865
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
6826
6866
|
var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
6827
6867
|
withMoon,
|
|
@@ -6834,13 +6874,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
6834
6874
|
}
|
|
6835
6875
|
});
|
|
6836
6876
|
(0, import_react22.useEffect)(() => {
|
|
6837
|
-
|
|
6838
|
-
window.document.body.parentElement?.setAttribute("data-theme", form.values.darkMode ? "dark" : "light");
|
|
6839
|
-
localStorage.setItem("theme", form.values.darkMode ? "dark" : "light");
|
|
6840
|
-
}, 0.2 * 1e3);
|
|
6841
|
-
return () => {
|
|
6842
|
-
clearTimeout(timeout);
|
|
6843
|
-
};
|
|
6877
|
+
colorThemeControls.toggleTheme(form.values.darkMode ? "dark" : "light");
|
|
6844
6878
|
}, [form.values.darkMode]);
|
|
6845
6879
|
(0, import_react22.useEffect)(() => {
|
|
6846
6880
|
const html = document.querySelector("html");
|
|
@@ -6919,7 +6953,7 @@ var TableStyledComponent = import_styled_components11.default.table.withConfig({
|
|
|
6919
6953
|
transition: ${props.theme.styles.transition};
|
|
6920
6954
|
|
|
6921
6955
|
&:not(.isHeader):not(.isFooter):not(.withoutHover):hover {
|
|
6922
|
-
filter: brightness(${props.colorTheme === "light" ?
|
|
6956
|
+
filter: brightness(${props.colorTheme === "light" ? 0.95 : 0.7});
|
|
6923
6957
|
}
|
|
6924
6958
|
` : ""}
|
|
6925
6959
|
|
|
@@ -7244,7 +7278,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7244
7278
|
[]
|
|
7245
7279
|
);
|
|
7246
7280
|
}, [data, openedFilterColumn]);
|
|
7247
|
-
const pageCountInternal = pageCount ?? (pageSize !== void 0 ? Math.ceil(
|
|
7281
|
+
const pageCountInternal = pageCount ?? (pageSize !== void 0 ? Math.ceil(dataAfterFilter.length / pageSize) : 1);
|
|
7248
7282
|
const paginationItems = (0, import_react23.useMemo)(() => {
|
|
7249
7283
|
const halfRange = Math.floor(maximumVisiblePages / 2);
|
|
7250
7284
|
let startPage = Math.max(1, currentPage - halfRange);
|
|
@@ -7537,11 +7571,18 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7537
7571
|
onClickWithValue: onClickFilterListItem,
|
|
7538
7572
|
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
7539
7573
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { children: value.value }),
|
|
7540
|
-
openedFilterColumn.withTotalNumber && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7574
|
+
openedFilterColumn.withTotalNumber && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
7575
|
+
Text_default,
|
|
7576
|
+
{
|
|
7577
|
+
fontSize: 14,
|
|
7578
|
+
color: isActive ? theme2.colors.base + "c0" : theme2.colors.textSecondary,
|
|
7579
|
+
children: [
|
|
7580
|
+
"(",
|
|
7581
|
+
value.count,
|
|
7582
|
+
")"
|
|
7583
|
+
]
|
|
7584
|
+
}
|
|
7585
|
+
)
|
|
7545
7586
|
] })
|
|
7546
7587
|
},
|
|
7547
7588
|
value.value
|
|
@@ -7866,32 +7907,6 @@ var Foldable2 = (0, import_react25.memo)(FoldableComponent);
|
|
|
7866
7907
|
Foldable2.box = FoldableComponent.box;
|
|
7867
7908
|
var Foldable_default = Foldable2;
|
|
7868
7909
|
|
|
7869
|
-
// src/utils/variableFunctions.ts
|
|
7870
|
-
var checkBetterHtmlContextValue = (value, functionsName) => {
|
|
7871
|
-
if (value === void 0) {
|
|
7872
|
-
throw new Error(
|
|
7873
|
-
`\`${functionsName}()\` must be used within a \`<BetterHtmlProvider>\`. Make sure to add one at the root of your component tree.`
|
|
7874
|
-
);
|
|
7875
|
-
}
|
|
7876
|
-
return value !== void 0;
|
|
7877
|
-
};
|
|
7878
|
-
var loaderControls = {
|
|
7879
|
-
startLoading: (loaderName) => {
|
|
7880
|
-
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "loaderControls.startLoading")) return;
|
|
7881
|
-
externalBetterHtmlContextValue.setLoaders((oldValue) => ({
|
|
7882
|
-
...oldValue,
|
|
7883
|
-
[loaderName.toString()]: true
|
|
7884
|
-
}));
|
|
7885
|
-
},
|
|
7886
|
-
stopLoading: (loaderName) => {
|
|
7887
|
-
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "loaderControls.stopLoading")) return;
|
|
7888
|
-
externalBetterHtmlContextValue.setLoaders((oldValue) => ({
|
|
7889
|
-
...oldValue,
|
|
7890
|
-
[loaderName.toString()]: false
|
|
7891
|
-
}));
|
|
7892
|
-
}
|
|
7893
|
-
};
|
|
7894
|
-
|
|
7895
7910
|
// src/plugins/react-router-dom.ts
|
|
7896
7911
|
var import_react_router_dom2 = require("react-router-dom");
|
|
7897
7912
|
var reactRouterDomPlugin = {
|
|
@@ -7928,6 +7943,7 @@ var reactRouterDomPlugin = {
|
|
|
7928
7943
|
Tabs,
|
|
7929
7944
|
Text,
|
|
7930
7945
|
ToggleInput,
|
|
7946
|
+
colorThemeControls,
|
|
7931
7947
|
countries,
|
|
7932
7948
|
darkenColor,
|
|
7933
7949
|
desaturateColor,
|