react-better-html 1.1.179 → 1.1.181

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
@@ -586,7 +586,7 @@ declare function useForm<FormFields extends Record<string | number, string | num
586
586
  dropdownRefs: Record<keyof FormFields, HTMLDivElement | undefined>;
587
587
  toggleInputRefs: Record<keyof FormFields, ToggleInputRef | undefined>;
588
588
  validate: () => {};
589
- onSubmit: (event: React.FormEvent<HTMLFormElement>) => Promise<void>;
589
+ onSubmit: (event?: React.FormEvent<HTMLFormElement>) => Promise<void>;
590
590
  reset: () => void;
591
591
  requiredFields: (keyof FormFields)[] | undefined;
592
592
  isDirty: boolean;
@@ -700,7 +700,7 @@ declare const ColorThemeSwitch: typeof ColorThemeSwitchComponent & {
700
700
  type FilterPreset = "today" | "yesterday" | "tomorrow" | "thisWeek" | "thisMonth" | "thisYear" | "lastWeek" | "lastMonth" | "lastYear" | "nextWeek" | "nextMonth" | "nextYear";
701
701
  type ListFilterValue = {
702
702
  label?: string;
703
- value: string;
703
+ value: number | string;
704
704
  count: number;
705
705
  };
706
706
  type TableFilterData = {
@@ -713,7 +713,7 @@ type TableFilterData = {
713
713
  max?: string;
714
714
  } | {
715
715
  type: "list";
716
- list?: string[];
716
+ list?: ListFilterValue["value"][];
717
717
  };
718
718
  type TextColumn<DataItem> = {
719
719
  type: "text";
package/dist/index.d.ts CHANGED
@@ -586,7 +586,7 @@ declare function useForm<FormFields extends Record<string | number, string | num
586
586
  dropdownRefs: Record<keyof FormFields, HTMLDivElement | undefined>;
587
587
  toggleInputRefs: Record<keyof FormFields, ToggleInputRef | undefined>;
588
588
  validate: () => {};
589
- onSubmit: (event: React.FormEvent<HTMLFormElement>) => Promise<void>;
589
+ onSubmit: (event?: React.FormEvent<HTMLFormElement>) => Promise<void>;
590
590
  reset: () => void;
591
591
  requiredFields: (keyof FormFields)[] | undefined;
592
592
  isDirty: boolean;
@@ -700,7 +700,7 @@ declare const ColorThemeSwitch: typeof ColorThemeSwitchComponent & {
700
700
  type FilterPreset = "today" | "yesterday" | "tomorrow" | "thisWeek" | "thisMonth" | "thisYear" | "lastWeek" | "lastMonth" | "lastYear" | "nextWeek" | "nextMonth" | "nextYear";
701
701
  type ListFilterValue = {
702
702
  label?: string;
703
- value: string;
703
+ value: number | string;
704
704
  count: number;
705
705
  };
706
706
  type TableFilterData = {
@@ -713,7 +713,7 @@ type TableFilterData = {
713
713
  max?: string;
714
714
  } | {
715
715
  type: "list";
716
- list?: string[];
716
+ list?: ListFilterValue["value"][];
717
717
  };
718
718
  type TextColumn<DataItem> = {
719
719
  type: "text";
package/dist/index.js CHANGED
@@ -3120,7 +3120,7 @@ function useForm(options) {
3120
3120
  }, [validate, values]);
3121
3121
  const onSubmitFunction = (0, import_react10.useCallback)(
3122
3122
  async (event) => {
3123
- event.preventDefault();
3123
+ event?.preventDefault();
3124
3124
  setIsSubmitting.setTrue();
3125
3125
  try {
3126
3126
  const validationErrors = validateForm();
@@ -7939,8 +7939,8 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7939
7939
  });
7940
7940
  const [openedFilterColumnIndex, setOpenedFilterColumnIndex] = (0, import_react25.useState)();
7941
7941
  const [filterListSelectedItems, setFilterListSelectedItems] = (0, import_react25.useState)();
7942
- const openedFilterData = openedFilterColumnIndex ? filterData[openedFilterColumnIndex] : void 0;
7943
- const openedFilterColumn = openedFilterColumnIndex ? readyColumns[openedFilterColumnIndex] : void 0;
7942
+ const openedFilterData = openedFilterColumnIndex !== void 0 ? filterData[openedFilterColumnIndex] : void 0;
7943
+ const openedFilterColumn = openedFilterColumnIndex !== void 0 ? readyColumns[openedFilterColumnIndex] : void 0;
7944
7944
  const filterForm = useForm({
7945
7945
  defaultValues: {
7946
7946
  min: void 0,
@@ -8230,7 +8230,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
8230
8230
  const label = valueFromList ? valueFromList.label : value;
8231
8231
  let searchPassed = openedFilterColumn.filter === "list" && openedFilterColumn.withSearch ? false : true;
8232
8232
  if (openedFilterColumn.filter === "list" && openedFilterColumn.withSearch) {
8233
- searchPassed = label?.toLowerCase().includes(filterForm.values.search.toLowerCase()) ?? false;
8233
+ searchPassed = label?.toString().toLowerCase().includes(filterForm.values.search.toLowerCase()) ?? false;
8234
8234
  }
8235
8235
  if (value !== void 0 && value !== null && value !== "" && searchPassed) {
8236
8236
  if (previousValue.some((item) => item.value === value)) {
@@ -8242,7 +8242,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
8242
8242
  );
8243
8243
  } else
8244
8244
  previousValue.push({
8245
- label,
8245
+ label: label?.toString() ?? "",
8246
8246
  value,
8247
8247
  count: 1
8248
8248
  });