@okta/odyssey-react-mui 1.14.2 → 1.14.3
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.
- package/CHANGELOG.md +4 -0
- package/dist/IconWithTooltip.js +63 -0
- package/dist/IconWithTooltip.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/IconWithTooltip.d.ts +31 -0
- package/dist/src/IconWithTooltip.d.ts.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/IconWithTooltip.tsx +90 -0
- package/src/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okta/odyssey-react-mui",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.3",
|
|
4
4
|
"description": "React MUI components for Odyssey, Okta's design system",
|
|
5
5
|
"author": "Okta, Inc.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@mui/system": "^5.15.9",
|
|
52
52
|
"@mui/utils": "^5.15.9",
|
|
53
53
|
"@mui/x-date-pickers": "^5.0.15",
|
|
54
|
-
"@okta/odyssey-design-tokens": "^1.14.
|
|
54
|
+
"@okta/odyssey-design-tokens": "^1.14.3",
|
|
55
55
|
"date-fns": "^2.30.0",
|
|
56
56
|
"i18next": "^23.8.2",
|
|
57
57
|
"material-react-table": "^2.11.3",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"react": ">=17 <19",
|
|
64
64
|
"react-dom": ">=17 <19"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "8ffc832fce91c68f4b6396e06051859a8c2dd0a1"
|
|
67
67
|
}
|
|
@@ -0,0 +1,90 @@
|
|
|
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 { memo, ReactNode } from "react";
|
|
14
|
+
import styled from "@emotion/styled";
|
|
15
|
+
import { Tooltip as MuiTooltip } from "@mui/material";
|
|
16
|
+
import type { TooltipProps as MuiTooltipProps } from "@mui/material";
|
|
17
|
+
|
|
18
|
+
import { HtmlProps } from "./HtmlProps";
|
|
19
|
+
import { InformationCircleIcon } from "./icons.generated";
|
|
20
|
+
import { useMuiProps } from "./MuiPropsContext";
|
|
21
|
+
import {
|
|
22
|
+
useOdysseyDesignTokens,
|
|
23
|
+
DesignTokens,
|
|
24
|
+
} from "./OdysseyDesignTokensContext";
|
|
25
|
+
|
|
26
|
+
const IconContainer = styled.span<{
|
|
27
|
+
odysseyDesignTokens: DesignTokens;
|
|
28
|
+
}>(({ odysseyDesignTokens }) => ({
|
|
29
|
+
display: "inline-flex",
|
|
30
|
+
transitionProperty: "border-color, box-shadow, outline",
|
|
31
|
+
transitionDuration: odysseyDesignTokens.TransitionDurationMain,
|
|
32
|
+
border: "1px solid transparent",
|
|
33
|
+
|
|
34
|
+
"&:focus, &:focus-visible": {
|
|
35
|
+
borderColor: odysseyDesignTokens.FocusOutlineColorPrimary,
|
|
36
|
+
boxShadow: `0 0 0 1px ${odysseyDesignTokens.FocusOutlineColorPrimary}`,
|
|
37
|
+
outline: `${odysseyDesignTokens.FocusOutlineWidthMain} ${odysseyDesignTokens.FocusOutlineStyle} transparent`,
|
|
38
|
+
outlineOffset: odysseyDesignTokens.FocusOutlineOffsetTight,
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
svg: {
|
|
42
|
+
display: "flex",
|
|
43
|
+
},
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
export type IconWithTooltipProps = {
|
|
47
|
+
/**
|
|
48
|
+
* The icon to render. Defaults to `InformationCircleIcon`
|
|
49
|
+
*/
|
|
50
|
+
IconComponent?: ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* The placement of the Tooltip
|
|
53
|
+
*/
|
|
54
|
+
placement?: MuiTooltipProps["placement"];
|
|
55
|
+
/**
|
|
56
|
+
* The text to display in the Tooltip
|
|
57
|
+
*/
|
|
58
|
+
tooltipText: string;
|
|
59
|
+
} & Pick<HtmlProps, "testId" | "translate">;
|
|
60
|
+
|
|
61
|
+
const IconWithTooltip = ({
|
|
62
|
+
IconComponent = <InformationCircleIcon />,
|
|
63
|
+
placement = "right",
|
|
64
|
+
testId,
|
|
65
|
+
tooltipText,
|
|
66
|
+
translate,
|
|
67
|
+
}: IconWithTooltipProps) => {
|
|
68
|
+
const muiProps = useMuiProps();
|
|
69
|
+
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<MuiTooltip
|
|
73
|
+
data-se={testId}
|
|
74
|
+
describeChild
|
|
75
|
+
placement={placement}
|
|
76
|
+
tabIndex={0}
|
|
77
|
+
title={tooltipText}
|
|
78
|
+
translate={translate}
|
|
79
|
+
>
|
|
80
|
+
<IconContainer odysseyDesignTokens={odysseyDesignTokens} {...muiProps}>
|
|
81
|
+
{IconComponent}
|
|
82
|
+
</IconContainer>
|
|
83
|
+
</MuiTooltip>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const MemoizedIconWithTooltip = memo(IconWithTooltip);
|
|
88
|
+
MemoizedIconWithTooltip.displayName = "IconWithTooltip";
|
|
89
|
+
|
|
90
|
+
export { MemoizedIconWithTooltip as IconWithTooltip };
|
package/src/index.ts
CHANGED