@economic/taco 2.14.2 → 2.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. package/dist/components/Drawer/Drawer.d.ts +5 -1
  2. package/dist/components/Icon/components/AiChatSolid.d.ts +3 -0
  3. package/dist/components/Icon/components/AiStars.d.ts +3 -0
  4. package/dist/components/Icon/components/EnvelopeSolid.d.ts +3 -0
  5. package/dist/components/Icon/components/PhoneSolid.d.ts +3 -0
  6. package/dist/components/Icon/components/QuestionMarkBold.d.ts +3 -0
  7. package/dist/components/Icon/components/index.d.ts +1 -1
  8. package/dist/components/Input/Input.d.ts +1 -1
  9. package/dist/components/Menu/components/Item.d.ts +1 -1
  10. package/dist/components/Menu/components/Link.d.ts +1 -1
  11. package/dist/components/Navigation2/components/Link.d.ts +1 -1
  12. package/dist/components/Provider/Localization.d.ts +19 -0
  13. package/dist/components/SearchInput2/SearchInput2.d.ts +1 -0
  14. package/dist/components/Select2/components/Option.d.ts +2 -2
  15. package/dist/components/Select2/components/Search.d.ts +1 -1
  16. package/dist/components/Table3/components/alert/ErrorAlert.d.ts +10 -0
  17. package/dist/components/Table3/components/columns/cell/DisplayCell.d.ts +5 -2
  18. package/dist/components/Table3/components/columns/cell/EditingCell.d.ts +3 -0
  19. package/dist/components/Table3/components/columns/cell/Highlight.d.ts +2 -0
  20. package/dist/components/Table3/components/columns/internal/EditingActions.d.ts +1 -1
  21. package/dist/components/Table3/components/rows/Row.d.ts +2 -0
  22. package/dist/components/Table3/components/rows/RowContext.d.ts +1 -0
  23. package/dist/components/Table3/hooks/features/useEditing.d.ts +12 -11
  24. package/dist/components/Table3/hooks/features/usePauseShortcuts.d.ts +5 -0
  25. package/dist/components/Table3/hooks/features/useSearch.d.ts +2 -0
  26. package/dist/components/Table3/hooks/features/useValidation.d.ts +13 -0
  27. package/dist/components/Table3/hooks/useTable.d.ts +4 -0
  28. package/dist/components/Table3/types.d.ts +26 -1
  29. package/dist/components/Table3/util/editing.d.ts +6 -0
  30. package/dist/components/Tag/Tag.d.ts +1 -1
  31. package/dist/components/Tooltip/Tooltip.d.ts +4 -0
  32. package/dist/esm/index.css +112 -33
  33. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +7 -2
  34. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
  35. package/dist/esm/packages/taco/src/components/Field/Field.js +19 -3
  36. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  37. package/dist/esm/packages/taco/src/components/Icon/components/AiChatSolid.js +19 -0
  38. package/dist/esm/packages/taco/src/components/Icon/components/AiChatSolid.js.map +1 -0
  39. package/dist/esm/packages/taco/src/components/Icon/components/AiStars.js +30 -0
  40. package/dist/esm/packages/taco/src/components/Icon/components/AiStars.js.map +1 -0
  41. package/dist/esm/packages/taco/src/components/Icon/components/EnvelopeSolid.js +19 -0
  42. package/dist/esm/packages/taco/src/components/Icon/components/EnvelopeSolid.js.map +1 -0
  43. package/dist/esm/packages/taco/src/components/Icon/components/PhoneSolid.js +17 -0
  44. package/dist/esm/packages/taco/src/components/Icon/components/PhoneSolid.js.map +1 -0
  45. package/dist/esm/packages/taco/src/components/Icon/components/QuestionMarkBold.js +17 -0
  46. package/dist/esm/packages/taco/src/components/Icon/components/QuestionMarkBold.js.map +1 -0
  47. package/dist/esm/packages/taco/src/components/Icon/components/index.js +10 -0
  48. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  49. package/dist/esm/packages/taco/src/components/Provider/Localization.js +19 -0
  50. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  51. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +4 -0
  52. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  53. package/dist/esm/packages/taco/src/components/Table3/Table3.js +28 -4
  54. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  55. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +154 -0
  56. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -0
  57. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +51 -6
  58. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
  59. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +7 -55
  60. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  61. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +69 -37
  62. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  63. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +17 -17
  64. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  65. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js +41 -0
  66. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js.map +1 -0
  67. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +21 -12
  68. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  69. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js +1 -1
  70. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
  71. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +6 -5
  72. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -1
  73. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +2 -2
  74. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  75. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +57 -17
  76. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
  77. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +42 -32
  78. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  79. package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js +2 -1
  80. package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js.map +1 -1
  81. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +8 -1
  82. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  83. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.js +2 -1
  84. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/hooks/useParentStylesheets.js.map +1 -1
  85. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +48 -1
  86. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
  87. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +2 -2
  88. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js.map +1 -1
  89. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Toolbar.js +1 -1
  90. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Toolbar.js.map +1 -1
  91. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js +185 -101
  92. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js.map +1 -1
  93. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js +12 -0
  94. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js.map +1 -0
  95. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js +4 -1
  96. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js.map +1 -1
  97. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js +178 -0
  98. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js.map +1 -0
  99. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +1 -1
  100. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
  101. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +8 -2
  102. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  103. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js +1 -1
  104. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  105. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +21 -1
  106. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  107. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +4 -0
  108. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
  109. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js +20 -0
  110. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js.map +1 -0
  111. package/dist/index.css +112 -33
  112. package/dist/taco.cjs.development.js +1735 -957
  113. package/dist/taco.cjs.development.js.map +1 -1
  114. package/dist/taco.cjs.production.min.js +1 -1
  115. package/dist/taco.cjs.production.min.js.map +1 -1
  116. package/package.json +2 -2
  117. package/types.json +23852 -10957
