@natoora-libs/core 0.1.16-dev-doug-7 → 0.1.16-dev-doug-8

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.
@@ -8007,13 +8007,15 @@ var TableDesktopNumericField = ({
8007
8007
  field,
8008
8008
  variant = "standard",
8009
8009
  size,
8010
+ validateInput,
8010
8011
  onUpdateEditableCell
8011
8012
  }) => {
8012
8013
  const [input, setInput] = (0, import_react36.useState)(initialValue);
8013
8014
  const oldValue = (0, import_react36.useRef)(initialValue);
8015
+ const isDirty = (0, import_react36.useMemo)(() => input !== oldValue.current, [input, oldValue.current]);
8016
+ const hasValidationError = (0, import_react36.useMemo)(() => isDirty && !validateInput?.(input), [input, validateInput, isDirty]);
8014
8017
  const commitValue = (value) => {
8015
- const isDirty = value !== oldValue.current;
8016
- if (!onUpdateEditableCell || !isDirty) {
8018
+ if (hasValidationError || !onUpdateEditableCell || !isDirty) {
8017
8019
  return;
8018
8020
  }
8019
8021
  oldValue.current = value;
@@ -8034,6 +8036,7 @@ var TableDesktopNumericField = ({
8034
8036
  value: input,
8035
8037
  disabled,
8036
8038
  label: inputLabel,
8039
+ error: hasValidationError,
8037
8040
  onKeyDown: handleKeyDown,
8038
8041
  onChange: (e) => {
8039
8042
  e.target.value = e.target.value.replace(/\D/g, "");
@@ -8141,9 +8144,9 @@ var TableDesktopTextField = ({
8141
8144
  }) => {
8142
8145
  const [input, setInput] = (0, import_react38.useState)(initialValue);
8143
8146
  const oldValue = (0, import_react38.useRef)(initialValue);
8144
- const hasValidationError = (0, import_react38.useMemo)(() => !validateInput?.(input), [input, validateInput]);
8147
+ const isDirty = (0, import_react38.useMemo)(() => input !== oldValue.current, [input, oldValue.current]);
8148
+ const hasValidationError = (0, import_react38.useMemo)(() => isDirty && !validateInput?.(input), [input, validateInput]);
8145
8149
  const commitValue = (value) => {
8146
- const isDirty = value !== oldValue.current;
8147
8150
  if (hasValidationError || !onUpdateEditableCell || !isDirty) {
8148
8151
  return;
8149
8152
  }
@@ -8258,6 +8261,7 @@ var TableDesktopEditableComponent = ({
8258
8261
  field,
8259
8262
  initialValue: editInitialValue ?? "",
8260
8263
  inputLabel: inputLabel ?? "",
8264
+ validateInput,
8261
8265
  onUpdateEditableCell
8262
8266
  }
8263
8267
  )