@economic/taco 2.69.0 → 2.69.2-onEditingChange-stale.0

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/taco.cjs CHANGED
@@ -11409,22 +11409,22 @@ const getButtonClasses$1 = () => {
11409
11409
  const getAppearanceClasses = (value, icon = false) => {
11410
11410
  switch (value) {
11411
11411
  case "primary":
11412
- return `wcag-blue-500 visited:wcag-blue-500 hover:wcag-blue-700 hover:active:wcag-blue-500 aria-disabled:bg-blue-500/50 aria-disabled:active:bg-blue-500/50`;
11412
+ return `wcag-blue-500 visited:wcag-blue-500 hover:wcag-blue-700 hover:active:wcag-blue-500 focus-visible:wcag-blue-500 aria-disabled:bg-blue-500/50 aria-disabled:active:bg-blue-500/50`;
11413
11413
  case "danger":
11414
- return `wcag-red-500 visited:wcag-red-500 hover:wcag-red-700 hover:active:wcag-red-500 aria-disabled:bg-red-500/50 aria-disabled:active:bg-red-500/50`;
11414
+ return `wcag-red-500 visited:wcag-red-500 hover:wcag-red-700 hover:active:wcag-red-500 focus-visible:wcag-red-500 aria-disabled:bg-red-500/50 aria-disabled:active:bg-red-500/50`;
11415
11415
  case "ghost":
11416
- return `bg-white border border-blue-500 text-blue-500 visited:text-blue-500 hover:bg-blue-100 hover:text-blue-700 aria-disabled:border-blue-500/50 aria-disabled:text-blue-500/50 aria-disabled:bg-white`;
11416
+ return `bg-white border border-blue-500 text-blue-500 visited:text-blue-500 hover:bg-blue-100 hover:text-blue-700 focus-visible:text-blue-700 aria-disabled:border-blue-500/50 aria-disabled:text-blue-500/50 aria-disabled:bg-white`;
11417
11417
  case "discrete": {
11418
11418
  if (icon) {
11419
- return `bg-transparent text-black visited:text-black hover:bg-[#000]/[0.08] aria-disabled:text-black/30`;
11419
+ return `bg-transparent text-black visited:text-black hover:bg-[#000]/[0.08] focus-visible:bg-[#000]/[0.08] aria-disabled:text-black/30`;
11420
11420
  }
11421
- return `bg-transparent text-blue-500 visited:text-blue-500 hover:text-blue-700 aria-disabled:text-blue-500/50`;
11421
+ return `bg-transparent text-blue-500 visited:text-blue-500 hover:text-blue-700 focus-visible:text-blue-700 aria-disabled:text-blue-500/50`;
11422
11422
  }
11423
11423
  case "transparent": {
11424
- return `bg-transparent text-black visited:text-black hover:text-black hover:bg-[#000]/[0.08] aria-disabled:text-black/30 aria-disabled:bg-transparent`;
11424
+ return `bg-transparent text-black visited:text-black hover:text-black focus-visible:text-black hover:bg-[#000]/[0.08] aria-disabled:text-black/30 aria-disabled:bg-transparent`;
11425
11425
  }
11426
11426
  default:
11427
- return `wcag-grey-200 visited:wcag-grey-200 hover:wcag-grey-300 aria-disabled:bg-grey-200/50 aria-disabled:text-black/30`;
11427
+ return `wcag-grey-200 visited:wcag-grey-200 hover:wcag-grey-300 focus-visible:wcag-grey-300 aria-disabled:bg-grey-200/50 aria-disabled:text-black/30`;
11428
11428
  }
11429
11429
  };
11430
11430
  const createButtonWithTooltip = (props, className, ref) => {
@@ -38499,7 +38499,16 @@ const useResizeObserver$1 = (ref, enabled = true) => {
38499
38499
  const DisplayRow = React.memo(
38500
38500
  React.forwardRef(function DisplayRow2(props, externalRef) {
38501
38501
  var _a, _b, _c;
38502
- const { children, cellRenderer: CellRenderer, index: index2, measureRow, row, table, ...otherAttributes } = props;
38502
+ const {
38503
+ children,
38504
+ cellRenderer: CellRenderer,
38505
+ index: index2,
38506
+ measureRow,
38507
+ row,
38508
+ table,
38509
+ remeasureDependencies = [],
38510
+ ...otherAttributes
38511
+ } = props;
38503
38512
  const tableMeta = table.options.meta;
38504
38513
  const attributes = {
38505
38514
  ...otherAttributes,
@@ -38595,7 +38604,7 @@ const DisplayRow = React.memo(
38595
38604
  const rowHeight = ((_a2 = ref.current) == null ? void 0 : _a2.getBoundingClientRect().height) ?? 0;
38596
38605
  const expansionHeight = ((_b2 = expansionRef.current) == null ? void 0 : _b2.getBoundingClientRect().height) ?? 0;
38597
38606
  measureRow(rowHeight + expansionHeight);
38598
- }, [expansionRef.current, expandedRowSize == null ? void 0 : expandedRowSize.height]);
38607
+ }, [expansionRef.current, expandedRowSize == null ? void 0 : expandedRowSize.height, ...remeasureDependencies]);
38599
38608
  const className = clsx("group/row", otherAttributes.className, {
38600
38609
  "hover:cursor-grab": tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== "function",
38601
38610
  "hover:cursor-pointer": typeof attributes.onClick === "function"
@@ -55908,10 +55917,17 @@ function EditingControlCell(props) {
55908
55917
  const handleFocus = useEditingCellAutofocus(props);
55909
55918
  const value = cell.getValue();
55910
55919
  const rowChanges = tableMeta.editing.getRowValue(cell.row.id);
55920
+ const shouldRunUpdate = React.useRef(false);
55911
55921
  const hasNonTextControl = React.useMemo(() => {
55912
55922
  var _a;
55913
55923
  return typeof type === "function" && !!((_a = cellRef.current) == null ? void 0 : _a.querySelector('[data-taco="Select2"],[data-taco="switch"],[data-taco="checkbox"]'));
55914
55924
  }, [cellRef.current]);
55925
+ useLazyEffect(() => {
55926
+ if (hasNonTextControl && shouldRunUpdate.current) {
55927
+ tableMeta.editing.onCellChanged(cell, rowIndex, value, true, false);
55928
+ shouldRunUpdate.current = false;
55929
+ }
55930
+ }, [value]);
55915
55931
  const handleChange = React.useCallback(
55916
55932
  (nextValue) => {
55917
55933
  let hasChanged = false;
@@ -55928,9 +55944,7 @@ function EditingControlCell(props) {
55928
55944
  }
55929
55945
  if (hasChanged) {
55930
55946
  tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
55931
- if (hasNonTextControl) {
55932
- requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue, true, false));
55933
- }
55947
+ shouldRunUpdate.current = hasNonTextControl;
55934
55948
  }
55935
55949
  },
55936
55950
  [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value, columnMeta.dataType]
@@ -56208,6 +56222,7 @@ function DiscardChangesConfirmationDialog(props) {
56208
56222
  return /* @__PURE__ */ React.createElement(Dialog, { ...dialogProps, showCloseButton: false }, /* @__PURE__ */ React.createElement(
56209
56223
  Dialog.Content,
56210
56224
  {
56225
+ "data-taco": "discard-changes-dialog",
56211
56226
  "aria-label": texts.table3.editing.clearChangesConfirmationDialog.title,
56212
56227
  onClick: handleClickInsideDialogContent,
56213
56228
  onKeyDown: handleKeydown
@@ -56226,16 +56241,11 @@ function DiscardChangesConfirmationDialog(props) {
56226
56241
  ));
56227
56242
  }
56228
56243
  function Row(props) {
56229
- const { row, index: index2, table, measureRow } = props;
56244
+ const { row, index: index2, table } = props;
56230
56245
  const focusManager = useAugmentedFocusManager();
56231
56246
  const tableMeta = table.options.meta;
56232
56247
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === index2;
56233
- const rowRef = React.useRef(null);
56234
56248
  const hasErrors = tableMeta.editing.hasRowErrors(row.id);
56235
- React.useEffect(() => {
56236
- if (!measureRow || !rowRef.current) return;
56237
- measureRow(rowRef.current.getBoundingClientRect().height);
56238
- }, [hasErrors, measureRow]);
56239
56249
  React.useEffect(() => {
56240
56250
  if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === void 0) {
56241
56251
  const element = focusManager.focusFirst();
@@ -56292,7 +56302,7 @@ function Row(props) {
56292
56302
  onFocus: handleFocus,
56293
56303
  onKeyDown: handleKeyDown
56294
56304
  };
56295
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DisplayRow, { ...props, ...attributes, ref: rowRef }, rowStatus === "saving" || rowStatus === "saved" ? /* @__PURE__ */ React.createElement(SaveStatus, { rowId: row.id, table }) : null), /* @__PURE__ */ React.createElement(
56305
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DisplayRow, { ...props, ...attributes, remeasureDependencies: [hasErrors] }, rowStatus === "saving" || rowStatus === "saved" ? /* @__PURE__ */ React.createElement(SaveStatus, { rowId: row.id, table }) : null), /* @__PURE__ */ React.createElement(
56296
56306
  DiscardChangesConfirmationDialog,
56297
56307
  {
56298
56308
  open: showDiscardDialog,