@@ -1 +1 @@
1
- {"version":3,"file":"Localization.js","sources":["../../../../../../../src/components/Provider/Localization.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Locale } from '../../types';\nimport { CalendarTexts } from '../Calendar/Calendar';\nimport { ComboboxTexts } from '../Combobox/Combobox';\nimport { DialogTexts } from '../Dialog/Dialog';\nimport { PaginationTexts } from '../Pagination/Pagination';\nimport { ListboxTexts } from '../Listbox/Listbox';\nimport { ToastsTexts } from '../Toast/Toast';\nimport { DatepickerTexts } from '../Datepicker/Datepicker';\nimport { HeaderTexts } from '../Header/Header';\nimport { HangerTexts } from '../Hanger/Hanger';\nimport { SelectTexts } from '../Select/Select';\nimport { TourTexts } from '../Tour/Tour';\nimport { TableTexts } from '../Table/Table';\nimport { Table3Texts } from '../Table3/types';\nimport { SearchInputTexts } from '../SearchInput/SearchInput';\nimport { Select2Texts } from '../Select2/Select2';\nimport { BannerTexts } from '../Banner/Banner';\nimport { DrawerTexts } from '../Drawer/Drawer';\n\nexport type LocalizationTexts = {\n /** Localized texts and aria-labels for [Banner](component:banner) component */\n banner: BannerTexts;\n /** Localized texts and aria-labels for [Calendar](component:calendar) component */\n calendar: CalendarTexts;\n /** Localized texts and aria-labels for [Combobox](component:combobox) component */\n combobox: ComboboxTexts;\n /** Localized texts and aria-labels for [DatePicker](component:datepicker) component */\n datepicker: DatepickerTexts;\n /** Localized texts and aria-labels for [Dialog](component:dialog) component */\n dialog: DialogTexts;\n /** Localized texts and aria-labels for [Hanger](component:hanger) component */\n hanger: HangerTexts;\n /** Localized texts and aria-labels for [Header](component:header) component */\n header: HeaderTexts;\n /** Localized texts and aria-labels for [Listbox](component:listbox) component */\n listbox: ListboxTexts;\n /** Localized texts and aria-labels for [Pagination](component:pagination) component */\n pagination: PaginationTexts;\n /** Localized texts and aria-labels for [Table](component:table) component */\n table: TableTexts;\n /** Localized texts and aria-labels for [Table3](component:table3) component */\n table3: Table3Texts;\n /** Localized texts and aria-labels for [SearchInput](component:searchinput) component */\n searchInput: SearchInputTexts;\n /** Localized texts and aria-labels for [Select](component:select) component */\n select: SelectTexts;\n /** Localized texts and aria-labels for [Select2](component:select2) component */\n select2: Select2Texts;\n /** Localized texts and aria-labels for [Toast](component:toast) component */\n toasts: ToastsTexts;\n /** Localized texts and aria-labels for [Tour](component:tour) component */\n tour: TourTexts;\n /** Localized texts and aria-labels for [Drawer](component:drawer) component */\n drawer: DrawerTexts;\n};\n\nexport type Localization = {\n /**\n * Provide the language code used in application.\n * Default value is `en-GB`\n */\n locale: Locale;\n /** Provide the texts and aria-labels for components used within the provider */\n texts: LocalizationTexts;\n /** Provide the formatting */\n formatting: {\n /** Default value is `dd.mm.yy` */\n date: string;\n };\n};\n\nexport const defaultLocalisationTexts = {\n banner: {\n close: 'Close',\n },\n calendar: {\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n actions: {\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n previousYear: 'Previous year',\n nextYear: 'Next year',\n today: 'Today',\n },\n },\n combobox: {\n tooltip: 'Search in list',\n },\n datepicker: {\n calendar: 'Calendar',\n clear: 'Clear',\n expand: 'Show calendar',\n shortcuts: 'Shortcuts',\n },\n dialog: {\n close: 'Close',\n drag: 'Drag',\n },\n hanger: {\n close: 'Close',\n },\n header: {\n addAgreement: 'Add agreement',\n logout: 'Log off',\n more: 'More',\n new: 'New',\n search: 'Search for agreement...',\n },\n listbox: {\n loading: 'Loading results...',\n empty: 'No results found',\n allOption: 'All',\n },\n pagination: {\n label: 'Pagination',\n pageSize: 'Items per page',\n showingXofYofTotal: 'Showing [X] - [Y] of [total]',\n actions: {\n firstPage: 'Goto first page',\n firstPageWithShortcut: 'Goto first page (Home)',\n previousPage: 'Goto previous page',\n previousPageWithShortcut: 'Goto previous page (Page Up)',\n nextPage: 'Goto next page',\n nextPageWithShortcut: 'Goto next page (Page Down)',\n lastPage: 'Goto last page',\n lastPageWithShortcut: 'Goto last page (End)',\n pageX: 'Goto page [X]',\n },\n },\n table: {\n actions: 'Other actions',\n edit: 'Edit (e)',\n copy: 'Copy (c)',\n del: 'Delete (del)',\n newSubRow: 'New row (shift + n)',\n loading: 'Loading...',\n },\n table3: {\n columns: {\n actions: {\n tooltip: 'Row actions',\n },\n drag: {\n tooltip: 'Drag row',\n },\n expansion: {\n collapse: 'Collapse row',\n collapseAll: 'Collapse all rows',\n expand: 'Expand row',\n expandAll: 'Expand all rows',\n },\n menu: {\n freezeFirstColumn: 'Freeze the first column',\n freezeUptoColumn: `Freeze first [TOTAL] columns`,\n freezeColumns: (count = 1) => (count === 1 ? 'Freeze the first column' : `Freeze first ${count} columns`),\n gotoRow: 'Go to',\n hideColumn: 'Hide column',\n unfreezeColumns: 'Unfreeze all columns',\n sorting: 'Sorting',\n sortingOrder: {\n ascending: 'Ascending order',\n descending: 'Descending order',\n unsorted: 'No sorting',\n },\n },\n resize: {\n tooltip: 'Resize column',\n },\n select: {\n deselect: 'Deselect row',\n deselectAll: 'Deselect all rows',\n select: 'Select row',\n selectAll: 'Select all rows',\n },\n },\n columnSettings: {\n search: 'Search column...',\n tooltip: 'Column settings',\n button: 'Column settings',\n noResults: 'No results',\n },\n editing: {\n actions: {\n tooltip: 'Row actions',\n save: 'Save',\n clear: 'Clear changes',\n exit: 'Exit edit mode',\n },\n buttons: {\n edit: {\n tooltip: 'Edit table',\n },\n },\n rowIndicator: {\n rowWillMove: 'Row will move due to sorting',\n rowWillBeHidden: 'Row will hide due to filtering',\n rowWillMoveReasonSearch:\n 'Due to a search filter applied to this table, this row will be hidden as soon as you select another row',\n rowWillMoveReasonFilter:\n \"Due to a filter applied to the column '[COLUMN]', this row will be hidden as soon as you select another row\",\n rowWillMoveReasonSorting:\n \"Due to sorting applied to the column '[COLUMN]', this row will move position as soon as you select another row\",\n },\n saving: {\n progress: 'Saving...',\n complete: 'Saved',\n },\n },\n filters: {\n button: 'Filters',\n buttons: {\n addFilter: 'Add new filter',\n clearFilters: 'Clear all filters',\n },\n comparators: {\n contains: 'Contains',\n doesNotContain: 'Does not contain',\n isEqualTo: 'Is',\n isNotEqualTo: 'Is not',\n isGreaterThan: 'Is greater than',\n isLessThan: 'Is less than',\n isBetween: 'Is between',\n isOneOf: 'Is one of',\n isNoneOf: 'Is none of',\n isAllOf: 'Is all of',\n isEmpty: 'Is empty',\n isNotEmpty: 'Is not empty',\n isBefore: 'Is before',\n isAfter: 'Is after',\n isOnOrBefore: 'Is on or before',\n isOnOrAfter: 'Is on or after',\n isLessThanOrEqualTo: 'Is less than or equal to',\n isGreaterThanOrEqualTo: 'Is greater than or equal to',\n hasAnyOf: 'Has any of',\n hasAllOf: 'Has all of',\n hasNoneOf: 'Has none of',\n },\n conditions: {\n and: 'And',\n where: 'Where',\n },\n emptyFilter: {\n condition: 'Condition',\n value: 'Value',\n },\n hiddenColumn: 'Hidden column',\n tooltip: 'Apply filters',\n total: 'Viewing [CURRENT] of [TOTAL]',\n },\n fontSize: {\n tooltip: 'Font size',\n sizes: {\n small: 'Small',\n medium: 'Medium',\n large: 'Large',\n },\n },\n footer: {\n summary: {\n count: 'of',\n records: 'Records:',\n selected: 'Records selected:',\n },\n },\n print: {\n error: 'An error occurred while creating a print preview',\n loading: 'Creating a print preview',\n tooltip: 'Print',\n warningDialog: {\n title: 'Extra loading time',\n description:\n 'Please note that printing a large amount of data may result in a slightly longer waiting time due to data loading.',\n checkboxVisibilityLabel: \"Don't show again\",\n cancelButtonText: 'Cancel',\n printButtonText: 'Print',\n },\n },\n rowHeight: {\n tooltip: 'Row height',\n sizes: {\n short: 'Short',\n medium: 'Medium',\n tall: 'Tall',\n extraTall: 'Extra tall',\n },\n },\n search: {\n excludeUnmatchedResults: 'Show only search results',\n placeholder: 'Search...',\n },\n shortcuts: {\n tooltip: 'View keyboard shortcuts',\n search: 'Search',\n filter: 'Filter',\n previousRow: 'Previous row',\n nextRow: 'Next row',\n editCell: 'Edit cell',\n previousColumn: 'Previous column',\n nextColumn: 'Next column',\n rowClick: 'Activate current row',\n selectRow: 'Select current row',\n selectAllRows: 'Select all rows',\n expandRow: 'Expand current row',\n collapseRow: 'Collapse current row',\n },\n otherOptions: {\n tooltip: 'Table settings',\n },\n },\n searchInput: {\n button: 'Search',\n findNext: 'Next',\n findPrevious: 'Previous',\n placeholder: 'Search...',\n clear: 'Clear',\n },\n select: {\n allOptionsSelected: 'All',\n },\n select2: {\n allSelect: 'Select all',\n allDeselect: 'Deselect all',\n cancel: 'Cancel',\n chooseColor: 'Pick a color',\n create: 'Create',\n delete: 'Delete',\n save: 'Save',\n search: 'Search...',\n searchOrCreate: 'Search or create...',\n },\n toasts: {\n dismiss: 'Dismiss',\n },\n tour: {\n back: 'Back',\n close: 'Close',\n skip: 'Close and complete',\n last: 'Done',\n next: 'Next',\n open: 'Open',\n },\n drawer: {\n close: 'Close',\n },\n};\n\nexport const defaultLocalizationContext: Localization = {\n locale: 'en-GB',\n texts: defaultLocalisationTexts,\n formatting: {\n date: 'dd.mm.yy',\n },\n};\n\nexport const LocalizationContext = React.createContext<Localization>(defaultLocalizationContext);\nexport interface LocalizationProviderProps {\n children: React.ReactNode;\n localization?: Localization;\n}\nexport const LocalizationProvider: React.FC<LocalizationProviderProps> = ({ localization, children }) => {\n return (\n <LocalizationContext.Provider value={localization ?? defaultLocalizationContext}>{children}</LocalizationContext.Provider>\n );\n};\n\nexport const useLocalization = () => React.useContext(LocalizationContext);\n"],"names":["defaultLocalisationTexts","banner","close","calendar","months","weekdaysShort","weekdays","actions","previousMonth","nextMonth","previousYear","nextYear","today","combobox","tooltip","datepicker","clear","expand","shortcuts","dialog","drag","hanger","header","addAgreement","logout","more","new","search","listbox","loading","empty","allOption","pagination","label","pageSize","showingXofYofTotal","firstPage","firstPageWithShortcut","previousPage","previousPageWithShortcut","nextPage","nextPageWithShortcut","lastPage","lastPageWithShortcut","pageX","table","edit","copy","del","newSubRow","table3","columns","expansion","collapse","collapseAll","expandAll","menu","freezeFirstColumn","freezeUptoColumn","freezeColumns","count","gotoRow","hideColumn","unfreezeColumns","sorting","sortingOrder","ascending","descending","unsorted","resize","select","deselect","deselectAll","selectAll","columnSettings","button","noResults","editing","save","exit","buttons","rowIndicator","rowWillMove","rowWillBeHidden","rowWillMoveReasonSearch","rowWillMoveReasonFilter","rowWillMoveReasonSorting","saving","progress","complete","filters","addFilter","clearFilters","comparators","contains","doesNotContain","isEqualTo","isNotEqualTo","isGreaterThan","isLessThan","isBetween","isOneOf","isNoneOf","isAllOf","isEmpty","isNotEmpty","isBefore","isAfter","isOnOrBefore","isOnOrAfter","isLessThanOrEqualTo","isGreaterThanOrEqualTo","hasAnyOf","hasAllOf","hasNoneOf","conditions","and","where","emptyFilter","condition","value","hiddenColumn","total","fontSize","sizes","small","medium","large","footer","summary","records","selected","print","error","warningDialog","title","description","checkboxVisibilityLabel","cancelButtonText","printButtonText","rowHeight","short","tall","extraTall","excludeUnmatchedResults","placeholder","filter","previousRow","nextRow","editCell","previousColumn","nextColumn","rowClick","selectRow","selectAllRows","expandRow","collapseRow","otherOptions","searchInput","findNext","findPrevious","allOptionsSelected","select2","allSelect","allDeselect","cancel","chooseColor","create","delete","searchOrCreate","toasts","dismiss","tour","back","skip","last","next","open","drawer","defaultLocalizationContext","locale","texts","formatting","date","LocalizationContext","React","LocalizationProvider","localization","children","Provider","useLocalization"],"mappings":";;MAwEaA,wBAAwB,GAAG;EACpCC,MAAM,EAAE;IACJC,KAAK,EAAE;GACV;EACDC,QAAQ,EAAE;IACNC,MAAM,EAAE,CACJ,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,CACb;IACDC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IAChEC,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC;IACxFC,OAAO,EAAE;MACLC,aAAa,EAAE,gBAAgB;MAC/BC,SAAS,EAAE,YAAY;MACvBC,YAAY,EAAE,eAAe;MAC7BC,QAAQ,EAAE,WAAW;MACrBC,KAAK,EAAE;;GAEd;EACDC,QAAQ,EAAE;IACNC,OAAO,EAAE;GACZ;EACDC,UAAU,EAAE;IACRZ,QAAQ,EAAE,UAAU;IACpBa,KAAK,EAAE,OAAO;IACdC,MAAM,EAAE,eAAe;IACvBC,SAAS,EAAE;GACd;EACDC,MAAM,EAAE;IACJjB,KAAK,EAA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MAAM;IACZC,IAAI,EAAE,MAAM;IACZC,IAAI,EAAE;GACT;EACDC,MAAM,EAAE;IACJhL,KAAK,EAAE;;;MAIFiL,0BAA0B,GAAiB;EACpDC,MAAM,EAAE,OAAO;EACfC,KAAK,EAAErL,wBAAwB;EAC/BsL,UAAU,EAAE;IACRC,IAAI,EAAE;;;MAIDC,mBAAmB,gBAAGC,aAAmB,CAAeN,0BAA0B;MAKlFO,oBAAoB,GAAwCA,CAAC;EAAEC,YAAY;EAAEC;CAAU;EAChG,oBACIH,cAACD,mBAAmB,CAACK,QAAQ;IAACrE,KAAK,EAAEmE,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAIR;KAA6BS,QAAQ,CAAgC;AAElI;MAEaE,eAAe,GAAGA,MAAML,UAAgB,CAACD,mBAAmB;;;;"}
1
+ {"version":3,"file":"Localization.js","sources":["../../../../../../../src/components/Provider/Localization.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Locale } from '../../types';\nimport { CalendarTexts } from '../Calendar/Calendar';\nimport { ComboboxTexts } from '../Combobox/Combobox';\nimport { DialogTexts } from '../Dialog/Dialog';\nimport { PaginationTexts } from '../Pagination/Pagination';\nimport { ListboxTexts } from '../Listbox/Listbox';\nimport { ToastsTexts } from '../Toast/Toast';\nimport { DatepickerTexts } from '../Datepicker/Datepicker';\nimport { HeaderTexts } from '../Header/Header';\nimport { HangerTexts } from '../Hanger/Hanger';\nimport { SelectTexts } from '../Select/Select';\nimport { TourTexts } from '../Tour/Tour';\nimport { TableTexts } from '../Table/Table';\nimport { Table3Texts } from '../Table3/types';\nimport { SearchInputTexts } from '../SearchInput/SearchInput';\nimport { Select2Texts } from '../Select2/Select2';\nimport { BannerTexts } from '../Banner/Banner';\nimport { DrawerTexts } from '../Drawer/Drawer';\n\nexport type LocalizationTexts = {\n /** Localized texts and aria-labels for [Banner](component:banner) component */\n banner: BannerTexts;\n /** Localized texts and aria-labels for [Calendar](component:calendar) component */\n calendar: CalendarTexts;\n /** Localized texts and aria-labels for [Combobox](component:combobox) component */\n combobox: ComboboxTexts;\n /** Localized texts and aria-labels for [DatePicker](component:datepicker) component */\n datepicker: DatepickerTexts;\n /** Localized texts and aria-labels for [Dialog](component:dialog) component */\n dialog: DialogTexts;\n /** Localized texts and aria-labels for [Hanger](component:hanger) component */\n hanger: HangerTexts;\n /** Localized texts and aria-labels for [Header](component:header) component */\n header: HeaderTexts;\n /** Localized texts and aria-labels for [Listbox](component:listbox) component */\n listbox: ListboxTexts;\n /** Localized texts and aria-labels for [Pagination](component:pagination) component */\n pagination: PaginationTexts;\n /** Localized texts and aria-labels for [Table](component:table) component */\n table: TableTexts;\n /** Localized texts and aria-labels for [Table3](component:table3) component */\n table3: Table3Texts;\n /** Localized texts and aria-labels for [SearchInput](component:searchinput) component */\n searchInput: SearchInputTexts;\n /** Localized texts and aria-labels for [Select](component:select) component */\n select: SelectTexts;\n /** Localized texts and aria-labels for [Select2](component:select2) component */\n select2: Select2Texts;\n /** Localized texts and aria-labels for [Toast](component:toast) component */\n toasts: ToastsTexts;\n /** Localized texts and aria-labels for [Tour](component:tour) component */\n tour: TourTexts;\n /** Localized texts and aria-labels for [Drawer](component:drawer) component */\n drawer: DrawerTexts;\n};\n\nexport type Localization = {\n /**\n * Provide the language code used in application.\n * Default value is `en-GB`\n */\n locale: Locale;\n /** Provide the texts and aria-labels for components used within the provider */\n texts: LocalizationTexts;\n /** Provide the formatting */\n formatting: {\n /** Default value is `dd.mm.yy` */\n date: string;\n };\n};\n\nexport const defaultLocalisationTexts = {\n banner: {\n close: 'Close',\n },\n calendar: {\n months: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n actions: {\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n previousYear: 'Previous year',\n nextYear: 'Next year',\n today: 'Today',\n },\n },\n combobox: {\n tooltip: 'Search in list',\n },\n datepicker: {\n calendar: 'Calendar',\n clear: 'Clear',\n expand: 'Show calendar',\n shortcuts: 'Shortcuts',\n },\n dialog: {\n close: 'Close',\n drag: 'Drag',\n },\n hanger: {\n close: 'Close',\n },\n header: {\n addAgreement: 'Add agreement',\n logout: 'Log off',\n more: 'More',\n new: 'New',\n search: 'Search for agreement...',\n },\n listbox: {\n loading: 'Loading results...',\n empty: 'No results found',\n allOption: 'All',\n },\n pagination: {\n label: 'Pagination',\n pageSize: 'Items per page',\n showingXofYofTotal: 'Showing [X] - [Y] of [total]',\n actions: {\n firstPage: 'Goto first page',\n firstPageWithShortcut: 'Goto first page (Home)',\n previousPage: 'Goto previous page',\n previousPageWithShortcut: 'Goto previous page (Page Up)',\n nextPage: 'Goto next page',\n nextPageWithShortcut: 'Goto next page (Page Down)',\n lastPage: 'Goto last page',\n lastPageWithShortcut: 'Goto last page (End)',\n pageX: 'Goto page [X]',\n },\n },\n table: {\n actions: 'Other actions',\n edit: 'Edit (e)',\n copy: 'Copy (c)',\n del: 'Delete (del)',\n newSubRow: 'New row (shift + n)',\n loading: 'Loading...',\n },\n table3: {\n columns: {\n actions: {\n tooltip: 'Row actions',\n },\n drag: {\n tooltip: 'Drag row',\n },\n expansion: {\n collapse: 'Collapse row',\n collapseAll: 'Collapse all rows',\n expand: 'Expand row',\n expandAll: 'Expand all rows',\n },\n menu: {\n freezeFirstColumn: 'Freeze the first column',\n freezeUptoColumn: `Freeze first [TOTAL] columns`,\n freezeColumns: (count = 1) => (count === 1 ? 'Freeze the first column' : `Freeze first ${count} columns`),\n gotoRow: 'Go to',\n hideColumn: 'Hide column',\n unfreezeColumns: 'Unfreeze all columns',\n sorting: 'Sorting',\n sortingOrder: {\n ascending: 'Ascending order',\n descending: 'Descending order',\n unsorted: 'No sorting',\n },\n },\n resize: {\n tooltip: 'Resize column',\n },\n select: {\n deselect: 'Deselect row',\n deselectAll: 'Deselect all rows',\n select: 'Select row',\n selectAll: 'Select all rows',\n },\n },\n columnSettings: {\n search: 'Search column...',\n tooltip: 'Column settings',\n button: 'Column settings',\n noResults: 'No results',\n },\n editing: {\n actions: {\n tooltip: 'Row actions',\n save: 'Save',\n clear: 'Clear changes',\n exit: 'Exit edit mode',\n },\n buttons: {\n edit: {\n tooltip: 'Edit table',\n },\n },\n rowIndicator: {\n rowWillMove: 'Row will move due to sorting',\n rowWillBeHidden: 'Row will hide due to filtering',\n rowWillMoveReasonSearch:\n 'Due to a search filter applied to this table, this row will be hidden as soon as you select another row',\n rowWillMoveReasonFilter:\n \"Due to a filter applied to the column '[COLUMN]', this row will be hidden as soon as you select another row\",\n rowWillMoveReasonSorting:\n \"Due to sorting applied to the column '[COLUMN]', this row will move position as soon as you select another row\",\n },\n saving: {\n progress: 'Saving...',\n complete: 'Saved',\n },\n clearChangesConfirmationDialog: {\n title: 'Discard changes',\n description:\n 'Are you sure you want to discard changes on row ‘[ROW_IDENTIFIER] [ROW_IDENTIFIER_VALUE]’. Your changes will be lost.',\n cancel: 'Continue edititng',\n confirm: 'Discard',\n },\n },\n filters: {\n button: 'Filters',\n buttons: {\n addFilter: 'Add new filter',\n clearFilters: 'Clear all filters',\n },\n comparators: {\n contains: 'Contains',\n doesNotContain: 'Does not contain',\n isEqualTo: 'Is',\n isNotEqualTo: 'Is not',\n isGreaterThan: 'Is greater than',\n isLessThan: 'Is less than',\n isBetween: 'Is between',\n isOneOf: 'Is one of',\n isNoneOf: 'Is none of',\n isAllOf: 'Is all of',\n isEmpty: 'Is empty',\n isNotEmpty: 'Is not empty',\n isBefore: 'Is before',\n isAfter: 'Is after',\n isOnOrBefore: 'Is on or before',\n isOnOrAfter: 'Is on or after',\n isLessThanOrEqualTo: 'Is less than or equal to',\n isGreaterThanOrEqualTo: 'Is greater than or equal to',\n hasAnyOf: 'Has any of',\n hasAllOf: 'Has all of',\n hasNoneOf: 'Has none of',\n },\n conditions: {\n and: 'And',\n where: 'Where',\n },\n emptyFilter: {\n condition: 'Condition',\n value: 'Value',\n },\n hiddenColumn: 'Hidden column',\n tooltip: 'Apply filters',\n total: 'Viewing [CURRENT] of [TOTAL]',\n },\n fontSize: {\n tooltip: 'Font size',\n sizes: {\n small: 'Small',\n medium: 'Medium',\n large: 'Large',\n },\n },\n footer: {\n summary: {\n count: 'of',\n records: 'Records:',\n selected: 'Records selected:',\n },\n },\n print: {\n error: 'An error occurred while creating a print preview',\n loading: 'Creating a print preview',\n tooltip: 'Print',\n warningDialog: {\n title: 'Extra loading time',\n description:\n 'Please note that printing a large amount of data may result in a slightly longer waiting time due to data loading.',\n checkboxVisibilityLabel: \"Don't show again\",\n cancelButtonText: 'Cancel',\n printButtonText: 'Print',\n },\n },\n rowHeight: {\n tooltip: 'Row height',\n sizes: {\n short: 'Short',\n medium: 'Medium',\n tall: 'Tall',\n extraTall: 'Extra tall',\n },\n },\n search: {\n excludeUnmatchedResults: 'Show only search results',\n placeholder: 'Search...',\n },\n shortcuts: {\n tooltip: 'View keyboard shortcuts',\n search: 'Search',\n filter: 'Filter',\n previousRow: 'Previous row',\n nextRow: 'Next row',\n editCell: 'Edit cell',\n previousColumn: 'Previous column',\n nextColumn: 'Next column',\n rowClick: 'Activate current row',\n selectRow: 'Select current row',\n selectAllRows: 'Select all rows',\n expandRow: 'Expand current row',\n collapseRow: 'Collapse current row',\n },\n otherOptions: {\n tooltip: 'Table settings',\n },\n validation: {\n index: 'Index',\n alert: {\n unsavedEntries: (count = 1) => (count === 1 ? 'unsaved entry:' : 'unsaved entries:'),\n incompleteAndHavntBeenSaved: (count = 1) =>\n count === 1 ? 'is incomplete and haven’t been saved.' : 'are incomplete and haven’t been saved.',\n },\n resetFiltersDialog: {\n title: 'Row is hidden',\n description: 'The row is hidden due to filtering.',\n cancel: 'Cancel',\n confirm: 'Remove filters',\n },\n },\n },\n searchInput: {\n button: 'Search',\n findNext: 'Next',\n findPrevious: 'Previous',\n placeholder: 'Search...',\n clear: 'Clear',\n },\n select: {\n allOptionsSelected: 'All',\n },\n select2: {\n allSelect: 'Select all',\n allDeselect: 'Deselect all',\n cancel: 'Cancel',\n chooseColor: 'Pick a color',\n create: 'Create',\n delete: 'Delete',\n save: 'Save',\n search: 'Search...',\n searchOrCreate: 'Search or create...',\n },\n toasts: {\n dismiss: 'Dismiss',\n },\n tour: {\n back: 'Back',\n close: 'Close',\n skip: 'Close and complete',\n last: 'Done',\n next: 'Next',\n open: 'Open',\n },\n drawer: {\n close: 'Close',\n },\n};\n\nexport const defaultLocalizationContext: Localization = {\n locale: 'en-GB',\n texts: defaultLocalisationTexts,\n formatting: {\n date: 'dd.mm.yy',\n },\n};\n\nexport const LocalizationContext = React.createContext<Localization>(defaultLocalizationContext);\nexport interface LocalizationProviderProps {\n children: React.ReactNode;\n localization?: Localization;\n}\nexport const LocalizationProvider: React.FC<LocalizationProviderProps> = ({ localization, children }) => {\n return (\n <LocalizationContext.Provider value={localization ?? defaultLocalizationContext}>{children}</LocalizationContext.Provider>\n );\n};\n\nexport const useLocalization = () => React.useContext(LocalizationContext);\n"],"names":["defaultLocalisationTexts","banner","close","calendar","months","weekdaysShort","weekdays","actions","previousMonth","nextMonth","previousYear","nextYear","today","combobox","tooltip","datepicker","clear","expand","shortcuts","dialog","drag","hanger","header","addAgreement","logout","more","new","search","listbox","loading","empty","allOption","pagination","label","pageSize","showingXofYofTotal","firstPage","firstPageWithShortcut","previousPage","previousPageWithShortcut","nextPage","nextPageWithShortcut","lastPage","lastPageWithShortcut","pageX","table","edit","copy","del","newSubRow","table3","columns","expansion","collapse","collapseAll","expandAll","menu","freezeFirstColumn","freezeUptoColumn","freezeColumns","count","gotoRow","hideColumn","unfreezeColumns","sorting","sortingOrder","ascending","descending","unsorted","resize","select","deselect","deselectAll","selectAll","columnSettings","button","noResults","editing","save","exit","buttons","rowIndicator","rowWillMove","rowWillBeHidden","rowWillMoveReasonSearch","rowWillMoveReasonFilter","rowWillMoveReasonSorting","saving","progress","complete","clearChangesConfirmationDialog","title","description","cancel","confirm","filters","addFilter","clearFilters","comparators","contains","doesNotContain","isEqualTo","isNotEqualTo","isGreaterThan","isLessThan","isBetween","isOneOf","isNoneOf","isAllOf","isEmpty","isNotEmpty","isBefore","isAfter","isOnOrBefore","isOnOrAfter","isLessThanOrEqualTo","isGreaterThanOrEqualTo","hasAnyOf","hasAllOf","hasNoneOf","conditions","and","where","emptyFilter","condition","value","hiddenColumn","total","fontSize","sizes","small","medium","large","footer","summary","records","selected","print","error","warningDialog","checkboxVisibilityLabel","cancelButtonText","printButtonText","rowHeight","short","tall","extraTall","excludeUnmatchedResults","placeholder","filter","previousRow","nextRow","editCell","previousColumn","nextColumn","rowClick","selectRow","selectAllRows","expandRow","collapseRow","otherOptions","validation","index","alert","unsavedEntries","incompleteAndHavntBeenSaved","resetFiltersDialog","searchInput","findNext","findPrevious","allOptionsSelected","select2","allSelect","allDeselect","chooseColor","create","delete","searchOrCreate","toasts","dismiss","tour","back","skip","last","next","open","drawer","defaultLocalizationContext","locale","texts","formatting","date","LocalizationContext","React","LocalizationProvider","localization","children","Provider","useLocalization"],"mappings":";;MAwEaA,wBAAwB,GAAG;EACpCC,MAAM,EAAE;IACJC,KAAK,EAAE;GACV;EACDC,QAAQ,EAAE;IACNC,MAAM,EAAE,CACJ,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,CACb;IACDC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IAChEC,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC;IACxFC,OAAO,EAAE;MACLC,aAAa,EAAE,gB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Y,cAAZA,YAAY,GAAIR;KAA6BS,QAAQ,CAAgC;AAElI;MAEaE,eAAe,GAAGA,MAAML,UAAgB,CAACD,mBAAmB;;;;"}
@@ -16,6 +16,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
16
16
  findTotal,
