@economic/taco 2.9.0 → 2.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. package/dist/components/Menu/Menu.d.ts +1 -2
  2. package/dist/components/Menu/components/Content.d.ts +1 -1
  3. package/dist/components/Menu/components/Separator.d.ts +2 -4
  4. package/dist/components/Menu/components/SubMenu.d.ts +1 -1
  5. package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +3 -3
  6. package/dist/esm/packages/taco/src/components/Menu/Menu.js.map +1 -1
  7. package/dist/esm/packages/taco/src/components/Menu/components/Separator.js +6 -7
  8. package/dist/esm/packages/taco/src/components/Menu/components/Separator.js.map +1 -1
  9. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +2 -3
  10. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
  11. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +2 -3
  12. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +1 -1
  14. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js +1 -1
  16. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js +2 -5
  18. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js +1 -2
  20. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js +4 -8
  22. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js +1 -1
  24. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +12 -10
  26. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
  27. package/dist/taco.cjs.development.js +31 -40
  28. package/dist/taco.cjs.development.js.map +1 -1
  29. package/dist/taco.cjs.production.min.js +1 -1
  30. package/dist/taco.cjs.production.min.js.map +1 -1
  31. package/package.json +14 -14
  32. package/types.json +26 -81
@@ -3983,29 +3983,31 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
3983
3983
 
3984
3984
  const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
3985
3985
  const {
3986
+ title,
3986
3987
  children,
3987
3988
  placement,
3988
- title,
3989
3989
  ...otherProps
3990
3990
  } = props;
3991
- const className = cn('xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white', otherProps.className);
3992
- const style = {
3993
- transformOrigin: 'var(--radix-tooltip-content-transform-origin)'
3994
- };
3991
+ const className = cn(otherProps.className);
3995
3992
  return /*#__PURE__*/React.createElement(TooltipPrimitive.Root, {
3996
3993
  delayDuration: 250
3997
3994
  }, /*#__PURE__*/React.createElement(TooltipPrimitive.Trigger, {
3998
3995
  asChild: true,
3999
3996
  ref: ref
4000
3997
  }, children), /*#__PURE__*/React.createElement(TooltipPrimitive.Portal, null, /*#__PURE__*/React.createElement(TooltipPrimitive.Content, Object.assign({}, otherProps, {
3998
+ asChild: true,
4001
3999
  className: className,
4002
- "data-taco": "tooltip",
4003
4000
  side: placement,
4004
- sideOffset: 3,
4005
- style: style
4006
- }), /*#__PURE__*/React.createElement(TooltipPrimitive.Arrow, {
4001
+ sideOffset: 3
4002
+ }), /*#__PURE__*/React.createElement("div", {
4003
+ className: "xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white",
4004
+ "data-taco": "tooltip",
4005
+ style: {
4006
+ transformOrigin: 'var(--radix-tooltip-content-transform-origin)'
4007
+ }
4008
+ }, /*#__PURE__*/React.createElement(TooltipPrimitive.Arrow, {
4007
4009
  className: "-mt-px fill-blue-900/90 stroke-blue-900/90"
4008
- }), title)));
4010
+ }), title))));
4009
4011
  });
4010
4012
 
4011
4013
  const getButtonClasses = () => {
@@ -7852,12 +7854,11 @@ const RadioGroup$1 = /*#__PURE__*/React.forwardRef(function MenuRadioItem(props,
7852
7854
  });
7853
7855
  RadioGroup$1.Item = RadioItem;
7854
7856
 
7855
- const Separator = /*#__PURE__*/React.forwardRef((props, ref) => {
7856
- return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Separator, Object.assign({}, props, {
7857
- className: "bg-grey-300 my-1 h-px",
7858
- ref: ref
7859
- }));
7860
- });
7857
+ const Separator = () => {
7858
+ return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Separator, {
7859
+ className: "bg-grey-300 my-1 h-px"
7860
+ });
7861
+ };
7861
7862
 
