@okta/odyssey-react-mui 0.15.0 → 0.15.2

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 (176) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +33 -9
  3. package/dist/components/Icon/Add.d.ts +1 -1
  4. package/dist/components/Icon/Add.js.map +1 -1
  5. package/dist/components/Icon/AddCircle.d.ts +1 -1
  6. package/dist/components/Icon/AddCircle.js.map +1 -1
  7. package/dist/components/Icon/AlertCircle.d.ts +1 -1
  8. package/dist/components/Icon/AlertCircle.js.map +1 -1
  9. package/dist/components/Icon/AlertCircleFilled.d.ts +1 -1
  10. package/dist/components/Icon/AlertCircleFilled.js.map +1 -1
  11. package/dist/components/Icon/AlertTriangleFilled.d.ts +1 -1
  12. package/dist/components/Icon/AlertTriangleFilled.js.map +1 -1
  13. package/dist/components/Icon/Anchor.d.ts +1 -1
  14. package/dist/components/Icon/Anchor.js.map +1 -1
  15. package/dist/components/Icon/ArrowDown.d.ts +1 -1
  16. package/dist/components/Icon/ArrowDown.js.map +1 -1
  17. package/dist/components/Icon/ArrowLeft.d.ts +1 -1
  18. package/dist/components/Icon/ArrowLeft.js.map +1 -1
  19. package/dist/components/Icon/ArrowRight.d.ts +1 -1
  20. package/dist/components/Icon/ArrowRight.js.map +1 -1
  21. package/dist/components/Icon/ArrowUp.d.ts +1 -1
  22. package/dist/components/Icon/ArrowUp.js.map +1 -1
  23. package/dist/components/Icon/ArrowUpDown.d.ts +16 -0
  24. package/dist/components/Icon/ArrowUpDown.d.ts.map +1 -0
  25. package/dist/components/Icon/ArrowUpDown.js +34 -0
  26. package/dist/components/Icon/ArrowUpDown.js.map +1 -0
  27. package/dist/components/Icon/Calendar.d.ts +1 -1
  28. package/dist/components/Icon/Calendar.js.map +1 -1
  29. package/dist/components/Icon/Check.d.ts +1 -1
  30. package/dist/components/Icon/Check.js.map +1 -1
  31. package/dist/components/Icon/CheckCircleFilled.d.ts +1 -1
  32. package/dist/components/Icon/CheckCircleFilled.js.map +1 -1
  33. package/dist/components/Icon/ChevronDown.d.ts +1 -1
  34. package/dist/components/Icon/ChevronDown.js.map +1 -1
  35. package/dist/components/Icon/ChevronUp.d.ts +1 -1
  36. package/dist/components/Icon/ChevronUp.js.map +1 -1
  37. package/dist/components/Icon/Close.d.ts +1 -1
  38. package/dist/components/Icon/Close.js.map +1 -1
  39. package/dist/components/Icon/CloseCircleFilled.d.ts +1 -1
  40. package/dist/components/Icon/CloseCircleFilled.js.map +1 -1
  41. package/dist/components/Icon/Copy.d.ts +1 -1
  42. package/dist/components/Icon/Copy.js.map +1 -1
  43. package/dist/components/Icon/Delete.d.ts +1 -1
  44. package/dist/components/Icon/Delete.js.map +1 -1
  45. package/dist/components/Icon/Download.d.ts +1 -1
  46. package/dist/components/Icon/Download.js.map +1 -1
  47. package/dist/components/Icon/DragHandle.d.ts +1 -1
  48. package/dist/components/Icon/DragHandle.js.map +1 -1
  49. package/dist/components/Icon/Edit.d.ts +1 -1
  50. package/dist/components/Icon/Edit.js.map +1 -1
  51. package/dist/components/Icon/ExternalLink.d.ts +1 -1
  52. package/dist/components/Icon/ExternalLink.js.map +1 -1
  53. package/dist/components/Icon/Eye.d.ts +1 -1
  54. package/dist/components/Icon/Eye.js.map +1 -1
  55. package/dist/components/Icon/EyeOff.d.ts +1 -1
  56. package/dist/components/Icon/EyeOff.js.map +1 -1
  57. package/dist/components/Icon/Filter.d.ts +1 -1
  58. package/dist/components/Icon/Filter.js.map +1 -1
  59. package/dist/components/Icon/Globe.d.ts +1 -1
  60. package/dist/components/Icon/Globe.js.map +1 -1
  61. package/dist/components/Icon/Home.d.ts +1 -1
  62. package/dist/components/Icon/Home.js.map +1 -1
  63. package/dist/components/Icon/Icon.d.ts +1 -1
  64. package/dist/components/Icon/Icon.js +6 -5
  65. package/dist/components/Icon/Icon.js.map +1 -1
  66. package/dist/components/Icon/InformationCircle.d.ts +1 -1
  67. package/dist/components/Icon/InformationCircle.js.map +1 -1
  68. package/dist/components/Icon/InformationCircleFilled.d.ts +1 -1
  69. package/dist/components/Icon/InformationCircleFilled.js.map +1 -1
  70. package/dist/components/Icon/Notification.d.ts +1 -1
  71. package/dist/components/Icon/Notification.js.map +1 -1
  72. package/dist/components/Icon/OverflowVertical.d.ts +1 -1
  73. package/dist/components/Icon/OverflowVertical.js.map +1 -1
  74. package/dist/components/Icon/QuestionCircle.d.ts +1 -1
  75. package/dist/components/Icon/QuestionCircle.js.map +1 -1
  76. package/dist/components/Icon/QuestionCircleFilled.d.ts +1 -1
  77. package/dist/components/Icon/QuestionCircleFilled.js.map +1 -1
  78. package/dist/components/Icon/Search.d.ts +1 -1
  79. package/dist/components/Icon/Search.js.map +1 -1
  80. package/dist/components/Icon/Settings.d.ts +1 -1
  81. package/dist/components/Icon/Settings.js.map +1 -1
  82. package/dist/components/Icon/Subtract.d.ts +1 -1
  83. package/dist/components/Icon/Subtract.js.map +1 -1
  84. package/dist/components/Icon/SvgIcon.js.map +1 -1
  85. package/dist/components/Icon/User.d.ts +1 -1
  86. package/dist/components/Icon/User.js.map +1 -1
  87. package/dist/components/Icon/UserGroup.d.ts +1 -1
  88. package/dist/components/Icon/UserGroup.js.map +1 -1
  89. package/dist/components/Icon/index.d.ts +41 -39
  90. package/dist/components/Icon/index.d.ts.map +1 -1
  91. package/dist/components/Icon/index.js +3 -0
  92. package/dist/components/Icon/index.js.map +1 -1
  93. package/dist/components/Icon/types.js.map +1 -1
  94. package/dist/components/Link/Link.d.ts +1 -1
  95. package/dist/components/Link/Link.js +1 -1
  96. package/dist/components/Link/Link.js.map +1 -1
  97. package/dist/components/Link/index.js.map +1 -1
  98. package/dist/components/PasswordInput/PasswordInput.d.ts +1 -1
  99. package/dist/components/PasswordInput/PasswordInput.js +5 -7
  100. package/dist/components/PasswordInput/PasswordInput.js.map +1 -1
  101. package/dist/components/PasswordInput/index.js.map +1 -1
  102. package/dist/components/ThemeProvider/ThemeProvider.d.ts +16 -0
  103. package/dist/components/ThemeProvider/ThemeProvider.d.ts.map +1 -0
  104. package/dist/components/ThemeProvider/ThemeProvider.js +24 -0
  105. package/dist/components/ThemeProvider/ThemeProvider.js.map +1 -0
  106. package/dist/components/ThemeProvider/index.d.ts +13 -0
  107. package/dist/components/ThemeProvider/index.d.ts.map +1 -0
  108. package/dist/components/ThemeProvider/index.js +13 -0
  109. package/dist/components/ThemeProvider/index.js.map +1 -0
  110. package/dist/components/index.d.ts +3 -2
  111. package/dist/components/index.d.ts.map +1 -1
  112. package/dist/components/index.js +3 -2
  113. package/dist/components/index.js.map +1 -1
  114. package/dist/index.d.ts +7 -0
  115. package/dist/index.d.ts.map +1 -1
  116. package/dist/index.js +5 -0
  117. package/dist/index.js.map +1 -1
  118. package/dist/themes/index.js.map +1 -1
  119. package/dist/themes/odyssey/components.d.ts.map +1 -1
  120. package/dist/themes/odyssey/components.js +1068 -600
  121. package/dist/themes/odyssey/components.js.map +1 -1
  122. package/dist/themes/odyssey/components.types.d.ts +15 -1
  123. package/dist/themes/odyssey/components.types.d.ts.map +1 -1
  124. package/dist/themes/odyssey/components.types.js.map +1 -1
  125. package/dist/themes/odyssey/index.js.map +1 -1
  126. package/dist/themes/odyssey/mixins.js.map +1 -1
  127. package/dist/themes/odyssey/mixins.types.js.map +1 -1
  128. package/dist/themes/odyssey/palette.js.map +1 -1
  129. package/dist/themes/odyssey/palette.types.js.map +1 -1
  130. package/dist/themes/odyssey/shape.d.ts.map +1 -1
  131. package/dist/themes/odyssey/shape.js +2 -1
  132. package/dist/themes/odyssey/shape.js.map +1 -1
  133. package/dist/themes/odyssey/spacing.js.map +1 -1
  134. package/dist/themes/odyssey/theme.d.ts +2 -2
  135. package/dist/themes/odyssey/theme.d.ts.map +1 -1
  136. package/dist/themes/odyssey/theme.js +8 -8
  137. package/dist/themes/odyssey/theme.js.map +1 -1
  138. package/dist/themes/odyssey/typography.js +6 -6
  139. package/dist/themes/odyssey/typography.js.map +1 -1
  140. package/dist/themes/odyssey/typography.types.d.ts +0 -1
  141. package/dist/themes/odyssey/typography.types.d.ts.map +1 -1
  142. package/dist/themes/odyssey/typography.types.js.map +1 -1
  143. package/dist/utils/{oid.d.ts → createUniqueId.d.ts} +3 -4
  144. package/dist/utils/createUniqueId.d.ts.map +1 -0
  145. package/dist/utils/{oid.js → createUniqueId.js} +3 -9
  146. package/dist/utils/createUniqueId.js.map +1 -0
  147. package/dist/utils/index.d.ts +2 -1
  148. package/dist/utils/index.d.ts.map +1 -1
  149. package/dist/utils/index.js +2 -1
  150. package/dist/utils/index.js.map +1 -1
  151. package/dist/utils/useUniqueId.d.ts +13 -0
  152. package/dist/utils/useUniqueId.d.ts.map +1 -0
  153. package/dist/utils/useUniqueId.js +18 -0
  154. package/dist/utils/useUniqueId.js.map +1 -0
  155. package/jest.config.cjs +1 -0
  156. package/package.json +8 -5
  157. package/src/components/Icon/ArrowUpDown.tsx +44 -0
  158. package/src/components/Icon/index.tsx +4 -0
  159. package/src/components/Link/Link.tsx +1 -1
  160. package/src/components/PasswordInput/PasswordInput.tsx +4 -4
  161. package/src/components/ThemeProvider/ThemeProvider.tsx +20 -0
  162. package/src/components/ThemeProvider/index.ts +13 -0
  163. package/src/components/index.ts +3 -2
  164. package/src/index.ts +80 -0
  165. package/src/themes/odyssey/components.tsx +362 -10
  166. package/src/themes/odyssey/components.types.ts +17 -1
  167. package/src/themes/odyssey/shape.ts +7 -1
  168. package/src/themes/odyssey/theme.ts +7 -7
  169. package/src/themes/odyssey/typography.ts +6 -6
  170. package/src/themes/odyssey/typography.types.ts +4 -5
  171. package/src/utils/{oid.test.ts → createUniqueId.test.ts} +5 -4
  172. package/src/utils/{oid.ts → createUniqueId.ts} +4 -9
  173. package/src/utils/index.ts +2 -1
  174. package/src/utils/useUniqueId.ts +21 -0
  175. package/dist/utils/oid.d.ts.map +0 -1
  176. package/dist/utils/oid.js.map +0 -1
