@economic/taco 2.46.5 → 2.46.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. package/dist/charts/components/Area/AreaChart.d.ts +19 -0
  2. package/dist/charts/components/Bar/BarChart.d.ts +20 -0
  3. package/dist/charts/components/Donut/ActiveShape.d.ts +8 -0
  4. package/dist/charts/components/Donut/CenteredLabel.d.ts +11 -0
  5. package/dist/charts/components/Donut/DonutChart.d.ts +21 -0
  6. package/dist/charts/components/Donut/Legend.d.ts +13 -0
  7. package/dist/charts/components/Donut/util.d.ts +2 -0
  8. package/dist/charts/components/Legend.d.ts +16 -0
  9. package/dist/charts/components/Line/LineChart.d.ts +18 -0
  10. package/dist/charts/components/ResponsiveContainer.d.ts +5 -0
  11. package/dist/charts/components/Tooltip.d.ts +10 -0
  12. package/dist/charts/components/types.d.ts +5 -0
  13. package/dist/charts/utils/color.d.ts +3 -0
  14. package/dist/charts/utils/common.d.ts +37 -0
  15. package/dist/components/RadioGroup/RadioGroup.d.ts +2 -2
  16. package/dist/components/Table3/features/useEditingState.d.ts +1 -1
  17. package/dist/components/Table3/features/useTableEditing.d.ts +4 -3
  18. package/dist/esm/index.css +18 -0
  19. package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js +67 -0
  20. package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js.map +1 -0
  21. package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js +120 -0
  22. package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js.map +1 -0
  23. package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js +47 -0
  24. package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js.map +1 -0
  25. package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js +27 -0
  26. package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js.map +1 -0
  27. package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js +170 -0
  28. package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js.map +1 -0
  29. package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js +164 -0
  30. package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js.map +1 -0
  31. package/dist/esm/packages/taco/src/charts/components/Donut/util.js +5 -0
  32. package/dist/esm/packages/taco/src/charts/components/Donut/util.js.map +1 -0
  33. package/dist/esm/packages/taco/src/charts/components/Legend.js +145 -0
  34. package/dist/esm/packages/taco/src/charts/components/Legend.js.map +1 -0
  35. package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js +65 -0
  36. package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js.map +1 -0
  37. package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js +10 -0
  38. package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js.map +1 -0
  39. package/dist/esm/packages/taco/src/charts/components/Tooltip.js +44 -0
  40. package/dist/esm/packages/taco/src/charts/components/Tooltip.js.map +1 -0
  41. package/dist/esm/packages/taco/src/charts/utils/color.js +24 -0
  42. package/dist/esm/packages/taco/src/charts/utils/color.js.map +1 -0
  43. package/dist/esm/packages/taco/src/charts/utils/common.js +34 -0
  44. package/dist/esm/packages/taco/src/charts/utils/common.js.map +1 -0
  45. package/dist/esm/packages/taco/src/components/Input/util.js +1 -1
  46. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  47. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Table3/Table3.js +0 -1
  49. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +4 -33
  51. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +1 -1
  53. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +4 -4
  55. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +32 -1
  57. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +2 -2
  59. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Table3/useTable3.js +4 -1
  61. package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
  62. package/dist/esm/packages/taco/src/index.js +4 -0
  63. package/dist/esm/packages/taco/src/index.js.map +1 -1
  64. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +5 -4
  65. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  66. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js +6 -0
  67. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js.map +1 -1
  68. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +2 -2
  69. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
  70. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js +7 -0
  71. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js.map +1 -1
  72. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js +7 -0
  73. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
  74. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +2 -1
  75. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  76. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js +3 -1
  77. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js.map +1 -1
  78. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/RowContext.js +3 -2
  79. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/RowContext.js.map +1 -1
  80. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +5 -1
  81. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  82. package/dist/esm/packages/taco/src/utils/colors.js +122 -0
  83. package/dist/esm/packages/taco/src/utils/colors.js.map +1 -0
  84. package/dist/index.css +18 -0
  85. package/dist/index.d.ts +5 -0
  86. package/dist/primitives/Table/Core/components/Body/EmptyStateBody.d.ts +1 -0
  87. package/dist/primitives/Table/Core/components/Row/RowContext.d.ts +2 -1
  88. package/dist/primitives/Table/Core/types.d.ts +1 -0
  89. package/dist/taco.cjs.development.js +881 -55
  90. package/dist/taco.cjs.development.js.map +1 -1
  91. package/dist/taco.cjs.production.min.js +1 -1
  92. package/dist/taco.cjs.production.min.js.map +1 -1
  93. package/package.json +3 -3
  94. package/tailwind.config.js +3 -2
@@ -2,6 +2,7 @@ import React__default from 'react';
2
2
  import cn from 'clsx';
3
3
  import { Icon } from '../../../../../../components/Icon/Icon.js';
4
4
  import { useLocalization } from '../../../../../../components/Provider/Localization.js';
5
+ import { RowContext } from '../../Row/RowContext.js';
5
6
 
