react-better-html 1.1.107 → 1.1.109

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 CHANGED
@@ -665,10 +665,13 @@ type ElementColumn<DataItem> = {
665
665
  type ImageColumn<DataItem> = {
666
666
  type: "image";
667
667
  keyName?: keyof DataItem;
668
- } & ImageProps;
668
+ getImageSrc?: (item: DataItem, index: number) => string;
669
+ imageProps?: ImageProps;
670
+ };
669
671
  type CheckboxColumn = {
670
672
  type: "checkbox";
671
- } & ToggleInputProps<boolean>;
673
+ toggleInputProps?: ToggleInputProps<boolean>;
674
+ };
672
675
  type NumberFilter<DataItem> = {
673
676
  filter?: "number";
674
677
  getValue?: (item: DataItem) => number;
@@ -715,7 +718,7 @@ type TableRef = {
715
718
  setCheckedItems: React.Dispatch<React.SetStateAction<boolean[]>>;
716
719
  };
717
720
  type TableComponentType = {
718
- <DataItem>(props: ComponentPropWithRef<HTMLDivElement, TableProps<DataItem>>): React.ReactElement;
721
+ <DataItem>(props: ComponentPropWithRef<TableRef, TableProps<DataItem>>): React.ReactElement;
719
722
  };
720
723
  declare const TableComponent: TableComponentType;
721
724
  declare const Table: typeof TableComponent;
@@ -849,8 +852,10 @@ declare const loaderControls: {
849
852
  stopLoading: (loaderName: LoaderName | AnyOtherString) => void;
850
853
  };
851
854
 
855
+ declare const countries: Country[];
856
+
852
857
  declare const isMobileDevice: boolean;
853
858
 
854
859
  declare const reactRouterDomPlugin: BetterHtmlPlugin;
855
860
 
856
- 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, darkenColor, desaturateColor, formatPhoneNumber, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, reactRouterDomPlugin, saturateColor, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
861
+ 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 };
package/dist/index.d.ts CHANGED
@@ -665,10 +665,13 @@ type ElementColumn<DataItem> = {
665
665
  type ImageColumn<DataItem> = {
666
666
  type: "image";
667
667
  keyName?: keyof DataItem;
668
- } & ImageProps;
668
+ getImageSrc?: (item: DataItem, index: number) => string;
669
+ imageProps?: ImageProps;
670
+ };
669
671
  type CheckboxColumn = {
670
672
  type: "checkbox";
671
- } & ToggleInputProps<boolean>;
673
+ toggleInputProps?: ToggleInputProps<boolean>;
674
+ };
672
675
  type NumberFilter<DataItem> = {
673
676
  filter?: "number";
674
677
  getValue?: (item: DataItem) => number;
@@ -715,7 +718,7 @@ type TableRef = {
715
718
  setCheckedItems: React.Dispatch<React.SetStateAction<boolean[]>>;
716
719
  };
717
720
  type TableComponentType = {
718
- <DataItem>(props: ComponentPropWithRef<HTMLDivElement, TableProps<DataItem>>): React.ReactElement;
721
+ <DataItem>(props: ComponentPropWithRef<TableRef, TableProps<DataItem>>): React.ReactElement;
719
722
  };
720
723
  declare const TableComponent: TableComponentType;
721
724
  declare const Table: typeof TableComponent;
@@ -849,8 +852,10 @@ declare const loaderControls: {
849
852
  stopLoading: (loaderName: LoaderName | AnyOtherString) => void;
850
853
  };
851
854
 
855
+ declare const countries: Country[];
856
+
852
857
  declare const isMobileDevice: boolean;
853
858
 
854
859
  declare const reactRouterDomPlugin: BetterHtmlPlugin;
855
860
 
856
- 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, darkenColor, desaturateColor, formatPhoneNumber, generateRandomString, getBrowser, getFormErrorObject, isMobileDevice, lightenColor, loaderControls, reactRouterDomPlugin, saturateColor, useBetterHtmlContext, useBooleanState, useDebounceState, useForm, useLoader, useLoaderControls, useMediaQuery, usePageResize, usePageScroll, useTheme, useUrlQuery };
861
+ 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 };
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
+ countries: () => countries,
55
56
  darkenColor: () => darkenColor,
56
57
  desaturateColor: () => desaturateColor,
57
58
  formatPhoneNumber: () => formatPhoneNumber,
@@ -7004,12 +7005,19 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
7004
7005
  return column.render?.(item, index) ?? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {});
7005
7006
  }
7006
7007
  case "image": {
7007
- const { type, keyName, ...props2 } = column;
7008
- const src = keyName ? item[keyName] : void 0;
7009
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Image_default, { src, width: defaultImageWidth, borderRadius: theme2.styles.borderRadius / 2, ...props2 });
7008
+ const src = column.getImageSrc?.(item, index) ?? (column.keyName ? item[column.keyName] : void 0);
7009
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7010
+ Image_default,
7011
+ {
7012
+ src,
7013
+ width: defaultImageWidth,
7014
+ borderRadius: theme2.styles.borderRadius / 2,
7015
+ ...column.imageProps
7016
+ }
7017
+ );
7010
7018
  }
7011
7019
  case "checkbox": {
7012
- const { type, onChange, ...props2 } = column;
7020
+ const { onChange, ...toggleInputProps } = column.toggleInputProps ?? {};
7013
7021
  const checkedValue = checkedItems[index];
7014
7022
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7015
7023
  ToggleInput_default.checkbox,
@@ -7021,7 +7029,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
7021
7029
  );
7022
7030
  onChange?.(checked, value);
7023
7031
  },
7024
- ...props2
7032
+ ...toggleInputProps
7025
7033
  }
7026
7034
  );
7027
7035
  }
@@ -7329,7 +7337,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
7329
7337
  },
7330
7338
  JSON.stringify(item) + rowIndex
7331
7339
  )) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "withoutHover", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
7332
- pageSize !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tfoot", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "isFooter", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7340
+ pageSize !== void 0 && pageCountInternal > 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tfoot", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "isFooter", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7333
7341
  Div_default.column,
7334
7342
  {
7335
7343
  position: "relative",
@@ -7904,6 +7912,7 @@ var reactRouterDomPlugin = {
7904
7912
  Tabs,
7905
7913
  Text,
7906
7914
  ToggleInput,
7915
+ countries,
7907
7916
  darkenColor,
7908
7917
  desaturateColor,
7909
7918
  formatPhoneNumber,