@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.js CHANGED
@@ -11391,22 +11391,22 @@ const getButtonClasses$1 = () => {
11391
11391
  const getAppearanceClasses = (value, icon = false) => {
11392
11392
  switch (value) {
11393
11393
  case "primary":
11394
- 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`;
11394
+ 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`;
11395
11395
  case "danger":
11396
- 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`;
11396
+ 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`;
11397
11397
  case "ghost":
11398
- 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`;
11398
+ 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`;
11399
11399
  case "discrete": {
11400
11400
  if (icon) {
11401
- return `bg-transparent text-black visited:text-black hover:bg-[#000]/[0.08] aria-disabled:text-black/30`;
11401
+ return `bg-transparent text-black visited:text-black hover:bg-[#000]/[0.08] focus-visible:bg-[#000]/[0.08] aria-disabled:text-black/30`;
11402
11402
  }
11403
- return `bg-transparent text-blue-500 visited:text-blue-500 hover:text-blue-700 aria-disabled:text-blue-500/50`;
11403
+ 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`;
11404
11404
  }
11405
11405
  case "transparent": {
11406
- 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`;
11406
+ 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`;
11407
11407
  }
11408
11408
  default:
11409
- return `wcag-grey-200 visited:wcag-grey-200 hover:wcag-grey-300 aria-disabled:bg-grey-200/50 aria-disabled:text-black/30`;
11409
+ 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`;
11410
11410
  }
11411
11411
  };
11412
11412
  const createButtonWithTooltip = (props, className, ref) => {
@@ -38481,7 +38481,16 @@ const useResizeObserver$1 = (ref, enabled = true) => {
38481
38481
  const DisplayRow = React__default.memo(
38482
38482
  React__default.forwardRef(function DisplayRow2(props, externalRef) {
38483
38483
  var _a, _b, _c;
38484
- const { children, cellRenderer: CellRenderer, index: index2, measureRow, row, table, ...otherAttributes } = props;
38484
+ const {
38485
+ children,
38486
+ cellRenderer: CellRenderer,
38487
+ index: index2,
38488
+ measureRow,
38489
+ row,
38490
+ table,
38491
+ remeasureDependencies = [],
38492
+ ...otherAttributes
38493
+ } = props;
38485
38494
  const tableMeta = table.options.meta;
38486
38495
  const attributes = {
38487
38496
  ...otherAttributes,
@@ -38577,7 +38586,7 @@ const DisplayRow = React__default.memo(
38577
38586
  const rowHeight = ((_a2 = ref.current) == null ? void 0 : _a2.getBoundingClientRect().height) ?? 0;
38578
38587
  const expansionHeight = ((_b2 = expansionRef.current) == null ? void 0 : _b2.getBoundingClientRect().height) ?? 0;
38579
38588
  measureRow(rowHeight + expansionHeight);
38580
- }, [expansionRef.current, expandedRowSize == null ? void 0 : expandedRowSize.height]);
38589
+ }, [expansionRef.current, expandedRowSize == null ? void 0 : expandedRowSize.height, ...remeasureDependencies]);
38581
38590
  const className = clsx("group/row", otherAttributes.className, {
38582
38591
  "hover:cursor-grab": tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== "function",
38583
38592
  "hover:cursor-pointer": typeof attributes.onClick === "function"
@@ -55890,10 +55899,17 @@ function EditingControlCell(props) {
55890
55899
  const handleFocus = useEditingCellAutofocus(props);
55891
55900
  const value = cell.getValue();
55892
55901
  const rowChanges = tableMeta.editing.getRowValue(cell.row.id);
55902
+ const shouldRunUpdate = React__default.useRef(false);
55893
55903
  const hasNonTextControl = React__default.useMemo(() => {
55894
55904
  var _a;
55895
55905
  return typeof type === "function" && !!((_a = cellRef.current) == null ? void 0 : _a.querySelector('[data-taco="Select2"],[data-taco="switch"],[data-taco="checkbox"]'));
55896
55906
  }, [cellRef.current]);
55907
+ useLazyEffect(() => {
55908
+ if (hasNonTextControl && shouldRunUpdate.current) {
55909
+ tableMeta.editing.onCellChanged(cell, rowIndex, value, true, false);
55910
+ shouldRunUpdate.current = false;
55911
+ }
55912
+ }, [value]);
55897
55913
  const handleChange = React__default.useCallback(
55898
55914
  (nextValue) => {
55899
55915
  let hasChanged = false;
@@ -55910,9 +55926,7 @@ function EditingControlCell(props) {
55910
55926
  }
55911
55927
  if (hasChanged) {
55912
55928
  tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
55913
- if (hasNonTextControl) {
55914
- requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue, true, false));
55915
- }
55929
+ shouldRunUpdate.current = hasNonTextControl;
55916
55930
  }
55917
55931
  },
55918
55932
  [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value, columnMeta.dataType]
@@ -56190,6 +56204,7 @@ function DiscardChangesConfirmationDialog(props) {
56190
56204
  return /* @__PURE__ */ React__default.createElement(Dialog, { ...dialogProps, showCloseButton: false }, /* @__PURE__ */ React__default.createElement(
56191
56205
  Dialog.Content,
56192
56206
  {
56207
+ "data-taco": "discard-changes-dialog",
56193
56208
  "aria-label": texts.table3.editing.clearChangesConfirmationDialog.title,
56194
56209
  onClick: handleClickInsideDialogContent,
56195
56210
  onKeyDown: handleKeydown
@@ -56208,16 +56223,11 @@ function DiscardChangesConfirmationDialog(props) {
56208
56223
  ));
56209
56224
  }
56210
56225
  function Row(props) {
56211
- const { row, index: index2, table, measureRow } = props;
56226
+ const { row, index: index2, table } = props;
56212
56227
  const focusManager = useAugmentedFocusManager();
56213
56228
  const tableMeta = table.options.meta;
56214
56229
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === index2;
56215
- const rowRef = React__default.useRef(null);
56216
56230
  const hasErrors = tableMeta.editing.hasRowErrors(row.id);
56217
- React__default.useEffect(() => {
56218
- if (!measureRow || !rowRef.current) return;
56219
- measureRow(rowRef.current.getBoundingClientRect().height);
56220
- }, [hasErrors, measureRow]);
56221
56231
  React__default.useEffect(() => {
56222
56232
  if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === void 0) {
56223
56233
  const element = focusManager.focusFirst();
@@ -56274,7 +56284,7 @@ function Row(props) {
56274
56284
  onFocus: handleFocus,
56275
56285
  onKeyDown: handleKeyDown
56276
56286
  };
56277
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(DisplayRow, { ...props, ...attributes, ref: rowRef }, rowStatus === "saving" || rowStatus === "saved" ? /* @__PURE__ */ React__default.createElement(SaveStatus, { rowId: row.id, table }) : null), /* @__PURE__ */ React__default.createElement(
56287
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(DisplayRow, { ...props, ...attributes, remeasureDependencies: [hasErrors] }, rowStatus === "saving" || rowStatus === "saved" ? /* @__PURE__ */ React__default.createElement(SaveStatus, { rowId: row.id, table }) : null), /* @__PURE__ */ React__default.createElement(
56278
56288
  DiscardChangesConfirmationDialog,
56279
56289
  {
56280
56290
  open: showDiscardDialog,