@okta/odyssey-react-mui 1.14.4 → 1.14.6

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 (108) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/Badge.js +1 -1
  3. package/dist/Badge.js.map +1 -1
  4. package/dist/DataTable/DataTable.js +178 -58
  5. package/dist/DataTable/DataTable.js.map +1 -1
  6. package/dist/DataTable/DataTableEmptyState.js +55 -0
  7. package/dist/DataTable/DataTableEmptyState.js.map +1 -0
  8. package/dist/DataTable/DataTablePagination.js +221 -0
  9. package/dist/DataTable/DataTablePagination.js.map +1 -0
  10. package/dist/DataTable/DataTableRowActions.js +34 -24
  11. package/dist/DataTable/DataTableRowActions.js.map +1 -1
  12. package/dist/DataTable/DataTableSettings.js +22 -10
  13. package/dist/DataTable/DataTableSettings.js.map +1 -1
  14. package/dist/DataTable/constants.js +1 -0
  15. package/dist/DataTable/constants.js.map +1 -1
  16. package/dist/DataTable/index.js +1 -0
  17. package/dist/DataTable/index.js.map +1 -1
  18. package/dist/DataTable/useRowReordering.js +3 -3
  19. package/dist/DataTable/useRowReordering.js.map +1 -1
  20. package/dist/DataTable/useScrollIndication.js +70 -0
  21. package/dist/DataTable/useScrollIndication.js.map +1 -0
  22. package/dist/Field.js.map +1 -1
  23. package/dist/Fieldset.js +17 -14
  24. package/dist/Fieldset.js.map +1 -1
  25. package/dist/Form.js +33 -23
  26. package/dist/Form.js.map +1 -1
  27. package/dist/MenuButton.js +1 -1
  28. package/dist/MenuButton.js.map +1 -1
  29. package/dist/SearchField.js +2 -2
  30. package/dist/SearchField.js.map +1 -1
  31. package/dist/labs/DataFilters.js +6 -2
  32. package/dist/labs/DataFilters.js.map +1 -1
  33. package/dist/labs/DataTable.js +3 -3
  34. package/dist/labs/DataTable.js.map +1 -1
  35. package/dist/labs/FileUpload.js +195 -0
  36. package/dist/labs/FileUpload.js.map +1 -0
  37. package/dist/labs/FileUploadIllustration.js +54 -0
  38. package/dist/labs/FileUploadIllustration.js.map +1 -0
  39. package/dist/labs/FileUploadPreview.js +109 -0
  40. package/dist/labs/FileUploadPreview.js.map +1 -0
  41. package/dist/labs/index.js +1 -0
  42. package/dist/labs/index.js.map +1 -1
  43. package/dist/properties/ts/odyssey-react-mui.js +12 -0
  44. package/dist/properties/ts/odyssey-react-mui.js.map +1 -1
  45. package/dist/src/DataTable/DataTable.d.ts +36 -18
  46. package/dist/src/DataTable/DataTable.d.ts.map +1 -1
  47. package/dist/src/DataTable/DataTableEmptyState.d.ts +21 -0
  48. package/dist/src/DataTable/DataTableEmptyState.d.ts.map +1 -0
  49. package/dist/src/DataTable/DataTablePagination.d.ts +33 -0
  50. package/dist/src/DataTable/DataTablePagination.d.ts.map +1 -0
  51. package/dist/src/DataTable/DataTableRowActions.d.ts.map +1 -1
  52. package/dist/src/DataTable/DataTableSettings.d.ts.map +1 -1
  53. package/dist/src/DataTable/constants.d.ts +1 -0
  54. package/dist/src/DataTable/constants.d.ts.map +1 -1
  55. package/dist/src/DataTable/index.d.ts +2 -1
  56. package/dist/src/DataTable/index.d.ts.map +1 -1
  57. package/dist/src/DataTable/useRowReordering.d.ts.map +1 -1
  58. package/dist/src/DataTable/useScrollIndication.d.ts +22 -0
  59. package/dist/src/DataTable/useScrollIndication.d.ts.map +1 -0
  60. package/dist/src/Field.d.ts +8 -7
  61. package/dist/src/Field.d.ts.map +1 -1
  62. package/dist/src/Fieldset.d.ts.map +1 -1
  63. package/dist/src/Form.d.ts.map +1 -1
  64. package/dist/src/OdysseyTranslationProvider.d.ts +1 -1
  65. package/dist/src/OdysseyTranslationProvider.d.ts.map +1 -1
  66. package/dist/src/SearchField.d.ts.map +1 -1
  67. package/dist/src/labs/DataFilters.d.ts +5 -1
  68. package/dist/src/labs/DataFilters.d.ts.map +1 -1
  69. package/dist/src/labs/DataTable.d.ts.map +1 -1
  70. package/dist/src/labs/FileUpload.d.ts +40 -0
  71. package/dist/src/labs/FileUpload.d.ts.map +1 -0
  72. package/dist/src/labs/FileUploadIllustration.d.ts +15 -0
  73. package/dist/src/labs/FileUploadIllustration.d.ts.map +1 -0
  74. package/dist/src/labs/FileUploadPreview.d.ts +21 -0
  75. package/dist/src/labs/FileUploadPreview.d.ts.map +1 -0
  76. package/dist/src/labs/index.d.ts +4 -0
  77. package/dist/src/labs/index.d.ts.map +1 -1
  78. package/dist/src/properties/ts/odyssey-react-mui.d.ts +12 -0
  79. package/dist/src/properties/ts/odyssey-react-mui.d.ts.map +1 -1
  80. package/dist/src/theme/components.d.ts.map +1 -1
  81. package/dist/theme/components.js +10 -1
  82. package/dist/theme/components.js.map +1 -1
  83. package/dist/tsconfig.production.tsbuildinfo +1 -1
  84. package/package.json +3 -3
  85. package/src/Badge.tsx +1 -1
  86. package/src/DataTable/DataTable.tsx +293 -85
  87. package/src/DataTable/DataTableEmptyState.tsx +62 -0
  88. package/src/DataTable/DataTablePagination.tsx +289 -0
  89. package/src/DataTable/DataTableRowActions.tsx +35 -37
  90. package/src/DataTable/DataTableSettings.tsx +43 -17
  91. package/src/DataTable/constants.ts +1 -0
  92. package/src/DataTable/index.tsx +7 -1
  93. package/src/DataTable/useRowReordering.tsx +5 -3
  94. package/src/DataTable/useScrollIndication.tsx +118 -0
  95. package/src/Field.tsx +9 -7
  96. package/src/Fieldset.tsx +24 -18
  97. package/src/Form.tsx +43 -27
  98. package/src/MenuButton.tsx +1 -1
  99. package/src/SearchField.tsx +1 -2
  100. package/src/labs/DataFilters.tsx +9 -0
  101. package/src/labs/DataTable.tsx +5 -9
  102. package/src/labs/FileUpload.tsx +301 -0
  103. package/src/labs/FileUploadIllustration.tsx +66 -0
  104. package/src/labs/FileUploadPreview.tsx +150 -0
  105. package/src/labs/index.ts +4 -2
  106. package/src/properties/odyssey-react-mui.properties +18 -0
  107. package/src/properties/ts/odyssey-react-mui.ts +1 -1
  108. package/src/theme/components.tsx +9 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.14.6](https://github.com/okta/odyssey/compare/v1.14.5...v1.14.6) (2024-03-07)
7
+
8
+ **Note:** Version bump only for package @okta/odyssey-react-mui
9
+
10
+ ## [1.14.5](https://github.com/okta/odyssey/compare/v1.14.4...v1.14.5) (2024-03-01)
11
+
12
+ **Note:** Version bump only for package @okta/odyssey-react-mui
13
+
6
14
  ## [1.14.4](https://github.com/okta/odyssey/compare/v1.14.3...v1.14.4) (2024-03-01)
7
15
 
8
16
  **Note:** Version bump only for package @okta/odyssey-react-mui
package/dist/Badge.js CHANGED
@@ -64,7 +64,7 @@ const Badge = ({
64
64
  const hasNotificationCount = badgeContent && badgeContent > 0;
65
65
  return hasNotificationCount ? _jsx(Box, {
66
66
  sx: badgeStyles,
67
- "data-se": testId,
67
+ testId: testId,
68
68
  translate: translate,
69
69
  children: formattedContent
70
70
  }) : null;
package/dist/Badge.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","names":["memo","useMemo","useOdysseyDesignTokens","Box","jsx","_jsx","badgeTypeValues","badgeTypeColors","odysseyTokens","default","background","HueNeutral200","font","TypographyColorBody","attention","PalettePrimaryMain","TypographyColorInverse","danger","PaletteDangerMain","Badge","badgeContent","badgeContentMax","testId","translate","type","odysseyDesignTokens","renderBadge","greaterThanZeroContentMax","threeDigitLimitedMax","isOverContentMax","overContentMaxMessage","formattedContent","toString","badgeStyles","display","alignItems","justifyContent","minWidth","Spacing4","Spacing1","height","minHeight","padding","backgroundColor","color","borderRadius","length","BorderRadiusOuter","fontSize","TypographyScale0","fontFamily","TypographyFamilyMono","fontWeight","TypographyWeightBodyBold","lineHeight","transitionDuration","TransitionDurationMain","transitionProperty","hasNotificationCount","sx","children","MemoizedBadge","displayName"],"sources":["../src/Badge.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { CSSProperties, memo, useMemo } from \"react\";\n\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport { Box } from \"./Box\";\nimport type { HtmlProps } from \"./HtmlProps\";\n\nexport type BadgeContentMax = 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100;\n\nexport const badgeTypeValues = [\"default\", \"attention\", \"danger\"] as const;\n\nexport type BadgeProps = {\n badgeContent: number;\n badgeContentMax?: BadgeContentMax;\n type?: (typeof badgeTypeValues)[number];\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst badgeTypeColors = (odysseyTokens: DesignTokens) => ({\n default: {\n background: odysseyTokens.HueNeutral200,\n font: odysseyTokens.TypographyColorBody,\n },\n attention: {\n background: odysseyTokens.PalettePrimaryMain,\n font: odysseyTokens.TypographyColorInverse,\n },\n danger: {\n background: odysseyTokens.PaletteDangerMain,\n font: odysseyTokens.TypographyColorInverse,\n },\n});\n\nconst Badge = ({\n badgeContent,\n badgeContentMax = 100,\n testId,\n translate,\n type = \"default\",\n}: BadgeProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const renderBadge = useMemo(() => {\n const greaterThanZeroContentMax = badgeContentMax > 0 ? badgeContentMax : 1;\n const threeDigitLimitedMax =\n greaterThanZeroContentMax > 999 ? 999 : greaterThanZeroContentMax;\n const isOverContentMax = badgeContent > threeDigitLimitedMax;\n const overContentMaxMessage = `${greaterThanZeroContentMax}+`;\n const formattedContent = isOverContentMax\n ? overContentMaxMessage\n : badgeContent.toString();\n\n const badgeStyles: CSSProperties = {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n minWidth: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n height: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n minHeight: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n // 6px horizontal padding per design requirements\n padding: \"0 6px\",\n backgroundColor: badgeTypeColors(odysseyDesignTokens)[type].background,\n color: badgeTypeColors(odysseyDesignTokens)[type].font,\n borderRadius:\n formattedContent.length > 1\n ? `${odysseyDesignTokens.BorderRadiusOuter}`\n : \"50%\",\n fontSize: `${odysseyDesignTokens.TypographyScale0}`,\n fontFamily: `${odysseyDesignTokens.TypographyFamilyMono}`,\n fontWeight: `${odysseyDesignTokens.TypographyWeightBodyBold}`,\n lineHeight: 1,\n transitionDuration: `${odysseyDesignTokens.TransitionDurationMain}`,\n transitionProperty: `background-color, color`,\n };\n\n const hasNotificationCount = badgeContent && badgeContent > 0;\n\n return hasNotificationCount ? (\n <Box sx={badgeStyles} data-se={testId} translate={translate}>\n {formattedContent}\n </Box>\n ) : null;\n }, [\n badgeContent,\n badgeContentMax,\n odysseyDesignTokens,\n testId,\n translate,\n type,\n ]);\n\n return renderBadge;\n};\n\nconst MemoizedBadge = memo(Badge);\nMemoizedBadge.displayName = \"Badge\";\n\nexport { MemoizedBadge as Badge };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAwBA,IAAI,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAGnDC,sBAAsB;AAAA,SAGfC,GAAG;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAKZ,OAAO,MAAMC,eAAe,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAU;AAQ1E,MAAMC,eAAe,GAAIC,aAA2B,KAAM;EACxDC,OAAO,EAAE;IACPC,UAAU,EAAEF,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AAO;MAChBC,eAAe,EAAEpC,eAAe,CAACkB,mBAAmB,CAAC,CAACD,IAAI,CAAC,CAACd,UAAU;MACtEkC,KAAK,EAAErC,eAAe,CAACkB,mBAAmB,CAAC,CAACD,IAAI,CAAC,CAACZ,IAAI;MACtDiC,YAAY,EACVd,gBAAgB,CAACe,MAAM,GAAG,CAAC,GACtB,GAAErB,mBAAmB,CAACsB,iBAAkB,EAAC,GAC1C,KAAK;MACXC,QAAQ,EAAG,GAAEvB,mBAAmB,CAACwB,gBAAiB,EAAC;MACnDC,UAAU,EAAG,GAAEzB,mBAAmB,CAAC0B,oBAAqB,EAAC;MACzDC,UAAU,EAAG,GAAE3B,mBAAmB,CAAC4B,wBAAyB,EAAC;MAC7DC,UAAU,EAAE,CAAC;MACbC,kBAAkB,EAAG,GAAE9B,mBAAmB,CAAC+B,sBAAuB,EAAC;MACnEC,kBAAkB,EAAG;IACvB,CAAC;IAED,MAAMC,oBAAoB,GAAGtC,YAAY,IAAIA,YAAY,GAAG,CAAC;IAE7D,OAAOsC,oBAAoB,GACzBrD,IAAA,CAACF,GAAG;MAACwD,EAAE,EAAE1B,WAAY;MAAC,WAASX,MAAO;MAACC,SAAS,EAAEA,SAAU;MAAAqC,QAAA,EACzD7B;IAAgB,CACd,CAAC,GACJ,IAAI;EACV,CAAC,EAAE,CACDX,YAAY,EACZC,eAAe,EACfI,mBAAmB,EACnBH,MAAM,EACNC,SAAS,EACTC,IAAI,CACL,CAAC;EAEF,OAAOE,WAAW;AACpB,CAAC;AAED,MAAMmC,aAAa,GAAG7D,IAAI,CAACmB,KAAK,CAAC;AACjC0C,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAI1C,KAAK"}
1
+ {"version":3,"file":"Badge.js","names":["memo","useMemo","useOdysseyDesignTokens","Box","jsx","_jsx","badgeTypeValues","badgeTypeColors","odysseyTokens","default","background","HueNeutral200","font","TypographyColorBody","attention","PalettePrimaryMain","TypographyColorInverse","danger","PaletteDangerMain","Badge","badgeContent","badgeContentMax","testId","translate","type","odysseyDesignTokens","renderBadge","greaterThanZeroContentMax","threeDigitLimitedMax","isOverContentMax","overContentMaxMessage","formattedContent","toString","badgeStyles","display","alignItems","justifyContent","minWidth","Spacing4","Spacing1","height","minHeight","padding","backgroundColor","color","borderRadius","length","BorderRadiusOuter","fontSize","TypographyScale0","fontFamily","TypographyFamilyMono","fontWeight","TypographyWeightBodyBold","lineHeight","transitionDuration","TransitionDurationMain","transitionProperty","hasNotificationCount","sx","children","MemoizedBadge","displayName"],"sources":["../src/Badge.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { CSSProperties, memo, useMemo } from \"react\";\n\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport { Box } from \"./Box\";\nimport type { HtmlProps } from \"./HtmlProps\";\n\nexport type BadgeContentMax = 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100;\n\nexport const badgeTypeValues = [\"default\", \"attention\", \"danger\"] as const;\n\nexport type BadgeProps = {\n badgeContent: number;\n badgeContentMax?: BadgeContentMax;\n type?: (typeof badgeTypeValues)[number];\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst badgeTypeColors = (odysseyTokens: DesignTokens) => ({\n default: {\n background: odysseyTokens.HueNeutral200,\n font: odysseyTokens.TypographyColorBody,\n },\n attention: {\n background: odysseyTokens.PalettePrimaryMain,\n font: odysseyTokens.TypographyColorInverse,\n },\n danger: {\n background: odysseyTokens.PaletteDangerMain,\n font: odysseyTokens.TypographyColorInverse,\n },\n});\n\nconst Badge = ({\n badgeContent,\n badgeContentMax = 100,\n testId,\n translate,\n type = \"default\",\n}: BadgeProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const renderBadge = useMemo(() => {\n const greaterThanZeroContentMax = badgeContentMax > 0 ? badgeContentMax : 1;\n const threeDigitLimitedMax =\n greaterThanZeroContentMax > 999 ? 999 : greaterThanZeroContentMax;\n const isOverContentMax = badgeContent > threeDigitLimitedMax;\n const overContentMaxMessage = `${greaterThanZeroContentMax}+`;\n const formattedContent = isOverContentMax\n ? overContentMaxMessage\n : badgeContent.toString();\n\n const badgeStyles: CSSProperties = {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n minWidth: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n height: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n minHeight: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n // 6px horizontal padding per design requirements\n padding: \"0 6px\",\n backgroundColor: badgeTypeColors(odysseyDesignTokens)[type].background,\n color: badgeTypeColors(odysseyDesignTokens)[type].font,\n borderRadius:\n formattedContent.length > 1\n ? `${odysseyDesignTokens.BorderRadiusOuter}`\n : \"50%\",\n fontSize: `${odysseyDesignTokens.TypographyScale0}`,\n fontFamily: `${odysseyDesignTokens.TypographyFamilyMono}`,\n fontWeight: `${odysseyDesignTokens.TypographyWeightBodyBold}`,\n lineHeight: 1,\n transitionDuration: `${odysseyDesignTokens.TransitionDurationMain}`,\n transitionProperty: `background-color, color`,\n };\n\n const hasNotificationCount = badgeContent && badgeContent > 0;\n\n return hasNotificationCount ? (\n <Box sx={badgeStyles} testId={testId} translate={translate}>\n {formattedContent}\n </Box>\n ) : null;\n }, [\n badgeContent,\n badgeContentMax,\n odysseyDesignTokens,\n testId,\n translate,\n type,\n ]);\n\n return renderBadge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,IAAI;EACV,CAAC,EAAE,CACDX,YAAY,EACZC,eAAe,EACfI,mBAAmB,EACnBH,MAAM,EACNC,SAAS,EACTC,IAAI,CACL,CAAC;EAEF,OAAOE,WAAW;AACpB,CAAC;AAED,MAAMmC,aAAa,GAAG7D,IAAI,CAACmB,KAAK,CAAC;AACjC0C,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAI1C,KAAK"}
@@ -11,16 +11,25 @@
11
11
  */
12
12
 
13
13
  import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
14
- import { MaterialReactTable, useMaterialReactTable } from "material-react-table";
15
- import { ArrowDownIcon, ArrowUnsortedIcon, DragIndicatorIcon } from "../icons.generated/index.js";
14
+ import { useMaterialReactTable, MRT_TableContainer } from "material-react-table";
15
+ import { ArrowDownIcon, ArrowUnsortedIcon, DragIndicatorIcon, MoreIcon } from "../icons.generated/index.js";
16
16
  import { densityValues } from "./constants.js";
17
- import { DataTablePagination } from "../labs/DataTablePagination.js";
17
+ import { DataTablePagination } from "./DataTablePagination.js";
18
18
  import { DataFilters } from "../labs/DataFilters.js";
19
19
  import { DataTableRowActions } from "./DataTableRowActions.js";
20
20
  import { useRowReordering } from "./useRowReordering.js";
21
21
  import { DataTableSettings } from "./DataTableSettings.js";
22
+ import { MenuButton } from "../MenuButton.js";
22
23
  import { Box } from "../Box.js";
24
+ import { useOdysseyDesignTokens } from "../OdysseyDesignTokensContext.js";
25
+ import { useScrollIndication } from "./useScrollIndication.js";
26
+ import styled from "@emotion/styled";
27
+ import { DataTableEmptyState } from "./DataTableEmptyState.js";
28
+ import { Callout } from "../Callout.js";
29
+ import { t } from "i18next";
23
30
  import { jsx as _jsx } from "react/jsx-runtime";
31
+ import { Fragment as _Fragment } from "react/jsx-runtime";
32
+ import { jsxs as _jsxs } from "react/jsx-runtime";
24
33
  const displayColumnDefOptions = {
25
34
  "mrt-row-actions": {
26
35
  header: "",
@@ -77,6 +86,50 @@ const displayColumnDefOptions = {
77
86
  }
78
87
  }
79
88
  };
89
+ const ScrollableTableContainer = styled("div", {
90
+ shouldForwardProp: prop => prop !== "odysseyDesignTokens" && prop !== "isScrollableStart" && prop !== "isScrollableEnd"
91
+ })(({
92
+ odysseyDesignTokens,
93
+ isScrollableStart,
94
+ isScrollableEnd
95
+ }) => ({
96
+ borderBlockEndColor: odysseyDesignTokens.HueNeutral100,
97
+ borderBlockEndStyle: "solid",
98
+ borderBlockEndWidth: odysseyDesignTokens.BorderWidthMain,
99
+ marginBlockEnd: odysseyDesignTokens.Spacing4,
100
+ position: "relative",
101
+ borderInlineStartColor: isScrollableStart ? odysseyDesignTokens.HueNeutral200 : "transparent",
102
+ borderInlineStartStyle: "solid",
103
+ borderInlineStartWidth: odysseyDesignTokens.BorderWidthMain,
104
+ "::before": {
105
+ background: "linear-gradient(-90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.33) 50%, rgba(0, 0, 0, 1) 100%)",
106
+ content: '""',
107
+ opacity: isScrollableStart ? "0.075" : "0",
108
+ pointerEvents: "none",
109
+ position: "absolute",
110
+ top: 0,
111
+ left: 0,
112
+ bottom: 0,
113
+ width: odysseyDesignTokens.Spacing6,
114
+ zIndex: 100,
115
+ transition: `opacity ${odysseyDesignTokens.TransitionDurationMain} ${odysseyDesignTokens.TransitionTimingMain}`
116
+ },
117
+ borderInlineEndColor: isScrollableEnd ? odysseyDesignTokens.HueNeutral200 : "transparent",
118
+ borderInlineEndStyle: "solid",
119
+ borderInlineEndWidth: odysseyDesignTokens.BorderWidthMain,
120
+ "::after": {
121
+ background: "linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.33) 50%, rgba(0, 0, 0, 1) 100%)",
122
+ content: '""',
123
+ opacity: isScrollableEnd ? "0.075" : "0",
124
+ pointerEvents: "none",
125
+ position: "absolute",
126
+ top: 0,
127
+ right: 0,
128
+ bottom: 0,
129
+ width: odysseyDesignTokens.Spacing6,
130
+ transition: `opacity ${odysseyDesignTokens.TransitionDurationMain} ${odysseyDesignTokens.TransitionTimingMain}`
131
+ }
132
+ }));
80
133
  const DataTable = ({
81
134
  columns,
82
135
  getRowId: getRowIdProp,
@@ -100,7 +153,11 @@ const DataTable = ({
100
153
  hasRowReordering,
101
154
  hasRowSelection,
102
155
  hasSearch,
103
- hasSorting
156
+ hasSorting,
157
+ bulkActionMenuItems,
158
+ errorMessage: errorMessageProp,
159
+ emptyPlaceholder,
160
+ noResultsPlaceholder
104
161
  }) => {
105
162
  const [data, setData] = useState([]);
106
163
  const [pagination, setPagination] = useState({
@@ -108,11 +165,30 @@ const DataTable = ({
108
165
  pageSize: resultsPerPage
109
166
  });
110
167
  const [draggingRow, setDraggingRow] = useState();
168
+ const [isTableContainerScrolledToStart, setIsTableContainerScrolledToStart] = useState(true);
169
+ const [isTableContainerScrolledToEnd, setIsTableContainerScrolledToEnd] = useState(true);
170
+ const [tableInnerContainerWidth, setTableInnerContainerWidth] = useState("100%");
171
+ const tableOuterContainerRef = useRef(null);
172
+ const tableInnerContainerRef = useRef(null);
173
+ const tableContentRef = useRef(null);
111
174
  const [columnSorting, setColumnSorting] = useState([]);
112
175
  const [columnVisibility, setColumnVisibility] = useState();
113
176
  const [rowDensity, setRowDensity] = useState(initialDensity);
177
+ const [rowSelection, setRowSelection] = useState({});
114
178
  const [search, setSearch] = useState("");
115
179
  const [filters, setFilters] = useState();
180
+ const [initialFilters, setInitialFilters] = useState();
181
+ const [isLoading, setIsLoading] = useState(true);
182
+ const [isEmpty, setIsEmpty] = useState();
183
+ const [errorMessage, setErrorMessage] = useState(errorMessageProp);
184
+ useScrollIndication({
185
+ tableOuterContainer: tableOuterContainerRef.current,
186
+ tableInnerContainer: tableInnerContainerRef.current,
187
+ setIsTableContainerScrolledToStart: setIsTableContainerScrolledToStart,
188
+ setIsTableContainerScrolledToEnd: setIsTableContainerScrolledToEnd,
189
+ setTableInnerContainerWidth: setTableInnerContainerWidth
190
+ });
191
+ const odysseyDesignTokens = useOdysseyDesignTokens();
116
192
  const {
117
193
  dragHandleStyles,
118
194
  dragHandleText,
@@ -170,6 +246,19 @@ const DataTable = ({
170
246
  children: value
171
247
  });
172
248
  }, []);
249
+ const emptyState = useCallback(() => {
250
+ const noResultsInnerContent = noResultsPlaceholder || _jsx(DataTableEmptyState, {
251
+ heading: t("table.noresults.heading"),
252
+ text: t("table.noresults.text")
253
+ });
254
+ const emptyStateInnerContent = emptyPlaceholder && isEmpty ? emptyPlaceholder : noResultsInnerContent;
255
+ return _jsx(Box, {
256
+ sx: {
257
+ width: tableInnerContainerWidth
258
+ },
259
+ children: emptyStateInnerContent
260
+ });
261
+ }, [tableInnerContainerWidth, emptyPlaceholder, noResultsPlaceholder, isEmpty]);
173
262
  const dataTable = useMaterialReactTable({
174
263
  columns: columns,
175
264
  data: data,
@@ -178,7 +267,9 @@ const DataTable = ({
178
267
  density: rowDensity,
179
268
  sorting: columnSorting,
180
269
  globalFilter: search,
181
- columnVisibility
270
+ columnVisibility,
271
+ isLoading,
272
+ rowSelection
182
273
  },
183
274
  icons: {
184
275
  ArrowDownwardIcon: ArrowDownIcon,
@@ -245,6 +336,7 @@ const DataTable = ({
245
336
  row
246
337
  }),
247
338
  enableRowSelection: hasRowSelection,
339
+ onRowSelectionChange: setRowSelection,
248
340
  enableSorting: hasSorting,
249
341
  onSortingChange: setColumnSorting,
250
342
  muiTableHeadCellProps: ({
@@ -252,62 +344,32 @@ const DataTable = ({
252
344
  }) => ({
253
345
  className: columnSorting.find(sortedColumn => sortedColumn.id === currentColumn.id) ? "isSorted" : "isUnsorted"
254
346
  }),
255
- enableRowVirtualization: paginationType === "loadMore" || pagination.pageSize > 50,
347
+ enableRowVirtualization: paginationType !== "loadMore" && pagination.pageSize > 50,
256
348
  rowVirtualizerInstanceRef: useRef(null),
257
349
  rowVirtualizerOptions: {
258
350
  overscan: 4
259
351
  },
260
- renderTopToolbar: () => _jsx(Box, {
261
- sx: {
262
- marginBottom: 5
263
- },
264
- children: _jsx(DataFilters, {
265
- onChangeSearch: hasSearch ? setSearch : undefined,
266
- onChangeFilters: hasFilters ? setFilters : undefined,
267
- hasSearchSubmitButton: hasSearchSubmitButton,
268
- searchDelayTime: searchDelayTime,
269
- filters: hasFilters ? dataTableFilters : undefined,
270
- additionalActions: _jsx(DataTableSettings, {
271
- hasChangeableDensity: hasChangeableDensity,
272
- rowDensity: rowDensity,
273
- setRowDensity: setRowDensity,
274
- hasColumnVisibility: hasColumnVisibility,
275
- columns: columns,
276
- columnVisibility: columnVisibility,
277
- setColumnVisibility: setColumnVisibility
278
- })
279
- })
280
- }),
281
- renderBottomToolbar: hasPagination ? () => _jsx(DataTablePagination, {
282
- paginationType: paginationType,
283
- currentNumberOfResults: data.length,
284
- currentPage: pagination.pageIndex,
285
- isPreviousButtonDisabled: pagination.pageIndex <= 1,
286
- isNextButtonDisabled: false,
287
- onClickPrevious: () => setPagination({
288
- pageIndex: pagination.pageIndex - 1,
289
- pageSize: pagination.pageSize
290
- }),
291
- onClickNext: () => {
292
- if (paginationType === "loadMore") {
293
- setPagination({
294
- pageSize: pagination.pageSize,
295
- pageIndex: pagination.pageSize + resultsPerPage
296
- });
297
- } else {
298
- setPagination({
299
- pageSize: pagination.pageSize,
300
- pageIndex: pagination.pageIndex + 1
301
- });
302
- }
303
- }
304
- }) : undefined
352
+ renderEmptyRowsFallback: emptyState,
353
+ muiTableProps: {
354
+ ref: tableContentRef
355
+ },
356
+ muiTableContainerProps: {
357
+ ref: tableInnerContainerRef
358
+ }
305
359
  });
306
- useEffect(() => {
307
- onChangeRowSelection?.(dataTable.getState().rowSelection);
308
- }, [dataTable.getState().rowSelection, dataTable, onChangeRowSelection]);
360
+ const bulkActionMenuButton = useMemo(() => _jsx(_Fragment, {
361
+ children: _jsx(MenuButton, {
362
+ buttonVariant: "secondary",
363
+ endIcon: _jsx(MoreIcon, {}),
364
+ isDisabled: Object.keys(rowSelection).length === 0,
365
+ ariaLabel: "More actions",
366
+ children: bulkActionMenuItems?.(rowSelection)
367
+ })
368
+ }), [bulkActionMenuItems, rowSelection]);
309
369
  useEffect(() => {
310
370
  (async () => {
371
+ setIsLoading(true);
372
+ setErrorMessage(errorMessageProp);
311
373
  try {
312
374
  const incomingData = await getData?.({
313
375
  page: pagination.pageIndex,
@@ -317,11 +379,69 @@ const DataTable = ({
317
379
  sort: columnSorting
318
380
  });
319
381
  setData(incomingData);
320
- } catch (error) {} finally {}
382
+ } catch (error) {
383
+ setErrorMessage(typeof error === "string" ? error : t("table.error"));
384
+ } finally {
385
+ setIsLoading(false);
386
+ }
321
387
  })();
322
- }, [pagination, columnSorting, search, filters, getData]);
323
- return _jsx(MaterialReactTable, {
324
- table: dataTable
388
+ }, [pagination, columnSorting, search, filters, getData, errorMessageProp]);
389
+ useEffect(() => {
390
+ if (!initialFilters && filters) {
391
+ setInitialFilters(filters);
392
+ }
393
+ setIsEmpty(pagination.pageIndex === currentPage && pagination.pageSize === resultsPerPage && search === "" && filters === initialFilters && data.length === 0);
394
+ }, [filters, pagination, search, data, currentPage, initialFilters, resultsPerPage]);
395
+ useEffect(() => {
396
+ onChangeRowSelection?.(rowSelection);
397
+ }, [rowSelection, onChangeRowSelection]);
398
+ return _jsxs(_Fragment, {
399
+ children: [(hasSearch || hasFilters || hasChangeableDensity || hasColumnVisibility || bulkActionMenuItems) && _jsx(Box, {
400
+ sx: {
401
+ marginBottom: 5
402
+ },
403
+ children: _jsx(DataFilters, {
404
+ onChangeSearch: hasSearch ? setSearch : undefined,
405
+ onChangeFilters: hasFilters ? setFilters : undefined,
406
+ hasSearchSubmitButton: hasSearchSubmitButton,
407
+ searchDelayTime: searchDelayTime,
408
+ filters: hasFilters ? dataTableFilters : undefined,
409
+ isDisabled: isEmpty,
410
+ additionalActions: _jsxs(_Fragment, {
411
+ children: [_jsx(DataTableSettings, {
412
+ hasChangeableDensity: hasChangeableDensity,
413
+ rowDensity: rowDensity,
414
+ setRowDensity: setRowDensity,
415
+ hasColumnVisibility: hasColumnVisibility,
416
+ columns: columns,
417
+ columnVisibility: columnVisibility,
418
+ setColumnVisibility: setColumnVisibility
419
+ }), bulkActionMenuItems && bulkActionMenuButton]
420
+ })
421
+ })
422
+ }), errorMessage && _jsx(Box, {
423
+ sx: {
424
+ marginBlockEnd: 2
425
+ },
426
+ children: _jsx(Callout, {
427
+ severity: "error",
428
+ text: errorMessage
429
+ })
430
+ }), _jsx(ScrollableTableContainer, {
431
+ odysseyDesignTokens: odysseyDesignTokens,
432
+ isScrollableStart: !isTableContainerScrolledToStart,
433
+ isScrollableEnd: !isTableContainerScrolledToEnd,
434
+ ref: tableOuterContainerRef,
435
+ children: _jsx(MRT_TableContainer, {
436
+ table: dataTable
437
+ })
438
+ }), hasPagination && _jsx(DataTablePagination, {
439
+ pagination: pagination,
440
+ setPagination: setPagination,
441
+ totalRows: totalRows,
442
+ isDisabled: isEmpty,
443
+ variant: paginationType
444
+ })]
325
445
  });
326
446
  };
327
447
  const MemoizedDataTable = memo(DataTable);
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.js","names":["memo","useCallback","useEffect","useMemo","useRef","useState","MaterialReactTable","useMaterialReactTable","ArrowDownIcon","ArrowUnsortedIcon","DragIndicatorIcon","densityValues","DataTablePagination","DataFilters","DataTableRowActions","useRowReordering","DataTableSettings","Box","jsx","_jsx","displayColumnDefOptions","header","grow","muiTableBodyCellProps","align","sx","overflow","width","className","muiTableHeadCellProps","minWidth","children","marginInline","opacity","padding","DataTable","columns","getRowId","getRowIdProp","currentPage","initialDensity","resultsPerPage","getData","onReorderRows","totalRows","hasSearchSubmitButton","searchDelayTime","paginationType","onChangeRowSelection","rowActionButtons","rowActionMenuItems","hasChangeableDensity","hasColumnResizing","hasColumnVisibility","hasFilters","hasPagination","hasRowReordering","hasRowSelection","hasSearch","hasSorting","data","setData","pagination","setPagination","pageIndex","pageSize","draggingRow","setDraggingRow","columnSorting","setColumnSorting","columnVisibility","setColumnVisibility","rowDensity","setRowDensity","search","setSearch","filters","setFilters","dragHandleStyles","dragHandleText","draggableTableBodyRowClassName","handleDragHandleKeyDown","handleDragHandleOnDragCapture","handleDragHandleOnDragEnd","resetDraggingAndHoveredRow","updateRowOrder","page","row","id","rowDensityCellClassName","renderRowActions","currentIndex","index","rowIndex","undefined","dataTableFilters","filter","column","enableColumnFilter","map","accessorKey","label","variant","filterVariant","options","filterSelectOptions","defaultCell","cell","value","getValue","whiteSpace","textOverflow","dataTable","state","density","sorting","globalFilter","icons","ArrowDownwardIcon","DragHandleIcon","SyncAltIcon","enableColumnActions","enableColumnResizing","enableDensityToggle","enableFilters","enableFullScreenToggle","enableGlobalFilter","enableHiding","enablePagination","layoutMode","manualFiltering","manualSorting","muiTablePaperProps","elevation","selectAllMode","defaultColumn","Cell","enableRowOrdering","Boolean","enableRowDragging","muiTableBodyRowProps","table","currentRowId","draggingRowId","hoveredRowId","getState","hoveredRow","muiRowDragHandleProps","onKeyDown","event","onBlur","onDragEnd","onDragCapture","enableRowActions","positionActionsColumn","enableRowSelection","enableSorting","onSortingChange","currentColumn","find","sortedColumn","enableRowVirtualization","rowVirtualizerInstanceRef","rowVirtualizerOptions","overscan","renderTopToolbar","marginBottom","onChangeSearch","onChangeFilters","additionalActions","renderBottomToolbar","currentNumberOfResults","length","isPreviousButtonDisabled","isNextButtonDisabled","onClickPrevious","onClickNext","rowSelection","incomingData","sort","error","MemoizedDataTable","displayName"],"sources":["../../src/DataTable/DataTable.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport {\n MRT_Cell,\n MRT_DensityState,\n MRT_Row,\n MRT_RowData,\n MRT_SortingState,\n MRT_TableOptions,\n MRT_Virtualizer,\n MRT_VisibilityState,\n MaterialReactTable,\n useMaterialReactTable,\n} from \"material-react-table\";\nimport {\n ArrowDownIcon,\n ArrowUnsortedIcon,\n DragIndicatorIcon,\n} from \"../icons.generated\";\nimport { densityValues } from \"./constants\";\nimport {\n DataTablePagination,\n paginationTypeValues,\n} from \"../labs/DataTablePagination\";\nimport { DataFilter, DataFilters } from \"../labs/DataFilters\";\nimport {\n DataTableRowActions,\n DataTableRowActionsProps,\n} from \"./DataTableRowActions\";\nimport { useRowReordering } from \"./useRowReordering\";\nimport { DataTableSettings } from \"./DataTableSettings\";\nimport { Box } from \"../Box\";\nimport { DataTableRowSelectionState } from \".\";\n\nexport type DataTableProps = {\n /**\n * The columns that make up the table\n */\n columns: MRT_TableOptions<MRT_RowData>[\"columns\"];\n /**\n * The total number of rows in the table. Optional, because it's sometimes impossible\n * to calculate. Used in table pagination to know when to disable the \"next\"/\"more\" button.\n */\n totalRows?: number;\n /**\n * The function to get the ID of a row\n */\n getRowId?: MRT_TableOptions<MRT_RowData>[\"getRowId\"];\n /**\n * The initial density of the table. This is available even if the table density\n * isn't changeable.\n */\n initialDensity?: (typeof densityValues)[number];\n /**\n * If true, the end user will be able to change the table density.\n */\n hasChangeableDensity?: boolean;\n /**\n * If true, the end user can resize individual columns.\n */\n hasColumnResizing?: boolean;\n /**\n * If true, the end user will be able to show/hide columns.\n */\n hasColumnVisibility?: boolean;\n /**\n * If true, the end user will be able to filter columns.\n */\n hasFilters?: boolean;\n /**\n * If true, the table will include pagination controls.\n */\n hasPagination?: boolean;\n /**\n * If true, the table will include checkboxes on each row, enabling\n * the user to select some or all rows.\n */\n hasRowSelection?: boolean;\n /**\n * If true, the global table search controls will be shown.\n */\n hasSearch?: boolean;\n /**\n * If true, the end user can sort columns (ascending, descending, or neither)\n */\n hasSorting?: boolean;\n /**\n * If true, the end user can reorder rows via a drag-and-drop interface\n */\n hasRowReordering?: boolean;\n /**\n * If true, the search field will include a Search button, rather than\n * firing on input change.\n */\n hasSearchSubmitButton?: boolean;\n /**\n * The debounce time, in milliseconds, for the search input firing\n * `onChangeSearch` when changed. If `hasSearchSubmitButton` is true,\n * this doesn't do anything.\n */\n searchDelayTime?: number;\n /**\n * Callback that fires when a row (or rows) is selected or unselected.\n */\n onChangeRowSelection?: (rowSelection: DataTableRowSelectionState) => void;\n /**\n * Callback that fires whenever the table needs to fetch new data, due to changes in\n * page, results per page, search input, filters, or sorting\n */\n getData: ({\n page,\n resultsPerPage,\n search,\n filters,\n sort,\n }: {\n page?: number;\n resultsPerPage?: number;\n search?: string;\n filters?: DataFilter[];\n sort?: MRT_SortingState;\n }) =>\n | MRT_TableOptions<MRT_RowData>[\"data\"]\n | Promise<MRT_TableOptions<MRT_RowData>[\"data\"]>;\n /**\n * Callback that fires when the user reorders rows within the table. Can be used\n * to propogate order change to the backend.\n */\n onReorderRows?: ({\n rowId,\n newRowIndex,\n }: {\n rowId: string;\n newRowIndex: number;\n }) => void;\n /**\n * The current page number.\n */\n currentPage?: number;\n /**\n * The number of results per page.\n */\n resultsPerPage?: number;\n /**\n * The type of pagination controls shown. Defaults to next/prev buttons, but can be\n * set to a simple \"Load more\" button by setting to \"loadMore\".\n */\n paginationType?: (typeof paginationTypeValues)[number];\n /**\n * Action buttons to display in each row\n */\n rowActionButtons?: DataTableRowActionsProps[\"rowActionButtons\"];\n /**\n * Menu items to include in the optional actions menu on each row.\n */\n rowActionMenuItems?: DataTableRowActionsProps[\"rowActionMenuItems\"];\n};\n\nconst displayColumnDefOptions = {\n \"mrt-row-actions\": {\n header: \"\",\n grow: true,\n muiTableBodyCellProps: {\n align: \"right\",\n sx: {\n overflow: \"visible\",\n width: \"unset\",\n },\n className: \"ods-actions-cell\",\n },\n muiTableHeadCellProps: {\n align: \"right\",\n sx: {\n width: \"unset\",\n },\n className: \"ods-actions-cell\",\n },\n },\n \"mrt-row-drag\": {\n header: \"\",\n muiTableBodyCellProps: {\n sx: {\n minWidth: 0,\n width: \"auto\",\n },\n className: \"ods-drag-handle\",\n },\n muiTableHeadCellProps: {\n sx: {\n minWidth: 0,\n width: \"auto\",\n },\n children: (\n // Add a spacer to simulate the width of the drag handle in the column.\n // Without this, the head cells are offset from their body cell counterparts\n <Box sx={{ marginInline: \"-0.1rem\" }}>\n <DragIndicatorIcon sx={{ marginInline: 1, opacity: 0 }} />\n </Box>\n ),\n },\n },\n \"mrt-row-select\": {\n muiTableHeadCellProps: {\n padding: \"checkbox\",\n },\n muiTableBodyCellProps: {\n padding: \"checkbox\",\n },\n },\n};\n\nconst DataTable = ({\n columns,\n getRowId: getRowIdProp,\n currentPage = 1,\n initialDensity = densityValues[0],\n resultsPerPage = 20,\n getData,\n onReorderRows,\n totalRows,\n hasSearchSubmitButton,\n searchDelayTime,\n paginationType = \"paged\",\n onChangeRowSelection,\n rowActionButtons,\n rowActionMenuItems,\n hasChangeableDensity,\n hasColumnResizing,\n hasColumnVisibility,\n hasFilters,\n hasPagination,\n hasRowReordering,\n hasRowSelection,\n hasSearch,\n hasSorting,\n}: DataTableProps) => {\n const [data, setData] = useState<MRT_RowData[]>([]);\n const [pagination, setPagination] = useState({\n pageIndex: currentPage,\n pageSize: resultsPerPage,\n });\n const [draggingRow, setDraggingRow] = useState<MRT_Row<MRT_RowData> | null>();\n\n // Table states\n const [columnSorting, setColumnSorting] = useState<MRT_SortingState>([]);\n const [columnVisibility, setColumnVisibility] =\n useState<MRT_VisibilityState>();\n const [rowDensity, setRowDensity] =\n useState<MRT_DensityState>(initialDensity);\n const [search, setSearch] = useState<string>(\"\");\n const [filters, setFilters] = useState<DataFilter[]>();\n\n const {\n dragHandleStyles,\n dragHandleText,\n draggableTableBodyRowClassName,\n handleDragHandleKeyDown,\n handleDragHandleOnDragCapture,\n handleDragHandleOnDragEnd,\n resetDraggingAndHoveredRow,\n updateRowOrder,\n } = useRowReordering({\n totalRows,\n onReorderRows,\n data,\n setData,\n draggingRow,\n setDraggingRow,\n resultsPerPage: pagination.pageSize,\n page: pagination.pageIndex,\n });\n\n const getRowId = getRowIdProp ? getRowIdProp : (row: MRT_RowData) => row.id;\n\n const rowDensityCellClassName = useMemo(() => {\n return rowDensity === \"spacious\"\n ? \"MuiTableCell-spacious\"\n : rowDensity === \"compact\"\n ? \"MuiTableCell-compact\"\n : \"MuiTableCell-default\";\n }, [rowDensity]);\n\n const renderRowActions = useCallback(\n ({ row }: { row: MRT_Row<MRT_RowData> }) => {\n const currentIndex =\n row.index + (pagination.pageIndex - 1) * pagination.pageSize;\n return (\n <DataTableRowActions\n row={row}\n rowIndex={currentIndex}\n rowActionButtons={rowActionButtons}\n rowActionMenuItems={rowActionMenuItems}\n totalRows={totalRows}\n updateRowOrder={\n hasRowReordering && onReorderRows ? updateRowOrder : undefined\n }\n />\n );\n },\n [\n pagination,\n rowActionButtons,\n rowActionMenuItems,\n hasRowReordering,\n onReorderRows,\n totalRows,\n updateRowOrder,\n ],\n );\n\n const dataTableFilters = useMemo(\n () =>\n columns\n .filter((column) => column.enableColumnFilter !== false)\n .map((column) => {\n return {\n id: column.accessorKey as string,\n label: column.header,\n variant: column.filterVariant ?? \"text\",\n options: column.filterSelectOptions,\n } as DataFilter;\n }),\n [columns],\n );\n\n const defaultCell = useCallback(\n ({ cell }: { cell: MRT_Cell<MRT_RowData> }) => {\n const value = cell.getValue<string>();\n return (\n <Box\n sx={{\n whiteSpace: \"nowrap\",\n textOverflow: \"ellipsis\",\n overflow: \"hidden\",\n }}\n >\n {value}\n </Box>\n );\n },\n [],\n );\n\n const dataTable = useMaterialReactTable({\n columns: columns,\n data: data,\n getRowId: getRowId,\n state: {\n density: rowDensity,\n sorting: columnSorting,\n globalFilter: search,\n columnVisibility,\n },\n icons: {\n ArrowDownwardIcon: ArrowDownIcon,\n DragHandleIcon: DragIndicatorIcon,\n SyncAltIcon: ArrowUnsortedIcon,\n },\n\n // Base table settings\n enableColumnActions: false,\n enableColumnResizing: hasColumnResizing,\n enableDensityToggle: false,\n enableFilters: false,\n enableFullScreenToggle: false,\n enableGlobalFilter: false,\n enableHiding: false,\n enablePagination: false,\n layoutMode: \"grid-no-grow\",\n manualFiltering: true,\n manualSorting: true,\n muiTablePaperProps: {\n elevation: 0,\n sx: {\n overflow: \"visible\",\n },\n },\n selectAllMode: \"all\",\n displayColumnDefOptions:\n displayColumnDefOptions as MRT_TableOptions<MRT_RowData>[\"displayColumnDefOptions\"],\n muiTableBodyCellProps: () => ({\n className: rowDensityCellClassName,\n }),\n defaultColumn: {\n Cell: defaultCell,\n },\n\n // Reordering\n enableRowOrdering: hasRowReordering && Boolean(onReorderRows),\n enableRowDragging: hasRowReordering && Boolean(onReorderRows),\n muiTableBodyRowProps: ({ table, row }) => ({\n className: draggableTableBodyRowClassName({\n currentRowId: row.id,\n draggingRowId: draggingRow?.id,\n hoveredRowId: table.getState().hoveredRow?.id,\n }),\n }),\n muiRowDragHandleProps: ({ table, row }) => ({\n onKeyDown: (event) => handleDragHandleKeyDown({ table, row, event }),\n onBlur: () => resetDraggingAndHoveredRow(table),\n onDragEnd: () => handleDragHandleOnDragEnd(table),\n onDragCapture: () => handleDragHandleOnDragCapture(table),\n sx: dragHandleStyles,\n ...dragHandleText,\n }),\n\n // Row actions\n enableRowActions:\n (hasRowReordering === true && onReorderRows) ||\n rowActionButtons ||\n rowActionMenuItems\n ? true\n : false,\n positionActionsColumn:\n \"last\" as MRT_TableOptions<MRT_RowData>[\"positionActionsColumn\"],\n renderRowActions: ({ row }) => renderRowActions({ row }),\n\n // Row selection\n enableRowSelection: hasRowSelection,\n\n // Sorting\n enableSorting: hasSorting,\n onSortingChange: setColumnSorting,\n muiTableHeadCellProps: ({ column: currentColumn }) => ({\n className: columnSorting.find(\n (sortedColumn) => sortedColumn.id === currentColumn.id,\n )\n ? \"isSorted\"\n : \"isUnsorted\",\n }),\n\n // Virtualization\n enableRowVirtualization:\n paginationType === \"loadMore\" || pagination.pageSize > 50,\n rowVirtualizerInstanceRef:\n useRef<MRT_Virtualizer<HTMLDivElement, HTMLTableRowElement>>(null),\n rowVirtualizerOptions: {\n overscan: 4,\n },\n\n // Filters\n renderTopToolbar: () => (\n <Box sx={{ marginBottom: 5 }}>\n <DataFilters\n onChangeSearch={hasSearch ? setSearch : undefined}\n onChangeFilters={hasFilters ? setFilters : undefined}\n hasSearchSubmitButton={hasSearchSubmitButton}\n searchDelayTime={searchDelayTime}\n filters={hasFilters ? dataTableFilters : undefined}\n additionalActions={\n <DataTableSettings\n hasChangeableDensity={hasChangeableDensity}\n rowDensity={rowDensity}\n setRowDensity={setRowDensity}\n hasColumnVisibility={hasColumnVisibility}\n columns={columns}\n columnVisibility={columnVisibility}\n setColumnVisibility={setColumnVisibility}\n />\n }\n />\n </Box>\n ),\n\n // Pagination\n renderBottomToolbar: hasPagination\n ? () => (\n <DataTablePagination\n paginationType={paginationType}\n currentNumberOfResults={data.length}\n currentPage={pagination.pageIndex}\n isPreviousButtonDisabled={pagination.pageIndex <= 1}\n isNextButtonDisabled={false} // TODO: Add logic for disabling next/load more button\n onClickPrevious={() =>\n setPagination({\n pageIndex: pagination.pageIndex - 1,\n pageSize: pagination.pageSize,\n })\n }\n onClickNext={() => {\n if (paginationType === \"loadMore\") {\n setPagination({\n pageSize: pagination.pageSize,\n pageIndex: pagination.pageSize + resultsPerPage,\n });\n } else {\n setPagination({\n pageSize: pagination.pageSize,\n pageIndex: pagination.pageIndex + 1,\n });\n }\n }}\n />\n )\n : undefined,\n });\n\n // Effects\n useEffect(() => {\n onChangeRowSelection?.(dataTable.getState().rowSelection);\n }, [dataTable.getState().rowSelection, dataTable, onChangeRowSelection]);\n\n useEffect(() => {\n (async () => {\n try {\n const incomingData = await getData?.({\n page: pagination.pageIndex,\n resultsPerPage: pagination.pageSize,\n search,\n filters,\n sort: columnSorting,\n });\n setData(incomingData);\n } catch (error) {\n } finally {\n }\n })();\n }, [pagination, columnSorting, search, filters, getData]);\n\n // Render the table\n return <MaterialReactTable table={dataTable} />;\n};\n\nconst MemoizedDataTable = memo(DataTable);\nMemoizedDataTable.displayName = \"DataTable\";\n\nexport { MemoizedDataTable as DataTable };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC/E,SASEC,kBAAkB,EAClBC,qBAAqB,QAChB,sBAAsB;AAAC,SAE5BC,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB;AAAA,SAEVC,aAAa;AAAA,SAEpBC,mBAAmB;AAAA,SAGAC,WAAW;AAAA,SAE9BC,mBAAmB;AAAA,SAGZC,gBAAgB;AAAA,SAChBC,iBAAiB;AAAA,SACjBC,GAAG;AAAA,SAAAC,GAAA,IAAAC,IAAA;AA+HZ,MAAMC,uBAAuB,GAAG;EAC9B,iBAAiB,EAAE;IACjBC,MAAM,EAAE,EAAE;IACVC,IAAI,EAAE,IAAI;IACVC,qBAAqB,EAAE;MACrBC,KAAK,EAAE,OAAO;MACdC,EAAE,EAAE;QACFC,QAAQ,EAAE,SAAS;QACnBC,KAAK,EAAE;MACT,CAAC;MACDC,SAAS,EAAE;IACb,CAAC;IACDC,qBAAqB,EAAE;MACrBL,KAAK,EAAE,OAAO;MACdC,EAAE,EAAE;QACFE,KAAK,EAAE;MACT,CAAC;MACDC,SAAS,EAAE;IACb;EACF,CAAC;EACD,cAAc,EAAE;IACdP,MAAM,EAAE,EAAE;IACVE,qBAAqB,EAAE;MACrBE,EAAE,EAAE;QACFK,QAAQ,EAAE,CAAC;QACXH,KAAK,EAAE;MACT,CAAC;MACDC,SAAS,EAAE;IACb,CAAC;IACDC,qBAAqB,EAAE;MACrBJ,EAAE,EAAE;QACFK,QAAQ,EAAE,CAAC;QACXH,KAAK,EAAE;MACT,CAAC;MACDI,QAAQ,EAGNZ,IAAA,CAAC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CACH,CACF,GACD8B;EACN,CAAC,CAAC;EAGF5F,SAAS,CAAC,MAAM;IACd8C,oBAAoB,GAAGgE,SAAS,CAACiC,QAAQ,CAAC,CAAC,CAACgC,YAAY,CAAC;EAC3D,CAAC,EAAE,CAACjE,SAAS,CAACiC,QAAQ,CAAC,CAAC,CAACgC,YAAY,EAAEjE,SAAS,EAAEhE,oBAAoB,CAAC,CAAC;EAExE9C,SAAS,CAAC,MAAM;IACd,CAAC,YAAY;MACX,IAAI;QACF,MAAMgL,YAAY,GAAG,MAAMxI,OAAO,GAAG;UACnC4C,IAAI,EAAExB,UAAU,CAACE,SAAS;UAC1BvB,cAAc,EAAEqB,UAAU,CAACG,QAAQ;UACnCS,MAAM;UACNE,OAAO;UACPuG,IAAI,EAAE/G;QACR,CAAC,CAAC;QACFP,OAAO,CAACqH,YAAY,CAAC;MACvB,CAAC,CAAC,OAAOE,KAAK,EAAE,CAChB,CAAC,SAAS,CACV;IACF,CAAC,EAAE,CAAC;EACN,CAAC,EAAE,CAACtH,UAAU,EAAEM,aAAa,EAAEM,MAAM,EAAEE,OAAO,EAAElC,OAAO,CAAC,CAAC;EAGzD,OAAOvB,IAAA,CAACb,kBAAkB;IAACuI,KAAK,EAAE7B;EAAU,CAAE,CAAC;AACjD,CAAC;AAED,MAAMqE,iBAAiB,GAAGrL,IAAI,CAACmC,SAAS,CAAC;AACzCkJ,iBAAiB,CAACC,WAAW,GAAG,WAAW;AAE3C,SAASD,iBAAiB,IAAIlJ,SAAS"}
1
+ {"version":3,"file":"DataTable.js","names":["memo","useCallback","useEffect","useMemo","useRef","useState","useMaterialReactTable","MRT_TableContainer","ArrowDownIcon","ArrowUnsortedIcon","DragIndicatorIcon","MoreIcon","densityValues","DataTablePagination","DataFilters","DataTableRowActions","useRowReordering","DataTableSettings","MenuButton","Box","useOdysseyDesignTokens","useScrollIndication","styled","DataTableEmptyState","Callout","t","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","displayColumnDefOptions","header","grow","muiTableBodyCellProps","align","sx","overflow","width","className","muiTableHeadCellProps","minWidth","children","marginInline","opacity","padding","ScrollableTableContainer","shouldForwardProp","prop","odysseyDesignTokens","isScrollableStart","isScrollableEnd","borderBlockEndColor","HueNeutral100","borderBlockEndStyle","borderBlockEndWidth","BorderWidthMain","marginBlockEnd","Spacing4","position","borderInlineStartColor","HueNeutral200","borderInlineStartStyle","borderInlineStartWidth","background","content","pointerEvents","top","left","bottom","Spacing6","zIndex","transition","TransitionDurationMain","TransitionTimingMain","borderInlineEndColor","borderInlineEndStyle","borderInlineEndWidth","right","DataTable","columns","getRowId","getRowIdProp","currentPage","initialDensity","resultsPerPage","getData","onReorderRows","totalRows","hasSearchSubmitButton","searchDelayTime","paginationType","onChangeRowSelection","rowActionButtons","rowActionMenuItems","hasChangeableDensity","hasColumnResizing","hasColumnVisibility","hasFilters","hasPagination","hasRowReordering","hasRowSelection","hasSearch","hasSorting","bulkActionMenuItems","errorMessage","errorMessageProp","emptyPlaceholder","noResultsPlaceholder","data","setData","pagination","setPagination","pageIndex","pageSize","draggingRow","setDraggingRow","isTableContainerScrolledToStart","setIsTableContainerScrolledToStart","isTableContainerScrolledToEnd","setIsTableContainerScrolledToEnd","tableInnerContainerWidth","setTableInnerContainerWidth","tableOuterContainerRef","tableInnerContainerRef","tableContentRef","columnSorting","setColumnSorting","columnVisibility","setColumnVisibility","rowDensity","setRowDensity","rowSelection","setRowSelection","search","setSearch","filters","setFilters","initialFilters","setInitialFilters","isLoading","setIsLoading","isEmpty","setIsEmpty","setErrorMessage","tableOuterContainer","current","tableInnerContainer","dragHandleStyles","dragHandleText","draggableTableBodyRowClassName","handleDragHandleKeyDown","handleDragHandleOnDragCapture","handleDragHandleOnDragEnd","resetDraggingAndHoveredRow","updateRowOrder","page","row","id","rowDensityCellClassName","renderRowActions","currentIndex","index","rowIndex","undefined","dataTableFilters","filter","column","enableColumnFilter","map","accessorKey","label","variant","filterVariant","options","filterSelectOptions","defaultCell","cell","value","getValue","whiteSpace","textOverflow","emptyState","noResultsInnerContent","heading","text","emptyStateInnerContent","dataTable","state","density","sorting","globalFilter","icons","ArrowDownwardIcon","DragHandleIcon","SyncAltIcon","enableColumnActions","enableColumnResizing","enableDensityToggle","enableFilters","enableFullScreenToggle","enableGlobalFilter","enableHiding","enablePagination","layoutMode","manualFiltering","manualSorting","muiTablePaperProps","elevation","selectAllMode","defaultColumn","Cell","enableRowOrdering","Boolean","enableRowDragging","muiTableBodyRowProps","table","currentRowId","draggingRowId","hoveredRowId","getState","hoveredRow","muiRowDragHandleProps","onKeyDown","event","onBlur","onDragEnd","onDragCapture","enableRowActions","positionActionsColumn","enableRowSelection","onRowSelectionChange","enableSorting","onSortingChange","currentColumn","find","sortedColumn","enableRowVirtualization","rowVirtualizerInstanceRef","rowVirtualizerOptions","overscan","renderEmptyRowsFallback","muiTableProps","ref","muiTableContainerProps","bulkActionMenuButton","buttonVariant","endIcon","isDisabled","Object","keys","length","ariaLabel","incomingData","sort","error","marginBottom","onChangeSearch","onChangeFilters","additionalActions","severity","MemoizedDataTable","displayName"],"sources":["../../src/DataTable/DataTable.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n ReactNode,\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n MRT_Cell,\n MRT_DensityState,\n MRT_Row,\n MRT_RowData,\n MRT_SortingState,\n MRT_TableOptions,\n MRT_RowSelectionState,\n MRT_RowVirtualizer,\n MRT_VisibilityState,\n useMaterialReactTable,\n MRT_TableContainer,\n} from \"material-react-table\";\nimport {\n ArrowDownIcon,\n ArrowUnsortedIcon,\n DragIndicatorIcon,\n MoreIcon,\n} from \"../icons.generated\";\nimport { densityValues, paginationTypeValues } from \"./constants\";\nimport { DataTablePagination } from \"./DataTablePagination\";\nimport { DataFilter, DataFilters } from \"../labs/DataFilters\";\nimport {\n DataTableRowActions,\n DataTableRowActionsProps,\n} from \"./DataTableRowActions\";\nimport { useRowReordering } from \"./useRowReordering\";\nimport { DataTableSettings } from \"./DataTableSettings\";\nimport { MenuButton, MenuButtonProps } from \"../MenuButton\";\nimport { Box } from \"../Box\";\nimport { DataTableRowSelectionState } from \".\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../OdysseyDesignTokensContext\";\nimport { useScrollIndication } from \"./useScrollIndication\";\nimport styled from \"@emotion/styled\";\nimport { DataTableEmptyState } from \"./DataTableEmptyState\";\nimport { Callout } from \"../Callout\";\nimport { t } from \"i18next\";\n\nexport type DataTableGetDataType = {\n page?: number;\n resultsPerPage?: number;\n search?: string;\n filters?: DataFilter[];\n sort?: MRT_SortingState;\n};\n\nexport type DataTableOnReorderRowsType = {\n rowId: string;\n newRowIndex: number;\n};\n\nexport type DataTableProps = {\n /**\n * The columns that make up the table\n */\n columns: MRT_TableOptions<MRT_RowData>[\"columns\"];\n /**\n * The total number of rows in the table. Optional, because it's sometimes impossible\n * to calculate. Used in table pagination to know when to disable the \"next\"/\"more\" button.\n */\n totalRows?: number;\n /**\n * The function to get the ID of a row\n */\n getRowId?: MRT_TableOptions<MRT_RowData>[\"getRowId\"];\n /**\n * The initial density (height & padding) of the table rows. This is available even if the\n * table density isn't changeable by the end user via hasChangeableDensity.\n */\n initialDensity?: (typeof densityValues)[number];\n /**\n * If true, the end user will be able to change the table density.\n */\n hasChangeableDensity?: boolean;\n /**\n * If true, the end user can resize individual columns.\n */\n hasColumnResizing?: boolean;\n /**\n * If true, the end user will be able to show/hide columns.\n */\n hasColumnVisibility?: boolean;\n /**\n * If true, the end user will be able to filter columns.\n */\n hasFilters?: boolean;\n /**\n * If true, the table will include pagination controls.\n */\n hasPagination?: boolean;\n /**\n * If true, the table will include checkboxes on each row, enabling\n * the user to select some or all rows.\n */\n hasRowSelection?: boolean;\n /**\n * If true, the global table search controls will be shown.\n */\n hasSearch?: boolean;\n /**\n * If true, the end user can sort columns (ascending, descending, or neither)\n */\n hasSorting?: boolean;\n /**\n * If true, the end user can reorder rows via a drag-and-drop interface\n */\n hasRowReordering?: boolean;\n /**\n * If true, the search field will include a Search button, rather than\n * firing on input change.\n */\n hasSearchSubmitButton?: boolean;\n /**\n * The debounce time, in milliseconds, for the search input firing\n * `onChangeSearch` when changed. If `hasSearchSubmitButton` is true,\n * this doesn't do anything.\n */\n searchDelayTime?: number;\n /**\n * Callback that fires when a row (or rows) is selected or unselected.\n */\n onChangeRowSelection?: (rowSelection: DataTableRowSelectionState) => void;\n /**\n * Callback that fires whenever the table needs to fetch new data, due to changes in\n * page, results per page, search input, filters, or sorting\n */\n getData: ({\n page,\n resultsPerPage,\n search,\n filters,\n sort,\n }: DataTableGetDataType) =>\n | MRT_TableOptions<MRT_RowData>[\"data\"]\n | Promise<MRT_TableOptions<MRT_RowData>[\"data\"]>;\n /**\n * Callback that fires when the user reorders rows within the table. Can be used\n * to propogate order change to the backend.\n */\n onReorderRows?: ({ rowId, newRowIndex }: DataTableOnReorderRowsType) => void;\n /**\n * The current page number.\n */\n currentPage?: number;\n /**\n * The number of results per page.\n */\n resultsPerPage?: number;\n /**\n * The type of pagination controls shown. Defaults to next/prev buttons, but can be\n * set to a simple \"Load more\" button by setting to \"loadMore\".\n */\n paginationType?: (typeof paginationTypeValues)[number];\n /**\n * Action buttons to display in each row\n */\n rowActionButtons?: DataTableRowActionsProps[\"rowActionButtons\"];\n /**\n * Menu items to include in the optional actions menu on each row.\n */\n rowActionMenuItems?: DataTableRowActionsProps[\"rowActionMenuItems\"];\n /**\n * Menu items to include in the bulk actions menu, which appears above the table if a row or rows are selected\n */\n bulkActionMenuItems?: (\n selectedRows: MRT_RowSelectionState,\n ) => MenuButtonProps[\"children\"];\n /**\n * If `error` is not undefined, the DataTable will indicate an error.\n */\n errorMessage?: string;\n /**\n * The component to display when the table is displaying the initial empty state\n */\n emptyPlaceholder?: ReactNode;\n /**\n * The component to display when the query returns no results\n */\n noResultsPlaceholder?: ReactNode;\n};\n\nconst displayColumnDefOptions = {\n \"mrt-row-actions\": {\n header: \"\",\n grow: true,\n muiTableBodyCellProps: {\n align: \"right\",\n sx: {\n overflow: \"visible\",\n width: \"unset\",\n },\n className: \"ods-actions-cell\",\n },\n muiTableHeadCellProps: {\n align: \"right\",\n sx: {\n width: \"unset\",\n },\n className: \"ods-actions-cell\",\n },\n },\n \"mrt-row-drag\": {\n header: \"\",\n muiTableBodyCellProps: {\n sx: {\n minWidth: 0,\n width: \"auto\",\n },\n className: \"ods-drag-handle\",\n },\n muiTableHeadCellProps: {\n sx: {\n minWidth: 0,\n width: \"auto\",\n },\n children: (\n // Add a spacer to simulate the width of the drag handle in the column.\n // Without this, the head cells are offset from their body cell counterparts\n <Box sx={{ marginInline: \"-0.1rem\" }}>\n <DragIndicatorIcon sx={{ marginInline: 1, opacity: 0 }} />\n </Box>\n ),\n },\n },\n \"mrt-row-select\": {\n muiTableHeadCellProps: {\n padding: \"checkbox\",\n },\n muiTableBodyCellProps: {\n padding: \"checkbox\",\n },\n },\n};\n\nconst ScrollableTableContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" &&\n prop !== \"isScrollableStart\" &&\n prop !== \"isScrollableEnd\",\n})(\n ({\n odysseyDesignTokens,\n isScrollableStart,\n isScrollableEnd,\n }: {\n odysseyDesignTokens: DesignTokens;\n isScrollableStart: boolean;\n isScrollableEnd: boolean;\n }) => ({\n borderBlockEndColor: odysseyDesignTokens.HueNeutral100,\n borderBlockEndStyle: \"solid\",\n borderBlockEndWidth: odysseyDesignTokens.BorderWidthMain,\n marginBlockEnd: odysseyDesignTokens.Spacing4,\n position: \"relative\",\n borderInlineStartColor: isScrollableStart\n ? odysseyDesignTokens.HueNeutral200\n : \"transparent\",\n borderInlineStartStyle: \"solid\",\n borderInlineStartWidth: odysseyDesignTokens.BorderWidthMain,\n \"::before\": {\n background:\n \"linear-gradient(-90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.33) 50%, rgba(0, 0, 0, 1) 100%)\",\n content: '\"\"',\n opacity: isScrollableStart ? \"0.075\" : \"0\",\n pointerEvents: \"none\",\n position: \"absolute\",\n top: 0,\n left: 0,\n bottom: 0,\n width: odysseyDesignTokens.Spacing6,\n zIndex: 100,\n transition: `opacity ${odysseyDesignTokens.TransitionDurationMain} ${odysseyDesignTokens.TransitionTimingMain}`,\n },\n borderInlineEndColor: isScrollableEnd\n ? odysseyDesignTokens.HueNeutral200\n : \"transparent\",\n borderInlineEndStyle: \"solid\",\n borderInlineEndWidth: odysseyDesignTokens.BorderWidthMain,\n \"::after\": {\n background:\n \"linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.33) 50%, rgba(0, 0, 0, 1) 100%)\",\n content: '\"\"',\n opacity: isScrollableEnd ? \"0.075\" : \"0\",\n pointerEvents: \"none\",\n position: \"absolute\",\n top: 0,\n right: 0,\n bottom: 0,\n width: odysseyDesignTokens.Spacing6,\n transition: `opacity ${odysseyDesignTokens.TransitionDurationMain} ${odysseyDesignTokens.TransitionTimingMain}`,\n },\n }),\n);\n\nconst DataTable = ({\n columns,\n getRowId: getRowIdProp,\n currentPage = 1,\n initialDensity = densityValues[0],\n resultsPerPage = 20,\n getData,\n onReorderRows,\n totalRows,\n hasSearchSubmitButton,\n searchDelayTime,\n paginationType = \"paged\",\n onChangeRowSelection,\n rowActionButtons,\n rowActionMenuItems,\n hasChangeableDensity,\n hasColumnResizing,\n hasColumnVisibility,\n hasFilters,\n hasPagination,\n hasRowReordering,\n hasRowSelection,\n hasSearch,\n hasSorting,\n bulkActionMenuItems,\n errorMessage: errorMessageProp,\n emptyPlaceholder,\n noResultsPlaceholder,\n}: DataTableProps) => {\n const [data, setData] = useState<MRT_RowData[]>([]);\n const [pagination, setPagination] = useState({\n pageIndex: currentPage,\n pageSize: resultsPerPage,\n });\n const [draggingRow, setDraggingRow] = useState<MRT_Row<MRT_RowData> | null>();\n const [isTableContainerScrolledToStart, setIsTableContainerScrolledToStart] =\n useState(true);\n const [isTableContainerScrolledToEnd, setIsTableContainerScrolledToEnd] =\n useState(true);\n const [tableInnerContainerWidth, setTableInnerContainerWidth] =\n useState<string>(\"100%\");\n const tableOuterContainerRef = useRef<HTMLDivElement>(null);\n const tableInnerContainerRef = useRef<HTMLDivElement>(null);\n const tableContentRef = useRef<HTMLTableElement>(null);\n\n // Table states\n const [columnSorting, setColumnSorting] = useState<MRT_SortingState>([]);\n const [columnVisibility, setColumnVisibility] =\n useState<MRT_VisibilityState>();\n const [rowDensity, setRowDensity] =\n useState<MRT_DensityState>(initialDensity);\n const [rowSelection, setRowSelection] = useState<MRT_RowSelectionState>({});\n const [search, setSearch] = useState<string>(\"\");\n const [filters, setFilters] = useState<DataFilter[]>();\n const [initialFilters, setInitialFilters] = useState<DataFilter[]>();\n const [isLoading, setIsLoading] = useState<boolean | undefined>(true);\n const [isEmpty, setIsEmpty] = useState<boolean | undefined>();\n const [errorMessage, setErrorMessage] = useState<string | undefined>(\n errorMessageProp,\n );\n\n useScrollIndication({\n tableOuterContainer: tableOuterContainerRef.current,\n tableInnerContainer: tableInnerContainerRef.current,\n setIsTableContainerScrolledToStart: setIsTableContainerScrolledToStart,\n setIsTableContainerScrolledToEnd: setIsTableContainerScrolledToEnd,\n setTableInnerContainerWidth: setTableInnerContainerWidth,\n });\n\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const {\n dragHandleStyles,\n dragHandleText,\n draggableTableBodyRowClassName,\n handleDragHandleKeyDown,\n handleDragHandleOnDragCapture,\n handleDragHandleOnDragEnd,\n resetDraggingAndHoveredRow,\n updateRowOrder,\n } = useRowReordering({\n totalRows,\n onReorderRows,\n data,\n setData,\n draggingRow,\n setDraggingRow,\n resultsPerPage: pagination.pageSize,\n page: pagination.pageIndex,\n });\n\n const getRowId = getRowIdProp ? getRowIdProp : (row: MRT_RowData) => row.id;\n\n const rowDensityCellClassName = useMemo(() => {\n return rowDensity === \"spacious\"\n ? \"MuiTableCell-spacious\"\n : rowDensity === \"compact\"\n ? \"MuiTableCell-compact\"\n : \"MuiTableCell-default\";\n }, [rowDensity]);\n\n const renderRowActions = useCallback(\n ({ row }: { row: MRT_Row<MRT_RowData> }) => {\n const currentIndex =\n row.index + (pagination.pageIndex - 1) * pagination.pageSize;\n return (\n <DataTableRowActions\n row={row}\n rowIndex={currentIndex}\n rowActionButtons={rowActionButtons}\n rowActionMenuItems={rowActionMenuItems}\n totalRows={totalRows}\n updateRowOrder={\n hasRowReordering && onReorderRows ? updateRowOrder : undefined\n }\n />\n );\n },\n [\n pagination,\n rowActionButtons,\n rowActionMenuItems,\n hasRowReordering,\n onReorderRows,\n totalRows,\n updateRowOrder,\n ],\n );\n\n const dataTableFilters = useMemo(\n () =>\n columns\n .filter((column) => column.enableColumnFilter !== false)\n .map((column) => {\n return {\n id: column.accessorKey as string,\n label: column.header,\n variant: column.filterVariant ?? \"text\",\n options: column.filterSelectOptions,\n } as DataFilter;\n }),\n [columns],\n );\n\n const defaultCell = useCallback(\n ({ cell }: { cell: MRT_Cell<MRT_RowData> }) => {\n const value = cell.getValue<string>();\n return (\n <Box\n sx={{\n whiteSpace: \"nowrap\",\n textOverflow: \"ellipsis\",\n overflow: \"hidden\",\n }}\n >\n {value}\n </Box>\n );\n },\n [],\n );\n\n const emptyState = useCallback(() => {\n const noResultsInnerContent = noResultsPlaceholder || (\n <DataTableEmptyState\n heading={t(\"table.noresults.heading\")}\n text={t(\"table.noresults.text\")}\n />\n );\n\n const emptyStateInnerContent =\n emptyPlaceholder && isEmpty ? emptyPlaceholder : noResultsInnerContent;\n\n return (\n <Box sx={{ width: tableInnerContainerWidth }}>\n {emptyStateInnerContent}\n </Box>\n );\n }, [\n tableInnerContainerWidth,\n emptyPlaceholder,\n noResultsPlaceholder,\n isEmpty,\n ]);\n\n const dataTable = useMaterialReactTable({\n columns: columns,\n data: data,\n getRowId: getRowId,\n state: {\n density: rowDensity,\n sorting: columnSorting,\n globalFilter: search,\n columnVisibility,\n isLoading,\n rowSelection,\n },\n icons: {\n ArrowDownwardIcon: ArrowDownIcon,\n DragHandleIcon: DragIndicatorIcon,\n SyncAltIcon: ArrowUnsortedIcon,\n },\n\n // Base table settings\n enableColumnActions: false,\n enableColumnResizing: hasColumnResizing,\n enableDensityToggle: false,\n enableFilters: false,\n enableFullScreenToggle: false,\n enableGlobalFilter: false,\n enableHiding: false,\n enablePagination: false,\n layoutMode: \"grid-no-grow\",\n manualFiltering: true,\n manualSorting: true,\n muiTablePaperProps: {\n elevation: 0,\n sx: {\n overflow: \"visible\",\n },\n },\n selectAllMode: \"all\",\n displayColumnDefOptions:\n displayColumnDefOptions as MRT_TableOptions<MRT_RowData>[\"displayColumnDefOptions\"],\n muiTableBodyCellProps: () => ({\n className: rowDensityCellClassName,\n }),\n defaultColumn: {\n Cell: defaultCell,\n },\n\n // Reordering\n enableRowOrdering: hasRowReordering && Boolean(onReorderRows),\n enableRowDragging: hasRowReordering && Boolean(onReorderRows),\n muiTableBodyRowProps: ({ table, row }) => ({\n className: draggableTableBodyRowClassName({\n currentRowId: row.id,\n draggingRowId: draggingRow?.id,\n hoveredRowId: table.getState().hoveredRow?.id,\n }),\n }),\n muiRowDragHandleProps: ({ table, row }) => ({\n onKeyDown: (event) => handleDragHandleKeyDown({ table, row, event }),\n onBlur: () => resetDraggingAndHoveredRow(table),\n onDragEnd: () => handleDragHandleOnDragEnd(table),\n onDragCapture: () => handleDragHandleOnDragCapture(table),\n sx: dragHandleStyles,\n ...dragHandleText,\n }),\n\n // Row actions\n enableRowActions:\n (hasRowReordering === true && onReorderRows) ||\n rowActionButtons ||\n rowActionMenuItems\n ? true\n : false,\n positionActionsColumn:\n \"last\" as MRT_TableOptions<MRT_RowData>[\"positionActionsColumn\"],\n renderRowActions: ({ row }) => renderRowActions({ row }),\n\n // Row selection\n enableRowSelection: hasRowSelection,\n onRowSelectionChange: setRowSelection,\n\n // Sorting\n enableSorting: hasSorting,\n onSortingChange: setColumnSorting,\n muiTableHeadCellProps: ({ column: currentColumn }) => ({\n className: columnSorting.find(\n (sortedColumn) => sortedColumn.id === currentColumn.id,\n )\n ? \"isSorted\"\n : \"isUnsorted\",\n }),\n\n // Virtualization\n enableRowVirtualization:\n paginationType !== \"loadMore\" && pagination.pageSize > 50,\n rowVirtualizerInstanceRef:\n useRef<MRT_RowVirtualizer<HTMLDivElement, HTMLTableRowElement>>(null),\n rowVirtualizerOptions: {\n overscan: 4,\n },\n\n // States\n renderEmptyRowsFallback: emptyState,\n\n // Refs\n muiTableProps: {\n ref: tableContentRef,\n },\n\n muiTableContainerProps: {\n ref: tableInnerContainerRef,\n },\n });\n\n // Effects\n const bulkActionMenuButton = useMemo(\n () => (\n <>\n <MenuButton\n buttonVariant=\"secondary\"\n endIcon={<MoreIcon />}\n isDisabled={Object.keys(rowSelection).length === 0}\n ariaLabel=\"More actions\"\n >\n {bulkActionMenuItems?.(rowSelection)}\n </MenuButton>\n </>\n ),\n [bulkActionMenuItems, rowSelection],\n );\n\n useEffect(() => {\n (async () => {\n setIsLoading(true);\n setErrorMessage(errorMessageProp);\n try {\n const incomingData = await getData?.({\n page: pagination.pageIndex,\n resultsPerPage: pagination.pageSize,\n search,\n filters,\n sort: columnSorting,\n });\n setData(incomingData);\n } catch (error) {\n setErrorMessage(typeof error === \"string\" ? error : t(\"table.error\"));\n } finally {\n setIsLoading(false);\n }\n })();\n }, [pagination, columnSorting, search, filters, getData, errorMessageProp]);\n\n useEffect(() => {\n if (!initialFilters && filters) {\n setInitialFilters(filters);\n }\n\n setIsEmpty(\n pagination.pageIndex === currentPage &&\n pagination.pageSize === resultsPerPage &&\n search === \"\" &&\n filters === initialFilters &&\n data.length === 0,\n );\n }, [\n filters,\n pagination,\n search,\n data,\n currentPage,\n initialFilters,\n resultsPerPage,\n ]);\n\n useEffect(() => {\n onChangeRowSelection?.(rowSelection);\n }, [rowSelection, onChangeRowSelection]);\n\n // Render the table\n return (\n <>\n {(hasSearch ||\n hasFilters ||\n hasChangeableDensity ||\n hasColumnVisibility ||\n bulkActionMenuItems) && (\n <Box sx={{ marginBottom: 5 }}>\n <DataFilters\n onChangeSearch={hasSearch ? setSearch : undefined}\n onChangeFilters={hasFilters ? setFilters : undefined}\n hasSearchSubmitButton={hasSearchSubmitButton}\n searchDelayTime={searchDelayTime}\n filters={hasFilters ? dataTableFilters : undefined}\n isDisabled={isEmpty}\n additionalActions={\n <>\n <DataTableSettings\n hasChangeableDensity={hasChangeableDensity}\n rowDensity={rowDensity}\n setRowDensity={setRowDensity}\n hasColumnVisibility={hasColumnVisibility}\n columns={columns}\n columnVisibility={columnVisibility}\n setColumnVisibility={setColumnVisibility}\n />\n {bulkActionMenuItems && bulkActionMenuButton}\n </>\n }\n />\n </Box>\n )}\n\n {errorMessage && (\n <Box sx={{ marginBlockEnd: 2 }}>\n <Callout severity=\"error\" text={errorMessage} />\n </Box>\n )}\n\n <ScrollableTableContainer\n odysseyDesignTokens={odysseyDesignTokens}\n isScrollableStart={!isTableContainerScrolledToStart}\n isScrollableEnd={!isTableContainerScrolledToEnd}\n ref={tableOuterContainerRef}\n >\n <MRT_TableContainer table={dataTable} />\n </ScrollableTableContainer>\n\n {hasPagination && (\n <DataTablePagination\n pagination={pagination}\n setPagination={setPagination}\n totalRows={totalRows}\n isDisabled={isEmpty}\n variant={paginationType}\n />\n )}\n </>\n );\n};\n\nconst MemoizedDataTable = memo(DataTable);\nMemoizedDataTable.displayName = \"DataTable\";\n\nexport { MemoizedDataTable as DataTable };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAEEA,IAA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A8B;MAChD4H,GAAG,EAAExH,sBAAuB;MAAAjF,QAAA,EAE5BhB,IAAA,CAACpB,kBAAkB;QAACkN,KAAK,EAAE7B;MAAU,CAAE;IAAC,CAChB,CAAC,EAE1BxF,aAAa,IACZzE,IAAA,CAACd,mBAAmB;MAClBmG,UAAU,EAAEA,UAAW;MACvBC,aAAa,EAAEA,aAAc;MAC7BxB,SAAS,EAAEA,SAAU;MACrBgK,UAAU,EAAE1G,OAAQ;MACpB8B,OAAO,EAAEjF;IAAe,CACzB,CACF;EAAA,CACD,CAAC;AAEP,CAAC;AAED,MAAM0K,iBAAiB,GAAGtQ,IAAI,CAACgF,SAAS,CAAC;AACzCsL,iBAAiB,CAACC,WAAW,GAAG,WAAW;AAE3C,SAASD,iBAAiB,IAAItL,SAAS"}
@@ -0,0 +1,55 @@
1
+ /*!
2
+ * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { memo } from "react";
14
+ import { Heading4, Paragraph } from "../Typography.js";
15
+ import { Box } from "../Box.js";
16
+ import styled from "@emotion/styled";
17
+ import { useOdysseyDesignTokens } from "../OdysseyDesignTokensContext.js";
18
+ import { jsx as _jsx } from "react/jsx-runtime";
19
+ import { jsxs as _jsxs } from "react/jsx-runtime";
20
+ const EmptyContainer = styled("div", {
21
+ shouldForwardProp: prop => prop !== "odysseyDesignTokens"
22
+ })(({
23
+ odysseyDesignTokens
24
+ }) => ({
25
+ display: "flex",
26
+ flexDirection: "column",
27
+ marginBlock: odysseyDesignTokens.Spacing9,
28
+ padding: odysseyDesignTokens.Spacing5,
29
+ textAlign: "center",
30
+ width: "100%"
31
+ }));
32
+ const DataTableEmptyState = ({
33
+ heading,
34
+ text,
35
+ primaryButton,
36
+ secondaryButton
37
+ }) => {
38
+ const odysseyDesignTokens = useOdysseyDesignTokens();
39
+ return _jsxs(EmptyContainer, {
40
+ odysseyDesignTokens: odysseyDesignTokens,
41
+ children: [_jsx(Heading4, {
42
+ children: heading
43
+ }), _jsx(Paragraph, {
44
+ children: text
45
+ }), (primaryButton || secondaryButton) && _jsxs(Box, {
46
+ sx: {
47
+ marginBlockStart: 5
48
+ },
49
+ children: [secondaryButton, primaryButton]
50
+ })]
51
+ });
52
+ };
53
+ const MemoizedDataTableEmptyState = memo(DataTableEmptyState);
54
+ export { MemoizedDataTableEmptyState as DataTableEmptyState };
55
+ //# sourceMappingURL=DataTableEmptyState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableEmptyState.js","names":["memo","Heading4","Paragraph","Box","styled","useOdysseyDesignTokens","jsx","_jsx","jsxs","_jsxs","EmptyContainer","shouldForwardProp","prop","odysseyDesignTokens","display","flexDirection","marginBlock","Spacing9","padding","Spacing5","textAlign","width","DataTableEmptyState","heading","text","primaryButton","secondaryButton","children","sx","marginBlockStart","MemoizedDataTableEmptyState"],"sources":["../../src/DataTable/DataTableEmptyState.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { ReactNode, memo } from \"react\";\nimport { Heading4, Paragraph } from \"../Typography\";\nimport { Box } from \"../Box\";\nimport styled from \"@emotion/styled\";\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"../OdysseyDesignTokensContext\";\n\nconst EmptyContainer = styled(\"div\", {\n shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({\n display: \"flex\",\n flexDirection: \"column\",\n marginBlock: odysseyDesignTokens.Spacing9,\n padding: odysseyDesignTokens.Spacing5,\n textAlign: \"center\",\n width: \"100%\",\n}));\n\nexport type DataTableEmptyStateProps = {\n heading: string;\n text: string;\n primaryButton?: ReactNode;\n secondaryButton?: ReactNode;\n};\n\nconst DataTableEmptyState = ({\n heading,\n text,\n primaryButton,\n secondaryButton,\n}: DataTableEmptyStateProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n return (\n <EmptyContainer odysseyDesignTokens={odysseyDesignTokens}>\n <Heading4>{heading}</Heading4>\n <Paragraph>{text}</Paragraph>\n {(primaryButton || secondaryButton) && (\n <Box sx={{ marginBlockStart: 5 }}>\n {secondaryButton}\n {primaryButton}\n </Box>\n )}\n </EmptyContainer>\n );\n};\n\nconst MemoizedDataTableEmptyState = memo(DataTableEmptyState);\nexport { MemoizedDataTableEmptyState as DataTableEmptyState };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAoBA,IAAI,QAAQ,OAAO;AAAC,SAC/BC,QAAQ,EAAEC,SAAS;AAAA,SACnBC,GAAG;AACZ,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAEnCC,sBAAsB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAIxB,MAAMC,cAAc,GAAGN,MAAM,CAAC,KAAK,EAAE;EACnCO,iBAAiB,EAAGC,IAAI,IAAKA,IAAI,KAAK;AACxC,CAAC,CAAC,CAAC,CAAC;EAAEC;AAA2D,CAAC,MAAM;EACtEC,OAAO,EAAE,MAAM;E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