@okta/odyssey-react-mui 1.9.12 → 1.9.13
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/Badge.js +33 -32
- package/dist/Badge.js.map +1 -1
- package/dist/Tabs.js +54 -10
- package/dist/Tabs.js.map +1 -1
- package/dist/src/Badge.d.ts.map +1 -1
- package/dist/src/Tabs.d.ts +5 -1
- package/dist/src/Tabs.d.ts.map +1 -1
- package/dist/theme/components.js +1 -1
- package/dist/theme/components.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/Badge.tsx +33 -29
- package/src/Tabs.tsx +85 -17
- package/src/theme/components.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.9.13](https://github.com/okta/odyssey/compare/v1.9.12...v1.9.13) (2024-01-04)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
9
|
+
|
|
6
10
|
## [1.9.12](https://github.com/okta/odyssey/compare/v1.9.11...v1.9.12) (2023-12-22)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @okta/odyssey-react-mui
|
package/dist/Badge.js
CHANGED
|
@@ -38,38 +38,39 @@ const Badge = _ref => {
|
|
|
38
38
|
type = "default"
|
|
39
39
|
} = _ref;
|
|
40
40
|
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
});
|
|
41
|
+
const renderBadge = useMemo(() => {
|
|
42
|
+
const greaterThanZeroContentMax = badgeContentMax > 0 ? badgeContentMax : 1;
|
|
43
|
+
const threeDigitLimitedMax = greaterThanZeroContentMax > 999 ? 999 : greaterThanZeroContentMax;
|
|
44
|
+
const isOverContentMax = badgeContent > threeDigitLimitedMax;
|
|
45
|
+
const overContentMaxMessage = `${greaterThanZeroContentMax}+`;
|
|
46
|
+
const formattedContent = isOverContentMax ? overContentMaxMessage : badgeContent.toString();
|
|
47
|
+
const badgeStyles = {
|
|
48
|
+
display: "inline-flex",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
justifyContent: "center",
|
|
51
|
+
minWidth: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,
|
|
52
|
+
height: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,
|
|
53
|
+
minHeight: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,
|
|
54
|
+
padding: "0 6px",
|
|
55
|
+
backgroundColor: badgeTypeColors(odysseyDesignTokens)[type].background,
|
|
56
|
+
color: badgeTypeColors(odysseyDesignTokens)[type].font,
|
|
57
|
+
borderRadius: formattedContent.length > 1 ? `${odysseyDesignTokens.BorderRadiusOuter}` : "50%",
|
|
58
|
+
fontSize: `${odysseyDesignTokens.TypographyScale0}`,
|
|
59
|
+
fontFamily: `${odysseyDesignTokens.TypographyFamilyMono}`,
|
|
60
|
+
fontWeight: `${odysseyDesignTokens.TypographyWeightBodyBold}`,
|
|
61
|
+
lineHeight: 1,
|
|
62
|
+
transitionDuration: `${odysseyDesignTokens.TransitionDurationMain}`,
|
|
63
|
+
transitionProperty: `background-color, color`
|
|
64
|
+
};
|
|
65
|
+
const hasNotificationCount = badgeContent && badgeContent > 0;
|
|
66
|
+
return hasNotificationCount ? _jsx(Box, {
|
|
67
|
+
sx: badgeStyles,
|
|
68
|
+
"data-se": testId,
|
|
69
|
+
translate: translate,
|
|
70
|
+
children: formattedContent
|
|
71
|
+
}) : null;
|
|
72
|
+
}, [badgeContent, badgeContentMax, odysseyDesignTokens, testId, translate, type]);
|
|
73
|
+
return renderBadge;
|
|
73
74
|
};
|
|
74
75
|
const MemoizedBadge = memo(Badge);
|
|
75
76
|
MemoizedBadge.displayName = "Badge";
|
package/dist/Badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","names":["memo","useMemo","useOdysseyDesignTokens","Box","jsx","_jsx","badgeTypeValues","badgeTypeColors","odysseyTokens","default","background","HueNeutral200","font","TypographyColorBody","attention","PalettePrimaryMain","TypographyColorInverse","danger","PaletteDangerMain","Badge","_ref","badgeContent","badgeContentMax","testId","translate","type","odysseyDesignTokens","greaterThanZeroContentMax","threeDigitLimitedMax","isOverContentMax","
|
|
1
|
+
{"version":3,"file":"Badge.js","names":["memo","useMemo","useOdysseyDesignTokens","Box","jsx","_jsx","badgeTypeValues","badgeTypeColors","odysseyTokens","default","background","HueNeutral200","font","TypographyColorBody","attention","PalettePrimaryMain","TypographyColorInverse","danger","PaletteDangerMain","Badge","_ref","badgeContent","badgeContentMax","testId","translate","type","odysseyDesignTokens","renderBadge","greaterThanZeroContentMax","threeDigitLimitedMax","isOverContentMax","overContentMaxMessage","formattedContent","toString","badgeStyles","display","alignItems","justifyContent","minWidth","Spacing4","Spacing1","height","minHeight","padding","backgroundColor","color","borderRadius","length","BorderRadiusOuter","fontSize","TypographyScale0","fontFamily","TypographyFamilyMono","fontWeight","TypographyWeightBodyBold","lineHeight","transitionDuration","TransitionDurationMain","transitionProperty","hasNotificationCount","sx","children","MemoizedBadge","displayName"],"sources":["../src/Badge.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { CSSProperties, memo, useMemo } from \"react\";\n\nimport {\n useOdysseyDesignTokens,\n DesignTokens,\n} from \"./OdysseyDesignTokensContext\";\nimport { Box } from \"./Box\";\nimport type { AllowedProps } from \"./AllowedProps\";\n\nexport const badgeTypeValues = [\"default\", \"attention\", \"danger\"] as const;\n\nexport type BadgeProps = {\n badgeContent: number;\n badgeContentMax?: number;\n type?: (typeof badgeTypeValues)[number];\n} & AllowedProps;\n\nconst badgeTypeColors = (odysseyTokens: DesignTokens) => ({\n default: {\n background: odysseyTokens.HueNeutral200,\n font: odysseyTokens.TypographyColorBody,\n },\n attention: {\n background: odysseyTokens.PalettePrimaryMain,\n font: odysseyTokens.TypographyColorInverse,\n },\n danger: {\n background: odysseyTokens.PaletteDangerMain,\n font: odysseyTokens.TypographyColorInverse,\n },\n});\n\nconst Badge = ({\n badgeContent,\n badgeContentMax = 999,\n testId,\n translate,\n type = \"default\",\n}: BadgeProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const renderBadge = useMemo(() => {\n const greaterThanZeroContentMax = badgeContentMax > 0 ? badgeContentMax : 1;\n const threeDigitLimitedMax =\n greaterThanZeroContentMax > 999 ? 999 : greaterThanZeroContentMax;\n const isOverContentMax = badgeContent > threeDigitLimitedMax;\n const overContentMaxMessage = `${greaterThanZeroContentMax}+`;\n const formattedContent = isOverContentMax\n ? overContentMaxMessage\n : badgeContent.toString();\n\n const badgeStyles: CSSProperties = {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n minWidth: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n height: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n minHeight: `calc(${odysseyDesignTokens.Spacing4} + ${odysseyDesignTokens.Spacing1})`,\n // 6px horizontal padding per design requirements\n padding: \"0 6px\",\n backgroundColor: badgeTypeColors(odysseyDesignTokens)[type].background,\n color: badgeTypeColors(odysseyDesignTokens)[type].font,\n borderRadius:\n formattedContent.length > 1\n ? `${odysseyDesignTokens.BorderRadiusOuter}`\n : \"50%\",\n fontSize: `${odysseyDesignTokens.TypographyScale0}`,\n fontFamily: `${odysseyDesignTokens.TypographyFamilyMono}`,\n fontWeight: `${odysseyDesignTokens.TypographyWeightBodyBold}`,\n lineHeight: 1,\n transitionDuration: `${odysseyDesignTokens.TransitionDurationMain}`,\n transitionProperty: `background-color, color`,\n };\n\n const hasNotificationCount = badgeContent && badgeContent > 0;\n\n return hasNotificationCount ? (\n <Box sx={badgeStyles} data-se={testId} translate={translate}>\n {formattedContent}\n </Box>\n ) : null;\n }, [\n badgeContent,\n badgeContentMax,\n odysseyDesignTokens,\n testId,\n translate,\n type,\n ]);\n\n return renderBadge;\n};\n\nconst MemoizedBadge = memo(Badge);\nMemoizedBadge.displayName = \"Badge\";\n\nexport { MemoizedBadge as Badge };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAwBA,IAAI,EAAEC,OAAO,QAAQ,OAAO;AAAC,SAGnDC,sBAAsB;AAAA,SAGfC,GAAG;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGZ,OAAO,MAAMC,eAAe,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAU;AAQ1E,MAAMC,eAAe,GAAIC,aAA2B,KAAM;EACxDC,OAAO,EAAE;IACPC,UAAU,EAAEF,aAAa,CAACG,aAAa;IACvCC,I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;MAChBC,eAAe,EAAErC,eAAe,CAACmB,mBAAmB,CAAC,CAACD,IAAI,CAAC,CAACf,UAAU;MACtEmC,KAAK,EAAEtC,eAAe,CAACmB,mBAAmB,CAAC,CAACD,IAAI,CAAC,CAACb,IAAI;MACtDkC,YAAY,EACVd,gBAAgB,CAACe,MAAM,GAAG,CAAC,GACtB,GAAErB,mBAAmB,CAACsB,iBAAkB,EAAC,GAC1C,KAAK;MACXC,QAAQ,EAAG,GAAEvB,mBAAmB,CAACwB,gBAAiB,EAAC;MACnDC,UAAU,EAAG,GAAEzB,mBAAmB,CAAC0B,oBAAqB,EAAC;MACzDC,UAAU,EAAG,GAAE3B,mBAAmB,CAAC4B,wBAAyB,EAAC;MAC7DC,UAAU,EAAE,CAAC;MACbC,kBAAkB,EAAG,GAAE9B,mBAAmB,CAAC+B,sBAAuB,EAAC;MACnEC,kBAAkB,EAAG;IACvB,CAAC;IAED,MAAMC,oBAAoB,GAAGtC,YAAY,IAAIA,YAAY,GAAG,CAAC;IAE7D,OAAOsC,oBAAoB,GACzBtD,IAAA,CAACF,GAAG;MAACyD,EAAE,EAAE1B,WAAY;MAAC,WAASX,MAAO;MAACC,SAAS,EAAEA,SAAU;MAAAqC,QAAA,EACzD7B;IAAgB,CACd,CAAC,GACJ,IAAI;EACV,CAAC,EAAE,CACDX,YAAY,EACZC,eAAe,EACfI,mBAAmB,EACnBH,MAAM,EACNC,SAAS,EACTC,IAAI,CACL,CAAC;EAEF,OAAOE,WAAW;AACpB,CAAC;AAED,MAAMmC,aAAa,GAAG9D,IAAI,CAACmB,KAAK,CAAC;AACjC2C,aAAa,CAACC,WAAW,GAAG,OAAO;AAEnC,SAASD,aAAa,IAAI3C,KAAK"}
|
package/dist/Tabs.js
CHANGED
|
@@ -11,18 +11,44 @@ import _Tab from "@mui/material/Tab";
|
|
|
11
11
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { TabContext as MuiTabContext, TabList as MuiTabList, TabPanel as MuiTabPanel } from "@mui/lab";
|
|
15
14
|
import { memo, useCallback, useEffect, useState } from "react";
|
|
15
|
+
import { TabContext as MuiTabContext, TabList as MuiTabList, TabPanel as MuiTabPanel } from "@mui/lab";
|
|
16
|
+
import { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext.js";
|
|
17
|
+
import { Badge } from "./Badge.js";
|
|
18
|
+
import { Box } from "./Box.js";
|
|
16
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
-
const
|
|
22
|
+
const TabLabel = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
label,
|
|
25
|
+
notificationCount,
|
|
26
|
+
notificationCountMax,
|
|
27
|
+
tabState,
|
|
28
|
+
value
|
|
29
|
+
} = _ref;
|
|
30
|
+
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
31
|
+
return _jsxs(_Fragment, {
|
|
32
|
+
children: [label, notificationCount !== undefined && notificationCount > 0 && _jsx(Box, {
|
|
33
|
+
sx: {
|
|
34
|
+
marginInlineStart: notificationCount ? odysseyDesignTokens.Spacing2 : 0
|
|
35
|
+
},
|
|
36
|
+
children: _jsx(Badge, {
|
|
37
|
+
badgeContent: notificationCount,
|
|
38
|
+
badgeContentMax: notificationCountMax,
|
|
39
|
+
type: value === tabState ? "attention" : "default"
|
|
40
|
+
})
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const Tabs = _ref2 => {
|
|
19
45
|
let {
|
|
20
46
|
ariaLabel,
|
|
21
47
|
initialValue,
|
|
22
48
|
tabs,
|
|
23
49
|
value,
|
|
24
50
|
onChange: onChangeProp
|
|
25
|
-
} =
|
|
51
|
+
} = _ref2;
|
|
26
52
|
const [tabState, setTabState] = useState(initialValue ?? value ?? "0");
|
|
27
53
|
const onChange = useCallback((event, value) => {
|
|
28
54
|
setTabState(value);
|
|
@@ -33,18 +59,36 @@ const Tabs = _ref => {
|
|
|
33
59
|
setTabState(value);
|
|
34
60
|
}
|
|
35
61
|
}, [value]);
|
|
62
|
+
const renderTab = useCallback((tab, index) => {
|
|
63
|
+
const {
|
|
64
|
+
testId,
|
|
65
|
+
isDisabled,
|
|
66
|
+
label,
|
|
67
|
+
startIcon,
|
|
68
|
+
value,
|
|
69
|
+
notificationCount,
|
|
70
|
+
notificationCountMax
|
|
71
|
+
} = tab;
|
|
72
|
+
return _jsx(_Tab, {
|
|
73
|
+
"data-se": testId,
|
|
74
|
+
disabled: isDisabled,
|
|
75
|
+
icon: startIcon,
|
|
76
|
+
label: _jsx(TabLabel, {
|
|
77
|
+
label: label,
|
|
78
|
+
notificationCount: notificationCount,
|
|
79
|
+
notificationCountMax: notificationCountMax,
|
|
80
|
+
tabState: tabState,
|
|
81
|
+
value: value
|
|
82
|
+
}),
|
|
83
|
+
value: value ? value : index.toString()
|
|
84
|
+
}, value ? value : index.toString());
|
|
85
|
+
}, [tabState]);
|
|
36
86
|
return _jsxs(MuiTabContext, {
|
|
37
87
|
value: tabState,
|
|
38
88
|
children: [_jsx(MuiTabList, {
|
|
39
89
|
onChange: onChange,
|
|
40
90
|
"aria-label": ariaLabel,
|
|
41
|
-
children: tabs.map((tab, index) =>
|
|
42
|
-
"data-se": tab.testId,
|
|
43
|
-
disabled: tab.isDisabled,
|
|
44
|
-
icon: tab.startIcon,
|
|
45
|
-
label: tab.label,
|
|
46
|
-
value: tab.value ? tab.value : index.toString()
|
|
47
|
-
}, tab.value ? tab.value : index.toString()))
|
|
91
|
+
children: tabs.map((tab, index) => renderTab(tab, index))
|
|
48
92
|
}), tabs.map((tab, index) => _jsx(MuiTabPanel, {
|
|
49
93
|
value: tab.value ? tab.value : index.toString(),
|
|
50
94
|
children: tab.children
|
package/dist/Tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","names":["TabContext","MuiTabContext","TabList","MuiTabList","TabPanel","MuiTabPanel","
|
|
1
|
+
{"version":3,"file":"Tabs.js","names":["memo","useCallback","useEffect","useState","TabContext","MuiTabContext","TabList","MuiTabList","TabPanel","MuiTabPanel","useOdysseyDesignTokens","Badge","Box","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TabLabel","_ref","label","notificationCount","notificationCountMax","tabState","value","odysseyDesignTokens","children","undefined","sx","marginInlineStart","Spacing2","badgeContent","badgeContentMax","type","Tabs","_ref2","ariaLabel","initialValue","tabs","onChange","onChangeProp","setTabState","event","renderTab","tab","index","testId","isDisabled","startIcon","_Tab","disabled","icon","toString","map","MemoizedTabs","displayName"],"sources":["../src/Tabs.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 {\n ReactElement,\n ReactNode,\n memo,\n useCallback,\n useEffect,\n useState,\n} from \"react\";\nimport {\n TabContext as MuiTabContext,\n TabList as MuiTabList,\n TabListProps as MuiTabListProps,\n TabPanel as MuiTabPanel,\n} from \"@mui/lab\";\nimport { Tab as MuiTab } from \"@mui/material\";\n\nimport { useOdysseyDesignTokens } from \"./OdysseyDesignTokensContext\";\nimport { Badge, BadgeProps } from \"./Badge\";\nimport { AllowedProps } from \"./AllowedProps\";\nimport { Box } from \"./Box\";\n\nexport type TabItemProps = {\n /**\n * The content of the Tab itself\n */\n children: ReactNode;\n /**\n * If `true`, the TabItem is disabled\n */\n isDisabled?: boolean;\n /**\n * The label text for the TabItem\n */\n label: string;\n /**\n * An optional icon to display at the start of the TabItem\n */\n startIcon?: ReactElement;\n /**\n * The value associated with the TabItem\n */\n value?: string;\n} & {\n notificationCount?: BadgeProps[\"badgeContent\"];\n notificationCountMax?: BadgeProps[\"badgeContentMax\"];\n} & AllowedProps;\n\nexport type TabsProps = {\n /**\n * The ARIA label for the full Tabs group\n */\n ariaLabel?: string;\n /**\n * @deprecated please use the `value` prop instead\n * When `value` is provided, `initialValue` isn't used.\n */\n initialValue?: string;\n /**\n * The TabItems to be included in the Tabs group\n */\n tabs: TabItemProps[];\n /**\n * Identifier for the selected tab.\n */\n value?: string;\n /**\n * Callback fired when the active tab is changed.\n */\n onChange?: MuiTabListProps[\"onChange\"];\n};\n\nconst TabLabel = ({\n label,\n notificationCount,\n notificationCountMax,\n tabState,\n value,\n}: Pick<\n TabItemProps,\n \"label\" | \"notificationCount\" | \"notificationCountMax\" | \"value\"\n> & {\n tabState: string;\n}) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n return (\n <>\n {label}\n {notificationCount !== undefined && notificationCount > 0 && (\n <Box\n sx={{\n marginInlineStart: notificationCount\n ? odysseyDesignTokens.Spacing2\n : 0,\n }}\n >\n <Badge\n badgeContent={notificationCount}\n badgeContentMax={notificationCountMax}\n type={value === tabState ? \"attention\" : \"default\"}\n />\n </Box>\n )}\n </>\n );\n};\n\nconst Tabs = ({\n ariaLabel,\n initialValue,\n tabs,\n value,\n onChange: onChangeProp,\n}: TabsProps) => {\n const [tabState, setTabState] = useState(initialValue ?? value ?? \"0\");\n\n const onChange = useCallback<NonNullable<MuiTabListProps[\"onChange\"]>>(\n (event, value: string) => {\n setTabState(value);\n onChangeProp?.(event, value);\n },\n [onChangeProp]\n );\n\n useEffect(() => {\n if (value !== undefined) {\n setTabState(value);\n }\n }, [value]);\n\n const renderTab = useCallback(\n (tab, index) => {\n const {\n testId,\n isDisabled,\n label,\n startIcon,\n value,\n notificationCount,\n notificationCountMax,\n } = tab;\n\n return (\n <MuiTab\n data-se={testId}\n disabled={isDisabled}\n icon={startIcon}\n label={\n <TabLabel\n label={label}\n notificationCount={notificationCount}\n notificationCountMax={notificationCountMax}\n tabState={tabState}\n value={value}\n />\n }\n value={value ? value : index.toString()}\n key={value ? value : index.toString()}\n />\n );\n },\n [tabState]\n );\n\n return (\n <MuiTabContext value={tabState}>\n <MuiTabList onChange={onChange} aria-label={ariaLabel}>\n {tabs.map((tab, index) => renderTab(tab, index))}\n </MuiTabList>\n {tabs.map((tab, index) => (\n <MuiTabPanel\n value={tab.value ? tab.value : index.toString()}\n key={tab.value ? tab.value : index.toString()}\n >\n {tab.children}\n </MuiTabPanel>\n ))}\n </MuiTabContext>\n );\n};\n\nconst MemoizedTabs = memo(Tabs);\nMemoizedTabs.displayName = \"Tabs\";\n\nexport { MemoizedTabs as Tabs };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAGEA,IAAI,EACJC,WAAW,EACXC,SAAS,EACTC,QAAQ,QACH,OAAO;AACd,SACEC,UAAU,IAAIC,aAAa,EAC3BC,OAAO,IAAIC,UAAU,EAErBC,QAAQ,IAAIC,WAAW,QAClB,UAAU;AAAC,SAGTC,sBAAsB;AAAA,SACtBC,KAAK;AAAA,SAELC,GAAG;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAoDZ,MAAMC,QAAQ,GAAGC,IAAA,IAWX;EAAA,IAXY;IAChBC,KAAK;IACLC,iBAAiB;IACjBC,oBAAoB;IACpBC,QAAQ;IACRC;EAMF,CAAC,GAAAL,IAAA;EACC,MAAMM,mBAAmB,GAAGhB,sBAAsB,CAAC,CAAC;EAEpD,OACEQ,KAAA,CAAAF,SAAA;IAAAW,QAAA,GACGN,KAAK,EACLC,iBAAiB,KAAKM,SAAS,IAAIN,iBAAiB,GAAG,CAAC,IACvDR,IAAA,CAACF,GAAG;MACFiB,EAAE,EAAE;QACFC,iBAAiB,EAAER,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;GAUG;;AASH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,eAAO,MAAM,eAAe,6CAA8C,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;CACzC,GAAG,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/Badge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;AASH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,eAAO,MAAM,eAAe,6CAA8C,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;CACzC,GAAG,YAAY,CAAC;AA8EjB,QAAA,MAAM,aAAa,oGAvDhB,UAAU,wBAuDoB,CAAC;AAGlC,OAAO,EAAE,aAAa,IAAI,KAAK,EAAE,CAAC"}
|
package/dist/src/Tabs.d.ts
CHANGED
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
*
|
|
10
10
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
import { TabListProps as MuiTabListProps } from "@mui/lab";
|
|
13
12
|
import { ReactElement, ReactNode } from "react";
|
|
13
|
+
import { TabListProps as MuiTabListProps } from "@mui/lab";
|
|
14
|
+
import { BadgeProps } from "./Badge";
|
|
14
15
|
import { AllowedProps } from "./AllowedProps";
|
|
15
16
|
export type TabItemProps = {
|
|
16
17
|
/**
|
|
@@ -33,6 +34,9 @@ export type TabItemProps = {
|
|
|
33
34
|
* The value associated with the TabItem
|
|
34
35
|
*/
|
|
35
36
|
value?: string;
|
|
37
|
+
} & {
|
|
38
|
+
notificationCount?: BadgeProps["badgeContent"];
|
|
39
|
+
notificationCountMax?: BadgeProps["badgeContentMax"];
|
|
36
40
|
} & AllowedProps;
|
|
37
41
|
export type TabsProps = {
|
|
38
42
|
/**
|
package/dist/src/Tabs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../src/Tabs.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAGL,YAAY,IAAI,eAAe,EAEhC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../src/Tabs.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,YAAY,EACZ,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,YAAY,IAAI,eAAe,EAEhC,MAAM,UAAU,CAAC;AAIlB,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG;IACF,iBAAiB,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;IAC/C,oBAAoB,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC;CACtD,GAAG,YAAY,CAAC;AAEjB,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;CACxC,CAAC;AAgHF,QAAA,MAAM,YAAY,0GApEf,SAAS,iBAoEmB,CAAC;AAGhC,OAAO,EAAE,YAAY,IAAI,IAAI,EAAE,CAAC"}
|
package/dist/theme/components.js
CHANGED
|
@@ -2069,7 +2069,7 @@ export const components = _ref => {
|
|
|
2069
2069
|
return {
|
|
2070
2070
|
maxWidth: `calc(${odysseyTokens.TypographyLineLengthMax} / 2)`,
|
|
2071
2071
|
minWidth: "unset",
|
|
2072
|
-
minHeight:
|
|
2072
|
+
minHeight: odysseyTokens.Spacing9,
|
|
2073
2073
|
padding: `${odysseyTokens.Spacing4} ${odysseyTokens.Spacing1}`,
|
|
2074
2074
|
fontSize: odysseyTokens.TypographySizeHeading6,
|
|
2075
2075
|
fontFamily: odysseyTokens.TypographyFamilyHeading,
|