@helpwave/hightide 0.6.10 → 0.6.12

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.mjs CHANGED
@@ -7189,7 +7189,7 @@ var FormStore = class {
7189
7189
  return this.values[key];
7190
7190
  }
7191
7191
  getAllValues() {
7192
- return { ...this.values };
7192
+ return this.values;
7193
7193
  }
7194
7194
  setValue(key, value, triggerUpdate = false) {
7195
7195
  if (this.values[key] !== value) {
@@ -7216,7 +7216,7 @@ var FormStore = class {
7216
7216
  type: "onUpdate",
7217
7217
  key: "ALL",
7218
7218
  updatedKeys: Object.keys(values),
7219
- update: { ...values },
7219
+ update: values,
7220
7220
  values: this.values,
7221
7221
  hasErrors: this.getHasError(),
7222
7222
  errors: this.getErrors()
@@ -7228,19 +7228,19 @@ var FormStore = class {
7228
7228
  return !!this.touched[key];
7229
7229
  }
7230
7230
  getAllTouched() {
7231
- return { ...this.touched };
7231
+ return this.touched;
7232
7232
  }
7233
7233
  setTouched(key, isTouched = true) {
7234
7234
  if (this.touched[key] === isTouched) return;
7235
7235
  this.touched[key] = isTouched;
7236
- this.notify({ type: "onTouched", key, value: this.values[key], values: { ...this.values } });
7236
+ this.notify({ type: "onTouched", key, value: this.values[key], values: this.values });
7237
7237
  }
7238
7238
  // Error and Validation
7239
7239
  getHasError() {
7240
7240
  return Object.values(this.errors).some((value) => value !== void 0 && value !== null);
7241
7241
  }
7242
7242
  getErrors() {
7243
- return { ...this.errors };
7243
+ return this.errors;
7244
7244
  }
7245
7245
  getError(key) {
7246
7246
  return this.errors[key];
@@ -7252,7 +7252,7 @@ var FormStore = class {
7252
7252
  } else {
7253
7253
  this.errors[key] = error;
7254
7254
  }
7255
- this.notify({ type: "onError", key, value: this.values[key], error, values: { ...this.values } });
7255
+ this.notify({ type: "onError", key, value: this.values[key], error, values: this.values });
7256
7256
  }
7257
7257
  getHasTriedSubmitting() {
7258
7258
  return this.hasTriedSubmitting;
@@ -7308,8 +7308,8 @@ var FormStore = class {
7308
7308
  type: "onSubmit",
7309
7309
  key: "ALL",
7310
7310
  hasErrors,
7311
- errors: { ...this.errors },
7312
- values: { ...this.values }
7311
+ errors: this.errors,
7312
+ values: this.values
7313
7313
  });
7314
7314
  }
7315
7315
  reset() {
@@ -7317,10 +7317,10 @@ var FormStore = class {
7317
7317
  this.hasTriedSubmitting = false;
7318
7318
  this.touched = {};
7319
7319
  Object.keys(this.initialValues).forEach((key) => {
7320
- this.notify({ type: "onChange", key, value: this.values[key], values: { ...this.values } });
7320
+ this.notify({ type: "onChange", key, value: this.values[key], values: this.values });
7321
7321
  });
7322
7322
  this.validateAll();
7323
- this.notify({ type: "reset", key: "ALL", values: { ...this.values }, errors: { ...this.errors } });
7323
+ this.notify({ type: "reset", key: "ALL", values: this.values, errors: this.errors });
7324
7324
  }
7325
7325
  };
7326
7326
 
@@ -7408,11 +7408,11 @@ function useCreateForm({
7408
7408
  const callbacks = useMemo3(() => ({
7409
7409
  reset: () => storeRef.current.reset(),
7410
7410
  submit: () => storeRef.current.submit(),
7411
- update: (updater) => {
7411
+ update: (updater, triggerUpdate = false) => {
7412
7412
  if (typeof updater === "function") {
7413
- storeRef.current.setValues(updater(storeRef.current.getAllValues()));
7413
+ storeRef.current.setValues(updater(storeRef.current.getAllValues()), triggerUpdate);
7414
7414
  } else {
7415
- storeRef.current.setValues(updater);
7415
+ storeRef.current.setValues(updater, triggerUpdate);
7416
7416
  }
7417
7417
  },
7418
7418
  validateAll: () => storeRef.current.validateAll()
@@ -12541,8 +12541,7 @@ var Pagination = ({
12541
12541
  pageIndex,
12542
12542
  pageCount,
12543
12543
  onPageIndexChanged,
12544
- className,
12545
- style
12544
+ ...props
12546
12545
  }) => {
12547
12546
  const translation = useHightideTranslation();
12548
12547
  const [value, setValue] = useState25((pageIndex + 1).toString());
@@ -12559,7 +12558,7 @@ var Pagination = ({
12559
12558
  const changePage = (page) => {
12560
12559
  onPageIndexChanged(page);
12561
12560
  };
12562
- return /* @__PURE__ */ jsxs25("div", { className: clsx23("flex-row-1", className), style, children: [
12561
+ return /* @__PURE__ */ jsxs25("div", { ...props, className: clsx23("flex-row-1", props.className), children: [
12563
12562
  /* @__PURE__ */ jsx50(Tooltip, { tooltip: translation("first"), children: /* @__PURE__ */ jsx50(
12564
12563
  Button,
12565
12564
  {
@@ -15175,7 +15174,7 @@ var TableDisplay = ({
15175
15174
  import { useEffect as useEffect32 } from "react";
15176
15175
  import clsx35 from "clsx";
15177
15176
  import { jsx as jsx70, jsxs as jsxs41 } from "react/jsx-runtime";
15178
- var TablePaginationMenu = () => {
15177
+ var TablePaginationMenu = ({ ...props }) => {
15179
15178
  const { table } = useTableDataContext();
15180
15179
  useEffect32(() => {
15181
15180
  const { pageIndex } = table.getState().pagination;
@@ -15187,9 +15186,13 @@ var TablePaginationMenu = () => {
15187
15186
  return /* @__PURE__ */ jsx70(
15188
15187
  Pagination,
15189
15188
  {
15189
+ ...props,
15190
15190
  pageIndex: table.getState().pagination.pageIndex,
15191
15191
  pageCount: table.getPageCount(),
15192
- onPageIndexChanged: (page) => table.setPageIndex(page)
15192
+ onPageIndexChanged: (page) => {
15193
+ table.setPageIndex(page);
15194
+ props.onPageIndexChanged?.(page);
15195
+ }
15193
15196
  }
15194
15197
  );
15195
15198
  };
@@ -15211,10 +15214,10 @@ var TablePageSizeSelect = ({
15211
15214
  );
15212
15215
  };
15213
15216
  var TablePagination = ({ allowChangingPageSize = true, pageSizeOptions, ...props }) => {
15214
- return /* @__PURE__ */ jsx70("div", { ...props, className: clsx35("flex-row-2 items-center justify-center", props.className), children: /* @__PURE__ */ jsxs41("div", { className: "relative", children: [
15217
+ return /* @__PURE__ */ jsxs41("div", { ...props, className: clsx35("container flex-col-2 sm:flex-row-8 items-center justify-center", props.className), children: [
15215
15218
  /* @__PURE__ */ jsx70(TablePaginationMenu, {}),
15216
- /* @__PURE__ */ jsx70(Visibility, { isVisible: allowChangingPageSize, children: /* @__PURE__ */ jsx70(TablePageSizeSelect, { pageSizeOptions, buttonProps: { className: "absolute left-1/1 top-1/2 -translate-y-1/2 translate-x-4 h-10 min-w-24" } }) })
15217
- ] }) });
15219
+ /* @__PURE__ */ jsx70(Visibility, { isVisible: allowChangingPageSize, children: /* @__PURE__ */ jsx70(TablePageSizeSelect, { pageSizeOptions, buttonProps: { className: "h-10 min-w-24 max-w-24" } }) })
15220
+ ] });
15218
15221
  };
15219
15222
 
15220
15223
  // src/components/user-interaction/Checkbox.tsx
@@ -16754,9 +16757,9 @@ import { Binary } from "lucide-react";
16754
16757
  import { jsx as jsx89, jsxs as jsxs55 } from "react/jsx-runtime";
16755
16758
  var NumberProperty = ({
16756
16759
  value,
16757
- onRemove,
16758
16760
  onValueChange,
16759
16761
  onEditComplete,
16762
+ onValueClear,
16760
16763
  readOnly,
16761
16764
  suffix,
16762
16765
  ...baseProps
@@ -16767,7 +16770,7 @@ var NumberProperty = ({
16767
16770
  PropertyBase,
16768
16771
  {
16769
16772
  ...baseProps,
16770
- onRemove,
16773
+ onValueClear,
16771
16774
  hasValue,
16772
16775
  icon: /* @__PURE__ */ jsx89(Binary, { size: 24 }),
16773
16776
  children: ({ invalid }) => /* @__PURE__ */ jsxs55(
@@ -16789,7 +16792,7 @@ var NumberProperty = ({
16789
16792
  onValueChange: (value2) => {
16790
16793
  const numberValue = parseFloat(value2);
16791
16794
  if (isNaN(numberValue)) {
16792
- onRemove();
16795
+ onValueClear();
16793
16796
  } else {
16794
16797
  onValueChange?.(numberValue);
16795
16798
  }
@@ -16797,7 +16800,7 @@ var NumberProperty = ({
16797
16800
  onEditComplete: (value2) => {
16798
16801
  const numberValue = parseFloat(value2);
16799
16802
  if (isNaN(numberValue)) {
16800
- onRemove();
16803
+ onValueClear();
16801
16804
  } else {
16802
16805
  onEditComplete?.(numberValue);
16803
16806
  }
@@ -16868,7 +16871,6 @@ import { jsx as jsx91 } from "react/jsx-runtime";
16868
16871
  var TextProperty = ({
16869
16872
  value,
16870
16873
  readOnly,
16871
- onRemove,
16872
16874
  onValueChange,
16873
16875
  onEditComplete,
16874
16876
  ...baseProps
@@ -16879,7 +16881,6 @@ var TextProperty = ({
16879
16881
  PropertyBase,
16880
16882
  {
16881
16883
  ...baseProps,
16882
- onRemove,
16883
16884
  hasValue,
16884
16885
  icon: /* @__PURE__ */ jsx91(Text, { size: 24 }),
16885
16886
  children: ({ invalid }) => /* @__PURE__ */ jsx91(
@@ -16892,20 +16893,8 @@ var TextProperty = ({
16892
16893
  value: value ?? "",
16893
16894
  readOnly,
16894
16895
  placeholder: translation("text"),
16895
- onValueChange: (value2) => {
16896
- if (!value2) {
16897
- onRemove?.();
16898
- } else {
16899
- onValueChange?.(value2);
16900
- }
16901
- },
16902
- onEditComplete: (value2) => {
16903
- if (!value2) {
16904
- onRemove?.();
16905
- } else {
16906
- onEditComplete?.(value2);
16907
- }
16908
- }
16896
+ onValueChange: (value2) => onValueChange?.(value2),
16897
+ onEditComplete: (value2) => onEditComplete?.(value2)
16909
16898
  }
16910
16899
  )
16911
16900
  }