@economic/taco 2.22.2 → 2.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/components/Card/Card.d.ts +1 -0
  2. package/dist/components/Checkbox/Checkbox.d.ts +2 -0
  3. package/dist/components/OverflowGroup/OverflowGroup.d.ts +1 -1
  4. package/dist/components/Provider/Localization.d.ts +4 -0
  5. package/dist/components/Report/Report.d.ts +2 -0
  6. package/dist/components/Report/components/Body/Body.d.ts +0 -1
  7. package/dist/components/Report/components/Body/EmptyStateBody.d.ts +7 -0
  8. package/dist/components/Report/components/Cell/util.d.ts +1 -1
  9. package/dist/components/Report/components/Footer/Summary.d.ts +0 -1
  10. package/dist/components/Report/components/Toolbar/components/Filters/components/Filter.d.ts +2 -2
  11. package/dist/components/Report/components/Toolbar/components/Filters/components/FilterColumn.d.ts +5 -2
  12. package/dist/components/Report/types.d.ts +2 -0
  13. package/dist/components/Report/useReport.d.ts +1 -1
  14. package/dist/components/Select2/Select2.d.ts +4 -0
  15. package/dist/components/Select2/components/Trigger.d.ts +1 -0
  16. package/dist/components/Select2/hooks/useChildren.d.ts +1 -0
  17. package/dist/components/Table3/components/toolbar/Filter/filters/components/Filter.d.ts +2 -2
  18. package/dist/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.d.ts +5 -2
  19. package/dist/components/Truncate/Truncate.d.ts +2 -2
  20. package/dist/esm/index.css +128 -121
  21. package/dist/esm/packages/taco/src/components/Button/util.js +8 -8
  22. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Card/Card.js +8 -4
  24. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +11 -2
  26. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  27. package/dist/esm/packages/taco/src/components/Field/Field.js +4 -15
  28. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +2 -2
  30. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
  31. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
  32. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +13 -6
  33. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Provider/Localization.js +5 -1
  35. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Report/Report.js +11 -13
  37. package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js +1 -2
  39. package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Report/components/Body/EmptyStateBody.js +18 -0
  41. package/dist/esm/packages/taco/src/components/Report/components/Body/EmptyStateBody.js.map +1 -0
  42. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js +6 -2
  43. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js +14 -2
  45. package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js +2 -2
  47. package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js +47 -11
  49. package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js +28 -43
  51. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js +14 -7
  53. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js +4 -3
  55. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js +10 -8
  57. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js +2 -2
  59. package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js +10 -6
  61. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js +3 -10
  63. package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +2 -1
  65. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Select2/Select2.js +44 -4
  67. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +9 -4
  69. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  70. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +1 -1
  71. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/Table3/Table3.js +4 -6
  73. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +2 -2
  75. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +66 -14
  77. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +27 -44
  79. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  80. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js +14 -7
  81. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js.map +1 -1
  82. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +4 -3
  83. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
  84. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +1 -1
  85. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
  86. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +2 -0
  87. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
  88. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +2 -1
  89. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
  90. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +1 -1
  91. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +3 -1
  92. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
  93. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +10 -3
  94. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  95. package/dist/esm/packages/taco/src/components/Toast/Toaster.js +4 -3
  96. package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
  97. package/dist/esm/packages/taco/src/components/Truncate/Truncate.js +34 -0
  98. package/dist/esm/packages/taco/src/components/Truncate/Truncate.js.map +1 -0
  99. package/dist/esm/packages/taco/src/hooks/useLocalStorage.js.map +1 -1
  100. package/dist/esm/packages/taco/src/index.js +2 -1
  101. package/dist/esm/packages/taco/src/index.js.map +1 -1
  102. package/dist/esm/packages/taco/src/primitives/Button.js +1 -0
  103. package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
  104. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  105. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +24 -4
  106. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -1
  107. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js +48 -7
  108. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js.map +1 -1
  109. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js +1 -1
  110. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js.map +1 -1
  111. package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js +11 -6
  112. package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js.map +1 -1
  113. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js +33 -7
  114. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -1
  115. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js +5 -5
  116. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js.map +1 -1
  117. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js +14 -1
  118. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js.map +1 -1
  119. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js +0 -1
  120. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js.map +1 -1
  121. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +127 -3
  122. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  123. package/dist/esm/packages/taco/src/utils/dom.js +12 -3
  124. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  125. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js +4 -4
  126. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js.map +1 -1
  127. package/dist/esm/packages/taco/src/utils/keyboard.js +2 -2
  128. package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
  129. package/dist/hooks/useLocalStorage.d.ts +2 -1
  130. package/dist/index.css +128 -121
  131. package/dist/index.d.ts +1 -0
  132. package/dist/primitives/Table/types.d.ts +12 -2
  133. package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +10 -3
  134. package/dist/primitives/Table/useTable/features/useTableSettings.d.ts +2 -2
  135. package/dist/primitives/Table/useTable/useTable.d.ts +2 -1
  136. package/dist/primitives/Table/useTable/util/settings.d.ts +0 -1
  137. package/dist/taco.cjs.development.js +814 -455
  138. package/dist/taco.cjs.development.js.map +1 -1
  139. package/dist/taco.cjs.production.min.js +1 -1
  140. package/dist/taco.cjs.production.min.js.map +1 -1
  141. package/dist/utils/dom.d.ts +3 -1
  142. package/dist/utils/hooks/useTruncated.d.ts +1 -1
  143. package/package.json +2 -2
  144. package/types.json +9339 -9261
  145. package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +0 -12
  146. package/dist/components/Table3/components/toolbar/Filter/filters/components/Placeholder.d.ts +0 -12
  147. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js +0 -41
  148. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js.map +0 -1
  149. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js +0 -41
  150. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useTableDataLoader.js","sources":["../../../../../../../src/primitives/Table/useTableDataLoader.ts"],"sourcesContent":["import React from 'react';\nimport {\n TableColumnFilter,\n TableColumnSort,\n TableFilterHandler,\n TableServerLoadPageHandler,\n TableServerLoadAllHandler,\n TableSortHandler,\n} from './types';\n\nexport const DEFAULT_PAGE_SIZE = 100;\n\nexport type useTableDataPageFetcher<TType = unknown> = (\n pageIndex: number,\n pageSize: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataAllFetcher<TType = unknown> = (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataLoaderOptions = { pageSize: number };\n\nexport type useTableDataLoaderValues<TType = unknown> = {\n data: TType[];\n length: number | undefined;\n loadAll: TableServerLoadAllHandler;\n loadPage: TableServerLoadPageHandler;\n onChangeFilter: TableFilterHandler;\n onChangeSort: TableSortHandler;\n pageSize: number;\n};\n\nexport function useTableDataLoader<TType = unknown>(\n fetch: useTableDataPageFetcher<TType>,\n fetchAll: useTableDataAllFetcher<TType>,\n options: useTableDataLoaderOptions = { pageSize: DEFAULT_PAGE_SIZE }\n): [useTableDataLoaderValues<TType>, () => void] {\n const { pageSize } = options;\n\n // track the data length, we don't know it until the first request\n const length = React.useRef<number | undefined>(undefined);\n // data will be filled after the first request, then we'll update values in place\n const [data, setData] = React.useState<any[]>([]);\n // track which pages have been loaded to dedupe requests\n const _pendingPageRequests = React.useRef({});\n const _lastUsedSorting = React.useRef<TableColumnSort[]>([]);\n const _lastUsedFilters = React.useRef<TableColumnFilter[]>([]);\n const _lastUsedSearch = React.useRef<string>();\n const _forceReset = React.useRef(false);\n\n const loadPage = async (\n pageIndex: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n ) => {\n let reset = false;\n\n // sorting or filters changed, reset everything\n if (\n _forceReset.current ||\n search !== _lastUsedSearch.current ||\n JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) ||\n JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)\n ) {\n _pendingPageRequests.current = {};\n // nuke the dataset so that we \"start again\" after sorting\n reset = true;\n }\n\n if (_pendingPageRequests.current[pageIndex]) {\n // if page is already loaded/loading, abort, otherwise mark it as loading\n return;\n } else {\n _pendingPageRequests.current[pageIndex] = true;\n }\n\n _forceReset.current = false;\n // set the sorting so we can track if it changed between loads\n _lastUsedSorting.current = sorting;\n // set the filters so we can track if it changed between loads\n _lastUsedFilters.current = filters;\n // set the search so we can track if it changed between loads\n _lastUsedSearch.current = search;\n\n try {\n const response = await fetch(pageIndex, pageSize, sorting, filters, search);\n\n // update state, here we do some \"magic\" to support \"load in place\"\n setData(currentData => {\n let nextData;\n\n // reset table state if:\n // - the length isn't set at all (first load)\n // - the client length and server length are different (the data changed)\n if (reset || length.current !== response.length) {\n length.current = response.length;\n nextData = Array(length.current).fill(undefined);\n } else {\n nextData = [...currentData];\n }\n\n const startIndex = pageIndex * pageSize;\n nextData.splice(startIndex, pageSize, ...response.data);\n return nextData;\n });\n } catch {\n //\n } finally {\n _pendingPageRequests.current[pageIndex] = false;\n }\n };\n\n const loadAll = async (sorting: TableColumnSort[], filters: TableColumnFilter[], search: string | undefined) => {\n try {\n const response = await fetchAll(sorting, filters, search);\n length.current = response.length;\n\n setData(() => {\n let nextData;\n\n if (response.data.length !== response.length) {\n nextData = Array(response.length).fill(undefined);\n nextData.splice(0, response.data.length, ...response.data);\n } else {\n nextData = [...response.data];\n }\n\n return nextData;\n });\n } catch {\n //\n }\n };\n\n const invalidate = async () => {\n _forceReset.current = true;\n return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedSearch.current);\n };\n\n // we reset the page to 0 whenever sorting, filtering or search changes\n const handleSort = async (sorting: TableColumnSort[]) =>\n loadPage(0, sorting, _lastUsedFilters.current, _lastUsedSearch.current);\n const handleFilter = async (filters: TableColumnFilter[]) =>\n loadPage(0, _lastUsedSorting.current, filters, _lastUsedSearch.current);\n\n return [\n {\n data,\n length: length.current,\n loadAll,\n loadPage,\n onChangeFilter: handleFilter,\n onChangeSort: handleSort,\n pageSize,\n },\n invalidate,\n ];\n}\n"],"names":["DEFAULT_PAGE_SIZE"],"mappings":";;;MAUaA,iBAAiB,GAAG;;;;"}
1
+ {"version":3,"file":"useTableDataLoader.js","sources":["../../../../../../../src/primitives/Table/useTableDataLoader.ts"],"sourcesContent":["import React from 'react';\nimport {\n TableColumnFilter,\n TableColumnSort,\n TableFilterHandler,\n TableServerLoadPageHandler,\n TableServerLoadAllHandler,\n TableSortHandler,\n} from './types';\n\nexport const DEFAULT_PAGE_SIZE = 100;\n\nexport type useTableDataPageFetcher<TType = unknown> = (\n pageIndex: number,\n pageSize: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataAllFetcher<TType = unknown> = (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataLoaderOptions = { pageSize: number };\n\nexport type useTableDataLoaderValues<TType = unknown> = {\n data: TType[];\n length: number | undefined;\n loadAll: TableServerLoadAllHandler;\n loadPage: TableServerLoadPageHandler;\n onChangeFilter: TableFilterHandler;\n onChangeSort: TableSortHandler;\n pageSize: number;\n};\n\nexport function useTableDataLoader<TType = unknown>(\n fetch: useTableDataPageFetcher<TType>,\n fetchAll: useTableDataAllFetcher<TType>,\n options: useTableDataLoaderOptions = { pageSize: DEFAULT_PAGE_SIZE }\n): [useTableDataLoaderValues<TType>, () => void] {\n const { pageSize } = options;\n\n // track the data length, we don't know it until the first request\n const length = React.useRef<number | undefined>(undefined);\n // data will be filled after the first request, then we'll update values in place\n const [data, setData] = React.useState<any[]>([]);\n // track which pages have been loaded to dedupe requests\n const _pendingPageRequests = React.useRef({});\n const _lastUsedSorting = React.useRef<TableColumnSort[]>([]);\n const _lastUsedFilters = React.useRef<TableColumnFilter[]>([]);\n const _lastUsedSearch = React.useRef<string>();\n const _forceReset = React.useRef(false);\n\n const loadPage = async (\n pageIndex: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n ) => {\n let reset = false;\n\n // sorting or filters changed, reset everything\n if (\n _forceReset.current ||\n search !== _lastUsedSearch.current ||\n JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) ||\n JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)\n ) {\n _pendingPageRequests.current = {};\n // nuke the dataset so that we \"start again\" after sorting\n reset = true;\n }\n\n if (_pendingPageRequests.current[pageIndex]) {\n // if page is already loaded/loading, abort, otherwise mark it as loading\n return;\n } else {\n _pendingPageRequests.current[pageIndex] = true;\n }\n\n _forceReset.current = false;\n // set the sorting so we can track if it changed between loads\n _lastUsedSorting.current = sorting;\n // set the filters so we can track if it changed between loads\n _lastUsedFilters.current = filters;\n // set the search so we can track if it changed between loads\n _lastUsedSearch.current = search;\n\n try {\n const response = await fetch(pageIndex, pageSize, sorting, filters, search);\n\n // update state, here we do some \"magic\" to support \"load in place\"\n setData(currentData => {\n let nextData;\n\n // reset table state if:\n // - the length isn't set at all (first load)\n // - the client length and server length are different (the data changed)\n if (reset || length.current !== response.length) {\n length.current = response.length;\n nextData = Array(length.current).fill(undefined);\n } else {\n nextData = [...currentData];\n }\n\n const startIndex = pageIndex * pageSize;\n nextData.splice(startIndex, pageSize, ...response.data);\n return nextData;\n });\n } catch {\n //\n } finally {\n _pendingPageRequests.current[pageIndex] = false;\n }\n };\n\n const loadAll = async (sorting: TableColumnSort[], filters: TableColumnFilter[], search: string | undefined) => {\n try {\n const response = await fetchAll(sorting, filters, search);\n length.current = response.length;\n\n setData(() => {\n let nextData;\n\n if (response.data.length !== response.length) {\n nextData = Array(response.length).fill(undefined);\n nextData.splice(0, response.data.length, ...response.data);\n } else {\n nextData = [...response.data];\n }\n\n return nextData;\n });\n } catch {\n //\n }\n };\n\n const invalidate = async () => {\n _forceReset.current = true;\n return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedSearch.current);\n };\n\n // we reset the page to 0 whenever sorting, filtering or search changes\n const handleSort = async (sorting: TableColumnSort[]) =>\n loadPage(0, sorting, _lastUsedFilters.current, _lastUsedSearch.current);\n const handleFilter = async (filters: TableColumnFilter[]) =>\n loadPage(0, _lastUsedSorting.current, filters, _lastUsedSearch.current);\n\n return [\n {\n data,\n length: length.current,\n loadAll,\n loadPage,\n onChangeFilter: handleFilter,\n onChangeSort: handleSort,\n pageSize,\n },\n invalidate,\n ];\n}\n"],"names":["DEFAULT_PAGE_SIZE","useTableDataLoader","fetch","fetchAll","options","pageSize","length","React","useRef","undefined","data","setData","useState","_pendingPageRequests","_lastUsedSorting","_lastUsedFilters","_lastUsedSearch","_forceReset","loadPage","pageIndex","sorting","filters","search","reset","current","JSON","stringify","Promise","resolve","_temp","_finallyRethrows","_catch","then","response","currentData","nextData","Array","fill","startIndex","splice","_wasThrown","_result","e","reject","loadAll","_temp2","invalidate","handleSort","handleFilter","onChangeFilter","onChangeSort"],"mappings":";;;MAUaA,iBAAiB,GAAG;SA4BjBC,kBAAkBA,CAC9BC,KAAqC,EACrCC,QAAuC,EACvCC,UAAqC;EAAEC,QAAQ,EAAEL;CAAmB;EAEpE,MAAM;IAAEK;GAAU,GAAGD,OAAO;;EAG5B,MAAME,MAAM,GAAGC,cAAK,CAACC,MAAM,CAAqBC,SAAS,CAAC;;EAE1D,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGJ,cAAK,CAACK,QAAQ,CAAQ,EAAE,CAAC;;EAEjD,MAAMC,oBAAoB,GAAGN,cAAK,CAACC,MAAM,CAAC,EAAE,CAAC;EAC7C,MAAMM,gBAAgB,GAAGP,cAAK,CAACC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BoB,OAAO;IACP1B,QAAQ;IACR+B,cAAc,EAAED,YAAY;IAC5BE,YAAY,EAAEH,UAAU;IACxB1C;GACH,EACDyC,UAAU,CACb;AACL;;;;"}
@@ -43,10 +43,19 @@ function isElementInsideOrTriggeredFromContainer(element, container) {
43
43
  }
44
44
  return !!(container !== null && container !== void 0 && container.contains(element));
45
45
  }
46
- function isEventTriggeredOnInteractiveElement(eventTarget) {
47
- const element = eventTarget;
46
+ function isElementInsideOverlay(element) {
47
+ return !!(element !== null && element !== void 0 && element.closest('[role=dialog],[role=menu]'));
48
+ }
49
+ function isSiblingElementInsideSameParentOverlay(element, sibling) {
50
+ var _element$closest2;
51
+ return !!(element !== null && element !== void 0 && (_element$closest2 = element.closest('[role=dialog],[role=menu]')) !== null && _element$closest2 !== void 0 && _element$closest2.contains(sibling));
52
+ }
53
+ function isElementInteractive(element) {
54
+ if (!element) {
55
+ return false;
56
+ }
48
57
  return ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
49
58
  }
50
59
 
51
- export { getIndexOfFirstChildOverflowingParent, getNextFocussableElement, isElementInsideOrTriggeredFromContainer, isEventTriggeredOnInteractiveElement };
60
+ export { getIndexOfFirstChildOverflowingParent, getNextFocussableElement, isElementInsideOrTriggeredFromContainer, isElementInsideOverlay, isElementInteractive, isSiblingElementInsideSameParentOverlay };
52
61
  //# sourceMappingURL=dom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dom.js","sources":["../../../../../../src/utils/dom.ts"],"sourcesContent":["export const isOverflowing = (element: HTMLElement | null) =>\n element !== null ? element.scrollWidth > element.offsetWidth : false;\n\nexport const getIndexOfFirstChildOverflowingParent = (element: HTMLElement, overscan = 0) => {\n let index = 0;\n let boundaryChildIndex: number | null = null;\n const clientRect = element.getBoundingClientRect();\n\n for (const child of Array.from(element.children)) {\n const right = child.getBoundingClientRect().right - clientRect.left;\n const width = clientRect.width - overscan;\n\n if (right > width) {\n boundaryChildIndex = index;\n break;\n }\n index++;\n }\n\n return boundaryChildIndex;\n};\n\nexport const getNextFocussableElement = (currentElement: HTMLElement | null) => {\n if (!currentElement) {\n return null;\n }\n\n const focussableElements = [\n ...document.querySelectorAll<HTMLElement>(\n 'button:not([disabled]), [href]:not(link):not(script), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled]), details:not([disabled]), summary:not(:disabled)'\n ),\n ];\n const currentElementIndex = focussableElements.indexOf(currentElement);\n\n // If the currentElement is not in the focussable elements list or it is the last element\n if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {\n return null;\n }\n\n return focussableElements[currentElementIndex + 1];\n};\n\nconst getOverlaySelector = (element: Element | null) => {\n switch (element?.getAttribute('role')) {\n case 'dialog':\n return `[aria-controls='${element.id}']`;\n\n case 'menu':\n return `#${element.getAttribute('aria-labelledby')}`;\n\n default:\n return undefined;\n }\n};\n\nexport function isElementInsideOrTriggeredFromContainer(element: Element | null, container: Element | null) {\n const selector = getOverlaySelector(element) ?? getOverlaySelector(element?.closest('[role=dialog],[role=menu]') ?? null);\n\n if (selector) {\n return !!container?.querySelector(selector);\n }\n\n return !!container?.contains(element);\n}\n\nexport function isEventTriggeredOnInteractiveElement(eventTarget: EventTarget | null) {\n const element = eventTarget as HTMLElement;\n\n return (\n ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) &&\n !element.hidden &&\n !(element as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLButtonElement).disabled &&\n !(element as HTMLInputElement | HTMLTextAreaElement).readOnly\n );\n}\n"],"names":["getIndexOfFirstChildOverflowingParent","element","overscan","index","boundaryChildIndex","clientRect","getBoundingClientRect","child","Array","from","children","right","left","width","getNextFocussableElement","currentElement","focussableElements","document","querySelectorAll","currentElementIndex","indexOf","length","getOverlaySelector","getAttribute","id","undefined","isElementInsideOrTriggeredFromContainer","container","selector","_getOverlaySelector","_element$closest","closest","querySelector","contains","isEventTriggeredOnInteractiveElement","eventTarget","includes","tagName","hidden","disabled","readOnly"],"mappings":"MAGaA,qCAAqC,GAAGA,CAACC,OAAoB,EAAEC,QAAQ,GAAG,CAAC;EACpF,IAAIC,KAAK,GAAG,CAAC;EACb,IAAIC,kBAAkB,GAAkB,IAAI;EAC5C,MAAMC,UAAU,GAAGJ,OAAO,CAACK,qBAAqB,EAAE;EAElD,KAAK,MAAMC,KAAK,IAAIC,KAAK,CAACC,IAAI,CAACR,OAAO,CAACS,QAAQ,CAAC,EAAE;IAC9C,MAAMC,KAAK,GAAGJ,KAAK,CAACD,qBAAqB,EAAE,CAACK,KAAK,GAAGN,UAAU,CAACO,IAAI;IACnE,MAAMC,KAAK,GAAGR,UAAU,CAACQ,KAAK,GAAGX,QAAQ;IAEzC,IAAIS,KAAK,GAAGE,KAAK,EAAE;MACfT,kBAAkB,GAAGD,KAAK;MAC1B;;IAEJA,KAAK,EAAE;;EAGX,OAAOC,kBAAkB;AAC7B;MAEaU,wBAAwB,GAAIC,cAAkC;EACvE,IAAI,CAACA,cAAc,EAAE;IACjB,OAAO,IAAI;;EAGf,MAAMC,kBAAkB,GAAG,CACvB,GAAGC,QAAQ,CAACC,gBAAgB,CACxB,iOAAiO,CACpO,CACJ;EACD,MAAMC,mBAAmB,GAAGH,kBAAkB,CAACI,OAAO,CAACL,cAAc,CAAC;;EAGtE,IAAII,mBAAmB,KAAK,CAAC,CAAC,IAAIA,mBAAmB,KAAKH,kBAAkB,CAACK,MAAM,GAAG,CAAC,EAAE;IACrF,OAAO,IAAI;;EAGf,OAAOL,kBAAkB,CAACG,mBAAmB,GAAG,CAAC,CAAC;AACtD;AAEA,MAAMG,kBAAkB,GAAIrB,OAAuB;EAC/C,QAAQA,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEsB,YAAY,CAAC,MAAM,CAAC;IACjC,KAAK,QAAQ;MACT,0BAA0BtB,OAAO,CAACuB,MAAM;IAE5C,KAAK,MAAM;MACP,WAAWvB,OAAO,CAACsB,YAAY,CAAC,iBAAiB,GAAG;IAExD;MACI,OAAOE,SAAS;;AAE5B,CAAC;SAEeC,uCAAuCA,CAACzB,OAAuB,EAAE0B,SAAyB;;EACtG,MAAMC,QAAQ,IAAAC,mBAAA,GAAGP,kBAAkB,CAACrB,OAAO,CAAC,cAAA4B,mBAAA,cAAAA,mBAAA,GAAIP,kBAAkB,EAAAQ,gBAAA,GAAC7B,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAE8B,OAAO,CAAC,2BAA2B,CAAC,cAAAD,gBAAA,cAAAA,gBAAA,GAAI,IAAI,CAAC;EAEzH,IAAIF,QAAQ,EAAE;IACV,OAAO,CAAC,EAACD,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEK,aAAa,CAACJ,QAAQ,CAAC;;EAG/C,OAAO,CAAC,EAACD,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEM,QAAQ,CAAChC,OAAO,CAAC;AACzC;SAEgBiC,oCAAoCA,CAACC,WAA+B;EAChF,MAAMlC,OAAO,GAAGkC,WAA0B;EAE1C,OACI,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAACC,QAAQ,CAACnC,OAAO,CAACoC,OAAO,CAAC,IAC3F,CAACpC,OAAO,CAACqC,MAAM,IACf,CAAErC,OAA0F,CAACsC,QAAQ,IACrG,CAAEtC,OAAkD,CAACuC,QAAQ;AAErE;;;;"}
1
+ {"version":3,"file":"dom.js","sources":["../../../../../../src/utils/dom.ts"],"sourcesContent":["export const isOverflowing = (element: HTMLElement | null) =>\n element !== null ? element.scrollWidth > element.offsetWidth : false;\n\nexport const getIndexOfFirstChildOverflowingParent = (element: HTMLElement, overscan = 0) => {\n let index = 0;\n let boundaryChildIndex: number | null = null;\n const clientRect = element.getBoundingClientRect();\n\n for (const child of Array.from(element.children)) {\n const right = child.getBoundingClientRect().right - clientRect.left;\n const width = clientRect.width - overscan;\n\n if (right > width) {\n boundaryChildIndex = index;\n break;\n }\n index++;\n }\n\n return boundaryChildIndex;\n};\n\nexport const getNextFocussableElement = (currentElement: HTMLElement | null) => {\n if (!currentElement) {\n return null;\n }\n\n const focussableElements = [\n ...document.querySelectorAll<HTMLElement>(\n 'button:not([disabled]), [href]:not(link):not(script), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled]), details:not([disabled]), summary:not(:disabled)'\n ),\n ];\n const currentElementIndex = focussableElements.indexOf(currentElement);\n\n // If the currentElement is not in the focussable elements list or it is the last element\n if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {\n return null;\n }\n\n return focussableElements[currentElementIndex + 1];\n};\n\nconst getOverlaySelector = (element: Element | null) => {\n switch (element?.getAttribute('role')) {\n case 'dialog':\n return `[aria-controls='${element.id}']`;\n\n case 'menu':\n return `#${element.getAttribute('aria-labelledby')}`;\n\n default:\n return undefined;\n }\n};\n\nexport function isElementInsideOrTriggeredFromContainer(element: Element | null, container: Element | null) {\n const selector = getOverlaySelector(element) ?? getOverlaySelector(element?.closest('[role=dialog],[role=menu]') ?? null);\n\n if (selector) {\n return !!container?.querySelector(selector);\n }\n\n return !!container?.contains(element);\n}\n\nexport function isElementInsideOverlay(element: Element | null) {\n return !!element?.closest('[role=dialog],[role=menu]');\n}\n\nexport function isSiblingElementInsideSameParentOverlay(element: Element | null, sibling: Element | null) {\n return !!element?.closest('[role=dialog],[role=menu]')?.contains(sibling);\n}\n\nexport function isElementInteractive(element: Element | null) {\n if (!element) {\n return false;\n }\n\n return (\n ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) &&\n !(element as HTMLElement).hidden &&\n !(element as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLButtonElement).disabled &&\n !(element as HTMLInputElement | HTMLTextAreaElement).readOnly\n );\n}\n"],"names":["getIndexOfFirstChildOverflowingParent","element","overscan","index","boundaryChildIndex","clientRect","getBoundingClientRect","child","Array","from","children","right","left","width","getNextFocussableElement","currentElement","focussableElements","document","querySelectorAll","currentElementIndex","indexOf","length","getOverlaySelector","getAttribute","id","undefined","isElementInsideOrTriggeredFromContainer","container","selector","_getOverlaySelector","_element$closest","closest","querySelector","contains","isElementInsideOverlay","isSiblingElementInsideSameParentOverlay","sibling","_element$closest2","isElementInteractive","includes","tagName","hidden","disabled","readOnly"],"mappings":"MAGaA,qCAAqC,GAAGA,CAACC,OAAoB,EAAEC,QAAQ,GAAG,CAAC;EACpF,IAAIC,KAAK,GAAG,CAAC;EACb,IAAIC,kBAAkB,GAAkB,IAAI;EAC5C,MAAMC,UAAU,GAAGJ,OAAO,CAACK,qBAAqB,EAAE;EAElD,KAAK,MAAMC,KAAK,IAAIC,KAAK,CAACC,IAAI,CAACR,OAAO,CAACS,QAAQ,CAAC,EAAE;IAC9C,MAAMC,KAAK,GAAGJ,KAAK,CAACD,qBAAqB,EAAE,CAACK,KAAK,GAAGN,UAAU,CAACO,IAAI;IACnE,MAAMC,KAAK,GAAGR,UAAU,CAACQ,KAAK,GAAGX,QAAQ;IAEzC,IAAIS,KAAK,GAAGE,KAAK,EAAE;MACfT,kBAAkB,GAAGD,KAAK;MAC1B;;IAEJA,KAAK,EAAE;;EAGX,OAAOC,kBAAkB;AAC7B;MAEaU,wBAAwB,GAAIC,cAAkC;EACvE,IAAI,CAACA,cAAc,EAAE;IACjB,OAAO,IAAI;;EAGf,MAAMC,kBAAkB,GAAG,CACvB,GAAGC,QAAQ,CAACC,gBAAgB,CACxB,iOAAiO,CACpO,CACJ;EACD,MAAMC,mBAAmB,GAAGH,kBAAkB,CAACI,OAAO,CAACL,cAAc,CAAC;;EAGtE,IAAII,mBAAmB,KAAK,CAAC,CAAC,IAAIA,mBAAmB,KAAKH,kBAAkB,CAACK,MAAM,GAAG,CAAC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AO,CAAC;AAC7E;SAEgBE,oBAAoBA,CAACrC,OAAuB;EACxD,IAAI,CAACA,OAAO,EAAE;IACV,OAAO,KAAK;;EAGhB,OACI,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAACsC,QAAQ,CAACtC,OAAO,CAACuC,OAAO,CAAC,IAC3F,CAAEvC,OAAuB,CAACwC,MAAM,IAChC,CAAExC,OAA0F,CAACyC,QAAQ,IACrG,CAAEzC,OAAkD,CAAC0C,QAAQ;AAErE;;;;"}
@@ -1,18 +1,18 @@
1
1
  import React__default from 'react';
2
2
 
3
- const isTruncated = targetElement => {
3
+ const isElementTruncated = targetElement => {
4
4
  if (targetElement !== null) {
5
5
  return targetElement.offsetWidth < targetElement.scrollWidth;
6
6
  }
7
7
  return false;
8
8
  };
9
9
  const useTruncated = (element, deps = []) => {
10
- const [truncated, setTruncated] = React__default.useState(isTruncated(element));
10
+ const [isTruncated, setIsTruncated] = React__default.useState(isElementTruncated(element));
11
11
  React__default.useEffect(() => {
12
- setTruncated(isTruncated(element));
12
+ setIsTruncated(isElementTruncated(element));
13
13
  }, [element, ...deps]);
14
14
  return {
15
- truncated
15
+ isTruncated
16
16
  };
17
17
  };
18
18
 
@@ -1 +1 @@
1
- {"version":3,"file":"useTruncated.js","sources":["../../../../../../../src/utils/hooks/useTruncated.tsx"],"sourcesContent":["import React from 'react';\n\nconst isTruncated = (targetElement: HTMLElement | null) => {\n if (targetElement !== null) {\n return targetElement.offsetWidth < targetElement.scrollWidth;\n }\n\n return false;\n};\n\nexport const useTruncated = (element: HTMLElement | null, deps: any[] = []) => {\n const [truncated, setTruncated] = React.useState<boolean>(isTruncated(element));\n\n React.useEffect(() => {\n setTruncated(isTruncated(element));\n }, [element, ...deps]);\n\n return { truncated };\n};\n"],"names":["isTruncated","targetElement","offsetWidth","scrollWidth","useTruncated","element","deps","truncated","setTruncated","React","useState","useEffect"],"mappings":";;AAEA,MAAMA,WAAW,GAAIC,aAAiC;EAClD,IAAIA,aAAa,KAAK,IAAI,EAAE;IACxB,OAAOA,aAAa,CAACC,WAAW,GAAGD,aAAa,CAACE,WAAW;;EAGhE,OAAO,KAAK;AAChB,CAAC;MAEYC,YAAY,GAAGA,CAACC,OAA2B,EAAEC,OAAc,EAAE;EACtE,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAUV,WAAW,CAACK,OAAO,CAAC,CAAC;EAE/EI,cAAK,CAACE,SAAS,CAAC;IACZH,YAAY,CAACR,WAAW,CAACK,OAAO,CAAC,CAAC;GACrC,EAAE,CAACA,OAAO,EAAE,GAAGC,IAAI,CAAC,CAAC;EAEtB,OAAO;IAAEC;GAAW;AACxB;;;;"}
1
+ {"version":3,"file":"useTruncated.js","sources":["../../../../../../../src/utils/hooks/useTruncated.tsx"],"sourcesContent":["import React from 'react';\n\nconst isElementTruncated = (targetElement: HTMLElement | null) => {\n if (targetElement !== null) {\n return targetElement.offsetWidth < targetElement.scrollWidth;\n }\n\n return false;\n};\n\nexport const useTruncated = (element: HTMLElement | null, deps: any[] = []) => {\n const [isTruncated, setIsTruncated] = React.useState<boolean>(isElementTruncated(element));\n\n React.useEffect(() => {\n setIsTruncated(isElementTruncated(element));\n }, [element, ...deps]);\n\n return { isTruncated };\n};\n"],"names":["isElementTruncated","targetElement","offsetWidth","scrollWidth","useTruncated","element","deps","isTruncated","setIsTruncated","React","useState","useEffect"],"mappings":";;AAEA,MAAMA,kBAAkB,GAAIC,aAAiC;EACzD,IAAIA,aAAa,KAAK,IAAI,EAAE;IACxB,OAAOA,aAAa,CAACC,WAAW,GAAGD,aAAa,CAACE,WAAW;;EAGhE,OAAO,KAAK;AAChB,CAAC;MAEYC,YAAY,GAAGA,CAACC,OAA2B,EAAEC,OAAc,EAAE;EACtE,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAUV,kBAAkB,CAACK,OAAO,CAAC,CAAC;EAE1FI,cAAK,CAACE,SAAS,CAAC;IACZH,cAAc,CAACR,kBAAkB,CAACK,OAAO,CAAC,CAAC;GAC9C,EAAE,CAACA,OAAO,EAAE,GAAGC,IAAI,CAAC,CAAC;EAEtB,OAAO;IAAEC;GAAa;AAC1B;;;;"}
@@ -1,4 +1,4 @@
1
- import { isEventTriggeredOnInteractiveElement } from './dom.js';
1
+ import { isElementInteractive } from './dom.js';
2
2
 
3
3
  function isPressingMetaKey(event) {
4
4
  return isMacOs() ? event.metaKey : event.ctrlKey;
@@ -19,7 +19,7 @@ function shouldTriggerShortcut(event, key) {
19
19
  }
20
20
  function createShortcutKeyDownHandler(key, handler, stopPropagation = true) {
21
21
  return function (event) {
22
- if (event.target !== event.currentTarget && isEventTriggeredOnInteractiveElement(event.target) && !isPressingMetaKey(event)) {
22
+ if (event.target !== event.currentTarget && isElementInteractive(event.target) && !isPressingMetaKey(event)) {
23
23
  return;
24
24
  }
25
25
  const condition = shouldTriggerShortcut(event, key);
@@ -1 +1 @@
1
- {"version":3,"file":"keyboard.js","sources":["../../../../../../src/utils/keyboard.ts"],"sourcesContent":["import React from 'react';\nimport { isEventTriggeredOnInteractiveElement } from './dom';\n\nexport type KeyDownHandlerOptions = { key: string; meta?: boolean; shift?: boolean };\n\nexport function isPressingMetaKey<T = Element>(event: KeyboardEvent | React.KeyboardEvent<T>) {\n return isMacOs() ? event.metaKey : event.ctrlKey;\n}\n\nexport function shouldTriggerShortcut<T = Element>(\n event: KeyboardEvent | React.KeyboardEvent<T>,\n key: string | KeyDownHandlerOptions\n) {\n const keyOptions: KeyDownHandlerOptions = typeof key === 'string' ? { key, meta: false, shift: false } : key;\n\n if (\n (keyOptions.meta && (isMacOs() ? !event.metaKey : !event.ctrlKey)) ||\n (!keyOptions.meta && (isMacOs() ? event.metaKey : event.ctrlKey))\n ) {\n return false;\n }\n\n if ((keyOptions.shift && !event.shiftKey) || (keyOptions.shift === false && event.shiftKey)) {\n return false;\n }\n\n return event.key.toLowerCase() === keyOptions.key.toLowerCase();\n}\n\nexport function createShortcutKeyDownHandler<T = Element>(\n key: string | KeyDownHandlerOptions,\n handler: (event: KeyboardEvent | React.KeyboardEvent<T>) => void,\n stopPropagation = true\n) {\n return function (event: KeyboardEvent | React.KeyboardEvent<T>) {\n if (\n event.target !== event.currentTarget &&\n isEventTriggeredOnInteractiveElement(event.target as HTMLElement) &&\n !isPressingMetaKey(event)\n ) {\n return;\n }\n\n const condition = shouldTriggerShortcut(event, key);\n\n if (condition) {\n if (stopPropagation) {\n // stops react handlers bubbling up to global\n event.stopPropagation();\n // stops global handlers bubbling up to other global\n (event as KeyboardEvent).stopImmediatePropagation?.();\n }\n\n handler(event);\n }\n };\n}\n\nexport const isMacOs = () => window?.navigator.userAgent.includes('Mac');\n"],"names":["isPressingMetaKey","event","isMacOs","metaKey","ctrlKey","shouldTriggerShortcut","key","keyOptions","meta","shift","shiftKey","toLowerCase","createShortcutKeyDownHandler","handler","stopPropagation","target","currentTarget","isEventTriggeredOnInteractiveElement","condition","_event$stopImmediateP","stopImmediatePropagation","call","_window","window","navigator","userAgent","includes"],"mappings":";;SAKgBA,iBAAiBA,CAAcC,KAA6C;EACxF,OAAOC,OAAO,EAAE,GAAGD,KAAK,CAACE,OAAO,GAAGF,KAAK,CAACG,OAAO;AACpD;SAEgBC,qBAAqBA,CACjCJ,KAA6C,EAC7CK,GAAmC;EAEnC,MAAMC,UAAU,GAA0B,OAAOD,GAAG,KAAK,QAAQ,GAAG;IAAEA,GAAG;IAAEE,IAAI,EAAE,KAAK;IAAEC,KAAK,EAAE;GAAO,GAAGH,GAAG;EAE5G,IACKC,UAAU,CAACC,IAAI,KAAKN,OAAO,EAAE,GAAG,CAACD,KAAK,CAACE,OAAO,GAAG,CAACF,KAAK,CAACG,OAAO,CAAC,IAChE,CAACG,UAAU,CAACC,IAAI,KAAKN,OAAO,EAAE,GAAGD,KAAK,CAACE,OAAO,GAAGF,KAAK,CAACG,OAAO,CAAE,EACnE;IACE,OAAO,KAAK;;EAGhB,IAAKG,UAAU,CAACE,KAAK,IAAI,CAACR,KAAK,CAACS,QAAQ,IAAMH,UAAU,CAACE,KAAK,KAAK,KAAK,IAAIR,KAAK,CAACS,QAAS,EAAE;IACzF,OAAO,KAAK;;EAGhB,OAAOT,KAAK,CAACK,GAAG,CAACK,WAAW,EAAE,KAAKJ,UAAU,CAACD,GAAG,CAACK,WAAW,EAAE;AACnE;SAEgBC,4BAA4BA,CACxCN,GAAmC,EACnCO,OAAgE,EAChEC,eAAe,GAAG,IAAI;EAEtB,OAAO,UAAUb,KAA6C;IAC1D,IACIA,KAAK,CAACc,MAAM,KAAKd,KAAK,CAACe,aAAa,IACpCC,oCAAoC,CAAChB,KAAK,CAACc,MAAqB,CAAC,IACjE,CAACf,iBAAiB,CAACC,KAAK,CAAC,EAC3B;MACE;;IAGJ,MAAMiB,SAAS,GAAGb,qBAAqB,CAACJ,KAAK,EAAEK,GAAG,CAAC;IAEnD,IAAIY,SAAS,EAAE;MACX,IAAIJ,eAAe,EAAE;QAAA,IAAAK,qBAAA;;QAEjBlB,KAAK,CAACa,eAAe,EAAE;;QAEtB,CAAAK,qBAAA,GAAAlB,KAAuB,CAACmB,wBAAwB,cAAAD,qBAAA,uBAAhDA,qBAAA,CAAAE,IAAA,CAAApB,MAAoD;;MAGzDY,OAAO,CAACZ,KAAK,CAAC;;GAErB;AACL;MAEaC,OAAO,GAAGA;EAAA,IAAAoB,OAAA;EAAA,QAAAA,OAAA,GAAMC,MAAM,cAAAD,OAAA,uBAANA,OAAA,CAAQE,SAAS,CAACC,SAAS,CAACC,QAAQ,CAAC,KAAK,CAAC;AAAA;;;;"}
1
+ {"version":3,"file":"keyboard.js","sources":["../../../../../../src/utils/keyboard.ts"],"sourcesContent":["import React from 'react';\nimport { isElementInteractive } from './dom';\n\nexport type KeyDownHandlerOptions = { key: string; meta?: boolean; shift?: boolean };\n\nexport function isPressingMetaKey<T = Element>(event: KeyboardEvent | React.KeyboardEvent<T>) {\n return isMacOs() ? event.metaKey : event.ctrlKey;\n}\n\nexport function shouldTriggerShortcut<T = Element>(\n event: KeyboardEvent | React.KeyboardEvent<T>,\n key: string | KeyDownHandlerOptions\n) {\n const keyOptions: KeyDownHandlerOptions = typeof key === 'string' ? { key, meta: false, shift: false } : key;\n\n if (\n (keyOptions.meta && (isMacOs() ? !event.metaKey : !event.ctrlKey)) ||\n (!keyOptions.meta && (isMacOs() ? event.metaKey : event.ctrlKey))\n ) {\n return false;\n }\n\n if ((keyOptions.shift && !event.shiftKey) || (keyOptions.shift === false && event.shiftKey)) {\n return false;\n }\n\n return event.key.toLowerCase() === keyOptions.key.toLowerCase();\n}\n\nexport function createShortcutKeyDownHandler<T = Element>(\n key: string | KeyDownHandlerOptions,\n handler: (event: KeyboardEvent | React.KeyboardEvent<T>) => void,\n stopPropagation = true\n) {\n return function (event: KeyboardEvent | React.KeyboardEvent<T>) {\n if (\n event.target !== event.currentTarget &&\n isElementInteractive(event.target as HTMLElement) &&\n !isPressingMetaKey(event)\n ) {\n return;\n }\n\n const condition = shouldTriggerShortcut(event, key);\n\n if (condition) {\n if (stopPropagation) {\n // stops react handlers bubbling up to global\n event.stopPropagation();\n // stops global handlers bubbling up to other global\n (event as KeyboardEvent).stopImmediatePropagation?.();\n }\n\n handler(event);\n }\n };\n}\n\nexport const isMacOs = () => window?.navigator.userAgent.includes('Mac');\n"],"names":["isPressingMetaKey","event","isMacOs","metaKey","ctrlKey","shouldTriggerShortcut","key","keyOptions","meta","shift","shiftKey","toLowerCase","createShortcutKeyDownHandler","handler","stopPropagation","target","currentTarget","isElementInteractive","condition","_event$stopImmediateP","stopImmediatePropagation","call","_window","window","navigator","userAgent","includes"],"mappings":";;SAKgBA,iBAAiBA,CAAcC,KAA6C;EACxF,OAAOC,OAAO,EAAE,GAAGD,KAAK,CAACE,OAAO,GAAGF,KAAK,CAACG,OAAO;AACpD;SAEgBC,qBAAqBA,CACjCJ,K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,CAAC;;GAErB;AACL;MAEaC,OAAO,GAAGA;EAAA,IAAAoB,OAAA;EAAA,QAAAA,OAAA,GAAMC,MAAM,cAAAD,OAAA,uBAANA,OAAA,CAAQE,SAAS,CAACC,SAAS,CAACC,QAAQ,CAAC,KAAK,CAAC;AAAA;;;;"}
@@ -1 +1,2 @@
1
- export declare const useLocalStorage: <TType>(key?: string | undefined, initialValue?: TType | undefined) => [TType, (value: TType) => void, () => void];
1
+ import React from 'react';
2
+ export declare const useLocalStorage: <TType>(key?: string | undefined, initialValue?: TType | undefined) => [TType, React.Dispatch<React.SetStateAction<TType>>, () => void];
package/dist/index.css CHANGED
@@ -282,51 +282,9 @@
282
282
  @apply font-semibold;
283
283
  }
284
284
 
285
- [data-taco='scrollable-list'].yt-list--multiselect li:first-child {
286
- @apply border-grey-100 border-b-2 pl-4; /* Listbox max-height is dependant on this border-bottom-width value! */
287
- }
288
-
289
- [data-taco='scrollable-list'] li > [data-taco='icon'] {
290
- @apply mr-2;
291
- }
292
-
293
- [data-taco='scrollable-list']:not([readonly]) li:not([disabled]):hover {
294
- @apply wcag-grey-200;
295
- }
296
-
297
- [data-taco='scrollable-list']:not([readonly]) li:not([disabled]):hover [data-taco='icon'] {
298
- @apply wcag-grey-200;
299
- }
300
-
301
- [data-taco='scrollable-list'] li:focus,
302
- [data-taco='scrollable-list']:not(.yt-list--multiselect) li[aria-selected='true'],
303
- [data-taco='scrollable-list'] li[data-focused='true'] {
304
- @apply wcag-blue-500;
305
- }
306
-
307
- [data-taco='scrollable-list'] li:focus [data-taco='icon'],
308
- [data-taco='scrollable-list']:not(.yt-list--multiselect) li[aria-selected='true'] [data-taco='icon'],
309
- [data-taco='scrollable-list'] li[data-focused='true'] [data-taco='icon'] {
310
- @apply wcag-blue-500;
311
- }
312
-
313
- [data-taco='scrollable-list'][readonly] li {
314
- @apply cursor-not-allowed;
315
- }
316
-
317
- [data-taco='scrollable-list'] li[disabled],
318
- [data-taco='scrollable-list'][disabled] li[aria-selected='true'] {
319
- @apply cursor-not-allowed text-black text-opacity-25;
320
- }
321
-
322
- [data-taco='scrollable-list'] li.yt-list__empty,
323
- [data-taco='scrollable-list'] li.yt-list__empty:hover,
324
- [data-taco='scrollable-list'] li.yt-list__empty:focus {
325
- @apply text-grey-700 flex w-full items-center overflow-hidden bg-white px-3 italic;
326
- }
327
-
328
- [data-taco='scrollable-list'] li.yt-list__empty [data-taco='spinner'] {
329
- @apply mr-2 mt-2 h-5 w-5 opacity-75;
285
+ [data-taco='card'] [data-taco='report'],
286
+ [data-taco='card'] [data-taco='table2'] {
287
+ @apply !border-0;
330
288
  }
331
289
 
332
290
  [data-taco='spinner'] svg circle {
@@ -404,6 +362,53 @@
404
362
  stroke: currentColor;
405
363
  }
406
364
 
365
+ [data-taco='scrollable-list'].yt-list--multiselect li:first-child {
366
+ @apply border-grey-100 border-b-2 pl-4; /* Listbox max-height is dependant on this border-bottom-width value! */
367
+ }
368
+
369
+ [data-taco='scrollable-list'] li > [data-taco='icon'] {
370
+ @apply mr-2;
371
+ }
372
+
373
+ [data-taco='scrollable-list']:not([readonly]) li:not([disabled]):hover {
374
+ @apply wcag-grey-200;
375
+ }
376
+
377
+ [data-taco='scrollable-list']:not([readonly]) li:not([disabled]):hover [data-taco='icon'] {
378
+ @apply wcag-grey-200;
379
+ }
380
+
381
+ [data-taco='scrollable-list'] li:focus,
382
+ [data-taco='scrollable-list']:not(.yt-list--multiselect) li[aria-selected='true'],
383
+ [data-taco='scrollable-list'] li[data-focused='true'] {
384
+ @apply wcag-blue-500;
385
+ }
386
+
387
+ [data-taco='scrollable-list'] li:focus [data-taco='icon'],
388
+ [data-taco='scrollable-list']:not(.yt-list--multiselect) li[aria-selected='true'] [data-taco='icon'],
389
+ [data-taco='scrollable-list'] li[data-focused='true'] [data-taco='icon'] {
390
+ @apply wcag-blue-500;
391
+ }
392
+
393
+ [data-taco='scrollable-list'][readonly] li {
394
+ @apply cursor-not-allowed;
395
+ }
396
+
397
+ [data-taco='scrollable-list'] li[disabled],
398
+ [data-taco='scrollable-list'][disabled] li[aria-selected='true'] {
399
+ @apply cursor-not-allowed text-black text-opacity-25;
400
+ }
401
+
402
+ [data-taco='scrollable-list'] li.yt-list__empty,
403
+ [data-taco='scrollable-list'] li.yt-list__empty:hover,
404
+ [data-taco='scrollable-list'] li.yt-list__empty:focus {
405
+ @apply text-grey-700 flex w-full items-center overflow-hidden bg-white px-3 italic;
406
+ }
407
+
408
+ [data-taco='scrollable-list'] li.yt-list__empty [data-taco='spinner'] {
409
+ @apply mr-2 mt-2 h-5 w-5 opacity-75;
410
+ }
411
+
407
412
  [data-taco='combobox'] > [aria-expanded='true'] + [role='dialog'] > ul,
408
413
  [data-taco='combobox'] > [aria-expanded='true'] + [role='dialog'] > ul:hover {
409
414
  @apply border-blue-500;
@@ -574,9 +579,13 @@ table[data-taco='report'] tfoot {
574
579
  /* z-indexes & layout */
575
580
  @apply sticky bottom-0 isolate z-20;
576
581
  /* grid */
577
- @apply col-span-full grid auto-rows-min grid-cols-[subgrid];
582
+ @apply col-span-full grid grid-cols-[subgrid] grid-rows-[calc(theme(spacing.10)_+_2px)];
578
583
  }
579
584
 
585
+ table[data-taco='report'] tfoot > tr {
586
+ @apply grid-rows-[calc(theme(spacing.10)_+_2px)];
587
+ }
588
+
580
589
  table[data-taco='report'] tbody {
581
590
  /* z-indexes & layout */
582
591
  @apply isolate z-10;
@@ -903,88 +912,80 @@ table[data-taco='report'][data-table-font-size='large']
903
912
  }
904
913
 
905
914
  /* row/cell backgrounds -- we have to be specific so that nested tables don't inherit */
906
-
907
915
  /* normal rows */
908
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true']) > td {
909
- @apply bg-white;
910
- }
916
+ table[data-taco='report'] > tbody > tr:not([data-row-selected]) > td {
917
+ @apply bg-white;
918
+ }
919
+ table[data-taco='report'] > tbody > tr:not([data-row-selected]):hover > td,
920
+ table[data-taco='report'] > tbody > tr:not([data-row-selected])[data-row-active] > td,
921
+ table[data-taco='report'] > tbody > tr:not([data-row-selected])[data-row-group] > td {
922
+ --table-row-actions-shadow: theme(colors.grey.100);
923
+ @apply bg-grey-100;
924
+ }
911
925
  /* search highlighting */
912
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true']) > td[data-cell-highlighted='true'] {
913
- @apply bg-[#e9f2ff];
926
+ table[data-taco='report'] > tbody > tr:not([data-row-selected]) > td[data-cell-highlighted='true'] {
927
+ --table-row-actions-shadow: #e9f2ff;
928
+ @apply !bg-[#e9f2ff];
914
929
  }
915
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true']) > td[data-cell-highlighted='current'] {
916
- @apply !bg-[#bfd9ff];
930
+ table[data-taco='report'] > tbody > tr:not([data-row-selected]) > td[data-cell-highlighted='current'] {
931
+ --table-row-actions-shadow: #bdd7fc;
932
+ @apply !bg-[#bdd7fc];
933
+ }
934
+ /* selected rows */
935
+ table[data-taco='report'] > tbody > tr[data-row-selected] > td {
936
+ @apply bg-blue-100;
937
+ }
938
+ table[data-taco='report'] > tbody > tr[data-row-selected]:hover > td,
939
+ table[data-taco='report'] > tbody > tr[data-row-selected][data-row-active] > td,
940
+ table[data-taco='report'] > tbody > tr[data-row-selected][data-row-group] > td {
941
+ --table-row-actions-shadow: #d6e3f6;
942
+ @apply bg-[#d6e3f6];
917
943
  }
918
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true'])[data-row-group] > td {
919
- @apply bg-grey-100;
920
- }
921
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true']):hover > td,
922
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true'])[data-row-active='true'] > td,
923
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true'])[data-row-active='true']:hover > td {
924
- --table-row-actions-shadow: theme(colors.grey.100);
925
- @apply bg-grey-100;
926
- }
927
944
  /* search highlighting */
928
- table[data-taco='report'] > tbody > tr:not([data-row-selected='true']):hover > td[data-cell-highlighted='true'], table[data-taco='report'] > tbody > tr:not([data-row-selected='true'])[data-row-active='true'] > td[data-cell-highlighted='true'], table[data-taco='report'] > tbody > tr:not([data-row-selected='true'])[data-row-active='true']:hover > td[data-cell-highlighted='true'] {
929
- @apply bg-[#e2ebf8];
945
+ table[data-taco='report'] > tbody > tr[data-row-selected] > td[data-cell-highlighted] {
946
+ --table-row-actions-shadow: #b4d2fd;
947
+ @apply !bg-[#b4d2fd];
930
948
  }
931
- /* normal rows when focus is inside the table */
932
- table[data-taco='report']:focus-within > tbody > tr[data-row-active='true']:not([data-row-selected='true']) > td {
933
- --table-row-actions-shadow: theme(colors.grey.200);
934
- @apply !bg-grey-200;
935
- }
936
949
 
937
- /* normal rows when hover is paused */
938
- table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:not([data-row-selected='true']):hover:not([data-row-active='true']) > td {
939
- --table-row-actions-shadow: theme(colors.white);
940
- @apply !bg-white;
941
- }
942
- table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:not([data-row-selected='true']):hover[data-row-active='true'] > td {
943
- --table-row-actions-shadow: theme(colors.grey.200);
944
- @apply !bg-grey-200;
945
- }
950
+ /* normal rows */
951
+
952
+ table[data-taco='report']:focus-within > tbody > tr:not([data-row-selected])[data-row-active] > td {
953
+ --table-row-actions-shadow: theme(colors.grey.200);
954
+ @apply bg-grey-200;
955
+ }
946
956
 
947
957
  /* selected rows */
948
- table[data-taco='report'] > tbody > tr[data-row-selected='true'] > td {
949
- @apply bg-blue-100;
950
- }
951
- /* search highlighting */
952
- table[data-taco='report'] > tbody > tr[data-row-selected='true'] > td[data-cell-highlighted='true'] {
953
- @apply bg-[#d0e4ff];
958
+
959
+ table[data-taco='report']:focus-within > tbody > tr[data-row-selected][data-row-active] > td {
960
+ --table-row-actions-shadow: #ccd8eb;
961
+ @apply bg-[#ccd8eb];
954
962
  }
955
- table[data-taco='report'] > tbody > tr[data-row-selected='true'] > td[data-cell-highlighted='current'] {
956
- @apply !bg-[#b6d4ff];
963
+
964
+ /* normal rows */
965
+
966
+ table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:hover:not([data-row-selected]):not([data-row-active]) > td {
967
+ --table-row-actions-shadow: theme(colors.white);
968
+ @apply bg-white;
957
969
  }
958
- table[data-taco='report'] > tbody > tr[data-row-selected='true']:hover > td,
959
- table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true'] > td,
960
- table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true']:hover > td {
961
- --table-row-actions-shadow: #d6e3f6;
962
- @apply bg-[#D6E3F6];
963
- }
964
- /* search highlighting */
965
- table[data-taco='report'] > tbody > tr[data-row-selected='true']:hover > td[data-cell-highlighted='true'], table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true'] > td[data-cell-highlighted='true'], table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true']:hover > td[data-cell-highlighted='true'] {
966
- @apply bg-[#cadef9];
970
+
971
+ table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:hover:not([data-row-selected])[data-row-active] > td {
972
+ --table-row-actions-shadow: theme(colors.grey.200);
973
+ @apply bg-grey-200;
967
974
  }
968
- table[data-taco='report'] > tbody > tr[data-row-selected='true']:hover > td[data-cell-highlighted='current'], table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true'] > td[data-cell-highlighted='current'], table[data-taco='report'] > tbody > tr[data-row-selected='true'][data-row-active='true']:hover > td[data-cell-highlighted='current'] {
969
- @apply !bg-[#b4d2fd];
975
+
976
+ /* selected rows */
977
+
978
+ table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:hover[data-row-selected]:not([data-row-active]) > td {
979
+ --table-row-actions-shadow: theme(colors.blue.100);
980
+ @apply bg-blue-100;
970
981
  }
971
- /* selected rows when focus is inside the table */
972
- table[data-taco='report']:focus-within > tbody > tr[data-row-active='true'][data-row-selected='true'] > td {
973
- --table-row-actions-shadow: #ccd8eb;
974
- @apply bg-[#CCD8EB];
975
- }
976
- /* selected rows when hover is paused */
977
- table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr[data-row-selected='true']:hover:not([data-row-active='true']) > td {
978
- --table-row-actions-shadow: theme(colors.blue.100);
979
- @apply !bg-blue-100;
980
- }
981
- table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr[data-row-selected='true']:hover[data-row-active='true'] > td {
982
- --table-row-actions-shadow: #ccd8eb;
983
- @apply !bg-[#CCD8EB];
984
- }
985
982
 
986
- /* row metadata */
983
+ table[data-taco='report'][data-table-pause-hover='true'] > tbody > tr:hover[data-row-selected][data-row-active] > td {
984
+ --table-row-actions-shadow: #ccd8eb;
985
+ @apply bg-[#CCD8EB];
986
+ }
987
987
 
988
+ /* row metadata */
988
989
  table[data-taco='report'] tbody tr[data-row-meta-layout='heading']:not([data-row-group='true']) td {
989
990
  @apply !border-b-0 border-t font-bold;
990
991
  }
@@ -1335,7 +1336,7 @@ table[data-taco='report'] [data-cell-id^='__'] {
1335
1336
  }
1336
1337
 
1337
1338
  [data-font-size='small'] [role='cell'] [data-taco='tag'] {
1338
- @apply !-my-1;
1339
+ @apply h-4 min-h-[theme(spacing.4)];
1339
1340
  }
1340
1341
 
1341
1342
  [data-font-size='small'] [role='cell'] [data-taco='Select2'],
@@ -1391,7 +1392,7 @@ table[data-taco='report'] [data-cell-id^='__'] {
1391
1392
  }
1392
1393
 
1393
1394
  /* When cell is editable and highlighted, the padding should apply to highlight wrapper and remove 1px border-width,
1394
- because it should take all the available space in the cell */
1395
+ because it should take all the available space in the cell */
1395
1396
 
1396
1397
  [data-font-size='small'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
1397
1398
  @apply px-[calc(var(--table3-cell-padding-x)_-_6px_-_1px)];
@@ -1414,8 +1415,8 @@ table[data-taco='report'] [data-cell-id^='__'] {
1414
1415
  @apply !-my-0.5;
1415
1416
  }
1416
1417
 
1417
- [data-font-size='medium'] [role='cell'] [data-taco='tag'] {
1418
- @apply !-my-0.5;
1418
+ [data-font-size='medium'] [role='cell'] [data-taco='Select2'] {
1419
+ @apply !px-2;
1419
1420
  }
1420
1421
 
1421
1422
  [data-font-size='medium'] [role='cell'] [data-taco='Select2'],
@@ -1430,7 +1431,7 @@ table[data-taco='report'] [data-cell-id^='__'] {
1430
1431
  }
1431
1432
 
1432
1433
  /* When cell is editable and highlighted, the padding should apply to highlight wrapper and remove 1px border-width,
1433
- because it should take all the available space in the cell */
1434
+ because it should take all the available space in the cell */
1434
1435
 
1435
1436
  [data-font-size='medium'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
1436
1437
  @apply px-[calc(var(--table3-cell-padding-x)_-_8px_-_1px)];
@@ -1460,8 +1461,8 @@ table[data-taco='report'] [data-cell-id^='__'] {
1460
1461
  @apply !-my-0.5;
1461
1462
  }
1462
1463
 
1463
- [data-font-size='large'] [role='cell'] [data-taco='tag'] {
1464
- @apply !-my-0.5;
1464
+ [data-font-size='large'] [role='cell'] [data-taco='Select2'] {
1465
+ @apply !px-2.5;
1465
1466
  }
1466
1467
 
1467
1468
  [data-font-size='large'] [role='cell'] [data-taco='Select2'],
@@ -1502,7 +1503,7 @@ table[data-taco='report'] [data-cell-id^='__'] {
1502
1503
  }
1503
1504
 
1504
1505
  /* When cell is editable and highlighted, the padding should apply to highlight wrapper and remove 1px border-width,
1505
- because it should take all the available space in the cell */
1506
+ because it should take all the available space in the cell */
1506
1507
 
1507
1508
  [data-font-size='large'] [role='cell'][data-editable][data-highlighted='true'] [data-taco='highlight'] {
1508
1509
  @apply px-[calc(var(--table3-cell-padding-x)_-_10px_-_1px)];
@@ -1520,3 +1521,9 @@ table[data-taco='report'] [data-cell-id^='__'] {
1520
1521
  [data-font-size='large'] [role='columnheader'] button {
1521
1522
  @apply !text-sm;
1522
1523
  }
1524
+
1525
+ /* When spinner is rendered in the last cell of the table, it slightly pushes the edge of the table(while rotating),
1526
+ and making horisontal scroll bar jump */
1527
+ [data-editing='true'] [role='cell']:last-child [data-taco='spinner'] {
1528
+ overflow: hidden;
1529
+ }
package/dist/index.d.ts CHANGED
@@ -55,6 +55,7 @@ export * from './components/Header/Header';
55
55
  export * from './components/Layout/Layout';
56
56
  export * from './components/Navigation2/Navigation2';
57
57
  export * as CollectionPrimitive from './primitives/Collection/Collection';
58
+ export * from './primitives/Table/useTableDataLoader';
58
59
  export * from './utils/date';
59
60
  export * from './utils/keyboard';
60
61
  export * from './utils/mergeRefs';
@@ -100,10 +100,20 @@ export declare type TableSettings = {
100
100
  fontSize?: TableFontSize;
101
101
  grouping?: ReactTableGroupingState;
102
102
  rowHeight?: TableRowHeight;
103
- showWarningWhenPrintingLargeDataset?: boolean;
104
103
  searchQuery?: string;
105
104
  sorting?: ReactTableSortingState;
106
105
  };
106
+ export declare type EnableSettingsOptions = {
107
+ columnOrder: boolean;
108
+ columnPinning: boolean;
109
+ columnSizing: boolean;
110
+ columnVisibility: boolean;
111
+ excludeUnmatchedRecordsInSearch: boolean;
112
+ fontSize: boolean;
113
+ grouping: boolean;
114
+ rowHeight: boolean;
115
+ sorting: boolean;
116
+ };
107
117
  export declare type TableFeatureProps = {
108
118
  enableFiltering?: boolean;
109
119
  enableSearch?: boolean;
@@ -123,7 +133,7 @@ export declare type TableFeatureProps = {
123
133
  enableRowClick?: boolean;
124
134
  enableRowGoto?: boolean;
125
135
  enableRowHeight?: boolean;
126
- enableSettings?: boolean;
136
+ enableSaveSettings?: boolean | Partial<EnableSettingsOptions>;
127
137
  };
128
138
  export declare type useTableInternalColumn<TType = unknown> = {
129
139
  header?: (info: ReactTableHeaderContext<TType, unknown>) => JSX.Element | string | null;
@@ -1,8 +1,15 @@
1
1
  import React from 'react';
2
- export declare function useTablePrinting(isEnabled?: boolean, defaultIsWarningVisible?: boolean): {
2
+ declare type TablePrintSettings = {
3
+ allRows: boolean;
4
+ orientation: 'portrait' | 'landscape';
5
+ size: 'A3' | 'A4' | 'A5' | 'letter' | 'legal';
6
+ splitGroups: boolean;
7
+ };
8
+ export declare function useTablePrinting(isEnabled: boolean | undefined, tableId: string): {
3
9
  isEnabled: boolean;
4
10
  isPrinting: boolean;
5
11
  setIsPrinting: React.Dispatch<React.SetStateAction<boolean>>;
6
- isWarningVisibleForLargeDatasets: boolean;
7
- setIsWarningVisibleForLargeDatasets: React.Dispatch<React.SetStateAction<boolean>>;
12
+ settings: TablePrintSettings;
13
+ setSetting: (key: "allRows" | "orientation" | "size" | "splitGroups", value: any) => void;
8
14
  };
15
+ export {};
@@ -1,3 +1,3 @@
1
- import { TableSettings, TableSettingsHandler } from '../../types';
1
+ import { EnableSettingsOptions, TableSettings, TableSettingsHandler } from '../../types';
2
2
  export declare function useUniqueTableId(tableId: string): string;
3
- export declare function useTableSettings(isEnabled: boolean | undefined, id: string, defaultSettings: TableSettings | undefined, onChangeSettings: TableSettingsHandler | undefined): [TableSettings, TableSettingsHandler];
3
+ export declare function useTableSettings(isEnabled: boolean | Partial<EnableSettingsOptions> | undefined, id: string, defaultSettings: TableSettings | undefined, onChangeSettings: TableSettingsHandler | undefined): [TableSettings, TableSettingsHandler];
@@ -22,6 +22,7 @@ declare module '@tanstack/table-core' {
22
22
  columnOrdering: ReturnType<typeof useTableColumnOrdering>;
23
23
  fontSize: ReturnType<typeof useTableFontSize>;
24
24
  footer: ReturnType<typeof useTableFooter>;
25
+ length: number;
25
26
  printing: ReturnType<typeof useTablePrinting>;
26
27
  rowActions: ReturnType<typeof useTableRowActions>;
27
28
  rowActive: ReturnType<typeof useTableRowActive>;
@@ -50,8 +51,8 @@ declare module '@tanstack/table-core' {
50
51
  }
51
52
  }
52
53
  export declare function useTable<TType = unknown, TMeta = {}>(props: useTableProps<TType>, ref: React.RefObject<TableRef>, meta?: Partial<ReactTableMeta<TType>> & TMeta, internalColumns?: useTableInternalColumns<TType>): {
54
+ id: string;
53
55
  instance: import("@tanstack/react-table").Table<TType>;
54
- length: number;
55
56
  meta: ReactTableMeta<TType> & TMeta;
56
57
  state: import("@tanstack/react-table").TableState;
57
58
  };
@@ -8,6 +8,5 @@ export declare function getSettings<TType = unknown>(table: ReactTable<TType>):
8
8
  fontSize: "small" | "medium" | "large" | undefined;
9
9
  grouping: import("@tanstack/react-table").GroupingState | undefined;
10
10
  rowHeight: "medium" | "short" | "tall" | "extra-tall" | undefined;
11
- showWarningWhenPrintingLargeDataset: boolean;
12
11
  sorting: import("@tanstack/react-table").SortingState;
13
12
  };