17
17
  loading = false,
18
18
  onChange: handleChange,
19
+ onClear: handleClearCallback,
19
20
  onClickFindNext: handleClickFindNext,
20
21
  onClickFindPrevious: handleClickFindPrevious,
21
22
  settingsContent,
@@ -52,6 +53,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
52
53
  return (_internalRef$current2 = internalRef.current) === null || _internalRef$current2 === void 0 ? void 0 : _internalRef$current2.blur();
53
54
  });
54
55
  handleChange('');
56
+ handleClearCallback === null || handleClearCallback === void 0 ? void 0 : handleClearCallback();
55
57
  };
56
58
  const handleFocus = event => {
57
59
  var _attributes$onFocus;
@@ -173,6 +175,8 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
173
175
  opacity: 0.999
174
176
  }
175
177
  }, input, /*#__PURE__*/React__default.createElement("div", {
178
+ // We need to trigger blur when settings got blured as well, because settings is a part of SearchInput2 component
179
+ onBlur: handleBlur,
176
180
  className: settingsClassname,
177
181
  onClickCapture: () => {
178
182
  var _internalRef$current5;
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput2.js","sources":["../../../../../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\nimport { Spinner } from '../Spinner/Spinner';\nimport { Icon } from '../Icon/Icon';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n loading?: boolean;\n onChange: (value: string) => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n loading = false,\n onChange: handleChange,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n settingsContent,\n shortcut,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const hasFind = handleClickFindNext && handleClickFindPrevious && findCurrent !== undefined && findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n if (\n containerRef.current &&\n (containerRef.current === event.relatedTarget || containerRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.blur());\n handleChange('');\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setFocused(true);\n attributes.onFocus?.(event);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n }\n\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (value || focused)) {\n if (value) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"text-grey-700 flex h-4 items-center border-r border-black/[0.25] pr-2\">\n {loading ? <Spinner className=\"h-4 w-4\" /> : `${findCurrent ?? 0}/${findTotal ?? 0}`}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !value) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n '!pl-7 group-focus-within:!w-72 group-focus-within:yt-focus',\n hasFind\n ? {\n '!w-48': !value,\n '!w-72': value,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const icon = (\n <Icon\n aria-label={texts.searchInput.button}\n className=\"-ml-0.5 scale-95\"\n name=\"search\"\n onClickCapture={() => internalRef.current?.focus()}\n />\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={event => handleChange(event.target.value)}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={icon}\n postfix={postfix}\n ref={internalRef}\n value={value ?? ''}\n />\n );\n\n if (settingsContent) {\n const settingsClassname = cn(\n 'border-grey-300 absolute left-0 right-0 -mt-0.5 hidden top-full group-focus-within:flex focus-within:flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow !pt-[calc(theme(spacing.3)_+_theme(spacing[0.5]))]'\n );\n\n return (\n <div\n className={cn('group relative', { 'z-10 [&_[data-taco=input-container]]:z-10': focused })}\n ref={containerRef}\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n style={{ opacity: 0.999 }}>\n {input}\n <div\n className={settingsClassname}\n onClickCapture={() => internalRef.current?.focus()}\n // tab index is important, it lets the element show as a relatedTarget on event handlers\n tabIndex={-1}>\n {settingsContent}\n </div>\n </div>\n );\n }\n\n return input;\n});\n"],"names":["SearchInput2","React","forwardRef","props","ref","findCurrent","findTotal","loading","onChange","handleChange","onClickFindNext","handleClickFindNext","onClickFindPrevious","handleClickFindPrevious","settingsContent","shortcut","value","attributes","internalRef","useMergedRef","containerRef","useRef","focused","setFocused","useState","texts","useLocalization","isActive","length","hasFind","undefined","useGlobalKeyDown","event","document","activeElement","current","_internalRef$current","preventDefault","focus","handleBlur","relatedTarget","_containerRef$current","contains","_attributes$onBlur","onBlur","call","handleClear","requestAnimationFrame","_internalRef$current2","blur","handleFocus","_attributes$onFocus","onFocus","handleKeyDown","_props$onKeyDown","onKeyDown","isDefaultPrevented","key","shiftKey","postfix","disabled","readOnly","IconButton","searchInput","clear","className","icon","onMouseDown","tabIndex","tooltip","Shortcut","keys","Spinner","findPrevious","shift","findNext","onClickCapture","_internalRef$current3","cn","Icon","button","name","_internalRef$current4","input","Input","_attributes$ariaLabe","placeholder","target","_attributes$placehold","prefix","settingsClassname","style","opacity","_internalRef$current5"],"mappings":";;;;;;;;;;;MAqCaA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAYA,CAACG,KAAwB,EAAEC,GAAgC;;EACzH,MAAM;IACFC,WAAW;IACXC,SAAS;IACTC,OAAO,GAAG,KAAK;IACfC,QAAQ,EAAEC,YAAY;IACtBC,eAAe,EAAEC,mBAAmB;IACpCC,mBAAmB,EAAEC,uBAAuB;IAC5CC,eAAe;IACfC,QAAQ;IACRC,KAAK;IACL,GAAGC;GACN,GAAGd,KAAK;EACT,MAAMe,WAAW,GAAGC,YAAY,CAAmBf,GAAG,CAAC;EACvD,MAAMgB,YAAY,GAAGnB,cAAK,CAACoB,MAAM,CAAiB,IAAI,CAAC;EACvD,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGtB,cAAK,CAACuB,QAAQ,CAAC,KAAK,CAAC;EACnD,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,QAAQ,GAAGX,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEY,MAAM;EAC9B,MAAMC,OAAO,GAAGlB,mBAAmB,IAAIE,uBAAuB,IAAIR,WAAW,KAAKyB,SAAS,IAAIxB,SAAS,KAAKwB,SAAS;EAEtHC,gBAAgB,CAAChB,QAA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C,OAAO,EAAE;;OACjBT,KAAK,eACNlF;MACIgE,SAAS,EAAEyB,iBAAiB;MAC5Bd,cAAc,EAAEA;QAAA,IAAAiB,qBAAA;QAAA,QAAAA,qBAAA,GAAM3E,WAAW,CAACiB,OAAO,cAAA0D,qBAAA,uBAAnBA,qBAAA,CAAqBvD,KAAK,EAAE;;;MAElD8B,QAAQ,EAAE,CAAC;OACVtD,eAAe,CACd,CACJ;;EAId,OAAOqE,KAAK;AAChB,CAAC;;;;"}
1
+ {"version":3,"file":"SearchInput2.js","sources":["../../../../../../../src/components/SearchInput2/SearchInput2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { useGlobalKeyDown } from '../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\nimport { Input } from '../Input/Input';\nimport { Shortcut } from '../Shortcut/Shortcut';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { KeyDownHandlerOptions } from '../../utils/keyboard';\nimport { Spinner } from '../Spinner/Spinner';\nimport { Icon } from '../Icon/Icon';\n\ninterface CommonSearchInput2Props\n extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'onChange' | 'value'> {\n loading?: boolean;\n onChange: (value: string) => void;\n onClear?: () => void;\n settingsContent?: JSX.Element;\n shortcut?: string | KeyDownHandlerOptions;\n value?: string;\n}\n\ninterface BasicSearchInput2Props extends CommonSearchInput2Props {\n findCurrent?: never;\n findTotal?: never;\n onClickFindNext?: never;\n onClickFindPrevious?: never;\n}\n\ninterface ComplexSearchInput2Props extends CommonSearchInput2Props {\n findCurrent: number | null;\n findTotal: number | null;\n onClickFindNext: () => void;\n onClickFindPrevious: () => void;\n}\n\nexport type SearchInput2Props = BasicSearchInput2Props | ComplexSearchInput2Props;\n\nexport const SearchInput2 = React.forwardRef(function SearchInput2(props: SearchInput2Props, ref: React.Ref<HTMLInputElement>) {\n const {\n findCurrent,\n findTotal,\n loading = false,\n onChange: handleChange,\n onClear: handleClearCallback,\n onClickFindNext: handleClickFindNext,\n onClickFindPrevious: handleClickFindPrevious,\n settingsContent,\n shortcut,\n value,\n ...attributes\n } = props;\n const internalRef = useMergedRef<HTMLInputElement>(ref);\n const containerRef = React.useRef<HTMLDivElement>(null);\n const [focused, setFocused] = React.useState(false);\n const { texts } = useLocalization();\n const isActive = value?.length;\n const hasFind = handleClickFindNext && handleClickFindPrevious && findCurrent !== undefined && findTotal !== undefined;\n\n useGlobalKeyDown(shortcut, (event: KeyboardEvent) => {\n if (document.activeElement !== internalRef.current) {\n event.preventDefault();\n internalRef.current?.focus();\n }\n });\n\n const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n if (\n containerRef.current &&\n (containerRef.current === event.relatedTarget || containerRef.current?.contains(event.relatedTarget))\n ) {\n return;\n }\n\n setFocused(false);\n attributes.onBlur?.(event);\n };\n\n const handleClear = () => {\n requestAnimationFrame(() => internalRef.current?.blur());\n handleChange('');\n handleClearCallback?.();\n };\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setFocused(true);\n attributes.onFocus?.(event);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {\n props.onKeyDown?.(event);\n\n if (event.isDefaultPrevented()) {\n return;\n }\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (hasFind && isActive) {\n if (event.shiftKey) {\n handleClickFindPrevious?.();\n } else {\n handleClickFindNext?.();\n }\n }\n\n return;\n }\n\n if (event.key === 'Escape') {\n handleClear();\n return;\n }\n };\n\n let postfix;\n\n if (!attributes.disabled && !attributes.readOnly && (value || focused)) {\n if (value) {\n postfix = (\n <IconButton\n aria-label={texts.searchInput.clear}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"close\"\n onMouseDown={handleClear}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.clear} <Shortcut keys=\"Escape\" />\n </>\n ) : (\n texts.searchInput.clear\n )\n }\n />\n );\n }\n\n if (hasFind && isActive) {\n postfix = (\n <>\n <span className=\"text-grey-700 flex h-4 items-center border-r border-black/[0.25] pr-2\">\n {loading ? <Spinner className=\"h-4 w-4\" /> : `${findCurrent ?? 0}/${findTotal ?? 0}`}\n </span>\n {findCurrent ? (\n <>\n <IconButton\n aria-label={texts.searchInput.findPrevious}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-up\"\n onMouseDown={handleClickFindPrevious}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findPrevious} <Shortcut keys={{ shift: true, key: 'Enter' }} />\n </>\n ) : (\n texts.searchInput.findPrevious\n )\n }\n />\n <IconButton\n aria-label={texts.searchInput.findNext}\n className=\"scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125\"\n icon=\"chevron-down\"\n onMouseDown={handleClickFindNext}\n tabIndex={-1}\n tooltip={\n focused ? (\n <>\n {texts.searchInput.findNext} <Shortcut keys=\"Enter\" />\n </>\n ) : (\n texts.searchInput.findNext\n )\n }\n />\n </>\n ) : null}\n {postfix}\n </>\n );\n }\n } else if (shortcut && !focused && !value) {\n postfix = <Shortcut keys={shortcut} onClickCapture={() => internalRef.current?.focus()} />;\n }\n\n const className = cn(\n '!pl-7 group-focus-within:!w-72 group-focus-within:yt-focus',\n hasFind\n ? {\n '!w-48': !value,\n '!w-72': value,\n }\n : '!w-48',\n {\n '!wcag-blue-100': isActive,\n },\n props.className\n );\n\n const icon = (\n <Icon\n aria-label={texts.searchInput.button}\n className=\"-ml-0.5 scale-95\"\n name=\"search\"\n onClickCapture={() => internalRef.current?.focus()}\n />\n );\n\n const input = (\n <Input\n {...attributes}\n aria-label={attributes['aria-label'] ?? texts.searchInput.placeholder}\n className={className}\n data-taco=\"search-input2\"\n onBlur={handleBlur}\n onChange={event => handleChange(event.target.value)}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={attributes.placeholder ?? texts.searchInput.placeholder}\n prefix={icon}\n postfix={postfix}\n ref={internalRef}\n value={value ?? ''}\n />\n );\n\n if (settingsContent) {\n const settingsClassname = cn(\n 'border-grey-300 absolute left-0 right-0 -mt-0.5 hidden top-full group-focus-within:flex focus-within:flex flex-col gap-y-4 rounded-b border border-t-0 bg-white p-3 shadow !pt-[calc(theme(spacing.3)_+_theme(spacing[0.5]))]'\n );\n\n return (\n <div\n className={cn('group relative', { 'z-10 [&_[data-taco=input-container]]:z-10': focused })}\n ref={containerRef}\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n style={{ opacity: 0.999 }}>\n {input}\n <div\n // We need to trigger blur when settings got blured as well, because settings is a part of SearchInput2 component\n onBlur={handleBlur}\n className={settingsClassname}\n onClickCapture={() => internalRef.current?.focus()}\n // tab index is important, it lets the element show as a relatedTarget on event handlers\n tabIndex={-1}>\n {settingsContent}\n </div>\n </div>\n );\n }\n\n return input;\n});\n"],"names":["SearchInput2","React","forwardRef","props","ref","findCurrent","findTotal","loading","onChange","handleChange","onClear","handleClearCallback","onClickFindNext","handleClickFindNext","onClickFindPrevious","handleClickFindPrevious","settingsContent","shortcut","value","attributes","internalRef","useMergedRef","containerRef","useRef","focused","setFocused","useState","texts","useLocalization","isActive","length","hasFind","undefined","useGlobalKeyDown","event","document","activeElement","current","_internalRef$current","preventDefault","focus","handleBlur","relatedTarget","_containerRef$current","contains","_attributes$onBlur","onBlur","call","handleClear","requestAnimationFrame","_internalRef$current2","blur","handleFocus","_attributes$onFocus","onFocus","handleKeyDown","_props$onKeyDown","onKeyDown","isDefaultPrevented","key","shiftKey","postfix","disabled","readOnly","IconButton","searchInput","clear","className","icon","onMouseDown","tabIndex","tooltip","Shortcut","keys","Spinner","findPrevious","shift","findNext","onClickCapture","_internalRef$current3","cn","Icon","button","name","_internalRef$current4","input","Input","_attributes$ariaLabe","placeholder","target","_att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AAK;AAChB,CAAC;;;;"}
@@ -13,6 +13,7 @@ import { useTableRefInstanceSetup } from './hooks/useTableRefInstanceSetup.js';
13
13
  import { Summary } from './components/columns/footer/Summary.js';
14
14
  import { useCssVars } from './hooks/useCssVars.js';
15
15
  import { useHeaderOffsetStyle } from './hooks/features/useHeaderOffsetStyle.js';
16
+ import { ErrorAlert } from './components/alert/ErrorAlert.js';
16
17
  export { useTable3DataLoader } from './hooks/useTableDataLoader.js';
17
18
 
18
19
  function Column(_) {
@@ -30,7 +31,8 @@ const Table = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
30
31
  emptyState: EmptyState,
31
32
  customSettings,
32
33
  toolbarLeft,
33
- toolbarRight
34
+ toolbarRight,
35
+ defaultCurrentRowIndex
34
36
  } = props;
35
37
  const internalRef = useMergedRef(ref);
36
38
  const {
@@ -51,6 +53,20 @@ const Table = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
51
53
  const tableMeta = table.options.meta;
52
54
  const state = table.getState();
53
55
  const bodyRef = React__default.useRef(null);
56
+ React__default.useEffect(() => {
57
+ // On a very first render, the tanstack table rendered without any rows,
58
+ // so we delaying default row scrolling logic with using of requestAnimation frame
59
+ const animationFrameId = requestAnimationFrame(() => {
60
+ if (defaultCurrentRowIndex) {
61
+ scrollToIndex(defaultCurrentRowIndex, {
62
+ align: 'center'
63
+ });
64
+ }
65
+ });
66
+ return () => {
67
+ cancelAnimationFrame(animationFrameId);
68
+ };
69
+ }, []);
54
70
  React__default.useEffect(() => {
55
71
  const handleKeyDown = event => {
56
72
  const target = event.target;
@@ -58,7 +74,7 @@ const Table = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
58
74
  const eventOriginatedFromCombobox = !!target.closest('[role="combobox"]');
59
75
  // Don't trigger global shortcuts on the table if event originated from a combobox or if table is
60
76
  // outside the dialog
61
- if (eventOriginatedFromCombobox || dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(internalRef.current))) {
77
+ if (eventOriginatedFromCombobox || dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(internalRef.current)) || tableMeta.shortcutsState.isPaused) {
62
78
  return;
63
79
  }
64
80
  tableMeta.hoverState.handleKeyDown(event);
@@ -117,9 +133,10 @@ const Table = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
117
133
  const columnFreezingStyle = useColumnFreezingStyle(props.id, table);
118
134
  const headerOffsetStyle = useHeaderOffsetStyle(props.id, table);
119
135
  const isServerLoadingAndNotReady = tableMeta.isUsingServer && props.length === undefined;
136
+ const isPrinting = tableMeta.isPrinting;
120
137
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, columnFreezingStyle ? /*#__PURE__*/React__default.createElement("style", {
121
138
  "data-taco": "table3-column-freezing-styles"
122
- }, columnFreezingStyle) : null, headerOffsetStyle ? /*#__PURE__*/React__default.createElement("style", {
139
+ }, columnFreezingStyle) : null, headerOffsetStyle && !isPrinting ? /*#__PURE__*/React__default.createElement("style", {
123
140
  "data-taco": "table3-column-header-offset-styles"
124
141
  }, headerOffsetStyle) : null, /*#__PURE__*/React__default.createElement(Toolbar, {
125
142
  table: table,
@@ -129,6 +146,11 @@ const Table = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
129
146
  right: toolbarRight,
130
147
  customSettings: customSettings,
131
148
  scrollToIndex: scrollToIndex
149
+ }), /*#__PURE__*/React__default.createElement(ErrorAlert, {
150
+ table: table,
151
+ tableRef: internalRef,
152
+ scrollToIndex: scrollToIndex,
153
+ rowIdentifier: props.rowIdentifier
132
154
  }), /*#__PURE__*/React__default.createElement("div", {
133
155
  className: className,
134
156
  id: props.id,
@@ -179,7 +201,9 @@ const Table = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
179
201
  className: "group/footer contents",
180
202
  "data-taco": "table2-footer",
181
203
  role: "rowgroup"
182
- }, table.getFooterGroups().map(footerGroup => /*#__PURE__*/React__default.createElement("div", {
204
+ },
205
+ // Render the footer cell only for individual columns, excluding column groups.
206
+ table.getFooterGroups().slice(0, 1).map(footerGroup => /*#__PURE__*/React__default.createElement("div", {
183
207
  className: "contents",
184
208
  key: footerGroup.id,
185
209
  role: "row"
@@ -1 +1 @@
1
- {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { flexRender, TableMeta } from '@tanstack/react-table';\nimport { FocusScope } from '@react-aria/focus';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useCssGrid } from './hooks/useCssGrid';\nimport { useTable } from './hooks/useTable';\nimport { useTableRenderStrategy } from './strategies';\nimport { Table3ColumnProps, Table3GroupProps, Table3Props, Table3Ref } from './types';\nimport { Toolbar } from './components/toolbar/Toolbar';\nimport { useColumnFreezingStyle } from './hooks/features/useColumnFreezing';\nimport { useTableRefInstanceSetup } from './hooks/useTableRefInstanceSetup';\nimport { Summary } from './components/columns/footer/Summary';\nimport { useCssVars } from './hooks/useCssVars';\nimport './style.css';\nimport { useHeaderOffsetStyle } from './hooks/features/useHeaderOffsetStyle';\nimport { FONT_SIZE } from './components/toolbar/FontSize';\n\nfunction Column<TType = unknown>(_: Table3ColumnProps<TType>) {\n return null;\n}\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\ntype FixedForwardRef = <T, P = {}>(\n render: (props: P, ref: React.Ref<T>) => JSX.Element\n) => (props: P & React.RefAttributes<T>) => JSX.Element;\n\n// Cast the old forwardRef to the new one\nexport const fixedForwardRef = React.forwardRef as FixedForwardRef;\n\nconst Table = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const { emptyState: EmptyState, customSettings, toolbarLeft, toolbarRight } = props;\n const internalRef = useMergedRef<Table3Ref>(ref);\n\n const { table, length } = useTable<TType>(props);\n useTableRefInstanceSetup(table, internalRef);\n\n React.useEffect(() => {\n if (props.autoFocus) {\n internalRef.current?.focus();\n }\n }, []);\n\n const { renderBody, scrollToIndex } = useTableRenderStrategy<TType>(props, table, internalRef);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n\n const bodyRef = React.useRef<HTMLDivElement | null>(null);\n\n React.useEffect(\n () => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const dialog = target.closest('[role=\"dialog\"]');\n const eventOriginatedFromCombobox = !!target.closest('[role=\"combobox\"]');\n\n // Don't trigger global shortcuts on the table if event originated from a combobox or if table is\n // outside the dialog\n if (eventOriginatedFromCombobox || (dialog && !dialog?.contains(internalRef.current))) {\n return;\n }\n\n tableMeta.hoverState.handleKeyDown(event);\n tableMeta.currentRow.handleKeyDown(\n event,\n table.getRowModel().rows.length,\n scrollToIndex,\n tableMeta.editing.isEditing,\n internalRef\n );\n tableMeta.rowClick.handleKeyDown(event, table);\n tableMeta.rowSelection.handleKeyDown(event, table);\n tableMeta.editing.handleKeyDown(event);\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n },\n // See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143\n // scrollToIndex function changes when row count changes, so it is important to update handlers with new\n // scrollToIndex function.\n [scrollToIndex, tableMeta.editing.isEditing, internalRef.current]\n );\n\n const handleBlur = tableMeta.editing.isEnabled\n ? (event: React.FocusEvent) => {\n tableMeta.editing.handleBlur(event);\n }\n : undefined;\n\n const handleFocus =\n tableMeta.currentRow.currentRowIndex === undefined\n ? (event: React.FocusEvent) => {\n tableMeta.currentRow.handleFocus(event, table.getRowModel().rows.length, scrollToIndex);\n }\n : undefined;\n\n // mouse capture fires before focus, so we can prevent propagation and stop double setting of the active row\n const handleMouseCapture =\n tableMeta.currentRow.currentRowIndex === undefined\n ? (event: React.MouseEvent) => {\n tableMeta.currentRow.handleMouseCapture(event, table.getRowModel().rows.length);\n }\n : undefined;\n\n const handleScroll = async (event: React.MouseEvent<HTMLDivElement>) => {\n tableMeta.columnFreezing.handleScroll(event);\n };\n\n const className = cn(\n 'border-grey-300 relative grid h-full w-full flex-grow overflow-auto rounded border bg-white scroll-mt-[41px] focus-visible:outline-none',\n '[&[data-resizing=\"true\"]]:select-none',\n {\n 'text-xs': tableMeta.fontSize.size === FONT_SIZE.small,\n 'text-sm': tableMeta.fontSize.size === FONT_SIZE.medium,\n 'text-base': tableMeta.fontSize.size === FONT_SIZE.large,\n }\n );\n\n // Print tables have \"_print\" as the postfix for the table id, so we can use the it to determine\n // if the table is a print table or not.\n const { style: cssGridStyle } = useCssGrid<TType>(\n table,\n tableMeta.isPrinting,\n tableMeta.rowActions.actionsForRowLength,\n tableMeta.fontSize.size\n );\n const { style: cssVars } = useCssVars(tableMeta.rowHeight.height, tableMeta.fontSize.size);\n\n const style = {\n ...cssVars,\n ...cssGridStyle,\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n opacity: 0.999,\n };\n\n const columnFreezingStyle = useColumnFreezingStyle(props.id, table);\n const headerOffsetStyle = useHeaderOffsetStyle(props.id, table);\n const isServerLoadingAndNotReady = tableMeta.isUsingServer && props.length === undefined;\n\n return (\n <>\n {columnFreezingStyle ? <style data-taco=\"table3-column-freezing-styles\">{columnFreezingStyle}</style> : null}\n {headerOffsetStyle ? <style data-taco=\"table3-column-header-offset-styles\">{headerOffsetStyle}</style> : null}\n <Toolbar\n table={table}\n tableProps={props}\n total={length}\n left={toolbarLeft}\n right={toolbarRight}\n customSettings={customSettings}\n scrollToIndex={scrollToIndex}\n />\n <div\n className={className}\n id={props.id}\n data-font-size={tableMeta.fontSize.size}\n data-editing={tableMeta.editing.isEditing}\n data-horizontally-scrolled={tableMeta.columnFreezing.horizontallyScrolled}\n data-pause-hover={tableMeta?.hoverState.isPaused}\n data-resizing={!!state.columnSizingInfo.isResizingColumn}\n data-taco=\"table2\"\n onBlur={handleBlur}\n onFocus={handleFocus}\n onScroll={handleScroll}\n ref={internalRef}\n role=\"table\"\n style={style}\n tabIndex={-1}>\n {isServerLoadingAndNotReady ? null : (\n <div className=\"group/header contents\" data-taco=\"table2-header\" role=\"rowgroup\">\n {table.getHeaderGroups().map(headerGroup => (\n <div className=\"contents\" key={headerGroup.id} role=\"row\">\n {headerGroup.headers.map((header, index) => {\n // We need to render separator if column is not the last in array, if index is not equal to freeze column index,\n // if next element is not placeholder and if column itself is not placeholder.\n const hasSeparator =\n index !== tableMeta.columnFreezing.frozenColumnIndex &&\n index !== headerGroup.headers.length - 1 &&\n (!headerGroup.headers[index + 1]?.isPlaceholder || !header.isPlaceholder);\n return (\n <React.Fragment key={header.id}>\n {flexRender(header.column.columnDef.header, {\n ...header.getContext(),\n scrollToIndex,\n hasSeparator,\n })}\n </React.Fragment>\n );\n })}\n </div>\n ))}\n </div>\n )}\n {table.getRowModel().rows.length ? (\n <>\n <FocusScope autoFocus={tableMeta.editing.isEditing}>\n <div\n onMouseDownCapture={handleMouseCapture}\n className=\"group/body contents\"\n data-taco=\"table2-body\"\n role=\"rowgroup\"\n ref={bodyRef}>\n {renderBody()}\n </div>\n </FocusScope>\n {/* This div makes sure that there is always a free space between the rows and footer when\n table height exceeds the cumulative height of all rows. See useCSSGrid.ts */}\n {/* By vertically translating the div a pixel down, we hide the div border below footer so that\n the footer border doesn't appear an extra pixel thick */}\n <div className=\"border-grey-300 col-span-full translate-y-px border-t\" />\n {tableMeta.enableFooter ? (\n <div className=\"group/footer contents\" data-taco=\"table2-footer\" role=\"rowgroup\">\n {table.getFooterGroups().map(footerGroup => (\n <div className=\"contents\" key={footerGroup.id} role=\"row\">\n {footerGroup.headers.map(footer => (\n <React.Fragment key={footer.id}>\n {flexRender(footer.column.columnDef.footer, footer.getContext())}\n </React.Fragment>\n ))}\n </div>\n ))}\n {length ? (\n <Summary currentLength={table.getRowModel().rows.length} length={length} table={table} />\n ) : null}\n </div>\n ) : null}\n </>\n ) : (\n <div className=\"col-span-full min-h-[theme(spacing.8)]\">{EmptyState ? <EmptyState /> : null}</div>\n )}\n </div>\n </>\n );\n});\n\ntype Table3WithStatics = (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <Table<TType> {...props} key={key} ref={ref} />;\n}) as Table3WithStatics;\nTable3.Column = Column;\nTable3.Group = Group;\n\n// hooks\nexport { useTable3DataLoader } from './hooks/useTableDataLoader';\n\n// types\nexport type {\n useTable3DataFetcher,\n useTable3DataOptions,\n useTable3DataFetcherValues as useTableDataValues,\n} from './hooks/useTableDataLoader';\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3Preset,\n Table3Settings,\n Table3SettingsHandler,\n Table3RowHeight,\n Table3FilterComparator,\n Table3FilterHandler,\n Table3LoadPageHandler,\n Table3LoadAllHandler,\n Table3RowGotoHandler,\n Table3SortHandler,\n Table3Shortcuts,\n Table3ShortcutHandlerFn,\n Table3ShortcutHandlerObject,\n Table3FontSize,\n Table3SortDirection,\n Table3SortFn,\n Table3RowActionRenderer,\n Table3RowSelectionHandler,\n Table3RowExpansionRenderer,\n Table3RowDropHandler,\n Table3RowDragHandler,\n Table3RowClickHandler,\n Table3ColumnProps,\n Table3ColumnAlignment,\n Table3ColumnDataType,\n Table3ColumnHeaderMenu,\n Table3ColumnClassNameHandler,\n Table3ColumnFooterRenderer,\n Table3ColumnRenderer,\n Table3ColumnControlRenderer,\n Table3ColumnControlProps,\n} from './types';\n"],"names":["Column","_","displayName","Group","fixedForwardRef","React","forwardRef","Table","Table3","props","ref","emptyState","EmptyState","customSettings","toolbarLeft","toolbarRight","internalRef","useMergedRef","table","length","useTable","useTableRefInstanceSetup","useEffect","autoFocus","_internalRef$current","current","focus","renderBody","scrollToIndex","useTableRenderStrategy","tableMeta","options","meta","state","getState","bodyRef","useRef","handleKeyDown","event","target","dialog","closest","eventOriginatedFromCombobox","contains","hoverState","currentRow","getRowModel","rows","editing","isEditing","rowClick","rowSelection","document","addEventListener","removeEventListener","handleBlur","isEnabled","undefined","handleFocus","currentRowIndex","handleMouseCapture","handleScroll","columnFreezing","Promise","resolve","e","reject","className","cn","fontSize","size","FONT_SIZE","small","medium","large","style","cssGridStyle","useCssGrid","isPrinting","rowActions","actionsForRowLength","cssVars","useCssVars","rowHeight","height","opacity","columnFreezingStyle","useColumnFreezingStyle","id","headerOffsetStyle","useHeaderOffsetStyle","isServerLoadingAndNotReady","isUsingServer","Toolbar","tableProps","total","left","right","horizontallyScrolled","isPaused","columnSizingInfo","isResizingColumn","onBlur","onFocus","onScroll","role","tabIndex","getHeaderGroups","map","headerGroup","key","headers","header","index","hasSeparator","frozenColumnIndex","_headerGroup$headers","isPlaceholder","Fragment","flexRender","column","columnDef","getContext","FocusScope","onMouseDownCapture","enableFooter","getFooterGroups","footerGroup","footer","Summary","currentLength","stringifiedChildren","String","children","useMemo"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAAI;AACf;AACAD,MAAM,CAACE,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACF,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAE,KAAK,CAACD,WAAW,GAAG,aAAa;AAMjC;MACaE,eAAe,GAAGC,cAAK,CAACC;AAErC,MAAMC,KAAK,gBAAGH,eAAe,CAAC,SAASI,MAAMA,CAAkBC,KAAyB,EAAEC,GAAyB;EAC/G,MAAM;IAAEC,UAAU,EAAEC,UAAU;IAAEC,cAAc;IAAEC,WAAW;IAAEC;GAAc,GAAGN,KAAK;EACnF,MAAM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,CAAC,CAET,CAAC,EACDvG,MAAM,gBACHd,6BAAC4H,OAAO;IAACC,aAAa,EAAEhH,KAAK,CAAC4B,WAAW,EAAE,CAACC,IAAI,CAAC5B,MAAM;IAAEA,MAAM,EAAEA,MAAM;IAAED,KAAK,EAAEA;IAAS,GACzF,IAAI,CACN,GACN,IAAI,CACT,gBAEHb;IAAK8D,SAAS,EAAC;KAA0CvD,UAAU,gBAAGP,6BAACO,UAAU,OAAG,GAAG,IAAI,CAC9F,CACC,CACP;AAEX,CAAC,CAAC;MAOWJ,MAAM,gBAAGJ,eAAe,CAAC,SAASI,MAAMA,CAAkBC,KAAyB,EAAEC,GAAyB;EACvH,MAAMyH,mBAAmB,GAAGC,MAAM,CAAC3H,KAAK,CAAC4H,QAAQ,CAAC;;;EAGlD,MAAMvB,GAAG,GAAGzG,cAAK,CAACiI,OAAO,CAAC,MAAMF,MAAM,CAAC,WAAW,GAAGD,mBAAmB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EACjG,oBAAO9H,6BAACE,KAAK,oBAAYE,KAAK;IAAEqG,GAAG,EAAEA,GAAG;IAAEpG,GAAG,EAAEA;KAAO;AAC1D,CAAC;AACDF,MAAM,CAACR,MAAM,GAAGA,MAAM;AACtBQ,MAAM,CAACL,KAAK,GAAGA,KAAK;;;;"}
1
+ {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { flexRender, TableMeta } from '@tanstack/react-table';\nimport { FocusScope } from '@react-aria/focus';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useCssGrid } from './hooks/useCssGrid';\nimport { useTable } from './hooks/useTable';\nimport { useTableRenderStrategy } from './strategies';\nimport { Table3ColumnProps, Table3GroupProps, Table3Props, Table3Ref } from './types';\nimport { Toolbar } from './components/toolbar/Toolbar';\nimport { useColumnFreezingStyle } from './hooks/features/useColumnFreezing';\nimport { useTableRefInstanceSetup } from './hooks/useTableRefInstanceSetup';\nimport { Summary } from './components/columns/footer/Summary';\nimport { useCssVars } from './hooks/useCssVars';\nimport './style.css';\nimport { useHeaderOffsetStyle } from './hooks/features/useHeaderOffsetStyle';\nimport { FONT_SIZE } from './components/toolbar/FontSize';\nimport { ErrorAlert } from './components/alert/ErrorAlert';\n\nfunction Column<TType = unknown>(_: Table3ColumnProps<TType>) {\n return null;\n}\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\ntype FixedForwardRef = <T, P = {}>(\n render: (props: P, ref: React.Ref<T>) => JSX.Element\n) => (props: P & React.RefAttributes<T>) => JSX.Element;\n\n// Cast the old forwardRef to the new one\nexport const fixedForwardRef = React.forwardRef as FixedForwardRef;\n\nconst Table = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const { emptyState: EmptyState, customSettings, toolbarLeft, toolbarRight, defaultCurrentRowIndex } = props;\n const internalRef = useMergedRef<Table3Ref>(ref);\n\n const { table, length } = useTable<TType>(props);\n useTableRefInstanceSetup(table, internalRef);\n\n React.useEffect(() => {\n if (props.autoFocus) {\n internalRef.current?.focus();\n }\n }, []);\n\n const { renderBody, scrollToIndex } = useTableRenderStrategy<TType>(props, table, internalRef);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n\n const bodyRef = React.useRef<HTMLDivElement | null>(null);\n\n React.useEffect(() => {\n // On a very first render, the tanstack table rendered without any rows,\n // so we delaying default row scrolling logic with using of requestAnimation frame\n const animationFrameId = requestAnimationFrame(() => {\n if (defaultCurrentRowIndex) {\n scrollToIndex(defaultCurrentRowIndex, { align: 'center' });\n }\n });\n\n return () => {\n cancelAnimationFrame(animationFrameId);\n };\n }, []);\n\n React.useEffect(\n () => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const dialog = target.closest('[role=\"dialog\"]');\n const eventOriginatedFromCombobox = !!target.closest('[role=\"combobox\"]');\n\n // Don't trigger global shortcuts on the table if event originated from a combobox or if table is\n // outside the dialog\n if (eventOriginatedFromCombobox || (dialog && !dialog?.contains(internalRef.current)) || tableMeta.shortcutsState.isPaused) {\n return;\n }\n\n tableMeta.hoverState.handleKeyDown(event);\n tableMeta.currentRow.handleKeyDown(\n event,\n table.getRowModel().rows.length,\n scrollToIndex,\n tableMeta.editing.isEditing,\n internalRef\n );\n tableMeta.rowClick.handleKeyDown(event, table);\n tableMeta.rowSelection.handleKeyDown(event, table);\n tableMeta.editing.handleKeyDown(event);\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n },\n // See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143\n // scrollToIndex function changes when row count changes, so it is important to update handlers with new\n // scrollToIndex function.\n [scrollToIndex, tableMeta.editing.isEditing, internalRef.current]\n );\n\n const handleBlur = tableMeta.editing.isEnabled\n ? (event: React.FocusEvent) => {\n tableMeta.editing.handleBlur(event);\n }\n : undefined;\n\n const handleFocus =\n tableMeta.currentRow.currentRowIndex === undefined\n ? (event: React.FocusEvent) => {\n tableMeta.currentRow.handleFocus(event, table.getRowModel().rows.length, scrollToIndex);\n }\n : undefined;\n\n // mouse capture fires before focus, so we can prevent propagation and stop double setting of the active row\n const handleMouseCapture =\n tableMeta.currentRow.currentRowIndex === undefined\n ? (event: React.MouseEvent) => {\n tableMeta.currentRow.handleMouseCapture(event, table.getRowModel().rows.length);\n }\n : undefined;\n\n const handleScroll = async (event: React.MouseEvent<HTMLDivElement>) => {\n tableMeta.columnFreezing.handleScroll(event);\n };\n\n const className = cn(\n 'border-grey-300 relative grid h-full w-full flex-grow overflow-auto rounded border bg-white scroll-mt-[41px] focus-visible:outline-none',\n '[&[data-resizing=\"true\"]]:select-none',\n {\n 'text-xs': tableMeta.fontSize.size === FONT_SIZE.small,\n 'text-sm': tableMeta.fontSize.size === FONT_SIZE.medium,\n 'text-base': tableMeta.fontSize.size === FONT_SIZE.large,\n }\n );\n\n // Print tables have \"_print\" as the postfix for the table id, so we can use the it to determine\n // if the table is a print table or not.\n const { style: cssGridStyle } = useCssGrid<TType>(\n table,\n tableMeta.isPrinting,\n tableMeta.rowActions.actionsForRowLength,\n tableMeta.fontSize.size\n );\n const { style: cssVars } = useCssVars(tableMeta.rowHeight.height, tableMeta.fontSize.size);\n\n const style = {\n ...cssVars,\n ...cssGridStyle,\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n opacity: 0.999,\n };\n\n const columnFreezingStyle = useColumnFreezingStyle(props.id, table);\n const headerOffsetStyle = useHeaderOffsetStyle(props.id, table);\n const isServerLoadingAndNotReady = tableMeta.isUsingServer && props.length === undefined;\n const isPrinting = tableMeta.isPrinting;\n\n return (\n <>\n {columnFreezingStyle ? <style data-taco=\"table3-column-freezing-styles\">{columnFreezingStyle}</style> : null}\n {headerOffsetStyle && !isPrinting ? (\n <style data-taco=\"table3-column-header-offset-styles\">{headerOffsetStyle}</style>\n ) : null}\n <Toolbar\n table={table}\n tableProps={props}\n total={length}\n left={toolbarLeft}\n right={toolbarRight}\n customSettings={customSettings}\n scrollToIndex={scrollToIndex}\n />\n <ErrorAlert table={table} tableRef={internalRef} scrollToIndex={scrollToIndex} rowIdentifier={props.rowIdentifier} />\n <div\n className={className}\n id={props.id}\n data-font-size={tableMeta.fontSize.size}\n data-editing={tableMeta.editing.isEditing}\n data-horizontally-scrolled={tableMeta.columnFreezing.horizontallyScrolled}\n data-pause-hover={tableMeta?.hoverState.isPaused}\n data-resizing={!!state.columnSizingInfo.isResizingColumn}\n data-taco=\"table2\"\n onBlur={handleBlur}\n onFocus={handleFocus}\n onScroll={handleScroll}\n ref={internalRef}\n role=\"table\"\n style={style}\n tabIndex={-1}>\n {isServerLoadingAndNotReady ? null : (\n <div className=\"group/header contents\" data-taco=\"table2-header\" role=\"rowgroup\">\n {table.getHeaderGroups().map(headerGroup => (\n <div className=\"contents\" key={headerGroup.id} role=\"row\">\n {headerGroup.headers.map((header, index) => {\n // We need to render separator if column is not the last in array, if index is not equal to freeze column index,\n // if next element is not placeholder and if column itself is not placeholder.\n const hasSeparator =\n index !== tableMeta.columnFreezing.frozenColumnIndex &&\n index !== headerGroup.headers.length - 1 &&\n (!headerGroup.headers[index + 1]?.isPlaceholder || !header.isPlaceholder);\n return (\n <React.Fragment key={header.id}>\n {flexRender(header.column.columnDef.header, {\n ...header.getContext(),\n scrollToIndex,\n hasSeparator,\n })}\n </React.Fragment>\n );\n })}\n </div>\n ))}\n </div>\n )}\n {table.getRowModel().rows.length ? (\n <>\n <FocusScope autoFocus={tableMeta.editing.isEditing}>\n <div\n onMouseDownCapture={handleMouseCapture}\n className=\"group/body contents\"\n data-taco=\"table2-body\"\n role=\"rowgroup\"\n ref={bodyRef}>\n {renderBody()}\n </div>\n </FocusScope>\n {/* This div makes sure that there is always a free space between the rows and footer when\n table height exceeds the cumulative height of all rows. See useCSSGrid.ts */}\n {/* By vertically translating the div a pixel down, we hide the div border below footer so that\n the footer border doesn't appear an extra pixel thick */}\n <div className=\"border-grey-300 col-span-full translate-y-px border-t\" />\n {tableMeta.enableFooter ? (\n <div className=\"group/footer contents\" data-taco=\"table2-footer\" role=\"rowgroup\">\n {\n // Render the footer cell only for individual columns, excluding column groups.\n table\n .getFooterGroups()\n .slice(0, 1)\n .map(footerGroup => (\n <div className=\"contents\" key={footerGroup.id} role=\"row\">\n {footerGroup.headers.map(footer => (\n <React.Fragment key={footer.id}>\n {flexRender(footer.column.columnDef.footer, footer.getContext())}\n </React.Fragment>\n ))}\n </div>\n ))\n }\n {length ? (\n <Summary currentLength={table.getRowModel().rows.length} length={length} table={table} />\n ) : null}\n </div>\n ) : null}\n </>\n ) : (\n <div className=\"col-span-full min-h-[theme(spacing.8)]\">{EmptyState ? <EmptyState /> : null}</div>\n )}\n </div>\n </>\n );\n});\n\ntype Table3WithStatics = (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <Table<TType> {...props} key={key} ref={ref} />;\n}) as Table3WithStatics;\nTable3.Column = Column;\nTable3.Group = Group;\n\n// hooks\nexport { useTable3DataLoader } from './hooks/useTableDataLoader';\n\n// types\nexport type {\n useTable3DataFetcher,\n useTable3DataOptions,\n useTable3DataFetcherValues as useTableDataValues,\n} from './hooks/useTableDataLoader';\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3Preset,\n Table3Settings,\n Table3SettingsHandler,\n Table3RowHeight,\n Table3FilterComparator,\n Table3FilterHandler,\n Table3LoadPageHandler,\n Table3LoadAllHandler,\n Table3RowGotoHandler,\n Table3SortHandler,\n Table3Shortcuts,\n Table3ShortcutHandlerFn,\n Table3ShortcutHandlerObject,\n Table3FontSize,\n Table3SortDirection,\n Table3SortFn,\n Table3RowActionRenderer,\n Table3RowSelectionHandler,\n Table3RowExpansionRenderer,\n Table3RowDropHandler,\n Table3RowDragHandler,\n Table3RowClickHandler,\n Table3ColumnProps,\n Table3ColumnAlignment,\n Table3ColumnDataType,\n Table3ColumnHeaderMenu,\n Table3ColumnClassNameHandler,\n Table3ColumnFooterRenderer,\n Table3ColumnRenderer,\n Table3ColumnControlRenderer,\n Table3ColumnControlProps,\n} from './types';\n"],"names":["Column","_","displayName","Group","fixedForwardRef","React","forwardRef","Table","Table3","props","ref","emptyState","EmptyState","customSettings","toolbarLeft","toolbarRight","defaultCurrentRowIndex","internalRef","useMergedRef","table","length","useTable","useTableRefInstanceSetup","useEffect","autoFocus","_internalRef$current","current","focus","renderBody","scrollToIndex","useTableRenderStrategy","tableMeta","options","meta","state","getState","bodyRef","useRef","animationFrameId","requestAnimationFrame","align","cancelAnimationFrame","handleKeyDown","event","target","dialog","closest","eventOriginatedFromCombobox","contains","shortcutsState","isPaused","hoverState","currentRow","getRowModel","rows","editing","isEditing","rowClick","rowSelection","document","addEventListener","removeEventListener","handleBlur","isEnabled","undefined","handleFocus","currentRowIndex","handleMouseCapture","handleScroll","columnFreezing","Promise","resolve","e","reject","className","cn","fontSize","size","FONT_SIZE","small","medium","large","style","cssGridStyle","useCssGrid","isPrinting","rowActions","actionsForRowLength","cssVars","useCssVars","rowHeight","height","opacity","columnFreezingStyle","useColumnFreezingStyle","id","headerOffsetStyle","useHeaderOffsetStyle","isServerLoadingAndNotReady","isUsingServer","Toolbar","tableProps","total","left","right","ErrorAlert","tableRef","rowIdentifier","horizontallyScrolled","columnSizingInfo","isResizingColumn","onBlur","onFocus","onScroll","role","tabIndex","getHeaderGroups","map","headerGroup","key","headers","header","index","hasSeparator","frozenColumnIndex","_headerGroup$headers","isPlaceholder","Fragment","flexRender","column","columnDef","getContext","FocusScope","onMouseDownCapture","enableFooter","getFooterGroups","slice","footerGroup","footer","Summary","currentLength","stringifiedChildren","String","children","useMemo"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAAI;AACf;AACAD,MAAM,CAACE,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACF,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAE,KAAK,CAACD,WAAW,GAAG,aAAa;AAMjC;MACaE,eAAe,GAAGC,cAAK,CAACC;AAErC,MAAMC,KAAK,gBAAGH,eAAe,CAAC,SAASI,MAAMA,CAAkBC,KAAyB,EAAEC,GAAyB;EAC/G,MAAM;IAAEC,UAAU,EAAEC,UAAU;IAAEC,cAAc;IAAEC,WAAW;IAAEC,YAAY;IA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C,CAAC;EACjG,oBAAOxI,6BAACE,KAAK,oBAAYE,KAAK;IAAE8G,GAAG,EAAEA,GAAG;IAAE7G,GAAG,EAAEA;KAAO;AAC1D,CAAC;AACDF,MAAM,CAACR,MAAM,GAAGA,MAAM;AACtBQ,MAAM,CAACL,KAAK,GAAGA,KAAK;;;;"}
@@ -0,0 +1,154 @@
1
+ import React__default from 'react';
2
+ import { Alert } from '../../../Alert/Alert.js';
3
+ import { useLocalization } from '../../../Provider/Localization.js';
4
+ import { Button } from '../../../Button/Button.js';
5
+ import { Dialog } from '../../../Dialog/Dialog.js';
6
+ import { Group } from '../../../Group/Group.js';
7
+ import { focusableSelector } from '../../util/editing.js';
8
+ import { lastCellIndex } from '../rows/Row.js';
9
+
10
+ function ErrorAlert(props) {
11
+ var _column$columnDef$met;
12
+ const {
13
+ table,
14
+ tableRef,
15
+ scrollToIndex,
16
+ rowIdentifier
17
+ } = props;
18
+ const tableMeta = table.options.meta;
19
+ const errors = tableMeta.validation.errors;
20
+ const errorsRowIds = errors ? Object.keys(errors) : [];
21
+ const rows = table.getRowModel().rows;
22
+ const coreRows = table.getCoreRowModel().rows;
23
+ const {
24
+ texts
25
+ } = useLocalization();
26
+ const [resetFiltersConfirmationOpen, setResetFiltersConfirmationOpen] = React__default.useState(false);
27
+ const [internalRowId, setInternalRowId] = React__default.useState(null);
28
+ const [internalRowIndex, setInternalRowIndex] = React__default.useState(null);
29
+ const [isFiltersReset, setIsFiltersReset] = React__default.useState(false);
30
+ const columns = table.getAllFlatColumns();
31
+ const column = columns.find(column => column.id === rowIdentifier);
32
+ const rowIdentifierHeader = column === null || column === void 0 ? void 0 : (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header;
33
+ // Find and focus first invalid cell
34
+ const navigateToFirstInvalidCell = () => {
35
+ var _tableRef$current;
36
+ const firstInvalidCell = (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.querySelector('[role="row"][data-current="true"] [role="cell"][data-invalid="true"]');
37
+ const firstInvalidElement = firstInvalidCell === null || firstInvalidCell === void 0 ? void 0 : firstInvalidCell.querySelector(focusableSelector);
38
+ if (firstInvalidElement) {
39
+ firstInvalidElement === null || firstInvalidElement === void 0 ? void 0 : firstInvalidElement.focus();
40
+ lastCellIndex.value = firstInvalidCell === null || firstInvalidCell === void 0 ? void 0 : firstInvalidCell.getAttribute('data-column-index');
41
+ }
42
+ };
43
+ // Navigate to row and focus first invalid cell
44
+ const navigateToRow = rowIndex => {
45
+ tableMeta.currentRow.setCurrentRowIndex(rowIndex);
46
+ scrollToIndex(rowIndex, {
47
+ align: 'center'
48
+ });
49
+ lastCellIndex.value = undefined;
50
+ // Need to request animation frame here, because newly selected row is not rendered yet.
51
+ requestAnimationFrame(() => {
52
+ navigateToFirstInvalidCell();
53
+ });
54
+ };
55
+ // When internal row index is changed after click on row link, we should navigate to the row.
56
+ React__default.useEffect(() => {
57
+ if (internalRowIndex !== null && internalRowIndex >= 0) {
58
+ navigateToRow(internalRowIndex);
59
+ }
60
+ }, [internalRowIndex]);
61
+ // When filters are reset, we're able to get the real row index by rowId
62
+ React__default.useEffect(() => {
63
+ if (isFiltersReset) {
64
+ const rowIndex = rows.findIndex(row => row.id === internalRowId);
65
+ if (rowIndex === -1) {
66
+ return;
67
+ }
68
+ setInternalRowIndex(rowIndex);
69
+ }
70
+ }, [isFiltersReset]);
71
+ const onRowNumberClick = React__default.useCallback(rowId => {
72
+ // When row is hidden due filtering it will not be present in rows (but it still will be present in coreRows)
73
+ const foundIndex = rows.findIndex(row => row.id === rowId);
74
+ if (foundIndex === -1) {
75
+ setIsFiltersReset(false);
76
+ setResetFiltersConfirmationOpen(true);
77
+ // Since row indexes changed due filtering, we need to save row id, so that we can find it when filters will be reset
78
+ setInternalRowId(rowId);
79
+ return;
80
+ }
81
+ // In cases when user clicked on a row link multiple times we still need to navigate to the row, and focus the cell,
82
+ // because row/cell will loose focus on next click, but row index will not change.
83
+ if (foundIndex === internalRowIndex) {
84
+ navigateToRow(foundIndex);
85
+ } else {
86
+ setInternalRowIndex(foundIndex);
87
+ }
88
+ }, [rows, internalRowIndex]);
89
+ const onResetFiltersConfirm = () => {
90
+ setIsFiltersReset(true);
91
+ };
92
+ // Getting the row from core rows (ignoring search and filtering)
93
+ const getCoreRow = React__default.useCallback(rowId => coreRows.find(coreRow => coreRow.id === rowId), [coreRows]);
94
+ return /*#__PURE__*/React__default.createElement("div", {
95
+ className: "mb-4"
96
+ }, errorsRowIds.length ? /*#__PURE__*/React__default.createElement(Alert, {
97
+ state: "error",
98
+ className: "mb-1"
99
+ }, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("b", null, errorsRowIds.length, " ", texts.table3.validation.alert.unsavedEntries(errorsRowIds.length)), ' '), rowIdentifierHeader || texts.table3.validation.index, ' ', errorsRowIds.map((rowId, index) => {
100
+ const coreRow = getCoreRow(rowId);
101
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Button, {
102
+ key: rowId,
103
+ className: "!min-h-[theme(spacing.2)] !min-w-[theme(spacing.2)] !px-1",
104
+ appearance: "discrete",
105
+ onClick: () => {
106
+ onRowNumberClick(rowId);
107
+ }
108
+ }, rowIdentifier ? coreRow === null || coreRow === void 0 ? void 0 : coreRow.original[rowIdentifier] : coreRow === null || coreRow === void 0 ? void 0 : coreRow.index), /*#__PURE__*/React__default.createElement("span", {
109
+ key: `${rowId}_comma`
110
+ }, index < errorsRowIds.length - 1 ? ',' : ''));
111
+ }), texts.table3.validation.alert.incompleteAndHavntBeenSaved(errorsRowIds.length)) : null, /*#__PURE__*/React__default.createElement(FilterResetDialog, {
112
+ open: resetFiltersConfirmationOpen,
113
+ onClose: () => {
114
+ setResetFiltersConfirmationOpen(false);
115
+ },
116
+ onConfirm: onResetFiltersConfirm,
117
+ table: table
118
+ }));
119
+ }
120
+ function FilterResetDialog(props) {
121
+ const {
122
+ open,
123
+ onClose,
124
+ onConfirm,
125
+ table
126
+ } = props;
127
+ const tableMeta = table.options.meta;
128
+ const {
129
+ texts
130
+ } = useLocalization();
131
+ const resetFilters = React__default.useCallback(() => {
132
+ tableMeta.search.setQuery('');
133
+ table.resetGlobalFilter();
134
+ table.resetColumnFilters();
135
+ }, [table, tableMeta.search]);
136
+ const handleConfirmClick = () => {
137
+ resetFilters();
138
+ onConfirm();
139
+ onClose();
140
+ };
141
+ return /*#__PURE__*/React__default.createElement(Dialog, {
142
+ open: open,
143
+ onClose: onClose,
144
+ size: "xs"
145
+ }, /*#__PURE__*/React__default.createElement(Dialog.Content, {
146
+ "aria-label": "Create a new account"
147
+ }, /*#__PURE__*/React__default.createElement(Dialog.Title, null, texts.table3.validation.resetFiltersDialog.title), /*#__PURE__*/React__default.createElement("p", null, texts.table3.validation.resetFiltersDialog.description), /*#__PURE__*/React__default.createElement(Dialog.Footer, null, /*#__PURE__*/React__default.createElement(Group, null, /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button, null, texts.table3.validation.resetFiltersDialog.cancel)), /*#__PURE__*/React__default.createElement(Button, {
148
+ appearance: "primary",
149
+ onClick: handleConfirmClick
150
+ }, texts.table3.validation.resetFiltersDialog.confirm)))));
151
+ }
152
+
153
+ export { ErrorAlert };
154
+ //# sourceMappingURL=ErrorAlert.js.map