react-better-html 1.1.74 → 1.1.76
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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +12 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -609,6 +609,8 @@ type TableProps<DataItem> = {
|
|
|
609
609
|
/** @default false */
|
|
610
610
|
isStriped?: boolean;
|
|
611
611
|
/** @default false */
|
|
612
|
+
isLoading?: boolean;
|
|
613
|
+
/** @default false */
|
|
612
614
|
withStickyHeader?: boolean;
|
|
613
615
|
/** @default "No data available" */
|
|
614
616
|
noDataItemsMessage?: string;
|
|
@@ -649,7 +651,7 @@ declare const useLoaderControls: () => {
|
|
|
649
651
|
startLoading: (loaderName: LoaderName | AnyOtherString) => void;
|
|
650
652
|
stopLoading: (loaderName: LoaderName | AnyOtherString) => void;
|
|
651
653
|
};
|
|
652
|
-
type BetterHtmlProviderValue = DeepPartialRecord<
|
|
654
|
+
type BetterHtmlProviderValue = DeepPartialRecord<BetterHtmlConfig>;
|
|
653
655
|
type BetterHtmlProviderProps = {
|
|
654
656
|
value?: BetterHtmlProviderValue;
|
|
655
657
|
plugins?: BetterHtmlPlugin[];
|
package/dist/index.d.ts
CHANGED
|
@@ -609,6 +609,8 @@ type TableProps<DataItem> = {
|
|
|
609
609
|
/** @default false */
|
|
610
610
|
isStriped?: boolean;
|
|
611
611
|
/** @default false */
|
|
612
|
+
isLoading?: boolean;
|
|
613
|
+
/** @default false */
|
|
612
614
|
withStickyHeader?: boolean;
|
|
613
615
|
/** @default "No data available" */
|
|
614
616
|
noDataItemsMessage?: string;
|
|
@@ -649,7 +651,7 @@ declare const useLoaderControls: () => {
|
|
|
649
651
|
startLoading: (loaderName: LoaderName | AnyOtherString) => void;
|
|
650
652
|
stopLoading: (loaderName: LoaderName | AnyOtherString) => void;
|
|
651
653
|
};
|
|
652
|
-
type BetterHtmlProviderValue = DeepPartialRecord<
|
|
654
|
+
type BetterHtmlProviderValue = DeepPartialRecord<BetterHtmlConfig>;
|
|
653
655
|
type BetterHtmlProviderProps = {
|
|
654
656
|
value?: BetterHtmlProviderValue;
|
|
655
657
|
plugins?: BetterHtmlPlugin[];
|
package/dist/index.js
CHANGED
|
@@ -1408,7 +1408,7 @@ var theme = {
|
|
|
1408
1408
|
},
|
|
1409
1409
|
dark: {
|
|
1410
1410
|
textPrimary: "#f8f8f8",
|
|
1411
|
-
textSecondary: "#
|
|
1411
|
+
textSecondary: "#c8c8c8",
|
|
1412
1412
|
textLink: "#0894ff",
|
|
1413
1413
|
label: "#111111",
|
|
1414
1414
|
primary: "#9b6499",
|
|
@@ -1417,7 +1417,7 @@ var theme = {
|
|
|
1417
1417
|
success: "#28a745",
|
|
1418
1418
|
info: "#0fa0da",
|
|
1419
1419
|
warn: "#ffc107",
|
|
1420
|
-
error: "#
|
|
1420
|
+
error: "#f5384b",
|
|
1421
1421
|
base: "#f8f8f8",
|
|
1422
1422
|
backgroundBase: "#111111",
|
|
1423
1423
|
backgroundSecondary: "#222222",
|
|
@@ -1626,7 +1626,7 @@ function BetterHtmlProvider({ value, plugins: pluginsToUse, children }) {
|
|
|
1626
1626
|
const [loaders, setLoaders] = (0, import_react.useState)(value?.loaders ?? {});
|
|
1627
1627
|
const [plugins] = (0, import_react.useState)(pluginsToUse ?? []);
|
|
1628
1628
|
const [colorTheme, setColorTheme] = (0, import_react.useState)(
|
|
1629
|
-
localStorage.getItem("theme") === "dark" ? "dark" : "light"
|
|
1629
|
+
localStorage.getItem("theme") === "dark" ? "dark" : value?.colorTheme ?? "light"
|
|
1630
1630
|
);
|
|
1631
1631
|
const readyValue = (0, import_react.useMemo)(
|
|
1632
1632
|
() => ({
|
|
@@ -1679,7 +1679,7 @@ function BetterHtmlProvider({ value, plugins: pluginsToUse, children }) {
|
|
|
1679
1679
|
const observer = new MutationObserver((mutations) => {
|
|
1680
1680
|
mutations.forEach((mutation) => {
|
|
1681
1681
|
if (mutation.type === "attributes") {
|
|
1682
|
-
setColorTheme(html.getAttribute("data-theme") === "dark" ? "dark" : "light");
|
|
1682
|
+
setColorTheme(html.getAttribute("data-theme") === "dark" ? "dark" : value?.colorTheme ?? "light");
|
|
1683
1683
|
}
|
|
1684
1684
|
});
|
|
1685
1685
|
});
|
|
@@ -3064,7 +3064,7 @@ function PageHeader({
|
|
|
3064
3064
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3065
3065
|
Div_default.column,
|
|
3066
3066
|
{
|
|
3067
|
-
|
|
3067
|
+
alignItems: textAlign === "center" ? "center" : textAlign === "right" ? "flex-end" : void 0,
|
|
3068
3068
|
flex: 1,
|
|
3069
3069
|
gap: theme2.styles.gap / 2,
|
|
3070
3070
|
children: [
|
|
@@ -5981,7 +5981,7 @@ var import_styled_components11 = __toESM(require("styled-components"));
|
|
|
5981
5981
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
5982
5982
|
var defaultImageWidth = 120;
|
|
5983
5983
|
var TableStyledComponent = import_styled_components11.default.table.withConfig({
|
|
5984
|
-
shouldForwardProp: (prop) => !["isStriped", "withHover", "withStickyHeader", "theme"].includes(prop)
|
|
5984
|
+
shouldForwardProp: (prop) => !["isStriped", "withHover", "withStickyHeader", "colorTheme", "theme"].includes(prop)
|
|
5985
5985
|
})`
|
|
5986
5986
|
width: 100%;
|
|
5987
5987
|
border-collapse: collapse;
|
|
@@ -6009,7 +6009,7 @@ var TableStyledComponent = import_styled_components11.default.table.withConfig({
|
|
|
6009
6009
|
transition: ${props.theme.styles.transition};
|
|
6010
6010
|
|
|
6011
6011
|
&:not(.isHeader):hover {
|
|
6012
|
-
|
|
6012
|
+
filter: brightness(${props.colorTheme === "light" ? "0.95" : "0.85"});
|
|
6013
6013
|
}
|
|
6014
6014
|
` : ""}
|
|
6015
6015
|
|
|
@@ -6020,7 +6020,7 @@ var TableStyledComponent = import_styled_components11.default.table.withConfig({
|
|
|
6020
6020
|
}
|
|
6021
6021
|
|
|
6022
6022
|
td {
|
|
6023
|
-
border-top: 1px solid ${(props) => props.theme.colors.border}
|
|
6023
|
+
border-top: 1px solid ${(props) => props.theme.colors.border + (props.colorTheme === "light" ? "60" : "40")};
|
|
6024
6024
|
padding: ${(props) => props.theme.styles.gap}px ${(props) => props.theme.styles.space}px;
|
|
6025
6025
|
|
|
6026
6026
|
&.noData {
|
|
@@ -6047,12 +6047,14 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6047
6047
|
columns,
|
|
6048
6048
|
data,
|
|
6049
6049
|
isStriped,
|
|
6050
|
+
isLoading,
|
|
6050
6051
|
withStickyHeader,
|
|
6051
6052
|
noDataItemsMessage = "No data available",
|
|
6052
6053
|
onClickRow,
|
|
6053
6054
|
onClickAllCheckboxes,
|
|
6054
6055
|
...props
|
|
6055
6056
|
}, ref) {
|
|
6057
|
+
const { colorTheme } = useBetterHtmlContext();
|
|
6056
6058
|
const theme2 = useTheme();
|
|
6057
6059
|
const [checkedItems, setCheckedItems] = (0, import_react22.useState)([]);
|
|
6058
6060
|
const renderCellContent = (0, import_react22.useCallback)(
|
|
@@ -6124,6 +6126,7 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6124
6126
|
isStriped,
|
|
6125
6127
|
withHover: onClickRow !== void 0,
|
|
6126
6128
|
withStickyHeader,
|
|
6129
|
+
colorTheme,
|
|
6127
6130
|
theme: theme2,
|
|
6128
6131
|
children: [
|
|
6129
6132
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tr", { className: "isHeader", children: columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -6143,7 +6146,7 @@ var TableComponent = (0, import_react22.forwardRef)(function Table({
|
|
|
6143
6146
|
},
|
|
6144
6147
|
column.type + column.label + index
|
|
6145
6148
|
)) }) }),
|
|
6146
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tbody", { children: data.length > 0 ? data.map((item, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6149
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tbody", { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Loader_default.box, {}) }) }) : data.length > 0 ? data.map((item, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
6147
6150
|
"tr",
|
|
6148
6151
|
{
|
|
6149
6152
|
className: onClickRow ? "isClickable" : void 0,
|