@economic/taco 2.9.2 → 2.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. package/dist/components/Button/Button.d.ts +1 -1
  2. package/dist/components/IconButton/IconButton.d.ts +2 -2
  3. package/dist/components/Provider/Localization.d.ts +6 -0
  4. package/dist/components/Table3/components/columns/header/Header.d.ts +6 -1
  5. package/dist/components/Table3/components/columns/header/Menu.d.ts +4 -0
  6. package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +6 -5
  7. package/dist/components/Table3/hooks/useCssVars.d.ts +2 -1
  8. package/dist/components/Table3/hooks/useTable.d.ts +1 -0
  9. package/dist/components/Table3/types.d.ts +7 -0
  10. package/dist/esm/index.css +92 -16
  11. package/dist/esm/packages/taco/src/components/Button/util.js +5 -1
  12. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Menu/components/Content.js +1 -1
  14. package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Provider/Localization.js +7 -1
  16. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Table3/Table3.js +13 -6
  18. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +3 -2
  20. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +5 -3
  22. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +5 -3
  24. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +0 -1
  26. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  27. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +1 -1
  28. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +30 -6
  30. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  31. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +36 -10
  32. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
  33. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +3 -3
  34. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  35. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js +1 -1
  36. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js.map +1 -1
  37. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +1 -1
  38. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
  39. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js +2 -2
  40. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js.map +1 -1
  41. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +1 -1
  42. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
  43. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +87 -40
  44. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  45. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +10 -0
  46. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
  47. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +28 -2
  48. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +1 -1
  49. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js +1 -1
  50. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js.map +1 -1
  51. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js +5 -2
  52. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js.map +1 -1
  53. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js +2 -1
  54. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js.map +1 -1
  55. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js +8 -4
  56. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js.map +1 -1
  57. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js +1 -1
  58. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js.map +1 -1
  59. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +2 -1
  60. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
  61. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js +15 -2
  62. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js.map +1 -1
  63. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +1 -0
  64. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  65. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  66. package/dist/index.css +92 -16
  67. package/dist/taco.cjs.development.js +272 -96
  68. package/dist/taco.cjs.development.js.map +1 -1
  69. package/dist/taco.cjs.production.min.js +1 -1
  70. package/dist/taco.cjs.production.min.js.map +1 -1
  71. package/dist/types.d.ts +1 -1
  72. package/package.json +2 -2
  73. package/types.json +5803 -5242
@@ -44,7 +44,7 @@ export declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAtt
44
44
  target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