@@ -11,10 +11,18 @@
11
11
  */
12
12
 
13
13
  import type { ThemeOptions } from "@mui/material";
14
+ import type {} from "@mui/lab/themeAugmentation";
14
15
  //import radioClasses from "@mui/material";
15
16
  import { outlinedInputClasses } from "@mui/material/OutlinedInput";
17
+ import { tableBodyClasses } from "@mui/material/TableBody";
18
+ import { tableCellClasses } from "@mui/material/TableCell";
19
+ import { tableHeadClasses } from "@mui/material/TableHead";
20
+ import { tableRowClasses } from "@mui/material/TableRow";
21
+ import { tableSortLabelClasses } from "@mui/material/TableSortLabel";
22
+ import { tooltipClasses } from "@mui/material/Tooltip";
16
23
  import {
17
24
  AlertTriangleFilledIcon,
25
+ ArrowDownIcon,
18
26
  CheckCircleFilledIcon,
19
27
  InformationCircleFilledIcon,
20
28
  } from "../../components/Icon";
@@ -43,18 +51,21 @@ export const components: ThemeOptions["components"] = {
43
51
  justifyContent: "center",
44
52
  alignItems: "center",
45
53
  borderWidth: 0,
54
+ borderRadius: 0,
46
55
  }),
47
56
  ...(ownerState.variant === "infobox" && {
48
- borderStyle: "solid",
49
- borderWidth: 1,
57
+ borderStyle: theme.mixins.borderStyle,
58
+ borderWidth: theme.mixins.borderWidth,
59
+ borderRadius: theme.mixins.borderRadius,
50
60
  "&:not(:last-child)": {
51
61
  marginBottom: theme.spacing(4),
52
62
  },
53
63
  }),