7862
7863
  const Header = /*#__PURE__*/React.forwardRef(function MenuHeader(props, ref) {
7863
7864
  const menu = useCurrentMenu();
@@ -16651,7 +16652,7 @@ const useCssGrid = (table, isPrintTable = false) => {
16651
16652
  };
16652
16653
  };
16653
16654
 
16654
- function useCurrentRow(defaultCurrentRowIndex) {
16655
+ function useCurrentRow(defaultCurrentRowIndex = 0) {
16655
16656
  const [currentRowIndex, setCurrentRowIndex] = React__default.useState(defaultCurrentRowIndex);
16656
16657
  const move = (direction, length, scrollToIndex) => setCurrentRowIndex(currentIndex => {
16657
16658
  const nextIndex = currentIndex !== undefined ? getNextIndex$2(direction, currentIndex, length) : 0;
@@ -17071,8 +17072,7 @@ function useCurrentRowListener(table) {
17071
17072
  const meta = table.options.meta;
17072
17073
  const rows = table.getRowModel().rows;
17073
17074
  React__default.useEffect(() => {
17074
- const currentRowIndex = meta.currentRow.currentRowIndex;
17075
- if (currentRowIndex !== undefined && currentRowIndex > rows.length) {
17075
+ if (meta.currentRow.currentRowIndex > rows.length) {
17076
17076
  meta.currentRow.setCurrentRowIndex(0);
17077
17077
  }
17078
17078
  }, [rows.length]);
@@ -17183,12 +17183,9 @@ function useRowSelection() {
17183
17183
  const rows = table.getRowModel().rows;
17184
17184
  const tableMeta = table.options.meta;
17185
17185
  if (event.key === ' ') {
17186
+ var _rows$tableMeta$curre;
17186
17187
  event.preventDefault();
17187
- const currentRowIndex = tableMeta.currentRow.currentRowIndex;
17188
- if (currentRowIndex !== undefined) {
17189
- var _rows$currentRowIndex;
17190
- (_rows$currentRowIndex = rows[currentRowIndex]) === null || _rows$currentRowIndex === void 0 ? void 0 : _rows$currentRowIndex.toggleSelected();
17191
- }
17188
+ (_rows$tableMeta$curre = rows[tableMeta.currentRow.currentRowIndex]) === null || _rows$tableMeta$curre === void 0 ? void 0 : _rows$tableMeta$curre.toggleSelected();
17192
17189
  return;
17193
17190
  } else if ((event.ctrlKey || event.metaKey) && event.key === 'a') {
17194
17191
  event.preventDefault();
@@ -17211,7 +17208,7 @@ function useRowClick(onRowClick) {
17211
17208
  const tableMeta = table.options.meta;
17212
17209
  if (event.key === 'Enter') {
17213
17210
  event.preventDefault();
17214
- if (onRowClick && tableMeta.currentRow.currentRowIndex !== undefined) {
17211
+ if (onRowClick) {
17215
17212
  onRowClick(rows[tableMeta.currentRow.currentRowIndex].original);
17216
17213
  }
17217
17214
  return;
@@ -17990,7 +17987,7 @@ function EditingCell$1(props) {
17990
17987
  }));
17991
17988
  }
17992
17989
  const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditingCell(props) {
17993
- var _tableMeta$editing$ge, _tableMeta$editing$ro, _rows$currentRowIndex, _column$columnDef$met;
17990
+ var _tableMeta$editing$ge, _tableMeta$editing$ro, _rows$tableMeta$curre, _column$columnDef$met;
17994
17991
  const {
17995
17992
  cell,
17996
17993
  column,
@@ -18042,8 +18039,7 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
18042
18039
  // row move indicator
18043
18040
  const moveReason = (_tableMeta$editing$ro = tableMeta.editing.rowMoveReason[cell.column.id]) !== null && _tableMeta$editing$ro !== void 0 ? _tableMeta$editing$ro : null;
18044
18041
  const rows = table.getRowModel().rows;
18045
- const currentRowIndex = tableMeta.currentRow.currentRowIndex;
18046
- const isCurrentRow = currentRowIndex !== undefined && ((_rows$currentRowIndex = rows[currentRowIndex]) === null || _rows$currentRowIndex === void 0 ? void 0 : _rows$currentRowIndex.id) === row.id;
18042
+ const isCurrentRow = ((_rows$tableMeta$curre = rows[tableMeta.currentRow.currentRowIndex]) === null || _rows$tableMeta$curre === void 0 ? void 0 : _rows$tableMeta$curre.id) === row.id;
18047
18043
  const mountNode = React__default.useMemo(() => {
18048
18044
  if (moveReason) {
18049
18045
  var _cellRef$current2, _cellRef$current2$par;
@@ -18133,7 +18129,7 @@ function getRowMoveReason(table, rowIndex, rowValues, cell, newValue) {
18133
18129
  }
18134
18130
 
18135
18131
  function Cell$3(props) {
18136
- var _rows$currentRowIndex;
18132
+ var _rows$tableMeta$curre;
18137
18133
  const {
18138
18134
  column,
18139
18135
  row,
@@ -18145,8 +18141,7 @@ function Cell$3(props) {
18145
18141
  const rows = table.getRowModel().rows;
18146
18142
  const tableMeta = table.options.meta;
18147
18143
  const columnMeta = column.columnDef.meta;
18148
- const currentRowIndex = tableMeta.currentRow.currentRowIndex;
18149
- const isCurrentRow = currentRowIndex !== undefined && ((_rows$currentRowIndex = rows[currentRowIndex]) === null || _rows$currentRowIndex === void 0 ? void 0 : _rows$currentRowIndex.id) === row.id;
18144
+ const isCurrentRow = ((_rows$tableMeta$curre = rows[tableMeta.currentRow.currentRowIndex]) === null || _rows$tableMeta$curre === void 0 ? void 0 : _rows$tableMeta$curre.id) === row.id;
18150
18145
  if (tableMeta.editing.isEditing && columnMeta.control && (isCurrentRow || isHoveredRow && !tableMeta.hoverState.isPaused)) {
18151
18146
  return /*#__PURE__*/React__default.createElement(EditingCell$1, Object.assign({}, props));
18152
18147
  }
@@ -18565,7 +18560,7 @@ function useShortcutsListener(table, shortcuts) {
18565
18560
  const shortcutKeys = Object.keys(shortcuts !== null && shortcuts !== void 0 ? shortcuts : {});
18566
18561
  const globalHandlers = [];
18567
18562
  // convert the shortcut into the correct format to register it
18568
- if (shortcuts && shortcutKeys.length && meta.currentRow.currentRowIndex !== undefined) {
18563
+ if (shortcuts && shortcutKeys.length) {
18569
18564
  const currentRow = rows[meta.currentRow.currentRowIndex];
18570
18565
  shortcutKeys.forEach(key => {
18571
18566
  const handler = shortcuts[key];
@@ -18633,14 +18628,10 @@ function useEditingStateListener(table) {
18633
18628
  }, [meta.currentRow.currentRowIndex]);
18634
18629
  // save if editing gets toggled off
18635
18630
  React__default.useEffect(() => {
18636
- if (meta.editing.isEnabled) {
18637
- if (!meta.editing.isEditing) {
18638
- requestAnimationFrame(() => {
18639
- meta.editing.saveChangesIfNeeded();
18640
- });
18641
- } else if (meta.currentRow.currentRowIndex === undefined) {
18642
- meta.currentRow.setCurrentRowIndex(0);
18643
- }
18631
+ if (meta.editing.isEnabled && !meta.editing.isEditing) {
18632
+ requestAnimationFrame(() => {
18633
+ meta.editing.saveChangesIfNeeded();
18634
+ });
18644
18635
  }
18645
18636
  }, [meta.editing.isEditing]);
18646
18637
  }