6
7
  function Header() {
7
8
  return null;
@@ -10,6 +11,12 @@ function Cell() {
10
11
  const {
11
12
  texts
12
13
  } = useLocalization();
14
+ const {
15
+ hideInternalColumns
16
+ } = React__default.useContext(RowContext);
17
+ if (hideInternalColumns) {
18
+ return null;
19
+ }
13
20
  return /*#__PURE__*/React__default.createElement(Icon, {
14
21
  "aria-label": texts.table.columns.drag.tooltip,
15
22
  name: "drag",
@@ -1 +1 @@
1
- {"version":3,"file":"Drag.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Drag.tsx"],"sourcesContent":["import React from 'react';\nimport clsx from 'clsx';\n\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\nimport { Icon } from '../../../../../../components/Icon/Icon';\n\nfunction Header() {\n return null;\n}\n\nfunction Cell() {\n const { texts } = useLocalization();\n\n return (\n <Icon\n aria-label={texts.table.columns.drag.tooltip}\n name=\"drag\"\n className={clsx(\n \"text-grey-darkest invisible -mt-1 ml-[2px] cursor-grab active:cursor-grabbing group-hover/row:visible group-[[aria-grabbed='true']]/row:text-white\",\n '[[data-table-editing-mode]_&]:!invisible'\n )}\n />\n );\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 20,\n meta: {\n align: 'center',\n className: '!px-0 !pb-0 justify-end',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!p-0',\n },\n};\n"],"names":["Header","Cell","texts","useLocalization","React","Icon","table","columns","drag","tooltip","name","className","clsx","renderer","header","size","meta","align","enableSearch","headerClassName"],"mappings":";;;;;AAOA,SAASA,MAAMA;EACX,OAAO,IAAI;AACf;AAEA,SAASC,IAAIA;EACT,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAEnC,oBACIC,6BAACC,IAAI;kBACWH,KAAK,CAACI,KAAK,CAACC,OAAO,CAACC,IAAI,CAACC,OAAO;IAC5CC,IAAI,EAAC,MAAM;IACXC,SAAS,EAAEC,EAAI,CACX,oJAAoJ,EACpJ,0CAA0C;IAEhD;AAEV;MAEaC,QAAQ,GAAkC;EACnDC,MAAM,EAAEd,MAAM;EACda,QAAQ,EAAEZ,IAAI;EACdc,IAAI,EAAE,EAAE;EACRC,IAAI,EAAE;IACFC,KAAK,EAAE,QAAQ;IACfN,SAAS,EAAE,yBAAyB;;IAEpCO,YAAY,EAAE,KAAK;IACnBJ,MAAM,EAAE,EAAE;IACVK,eAAe,EAAE;;;;;;"}
1
+ {"version":3,"file":"Drag.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Drag.tsx"],"sourcesContent":["import React from 'react';\nimport clsx from 'clsx';\n\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\nimport { Icon } from '../../../../../../components/Icon/Icon';\nimport { RowContext } from '../../Row/RowContext';\n\nfunction Header() {\n return null;\n}\n\nfunction Cell() {\n const { texts } = useLocalization();\n const { hideInternalColumns } = React.useContext(RowContext);\n\n if (hideInternalColumns) {\n return null;\n }\n\n return (\n <Icon\n aria-label={texts.table.columns.drag.tooltip}\n name=\"drag\"\n className={clsx(\n \"text-grey-darkest invisible -mt-1 ml-[2px] cursor-grab active:cursor-grabbing group-hover/row:visible group-[[aria-grabbed='true']]/row:text-white\",\n '[[data-table-editing-mode]_&]:!invisible'\n )}\n />\n );\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 20,\n meta: {\n align: 'center',\n className: '!px-0 !pb-0 justify-end',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!p-0',\n },\n};\n"],"names":["Header","Cell","texts","useLocalization","hideInternalColumns","React","useContext","RowContext","Icon","table","columns","drag","tooltip","name","className","clsx","renderer","header","size","meta","align","enableSearch","headerClassName"],"mappings":";;;;;;AAQA,SAASA,MAAMA;EACX,OAAO,IAAI;AACf;AAEA,SAASC,IAAIA;EACT,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAqB,GAAGC,cAAK,CAACC,UAAU,CAACC,UAAU,CAAC;EAE5D,IAAIH,mBAAmB,EAAE;IACrB,OAAO,IAAI;;EAGf,oBACIC,6BAACG,IAAI;kBACWN,KAAK,CAACO,KAAK,CAACC,OAAO,CAACC,IAAI,CAACC,OAAO;IAC5CC,IAAI,EAAC,MAAM;IACXC,SAAS,EAAEC,EAAI,CACX,oJAAoJ,EACpJ,0CAA0C;IAEhD;AAEV;MAEaC,QAAQ,GAAkC;EACnDC,MAAM,EAAEjB,MAAM;EACdgB,QAAQ,EAAEf,IAAI;EACdiB,IAAI,EAAE,EAAE;EACRC,IAAI,EAAE;IACFC,KAAK,EAAE,QAAQ;IACfN,SAAS,EAAE,yBAAyB;;IAEpCO,YAAY,EAAE,KAAK;IACnBJ,MAAM,EAAE,EAAE;IACVK,eAAe,EAAE;;;;;;"}
@@ -2,6 +2,7 @@ import React__default from 'react';
2
2
  import { Tooltip } from '../../../../../../components/Tooltip/Tooltip.js';
3
3
  import { IconButton } from '../../../../../../components/IconButton/IconButton.js';
4
4
  import { useLocalization } from '../../../../../../components/Provider/Localization.js';
5
+ import { RowContext } from '../../Row/RowContext.js';
5
6
 
6
7
  function Header(context) {
7
8
  const {
@@ -31,7 +32,13 @@ function Cell(context) {
31
32
  const {
32
33
  texts
33
34
  } = useLocalization();
35
+ const {
36
+ hideInternalColumns
37
+ } = React__default.useContext(RowContext);
34
38
  const tableMeta = context.table.options.meta;
39
+ if (hideInternalColumns) {
40
+ return null;
41
+ }
35
42
  const hasExpandedRow = (_tableMeta$rowExpansi = (_tableMeta$rowExpansi2 = tableMeta.rowExpansion).rowExpansionRenderer) === null || _tableMeta$rowExpansi === void 0 ? void 0 : _tableMeta$rowExpansi.call(_tableMeta$rowExpansi2, context.row.original);
36
43
  if (hasExpandedRow) {
37
44
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;
@@ -1 +1 @@
1
- {"version":3,"file":"Expansion.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Expansion.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n} from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { IconButton } from '../../../../../../components/IconButton/IconButton';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n\n const isSomeRowsExpanded = table.getIsSomeRowsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n table.toggleAllRowsExpanded(!isSomeRowsExpanded);\n };\n\n const title = isSomeRowsExpanded ? texts.table.columns.expansion.collapseAll : texts.table.columns.expansion.expandAll;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"transparent\"\n icon={isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={handleClick}\n tabIndex={-1}\n title={title}\n />\n </Tooltip>\n );\n}\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const tableMeta = context.table.options.meta as ReactTableMeta<TType>;\n\n const hasExpandedRow = tableMeta.rowExpansion.rowExpansionRenderer?.(context.row.original);\n\n if (hasExpandedRow) {\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;\n const isExpanded = context.row.getIsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n context.row.toggleExpanded();\n };\n\n const title = isExpanded ? texts.table.columns.expansion.collapse : texts.table.columns.expansion.expand;\n const tabIndex = isActiveRow ? 0 : -1;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"discrete\"\n icon={isExpanded ? 'chevron-down' : 'chevron-right'}\n onClick={handleClick}\n tabIndex={tabIndex}\n title={title}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!p-0',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","isSomeRowsExpanded","getIsSomeRowsExpanded","handleClick","event","stopPropagation","toggleAllRowsExpanded","title","columns","expansion","collapseAll","expandAll","React","Tooltip","IconButton","appearance","icon","onClick","tabIndex","Cell","tableMeta","options","meta","hasExpandedRow","_tableMeta$rowExpansi","_tableMeta$rowExpansi2","rowExpansion","rowExpansionRenderer","call","row","original","isActiveRow","rowActive","rowActiveIndex","index","isExpanded","getIsExpanded","toggleExpanded","collapse","expand","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;AAWA,SAASA,MAAMA,CAAkBC,OAAgD;EAC7E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EAEzB,MAAMI,kBAAkB,GAAGD,KAAK,CAACE,qBAAqB,EAAE;EAExD,MAAMC,WAAW,GAAGC,KAAK;IACrBA,KAAK,CAACC,eAAe,EAAE;IACvBL,KAAK,CAACM,qBAAqB,CAAC,CAACL,kBAAkB,CAAC;GACnD;EAED,MAAMM,KAAK,GAAGN,kBAAkB,GAAGH,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAACC,WAAW,GAAGZ,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAACE,SAAS;EAEtH,oBACIC,6BAACC,OAAO;IAACN,KAAK,EAAEA;kBACZK,6BAACE,UAAU;IACPC,UAAU,EAAC,aAAa;IACxBC,IAAI,EAAEf,kBAAkB,GAAG,qBAAqB,GAAG,sBAAsB;IACzEgB,OAAO,EAAEd,WAAW;IACpBe,QAAQ,EAAE,CAAC,CAAC;IACZX,KAAK,EAAEA;IACT,CACI;AAElB;AAEA,SAASY,IAAIA,CAAkBtB,OAA8C;;EACzE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMqB,SAAS,GAAGvB,OAAO,CAACG,KAAK,CAACqB,OAAO,CAACC,IAA6B;EAErE,MAAMC,cAAc,IAAAC,qBAAA,GAAG,CAAAC,sBAAA,GAAAL,SAAS,CAACM,YAAY,EAACC,oBAAoB,cAAAH,qBAAA,uBAA3CA,qBAAA,CAAAI,IAAA,CAAAH,sBAAA,EAA8C5B,OAAO,CAACgC,GAAG,CAACC,QAAQ,CAAC;EAE1F,IAAIP,cAAc,EAAE;IAChB,MAAMQ,WAAW,GAAGX,SAAS,CAACY,SAAS,CAACC,cAAc,KAAKpC,OAAO,CAACgC,GAAG,CAACK,KAAK;IAC5E,MAAMC,UAAU,GAAGtC,OAAO,CAACgC,GAAG,CAACO,aAAa,EAAE;IAE9C,MAAMjC,WAAW,GAAGC,KAAK;MACrBA,KAAK,CAACC,eAAe,EAAE;MACvBR,OAAO,CAACgC,GAAG,CAACQ,cAAc,EAAE;KAC/B;IAED,MAAM9B,KAAK,GAAG4B,UAAU,GAAGrC,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAAC6B,QAAQ,GAAGxC,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAAC8B,MAAM;IACxG,MAAMrB,QAAQ,GAAGa,WAAW,GAAG,CAAC,GAAG,CAAC,CAAC;IAErC,oBACInB,6BAACC,OAAO;MAACN,KAAK,EAAEA;oBACZK,6BAACE,UAAU;MACPC,UAAU,EAAC,UAAU;MACrBC,IAAI,EAAEmB,UAAU,GAAG,cAAc,GAAG,eAAe;MACnDlB,OAAO,EAAEd,WAAW;MACpBe,QAAQ,EAAEA,QAAQ;MAClBX,KAAK,EAAEA;MACT,CACI;;EAIlB,OAAO,IAAI;AACf;MAEaiC,QAAQ,GAAkC;EACnDC,MAAM,EAAE7C,MAAM;EACd4C,QAAQ,EAAErB,IAAI;EACduB,IAAI,EAAE,EAAE;EACRpB,IAAI,EAAE;IACFqB,KAAK,EAAE,QAAQ;;IAEfC,YAAY,EAAE,KAAK;IACnBH,MAAM,EAAE,EAAE;IACVI,eAAe,EAAE;;;;;;"}
1
+ {"version":3,"file":"Expansion.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Expansion.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n} from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { IconButton } from '../../../../../../components/IconButton/IconButton';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\nimport { RowContext } from '../../Row/RowContext';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n\n const isSomeRowsExpanded = table.getIsSomeRowsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n table.toggleAllRowsExpanded(!isSomeRowsExpanded);\n };\n\n const title = isSomeRowsExpanded ? texts.table.columns.expansion.collapseAll : texts.table.columns.expansion.expandAll;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"transparent\"\n icon={isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={handleClick}\n tabIndex={-1}\n title={title}\n />\n </Tooltip>\n );\n}\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { hideInternalColumns } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as ReactTableMeta<TType>;\n\n if (hideInternalColumns) {\n return null;\n }\n\n const hasExpandedRow = tableMeta.rowExpansion.rowExpansionRenderer?.(context.row.original);\n\n if (hasExpandedRow) {\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;\n const isExpanded = context.row.getIsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n context.row.toggleExpanded();\n };\n\n const title = isExpanded ? texts.table.columns.expansion.collapse : texts.table.columns.expansion.expand;\n const tabIndex = isActiveRow ? 0 : -1;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"discrete\"\n icon={isExpanded ? 'chevron-down' : 'chevron-right'}\n onClick={handleClick}\n tabIndex={tabIndex}\n title={title}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!p-0',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","isSomeRowsExpanded","getIsSomeRowsExpanded","handleClick","event","stopPropagation","toggleAllRowsExpanded","title","columns","expansion","collapseAll","expandAll","React","Tooltip","IconButton","appearance","icon","onClick","tabIndex","Cell","hideInternalColumns","useContext","RowContext","tableMeta","options","meta","hasExpandedRow","_tableMeta$rowExpansi","_tableMeta$rowExpansi2","rowExpansion","rowExpansionRenderer","call","row","original","isActiveRow","rowActive","rowActiveIndex","index","isExpanded","getIsExpanded","toggleExpanded","collapse","expand","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;;AAYA,SAASA,MAAMA,CAAkBC,OAAgD;EAC7E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EAEzB,MAAMI,kBAAkB,GAAGD,KAAK,CAACE,qBAAqB,EAAE;EAExD,MAAMC,WAAW,GAAGC,KAAK;IACrBA,KAAK,CAACC,eAAe,EAAE;IACvBL,KAAK,CAACM,qBAAqB,CAAC,CAACL,kBAAkB,CAAC;GACnD;EAED,MAAMM,KAAK,GAAGN,kBAAkB,GAAGH,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAACC,WAAW,GAAGZ,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAACE,SAAS;EAEtH,oBACIC,6BAACC,OAAO;IAACN,KAAK,EAAEA;kBACZK,6BAACE,UAAU;IACPC,UAAU,EAAC,aAAa;IACxBC,IAAI,EAAEf,kBAAkB,GAAG,qBAAqB,GAAG,sBAAsB;IACzEgB,OAAO,EAAEd,WAAW;IACpBe,QAAQ,EAAE,CAAC,CAAC;IACZX,KAAK,EAAEA;IACT,CACI;AAElB;AAEA,SAASY,IAAIA,CAAkBtB,OAA8C;;EACzE,MAAM;I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,GAAkC;EACnDC,MAAM,EAAEhD,MAAM;EACd+C,QAAQ,EAAExB,IAAI;EACd0B,IAAI,EAAE,EAAE;EACRpB,IAAI,EAAE;IACFqB,KAAK,EAAE,QAAQ;;IAEfC,YAAY,EAAE,KAAK;IACnBH,MAAM,EAAE,EAAE;IACVI,eAAe,EAAE;;;;;;"}
@@ -60,10 +60,11 @@ function Cell(context) {
60
60
  table
61
61
  } = context;
62
62
  const {
63
+ hideInternalColumns,
63
64
  rowIndex
64
65
  } = React__default.useContext(RowContext);
65
66
  const tableMeta = table.options.meta;
66
- if (table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
67
+ if (hideInternalColumns || table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
67
68
  return null;
68
69
  }
69
70
  const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();
@@ -1 +1 @@
1
- {"version":3,"file":"Selection.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n RowSelectionState,\n} from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { Checkbox } from '../../../../../../components/Checkbox/Checkbox';\nimport { Shortcut } from '../../../../../../components/Shortcut/Shortcut';\nimport { TableServerLoadAllState } from '../../../../types';\nimport { RowContext } from '../../Row/RowContext';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const isAllRowsSelected = table.getIsAllRowsSelected();\n const isSomeRowsSelected = table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table.columns.select.deselectAll : texts.table.columns.select.selectAll;\n\n const handleChange = async (checked: boolean) => {\n // load all data if that is possible\n if (tableMeta.server.loadAllIfNeeded) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters);\n }\n\n table.toggleAllRowsSelected(checked);\n };\n\n return (\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !-mt-px\"\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected && !isAllRowsSelected}\n loading={tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading}\n onChange={handleChange}\n />\n </Tooltip>\n );\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { row, table } = context;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableGrouping && table.getState().grouping?.length && !row.getIsGrouped()) {\n return null;\n }\n\n const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();\n const canSelect = row.getCanSelect();\n const title = isSelected ? texts.table.columns.select.deselect : texts.table.columns.select.select;\n\n const handleClick = async (event: React.MouseEvent) => {\n event.stopPropagation();\n\n if (row.getIsGrouped()) {\n row.subRows.forEach(row => row.toggleSelected());\n } else if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0, rowIndex);\n const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);\n\n if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters);\n }\n\n table.setRowSelection((currentRowSelection: RowSelectionState) => ({\n ...currentRowSelection,\n ...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({ ...state, [row.id]: true }), {}),\n }));\n } else {\n row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <Tooltip\n hidden={!canSelect}\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n disabled={!canSelect}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n />\n </Tooltip>\n );\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n className: '!px-1',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!px-1',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","columns","select","deselectAll","selectAll","handleChange","checked","toggleAllRowsSelected","_temp","server","loadAllIfNeeded","Promise","resolve","getState","sorting","columnFilters","then","_temp2","e","reject","React","Tooltip","Checkbox","className","indeterminate","loading","loadAllStatus","TableServerLoadAllState","Loading","onChange","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","row","rowIndex","useContext","RowContext","enableGrouping","_table$getState$group","grouping","length","getIsGrouped","isSelected","getIsAllSubRowsSelected","getIsSelected","canSelect","getCanSelect","deselect","handleClick","event","rowSelection","lastSelectedRowIndex","current","index","stopPropagation","_temp6","subRows","forEach","toggleSelected","_temp5","shiftKey","_tableMeta$rowSelecti","_temp4","setRowSelection","currentRowSelection","selectedRows","filter","reduce","state","id","getRowModel","rows","slice","_temp3","some","original","undefined","_temp7","hidden","Shortcut","keys","onClick","disabled","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;;;;AAeA,SAASA,MAAMA,CAAkBC,OAAgD;EAC7E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EACzB,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,MAAMC,iBAAiB,GAAGJ,KAAK,CAACK,oBAAoB,EAAE;EACtD,MAAMC,kBAAkB,GAAGN,KAAK,CAACO,qBAAqB,EAAE;EACxD,MAAMC,KAAK,GAAGJ,iBAAiB,GAAGN,KAAK,CAACE,KAAK,CAACS,OAAO,CAACC,MAAM,CAACC,WAAW,GAAGb,KAAK,CAACE,KAAK,CAACS,OAAO,CAACC,MAAM,CAACE,SAAS;EAE/G,MAAMC,YAAY,aAAUC,OAAgB;IAAA;;QAOxCd,KAAK,CAACe,qBAAqB,CAACD,OAAO,CAAC;;MAAC,MAAAE,KAAA;QAAA,IALjCf,SAAS,CAACgB,MAAM,CAACC,eAAe;;UAChC,OAAAC,OAAA,CAAAC,OAAA,CACMnB,SAAS,CAACgB,MAAM,CAACC,eAAe,CAAClB,KAAK,CAACqB,QAAQ,EAAE,CAACC,OAAO,EAAEtB,KAAK,CAACqB,QAAQ,EAAE,CAACE,aAAa,CAAC,EAAAC,IAAA;;;;MAHpG,OAAAL,OAAA,CAAAC,OAAA,CAAAJ,KAAA,IAAAA,KAAA,CAAAQ,IAAA,GAAAR,KAAA,CAAAQ,IAAA,CAAAC,MAAA,IAAAA,MAAA,CAAAT,KAAA;KAOH,QAAAU,CAAA;MAAA,OAAAP,OAAA,CAAAQ,MAAA,CAAAD,CAAA;;;EAED,oBACIE,6BAACC,OAAO;IAACrB,KAAK,EAAEA;kBACZoB,6BAACE,QAAQ;kBACOtB,KAAK;IACjBuB,SAAS,EAAC,2BAA2B;IACrCjB,OAAO,EA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AAE;IACVI,eAAe,EAAE;;;;;;"}
1
+ {"version":3,"file":"Selection.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n RowSelectionState,\n} from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { Checkbox } from '../../../../../../components/Checkbox/Checkbox';\nimport { Shortcut } from '../../../../../../components/Shortcut/Shortcut';\nimport { TableServerLoadAllState } from '../../../../types';\nimport { RowContext } from '../../Row/RowContext';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const isAllRowsSelected = table.getIsAllRowsSelected();\n const isSomeRowsSelected = table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table.columns.select.deselectAll : texts.table.columns.select.selectAll;\n\n const handleChange = async (checked: boolean) => {\n // load all data if that is possible\n if (tableMeta.server.loadAllIfNeeded) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters);\n }\n\n table.toggleAllRowsSelected(checked);\n };\n\n return (\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !-mt-px\"\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected && !isAllRowsSelected}\n loading={tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading}\n onChange={handleChange}\n />\n </Tooltip>\n );\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { row, table } = context;\n const { hideInternalColumns, rowIndex } = React.useContext(RowContext);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (hideInternalColumns || (table.options.enableGrouping && table.getState().grouping?.length && !row.getIsGrouped())) {\n return null;\n }\n\n const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();\n const canSelect = row.getCanSelect();\n const title = isSelected ? texts.table.columns.select.deselect : texts.table.columns.select.select;\n\n const handleClick = async (event: React.MouseEvent) => {\n event.stopPropagation();\n\n if (row.getIsGrouped()) {\n row.subRows.forEach(row => row.toggleSelected());\n } else if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0, rowIndex);\n const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);\n\n if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters);\n }\n\n table.setRowSelection((currentRowSelection: RowSelectionState) => ({\n ...currentRowSelection,\n ...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({ ...state, [row.id]: true }), {}),\n }));\n } else {\n row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <Tooltip\n hidden={!canSelect}\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n disabled={!canSelect}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n />\n </Tooltip>\n );\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n className: '!px-1',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!px-1',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","columns","select","deselectAll","selectAll","handleChange","checked","toggleAllRowsSelected","_temp","server","loadAllIfNeeded","Promise","resolve","getState","sorting","columnFilters","then","_temp2","e","reject","React","Tooltip","Checkbox","className","indeterminate","loading","loadAllStatus","TableServerLoadAllState","Loading","onChange","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","row","hideInternalColumns","rowIndex","useContext","RowContext","enableGrouping","_table$getState$group","grouping","length","getIsGrouped","isSelected","getIsAllSubRowsSelected","getIsSelected","canSelect","getCanSelect","deselect","handleClick","event","rowSelection","lastSelectedRowIndex","current","index","stopPropagation","_temp6","subRows","forEach","toggleSelected","_temp5","shiftKey","_tableMeta$rowSelecti","_temp4","setRowSelection","currentRowSelection","selectedRows","filter","reduce","state","id","getRowModel","rows","slice","_temp3","some","original","undefined","_temp7","hidden","Shortcut","keys","onClick","disabled","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;;;;AAeA,SAASA,MAAMA,CAAkBC,OAAgD;EAC7E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EACzB,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,MAAMC,iBAAiB,GAAGJ,KAAK,CAACK,oBAAoB,EAAE;EACtD,MAAMC,kBAAkB,GAAGN,KAAK,CAACO,qBAAqB,EAAE;EACxD,MAAMC,KAAK,GAAGJ,iBAAiB,GAAGN,KAAK,CAACE,KAAK,CAACS,OAAO,CAACC,MAAM,CAACC,WAAW,GAAGb,KAAK,CAACE,KAAK,CAACS,OAAO,CAACC,MAAM,CAACE,SAAS;EAE/G,MAAMC,YAAY,aAAU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A,CAAAtB,MAAA;KAI5B,QAAAzC,CAAA;MAAA,OAAAP,OAAA,CAAAQ,MAAA,CAAAD,CAAA;;;EAED,oBACIE,6BAACC,OAAO;IACJ6D,MAAM,EAAE,CAACjC,SAAS;IAClBjD,KAAK,eACDoB,4DACKpB,KAAK,eACNoB,6BAAC+D,QAAQ;MAAC5D,SAAS,EAAC,MAAM;MAAC6D,IAAI,EAAC;MAAU;kBAGlDhE,6BAACE,QAAQ;kBACOtB,KAAK;IACjBuB,SAAS,EAAC,OAAO;IACjBjB,OAAO,EAAEwC,UAAU;IACnBuC,OAAO,EAAEjC,WAAW;IACpBkC,QAAQ,EAAE,CAACrC,SAAS;;IAEpBpB,QAAQ,EAAEA,MAAM;IAClB,CACI;AAElB;MAEa0D,QAAQ,GAAkC;EACnDC,MAAM,EAAEpG,MAAM;EACdmG,QAAQ,EAAEpD,IAAI;EACdsD,IAAI,EAAE,EAAE;EACR9F,IAAI,EAAE;IACF+F,KAAK,EAAE,QAAQ;IACfnE,SAAS,EAAE,OAAO;;IAElBoE,YAAY,EAAE,KAAK;IACnBH,MAAM,EAAE,EAAE;IACVI,eAAe,EAAE;;;;;;"}
@@ -7,6 +7,7 @@ function Row(props) {
7
7
  const {
8
8
  renderer: RowRenderer,
9
9
  cellRenderer: CellRenderer,
10
+ hideInternalColumns = false,
10
11
  hideRowActions = false,
11
12
  ...displayRowProps
12
13
  } = props;
@@ -16,8 +17,9 @@ function Row(props) {
16
17
  const contextValue = React__default.useMemo(() => ({
17
18
  isHovered,
18
19
  rowIndex: props.index,
20
+ hideInternalColumns,
19
21
  hideRowActions
20
- }), [isHovered, props.index, hideRowActions]);
22
+ }), [isHovered, props.index, hideInternalColumns, hideRowActions]);
21
23
  if (props.row.original === undefined) {
22
24
  return /*#__PURE__*/React__default.createElement(SkeletonRow, Object.assign({}, props));
23
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Row.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { SkeletonRow } from './BuiltIns/SkeletonRow';\nimport { RowContext } from './RowContext';\nimport { TableRowRenderer, TableRowRendererProps } from '../../types';\n\nexport type RowProps<TType = unknown> = React.HTMLAttributes<HTMLTableRowElement> &\n TableRowRendererProps<TType> & {\n renderer: TableRowRenderer<TType>;\n };\n\n/* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */\nexport function Row<TType = unknown>(props: RowProps<TType>) {\n const { renderer: RowRenderer, cellRenderer: CellRenderer, hideRowActions = false, ...displayRowProps } = props;\n\n const tableMeta = props.table.options.meta as ReactTableMeta<TType>;\n const isHovered = tableMeta.rowActive.rowHoverIndex === props.index;\n // context - it must be here for cells to read it, since they render alongside the row inside DisplayRow\n const contextValue = React.useMemo(\n () => ({ isHovered, rowIndex: props.index, hideRowActions }),\n [isHovered, props.index, hideRowActions]\n );\n\n if (props.row.original === undefined) {\n return <SkeletonRow {...props} />;\n }\n\n return (\n <RowContext.Provider value={contextValue}>\n <RowRenderer<TType> {...displayRowProps} cellRenderer={CellRenderer} />\n </RowContext.Provider>\n );\n}\n"],"names":["Row","props","renderer","RowRenderer","cellRenderer","CellRenderer","hideRowActions","displayRowProps","tableMeta","table","options","meta","isHovered","rowActive","rowHoverIndex","index","contextValue","React","useMemo","rowIndex","row","original","undefined","SkeletonRow","RowContext","Provider","value"],"mappings":";;;;AAWA;SACgBA,GAAGA,CAAkBC,KAAsB;EACvD,MAAM;IAAEC,QAAQ,EAAEC,WAAW;IAAEC,YAAY,EAAEC,YAAY;IAAEC,cAAc,GAAG,KAAK;IAAE,GAAGC;GAAiB,GAAGN,KAAK;EAE/G,MAAMO,SAAS,GAAGP,KAAK,CAACQ,KAAK,CAACC,OAAO,CAACC,IAA6B;EACnE,MAAMC,SAAS,GAAGJ,SAAS,CAACK,SAAS,CAACC,aAAa,KAAKb,KAAK,CAACc,KAAK;;EAEnE,MAAMC,YAAY,GAAGC,cAAK,CAACC,OAAO,CAC9B,OAAO;IAAEN,SAAS;IAAEO,QAAQ,EAAElB,KAAK,CAACc,KAAK;IAAET;GAAgB,CAAC,EAC5D,CAACM,SAAS,EAAEX,KAAK,CAACc,KAAK,EAAET,cAAc,CAAC,CAC3C;EAED,IAAIL,KAAK,CAACmB,GAAG,CAACC,QAAQ,KAAKC,SAAS,EAAE;IAClC,oBAAOL,6BAACM,WAAW,oBAAKtB,KAAK,EAAI;;EAGrC,oBACIgB,6BAACO,UAAU,CAACC,QAAQ;IAACC,KAAK,EAAEV;kBACxBC,6BAACd,WAAW,oBAAYI,eAAe;IAAEH,YAAY,EAAEC;KAAgB,CACrD;AAE9B;;;;"}
1
+ {"version":3,"file":"Row.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { SkeletonRow } from './BuiltIns/SkeletonRow';\nimport { RowContext } from './RowContext';\nimport { TableRowRenderer, TableRowRendererProps } from '../../types';\n\nexport type RowProps<TType = unknown> = React.HTMLAttributes<HTMLTableRowElement> &\n TableRowRendererProps<TType> & {\n renderer: TableRowRenderer<TType>;\n };\n\n/* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */\nexport function Row<TType = unknown>(props: RowProps<TType>) {\n const {\n renderer: RowRenderer,\n cellRenderer: CellRenderer,\n hideInternalColumns = false,\n hideRowActions = false,\n ...displayRowProps\n } = props;\n\n const tableMeta = props.table.options.meta as ReactTableMeta<TType>;\n const isHovered = tableMeta.rowActive.rowHoverIndex === props.index;\n // context - it must be here for cells to read it, since they render alongside the row inside DisplayRow\n const contextValue = React.useMemo(\n () => ({ isHovered, rowIndex: props.index, hideInternalColumns, hideRowActions }),\n [isHovered, props.index, hideInternalColumns, hideRowActions]\n );\n\n if (props.row.original === undefined) {\n return <SkeletonRow {...props} />;\n }\n\n return (\n <RowContext.Provider value={contextValue}>\n <RowRenderer<TType> {...displayRowProps} cellRenderer={CellRenderer} />\n </RowContext.Provider>\n );\n}\n"],"names":["Row","props","renderer","RowRenderer","cellRenderer","CellRenderer","hideInternalColumns","hideRowActions","displayRowProps","tableMeta","table","options","meta","isHovered","rowActive","rowHoverIndex","index","contextValue","React","useMemo","rowIndex","row","original","undefined","SkeletonRow","RowContext","Provider","value"],"mappings":";;;;AAWA;SACgBA,GAAGA,CAAkBC,KAAsB;EACvD,MAAM;IACFC,QAAQ,EAAEC,WAAW;IACrBC,YAAY,EAAEC,YAAY;IAC1BC,mBAAmB,GAAG,KAAK;IAC3BC,cAAc,GAAG,KAAK;IACtB,GAAGC;GACN,GAAGP,KAAK;EAET,MAAMQ,SAAS,GAAGR,KAAK,CAACS,KAAK,CAACC,OAAO,CAACC,IAA6B;EACnE,MAAMC,SAAS,GAAGJ,SAAS,CAACK,SAAS,CAACC,aAAa,KAAKd,KAAK,CAACe,KAAK;;EAEnE,MAAMC,YAAY,GAAGC,cAAK,CAACC,OAAO,CAC9B,OAAO;IAAEN,SAAS;IAAEO,QAAQ,EAAEnB,KAAK,CAACe,KAAK;IAAEV,mBAAmB;IAAEC;GAAgB,CAAC,EACjF,CAACM,SAAS,EAAEZ,KAAK,CAACe,KAAK,EAAEV,mBAAmB,EAAEC,cAAc,CAAC,CAChE;EAED,IAAIN,KAAK,CAACoB,GAAG,CAACC,QAAQ,KAAKC,SAAS,EAAE;IAClC,oBAAOL,6BAACM,WAAW,oBAAKvB,KAAK,EAAI;;EAGrC,oBACIiB,6BAACO,UAAU,CAACC,QAAQ;IAACC,KAAK,EAAEV;kBACxBC,6BAACf,WAAW,oBAAYK,eAAe;IAAEJ,YAAY,EAAEC;KAAgB,CACrD;AAE9B;;;;"}
@@ -1,9 +1,10 @@
1
1
  import React__default from 'react';
2
2
 
3
3
  const RowContext = /*#__PURE__*/React__default.createContext({
4
+ hideInternalColumns: false,
5
+ hideRowActions: false,
4
6
  isHovered: false,
5
- rowIndex: -1,
6
- hideRowActions: false
7
+ rowIndex: -1
7
8
  });
8
9
 
9
10
  export { RowContext };
@@ -1 +1 @@
1
- {"version":3,"file":"RowContext.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Row/RowContext.tsx"],"sourcesContent":["import React from 'react';\n\ntype RowContextValue = {\n isHovered: boolean;\n rowIndex: number;\n hideRowActions: boolean;\n};\n\nexport const RowContext = React.createContext<RowContextValue>({\n isHovered: false,\n rowIndex: -1,\n hideRowActions: false,\n});\n"],"names":["RowContext","React","createContext","isHovered","rowIndex","hideRowActions"],"mappings":";;MAQaA,UAAU,gBAAGC,cAAK,CAACC,aAAa,CAAkB;EAC3DC,SAAS,EAAE,KAAK;EAChBC,QAAQ,EAAE,CAAC,CAAC;EACZC,cAAc,EAAE;CACnB;;;;"}
1
+ {"version":3,"file":"RowContext.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Row/RowContext.tsx"],"sourcesContent":["import React from 'react';\n\ntype RowContextValue = {\n hideInternalColumns: boolean;\n hideRowActions: boolean;\n isHovered: boolean;\n rowIndex: number;\n};\n\nexport const RowContext = React.createContext<RowContextValue>({\n hideInternalColumns: false,\n hideRowActions: false,\n isHovered: false,\n rowIndex: -1,\n});\n"],"names":["RowContext","React","createContext","hideInternalColumns","hideRowActions","isHovered","rowIndex"],"mappings":";;MASaA,UAAU,gBAAGC,cAAK,CAACC,aAAa,CAAkB;EAC3DC,mBAAmB,EAAE,KAAK;EAC1BC,cAAc,EAAE,KAAK;EACrBC,SAAS,EAAE,KAAK;EAChBC,QAAQ,EAAE,CAAC;CACd;;;;"}
@@ -90,12 +90,16 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
90
90
  // rendered output
91
91
  let style = {};
92
92
  let content = null;
93
- if (rows.length) {
93
+ // bottom rows aren't virtualised (they're sticky) but we need to set the height
94
+ if (rows.length || table.getBottomRows().length) {
94
95
  style = {
95
96
  height: totalSize,
96
97
  paddingBottom,
97
98
  paddingTop
98
99
  };
100
+ }
101
+ // only render non sticky rows
102
+ if (rows.length) {
99
103
  content = virtualItems.map(virtualRow => {
100
104
  // there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here
101
105
  if (!virtualRow) {
@@ -1 +1 @@
1
- {"version":3,"file":"useTableRenderer.js","sources":["../../../../../../../../../src/primitives/Table/Core/features/useTableRenderer.tsx"],"sourcesContent":["import React, { CSSProperties } from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport {\n useVirtualizer,\n defaultRangeExtractor,\n ScrollToOptions as ReactVirtualScrollToOptions,\n VirtualItem,\n} from '@tanstack/react-virtual';\nimport { ROW_HEIGHT_ESTIMATES } from '../util/rows';\nimport { Row } from '../components/Row/Row';\nimport { useTableRenderers, useTableRenderOptions } from '../types';\nimport { TableRef } from '../../types';\n\n// scroll padding end is designed to always show half of the next row\nfunction getScrollPaddingEndOffset<TType = unknown>(table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let offset = 2;\n\n if (tableMeta.footer.isEnabled) {\n offset += 1;\n }\n\n if (table.getHeaderGroups().length > 1) {\n offset += table.getHeaderGroups().length - 1;\n }\n\n let height = ROW_HEIGHT_ESTIMATES.medium * offset;\n\n const bottomRows = table.getBottomRows();\n\n if (bottomRows.length) {\n // 1.4 offsets for half rows and also accounts for increased row heights (which is likely in pinned rows)\n height += ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] * 1.4 * bottomRows.length;\n }\n\n return height;\n}\n\n// scroll padding end is designed to always show half of the next row\nfunction getPaddingEndOffset<TType = unknown>(table: ReactTable<TType>, options?: useTableRenderOptions) {\n const bottomRows = table.getBottomRows() ?? [];\n return ROW_HEIGHT_ESTIMATES.medium * (options?.virtualiserPaddingEndOffset ?? 1) * bottomRows.length;\n}\n\nexport function useTableRenderer<TType = unknown>(\n renderers: useTableRenderers<TType>,\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n defaultRowActiveIndex?: number | undefined,\n options?: useTableRenderOptions\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isTableRowGrouped = !!table.getState().grouping?.length;\n\n const rows = table.getCenterRows() ?? [];\n\n // expanded rows\n const { createRowMeasurer, estimateSize } = useRowHeightVirtualisation<TType>(table);\n\n // row groups\n const rangeExtractor = useRowGroupVirtualisation<TType>(table);\n\n // account for thead and tfoot in the scroll area - both are always medium row height\n const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;\n\n const virtualiser = useVirtualizer({\n count: rows.length,\n estimateSize,\n getScrollElement: () => tableRef.current,\n overscan: tableMeta.printing.isPrinting ? rows.length : undefined,\n rangeExtractor,\n // correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list\n scrollPaddingStart,\n scrollPaddingEnd: getScrollPaddingEndOffset(table),\n paddingEnd: getPaddingEndOffset(table, options),\n });\n\n const totalSize = virtualiser.getTotalSize();\n const virtualItems = virtualiser.getVirtualItems();\n\n const scrollToIndex = React.useCallback(\n (index: number, options: ReactVirtualScrollToOptions = { align: 'auto', behavior: 'smooth' }) => {\n const notSmooth: ReactVirtualScrollToOptions = { ...options, behavior: 'auto' };\n\n if (tableRef.current) {\n if (index === 0) {\n virtualiser.scrollToOffset(0, notSmooth);\n } else if (index === rows.length - 1) {\n // sometimes the last row doesn't fully show, so we just force scroll to the bottom\n tableRef.current.scrollTop = tableRef.current.scrollHeight;\n } else {\n virtualiser.scrollToIndex(index, options);\n }\n }\n },\n [virtualItems.length, tableRef.current, totalSize, rows.length]\n );\n\n // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0\n const paddingStartIndex = isTableRowGrouped && rows.length > 1 ? 1 : 0;\n\n const startValue = isTableRowGrouped\n ? virtualItems[paddingStartIndex]?.start - virtualItems[paddingStartIndex]?.size\n : virtualItems[paddingStartIndex]?.start;\n\n // styling for offsetting rows - this \"is\" the virtualisation\n const [paddingTop, paddingBottom] =\n virtualItems.length > 0\n ? [Math.max(0, startValue ?? 0), Math.max(0, totalSize - virtualItems[virtualItems.length - 1]?.end ?? 0)]\n : [0, 0];\n\n // ensure default active rows are scrolled to\n React.useEffect(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center', behavior: 'auto' });\n }\n }, []);\n\n // rendered output\n let style: CSSProperties = {};\n let content: (JSX.Element | null)[] | null = null;\n\n if (rows.length) {\n style = {\n height: totalSize,\n paddingBottom,\n paddingTop,\n };\n content = virtualItems.map(virtualRow => {\n // there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here\n if (!virtualRow) {\n return null;\n }\n\n const row = rows[virtualRow.index];\n const measureRow = createRowMeasurer(virtualiser.resizeItem, virtualRow);\n return (\n <Row\n key={row.id}\n row={row}\n index={virtualRow.index}\n table={table}\n measureRow={measureRow}\n renderer={renderers.row}\n cellRenderer={renderers.cell}\n />\n );\n });\n }\n\n return {\n rows: content,\n style,\n scrollToIndex,\n };\n}\n\n// support varying row heights - variable row heights, row expansion\nfunction useRowHeightVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n const expandedState = table.getState().expanded;\n\n const [expandedRowHeightsCache, setExpandedRowHeightsCache] = React.useState<Record<number, number>>({});\n\n // look at all registered expanded row heights and use them to form a more accurate average size\n // it might be worth considering if taking the max, or an upper bound, would be better\n const averageExpandedRowHeight = React.useMemo(() => {\n const values: number[] = Object.values(expandedRowHeightsCache);\n return values.length ? values.reduce((a, b) => a + b, 0) / values.length : 0;\n }, [expandedRowHeightsCache]);\n\n // row heights\n const estimateSize = React.useCallback(\n (index: number) => {\n const rowHeight = tableMeta.rowHeight.height\n ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height]\n : ROW_HEIGHT_ESTIMATES.medium;\n\n if (expandedState === true || rows[index]?.getIsExpanded?.()) {\n return rowHeight + averageExpandedRowHeight;\n }\n\n return rowHeight;\n },\n [tableMeta.rowHeight.height, averageExpandedRowHeight, expandedState]\n );\n\n const createRowMeasurer = React.useCallback(\n (resizeItem: (item: VirtualItem, size: number) => void, virtualRow: VirtualItem) =>\n (rowHeight: number, expansionHeight?: number) => {\n // register the expansion height so that it can be used to determine an average\n if (expansionHeight) {\n setExpandedRowHeightsCache(cache => ({ ...cache, [virtualRow.index]: expansionHeight }));\n }\n\n // update the whole row's size to include the expanded height\n resizeItem(virtualRow, rowHeight + (expansionHeight ?? 0));\n },\n []\n );\n\n return { estimateSize, createRowMeasurer };\n}\n\n// support virtualised row groups (where the row group headers are sticky)\nfunction useRowGroupVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const rows = table.getRowModel().rows;\n const isTableGrouped = !!table.getState().grouping.length;\n\n const rowGroupIndexes = React.useMemo(() => {\n const indexes: number[] = [];\n\n if (isTableGrouped) {\n rows.forEach((row, index) => {\n if (row.getIsGrouped()) {\n indexes.push(index);\n }\n });\n }\n\n return indexes;\n }, [rows]);\n\n // this is taken from the react-virtual docs/examples\n const rangeExtractor = React.useCallback(\n range => {\n const activeRowGroupIndex =\n [...rowGroupIndexes].reverse().find(index => range.startIndex >= index) ?? rowGroupIndexes[0];\n\n const next = new Set([activeRowGroupIndex, ...defaultRangeExtractor(range)]);\n return [...next].sort((a, b) => a - b);\n },\n [rowGroupIndexes]\n );\n\n return isTableGrouped ? rangeExtractor : undefined;\n}\n"],"names":["getScrollPaddingEndOffset","table","tableMeta","options","meta","offset","footer","isEnabled","getHeaderGroups","length","height","ROW_HEIGHT_ESTIMATES","medium","bottomRows","getBottomRows","rowHeight","getPaddingEndOffset","_table$getBottomRows","_options$virtualiserP","virtualiserPaddingEndOffset","useTableRenderer","renderers","tableRef","defaultRowActiveIndex","isTableRowGrouped","_table$getState$group","getState","grouping","rows","_table$getCenterRows","getCenterRows","createRowMeasurer","estimateSize","useRowHeightVirtualisation","rangeExtractor","useRowGroupVirtualisation","scrollPaddingStart","virtualiser","useVirtualizer","count","getScrollElement","current","overscan","printing","isPrinting","undefined","scrollPaddingEnd","paddingEnd","totalSize","getTotalSize","virtualItems","getVirtualItems","scrollToIndex","React","useCallback","index","align","behavior","notSmooth","scrollToOffset","scrollTop","scrollHeight","paddingStartIndex","startValue","_virtualItems$padding","start","_virtualItems$padding2","size","_virtualItems$padding3","paddingTop","paddingBottom","Math","max","_ref","_virtualItems","end","useEffect","style","content","map","virtualRow","row","measureRow","resizeItem","Row","key","id","renderer","cellRenderer","cell","getRowModel","expandedState","expanded","expandedRowHeightsCache","setExpandedRowHeightsCache","useState","averageExpandedRowHeight","useMemo","values","Object","reduce","a","b","_rows$index","_rows$index$getIsExpa","getIsExpanded","call","expansionHeight","cache","isTableGrouped","rowGroupIndexes","indexes","forEach","getIsGrouped","push","range","activeRowGroupIndex","_reverse$find","reverse","find","startIndex","next","Set","defaultRangeExtractor","sort"],"mappings":";;;;;AAaA;AACA,SAASA,yBAAyBA,CAAkBC,KAAwB;EACxE,MAAMC,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAC7D,IAAIC,MAAM,GAAG,CAAC;EAEd,IAAIH,SAAS,CAACI,MAAM,CAACC,SAAS,EAAE;IAC5BF,MAAM,IAAI,CAAC;;EAGf,IAAIJ,KAAK,CAACO,eAAe,EAAE,CAACC,MAAM,GAAG,CAAC,EAAE;IACpCJ,MAAM,IAAIJ,KAAK,CAACO,eAAe,EAAE,CAACC,MAAM,GAAG,CAAC;;EAGhD,IAAIC,MAAM,GAAGC,oBAAoB,CAACC,MAAM,GAAGP,MAAM;EAEjD,MAAMQ,UAAU,GAAGZ,KAAK,CAACa,aAAa,EAAE;EAExC,IAAID,UAAU,CAACJ,MAAM,EAAE;;IAEnBC,MAAM,IAAIC,oBAAoB,CAACT,SAAS,CAACa,SAAS,CAACL,MAAM,CAAC,GAAG,GAAG,GAAGG,UAAU,CAACJ,MAAM;;EAGxF,OAAOC,MAAM;AACjB;AAEA;AACA,SAASM,mBAAmBA,CAAkBf,KAAwB,EAAEE,OAA+B;;EACnG,MAAM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AC,CAAC;;EAGV,MAAMM,cAAc,GAAGmB,cAAK,CAACC,WAAW,CACpC6D,KAAK;;IACD,MAAMC,mBAAmB,IAAAC,aAAA,GACrB,CAAC,GAAGP,eAAe,CAAC,CAACQ,OAAO,EAAE,CAACC,IAAI,CAAChE,KAAK,IAAI4D,KAAK,CAACK,UAAU,IAAIjE,KAAK,CAAC,cAAA8D,aAAA,cAAAA,aAAA,GAAIP,eAAe,CAAC,CAAC,CAAC;IAEjG,MAAMW,IAAI,GAAG,IAAIC,GAAG,CAAC,CAACN,mBAAmB,EAAE,GAAGO,qBAAqB,CAACR,KAAK,CAAC,CAAC,CAAC;IAC5E,OAAO,CAAC,GAAGM,IAAI,CAAC,CAACG,IAAI,CAAC,CAACvB,CAAC,EAAEC,CAAC,KAAKD,CAAC,GAAGC,CAAC,CAAC;GACzC,EACD,CAACQ,eAAe,CAAC,CACpB;EAED,OAAOD,cAAc,GAAG3E,cAAc,GAAGW,SAAS;AACtD;;;;"}
1
+ {"version":3,"file":"useTableRenderer.js","sources":["../../../../../../../../../src/primitives/Table/Core/features/useTableRenderer.tsx"],"sourcesContent":["import React, { CSSProperties } from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport {\n useVirtualizer,\n defaultRangeExtractor,\n ScrollToOptions as ReactVirtualScrollToOptions,\n VirtualItem,\n} from '@tanstack/react-virtual';\nimport { ROW_HEIGHT_ESTIMATES } from '../util/rows';\nimport { Row } from '../components/Row/Row';\nimport { useTableRenderers, useTableRenderOptions } from '../types';\nimport { TableRef } from '../../types';\n\n// scroll padding end is designed to always show half of the next row\nfunction getScrollPaddingEndOffset<TType = unknown>(table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let offset = 2;\n\n if (tableMeta.footer.isEnabled) {\n offset += 1;\n }\n\n if (table.getHeaderGroups().length > 1) {\n offset += table.getHeaderGroups().length - 1;\n }\n\n let height = ROW_HEIGHT_ESTIMATES.medium * offset;\n\n const bottomRows = table.getBottomRows();\n\n if (bottomRows.length) {\n // 1.4 offsets for half rows and also accounts for increased row heights (which is likely in pinned rows)\n height += ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] * 1.4 * bottomRows.length;\n }\n\n return height;\n}\n\n// scroll padding end is designed to always show half of the next row\nfunction getPaddingEndOffset<TType = unknown>(table: ReactTable<TType>, options?: useTableRenderOptions) {\n const bottomRows = table.getBottomRows() ?? [];\n return ROW_HEIGHT_ESTIMATES.medium * (options?.virtualiserPaddingEndOffset ?? 1) * bottomRows.length;\n}\n\nexport function useTableRenderer<TType = unknown>(\n renderers: useTableRenderers<TType>,\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n defaultRowActiveIndex?: number | undefined,\n options?: useTableRenderOptions\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isTableRowGrouped = !!table.getState().grouping?.length;\n\n const rows = table.getCenterRows() ?? [];\n\n // expanded rows\n const { createRowMeasurer, estimateSize } = useRowHeightVirtualisation<TType>(table);\n\n // row groups\n const rangeExtractor = useRowGroupVirtualisation<TType>(table);\n\n // account for thead and tfoot in the scroll area - both are always medium row height\n const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;\n\n const virtualiser = useVirtualizer({\n count: rows.length,\n estimateSize,\n getScrollElement: () => tableRef.current,\n overscan: tableMeta.printing.isPrinting ? rows.length : undefined,\n rangeExtractor,\n // correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list\n scrollPaddingStart,\n scrollPaddingEnd: getScrollPaddingEndOffset(table),\n paddingEnd: getPaddingEndOffset(table, options),\n });\n\n const totalSize = virtualiser.getTotalSize();\n const virtualItems = virtualiser.getVirtualItems();\n\n const scrollToIndex = React.useCallback(\n (index: number, options: ReactVirtualScrollToOptions = { align: 'auto', behavior: 'smooth' }) => {\n const notSmooth: ReactVirtualScrollToOptions = { ...options, behavior: 'auto' };\n\n if (tableRef.current) {\n if (index === 0) {\n virtualiser.scrollToOffset(0, notSmooth);\n } else if (index === rows.length - 1) {\n // sometimes the last row doesn't fully show, so we just force scroll to the bottom\n tableRef.current.scrollTop = tableRef.current.scrollHeight;\n } else {\n virtualiser.scrollToIndex(index, options);\n }\n }\n },\n [virtualItems.length, tableRef.current, totalSize, rows.length]\n );\n\n // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0\n const paddingStartIndex = isTableRowGrouped && rows.length > 1 ? 1 : 0;\n\n const startValue = isTableRowGrouped\n ? virtualItems[paddingStartIndex]?.start - virtualItems[paddingStartIndex]?.size\n : virtualItems[paddingStartIndex]?.start;\n\n // styling for offsetting rows - this \"is\" the virtualisation\n const [paddingTop, paddingBottom] =\n virtualItems.length > 0\n ? [Math.max(0, startValue ?? 0), Math.max(0, totalSize - virtualItems[virtualItems.length - 1]?.end ?? 0)]\n : [0, 0];\n\n // ensure default active rows are scrolled to\n React.useEffect(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center', behavior: 'auto' });\n }\n }, []);\n\n // rendered output\n let style: CSSProperties = {};\n let content: (JSX.Element | null)[] | null = null;\n\n // bottom rows aren't virtualised (they're sticky) but we need to set the height\n if (rows.length || table.getBottomRows().length) {\n style = {\n height: totalSize,\n paddingBottom,\n paddingTop,\n };\n }\n\n // only render non sticky rows\n if (rows.length) {\n content = virtualItems.map(virtualRow => {\n // there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here\n if (!virtualRow) {\n return null;\n }\n\n const row = rows[virtualRow.index];\n const measureRow = createRowMeasurer(virtualiser.resizeItem, virtualRow);\n return (\n <Row\n key={row.id}\n row={row}\n index={virtualRow.index}\n table={table}\n measureRow={measureRow}\n renderer={renderers.row}\n cellRenderer={renderers.cell}\n />\n );\n });\n }\n\n return {\n rows: content,\n style,\n scrollToIndex,\n };\n}\n\n// support varying row heights - variable row heights, row expansion\nfunction useRowHeightVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n const expandedState = table.getState().expanded;\n\n const [expandedRowHeightsCache, setExpandedRowHeightsCache] = React.useState<Record<number, number>>({});\n\n // look at all registered expanded row heights and use them to form a more accurate average size\n // it might be worth considering if taking the max, or an upper bound, would be better\n const averageExpandedRowHeight = React.useMemo(() => {\n const values: number[] = Object.values(expandedRowHeightsCache);\n return values.length ? values.reduce((a, b) => a + b, 0) / values.length : 0;\n }, [expandedRowHeightsCache]);\n\n // row heights\n const estimateSize = React.useCallback(\n (index: number) => {\n const rowHeight = tableMeta.rowHeight.height\n ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height]\n : ROW_HEIGHT_ESTIMATES.medium;\n\n if (expandedState === true || rows[index]?.getIsExpanded?.()) {\n return rowHeight + averageExpandedRowHeight;\n }\n\n return rowHeight;\n },\n [tableMeta.rowHeight.height, averageExpandedRowHeight, expandedState]\n );\n\n const createRowMeasurer = React.useCallback(\n (resizeItem: (item: VirtualItem, size: number) => void, virtualRow: VirtualItem) =>\n (rowHeight: number, expansionHeight?: number) => {\n // register the expansion height so that it can be used to determine an average\n if (expansionHeight) {\n setExpandedRowHeightsCache(cache => ({ ...cache, [virtualRow.index]: expansionHeight }));\n }\n\n // update the whole row's size to include the expanded height\n resizeItem(virtualRow, rowHeight + (expansionHeight ?? 0));\n },\n []\n );\n\n return { estimateSize, createRowMeasurer };\n}\n\n// support virtualised row groups (where the row group headers are sticky)\nfunction useRowGroupVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const rows = table.getRowModel().rows;\n const isTableGrouped = !!table.getState().grouping.length;\n\n const rowGroupIndexes = React.useMemo(() => {\n const indexes: number[] = [];\n\n if (isTableGrouped) {\n rows.forEach((row, index) => {\n if (row.getIsGrouped()) {\n indexes.push(index);\n }\n });\n }\n\n return indexes;\n }, [rows]);\n\n // this is taken from the react-virtual docs/examples\n const rangeExtractor = React.useCallback(\n range => {\n const activeRowGroupIndex =\n [...rowGroupIndexes].reverse().find(index => range.startIndex >= index) ?? rowGroupIndexes[0];\n\n const next = new Set([activeRowGroupIndex, ...defaultRangeExtractor(range)]);\n return [...next].sort((a, b) => a - b);\n },\n [rowGroupIndexes]\n );\n\n return isTableGrouped ? rangeExtractor : undefined;\n}\n"],"names":["getScrollPaddingEndOffset","table","tableMeta","options","meta","offset","footer","isEnabled","getHeaderGroups","length","height","ROW_HEIGHT_ESTIMATES","medium","bottomRows","getBottomRows","rowHeight","getPaddingEndOffset","_table$getBottomRows","_options$virtualiserP","virtualiserPaddingEndOffset","useTableRenderer","renderers","tableRef","defaultRowActiveIndex","isTableRowGrouped","_table$getState$group","getState","grouping","rows","_table$getCenterRows","getCenterRows","createRowMeasurer","estimateSize","useRowHeightVirtualisation","rangeExtractor","useRowGroupVirtualisation","scrollPaddingStart","virtualiser","useVirtualizer","count","getScrollElement","current","overscan","printing","isPrinting","undefined","scrollPaddingEnd","paddingEnd","totalSize","getTotalSize","virtualItems","getVirtualItems","scrollToIndex","React","useCallback","index","align","behavior","notSmooth","scrollToOffset","scrollTop","scrollHeight","paddingStartIndex","startValue","_virtualItems$padding","start","_virtualItems$padding2","size","_virtualItems$padding3","paddingTop","paddingBottom","Math","max","_ref","_virtualItems","end","useEffect","style","content","map","virtualRow","row","measureRow","resizeItem","Row","key","id","renderer","cellRenderer","cell","getRowModel","expandedState","expanded","expandedRowHeightsCache","setExpandedRowHeightsCache","useState","averageExpandedRowHeight","useMemo","values","Object","reduce","a","b","_rows$index","_rows$index$getIsExpa","getIsExpanded","call","expansionHeight","cache","isTableGrouped","rowGroupIndexes","indexes","forEach","getIsGrouped","push","range","activeRowGroupIndex","_reverse$find","reverse","find","startIndex","next","Set","defaultRangeExtractor","sort"],"mappings":";;;;;AAaA;AACA,SAASA,yBAAyBA,CAAkBC,KAAwB;EACxE,MAAMC,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAC7D,IAAIC,MAAM,GAAG,CAAC;EAEd,IAAIH,SAAS,CAACI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AGW,SAAS;AACtD;;;;"}
@@ -0,0 +1,122 @@
1
+ // NOTE: this file is intentianally a js file so that it can be consumed by tailwind.config.js
2
+
3
+ const THEME_COLORS = {
4
+ transparent: 'transparent',
5
+ current: 'currentColor',
6
+ white: '#fff',
7
+ black: '#1c1c1c',
8
+ brand: {
9
+ vismaRed: '#E70641',
10
+ paleOrange: '#FFF5E5',
11
+ sunsetOrange: '#E89C2E',
12
+ midnightBlue: '#29283E',
13
+ coolBlue: '#F5F7F9'
14
+ },
15
+ grey: {
16
+ lightest: '#fafafa',
17
+ light: '#F6F6F6',
18
+ DEFAULT: '#EBEBEB',
19
+ dark: '#DDDDDD',
20
+ darker: '#ACACAC',
21
+ darkest: '#595959',
22
+ darkNew: '#a5a6a9',
23
+ 50: '#fafafa',
24
+ 100: '#F6F6F6',
25
+ 200: '#EBEBEB',
26
+ 300: '#DDDDDD',
27
+ 500: '#ACACAC',
28
+ 700: '#595959',
29
+ 900: '#303030'
30
+ },
31
+ purple: {
32
+ lightest: '#585c74',
33
+ light: '#4b4f64',
34
+ DEFAULT: '#3d4153',
35
+ dark: '#353a48',
36
+ darker: '#29283e',
37
+ darkest: '#212032',
38
+ darkNew_1: '#373647',
39
+ darkNew_2: '#414050',
40
+ 100: '#EEE5FF',
41
+ 200: '#ddd1ff',
42
+ 300: '#CBBCFE',
43
+ 500: '#9270FA',
44
+ 700: '#6542D1',
45
+ 900: '#412970'
46
+ },
47
+ blue: {
48
+ lightest: '#DEEBFF',
49
+ light: '#75A0F5',
50
+ DEFAULT: '#4573D2',
51
+ dark: '#2B57B4',
52
+ 100: '#DEEBFF',
53
+ 200: '#AACCFF',
54
+ 300: '#75A0F5',
55
+ 500: '#4573D2',
56
+ 700: '#2B57B4',
57
+ 900: '#29283E'
58
+ },
59
+ red: {
60
+ lightest: '#FFDAD2',
61
+ light: '#E66568',
62
+ DEFAULT: '#CE3F42',
63
+ dark: '#950027',
64
+ 100: '#FFDAD2',
65
+ 200: '#f3a09d',
66
+ 300: '#E66568',
67
+ 500: '#CE3F42',
68
+ 700: '#950027',
69
+ 900: '#64001B'
70
+ },
71
+ green: {
72
+ lightest: '#cdf0e7',
73
+ light: '#52C7AB',
74
+ DEFAULT: '#08AE87',
75
+ dark: '#028465',
76
+ 100: '#cdf0e7',
77
+ 200: '#9be1ce',
78
+ 300: '#52C7AB',
79
+ 500: '#08AE87',
80
+ 700: '#028465',
81
+ 900: '#14493A'
82
+ },
83
+ yellow: {
84
+ lightest: '#FFF1C3',
85
+ light: '#FFD665',
86
+ DEFAULT: '#FFBD3B',
87
+ dark: '#e89c2e',
88
+ 100: '#FFF1C3',
89
+ 200: '#ffe494',
90
+ 300: '#FFD665',
91
+ 500: '#FFBD3B',
92
+ 700: '#e89c2e',
93
+ 900: '#733700'
94
+ },
95
+ pink: {
96
+ 100: '#FFE3F7',
97
+ 200: '#fcb9e9',
98
+ 300: '#F98EDB',
99
+ 500: '#E165BF',
100
+ 700: '#CF49AA',
101
+ 900: '#870062'
102
+ },
103
+ brown: {
104
+ 100: '#EEE0DA',
105
+ 200: '#DFCCC2',
106
+ 300: '#C4AB9E',
107
+ 500: '#93715D',
108
+ 700: '#73503B',
109
+ 900: '#45291F'
110
+ },
111
+ orange: {
112
+ 100: '#FFE3BB',
113
+ 200: '#FCCB80',
114
+ 300: '#FAB64D',
115
+ 500: '#F99702',
116
+ 700: '#EF7D00',
117
+ 900: '#4A2811'
118
+ }
119
+ };
120
+
121
+ export default THEME_COLORS;
122
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.js","sources":["../../../../../../src/utils/colors.js"],"sourcesContent":["// NOTE: this file is intentianally a js file so that it can be consumed by tailwind.config.js\n\nconst THEME_COLORS = {\n transparent: 'transparent',\n current: 'currentColor',\n white: '#fff',\n black: '#1c1c1c',\n brand: {\n vismaRed: '#E70641',\n paleOrange: '#FFF5E5',\n sunsetOrange: '#E89C2E',\n midnightBlue: '#29283E',\n coolBlue: '#F5F7F9',\n },\n grey: {\n lightest: '#fafafa',\n light: '#F6F6F6',\n DEFAULT: '#EBEBEB',\n dark: '#DDDDDD',\n darker: '#ACACAC',\n darkest: '#595959',\n darkNew: '#a5a6a9',\n 50: '#fafafa',\n 100: '#F6F6F6',\n 200: '#EBEBEB',\n 300: '#DDDDDD',\n 500: '#ACACAC',\n 700: '#595959',\n 900: '#303030',\n },\n purple: {\n lightest: '#585c74',\n light: '#4b4f64',\n DEFAULT: '#3d4153',\n dark: '#353a48',\n darker: '#29283e',\n darkest: '#212032',\n darkNew_1: '#373647',\n darkNew_2: '#414050',\n 100: '#EEE5FF',\n 200: '#ddd1ff',\n 300: '#CBBCFE',\n 500: '#9270FA',\n 700: '#6542D1',\n 900: '#412970',\n },\n blue: {\n lightest: '#DEEBFF',\n light: '#75A0F5',\n DEFAULT: '#4573D2',\n dark: '#2B57B4',\n 100: '#DEEBFF',\n 200: '#AACCFF',\n 300: '#75A0F5',\n 500: '#4573D2',\n 700: '#2B57B4',\n 900: '#29283E',\n },\n red: {\n lightest: '#FFDAD2',\n light: '#E66568',\n DEFAULT: '#CE3F42',\n dark: '#950027',\n 100: '#FFDAD2',\n 200: '#f3a09d',\n 300: '#E66568',\n 500: '#CE3F42',\n 700: '#950027',\n 900: '#64001B',\n },\n green: {\n lightest: '#cdf0e7',\n light: '#52C7AB',\n DEFAULT: '#08AE87',\n dark: '#028465',\n 100: '#cdf0e7',\n 200: '#9be1ce',\n 300: '#52C7AB',\n 500: '#08AE87',\n 700: '#028465',\n 900: '#14493A',\n },\n yellow: {\n lightest: '#FFF1C3',\n light: '#FFD665',\n DEFAULT: '#FFBD3B',\n dark: '#e89c2e',\n 100: '#FFF1C3',\n 200: '#ffe494',\n 300: '#FFD665',\n 500: '#FFBD3B',\n 700: '#e89c2e',\n 900: '#733700',\n },\n pink: {\n 100: '#FFE3F7',\n 200: '#fcb9e9',\n 300: '#F98EDB',\n 500: '#E165BF',\n 700: '#CF49AA',\n 900: '#870062',\n },\n brown: {\n 100: '#EEE0DA',\n 200: '#DFCCC2',\n 300: '#C4AB9E',\n 500: '#93715D',\n 700: '#73503B',\n 900: '#45291F',\n },\n orange: {\n 100: '#FFE3BB',\n 200: '#FCCB80',\n 300: '#FAB64D',\n 500: '#F99702',\n 700: '#EF7D00',\n 900: '#4A2811',\n },\n};\n\nexport default THEME_COLORS;\n"],"names":["THEME_COLORS","transparent","current","white","black","brand","vismaRed","paleOrange","sunsetOrange","midnightBlue","coolBlue","grey","lightest","light","DEFAULT","dark","darker","darkest","darkNew","purple","darkNew_1","darkNew_2","blue","red","green","yellow","pink","brown","orange"],"mappings":"AAAA;;AAEA,MAAMA,YAAY,GAAG;EACjBC,WAAW,EAAE,aAAa;EAC1BC,OAAO,EAAE,cAAc;EACvBC,KAAK,EAAE,MAAM;EACbC,KAAK,EAAE,SAAS;EAChBC,KAAK,EAAE;IACHC,QAAQ,EAAE,SAAS;IACnBC,UAAU,EAAE,SAAS;IACrBC,YAAY,EAAE,SAAS;IACvBC,YAAY,EAAE,SAAS;IACvBC,QAAQ,EAAE;GACb;EACDC,IAAI,EAAE;IACFC,QAAQ,EAAE,SAAS;IACnBC,KAAK,EAAE,SAAS;IAChBC,OAAO,EAAE,SAAS;IAClBC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE,SAAS;IACjBC,OAAO,EAAE,SAAS;IAClBC,OAAO,EAAE,SAAS;IAClB,EAAE,EAAE,SAAS;IACb,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE;GACR;EACDC,MAAM,EAAE;IACJP,QAAQ,EAAE,SAAS;IACnBC,KAAK,EAAE,SAAS;IAChBC,OAAO,EAAE,SAAS;IAClBC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE,SAAS;IACjBC,OAAO,EAAE,SAAS;IAClBG,SAAS,EAAE,SAAS;IACpBC,SAAS,EAAE,S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,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE;GACR;EACDC,KAAK,EAAE;IACH,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE;GACR;EACDC,MAAM,EAAE;IACJ,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE;;AAEb,CAAC;;;;"}
package/dist/index.css CHANGED
@@ -180,6 +180,24 @@
180
180
  }
181
181
  }
182
182
 
183
+ .recharts-cartesian-axis line,
184
+ .recharts-cartesian-grid-horizontal line {
185
+ stroke: #efefef !important;
186
+ }
187
+
188
+ .recharts-tooltip-cursor {
189
+ fill: transparent !important;
190
+ }
191
+
192
+ .recharts-legend-wrapper {
193
+ left: 0 !important;
194
+ width: 100% !important;
195
+ }
196
+
197
+ .recharts-wrapper > svg g {
198
+ outline: none !important;
199
+ }
200
+
183
201
  [data-taco='badge'] > [data-taco='spinner'] {
184
202
  @apply ml-2 h-3 w-3;
185
203
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import './css/global.css';
2
+ import './charts/style.css';
2
3
  export * from './components/Alert/Alert';
3
4
  export * from './components/AlertDialog/AlertDialog';
4
5
  export * from './components/Accordion/Accordion';
@@ -52,6 +53,10 @@ export * from './components/Tooltip/Tooltip';
52
53
  export * from './components/Tour/Tour';
53
54
  export * from './components/Treeview/Treeview';
54
55
  export * from './components/VisuallyHidden/VisuallyHidden';
56
+ export * from './charts/components/Area/AreaChart';
57
+ export * from './charts/components/Bar/BarChart';
58
+ export * from './charts/components/Donut/DonutChart';
59
+ export * from './charts/components/Line/LineChart';
55
60
  export * from './components/Header/Header';
56
61
  export * from './components/Layout/Layout';
57
62
  export * from './components/Navigation2/Navigation2';
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { TableEmptyStateReason, TableEmptyStateRenderer } from '../../../types';
3
3
  declare type EmptyStateProps = React.HTMLAttributes<HTMLTableSectionElement> & {
4
4
  emptyState?: TableEmptyStateRenderer;
5
+ isReady: boolean;
5
6
  reason: TableEmptyStateReason;
6
7
  };
7
8
  export declare function EmptyStateBody(props: EmptyStateProps): JSX.Element;
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  declare type RowContextValue = {
3
+ hideInternalColumns: boolean;
4
+ hideRowActions: boolean;
3
5
  isHovered: boolean;
4
6
  rowIndex: number;
5
- hideRowActions: boolean;
6
7
  };
7
8
  export declare const RowContext: React.Context<RowContextValue>;
8
9
  export {};
@@ -9,6 +9,7 @@ export declare type useTableRenderers<TType = unknown> = {
9
9
  };
10
10
  export declare type TableRowRendererProps<TType = unknown> = {
11
11
  cellRenderer: TableCellRenderer<TType>;
12
+ hideInternalColumns?: boolean;
12
13
  hideRowActions?: boolean;
13
14
  index: number;
14
15
  measureRow: (size: number, expansionHeight?: number) => void;