54
64
  ...(ownerState.variant === "toast" && {
55
65
  maxWidth: theme.mixins.maxWidth,
56
- borderStyle: "solid",
57
- borderWidth: 1,
66
+ borderStyle: theme.mixins.borderStyle,
67
+ borderWidth: theme.mixins.borderWidth,
68
+ borderRadius: theme.mixins.borderRadius,
58
69
  position: "relative",
59
70
  alignItems: "start",
60
71
  }),
@@ -96,6 +107,7 @@ export const components: ThemeOptions["components"] = {
96
107
  message: ({ ownerState, theme }) => ({
97
108
  padding: 0,
98
109
  lineHeight: theme.typography.body1.lineHeight,
110
+ overflow: "visible",
99
111
  ...(ownerState.variant === "banner" && {
100
112
  display: "flex",
101
113
  justifyContent: "space-between",
@@ -120,6 +132,7 @@ export const components: ThemeOptions["components"] = {
120
132
  },
121
133
  MuiButton: {
122
134
  defaultProps: {
135
+ variant: "primary",
123
136
  disableElevation: true,
124
137
  },
125
138
  variants: [
@@ -270,6 +283,7 @@ export const components: ThemeOptions["components"] = {
270
283
  styleOverrides: {
271
284
  root: ({ theme }) => ({
272
285
  fontWeight: 600,
286
+ minWidth: "unset",
273
287
  padding: `calc(${theme.spacing(3)} - 1px) ${theme.spacing(3)}`,
274
288
  display: "inline-block",
275
289
  position: "relative",
@@ -279,11 +293,12 @@ export const components: ThemeOptions["components"] = {
279
293
  "color, background-color, border-color, outline-offset, outline-color",
280
294
  transitionDuration: "100ms",
281
295
  transitionTimingFunction: "linear",
282
- borderWidth: "1px",
283
- borderStyle: "solid",
296
+ borderWidth: theme.mixins.borderWidth,
297
+ borderStyle: theme.mixins.borderStyle,
298
+ borderRadius: theme.mixins.borderRadius,
284
299
  outlineColor: "transparent",
285
300
  outlineOffset: "0",
286
- fontSize: "1rem",
301
+ fontSize: theme.typography.body1.fontSize,
287
302
  lineHeight: "1.14285714",
288
303
  whiteSpace: "nowrap",
289
304
 
@@ -482,6 +497,27 @@ export const components: ThemeOptions["components"] = {
482
497
  root: ({ theme }) => ({
483
498
  padding: theme.spacing(1),
484
499
  fontSize: theme.typography.body1.fontSize,
500
+ backgroundColor: "transparent",
501
+ color: theme.palette.text.primary,
502
+ borderColor: "transparent",
503
+ borderRadius: theme.mixins.borderRadius,
504
+
505
+ "&:hover, &:focus-visible": {
506
+ backgroundColor: "rgba(29, 29, 33, 0.1)",
507
+ borderColor: "transparent",
508
+ },
509
+ "&:focus-visible": {
510
+ outlineColor: theme.palette.primary.main,
511
+ },
512
+ "&:active": {
513
+ backgroundColor: "rgba(29, 29, 33, 0.2)",
514
+ borderColor: "transparent",
515
+ },
516
+ "&:disabled": {
517
+ backgroundColor: "rgba(235, 235, 237, 0.6)",
518
+ color: theme.palette.text.secondary,
519
+ borderColor: "transparent",
520
+ },
485
521
  }),
486
522
  },
487
523
  },
@@ -503,9 +539,13 @@ export const components: ThemeOptions["components"] = {
503
539
  },
504
540
  MuiInputBase: {
505
541
  styleOverrides: {
506
- root: {
542
+ root: ({ ownerState, theme }) => ({
507
543
  lineHeight: "1.14285714",
508
- },
544
+
545
+ ...(ownerState.readOnly === true && {
546
+ backgroundColor: theme.palette.grey[50],
547
+ }),
548
+ }),
509
549
  input: {
510
550
  boxSizing: "border-box",
511
551
  height: "auto",
@@ -645,10 +685,11 @@ export const components: ThemeOptions["components"] = {
645
685
  [`&.${outlinedInputClasses.disabled} .${outlinedInputClasses.notchedOutline}`]:
646
686
  {
647
687
  borderColor: theme.palette.action.disabled,
688
+ pointerEvents: "auto",
648
689
  },
649
690
  [`&.${outlinedInputClasses.disabled}`]: {
650
691
  backgroundColor: theme.palette.grey[50],
651
- pointerEvents: "none",
692
+ cursor: "not-allowed",
652
693
  },
653
694
  ...(ownerState.startAdornment && {
654
695
  paddingLeft: theme.spacing(3),
@@ -768,6 +809,220 @@ export const components: ThemeOptions["components"] = {
768
809
  }),
769
810
  },
770
811
  },
812
+ MuiTabPanel: {
813
+ styleOverrides: {
814
+ root: {
815
+ padding: 0,
816
+ },
817
+ },
818
+ },
819
+ MuiTable: {
820
+ styleOverrides: {
821
+ root: ({ theme, ownerState }) => ({
822
+ display: "table",
823
+ width: "auto",
824
+ borderCollapse: "separate",
825
+ borderSpacing: 0,
826
+ border: `${theme.mixins.borderWidth} ${theme.mixins.borderStyle} ${theme.palette.grey[100]}`,
827
+ borderRadius: theme.mixins.borderRadius,
828
+ marginBlock: theme.spacing(0),
829
+ marginInline: theme.spacing(0),
830
+ lineHeight: "1.14285714",
831
+
832
+ "&:only-child": {
833
+ marginBlockEnd: 0,
834
+ },
835
+
836
+ ...(ownerState.stickyHeader && {
837
+ borderCollapse: "separate",
838
+ }),
839
+ }),
840
+ },
841
+ },
842
+ MuiTableCell: {
843
+ styleOverrides: {
844
+ root: ({ theme, ownerState }) => ({
845
+ ...theme.typography.body1,
846
+ maxWidth: theme.mixins.maxWidth,
847
+ borderBottom: `${theme.mixins.borderWidth} ${theme.mixins.borderStyle} ${theme.palette.grey[100]}`,
848
+ textAlign: "start",
849
+ verticalAlign: "baseline",
850
+ padding: "unset",
851
+ paddingBlock: theme.spacing(4),
852
+ paddingInline: theme.spacing(4),
853
+ overflowWrap: "break-word",
854
+
855
+ [`.${tableRowClasses.root}:hover &[rowspan]`]: {
856
+ backgroundColor: theme.palette.common.white,
857
+ },
858
+
859
+ [`.${tableBodyClasses.root} .${tableRowClasses.root}:last-of-type &`]: {
860
+ borderBottom: 0,
861
+ },
862
+
863
+ [`.${tableRowClasses.selected} &`]: {
864
+ borderBottomColor: theme.palette.primary.light,
865
+ },
866
+
867
+ [`.${tableRowClasses.selected}:hover &`]: {
868
+ borderBottomColor: theme.palette.primary.main,
869
+ },
870
+
871
+ ...(ownerState.variant === "action" && {
872
+ paddingBlock: 0,
873
+ }),
874
+
875
+ ...(ownerState.variant === "body" && {
876
+ color: theme.palette.text.primary,
877
+ }),
878
+
879
+ ...(ownerState.variant === "date" && {
880
+ whiteSpace: "nowrap",
881
+ }),
882
+
883
+ ...(ownerState.variant === "footer" && {
884
+ color: theme.palette.text.secondary,
885
+ lineHeight: theme.typography.body1.lineHeight,
886
+ fontSize: theme.typography.body1.fontSize,
887
+ }),
888
+
889
+ [`.${tableHeadClasses.root} &`]: {
890
+ color: theme.palette.text.secondary,
891
+ lineHeight: theme.typography.body1.lineHeight,
892
+ fontWeight: theme.typography.fontWeightBold,
893
+ backgroundColor: theme.palette.grey[50],
894
+ },
895
+
896
+ ...(ownerState.variant === "head" && {
897
+ lineHeight: theme.typography.body1.lineHeight,
898
+ fontWeight: theme.typography.fontWeightBold,
899
+ }),
900
+
901
+ ...(ownerState.variant === "number" && {
902
+ textAlign: "right",
903
+ fontFeatureSettings: '"lnum", "tnum"',
904
+ }),
905
+
906
+ ...(ownerState.padding === "checkbox" && {
907
+ width: 48, // prevent the checkbox column from growing
908
+ padding: "0 0 0 4px",
909
+ }),
910
+
911
+ ...(ownerState.padding === "none" && {
912
+ padding: 0,
913
+ }),
914
+
915
+ ...(ownerState.align === "left" && {
916
+ textAlign: "left",
917
+ }),
918
+
919
+ ...(ownerState.align === "center" && {
920
+ textAlign: "center",
921
+ }),
922
+
923
+ ...(ownerState.align === "right" && {
924
+ textAlign: "right",
925
+ flexDirection: "row-reverse",
926
+ }),
927
+
928
+ ...(ownerState.align === "justify" && {
929
+ textAlign: "justify",
930
+ }),
931
+ }),
932
+ },
933
+ },
934
+ MuiTableContainer: {
935
+ styleOverrides: {
936
+ root: ({ theme }) => ({
937
+ width: "unset",
938
+ maxWidth: "100%",
939
+ marginBlockStart: theme.spacing(0),
940
+ marginBlockEnd: theme.spacing(4),
941
+ marginInline: 0,
942
+ overflowX: "auto",
943
+
944
+ "&:last-child": {
945
+ marginBlock: 0,
946
+ },
947
+ }),
948
+ },
949
+ },
950
+ MuiTableRow: {
951
+ styleOverrides: {
952
+ root: ({ theme }) => ({
953
+ verticalAlign: "unset",
954
+ [`&.${tableRowClasses.root}:hover`]: {
955
+ backgroundColor: theme.palette.grey[50],
956
+ },
957
+ [`&.${tableRowClasses.selected}`]: {
958
+ backgroundColor: theme.palette.primary.lighter,
959
+ "&:hover": {
960
+ backgroundColor: theme.palette.primary.lighter,
961
+ },
962
+ },
963
+ }),
964
+ },
965
+ },
966
+ MuiTableSortLabel: {
967
+ defaultProps: {
968
+ IconComponent: ArrowDownIcon,
969
+ },
970
+ styleOverrides: {
971
+ root: ({ theme }) => ({
972
+ cursor: "pointer",
973
+ display: "inline-flex",
974
+ justifyContent: "flex-start",
975
+ flexDirection: "inherit",
976
+ alignItems: "center",
977
+ "&:focus-visible": {
978
+ color: theme.palette.text.primary,
979
+ outlineOffset: theme.spacing(4),
980
+ outlineStyle: "solid",
981
+ outlineWidth: "2px",
982
+ outlineColor: theme.palette.primary.main,
983
+ },
984
+ "&:hover": {
985
+ color: theme.palette.text.primary,
986
+ [`& .${tableSortLabelClasses.icon}`]: {
987
+ opacity: 1,
988
+ },
989
+ },
990
+ [`&.${tableSortLabelClasses.active}`]: {
991
+ color: theme.palette.text.secondary,
992
+ [`& .${tableSortLabelClasses.icon}`]: {
993
+ opacity: 1,
994
+ color: "inherit",
995
+ },
996
+ },
997
+ }),
998
+ icon: ({ theme, ownerState }) => ({
999
+ fontSize: "inherit",
1000
+ marginRight: 0,
1001
+ marginLeft: 0,
1002
+ opacity: 0,
1003
+ color: "inherit",
1004
+ transition: theme.transitions.create(["opacity", "transform"], {
1005
+ duration: theme.transitions.duration.shorter,
1006
+ }),
1007
+ userSelect: "none",
1008
+
1009
+ [`.${tableCellClasses.alignRight} &`]: {
1010
+ marginInlineEnd: theme.spacing(2),
1011
+ },
1012
+
1013
+ [`.${tableCellClasses.alignLeft} &`]: {
1014
+ marginInlineStart: theme.spacing(2),
1015
+ },
1016
+
1017
+ ...(ownerState.direction === "desc" && {
1018
+ transform: "rotate(0deg)",
1019
+ }),
1020
+ ...(ownerState.direction === "asc" && {
1021
+ transform: "rotate(180deg)",
1022
+ }),
1023
+ }),
1024
+ },
1025
+ },
771
1026
  MuiTabs: {
772
1027
  styleOverrides: {
773
1028
  root: ({ theme }) => ({
@@ -780,6 +1035,103 @@ export const components: ThemeOptions["components"] = {
780
1035
  }),
781
1036
  },
782
1037
  },
1038
+ MuiTooltip: {
1039
+ defaultProps: {
1040
+ arrow: true,
1041
+ enterDelay: 500,
1042
+ enterNextDelay: 250,
1043
+ placement: "top",
1044
+ },
1045
+ styleOverrides: {
1046
+ tooltip: ({ theme, ownerState }) => ({
1047
+ maxWidth: `calc(${theme.mixins.maxWidth} / 2)`,
1048
+ paddingBlock: theme.spacing(2),
1049
+ paddingInline: theme.spacing(3),
1050
+ backgroundColor: theme.palette.grey[900],
1051
+ color: theme.palette.common.white,
1052
+ fontSize: theme.typography.subtitle1.fontSize,
1053
+ lineHeight: theme.typography.subtitle1.lineHeight,
1054
+ ...(ownerState.touch === true && {
1055
+ paddingBlock: theme.spacing(2),
1056
+ paddingInline: theme.spacing(3),
1057
+ fontSize: theme.typography.subtitle1.fontSize,
1058
+ lineHeight: theme.typography.subtitle1.lineHeight,
1059
+ fontWeight: theme.typography.fontWeightRegular,
1060
+ }),
1061
+ [`.${tooltipClasses.popper}[data-popper-placement*="left"] &`]: {
1062
+ transformOrigin: "right center",
1063
+ ...(ownerState.isRtl
1064
+ ? {
1065
+ marginLeft: theme.spacing(3),
1066
+ ...(ownerState.touch === true && {
1067
+ marginLeft: theme.spacing(4),
1068
+ }),
1069
+ }
1070
+ : {
1071
+ marginRight: theme.spacing(3),
1072
+ ...(ownerState.touch === true && {
1073
+ marginRight: theme.spacing(4),
1074
+ }),
1075
+ }),
1076
+ },
1077
+ [`.${tooltipClasses.popper}[data-popper-placement*="right"] &`]: {
1078
+ transformOrigin: "left center",
1079
+ ...(ownerState.isRtl
1080
+ ? {
1081
+ marginRight: theme.spacing(3),
1082
+ ...(ownerState.touch === true && {
1083
+ marginRight: theme.spacing(4),
1084
+ }),
1085
+ }
1086
+ : {
1087
+ marginLeft: theme.spacing(3),
1088
+ ...(ownerState.touch === true && {
1089
+ marginLeft: theme.spacing(4),
1090
+ }),
1091
+ }),
1092
+ },
1093
+ [`.${tooltipClasses.popper}[data-popper-placement*="top"] &`]: {
1094
+ transformOrigin: "center bottom",
1095
+ marginBottom: theme.spacing(3),
1096
+ ...(ownerState.touch === true && {
1097
+ marginBottom: theme.spacing(4),
1098
+ }),
1099
+ },
1100
+ [`.${tooltipClasses.popper}[data-popper-placement*="bottom"] &`]: {
1101
+ transformOrigin: "center top",
1102
+ marginTop: theme.spacing(3),
1103
+ ...(ownerState.touch === true && {
1104
+ marginTop: theme.spacing(4),
1105
+ }),
1106
+ },
1107
+ }),
1108
+ arrow: ({ theme }) => ({
1109
+ color: theme.palette.grey[900],
1110
+ "&::before": {
1111
+ borderRadius: "0",
1112
+ },
1113
+
1114
+ [`.${tooltipClasses.popper}[data-popper-placement*="top"] &::before`]: {
1115
+ borderRadius: `0 0 3px 0`,
1116
+ },
1117
+
1118
+ [`.${tooltipClasses.popper}[data-popper-placement*="right"] &::before`]:
1119
+ {
1120
+ borderRadius: `0 0 0 3px`,
1121
+ },
1122
+
1123
+ [`.${tooltipClasses.popper}[data-popper-placement*="bottom"] &::before`]:
1124
+ {
1125
+ borderRadius: `3px 0 0 0`,
1126
+ },
1127
+
1128
+ [`.${tooltipClasses.popper}[data-popper-placement*="left"] &::before`]:
1129
+ {
1130
+ borderRadius: `0 3px 0 0`,
1131
+ },
1132
+ }),
1133
+ },
1134
+ },
783
1135
  MuiTypography: {
784
1136
  defaultProps: {
785
1137
  fontFamily:
@@ -59,7 +59,6 @@ declare module "@mui/material/Link" {
59
59
  body1: false;
60
60
  body2: false;
61
61
  button: false;
62
- caption: false;
63
62
  h1: false;
64
63
  h2: false;
65
64
  h3: false;
@@ -89,4 +88,21 @@ declare module "@mui/material/Link" {
89
88
  }
90
89
  }
91
90
 
91
+ declare module "@mui/material/TableCell" {
92
+ interface TableCellPropsVariantOverrides {
93
+ action: true;
94
+ body: true;
95
+ date: true;
96
+ footer: true;
97
+ head: true;
98
+ number: true;
99
+ }
100
+ }
101
+
102
+ declare module "@mui/material/Tooltip" {
103
+ interface TooltipComponentsPropsOverrides {
104
+ placement?: "bottom" | "left" | "right" | "top";
105
+ }
106
+ }
107
+
92
108
  export {};
@@ -13,6 +13,12 @@
13
13
  import type { ThemeOptions } from "@mui/material";
14
14
  import * as Tokens from "@okta/odyssey-design-tokens";
15
15
 
16
+ // Strip units from BorderRadiusBase to accommodate MUI's typing
17
+ const NumericalBorderRadiusBase =
18
+ typeof Tokens.BorderRadiusBase === "string"
19
+ ? Number(Tokens.BorderRadiusBase.replace(/(\d+).*/, "$1"))
20
+ : Tokens.BorderRadiusBase;
21
+
16
22
  export const shape: ThemeOptions["shape"] = {
17
- borderRadius: Tokens.BorderRadiusBase,
23
+ borderRadius: NumericalBorderRadiusBase,
18
24
  };
@@ -12,22 +12,22 @@
12
12
 
13
13
  import { createTheme } from "@mui/material/styles";
14
14
 
15
+ import { components } from "./components";
16
+ import { mixins } from "./mixins";
15
17
  import { palette } from "./palette";
16
- import "./palette.types";
17
18
  import { shape } from "./shape";
18
- import { mixins } from "./mixins";
19
- import "./mixins.types";
20
19
  import { spacing } from "./spacing";
21
20
  import { typography } from "./typography";
22
- import "./typography.types";
23
- import { components } from "./components";
24
21
  import "./components.types";
22
+ import "./mixins.types";
23
+ import "./palette.types";
24
+ import "./typography.types";
25
25
 
26
26
  export const theme = createTheme({
27
+ components,
28
+ mixins,
27
29
  palette,
28
30
  shape,
29
- mixins,
30
31
  spacing,
31
32
  typography,
32
- components,
33
33
  });
@@ -28,37 +28,37 @@ export const typography: ThemeOptions["typography"] = {
28
28
  letterSpacing: 0,
29
29
  },
30
30
  h1: {
31
- fontWeight: Tokens.FontWeightBold,
31
+ fontWeight: Number(Tokens.FontWeightBold),
32
32
  fontSize: Tokens.FontSizeHeading1,
33
33
  lineHeight: Tokens.FontLineHeightHeading1,
34
34
  marginBottom: Tokens.SpaceScale1,
35
35
  },
36
36
  h2: {
37
- fontWeight: Tokens.FontWeightBold,
37
+ fontWeight: Number(Tokens.FontWeightBold),
38
38
  fontSize: Tokens.FontSizeHeading2,
39
39
  lineHeight: Tokens.FontLineHeightHeading2,
40
40
  marginBottom: Tokens.SpaceScale1,
41
41
  },
42
42
  h3: {
43
- fontWeight: Tokens.FontWeightBold,
43
+ fontWeight: Number(Tokens.FontWeightBold),
44
44
  fontSize: Tokens.FontSizeHeading3,
45
45
  lineHeight: Tokens.FontLineHeightHeading3,
46
46
  marginBottom: Tokens.SpaceScale1,
47
47
  },
48
48
  h4: {
49
- fontWeight: Tokens.FontWeightBold,
49
+ fontWeight: Number(Tokens.FontWeightBold),
50
50
  fontSize: Tokens.FontSizeHeading4,
51
51
  lineHeight: Tokens.FontLineHeightHeading4,
52
52
  marginBottom: Tokens.SpaceScale1,
53
53
  },
54
54
  h5: {
55
- fontWeight: Tokens.FontWeightBold,
55
+ fontWeight: Number(Tokens.FontWeightBold),
56
56
  fontSize: Tokens.FontSizeHeading5,
57
57
  lineHeight: Tokens.FontLineHeightHeading5,
58
58
  marginBottom: Tokens.SpaceScale1,
59
59
  },
60
60
  h6: {
61
- fontWeight: Tokens.FontWeightBold,
61
+ fontWeight: Number(Tokens.FontWeightBold),
62
62
  fontSize: Tokens.FontScale2,
63
63
  lineHeight: Tokens.FontLineHeightHeading6,
64
64
  marginBottom: Tokens.SpaceScale1,
@@ -25,17 +25,16 @@ declare module "@mui/material/styles" {
25
25
 
26
26
  declare module "@mui/material/Typography" {
27
27
  interface TypographyPropsVariantOverrides {
28
- body1: true;
28
+ body1: true; // Design may refer to this as "body"
29
29
  body2: false;
30
- body: true;
31
30
  button: false;
32
31
  kbd: true;
33
32
  legend: true;
34
33
  overline: false;
35
- subtitle1: true;
34
+ subtitle1: true; // Design may refer to this as "caption"
36
35
  subtitle2: false;
37
- default: true; // used by Link
38
- monochrome: true; // used by Link
36
+ default: true; // used by <Link>
37
+ monochrome: true; // used by <Link>
39
38
  }
40
39
  }
41
40
 
@@ -10,12 +10,13 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { oid, length } from "./oid";
13
+ import { createUniqueId, uniqueIdLength } from "./createUniqueId";
14
14
 
15
- describe("oid", () => {
15
+ describe("createUniqueId", () => {
16
16
  it("returns a nice id string", () => {
17
- const result = oid();
17
+ const result = createUniqueId();
18
+
18
19
  expect(typeof result).toBe("string");
19
- expect(result).toHaveLength(length);
20
+ expect(result).toHaveLength(uniqueIdLength);
20
21
  });
21
22
  });
@@ -10,13 +10,8 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { useMemo } from "react";
13
+ // This is a random number chosen to shrink down the unique ID to an arbitrary length.
14
+ export const uniqueIdLength = 6;
14
15
 
15
- export const length = 6;
16
-
17
- export const oid = (): string => Math.random().toString(36).slice(-length);
18
-
19
- export const useOid = (id?: string): string => {
20
- const _oid = useMemo(oid, [oid]);
21
- return id || _oid;
22
- };
16
+ export const createUniqueId = (): string =>
17
+ Math.random().toString(36).slice(-uniqueIdLength);
@@ -10,4 +10,5 @@
10
10
  * See the License for the specific language governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- export { oid, useOid } from "./oid";
13
+ export * from "./createUniqueId";
14
+ export * from "./useUniqueId";
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Copyright (c) 2022-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 { useMemo } from "react";
14
+
15
+ import { createUniqueId } from "./createUniqueId";
16
+
17
+ export const useUniqueId = (id?: string): string => {
18
+ const uniqueId = useMemo(() => createUniqueId(), []);
19
+
20
+ return id || uniqueId;
21
+ };
@@ -1 +0,0 @@
1
- {"version":3,"file":"oid.d.ts","sourceRoot":"","sources":["../../src/utils/oid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,eAAO,MAAM,MAAM,IAAI,CAAC;AAExB,eAAO,MAAM,GAAG,QAAO,MAAmD,CAAC;AAE3E,eAAO,MAAM,MAAM,+BAAkB,MAGpC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/oid.ts"],"names":["useMemo","length","oid","Math","random","toString","slice","useOid","id","_oid"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,OAAT,QAAwB,OAAxB;AAEA,OAAO,MAAMC,MAAM,GAAG,CAAf;AAEP,OAAO,MAAMC,GAAG,GAAG,MAAcC,IAAI,CAACC,MAAL,GAAcC,QAAd,CAAuB,EAAvB,EAA2BC,KAA3B,CAAiC,CAACL,MAAlC,CAA1B;AAEP,OAAO,MAAMM,MAAM,GAAIC,EAAD,IAAyB;AAC7C,QAAMC,IAAI,GAAGT,OAAO,CAACE,GAAD,EAAM,CAACA,GAAD,CAAN,CAApB;;AACA,SAAOM,EAAE,IAAIC,IAAb;AACD,CAHM","sourcesContent":["/*!\n * Copyright (c) 2021-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 { useMemo } from \"react\";\n\nexport const length = 6;\n\nexport const oid = (): string => Math.random().toString(36).slice(-length);\n\nexport const useOid = (id?: string): string => {\n const _oid = useMemo(oid, [oid]);\n return id || _oid;\n};\n"],"file":"oid.js"}