45
45
  } & {
46
46
  /** Appearance will change the style of the button */
47
- appearance?: "default" | "primary" | "danger" | "ghost" | "discrete" | undefined;
47
+ appearance?: "default" | "primary" | "danger" | "ghost" | "discrete" | "transparent" | undefined;
48
48
  /**
49
49
  * Dialog component associated with the button, clicking the button will open the dialog.
50
50
  * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
@@ -34,7 +34,7 @@ export declare type IconButtonProps = Omit<ButtonPrimitive.ButtonProps, 'childre
34
34
  };
35
35
  export declare const Base: React.ForwardRefExoticComponent<Pick<ButtonPrimitive.ButtonProps, "autoFocus" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "href" | "shortcut" | "target"> & {
36
36
  /** Appearance will change the style of the button */
37
- appearance?: "default" | "primary" | "danger" | "ghost" | "discrete" | undefined;
37
+ appearance?: "default" | "primary" | "danger" | "ghost" | "discrete" | "transparent" | undefined;
38
38
  /**
39
39
  * Dialog component associated with the button, clicking the button will open the dialog.
40
40
  * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
@@ -63,7 +63,7 @@ export declare const Base: React.ForwardRefExoticComponent<Pick<ButtonPrimitive.
63
63
  } & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
64
64
  export declare const IconButton: React.ForwardRefExoticComponent<Pick<ButtonPrimitive.ButtonProps, "autoFocus" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "href" | "shortcut" | "target"> & {
65
65
  /** Appearance will change the style of the button */
66
- appearance?: "default" | "primary" | "danger" | "ghost" | "discrete" | undefined;
66
+ appearance?: "default" | "primary" | "danger" | "ghost" | "discrete" | "transparent" | undefined;
67
67
  /**
68
68
  * Dialog component associated with the button, clicking the button will open the dialog.
69
69
  * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of
@@ -269,6 +269,12 @@ export declare const defaultLocalisationTexts: {
269
269
  gotoRow: string;
270
270
  hideColumn: string;
271
271
  unfreezeColumns: string;
272
+ sorting: string;
273
+ sortingOrder: {
274
+ ascending: string;
275
+ descending: string;
276
+ unsorted: string;
277
+ };
272
278
  };
273
279
  resize: {
274
280
  tooltip: string;
@@ -1,6 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { ColumnMeta, HeaderContext } from '@tanstack/react-table';
3
3
  import { Table3ColumnAlignment, Table3SortDirection, TableStrategy } from '../../../types';
4
+ export declare const SORT_DIRECTION: Record<string, Table3SortDirection>;
5
+ export declare type HeaderSortDirection = Table3SortDirection | false;
6
+ export declare type SortToggleHandler = (sortDirection: HeaderSortDirection) => void;
4
7
  export declare type HeaderProps<TType = unknown> = HeaderContext<TType, unknown> & {
5
8
  children?: string | JSX.Element;
6
9
  };
@@ -15,6 +18,7 @@ export declare type MemoedHeaderProps<TType = unknown> = Omit<HeaderProps<TType>
15
18
  id: string;
16
19
  index: number;
17
20
  isFrozen: boolean;
21
+ isPrinting: boolean;
18
22
  isResizing: boolean;
19
23
  length: number;
20
24
  meta: ColumnMeta<TType, unknown>;
@@ -22,6 +26,7 @@ export declare type MemoedHeaderProps<TType = unknown> = Omit<HeaderProps<TType>
22
26
  onHide: (event: unknown) => void;
23
27
  onResize: (event: unknown) => void;
24
28
  onSort: (event: unknown) => void;
29
+ onSortToggle: SortToggleHandler;
25
30
  scrollToIndex: TableStrategy['scrollToIndex'];
26
- sortDirection: false | Table3SortDirection;
31
+ sortDirection: HeaderSortDirection;
27
32
  };
@@ -1,16 +1,20 @@
1
1
  import React from 'react';
2
2
  import { Header as RTHeader, Table as RTable } from '@tanstack/react-table';
3
3
  import { Table3ColumnHeaderMenu, TableStrategy } from '../../../types';
4
+ import { HeaderSortDirection, SortToggleHandler } from './Header';
4
5
  export declare function isGotoAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>): boolean;
5
6
  export declare function isMenuAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>): boolean;
6
7
  export declare type MenuProps<TType = unknown> = React.ButtonHTMLAttributes<HTMLButtonElement> & {
7
8
  canFreeze: boolean;
8
9
  canHide: boolean;
10
+ canSort: boolean;
9
11
  index: number;
10
12
  menu?: Table3ColumnHeaderMenu;
11
13
  onGoto?: (query: string) => Promise<number>;
12
14
  onHide: (event: unknown) => void;
15
+ onSortToggle: SortToggleHandler;
13
16
  scrollToIndex: TableStrategy['scrollToIndex'];
17
+ sortDirection: HeaderSortDirection;
14
18
  table: RTable<TType>;
15
19
  };
16
20
  export declare function Menu<TType = unknown>(props: MenuProps<TType>): JSX.Element;
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
- import { TableStrategy } from '../../types';
2
+ import { Table3Ref, TableStrategy } from '../../types';
3
3
  declare type CurrentRowHandlerCallback = TableStrategy['scrollToIndex'];
4
- export declare function useCurrentRow(defaultCurrentRowIndex?: number | undefined): {
5
- currentRowIndex: number;
6
- setCurrentRowIndex: React.Dispatch<React.SetStateAction<number>>;
7
- handleKeyDown: (event: KeyboardEvent, length: number, scrollToIndex: CurrentRowHandlerCallback) => void;
4
+ export declare function useCurrentRow(defaultCurrentRowIndex: number | undefined): {
5
+ currentRowIndex: number | undefined;
6
+ setCurrentRowIndex: React.Dispatch<React.SetStateAction<number | undefined>>;
7
+ handleFocus: (event: React.FocusEvent, length: number, scrollToIndex: CurrentRowHandlerCallback) => void;
8
+ handleKeyDown: (event: KeyboardEvent, length: number, scrollToIndex: CurrentRowHandlerCallback, isEditing: boolean, tableRef: React.RefObject<Table3Ref>) => void;
8
9
  };
9
10
  export {};
@@ -1,6 +1,7 @@
1
1
  import { Table3FontSize, Table3RowHeight } from '../types';
2
2
  export declare const useCssVars: (height: Table3RowHeight, fontSize: Table3FontSize) => {
3
3
  style: {
4
- '--table3-row-padding': string;
4
+ '--table3-cell-padding-x': string;
5
+ '--table3-cell-padding-y': string;
5
6
  };
6
7
  };
@@ -25,6 +25,7 @@ declare module '@tanstack/table-core' {
25
25
  enableFooter: boolean;
26
26
  fontSize: ReturnType<typeof useFontSize>;
27
27
  hoverState: ReturnType<typeof usePauseHoverState>;
28
+ isPrinting: boolean;
28
29
  isUsingServer: boolean;
29
30
  printing: ReturnType<typeof usePrinting>;
30
31
  rowActions: ReturnType<typeof useRowActions>;
@@ -35,6 +35,7 @@ export declare type Table3ColumnProps<TType = unknown> = ValueOf<{
35
35
  enableFiltering?: boolean;
36
36
  enableHiding?: boolean;
37
37
  enableOrdering?: boolean;
38
+ enablePrinting?: boolean;
38
39
  enableResizing?: boolean;
39
40
  enableSearch?: boolean;
40
41
  enableSorting?: boolean;
@@ -206,6 +207,12 @@ export declare type Table3Texts = {
206
207
  gotoRow: string;
207
208
  hideColumn: string;
208
209
  unfreezeColumns: string;
210
+ sorting: string;
211
+ sortingOrder: {
212
+ ascending: string;
213
+ descending: string;
214
+ unsorted: string;
215
+ };
209
216
  };
210
217
  resize: {
211
218
  tooltip: string;
@@ -647,7 +647,7 @@
647
647
 
648
648
  [role='cell']:not([data-highlighted='true']),
649
649
  [role='columnheader'] {
650
- @apply flex px-4;
650
+ @apply flex;
651
651
  }
652
652
 
653
653
  /* In cases where row height might differ from default one (example: textarea without truncate or changing of font size or row height),
@@ -696,13 +696,20 @@
696
696
  @apply bg-grey-100;
697
697
  }
698
698
  [role='row']:not([data-selected='true']):not([data-error='true'])[data-current='true'] [role='cell'] {
699
- --table3-row-actions-shadow: theme(colors.grey.200);
700
- @apply bg-grey-200;
699
+ --table3-row-actions-shadow: theme(colors.grey.100);
700
+ @apply bg-grey-100;
701
701
  }
702
702
  [role='row']:not([data-selected='true']):not([data-error='true'])[data-current='true']:hover [role='cell'] {
703
703
  --table3-row-actions-shadow: theme(colors.grey.100);
704
704
  @apply bg-grey-100;
705
705
  }
706
+ /* normal rows when focus is inside the table */
707
+ [data-taco='table2']:focus-within
708
+ [role='row'][data-current='true']:not([data-selected='true']):not([data-error='true'])
709
+ [role='cell'] {
710
+ --table3-row-actions-shadow: theme(colors.grey.200);
711
+ @apply bg-grey-200;
712
+ }
706
713
  /* normal rows when hover is paused */
707
714
  [data-pause-hover='true'] [role='row']:not([data-selected='true']):not([data-error='true']):hover:not([data-current='true']) [role='cell'] {
708
715
  --table3-row-actions-shadow: theme(colors.white);
@@ -721,14 +728,17 @@
721
728
  --table3-row-actions-shadow: #d6e3f6;
722
729
  @apply bg-[#D6E3F6];
723
730
  }
724
- [role='row'][data-selected='true']:not([data-error='true'])[data-current='true'] [role='cell'] {
725
- --table3-row-actions-shadow: #ccd8eb;
726
- @apply bg-[#CCD8EB];
727
- }
728
- [role='row'][data-selected='true']:not([data-error='true'])[data-current='true']:hover [role='cell'] {
731
+ [role='row'][data-selected='true']:not([data-error='true'])[data-current='true']:hover [role='cell'],
732
+
733
+ [role='row'][data-selected='true']:not([data-error='true'])[data-current='true'] [role='cell'] {
729
734
  --table3-row-actions-shadow: #d6e3f6;
730
735
  @apply bg-[#D6E3F6];
731
736
  }
737
+ /* selected rows when focus is inside the table */
738
+ [data-taco='table2']:focus-within [role='row'][data-current='true'][data-selected='true']:not([data-error='true']) [role='cell'] {
739
+ --table3-row-actions-shadow: #ccd8eb;
740
+ @apply bg-[#CCD8EB];
741
+ }
732
742
  /* selected rows when hover is paused */
733
743
  [data-pause-hover='true'] [role='row'][data-selected='true']:not([data-error='true']):hover:not([data-current='true']) [role='cell'] {
734
744
  --table3-row-actions-shadow: theme(colors.blue.100);
@@ -755,6 +765,11 @@
755
765
  --table3-row-actions-shadow: #ffe4de;
756
766
  @apply bg-[#FFE4DE];
757
767
  }
768
+ /* error rows when focus is inside the table */
769
+ [data-taco='table2']:focus-within [role='row'][data-current='true'][data-error='true'] [role='cell'] {
770
+ --table3-row-actions-shadow: theme(colors.red.100);
771
+ @apply bg-red-100;
772
+ }
758
773
  /* error rows when hover is paused */
759
774
  [data-pause-hover='true'] [role='row'][data-error='true']:hover:not([data-current='true']) [role='cell'] {
760
775
  --table3-row-actions-shadow: #ffede9;
@@ -777,17 +792,27 @@
777
792
  /* cell component overrides */
778
793
 
779
794
  /* small font size */
795
+ [data-font-size='small'] [role='cell'] > [data-taco='button'],
796
+ [data-font-size='small'] [role='cell'] > [data-taco='icon-button'] {
797
+ @apply !-my-2;
798
+ }
799
+
800
+ [data-font-size='small'] [role='cell'] > [data-taco='icon'] {
801
+ @apply !-my-[3px];
802
+ }
803
+
780
804
  [data-font-size='small'] [role='cell'] [data-taco='badge'],
781
- [data-font-size='small'] [role='cell'] [data-taco='badge-icon'],
782
- [data-font-size='small'] [role='cell'] [data-taco='icon'] {
805
+ [data-font-size='small'] [role='cell'] [data-taco='badge-icon'] {
783
806
  @apply !-my-0.5 !text-xs;
784
807
  }
785
808
 
786
- [data-font-size='small'] [role='cell'] [data-taco='tag'],
787
- [data-font-size='small'] [role='cell'] [data-taco='Select2'],
809
+ [data-font-size='small'] [role='cell'] [data-taco='tag'] {
810
+ @apply !-my-1;
811
+ }
812
+
788
813
  [data-font-size='small'] [role='cell'] [data-taco='input-container'],
789
814
  [data-font-size='small'] [role='cell'] [data-taco='Select2'] {
790
- @apply !-my-1;
815
+ @apply !-my-[3px];
791
816
  }
792
817
 
793
818
  [data-font-size='small'] [role='cell'] [data-taco='input'],
@@ -816,30 +841,70 @@
816
841
  @apply !my-0;
817
842
  }
818
843
 
844
+ [data-font-size='small'] [role='cell'][data-editable] {
845
+ @apply px-[calc(var(--table3-cell-padding-x)_-_7px)];
846
+ }
847
+
848
+ [data-font-size='small'] [role='cell'][data-editable] [data-taco='checkbox'],
849
+ [data-font-size='small'] [role='cell'][data-editable] [data-taco='checkbox-container'],
850
+ [data-font-size='small'] [role='cell'][data-editable] [data-taco='switch'],
851
+ [data-font-size='small'] [role='cell'][data-editable] [data-taco='switch-container'] {
852
+ @apply !mx-[calc(var(--table3-cell-padding-x)_-_1px)] !-mt-px;
853
+ }
854
+
819
855
  /* medium font size */
856
+ [data-font-size='medium'] [role='cell'] > [data-taco='button'],
857
+ [data-font-size='medium'] [role='cell'] > [data-taco='icon-button'] {
858
+ @apply !-my-1.5;
859
+ }
860
+
861
+ [data-font-size='medium'] [role='cell'] > [data-taco='icon'] {
862
+ @apply !-my-0.5;
863
+ }
864
+
820
865
  [data-font-size='medium'] [role='cell'] [data-taco='tag'] {
821
866
  @apply !-my-0.5;
822
867
  }
823
868
 
824
869
  [data-font-size='medium'] [role='cell'] [data-taco='Select2'],
825
870
  [data-font-size='medium'] [role='cell'] [data-taco='input-container'] {
826
- @apply !-my-1.5;
871
+ @apply !-my-[5px];
872
+ }
873
+
874
+ [data-font-size='medium'] [role='cell'][data-editable] {
875
+ @apply px-[calc(var(--table3-cell-padding-x)_-_9px)];
876
+ }
877
+
878
+ [data-font-size='medium'] [role='cell'][data-editable] [data-taco='checkbox'],
879
+ [data-font-size='medium'] [role='cell'][data-editable] [data-taco='checkbox-container'],
880
+ [data-font-size='medium'] [role='cell'][data-editable] [data-taco='switch'],
881
+ [data-font-size='medium'] [role='cell'][data-editable] [data-taco='switch-container'] {
882
+ @apply !mx-[calc(var(--table3-cell-padding-x)_-_3px)] !mt-px;
827
883
  }
828
884
 
829
885
  /* large font size */
886
+ [data-font-size='large'] [role='cell'] > [data-taco='button'],
887
+ [data-font-size='large'] [role='cell'] > [data-taco='icon-button'] {
888
+ @apply !-my-1;
889
+ }
890
+
891
+ [data-font-size='large'] [role='cell'] > [data-taco='icon'] {
892
+ @apply !-my-0.5;
893
+ }
894
+
830
895
  [data-font-size='large'] [role='cell'] [data-taco='tag'] {
831
896
  @apply !-my-0.5;
832
897
  }
833
898
 
834
899
  [data-font-size='large'] [role='cell'] [data-taco='Select2'],
835
900
  [data-font-size='large'] [role='cell'] [data-taco='input-container'] {
836
- @apply !-my-2;
901
+ @apply !-my-[7.5px];
837
902
  }
838
903
 
839
904
  [data-font-size='large'] [role='cell'] [data-taco='input'],
840
905
  [data-font-size='large'] [role='cell'] [data-taco='Select2'],
841
906
  [data-font-size='large'] [role='cell'] [data-taco='textarea'] {
842
- @apply h-10 px-2.5 text-lg;
907
+ @apply h-10 px-2.5 text-base;
843
908
  }
844
909
 
845
910
  [data-font-size='large'] [role='cell'] [data-taco='input-container'] [data-affix-type='postfix'] button {
@@ -849,3 +914,14 @@
849
914
  [data-font-size='large'] [role='cell'] [data-taco='input-container'] [data-affix-type='postfix'] [data-taco='icon'] {
850
915
  @apply !h-6 !w-6;
851
916
  }
917
+
918
+ [data-font-size='large'] [role='cell'][data-editable] {
919
+ @apply px-[calc(var(--table3-cell-padding-x)_-_11px)];
920
+ }
921
+
922
+ [data-font-size='large'] [role='cell'][data-editable] [data-taco='checkbox'],
923
+ [data-font-size='large'] [role='cell'][data-editable] [data-taco='checkbox-container'],
924
+ [data-font-size='large'] [role='cell'][data-editable] [data-taco='switch'],
925
+ [data-font-size='large'] [role='cell'][data-editable] [data-taco='switch-container'] {
926
+ @apply !mx-[calc(var(--table3-cell-padding-x)_-_5px)] !mt-px;
927
+ }
@@ -16,10 +16,14 @@ const getAppearanceClasses = (value, icon = false) => {
16
16
  case 'discrete':
17
17
  {
18
18
  if (icon) {
19
- return `bg-transparent text-black enabled:hover:bg-grey-200/80 disabled:text-black/30`;
19
+ return `bg-transparent text-black enabled:hover:bg-[#000]/[0.08] disabled:text-black/30`;
20
20
  }
21
21
  return `bg-transparent text-blue-500 enabled:hover:text-blue-700 disabled:text-blue-500/50`;
22
22
  }
23
+ case 'transparent':
24
+ {
25
+ return `bg-transparent text-black enabled:hover:text-black enabled:hover:bg-[#000]/[0.08] disabled:text-black/30`;
26
+ }
23
27
  default:
24
28
  return `wcag-grey-200 enabled:hover:wcag-grey-300 disabled:bg-grey-200/50 disabled:text-black/30`;
25
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sources":["../../../../../../../src/components/Button/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport const getButtonClasses = () => {\n return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center focus-visible:yt-focus disabled:cursor-not-allowed';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n return `wcag-blue-500 enabled:hover:wcag-blue-700 enabled:hover:active:wcag-blue-500 disabled:bg-blue-500/50`;\n\n case 'danger':\n return `wcag-red-500 enabled:hover:wcag-red-700 enabled:hover:active:wcag-red-500 disabled:bg-red-500/50`;\n\n case 'ghost':\n return `bg-white border border-blue-500 text-blue-500 enabled:hover:bg-blue-100 enabled:hover:text-blue-700 disabled:border-blue-500/50 disabled:text-blue-500/50`;\n\n case 'discrete': {\n if (icon) {\n return `bg-transparent text-black enabled:hover:bg-grey-200/80 disabled:text-black/30`;\n }\n\n return `bg-transparent text-blue-500 enabled:hover:text-blue-700 disabled:text-blue-500/50`;\n }\n\n default:\n return `wcag-grey-200 enabled:hover:wcag-grey-300 disabled:bg-grey-200/50 disabled:text-black/30`;\n }\n};\n\nexport const createButtonWithTooltip = (\n props: any,\n className: string,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n): JSX.Element => {\n const { tooltip, ...buttonProps } = props;\n const button = <ButtonPrimitive.Button {...buttonProps} className={className} ref={ref} />;\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{button}</Tooltip>;\n }\n\n return button;\n};\n\nexport const createButtonWithOverlays = (props: any, buttonBase: JSX.Element) => {\n const { dialog, drawer, hanger, menu, popover } = props;\n let button = buttonBase;\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n } else if (typeof drawer === 'function') {\n button = drawer({ trigger: button });\n } else if (typeof menu === 'function') {\n button = menu({ trigger: button });\n } else if (typeof popover === 'function') {\n button = popover({ trigger: button });\n }\n\n if (typeof hanger === 'function') {\n button = hanger({ anchor: button });\n }\n\n return button;\n};\n"],"names":["getButtonClasses","getAppearanceClasses","value","icon","createButtonWithTooltip","props","className","ref","tooltip","buttonProps","button","React","ButtonPrimitive","Tooltip","title","createButtonWithOverlays","buttonBase","dialog","drawer","hanger","menu","popover","trigger","anchor"],"mappings":";;;;MAKaA,gBAAgB,GAAGA;EAC5B,OAAO,kLAAkL;AAC7L;MAEaC,oBAAoB,GAAGA,CAACC,KAA6B,EAAEC,IAAI,GAAG,KAAK;EAC5E,QAAQD,KAAK;IACT,KAAK,SAAS;MACV,6GAA6G;IAEjH,KAAK,QAAQ;MACT,yGAAyG;IAE7G,KAAK,OAAO;MACR,kKAAkK;IAEtK,KAAK,UAAU;MAAE;QACb,IAAIC,IAAI,EAAE;UACN,sFAAsF;;QAG1F,2FAA2F;;IAG/F;MACI,iGAAiG;;AAE7G;MAEaC,uBAAuB,GAAGA,CACnCC,KAAU,EACVC,SAAiB,EACjBC,GAAqD;EAErD,MAAM;IAAEC,OAAO;IAAE,GAAGC;GAAa,GAAGJ,KAAK;EACzC,MAAMK,MAAM,gBAAGC,6BAACC,MAAsB,oBAAKH,WAAW;IAAEH,SAAS,EAAEA,SAAS;IAAEC,GAAG,EAAEA;KAAO;EAE1F,IAAIC,OAAO,EAAE;IACT,oBAAOG,6BAACE,OAAO;MAACC,KAAK,EAAEN;OAAUE,MAAM,CAAW;;EAGtD,OAAOA,MAAM;AACjB;MAEaK,wBAAwB,GAAGA,CAACV,KAAU,EAAEW,UAAuB;EACxE,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC;GAAS,GAAGhB,KAAK;EACvD,IAAIK,MAAM,GAAGM,UAAU;EAEvB,IAAI,OAAOC,MAAM,KAAK,UAAU,EAAE;IAC9BP,MAAM,GAAGO,MAAM,CAAC;MAAEK,OAAO,EAAEZ;KAAQ,CAAC;GACvC,MAAM,IAAI,OAAOQ,MAAM,KAAK,UAAU,EAAE;IACrCR,MAAM,GAAGQ,MAAM,CAAC;MAAEI,OAAO,EAAEZ;KAAQ,CAAC;GACvC,MAAM,IAAI,OAAOU,IAAI,KAAK,UAAU,EAAE;IACnCV,MAAM,GAAGU,IAAI,CAAC;MAAEE,OAAO,EAAEZ;KAAQ,CAAC;GACrC,MAAM,IAAI,OAAOW,OAAO,KAAK,UAAU,EAAE;IACtCX,MAAM,GAAGW,OAAO,CAAC;MAAEC,OAAO,EAAEZ;KAAQ,CAAC;;EAGzC,IAAI,OAAOS,MAAM,KAAK,UAAU,EAAE;IAC9BT,MAAM,GAAGS,MAAM,CAAC;MAAEI,MAAM,EAAEb;KAAQ,CAAC;;EAGvC,OAAOA,MAAM;AACjB;;;;"}
1
+ {"version":3,"file":"util.js","sources":["../../../../../../../src/components/Button/util.tsx"],"sourcesContent":["import React from 'react';\nimport { Appearance } from '../../types';\nimport * as ButtonPrimitive from '../../primitives/Button';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport const getButtonClasses = () => {\n return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center focus-visible:yt-focus disabled:cursor-not-allowed';\n};\n\nexport const getAppearanceClasses = (value: Appearance | undefined, icon = false): string => {\n switch (value) {\n case 'primary':\n return `wcag-blue-500 enabled:hover:wcag-blue-700 enabled:hover:active:wcag-blue-500 disabled:bg-blue-500/50`;\n\n case 'danger':\n return `wcag-red-500 enabled:hover:wcag-red-700 enabled:hover:active:wcag-red-500 disabled:bg-red-500/50`;\n\n case 'ghost':\n return `bg-white border border-blue-500 text-blue-500 enabled:hover:bg-blue-100 enabled:hover:text-blue-700 disabled:border-blue-500/50 disabled:text-blue-500/50`;\n\n case 'discrete': {\n if (icon) {\n return `bg-transparent text-black enabled:hover:bg-[#000]/[0.08] disabled:text-black/30`;\n }\n\n return `bg-transparent text-blue-500 enabled:hover:text-blue-700 disabled:text-blue-500/50`;\n }\n\n case 'transparent': {\n return `bg-transparent text-black enabled:hover:text-black enabled:hover:bg-[#000]/[0.08] disabled:text-black/30`;\n }\n\n default:\n return `wcag-grey-200 enabled:hover:wcag-grey-300 disabled:bg-grey-200/50 disabled:text-black/30`;\n }\n};\n\nexport const createButtonWithTooltip = (\n props: any,\n className: string,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\n): JSX.Element => {\n const { tooltip, ...buttonProps } = props;\n const button = <ButtonPrimitive.Button {...buttonProps} className={className} ref={ref} />;\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{button}</Tooltip>;\n }\n\n return button;\n};\n\nexport const createButtonWithOverlays = (props: any, buttonBase: JSX.Element) => {\n const { dialog, drawer, hanger, menu, popover } = props;\n let button = buttonBase;\n\n if (typeof dialog === 'function') {\n button = dialog({ trigger: button });\n } else if (typeof drawer === 'function') {\n button = drawer({ trigger: button });\n } else if (typeof menu === 'function') {\n button = menu({ trigger: button });\n } else if (typeof popover === 'function') {\n button = popover({ trigger: button });\n }\n\n if (typeof hanger === 'function') {\n button = hanger({ anchor: button });\n }\n\n return button;\n};\n"],"names":["getButtonClasses","getAppearanceClasses","value","icon","createButtonWithTooltip","props","className","ref","tooltip","buttonProps","button","React","ButtonPrimitive","Tooltip","title","createButtonWithOverlays","buttonBase","dialog","drawer","hanger","menu","popover","trigger","anchor"],"mappings":";;;;MAKaA,gBAAgB,GAAGA;EAC5B,OAAO,kLAAkL;AAC7L;MAEaC,oBAAoB,GAAGA,CAACC,KAA6B,EAAEC,IAAI,GAAG,KAAK;EAC5E,QAAQD,KAAK;IACT,KAAK,SAAS;MACV,6GAA6G;IAEjH,KAAK,QAAQ;MACT,yGAAyG;IAE7G,KAAK,OAAO;MACR,kKAAkK;IAEtK,KAAK,UAAU;MAAE;QACb,IAAIC,IAAI,EAAE;UACN,wFAAwF;;QAG5F,2FAA2F;;IAG/F,KAAK,aAAa;MAAE;QAChB,iHAAiH;;IAGrH;MACI,iGAAiG;;AAE7G;MAEaC,uBAAuB,GAAGA,CACnCC,KAAU,EACVC,SAAiB,EACjBC,GAAqD;EAErD,MAAM;IAAEC,OAAO;IAAE,GAAGC;GAAa,GAAGJ,KAAK;EACzC,MAAMK,MAAM,gBAAGC,6BAACC,MAAsB,oBAAKH,WAAW;IAAEH,SAAS,EAAEA,SAAS;IAAEC,GAAG,EAAEA;KAAO;EAE1F,IAAIC,OAAO,EAAE;IACT,oBAAOG,6BAACE,OAAO;MAACC,KAAK,EAAEN;OAAUE,MAAM,CAAW;;EAGtD,OAAOA,MAAM;AACjB;MAEaK,wBAAwB,GAAGA,CAACV,KAAU,EAAEW,UAAuB;EACxE,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC;GAAS,GAAGhB,KAAK;EACvD,IAAIK,MAAM,GAAGM,UAAU;EAEvB,IAAI,OAAOC,MAAM,KAAK,UAAU,EAAE;IAC9BP,MAAM,GAAGO,MAAM,CAAC;MAAEK,OAAO,EAAEZ;KAAQ,CAAC;GACvC,MAAM,IAAI,OAAOQ,MAAM,KAAK,UAAU,EAAE;IACrCR,MAAM,GAAGQ,MAAM,CAAC;MAAEI,OAAO,EAAEZ;KAAQ,CAAC;GACvC,MAAM,IAAI,OAAOU,IAAI,KAAK,UAAU,EAAE;IACnCV,MAAM,GAAGU,IAAI,CAAC;MAAEE,OAAO,EAAEZ;KAAQ,CAAC;GACrC,MAAM,IAAI,OAAOW,OAAO,KAAK,UAAU,EAAE;IACtCX,MAAM,GAAGW,OAAO,CAAC;MAAEC,OAAO,EAAEZ;KAAQ,CAAC;;EAGzC,IAAI,OAAOS,MAAM,KAAK,UAAU,EAAE;IAC9BT,MAAM,GAAGS,MAAM,CAAC;MAAEI,MAAM,EAAEb;KAAQ,CAAC;;EAGvC,OAAOA,MAAM;AACjB;;;;"}
@@ -43,7 +43,7 @@ const Content = /*#__PURE__*/forwardRef(function MenuContent(props, ref) {
43
43
  return () => {
44
44
  shortcuts.forEach(handler => document.removeEventListener('keydown', handler));
45
45
  };
46
- }, []);
46
+ }, [childrenWithRefs]);
47
47
  return /*#__PURE__*/createElement(Portal, null, /*#__PURE__*/createElement(Content$1, Object.assign({}, otherProps, {
48
48
  align: align,
49
49
  className: className,
@@ -1 +1 @@
1
- {"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/Menu/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { Align, Placement } from '../../../types';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { useCurrentMenu } from '../Context';\nimport { createShortcutKeyDownHandler } from '../../../utils/keyboard';\nimport { MenuItemProps } from './Item';\n\nexport type MenuContentProps = Omit<DropdownMenuPrimitive.DropdownMenuContentProps, 'children' | 'side'> & {\n align?: Align;\n children: React.ReactNode;\n /** Set the position of the Menu relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\n\nexport const Content = React.forwardRef(function MenuContent(props: MenuContentProps, ref: React.Ref<HTMLDivElement>) {\n const internalRef = useMergedRef<any>(ref);\n const menu = useCurrentMenu();\n const { align = 'start', children, placement: side, ...otherProps } = props;\n const className = cn('border border-transparent rounded block outline-none p-1 yt-shadow wcag-white', props.className);\n\n // attach refs to each child\n const childrenRefs = React.useRef<React.RefObject<HTMLDivElement>[]>([]);\n const childrenWithRefs = (React.Children.toArray(props.children) as React.ReactElement<MenuItemProps & { ref: any }>[])\n .filter(child => !!child) // remove falsey children\n .map((child, index) => {\n childrenRefs.current[index] = React.createRef<HTMLDivElement>();\n return React.cloneElement(child, { ref: childrenRefs.current[index] });\n });\n\n // register any shortcuts attached to children\n React.useEffect(() => {\n const shortcuts: ((event: KeyboardEvent) => void)[] = [];\n childrenWithRefs.forEach((child, index) => {\n if (child.props.shortcut) {\n shortcuts.push(\n createShortcutKeyDownHandler(child.props.shortcut, event => {\n event.preventDefault();\n menu?.open();\n setTimeout(() => childrenRefs.current[index]?.current?.click(), 1);\n })\n );\n }\n });\n\n shortcuts.forEach(handler => document.addEventListener('keydown', handler));\n\n return () => {\n shortcuts.forEach(handler => document.removeEventListener('keydown', handler));\n };\n }, []);\n\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n {...otherProps}\n align={align}\n className={className}\n data-taco=\"menu\"\n side={side}\n sideOffset={3}\n style={{ minWidth: menu?.minWidth }}\n ref={internalRef}>\n {childrenWithRefs}\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n );\n});\n"],"names":["Content","React","MenuContent","props","ref","internalRef","useMergedRef","menu","useCurrentMenu","align","children","placement","side","otherProps","className","cn","childrenRefs","childrenWithRefs","toArray","filter","child","map","index","current","shortcuts","forEach","shortcut","push","createShortcutKeyDownHandler","event","preventDefault","open","setTimeout","_childrenRefs$current","_childrenRefs$current2","click","handler","document","addEventListener","removeEventListener","DropdownMenuPrimitive","sideOffset","style","minWidth"],"mappings":";;;;;;;MAgBaA,OAAO,gBAAGC,UAAgB,CAAC,SAASC,WAAWA,CAACC,KAAuB,EAAEC,GAA8B;EAChH,MAAMC,WAAW,GAAGC,YAAY,CAAMF,GAAG,CAAC;EAC1C,MAAMG,IAAI,GAAGC,cAAc,EAAE;EAC7B,MAAM;IAAEC,KAAK,GAAG,OAAO;IAAEC,QAAQ;IAAEC,SAAS,EAAEC,IAAI;IAAE,GAAGC;GAAY,GAAGV,KAAK;EAC3E,MAAMW,SAAS,GAAGC,EAAE,CAAC,+EAA+E,EAAEZ,KAAK,CAACW,SAAS,CAAC;;EAGtH,MAAME,YAAY,GAAGf,MAAY,CAAoC,EAAE,CAAC;EACxE,MAAMgB,gBAAgB,GAAIhB,QAAc,CAACiB,OAAO,CAACf,KAAK,CAACO,QAAQ,CAAwD,CAClHS,MAAM,CAACC,KAAK,IAAI,CAAC,CAACA,KAAK,CAAC;GACxBC,GAAG,CAAC,CAACD,KAAK,EAAEE,KAAK;IACdN,YAAY,CAACO,OAAO,CAACD,KAAK,CAAC,gBAAGrB,SAAe,EAAkB;IAC/D,oBAAOA,YAAkB,CAACmB,KAAK,EAAE;MAAEhB,GAAG,EAAEY,YAAY,CAACO,OAAO,CAACD,KAAK;KAAG,CAAC;GACzE,CAAC;;EAGNrB,SAAe,CAAC;IACZ,MAAMuB,SAAS,GAAuC,EAAE;IACxDP,gBAAgB,CAACQ,OAAO,CAAC,CAACL,KAAK,EAAEE,KAAK;MAClC,IAAIF,KAAK,CAACjB,KAAK,CAACuB,QAAQ,EAAE;QACtBF,SAAS,CAACG,IAAI,CACVC,4BAA4B,CAACR,KAAK,CAACjB,KAAK,CAACuB,QAAQ,EAAEG,KAAK;UACpDA,KAAK,CAACC,cAAc,EAAE;UACtBvB,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEwB,IAAI,EAAE;UACZC,UAAU,CAAC;YAAA,IAAAC,qBAAA,EAAAC,sBAAA;YAAA,QAAAD,qBAAA,GAAMjB,YAAY,CAACO,OAAO,CAACD,KAAK,CAAC,cAAAW,qBAAA,wBAAAC,sBAAA,GAA3BD,qBAAA,CAA6BV,OAAO,cAAAW,sBAAA,uBAApCA,sBAAA,CAAsCC,KAAK,EAAE;aAAE,CAAC,CAAC;SACrE,CAAC,CACL;;KAER,CAAC;IAEFX,SAAS,CAACC,OAAO,CAACW,OAAO,IAAIC,QAAQ,CAACC,gBAAgB,CAAC,SAAS,EAAEF,OAAO,CAAC,CAAC;IAE3E,OAAO;MACHZ,SAAS,CAACC,OAAO,CAACW,OAAO,IAAIC,QAAQ,CAACE,mBAAmB,CAAC,SAAS,EAAEH,OAAO,CAAC,CAAC;KACjF;GACJ,EAAE,EAAE,CAAC;EAEN,oBACInC,cAACuC,MAA4B,qBACzBvC,cAACuC,SAA6B,oBACtB3B,UAAU;IACdJ,KAAK,EAAEA,KAAK;IACZK,SAAS,EAAEA,SAAS;iBACV,MAAM;IAChBF,IAAI,EAAEA,IAAI;IACV6B,UAAU,EAAE,CAAC;IACbC,KAAK,EAAE;MAAEC,QAAQ,EAAEpC,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEoC;KAAU;IACnCvC,GAAG,EAAEC;MACJY,gBAAgB,CACW,CACL;AAEvC,CAAC;;;;"}
1
+ {"version":3,"file":"Content.js","sources":["../../../../../../../../src/components/Menu/components/Content.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport cn from 'classnames';\nimport { Align, Placement } from '../../../types';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { useCurrentMenu } from '../Context';\nimport { createShortcutKeyDownHandler } from '../../../utils/keyboard';\nimport { MenuItemProps } from './Item';\n\nexport type MenuContentProps = Omit<DropdownMenuPrimitive.DropdownMenuContentProps, 'children' | 'side'> & {\n align?: Align;\n children: React.ReactNode;\n /** Set the position of the Menu relative to its trigger. Default value is `bottom` */\n placement?: Placement;\n};\n\nexport const Content = React.forwardRef(function MenuContent(props: MenuContentProps, ref: React.Ref<HTMLDivElement>) {\n const internalRef = useMergedRef<any>(ref);\n const menu = useCurrentMenu();\n const { align = 'start', children, placement: side, ...otherProps } = props;\n const className = cn('border border-transparent rounded block outline-none p-1 yt-shadow wcag-white', props.className);\n\n // attach refs to each child\n const childrenRefs = React.useRef<React.RefObject<HTMLDivElement>[]>([]);\n const childrenWithRefs = (React.Children.toArray(props.children) as React.ReactElement<MenuItemProps & { ref: any }>[])\n .filter(child => !!child) // remove falsey children\n .map((child, index) => {\n childrenRefs.current[index] = React.createRef<HTMLDivElement>();\n return React.cloneElement(child, { ref: childrenRefs.current[index] });\n });\n\n // register any shortcuts attached to children\n React.useEffect(() => {\n const shortcuts: ((event: KeyboardEvent) => void)[] = [];\n childrenWithRefs.forEach((child, index) => {\n if (child.props.shortcut) {\n shortcuts.push(\n createShortcutKeyDownHandler(child.props.shortcut, event => {\n event.preventDefault();\n menu?.open();\n setTimeout(() => childrenRefs.current[index]?.current?.click(), 1);\n })\n );\n }\n });\n\n shortcuts.forEach(handler => document.addEventListener('keydown', handler));\n\n return () => {\n shortcuts.forEach(handler => document.removeEventListener('keydown', handler));\n };\n }, [childrenWithRefs]);\n\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n {...otherProps}\n align={align}\n className={className}\n data-taco=\"menu\"\n side={side}\n sideOffset={3}\n style={{ minWidth: menu?.minWidth }}\n ref={internalRef}>\n {childrenWithRefs}\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n );\n});\n"],"names":["Content","React","MenuContent","props","ref","internalRef","useMergedRef","menu","useCurrentMenu","align","children","placement","side","otherProps","className","cn","childrenRefs","childrenWithRefs","toArray","filter","child","map","index","current","shortcuts","forEach","shortcut","push","createShortcutKeyDownHandler","event","preventDefault","open","setTimeout","_childrenRefs$current","_childrenRefs$current2","click","handler","document","addEventListener","removeEventListener","DropdownMenuPrimitive","sideOffset","style","minWidth"],"mappings":";;;;;;;MAgBaA,OAAO,gBAAGC,UAAgB,CAAC,SAASC,WAAWA,CAACC,KAAuB,EAAEC,GAA8B;EAChH,MAAMC,WAAW,GAAGC,YAAY,CAAMF,GAAG,CAAC;EAC1C,MAAMG,IAAI,GAAGC,cAAc,EAAE;EAC7B,MAAM;IAAEC,KAAK,GAAG,OAAO;IAAEC,QAAQ;IAAEC,SAAS,EAAEC,IAAI;IAAE,GAAGC;GAAY,GAAGV,KAAK;EAC3E,MAAMW,SAAS,GAAGC,EAAE,CAAC,+EAA+E,EAAEZ,KAAK,CAACW,SAAS,CAAC;;EAGtH,MAAME,YAAY,GAAGf,MAAY,CAAoC,EAAE,CAAC;EACxE,MAAMgB,gBAAgB,GAAIhB,QAAc,CAACiB,OAAO,CAACf,KAAK,CAACO,QAAQ,CAAwD,CAClHS,MAAM,CAACC,KAAK,IAAI,CAAC,CAACA,KAAK,CAAC;GACxBC,GAAG,CAAC,CAACD,KAAK,EAAEE,KAAK;IACdN,YAAY,CAACO,OAAO,CAACD,KAAK,CAAC,gBAAGrB,SAAe,EAAkB;IAC/D,oBAAOA,YAAkB,CAACmB,KAAK,EAAE;MAAEhB,GAAG,EAAEY,YAAY,CAACO,OAAO,CAACD,KAAK;KAAG,CAAC;GACzE,CAAC;;EAGNrB,SAAe,CAAC;IACZ,MAAMuB,SAAS,GAAuC,EAAE;IACxDP,gBAAgB,CAACQ,OAAO,CAAC,CAACL,KAAK,EAAEE,KAAK;MAClC,IAAIF,KAAK,CAACjB,KAAK,CAACuB,QAAQ,EAAE;QACtBF,SAAS,CAACG,IAAI,CACVC,4BAA4B,CAACR,KAAK,CAACjB,KAAK,CAACuB,QAAQ,EAAEG,KAAK;UACpDA,KAAK,CAACC,cAAc,EAAE;UACtBvB,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEwB,IAAI,EAAE;UACZC,UAAU,CAAC;YAAA,IAAAC,qBAAA,EAAAC,sBAAA;YAAA,QAAAD,qBAAA,GAAMjB,YAAY,CAACO,OAAO,CAACD,KAAK,CAAC,cAAAW,qBAAA,wBAAAC,sBAAA,GAA3BD,qBAAA,CAA6BV,OAAO,cAAAW,sBAAA,uBAApCA,sBAAA,CAAsCC,KAAK,EAAE;aAAE,CAAC,CAAC;SACrE,CAAC,CACL;;KAER,CAAC;IAEFX,SAAS,CAACC,OAAO,CAACW,OAAO,IAAIC,QAAQ,CAACC,gBAAgB,CAAC,SAAS,EAAEF,OAAO,CAAC,CAAC;IAE3E,OAAO;MACHZ,SAAS,CAACC,OAAO,CAACW,OAAO,IAAIC,QAAQ,CAACE,mBAAmB,CAAC,SAAS,EAAEH,OAAO,CAAC,CAAC;KACjF;GACJ,EAAE,CAACnB,gBAAgB,CAAC,CAAC;EAEtB,oBACIhB,cAACuC,MAA4B,qBACzBvC,cAACuC,SAA6B,oBACtB3B,UAAU;IACdJ,KAAK,EAAEA,KAAK;IACZK,SAAS,EAAEA,SAAS;iBACV,MAAM;IAChBF,IAAI,EAAEA,IAAI;IACV6B,UAAU,EAAE,CAAC;IACbC,KAAK,EAAE;MAAEC,QAAQ,EAAEpC,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEoC;KAAU;IACnCvC,GAAG,EAAEC;MACJY,gBAAgB,CACW,CACL;AAEvC,CAAC;;;;"}
@@ -198,7 +198,13 @@ const defaultLocalisationTexts = {
198
198
  freezeColumns: (count = 1) => count === 1 ? 'Freeze the first column' : `Freeze first ${count} columns`,
199
199
  gotoRow: 'Go to',
200
200
  hideColumn: 'Hide column',
201
- unfreezeColumns: 'Unfreeze all columns'
201
+ unfreezeColumns: 'Unfreeze all columns',
202
+ sorting: 'Sorting',
203
+ sortingOrder: {
204
+ ascending: 'Ascending order',
205
+ descending: 'Descending order',
206
+ unsorted: 'No sorting'
207
+ }
202
208
  },
203
209
  resize: {
204
210
  tooltip: 'Resize column'