@okta/odyssey-react-mui 1.23.0 → 1.24.1
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 +31 -0
- package/dist/Autocomplete.js +2 -0
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Banner.js +6 -2
- package/dist/Banner.js.map +1 -1
- package/dist/Callout.js +6 -2
- package/dist/Callout.js.map +1 -1
- package/dist/ContrastModeProvider.js +86 -0
- package/dist/ContrastModeProvider.js.map +1 -0
- package/dist/FieldHint.js +20 -6
- package/dist/FieldHint.js.map +1 -1
- package/dist/Link.js.map +1 -1
- package/dist/OdysseyProvider.js +40 -20
- package/dist/OdysseyProvider.js.map +1 -1
- package/dist/Stack.js +32 -0
- package/dist/Stack.js.map +1 -0
- package/dist/Tag.js +64 -22
- package/dist/Tag.js.map +1 -1
- package/dist/Typography.js +27 -6
- package/dist/Typography.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/index.scss +8 -4
- package/dist/labs/datePickerTheme.js +3 -6
- package/dist/labs/datePickerTheme.js.map +1 -1
- package/dist/src/Autocomplete.d.ts +7 -1
- package/dist/src/Autocomplete.d.ts.map +1 -1
- package/dist/src/Banner.d.ts +16 -12
- package/dist/src/Banner.d.ts.map +1 -1
- package/dist/src/Callout.d.ts +9 -9
- package/dist/src/Callout.d.ts.map +1 -1
- package/dist/src/ContrastModeProvider.d.ts +34 -0
- package/dist/src/ContrastModeProvider.d.ts.map +1 -0
- package/dist/src/FieldHint.d.ts.map +1 -1
- package/dist/src/Link.d.ts +3 -1
- package/dist/src/Link.d.ts.map +1 -1
- package/dist/src/OdysseyProvider.d.ts +5 -3
- package/dist/src/OdysseyProvider.d.ts.map +1 -1
- package/dist/src/Stack.d.ts +33 -0
- package/dist/src/Stack.d.ts.map +1 -0
- package/dist/src/Tag.d.ts.map +1 -1
- package/dist/src/Typography.d.ts +3 -2
- package/dist/src/Typography.d.ts.map +1 -1
- package/dist/src/index.d.ts +6 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/labs/datePickerTheme.d.ts.map +1 -1
- package/dist/src/theme/components.d.ts.map +1 -1
- package/dist/src/theme/palette.d.ts.map +1 -1
- package/dist/src/theme/palette.types.d.ts +2 -0
- package/dist/src/theme/palette.types.d.ts.map +1 -1
- package/dist/theme/components.js +345 -287
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/palette.js +2 -1
- package/dist/theme/palette.js.map +1 -1
- package/dist/theme/palette.types.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/Autocomplete.tsx +13 -0
- package/src/Banner.tsx +29 -14
- package/src/Callout.tsx +18 -11
- package/src/ContrastModeProvider.tsx +131 -0
- package/src/FieldHint.tsx +28 -4
- package/src/Link.tsx +3 -1
- package/src/OdysseyProvider.tsx +54 -27
- package/src/Stack.tsx +56 -0
- package/src/Tag.tsx +65 -21
- package/src/Typography.test.tsx +26 -0
- package/src/Typography.tsx +38 -6
- package/src/index.ts +4 -0
- package/src/labs/datePickerTheme.tsx +2 -6
- package/src/theme/components.tsx +371 -293
- package/src/theme/palette.ts +2 -1
- package/src/theme/palette.types.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OdysseyProvider.js","names":["memo","OdysseyCacheProvider","OdysseyThemeProvider","OdysseyTranslationProvider","jsx","_jsx","scopedCssBaselineStyles","height","
|
|
1
|
+
{"version":3,"file":"OdysseyProvider.js","names":["memo","useMemo","OdysseyCacheProvider","OdysseyThemeProvider","OdysseyTranslationProvider","ContrastModeProvider","useContrastContext","jsx","_jsx","scopedCssBaselineStyles","height","OdysseyProviderInner","children","designTokensOverride","emotionRoot","emotionRootElement","shadowDomElement","shadowRootElement","languageCode","nonce","stylisPlugins","themeOverride","translationOverrides","contrastMode","memoizedThemeProps","odysseyContrastMode","hasShadowDom","Boolean","_ScopedCssBaseline","sx","OdysseyProvider","providerProps","MemoizedOdysseyProvider"],"sources":["../src/OdysseyProvider.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-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, ReactNode, useMemo } from \"react\";\nimport { ScopedCssBaseline } from \"@mui/material\";\n\nimport {\n OdysseyCacheProvider,\n OdysseyCacheProviderProps,\n} from \"./OdysseyCacheProvider\";\nimport {\n OdysseyThemeProvider,\n OdysseyThemeProviderProps,\n} from \"./OdysseyThemeProvider\";\nimport {\n OdysseyTranslationProvider,\n OdysseyTranslationProviderProps,\n} from \"./OdysseyTranslationProvider\";\nimport { DefaultSupportedLanguages } from \"./OdysseyTranslationProvider.types\";\nimport {\n ContrastMode,\n ContrastModeProvider,\n useContrastContext,\n} from \"./ContrastModeProvider\";\n\nconst scopedCssBaselineStyles = {\n height: \"inherit\",\n};\n\nexport type OdysseyProviderProps<\n SupportedLanguages extends string = DefaultSupportedLanguages,\n> = OdysseyCacheProviderProps &\n OdysseyThemeProviderProps &\n OdysseyTranslationProviderProps<SupportedLanguages> & {\n children: ReactNode;\n contrastMode?: ContrastMode;\n };\n\nconst OdysseyProviderInner = <SupportedLanguages extends string>({\n children,\n designTokensOverride,\n emotionRoot,\n emotionRootElement,\n shadowDomElement,\n shadowRootElement,\n languageCode,\n nonce,\n stylisPlugins,\n themeOverride,\n translationOverrides,\n}: OdysseyProviderProps<SupportedLanguages>) => {\n const { contrastMode } = useContrastContext();\n\n const memoizedThemeProps = useMemo(\n () => ({\n ...themeOverride,\n odysseyContrastMode: contrastMode,\n }),\n [themeOverride, contrastMode],\n );\n\n return (\n <OdysseyCacheProvider\n emotionRoot={emotionRoot}\n emotionRootElement={emotionRootElement}\n hasShadowDom={Boolean(shadowRootElement || shadowDomElement)}\n nonce={nonce}\n stylisPlugins={stylisPlugins}\n >\n <OdysseyThemeProvider\n designTokensOverride={designTokensOverride}\n shadowDomElement={shadowDomElement}\n shadowRootElement={shadowRootElement}\n themeOverride={memoizedThemeProps}\n >\n <ScopedCssBaseline sx={scopedCssBaselineStyles}>\n <OdysseyTranslationProvider<SupportedLanguages>\n languageCode={languageCode}\n translationOverrides={translationOverrides}\n >\n {children}\n </OdysseyTranslationProvider>\n </ScopedCssBaseline>\n </OdysseyThemeProvider>\n </OdysseyCacheProvider>\n );\n};\n\nconst OdysseyProvider = <SupportedLanguages extends string>({\n contrastMode,\n ...providerProps\n}: OdysseyProviderProps<SupportedLanguages>) => (\n <ContrastModeProvider contrastMode={contrastMode}>\n <OdysseyProviderInner {...providerProps} />\n </ContrastModeProvider>\n);\n\nconst MemoizedOdysseyProvider = memo(OdysseyProvider) as typeof OdysseyProvider;\n\nexport { MemoizedOdysseyProvider as OdysseyProvider };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAaC,OAAO,QAAQ,OAAO;AAAC,SAI/CC,oBAAoB;AAAA,SAIpBC,oBAAoB;AAAA,SAIpBC,0BAA0B;AAAA,SAM1BC,oBAAoB,EACpBC,kBAAkB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGpB,MAAMC,uBAAuB,GAAG;EAC9BC,MAAM,EAAE;AACV,CAAC;AAWD,MAAMC,oBAAoB,GAAGA,CAAoC;EAC/DC,QAAQ;EACRC,oBAAoB;EACpBC,WAAW;EACXC,kBAAkB;EAClBC,gBAAgB;EAChBC,iBAAiB;EACjBC,YAAY;EACZC,KAAK;EACLC,aAAa;EACbC,aAAa;EACbC;AACwC,CAAC,KAAK;EAC9C,MAAM;IAAEC;EAAa,CAAC,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
3
|
+
* Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
4
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
5
|
+
*
|
|
6
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
9
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
+
*
|
|
11
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { memo } from "react";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
export const stackSpacingValues = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
17
|
+
export const stackDirectionValues = ["row", "row-reverse", "column", "column-reverse"];
|
|
18
|
+
const Stack = ({
|
|
19
|
+
children,
|
|
20
|
+
direction = "column",
|
|
21
|
+
spacing = 2
|
|
22
|
+
}) => {
|
|
23
|
+
return _jsx(_Stack, {
|
|
24
|
+
direction: direction,
|
|
25
|
+
spacing: spacing,
|
|
26
|
+
children: children
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const MemoizedStack = memo(Stack);
|
|
30
|
+
MemoizedStack.displayName = "Stack";
|
|
31
|
+
export { MemoizedStack as Stack };
|
|
32
|
+
//# sourceMappingURL=Stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stack.js","names":["memo","jsx","_jsx","stackSpacingValues","stackDirectionValues","Stack","children","direction","spacing","_Stack","MemoizedStack","displayName"],"sources":["../src/Stack.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 } from \"react\";\nimport { Stack as MuiStack, StackProps as MuiStackProps } from \"@mui/material\";\n\nexport const stackSpacingValues = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] as const;\nexport const stackDirectionValues = [\n \"row\",\n \"row-reverse\",\n \"column\",\n \"column-reverse\",\n] as const;\n\nexport type OdysseyStackProps = {\n children?: MuiStackProps[\"children\"];\n /**\n * The component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: MuiStackProps[\"component\"];\n /**\n * Defines the flex-direction style property. It is applied for all screen sizes.\n */\n direction?: (typeof stackDirectionValues)[number];\n /**\n * Defines the space between immediate children.\n */\n spacing?: (typeof stackSpacingValues)[number];\n sx?: MuiStackProps[\"sx\"];\n};\n\nconst Stack = ({\n children,\n direction = \"column\",\n spacing = 2,\n}: OdysseyStackProps) => {\n return (\n <MuiStack direction={direction} spacing={spacing}>\n {children}\n </MuiStack>\n );\n};\n\nconst MemoizedStack = memo(Stack);\nMemoizedStack.displayName = \"Stack\";\n\nexport { MemoizedStack as Stack };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG7B,OAAO,MAAMC,kBAAkB,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAU;AACzE,OAAO,MAAMC,oBAAoB,GAAG,CAClC,KAAK,EACL,aAAa,EACb,QAAQ,EACR,gBAAgB,CACR;AAmBV,MAAMC,KAAK,GAAGA,CAAC;EACbC,QAAQ;EACRC,SAAS,GAAG,QAAQ;EACpBC,OAAO,GAAG;AACO,CAAC,KAAK;EACvB,OACEN,IAAA,CAAAO,MAAA;IAAUF,SAAS,EAAEA,SAAU;IAACC,OAAO,EAAEA,OAAQ;IAAAF,QAAA,EAC9CA;EAAQ,CACD,CAAC;AAEf,CAAC;AAED,MAAMI,aAAa,GAAGV,IAAI,CAACK,KAAK,CAAC;AACjCK,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAIL,KAAK"}
|
package/dist/Tag.js
CHANGED
|
@@ -16,74 +16,112 @@ import { TagListContext } from "./TagListContext.js";
|
|
|
16
16
|
import { MuiPropsContext } from "./MuiPropsContext.js";
|
|
17
17
|
import { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext.js";
|
|
18
18
|
import { CloseCircleFilledIcon } from "./icons.generated/index.js";
|
|
19
|
+
import { useContrastContext } from "./ContrastModeProvider.js";
|
|
19
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
21
|
export const tagColorVariants = ["default", "info", "accentOne", "accentTwo", "accentThree", "accentFour"];
|
|
21
|
-
const getChipColors = (colorVariant, odysseyDesignTokens) => {
|
|
22
|
+
const getChipColors = (colorVariant, odysseyDesignTokens, contrastMode) => {
|
|
22
23
|
const colors = {
|
|
23
24
|
default: {
|
|
24
|
-
|
|
25
|
+
...(contrastMode === "lowContrast" && {
|
|
26
|
+
background: odysseyDesignTokens.HueNeutral200,
|
|
27
|
+
text: odysseyDesignTokens.HueNeutral700
|
|
28
|
+
}),
|
|
29
|
+
...(contrastMode === "highContrast" && {
|
|
30
|
+
background: odysseyDesignTokens.HueNeutral100,
|
|
31
|
+
text: odysseyDesignTokens.HueNeutral700
|
|
32
|
+
}),
|
|
25
33
|
hover: odysseyDesignTokens.HueNeutral200,
|
|
26
34
|
active: odysseyDesignTokens.HueNeutral300,
|
|
27
|
-
text: odysseyDesignTokens.HueNeutral700,
|
|
28
35
|
border: odysseyDesignTokens.HueNeutral200,
|
|
29
36
|
deleteIcon: odysseyDesignTokens.HueNeutral500,
|
|
30
|
-
deleteIconHover: odysseyDesignTokens.
|
|
37
|
+
deleteIconHover: odysseyDesignTokens.HueNeutral700
|
|
31
38
|
},
|
|
32
39
|
info: {
|
|
33
|
-
|
|
40
|
+
...(contrastMode === "lowContrast" && {
|
|
41
|
+
background: odysseyDesignTokens.HueBlue200,
|
|
42
|
+
text: odysseyDesignTokens.HueBlue700
|
|
43
|
+
}),
|
|
44
|
+
...(contrastMode === "highContrast" && {
|
|
45
|
+
background: odysseyDesignTokens.HueBlue100,
|
|
46
|
+
text: odysseyDesignTokens.HueBlue700
|
|
47
|
+
}),
|
|
34
48
|
hover: odysseyDesignTokens.HueBlue200,
|
|
35
49
|
active: odysseyDesignTokens.HueBlue300,
|
|
36
|
-
text: odysseyDesignTokens.HueBlue700,
|
|
37
50
|
border: odysseyDesignTokens.HueBlue200,
|
|
38
51
|
deleteIcon: odysseyDesignTokens.HueBlue500,
|
|
39
|
-
deleteIconHover: odysseyDesignTokens.
|
|
52
|
+
deleteIconHover: odysseyDesignTokens.HueBlue700
|
|
40
53
|
},
|
|
41
54
|
accentOne: {
|
|
42
|
-
|
|
55
|
+
...(contrastMode === "lowContrast" && {
|
|
56
|
+
background: odysseyDesignTokens.HueAccentOne200,
|
|
57
|
+
text: odysseyDesignTokens.HueAccentOne700
|
|
58
|
+
}),
|
|
59
|
+
...(contrastMode === "highContrast" && {
|
|
60
|
+
background: odysseyDesignTokens.HueAccentOne100,
|
|
61
|
+
text: odysseyDesignTokens.HueAccentOne700
|
|
62
|
+
}),
|
|
43
63
|
hover: odysseyDesignTokens.HueAccentOne200,
|
|
44
64
|
active: odysseyDesignTokens.HueAccentOne300,
|
|
45
|
-
text: odysseyDesignTokens.HueAccentOne700,
|
|
46
65
|
border: odysseyDesignTokens.HueAccentOne200,
|
|
47
66
|
deleteIcon: odysseyDesignTokens.HueAccentOne500,
|
|
48
|
-
deleteIconHover: odysseyDesignTokens.
|
|
67
|
+
deleteIconHover: odysseyDesignTokens.HueAccentOne700
|
|
49
68
|
},
|
|
50
69
|
accentTwo: {
|
|
51
|
-
|
|
70
|
+
...(contrastMode === "lowContrast" && {
|
|
71
|
+
background: odysseyDesignTokens.HueAccentTwo200,
|
|
72
|
+
text: odysseyDesignTokens.HueAccentTwo800
|
|
73
|
+
}),
|
|
74
|
+
...(contrastMode === "highContrast" && {
|
|
75
|
+
background: odysseyDesignTokens.HueAccentTwo100,
|
|
76
|
+
text: odysseyDesignTokens.HueAccentTwo700
|
|
77
|
+
}),
|
|
52
78
|
hover: odysseyDesignTokens.HueAccentTwo200,
|
|
53
79
|
active: odysseyDesignTokens.HueAccentTwo300,
|
|
54
|
-
text: odysseyDesignTokens.HueAccentTwo700,
|
|
55
80
|
border: odysseyDesignTokens.HueAccentTwo200,
|
|
56
81
|
deleteIcon: odysseyDesignTokens.HueAccentTwo500,
|
|
57
|
-
deleteIconHover: odysseyDesignTokens.
|
|
82
|
+
deleteIconHover: odysseyDesignTokens.HueAccentTwo700
|
|
58
83
|
},
|
|
59
84
|
accentThree: {
|
|
60
|
-
|
|
85
|
+
...(contrastMode === "lowContrast" && {
|
|
86
|
+
background: odysseyDesignTokens.HueAccentThree200,
|
|
87
|
+
text: odysseyDesignTokens.HueAccentThree700
|
|
88
|
+
}),
|
|
89
|
+
...(contrastMode === "highContrast" && {
|
|
90
|
+
background: odysseyDesignTokens.HueAccentThree100,
|
|
91
|
+
text: odysseyDesignTokens.HueAccentThree700
|
|
92
|
+
}),
|
|
61
93
|
hover: odysseyDesignTokens.HueAccentThree200,
|
|
62
94
|
active: odysseyDesignTokens.HueAccentThree300,
|
|
63
|
-
text: odysseyDesignTokens.HueAccentThree700,
|
|
64
95
|
border: odysseyDesignTokens.HueAccentThree200,
|
|
65
96
|
deleteIcon: odysseyDesignTokens.HueAccentThree500,
|
|
66
|
-
deleteIconHover: odysseyDesignTokens.
|
|
97
|
+
deleteIconHover: odysseyDesignTokens.HueAccentThree700
|
|
67
98
|
},
|
|
68
99
|
accentFour: {
|
|
69
|
-
|
|
100
|
+
...(contrastMode === "lowContrast" && {
|
|
101
|
+
background: odysseyDesignTokens.HueAccentFour200,
|
|
102
|
+
text: odysseyDesignTokens.HueAccentFour700
|
|
103
|
+
}),
|
|
104
|
+
...(contrastMode === "highContrast" && {
|
|
105
|
+
background: odysseyDesignTokens.HueAccentFour100,
|
|
106
|
+
text: odysseyDesignTokens.HueAccentFour700
|
|
107
|
+
}),
|
|
70
108
|
hover: odysseyDesignTokens.HueAccentFour200,
|
|
71
109
|
active: odysseyDesignTokens.HueAccentFour300,
|
|
72
|
-
text: odysseyDesignTokens.HueAccentFour700,
|
|
73
110
|
border: odysseyDesignTokens.HueAccentFour200,
|
|
74
111
|
deleteIcon: odysseyDesignTokens.HueAccentFour500,
|
|
75
|
-
deleteIconHover: odysseyDesignTokens.
|
|
112
|
+
deleteIconHover: odysseyDesignTokens.HueAccentFour700
|
|
76
113
|
}
|
|
77
114
|
};
|
|
78
115
|
return colors[colorVariant] || colors.default;
|
|
79
116
|
};
|
|
80
117
|
const StyledTag = styled(_Chip, {
|
|
81
|
-
shouldForwardProp: prop => !["colorVariant", "odysseyDesignTokens"].includes(prop)
|
|
118
|
+
shouldForwardProp: prop => !["colorVariant", "contrastMode", "odysseyDesignTokens"].includes(prop)
|
|
82
119
|
})(({
|
|
83
120
|
colorVariant,
|
|
121
|
+
contrastMode,
|
|
84
122
|
odysseyDesignTokens
|
|
85
123
|
}) => {
|
|
86
|
-
const colors = getChipColors(colorVariant, odysseyDesignTokens);
|
|
124
|
+
const colors = getChipColors(colorVariant, odysseyDesignTokens, contrastMode);
|
|
87
125
|
return {
|
|
88
126
|
backgroundColor: colors.background,
|
|
89
127
|
color: colors.text,
|
|
@@ -121,6 +159,9 @@ const Tag = ({
|
|
|
121
159
|
const {
|
|
122
160
|
chipElementType
|
|
123
161
|
} = useContext(TagListContext);
|
|
162
|
+
const {
|
|
163
|
+
contrastMode
|
|
164
|
+
} = useContrastContext();
|
|
124
165
|
const renderTag = useCallback(muiProps => _jsx(StyledTag, {
|
|
125
166
|
...muiProps,
|
|
126
167
|
as: chipElementType,
|
|
@@ -129,6 +170,7 @@ const Tag = ({
|
|
|
129
170
|
"data-se": testId,
|
|
130
171
|
colorVariant: colorVariant,
|
|
131
172
|
odysseyDesignTokens: odysseyDesignTokens,
|
|
173
|
+
contrastMode: contrastMode,
|
|
132
174
|
disabled: isDisabled,
|
|
133
175
|
icon: icon,
|
|
134
176
|
label: label,
|
|
@@ -136,7 +178,7 @@ const Tag = ({
|
|
|
136
178
|
onDelete: onRemove,
|
|
137
179
|
deleteIcon: _jsx(CloseCircleFilledIcon, {}),
|
|
138
180
|
translate: translate
|
|
139
|
-
}), [chipElementType, icon, isDisabled, label, onClick, onRemove, testId, translate, colorVariant, odysseyDesignTokens]);
|
|
181
|
+
}), [chipElementType, icon, isDisabled, label, onClick, onRemove, testId, translate, colorVariant, odysseyDesignTokens, contrastMode]);
|
|
140
182
|
return _jsx(MuiPropsContext.Consumer, {
|
|
141
183
|
children: renderTag
|
|
142
184
|
});
|
package/dist/Tag.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.js","names":["memo","useCallback","useContext","styled","TagListContext","MuiPropsContext","useOdysseyDesignTokens","CloseCircleFilledIcon","jsx","_jsx","tagColorVariants","getChipColors","colorVariant","odysseyDesignTokens","colors","default","background","HueNeutral100","hover","HueNeutral200","active","HueNeutral300","text","HueNeutral700","border","deleteIcon","HueNeutral500","deleteIconHover","HueNeutral600","info","HueBlue100","HueBlue200","HueBlue300","HueBlue700","HueBlue500","HueBlue600","accentOne","HueAccentOne100","HueAccentOne200","HueAccentOne300","HueAccentOne700","HueAccentOne500","HueAccentOne600","accentTwo","HueAccentTwo100","HueAccentTwo200","HueAccentTwo300","HueAccentTwo700","HueAccentTwo500","HueAccentTwo600","accentThree","HueAccentThree100","HueAccentThree200","HueAccentThree300","HueAccentThree700","HueAccentThree500","HueAccentThree600","accentFour","HueAccentFour100","HueAccentFour200","HueAccentFour300","HueAccentFour700","HueAccentFour500","HueAccentFour600","StyledTag","_Chip","shouldForwardProp","prop","includes","backgroundColor","color","borderColor","Tag","icon","isDisabled","label","onClick","onRemove","testId","translate","chipElementType","renderTag","muiProps","as","clickable","Boolean","disabled","onDelete","Consumer","children","MemoizedTag","displayName"],"sources":["../src/Tag.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-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 { Chip as MuiChip, ChipProps as MuiChipProps } from \"@mui/material\";\nimport { memo, ReactElement, useCallback, useContext } from \"react\";\nimport styled from \"@emotion/styled\";\nimport { TagListContext } from \"./TagListContext\";\nimport { MuiPropsContext, MuiPropsContextType } from \"./MuiPropsContext\";\nimport { HtmlProps } from \"./HtmlProps\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport { CloseCircleFilledIcon } from \"./icons.generated\";\n\nexport const tagColorVariants = [\n \"default\",\n \"info\",\n \"accentOne\",\n \"accentTwo\",\n \"accentThree\",\n \"accentFour\",\n] as const;\n\ntype TagColorVariant = (typeof tagColorVariants)[number];\n\nexport type TagProps = {\n icon?: ReactElement;\n isDisabled?: boolean;\n /**\n * The label text for the Tag\n */\n label: string;\n /**\n * Callback fired when the Tag is clicked\n */\n onClick?: MuiChipProps[\"onClick\"];\n /**\n * Callback fired when the remove button of the Tag is clicked\n */\n onRemove?: MuiChipProps[\"onDelete\"];\n /**\n * Color variant of the Tag, affecting its appearance\n */\n colorVariant?: TagColorVariant;\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst getChipColors = (\n colorVariant: TagColorVariant,\n odysseyDesignTokens: DesignTokens,\n) => {\n const colors = {\n default: {\n background: odysseyDesignTokens.HueNeutral100,\n hover: odysseyDesignTokens.HueNeutral200,\n active: odysseyDesignTokens.HueNeutral300,\n text: odysseyDesignTokens.HueNeutral700,\n border: odysseyDesignTokens.HueNeutral200,\n deleteIcon: odysseyDesignTokens.HueNeutral500,\n deleteIconHover: odysseyDesignTokens.HueNeutral600,\n },\n info: {\n background: odysseyDesignTokens.HueBlue100,\n hover: odysseyDesignTokens.HueBlue200,\n active: odysseyDesignTokens.HueBlue300,\n text: odysseyDesignTokens.HueBlue700,\n border: odysseyDesignTokens.HueBlue200,\n deleteIcon: odysseyDesignTokens.HueBlue500,\n deleteIconHover: odysseyDesignTokens.HueBlue600,\n },\n accentOne: {\n background: odysseyDesignTokens.HueAccentOne100,\n hover: odysseyDesignTokens.HueAccentOne200,\n active: odysseyDesignTokens.HueAccentOne300,\n text: odysseyDesignTokens.HueAccentOne700,\n border: odysseyDesignTokens.HueAccentOne200,\n deleteIcon: odysseyDesignTokens.HueAccentOne500,\n deleteIconHover: odysseyDesignTokens.HueAccentOne600,\n },\n accentTwo: {\n background: odysseyDesignTokens.HueAccentTwo100,\n hover: odysseyDesignTokens.HueAccentTwo200,\n active: odysseyDesignTokens.HueAccentTwo300,\n text: odysseyDesignTokens.HueAccentTwo700,\n border: odysseyDesignTokens.HueAccentTwo200,\n deleteIcon: odysseyDesignTokens.HueAccentTwo500,\n deleteIconHover: odysseyDesignTokens.HueAccentTwo600,\n },\n accentThree: {\n background: odysseyDesignTokens.HueAccentThree100,\n hover: odysseyDesignTokens.HueAccentThree200,\n active: odysseyDesignTokens.HueAccentThree300,\n text: odysseyDesignTokens.HueAccentThree700,\n border: odysseyDesignTokens.HueAccentThree200,\n deleteIcon: odysseyDesignTokens.HueAccentThree500,\n deleteIconHover: odysseyDesignTokens.HueAccentThree600,\n },\n accentFour: {\n background: odysseyDesignTokens.HueAccentFour100,\n hover: odysseyDesignTokens.HueAccentFour200,\n active: odysseyDesignTokens.HueAccentFour300,\n text: odysseyDesignTokens.HueAccentFour700,\n border: odysseyDesignTokens.HueAccentFour200,\n deleteIcon: odysseyDesignTokens.HueAccentFour500,\n deleteIconHover: odysseyDesignTokens.HueAccentFour600,\n },\n };\n\n return colors[colorVariant] || colors.default;\n};\n\nconst StyledTag = styled(MuiChip, {\n shouldForwardProp: (prop) =>\n ![\"colorVariant\", \"odysseyDesignTokens\"].includes(prop as string),\n})<{\n colorVariant: TagColorVariant;\n odysseyDesignTokens: DesignTokens;\n as?: React.ElementType; // Allow the 'as' prop to be forwarded\n}>(({ colorVariant, odysseyDesignTokens }) => {\n const colors = getChipColors(colorVariant, odysseyDesignTokens);\n\n return {\n backgroundColor: colors.background,\n color: colors.text,\n borderColor: colors.border,\n\n \"&.MuiChip-clickable:hover\": {\n backgroundColor: colors.hover,\n },\n\n \"&.MuiChip-clickable:active\": {\n backgroundColor: colors.active,\n },\n\n \"&.Mui-disabled\": {\n \"& .MuiChip-deleteIcon\": {\n color: odysseyDesignTokens.HueNeutral300,\n },\n },\n\n \"& .MuiChip-deleteIcon\": {\n color: colors.deleteIcon,\n\n \"&:hover\": {\n color: colors.deleteIconHover,\n },\n },\n };\n});\n\nconst Tag = ({\n colorVariant = \"default\",\n icon,\n isDisabled,\n label,\n onClick,\n onRemove,\n testId,\n translate,\n}: TagProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { chipElementType } = useContext(TagListContext);\n\n const renderTag = useCallback(\n (muiProps: MuiPropsContextType) => (\n <StyledTag\n {...muiProps}\n as={chipElementType}\n aria-disabled={isDisabled}\n clickable={Boolean(onClick)}\n data-se={testId}\n colorVariant={colorVariant}\n odysseyDesignTokens={odysseyDesignTokens}\n disabled={isDisabled}\n icon={icon}\n label={label}\n onClick={onClick}\n onDelete={onRemove}\n deleteIcon={<CloseCircleFilledIcon />}\n translate={translate}\n />\n ),\n [\n chipElementType,\n icon,\n isDisabled,\n label,\n onClick,\n onRemove,\n testId,\n translate,\n colorVariant,\n odysseyDesignTokens,\n ],\n );\n\n return <MuiPropsContext.Consumer>{renderTag}</MuiPropsContext.Consumer>;\n};\n\nconst MemoizedTag = memo(Tag);\nMemoizedTag.displayName = \"Tag\";\n\nexport { MemoizedTag as Tag };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAI,EAAgBC,WAAW,EAAEC,UAAU,QAAQ,OAAO;AACnE,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAC5BC,cAAc;AAAA,SACdC,eAAe;AAAA,SAItBC,sBAAsB;AAAA,SAEfC,qBAAqB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE9B,OAAO,MAAMC,gBAAgB,GAAG,CAC9B,SAAS,EACT,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,YAAY,CACJ;AAyBV,MAAMC,aAAa,GAAGA,CACpBC,YAA6B,EAC7BC,mBAAiC,KAC9B;EACH,MAAMC,MAAM,GAAG;IACbC,OAAO,EAAE;MACPC,UAAU,EAAEH,mBAAmB,CAACI,aAAa;MAC7CC,KAAK,EAAEL,mBAAmB,CAACM,aAAa;MACxCC,MAAM,EAAEP,mBAAmB,CAACQ,aAAa;MACzCC,IAAI,EAAET,mBAAmB,CAACU,aAAa;MACvCC,MAAM,EAAEX,mBAAmB,CAACM,aAAa;MACzCM,UAAU,EAAEZ,mBAAmB,CAACa,aAAa;MAC7CC,eAAe,EAAEd,mBAAmB,CAACe;IACvC,CAAC;IACDC,IAAI,EAAE;MACJb,UAAU,EAAEH,mBAAmB,CAACiB,UAAU;MAC1CZ,KAAK,EAAEL,mBAAmB,CAACkB,UAAU;MACrCX,MAAM,EAAEP,mBAAmB,CAACmB,UAAU;MACtCV,IAAI,EAAET,mBAAmB,CAACoB,UAAU;MACp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JC,UAAU;EACVC,KAAK;EACLC,OAAO;EACPC,QAAQ;EACRC,MAAM;EACNC;AACQ,CAAC,KAAK;EACd,MAAMlE,mBAAmB,GAAGP,sBAAsB,CAAC,CAAC;EACpD,MAAM;IAAE0E;EAAgB,CAAC,GAAG9E,UAAU,CAACE,cAAc,CAAC;EAEtD,MAAM6E,SAAS,GAAGhF,WAAW,CAC1BiF,QAA6B,IAC5BzE,IAAA,CAACuD,SAAS;IAAA,GACJkB,QAAQ;IACZC,EAAE,EAAEH,eAAgB;IACpB,iBAAeN,UAAW;IAC1BU,SAAS,EAAEC,OAAO,CAACT,OAAO,CAAE;IAC5B,WAASE,MAAO;IAChBlE,YAAY,EAAEA,YAAa;IAC3BC,mBAAmB,EAAEA,mBAAoB;IACzCyE,QAAQ,EAAEZ,UAAW;IACrBD,IAAI,EAAEA,IAAK;IACXE,KAAK,EAAEA,KAAM;IACbC,OAAO,EAAEA,OAAQ;IACjBW,QAAQ,EAAEV,QAAS;IACnBpD,UAAU,EAAEhB,IAAA,CAACF,qBAAqB,IAAE,CAAE;IACtCwE,SAAS,EAAEA;EAAU,CACtB,CACF,EACD,CACEC,eAAe,EACfP,IAAI,EACJC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,QAAQ,EACRC,MAAM,EACNC,SAAS,EACTnE,YAAY,EACZC,mBAAmB,CAEvB,CAAC;EAED,OAAOJ,IAAA,CAACJ,eAAe,CAACmF,QAAQ;IAAAC,QAAA,EAAER;EAAS,CAA2B,CAAC;AACzE,CAAC;AAED,MAAMS,WAAW,GAAG1F,IAAI,CAACwE,GAAG,CAAC;AAC7BkB,WAAW,CAACC,WAAW,GAAG,KAAK;AAE/B,SAASD,WAAW,IAAIlB,GAAG"}
|
|
1
|
+
{"version":3,"file":"Tag.js","names":["memo","useCallback","useContext","styled","TagListContext","MuiPropsContext","useOdysseyDesignTokens","CloseCircleFilledIcon","useContrastContext","jsx","_jsx","tagColorVariants","getChipColors","colorVariant","odysseyDesignTokens","contrastMode","colors","default","background","HueNeutral200","text","HueNeutral700","HueNeutral100","hover","active","HueNeutral300","border","deleteIcon","HueNeutral500","deleteIconHover","info","HueBlue200","HueBlue700","HueBlue100","HueBlue300","HueBlue500","accentOne","HueAccentOne200","HueAccentOne700","HueAccentOne100","HueAccentOne300","HueAccentOne500","accentTwo","HueAccentTwo200","HueAccentTwo800","HueAccentTwo100","HueAccentTwo700","HueAccentTwo300","HueAccentTwo500","accentThree","HueAccentThree200","HueAccentThree700","HueAccentThree100","HueAccentThree300","HueAccentThree500","accentFour","HueAccentFour200","HueAccentFour700","HueAccentFour100","HueAccentFour300","HueAccentFour500","StyledTag","_Chip","shouldForwardProp","prop","includes","backgroundColor","color","borderColor","Tag","icon","isDisabled","label","onClick","onRemove","testId","translate","chipElementType","renderTag","muiProps","as","clickable","Boolean","disabled","onDelete","Consumer","children","MemoizedTag","displayName"],"sources":["../src/Tag.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-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 { Chip as MuiChip, ChipProps as MuiChipProps } from \"@mui/material\";\nimport { memo, ReactElement, useCallback, useContext } from \"react\";\nimport styled from \"@emotion/styled\";\nimport { TagListContext } from \"./TagListContext\";\nimport { MuiPropsContext, MuiPropsContextType } from \"./MuiPropsContext\";\nimport { HtmlProps } from \"./HtmlProps\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport { CloseCircleFilledIcon } from \"./icons.generated\";\nimport { useContrastContext, ContrastMode } from \"./ContrastModeProvider\";\n\nexport const tagColorVariants = [\n \"default\",\n \"info\",\n \"accentOne\",\n \"accentTwo\",\n \"accentThree\",\n \"accentFour\",\n] as const;\n\ntype TagColorVariant = (typeof tagColorVariants)[number];\n\nexport type TagProps = {\n icon?: ReactElement;\n isDisabled?: boolean;\n /**\n * The label text for the Tag\n */\n label: string;\n /**\n * Callback fired when the Tag is clicked\n */\n onClick?: MuiChipProps[\"onClick\"];\n /**\n * Callback fired when the remove button of the Tag is clicked\n */\n onRemove?: MuiChipProps[\"onDelete\"];\n /**\n * Color variant of the Tag, affecting its appearance\n */\n colorVariant?: TagColorVariant;\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\nconst getChipColors = (\n colorVariant: TagColorVariant,\n odysseyDesignTokens: DesignTokens,\n contrastMode: ContrastMode,\n) => {\n const colors = {\n default: {\n ...(contrastMode === \"lowContrast\" && {\n background: odysseyDesignTokens.HueNeutral200,\n text: odysseyDesignTokens.HueNeutral700,\n }),\n ...(contrastMode === \"highContrast\" && {\n background: odysseyDesignTokens.HueNeutral100,\n text: odysseyDesignTokens.HueNeutral700,\n }),\n hover: odysseyDesignTokens.HueNeutral200,\n active: odysseyDesignTokens.HueNeutral300,\n border: odysseyDesignTokens.HueNeutral200,\n deleteIcon: odysseyDesignTokens.HueNeutral500,\n deleteIconHover: odysseyDesignTokens.HueNeutral700,\n },\n info: {\n ...(contrastMode === \"lowContrast\" && {\n background: odysseyDesignTokens.HueBlue200,\n text: odysseyDesignTokens.HueBlue700,\n }),\n ...(contrastMode === \"highContrast\" && {\n background: odysseyDesignTokens.HueBlue100,\n text: odysseyDesignTokens.HueBlue700,\n }),\n hover: odysseyDesignTokens.HueBlue200,\n active: odysseyDesignTokens.HueBlue300,\n border: odysseyDesignTokens.HueBlue200,\n deleteIcon: odysseyDesignTokens.HueBlue500,\n deleteIconHover: odysseyDesignTokens.HueBlue700,\n },\n accentOne: {\n ...(contrastMode === \"lowContrast\" && {\n background: odysseyDesignTokens.HueAccentOne200,\n text: odysseyDesignTokens.HueAccentOne700,\n }),\n ...(contrastMode === \"highContrast\" && {\n background: odysseyDesignTokens.HueAccentOne100,\n text: odysseyDesignTokens.HueAccentOne700,\n }),\n hover: odysseyDesignTokens.HueAccentOne200,\n active: odysseyDesignTokens.HueAccentOne300,\n border: odysseyDesignTokens.HueAccentOne200,\n deleteIcon: odysseyDesignTokens.HueAccentOne500,\n deleteIconHover: odysseyDesignTokens.HueAccentOne700,\n },\n accentTwo: {\n ...(contrastMode === \"lowContrast\" && {\n background: odysseyDesignTokens.HueAccentTwo200,\n text: odysseyDesignTokens.HueAccentTwo800,\n }),\n ...(contrastMode === \"highContrast\" && {\n background: odysseyDesignTokens.HueAccentTwo100,\n text: odysseyDesignTokens.HueAccentTwo700,\n }),\n hover: odysseyDesignTokens.HueAccentTwo200,\n active: odysseyDesignTokens.HueAccentTwo300,\n border: odysseyDesignTokens.HueAccentTwo200,\n deleteIcon: odysseyDesignTokens.HueAccentTwo500,\n deleteIconHover: odysseyDesignTokens.HueAccentTwo700,\n },\n accentThree: {\n ...(contrastMode === \"lowContrast\" && {\n background: odysseyDesignTokens.HueAccentThree200,\n text: odysseyDesignTokens.HueAccentThree700,\n }),\n ...(contrastMode === \"highContrast\" && {\n background: odysseyDesignTokens.HueAccentThree100,\n text: odysseyDesignTokens.HueAccentThree700,\n }),\n hover: odysseyDesignTokens.HueAccentThree200,\n active: odysseyDesignTokens.HueAccentThree300,\n border: odysseyDesignTokens.HueAccentThree200,\n deleteIcon: odysseyDesignTokens.HueAccentThree500,\n deleteIconHover: odysseyDesignTokens.HueAccentThree700,\n },\n accentFour: {\n ...(contrastMode === \"lowContrast\" && {\n background: odysseyDesignTokens.HueAccentFour200,\n text: odysseyDesignTokens.HueAccentFour700,\n }),\n ...(contrastMode === \"highContrast\" && {\n background: odysseyDesignTokens.HueAccentFour100,\n text: odysseyDesignTokens.HueAccentFour700,\n }),\n hover: odysseyDesignTokens.HueAccentFour200,\n active: odysseyDesignTokens.HueAccentFour300,\n border: odysseyDesignTokens.HueAccentFour200,\n deleteIcon: odysseyDesignTokens.HueAccentFour500,\n deleteIconHover: odysseyDesignTokens.HueAccentFour700,\n },\n };\n\n return colors[colorVariant] || colors.default;\n};\n\nconst StyledTag = styled(MuiChip, {\n shouldForwardProp: (prop) =>\n ![\"colorVariant\", \"contrastMode\", \"odysseyDesignTokens\"].includes(\n prop as string,\n ),\n})<{\n colorVariant: TagColorVariant;\n contrastMode: ContrastMode;\n odysseyDesignTokens: DesignTokens;\n as?: React.ElementType; // Allow the 'as' prop to be forwarded\n}>(({ colorVariant, contrastMode, odysseyDesignTokens }) => {\n const colors = getChipColors(colorVariant, odysseyDesignTokens, contrastMode);\n\n return {\n backgroundColor: colors.background,\n color: colors.text,\n borderColor: colors.border,\n\n \"&.MuiChip-clickable:hover\": {\n backgroundColor: colors.hover,\n },\n\n \"&.MuiChip-clickable:active\": {\n backgroundColor: colors.active,\n },\n\n \"&.Mui-disabled\": {\n \"& .MuiChip-deleteIcon\": {\n color: odysseyDesignTokens.HueNeutral300,\n },\n },\n\n \"& .MuiChip-deleteIcon\": {\n color: colors.deleteIcon,\n\n \"&:hover\": {\n color: colors.deleteIconHover,\n },\n },\n };\n});\n\nconst Tag = ({\n colorVariant = \"default\",\n icon,\n isDisabled,\n label,\n onClick,\n onRemove,\n testId,\n translate,\n}: TagProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { chipElementType } = useContext(TagListContext);\n const { contrastMode } = useContrastContext();\n\n const renderTag = useCallback(\n (muiProps: MuiPropsContextType) => (\n <StyledTag\n {...muiProps}\n as={chipElementType}\n aria-disabled={isDisabled}\n clickable={Boolean(onClick)}\n data-se={testId}\n colorVariant={colorVariant}\n odysseyDesignTokens={odysseyDesignTokens}\n contrastMode={contrastMode}\n disabled={isDisabled}\n icon={icon}\n label={label}\n onClick={onClick}\n onDelete={onRemove}\n deleteIcon={<CloseCircleFilledIcon />}\n translate={translate}\n />\n ),\n [\n chipElementType,\n icon,\n isDisabled,\n label,\n onClick,\n onRemove,\n testId,\n translate,\n colorVariant,\n odysseyDesignTokens,\n contrastMode,\n ],\n );\n\n return <MuiPropsContext.Consumer>{renderTag}</MuiPropsContext.Consumer>;\n};\n\nconst MemoizedTag = memo(Tag);\nMemoizedTag.displayName = \"Tag\";\n\nexport { MemoizedTag as Tag };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,IAAI,EAAgBC,WAAW,EAAEC,UAAU,QAAQ,OAAO;AACnE,OAAOC,MAAM,MAAM,iBAAiB;AAAC,SAC5BC,cAAc;AAAA,SACdC,eAAe;AAAA,SAItBC,sBAAsB;AAAA,SAEfC,qBAAqB;AAAA,SACrBC,kBAAkB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE3B,OAAO,MAAMC,gBAAgB,GAAG,CAC9B,SAAS,EACT,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,YAAY,CACJ;AAyBV,MAAMC,aAAa,GAAGA,CACpBC,YAA6B,EAC7BC,mBAAiC,EACjCC,YAA0B,KACvB;EACH,MAAMC,MAAM,GAAG;IACbC,OAAO,EAAE;MACP,IAAIF,YAAY,KAAK,aAAa,IAAI;QACpCG,UAAU,EAAEJ,mBAAmB,CAACK,aAAa;QAC7CC,IAAI,EAAEN,mBAAmB,CAACO;MAC5B,CAAC,CAAC;MACF,IAAIN,YAAY,KAAK,cAAc,IAAI;QACrCG,UAAU,EAAEJ,mBAAmB,CAACQ,aAAa;QAC7CF,IAAI,EAAEN,mBAAmB,CAACO;MAC5B,CAAC,CAAC;MACFE,KAAK,EAAET,mBAAmB,CAACK,aAAa;MACxCK,MAAM,EAAEV,mBAAmB,CAACW,aAAa;MACzCC,MAAM,EAAEZ,mBAAmB,CAACK,aAAa;MACzCQ,UAAU,EAAEb,mBAAmB,CAACc,aAAa;MAC7CC,eAAe,EAAEf,mBAAmB,CAACO;IACvC,CAAC;IACDS,IAAI,EAAE;MACJ,IAAI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AM9D,mBAAmB,GAAGR,sBAAsB,CAAC,CAAC;EACpD,MAAM;IAAEuE;EAAgB,CAAC,GAAG3E,UAAU,CAACE,cAAc,CAAC;EACtD,MAAM;IAAEW;EAAa,CAAC,GAAGP,kBAAkB,CAAC,CAAC;EAE7C,MAAMsE,SAAS,GAAG7E,WAAW,CAC1B8E,QAA6B,IAC5BrE,IAAA,CAACmD,SAAS;IAAA,GACJkB,QAAQ;IACZC,EAAE,EAAEH,eAAgB;IACpB,iBAAeN,UAAW;IAC1BU,SAAS,EAAEC,OAAO,CAACT,OAAO,CAAE;IAC5B,WAASE,MAAO;IAChB9D,YAAY,EAAEA,YAAa;IAC3BC,mBAAmB,EAAEA,mBAAoB;IACzCC,YAAY,EAAEA,YAAa;IAC3BoE,QAAQ,EAAEZ,UAAW;IACrBD,IAAI,EAAEA,IAAK;IACXE,KAAK,EAAEA,KAAM;IACbC,OAAO,EAAEA,OAAQ;IACjBW,QAAQ,EAAEV,QAAS;IACnB/C,UAAU,EAAEjB,IAAA,CAACH,qBAAqB,IAAE,CAAE;IACtCqE,SAAS,EAAEA;EAAU,CACtB,CACF,EACD,CACEC,eAAe,EACfP,IAAI,EACJC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,QAAQ,EACRC,MAAM,EACNC,SAAS,EACT/D,YAAY,EACZC,mBAAmB,EACnBC,YAAY,CAEhB,CAAC;EAED,OAAOL,IAAA,CAACL,eAAe,CAACgF,QAAQ;IAAAC,QAAA,EAAER;EAAS,CAA2B,CAAC;AACzE,CAAC;AAED,MAAMS,WAAW,GAAGvF,IAAI,CAACqE,GAAG,CAAC;AAC7BkB,WAAW,CAACC,WAAW,GAAG,KAAK;AAE/B,SAASD,WAAW,IAAIlB,GAAG"}
|
package/dist/Typography.js
CHANGED
|
@@ -21,9 +21,10 @@ export const typographyVariantMapping = {
|
|
|
21
21
|
h5: "h5",
|
|
22
22
|
h6: "h6",
|
|
23
23
|
body: "body1",
|
|
24
|
+
legend: "legend",
|
|
25
|
+
overline: "overline",
|
|
24
26
|
subordinate: "subtitle1",
|
|
25
|
-
support: "subtitle2"
|
|
26
|
-
legend: "legend"
|
|
27
|
+
support: "subtitle2"
|
|
27
28
|
};
|
|
28
29
|
export const typographyColorValues = ["primary", "textPrimary", "secondary", "textSecondary", "error"];
|
|
29
30
|
const Typography = ({
|
|
@@ -40,9 +41,7 @@ const Typography = ({
|
|
|
40
41
|
}) => {
|
|
41
42
|
const component = useMemo(() => {
|
|
42
43
|
if (!componentProp) {
|
|
43
|
-
if (variant === "body") {
|
|
44
|
-
return "p";
|
|
45
|
-
} else if (variant === "subordinate" || variant === "support") {
|
|
44
|
+
if (variant === "body" || variant === "subordinate" || variant === "support" || variant === "overline") {
|
|
46
45
|
return "p";
|
|
47
46
|
} else {
|
|
48
47
|
return variant;
|
|
@@ -294,5 +293,27 @@ const Legend = ({
|
|
|
294
293
|
});
|
|
295
294
|
const MemoizedLegend = memo(Legend);
|
|
296
295
|
MemoizedLegend.displayName = "Legend";
|
|
297
|
-
|
|
296
|
+
const Overline = ({
|
|
297
|
+
ariaDescribedBy,
|
|
298
|
+
ariaLabel,
|
|
299
|
+
ariaLabelledBy,
|
|
300
|
+
children,
|
|
301
|
+
color,
|
|
302
|
+
component,
|
|
303
|
+
testId,
|
|
304
|
+
translate
|
|
305
|
+
}) => _jsx(Typography, {
|
|
306
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
307
|
+
ariaLabel: ariaLabel,
|
|
308
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
309
|
+
children: children,
|
|
310
|
+
color: color,
|
|
311
|
+
component: component,
|
|
312
|
+
testId: testId,
|
|
313
|
+
translate: translate,
|
|
314
|
+
variant: "overline"
|
|
315
|
+
});
|
|
316
|
+
const MemoizedOverline = memo(Overline);
|
|
317
|
+
MemoizedOverline.displayName = "Overline";
|
|
318
|
+
export { MemoizedTypography as Typography, MemoizedHeading1 as Heading1, MemoizedHeading2 as Heading2, MemoizedHeading3 as Heading3, MemoizedHeading4 as Heading4, MemoizedHeading5 as Heading5, MemoizedHeading6 as Heading6, MemoizedLegend as Legend, MemoizedOverline as Overline, MemoizedParagraph as Paragraph, MemoizedSubordinate as Subordinate, MemoizedSupport as Support };
|
|
298
319
|
//# sourceMappingURL=Typography.js.map
|
package/dist/Typography.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typography.js","names":["memo","useMemo","useRef","useImperativeHandle","jsx","_jsx","typographyVariantMapping","h1","h2","h3","h4","h5","h6","body","subordinate","support","legend","typographyColorValues","Typography","ariaDescribedBy","ariaLabel","ariaLabelledBy","children","color","component","componentProp","testId","translate","typographyRef","variant","localTypographyRef","focus","current","_Typography","ref","tabIndex","MemoizedTypography","displayName","Heading1","MemoizedHeading1","Heading2","MemoizedHeading2","Heading3","MemoizedHeading3","Heading4","MemoizedHeading4","Heading5","MemoizedHeading5","Heading6","MemoizedHeading6","Paragraph","MemoizedParagraph","Subordinate","MemoizedSubordinate","Support","MemoizedSupport","Legend","MemoizedLegend"],"sources":["../src/Typography.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 ElementType,\n ReactNode,\n memo,\n useMemo,\n useRef,\n useImperativeHandle,\n} from \"react\";\nimport {\n Typography as MuiTypography,\n TypographyProps as MuiTypographyProps,\n} from \"@mui/material\";\n\nimport { HtmlProps } from \"./HtmlProps\";\nimport { FocusHandle } from \"./inputUtils\";\n\nexport type TypographyVariantValue =\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"body\"\n | \"subordinate\"\n | \"support\"\n | \"legend\";\n\nexport const typographyVariantMapping: Record<\n TypographyVariantValue,\n MuiTypographyProps[\"variant\"]\n> = {\n h1: \"h1\",\n h2: \"h2\",\n h3: \"h3\",\n h4: \"h4\",\n h5: \"h5\",\n h6: \"h6\",\n body: \"body1\",\n subordinate: \"subtitle1\",\n support: \"subtitle2\",\n legend: \"legend\",\n} as const;\n\nexport const typographyColorValues = [\n \"primary\",\n \"textPrimary\",\n \"secondary\",\n \"textSecondary\",\n \"error\",\n] as const;\n\nexport type TypographyProps = {\n /**\n * The text content of the component.\n */\n children: ReactNode;\n /**\n * The color of the text.\n */\n color?: (typeof typographyColorValues)[number];\n /**\n * The HTML element the component should render, if different from the default.\n */\n component?: ElementType;\n /**\n * The ref forwarded to the Typography\n */\n typographyRef?: React.RefObject<FocusHandle>;\n /**\n * The variant of Typography to render.\n */\n variant?: keyof typeof typographyVariantMapping;\n} & Pick<\n HtmlProps,\n \"ariaDescribedBy\" | \"ariaLabel\" | \"ariaLabelledBy\" | \"testId\" | \"translate\"\n>;\n\nconst Typography = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component: componentProp,\n testId,\n translate,\n typographyRef,\n variant = \"body\",\n}: TypographyProps) => {\n const component = useMemo(() => {\n if (!componentProp) {\n if (variant === \"body\") {\n return \"p\";\n } else if (variant === \"subordinate\" || variant === \"support\") {\n return \"p\";\n } else {\n return variant;\n }\n }\n return componentProp;\n }, [componentProp, variant]);\n\n const localTypographyRef = useRef<HTMLElement>(null);\n useImperativeHandle(\n typographyRef,\n () => {\n return {\n focus: () => {\n localTypographyRef.current?.focus();\n },\n };\n },\n [],\n );\n\n return (\n <MuiTypography\n aria-describedby={ariaDescribedBy}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n data-se={testId}\n ref={localTypographyRef}\n tabIndex={-1}\n translate={translate}\n variant={typographyVariantMapping[variant]}\n />\n );\n};\n\nconst MemoizedTypography = memo(Typography);\nMemoizedTypography.displayName = \"Typography\";\n\nconst Heading1 = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"h1\"\n />\n);\n\nconst MemoizedHeading1 = memo(Heading1);\nMemoizedHeading1.displayName = \"Heading1\";\n\nconst Heading2 = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"h2\"\n />\n);\n\nconst MemoizedHeading2 = memo(Heading2);\nMemoizedHeading2.displayName = \"Heading2\";\n\nconst Heading3 = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"h3\"\n />\n);\n\nconst MemoizedHeading3 = memo(Heading3);\nMemoizedHeading3.displayName = \"Heading3\";\n\nconst Heading4 = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"h4\"\n />\n);\n\nconst MemoizedHeading4 = memo(Heading4);\nMemoizedHeading4.displayName = \"Heading4\";\n\nconst Heading5 = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"h5\"\n />\n);\n\nconst MemoizedHeading5 = memo(Heading5);\nMemoizedHeading5.displayName = \"Heading5\";\n\nconst Heading6 = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"h6\"\n />\n);\n\nconst MemoizedHeading6 = memo(Heading6);\nMemoizedHeading6.displayName = \"Heading6\";\n\nconst Paragraph = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"body\"\n />\n);\n\nconst MemoizedParagraph = memo(Paragraph);\nMemoizedParagraph.displayName = \"Paragraph\";\n\nconst Subordinate = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"subordinate\"\n />\n);\n\nconst MemoizedSubordinate = memo(Subordinate);\nMemoizedSubordinate.displayName = \"Subordinate\";\n\nconst Support = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"support\"\n />\n);\n\nconst MemoizedSupport = memo(Support);\nMemoizedSupport.displayName = \"Support\";\n\nconst Legend = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"legend\"\n />\n);\n\nconst MemoizedLegend = memo(Legend);\nMemoizedLegend.displayName = \"Legend\";\n\nexport {\n MemoizedTypography as Typography,\n MemoizedHeading1 as Heading1,\n MemoizedHeading2 as Heading2,\n MemoizedHeading3 as Heading3,\n MemoizedHeading4 as Heading4,\n MemoizedHeading5 as Heading5,\n MemoizedHeading6 as Heading6,\n MemoizedLegend as Legend,\n MemoizedParagraph as Paragraph,\n MemoizedSubordinate as Subordinate,\n MemoizedSupport as Support,\n};\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAGEA,IAAI,EACJC,OAAO,EACPC,MAAM,EACNC,mBAAmB,QACd,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAqBf,OAAO,MAAMC,wBAGZ,GAAG;EACFC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,IAAI,EAAE,OAAO;EACbC,WAAW,EAAE,WAAW;EACxBC,OAAO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BC,cAAc,EAAEA,cAAe;EAC/BC,QAAQ,EAAEA,QAAS;EACnBC,KAAK,EAAEA,KAAM;EACbC,SAAS,EAAEA,SAAU;EACrBE,MAAM,EAAEA,MAAO;EACfC,SAAS,EAAEA,SAAU;EACrBE,OAAO,EAAC;AAAQ,CACjB,CACF;AAED,MAAM4B,cAAc,GAAGzD,IAAI,CAACwD,MAAM,CAAC;AACnCC,cAAc,CAACpB,WAAW,GAAG,QAAQ;AAErC,SACED,kBAAkB,IAAIlB,UAAU,EAChCqB,gBAAgB,IAAID,QAAQ,EAC5BG,gBAAgB,IAAID,QAAQ,EAC5BG,gBAAgB,IAAID,QAAQ,EAC5BG,gBAAgB,IAAID,QAAQ,EAC5BG,gBAAgB,IAAID,QAAQ,EAC5BG,gBAAgB,IAAID,QAAQ,EAC5BS,cAAc,IAAID,MAAM,EACxBL,iBAAiB,IAAID,SAAS,EAC9BG,mBAAmB,IAAID,WAAW,EAClCG,eAAe,IAAID,OAAO"}
|
|
1
|
+
{"version":3,"file":"Typography.js","names":["memo","useMemo","useRef","useImperativeHandle","jsx","_jsx","typographyVariantMapping","h1","h2","h3","h4","h5","h6","body","legend","overline","subordinate","support","typographyColorValues","Typography","ariaDescribedBy","ariaLabel","ariaLabelledBy","children","color","component","componentProp","testId","translate","typographyRef","variant","localTypographyRef","focus","current","_Typography","ref","tabIndex","MemoizedTypography","displayName","Heading1","MemoizedHeading1","Heading2","MemoizedHeading2","Heading3","MemoizedHeading3","Heading4","MemoizedHeading4","Heading5","MemoizedHeading5","Heading6","MemoizedHeading6","Paragraph","MemoizedParagraph","Subordinate","MemoizedSubordinate","Support","MemoizedSupport","Legend","MemoizedLegend","Overline","MemoizedOverline"],"sources":["../src/Typography.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 ElementType,\n ReactNode,\n memo,\n useMemo,\n useRef,\n useImperativeHandle,\n} from \"react\";\nimport {\n Typography as MuiTypography,\n TypographyProps as MuiTypographyProps,\n} from \"@mui/material\";\n\nimport { HtmlProps } from \"./HtmlProps\";\nimport { FocusHandle } from \"./inputUtils\";\n\nexport type TypographyVariantValue =\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"body\"\n | \"legend\"\n | \"overline\"\n | \"subordinate\"\n | \"support\";\n\nexport const typographyVariantMapping: Record<\n TypographyVariantValue,\n MuiTypographyProps[\"variant\"]\n> = {\n h1: \"h1\",\n h2: \"h2\",\n h3: \"h3\",\n h4: \"h4\",\n h5: \"h5\",\n h6: \"h6\",\n body: \"body1\",\n legend: \"legend\",\n overline: \"overline\",\n subordinate: \"subtitle1\",\n support: \"subtitle2\",\n} as const;\n\nexport const typographyColorValues = [\n \"primary\",\n \"textPrimary\",\n \"secondary\",\n \"textSecondary\",\n \"error\",\n] as const;\n\nexport type TypographyProps = {\n /**\n * The text content of the component.\n */\n children: ReactNode;\n /**\n * The color of the text.\n */\n color?: (typeof typographyColorValues)[number];\n /**\n * The HTML element the component should render, if different from the default.\n */\n component?: ElementType;\n /**\n * The ref forwarded to the Typography\n */\n typographyRef?: React.RefObject<FocusHandle>;\n /**\n * The variant of Typography to render.\n */\n variant?: keyof typeof typographyVariantMapping;\n} & Pick<\n HtmlProps,\n \"ariaDescribedBy\" | \"ariaLabel\" | \"ariaLabelledBy\" | \"testId\" | \"translate\"\n>;\n\nconst Typography = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component: componentProp,\n testId,\n translate,\n typographyRef,\n variant = \"body\",\n}: TypographyProps) => {\n const component = useMemo(() => {\n if (!componentProp) {\n if (\n variant === \"body\" ||\n variant === \"subordinate\" ||\n variant === \"support\" ||\n variant === \"overline\"\n ) {\n return \"p\";\n } else {\n return variant;\n }\n }\n return componentProp;\n }, [componentProp, variant]);\n\n const localTypographyRef = useRef<HTMLElement>(null);\n useImperativeHandle(\n typographyRef,\n () => {\n return {\n focus: () => {\n localTypographyRef.current?.focus();\n },\n };\n },\n [],\n );\n\n return (\n <MuiTypography\n aria-describedby={ariaDescribedBy}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n data-se={testId}\n ref={localTypographyRef}\n tabIndex={-1}\n translate={translate}\n variant={typographyVariantMapping[variant]}\n />\n );\n};\n\nconst MemoizedTypography = memo(Typography);\nMemoizedTypography.displayName = \"Typography\";\n\nconst Heading1 = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"h1\"\n />\n);\n\nconst MemoizedHeading1 = memo(Heading1);\nMemoizedHeading1.displayName = \"Heading1\";\n\nconst Heading2 = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"h2\"\n />\n);\n\nconst MemoizedHeading2 = memo(Heading2);\nMemoizedHeading2.displayName = \"Heading2\";\n\nconst Heading3 = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"h3\"\n />\n);\n\nconst MemoizedHeading3 = memo(Heading3);\nMemoizedHeading3.displayName = \"Heading3\";\n\nconst Heading4 = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"h4\"\n />\n);\n\nconst MemoizedHeading4 = memo(Heading4);\nMemoizedHeading4.displayName = \"Heading4\";\n\nconst Heading5 = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"h5\"\n />\n);\n\nconst MemoizedHeading5 = memo(Heading5);\nMemoizedHeading5.displayName = \"Heading5\";\n\nconst Heading6 = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"h6\"\n />\n);\n\nconst MemoizedHeading6 = memo(Heading6);\nMemoizedHeading6.displayName = \"Heading6\";\n\nconst Paragraph = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"body\"\n />\n);\n\nconst MemoizedParagraph = memo(Paragraph);\nMemoizedParagraph.displayName = \"Paragraph\";\n\nconst Subordinate = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"subordinate\"\n />\n);\n\nconst MemoizedSubordinate = memo(Subordinate);\nMemoizedSubordinate.displayName = \"Subordinate\";\n\nconst Support = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"support\"\n />\n);\n\nconst MemoizedSupport = memo(Support);\nMemoizedSupport.displayName = \"Support\";\n\nconst Legend = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"legend\"\n />\n);\n\nconst MemoizedLegend = memo(Legend);\nMemoizedLegend.displayName = \"Legend\";\n\nconst Overline = ({\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n children,\n color,\n component,\n testId,\n translate,\n}: TypographyProps) => (\n <Typography\n ariaDescribedBy={ariaDescribedBy}\n ariaLabel={ariaLabel}\n ariaLabelledBy={ariaLabelledBy}\n children={children}\n color={color}\n component={component}\n testId={testId}\n translate={translate}\n variant=\"overline\"\n />\n);\n\nconst MemoizedOverline = memo(Overline);\nMemoizedOverline.displayName = \"Overline\";\n\nexport {\n MemoizedTypography as Typography,\n MemoizedHeading1 as Heading1,\n MemoizedHeading2 as Heading2,\n MemoizedHeading3 as Heading3,\n MemoizedHeading4 as Heading4,\n MemoizedHeading5 as Heading5,\n MemoizedHeading6 as Heading6,\n MemoizedLegend as Legend,\n MemoizedOverline as Overline,\n MemoizedParagraph as Paragraph,\n MemoizedSubordinate as Subordinate,\n MemoizedSupport as Support,\n};\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAGEA,IAAI,EACJC,OAAO,EACPC,MAAM,EACNC,mBAAmB,QACd,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAsBf,OAAO,MAAMC,wBAGZ,GAAG;EACFC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,EAAE,EAAE,IAAI;EACRC,IAAI,EAAE,OAAO;EACbC,MAAM,EAAE,QAAQ;EAChBC,QAAQ,EAAE,UAAU;EACpBC,WAAW,EAAE,WAAW;EACxBC,OAAO,EAAE;AACX,CAAU;AAEV,OAAO,MAAMC,qBAAqB,GAAG,CACnC,SAAS,EACT,aAAa,EACb,WAAW,EACX,eAAe,EACf,OAAO,CACC;AA4BV,MAAMC,UAAU,GAAGA,CAAC;EAClBC,eAAe;EACfC,SAAS;EACTC,cAAc;EACdC,QAAQ;EACRC,KAAK;EACLC,SAAS,EAAEC,aAAa;EACxBC,MAAM;EACNC,SAAS;EACTC,aAAa;EACbC,OAAO,GAAG;AACK,CAAC,KAAK;EACrB,MAAML,SAAS,GAAGxB,OAAO,CAAC,MAAM;IAC9B,IAAI,CAACyB,aAAa,EAAE;MAClB,IACEI,OAAO,KAAK,MAAM,IAClBA,OAA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A,eAAgB;EACjCC,SAAS,EAAEA,SAAU;EACrBC,cAAc,EAAEA,cAAe;EAC/BC,QAAQ,EAAEA,QAAS;EACnBC,KAAK,EAAEA,KAAM;EACbC,SAAS,EAAEA,SAAU;EACrBE,MAAM,EAAEA,MAAO;EACfC,SAAS,EAAEA,SAAU;EACrBE,OAAO,EAAC;AAAU,CACnB,CACF;AAED,MAAM8B,gBAAgB,GAAG5D,IAAI,CAAC2D,QAAQ,CAAC;AACvCC,gBAAgB,CAACtB,WAAW,GAAG,UAAU;AAEzC,SACED,kBAAkB,IAAIlB,UAAU,EAChCqB,gBAAgB,IAAID,QAAQ,EAC5BG,gBAAgB,IAAID,QAAQ,EAC5BG,gBAAgB,IAAID,QAAQ,EAC5BG,gBAAgB,IAAID,QAAQ,EAC5BG,gBAAgB,IAAID,QAAQ,EAC5BG,gBAAgB,IAAID,QAAQ,EAC5BS,cAAc,IAAID,MAAM,EACxBG,gBAAgB,IAAID,QAAQ,EAC5BP,iBAAiB,IAAID,SAAS,EAC9BG,mBAAmB,IAAID,WAAW,EAClCG,eAAe,IAAID,OAAO"}
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export * from "./Callout.js";
|
|
|
26
26
|
export * from "./Checkbox.js";
|
|
27
27
|
export * from "./CheckboxGroup.js";
|
|
28
28
|
export * from "./CircularProgress.js";
|
|
29
|
+
export * from "./ContrastModeProvider.js";
|
|
29
30
|
export * from "./CssBaseline.js";
|
|
30
31
|
export * from "./createShadowDomElements.js";
|
|
31
32
|
export * from "./createUniqueId.js";
|
|
@@ -54,6 +55,7 @@ export * from "./RadioGroup.js";
|
|
|
54
55
|
export * from "./ScreenReaderText.js";
|
|
55
56
|
export * from "./SearchField.js";
|
|
56
57
|
export * from "./Select.js";
|
|
58
|
+
export * from "./Stack.js";
|
|
57
59
|
export * from "./Status.js";
|
|
58
60
|
export * from "./Surface.js";
|
|
59
61
|
export * from "./Tabs.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["deepmerge","visuallyHidden","createTheme","DialogContentText","Divider","InputAdornment","InputBase","ListItemIcon","ListItemText","ListSubheader","MenuList","Paper","ScopedCssBaseline","ThemeProvider","odysseyTranslate","useOdysseyDesignTokens","badgeContentMaxValues","FileUploader","fileUploadTypes","fileUploadVariants"],"sources":["../src/index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2022-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\nexport { deepmerge, visuallyHidden } from \"@mui/utils\";\n\nexport {\n createTheme,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n DialogContentText,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n Divider,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n InputAdornment,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n InputBase,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n ListItemIcon,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n ListItemText,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n ListSubheader,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n MenuList,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n Paper,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n ScopedCssBaseline,\n ThemeProvider,\n} from \"@mui/material\";\n\nexport type {\n CssBaselineProps,\n DialogContentTextProps,\n DividerProps,\n InputAdornmentProps,\n InputBaseProps,\n ListItemIconProps,\n ListItemTextProps,\n ListSubheaderProps,\n MenuListProps,\n PaperProps,\n ScopedCssBaselineProps,\n ThemeOptions,\n} from \"@mui/material\";\n\nexport { odysseyTranslate } from \"./i18n\";\nexport type { FocusHandle } from \"./inputUtils\";\nexport { useOdysseyDesignTokens } from \"./OdysseyDesignTokensContext\";\n\nexport * from \"./Accordion\";\nexport * from \"./Autocomplete\";\nexport { badgeContentMaxValues } from \"./Badge\";\nexport * from \"./Banner\";\nexport * from \"./Box\";\nexport * from \"./Breadcrumbs\";\nexport * from \"./Button\";\nexport * from \"./Card\";\nexport * from \"./Callout\";\nexport * from \"./Checkbox\";\nexport * from \"./CheckboxGroup\";\nexport * from \"./CircularProgress\";\nexport * from \"./CssBaseline\";\nexport * from \"./createShadowDomElements\";\nexport * from \"./createUniqueId\";\nexport * from \"./DataTable\";\nexport * from \"./Dialog\";\nexport * from \"./Drawer\";\nexport * from \"./EmptyState\";\nexport * from \"./Fieldset\";\nexport * from \"./FieldComponentProps\";\nexport {\n FileUploader,\n fileUploadTypes,\n fileUploadVariants,\n} from \"./FileUploader\";\nexport * from \"./Form\";\nexport * from \"./HintLink\";\nexport * from \"./IconWithTooltip\";\nexport * from \"./Link\";\nexport * from \"./MenuButton\";\nexport * from \"./MenuItem\";\nexport * from \"./NativeSelect\";\nexport * from \"./NullElement\";\nexport * from \"./OdysseyCacheProvider\";\nexport * from \"./OdysseyProvider\";\nexport * from \"./OdysseyThemeProvider\";\nexport * from \"./OdysseyTranslationProvider\";\nexport * from \"./PasswordField\";\nexport * from \"./Radio\";\nexport * from \"./RadioGroup\";\nexport * from \"./ScreenReaderText\";\nexport * from \"./SearchField\";\nexport * from \"./Select\";\nexport * from \"./Status\";\nexport * from \"./Surface\";\nexport * from \"./Tabs\";\nexport * from \"./Tag\";\nexport * from \"./TagList\";\nexport * from \"./TextField\";\nexport * from \"./theme\";\nexport * from \"./Toast\";\nexport * from \"./ToastStack\";\nexport * from \"./Switch\";\nexport * from \"./Tooltip\";\nexport * from \"./Typography\";\nexport * from \"./useUniqueId\";\nexport * from \"./Pagination\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,cAAc,QAAQ,YAAY;AAEtD,SACEC,WAAW,EAEXC,iBAAiB,EAEjBC,OAAO,EAEPC,cAAc,EAEdC,SAAS,EAETC,YAAY,EAEZC,YAAY,EAEZC,aAAa,EAEbC,QAAQ,EAERC,KAAK,EAELC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.js","names":["deepmerge","visuallyHidden","createTheme","DialogContentText","Divider","InputAdornment","InputBase","ListItemIcon","ListItemText","ListSubheader","MenuList","Paper","ScopedCssBaseline","ThemeProvider","odysseyTranslate","useOdysseyDesignTokens","badgeContentMaxValues","FileUploader","fileUploadTypes","fileUploadVariants"],"sources":["../src/index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2022-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\nexport { deepmerge, visuallyHidden } from \"@mui/utils\";\n\nexport {\n createTheme,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n DialogContentText,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n Divider,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n InputAdornment,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n InputBase,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n ListItemIcon,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n ListItemText,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n ListSubheader,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n MenuList,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n Paper,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n ScopedCssBaseline,\n /** @deprecated Will be removed in a future Odyssey version in lieu of a wrapped version. */\n ThemeProvider,\n} from \"@mui/material\";\n\nexport type {\n CssBaselineProps,\n DialogContentTextProps,\n DividerProps,\n InputAdornmentProps,\n InputBaseProps,\n ListItemIconProps,\n ListItemTextProps,\n ListSubheaderProps,\n MenuListProps,\n PaperProps,\n ScopedCssBaselineProps,\n StackProps,\n ThemeOptions,\n} from \"@mui/material\";\n\nexport { odysseyTranslate } from \"./i18n\";\nexport type { FocusHandle } from \"./inputUtils\";\nexport { useOdysseyDesignTokens } from \"./OdysseyDesignTokensContext\";\n\nexport * from \"./Accordion\";\nexport * from \"./Autocomplete\";\nexport { badgeContentMaxValues } from \"./Badge\";\nexport * from \"./Banner\";\nexport * from \"./Box\";\nexport * from \"./Breadcrumbs\";\nexport * from \"./Button\";\nexport * from \"./Card\";\nexport * from \"./Callout\";\nexport * from \"./Checkbox\";\nexport * from \"./CheckboxGroup\";\nexport * from \"./CircularProgress\";\nexport * from \"./ContrastModeProvider\";\nexport * from \"./CssBaseline\";\nexport * from \"./createShadowDomElements\";\nexport * from \"./createUniqueId\";\nexport * from \"./DataTable\";\nexport * from \"./Dialog\";\nexport * from \"./Drawer\";\nexport * from \"./EmptyState\";\nexport * from \"./Fieldset\";\nexport * from \"./FieldComponentProps\";\nexport {\n FileUploader,\n fileUploadTypes,\n fileUploadVariants,\n} from \"./FileUploader\";\nexport * from \"./Form\";\nexport * from \"./HintLink\";\nexport * from \"./IconWithTooltip\";\nexport * from \"./Link\";\nexport * from \"./MenuButton\";\nexport * from \"./MenuItem\";\nexport * from \"./NativeSelect\";\nexport * from \"./NullElement\";\nexport * from \"./OdysseyCacheProvider\";\nexport * from \"./OdysseyProvider\";\nexport * from \"./OdysseyThemeProvider\";\nexport * from \"./OdysseyTranslationProvider\";\nexport * from \"./PasswordField\";\nexport * from \"./Radio\";\nexport * from \"./RadioGroup\";\nexport * from \"./ScreenReaderText\";\nexport * from \"./SearchField\";\nexport * from \"./Select\";\nexport * from \"./Stack\";\nexport * from \"./Status\";\nexport * from \"./Surface\";\nexport * from \"./Tabs\";\nexport * from \"./Tag\";\nexport * from \"./TagList\";\nexport * from \"./TextField\";\nexport * from \"./theme\";\nexport * from \"./Toast\";\nexport * from \"./ToastStack\";\nexport * from \"./Switch\";\nexport * from \"./Tooltip\";\nexport * from \"./Typography\";\nexport * from \"./useUniqueId\";\nexport * from \"./Pagination\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,cAAc,QAAQ,YAAY;AAEtD,SACEC,WAAW,EAEXC,iBAAiB,EAEjBC,OAAO,EAEPC,cAAc,EAEdC,SAAS,EAETC,YAAY,EAEZC,YAAY,EAEZC,aAAa,EAEbC,QAAQ,EAERC,KAAK,EAELC,iBAAiB,EAEjBC,aAAa,QACR,eAAe;AAAC,SAkBdC,gBAAgB;AAAA,SAEhBC,sBAAsB;AAAA;AAAA;AAAA,SAItBC,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAqB5BC,YAAY,EACZC,eAAe,EACfC,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA"}
|
package/dist/index.scss
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* Do not edit directly
|
|
4
|
-
* Generated on
|
|
4
|
+
* Generated on Fri, 04 Oct 2024 18:01:40 GMT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
$border-color-control: #8d8d8d !default;
|
|
@@ -46,7 +46,7 @@ $hue-blue-200: #c1c9f6 !default;
|
|
|
46
46
|
$hue-blue-300: #9daaf1 !default;
|
|
47
47
|
$hue-blue-400: #7286eb !default;
|
|
48
48
|
$hue-blue-500: #546be7 !default;
|
|
49
|
-
$hue-blue-600: #
|
|
49
|
+
$hue-blue-600: #4C64E1 !default;
|
|
50
50
|
$hue-blue-700: #2e40a5 !default;
|
|
51
51
|
$hue-blue-800: #22307c !default;
|
|
52
52
|
$hue-blue-900: #182257 !default;
|
|
@@ -125,7 +125,7 @@ $palette-primary-light: #9daaf1 !default;
|
|
|
125
125
|
$palette-primary-main: #546be7 !default;
|
|
126
126
|
$palette-primary-dark: #2e40a5 !default;
|
|
127
127
|
$palette-primary-darker: #22307c !default;
|
|
128
|
-
$palette-primary-text: #
|
|
128
|
+
$palette-primary-text: #4C64E1 !default;
|
|
129
129
|
$palette-primary-heading: #182257 !default;
|
|
130
130
|
$palette-primary-highlight: #dbe0fa !default;
|
|
131
131
|
$palette-danger-lighter: #fff0ee !default;
|
|
@@ -177,7 +177,7 @@ $typography-color-inverse: #ffffff !default; // Inverse text color typically use
|
|
|
177
177
|
$typography-color-support: #4b4b4b !default;
|
|
178
178
|
$typography-color-subordinate: #6e6e6e !default; // Text color for subordinate text like captions
|
|
179
179
|
$typography-color-disabled: #aeaeae !default;
|
|
180
|
-
$typography-color-action: #
|
|
180
|
+
$typography-color-action: #4C64E1 !default;
|
|
181
181
|
$typography-color-danger: #d92300 !default;
|
|
182
182
|
$typography-color-success: #197f48 !default;
|
|
183
183
|
$typography-color-warning: #966603 !default;
|
|
@@ -227,6 +227,7 @@ $typography-line-height-heading3: 1.25 !default;
|
|
|
227
227
|
$typography-line-height-heading2: 1.2 !default;
|
|
228
228
|
$typography-line-height-heading1: 1.2 !default;
|
|
229
229
|
$typography-line-length-max: 55ch !default;
|
|
230
|
+
$typography-letter-spacing-overline: .05em !default;
|
|
230
231
|
|
|
231
232
|
$ods-tokens: (
|
|
232
233
|
'border': (
|
|
@@ -540,6 +541,9 @@ $ods-tokens: (
|
|
|
540
541
|
),
|
|
541
542
|
'lineLength': (
|
|
542
543
|
'max': $typography-line-length-max
|
|
544
|
+
),
|
|
545
|
+
'letterSpacing': (
|
|
546
|
+
'overline': $typography-letter-spacing-overline
|
|
543
547
|
)
|
|
544
548
|
)
|
|
545
549
|
);
|
|
@@ -44,10 +44,7 @@ const dateStyles = {
|
|
|
44
44
|
theme
|
|
45
45
|
}) => ({
|
|
46
46
|
backgroundColor: theme.palette.primary.dark,
|
|
47
|
-
color: theme.palette.primary.contrastText
|
|
48
|
-
"@media (pointer: fine)": {
|
|
49
|
-
backgroundColor: theme.palette.primary.main
|
|
50
|
-
}
|
|
47
|
+
color: theme.palette.primary.contrastText
|
|
51
48
|
}),
|
|
52
49
|
outsideOfMonth: ({
|
|
53
50
|
theme
|
|
@@ -178,8 +175,8 @@ export const datePickerTheme = {
|
|
|
178
175
|
borderStyle: theme.mixins.borderStyle,
|
|
179
176
|
borderWidth: theme.mixins.borderWidth,
|
|
180
177
|
borderRadius: theme.mixins.borderRadius,
|
|
181
|
-
paddingBlock: theme.spacing(
|
|
182
|
-
paddingInline: theme.spacing(
|
|
178
|
+
paddingBlock: theme.spacing(6),
|
|
179
|
+
paddingInline: theme.spacing(6)
|
|
183
180
|
}
|
|
184
181
|
})
|
|
185
182
|
}
|