@okta/odyssey-react-mui 1.26.0 → 1.27.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/Surface.js +10 -2
  3. package/dist/Surface.js.map +1 -1
  4. package/dist/index.scss +1 -1
  5. package/dist/labs/DataView/DataView.js +6 -0
  6. package/dist/labs/DataView/DataView.js.map +1 -1
  7. package/dist/labs/DataView/componentTypes.js.map +1 -1
  8. package/dist/labs/SideNav/NavAccordion.js +4 -5
  9. package/dist/labs/SideNav/NavAccordion.js.map +1 -1
  10. package/dist/labs/SideNav/SideNav.js +167 -93
  11. package/dist/labs/SideNav/SideNav.js.map +1 -1
  12. package/dist/labs/SideNav/SideNavItemContent.js +97 -57
  13. package/dist/labs/SideNav/SideNavItemContent.js.map +1 -1
  14. package/dist/labs/SideNav/SideNavItemContentContext.js +1 -0
  15. package/dist/labs/SideNav/SideNavItemContentContext.js.map +1 -1
  16. package/dist/labs/SideNav/SideNavItemLinkContent.js +2 -2
  17. package/dist/labs/SideNav/SideNavItemLinkContent.js.map +1 -1
  18. package/dist/labs/SideNav/SideNavToggleButton.js +5 -5
  19. package/dist/labs/SideNav/SideNavToggleButton.js.map +1 -1
  20. package/dist/labs/SideNav/SortableList/SortableItem.js +162 -0
  21. package/dist/labs/SideNav/SortableList/SortableItem.js.map +1 -0
  22. package/dist/labs/SideNav/SortableList/SortableList.js +118 -0
  23. package/dist/labs/SideNav/SortableList/SortableList.js.map +1 -0
  24. package/dist/labs/SideNav/SortableList/SortableOverlay.js +30 -0
  25. package/dist/labs/SideNav/SortableList/SortableOverlay.js.map +1 -0
  26. package/dist/labs/SideNav/types.js.map +1 -1
  27. package/dist/labs/TopNav/TopNav.js +1 -1
  28. package/dist/labs/TopNav/TopNav.js.map +1 -1
  29. package/dist/labs/UiShell/UiShellContent.js +1 -1
  30. package/dist/labs/UiShell/UiShellContent.js.map +1 -1
  31. package/dist/properties/ts/odyssey-react-mui.js +7 -0
  32. package/dist/properties/ts/odyssey-react-mui.js.map +1 -1
  33. package/dist/src/OdysseyTranslationProvider.d.ts +1 -1
  34. package/dist/src/OdysseyTranslationProvider.d.ts.map +1 -1
  35. package/dist/src/Surface.d.ts.map +1 -1
  36. package/dist/src/labs/DataView/DataView.d.ts +1 -1
  37. package/dist/src/labs/DataView/DataView.d.ts.map +1 -1
  38. package/dist/src/labs/DataView/componentTypes.d.ts +3 -2
  39. package/dist/src/labs/DataView/componentTypes.d.ts.map +1 -1
  40. package/dist/src/labs/SideNav/NavAccordion.d.ts +2 -6
  41. package/dist/src/labs/SideNav/NavAccordion.d.ts.map +1 -1
  42. package/dist/src/labs/SideNav/SideNav.d.ts +1 -1
  43. package/dist/src/labs/SideNav/SideNav.d.ts.map +1 -1
  44. package/dist/src/labs/SideNav/SideNavItemContent.d.ts +37 -1
  45. package/dist/src/labs/SideNav/SideNavItemContent.d.ts.map +1 -1
  46. package/dist/src/labs/SideNav/SideNavItemContentContext.d.ts +1 -0
  47. package/dist/src/labs/SideNav/SideNavItemContentContext.d.ts.map +1 -1
  48. package/dist/src/labs/SideNav/SideNavToggleButton.d.ts.map +1 -1
  49. package/dist/src/labs/SideNav/SortableList/SortableItem.d.ts +26 -0
  50. package/dist/src/labs/SideNav/SortableList/SortableItem.d.ts.map +1 -0
  51. package/dist/src/labs/SideNav/SortableList/SortableList.d.ts +36 -0
  52. package/dist/src/labs/SideNav/SortableList/SortableList.d.ts.map +1 -0
  53. package/dist/src/labs/SideNav/SortableList/SortableOverlay.d.ts +17 -0
  54. package/dist/src/labs/SideNav/SortableList/SortableOverlay.d.ts.map +1 -0
  55. package/dist/src/labs/SideNav/types.d.ts +16 -6
  56. package/dist/src/labs/SideNav/types.d.ts.map +1 -1
  57. package/dist/src/properties/ts/odyssey-react-mui.d.ts +7 -0
  58. package/dist/src/properties/ts/odyssey-react-mui.d.ts.map +1 -1
  59. package/dist/theme/components.js +1 -1
  60. package/dist/theme/components.js.map +1 -1
  61. package/dist/tsconfig.production.tsbuildinfo +1 -1
  62. package/i18n.config.json +2 -1
  63. package/package.json +6 -3
  64. package/src/Surface.tsx +16 -4
  65. package/src/labs/DataView/DataView.tsx +6 -0
  66. package/src/labs/DataView/componentTypes.ts +6 -2
  67. package/src/labs/SideNav/NavAccordion.tsx +5 -10
  68. package/src/labs/SideNav/SideNav.test.tsx +8 -8
  69. package/src/labs/SideNav/SideNav.tsx +232 -119
  70. package/src/labs/SideNav/SideNavItemContent.tsx +114 -61
  71. package/src/labs/SideNav/SideNavItemContentContext.tsx +2 -0
  72. package/src/labs/SideNav/SideNavItemLinkContent.tsx +2 -2
  73. package/src/labs/SideNav/SideNavToggleButton.tsx +5 -9
  74. package/src/labs/SideNav/SortableList/SortableItem.tsx +202 -0
  75. package/src/labs/SideNav/SortableList/SortableList.tsx +122 -0
  76. package/src/labs/SideNav/SortableList/SortableOverlay.tsx +34 -0
  77. package/src/labs/SideNav/types.ts +16 -6
  78. package/src/labs/TopNav/TopNav.tsx +1 -1
  79. package/src/labs/UiShell/UiShellContent.tsx +1 -1
  80. package/src/properties/odyssey-react-mui.properties +7 -0
  81. package/src/properties/ts/odyssey-react-mui.ts +1 -1
  82. package/src/theme/components.tsx +1 -1
@@ -29,15 +29,11 @@ export const StyledSideNavListItem = styled("li", {
29
29
  alignItems: "center",
30
30
  backgroundColor: "unset",
31
31
  borderRadius: odysseyDesignTokens.BorderRadiusMain,
32
- lineHeight: 1.5,
33
32
  transition: `backgroundColor ${odysseyDesignTokens.TransitionDurationMain}, color ${odysseyDesignTokens.TransitionDurationMain}`,
34
33
  ...(isSelected && {
35
34
  color: `${odysseyDesignTokens.TypographyColorAction} !important`,
36
35
  backgroundColor: odysseyDesignTokens.HueBlue50
37
- }),
38
- "&:last-child": {
39
- marginBottom: odysseyDesignTokens.Spacing2
40
- }
36
+ })
41
37
  }));
42
38
  const scrollToNode = node => {
43
39
  if (node) {
@@ -48,60 +44,94 @@ const scrollToNode = node => {
48
44
  });
49
45
  }
50
46
  };
51
- const GetNavItemContentStyles = ({
47
+ export const getBaseNavItemContentStyles = ({
52
48
  odysseyDesignTokens,
53
- contextValue,
54
49
  isDisabled,
55
50
  isSelected
56
- }) => {
57
- return {
58
- display: "flex",
59
- alignItems: "center",
60
- width: "100%",
51
+ }) => ({
52
+ display: "flex",
53
+ alignItems: "center",
54
+ width: "100%",
55
+ textDecoration: "none",
56
+ color: `${odysseyDesignTokens.TypographyColorHeading} !important`,
57
+ minHeight: "unset",
58
+ paddingBlock: odysseyDesignTokens.Spacing3,
59
+ paddingInlineEnd: odysseyDesignTokens.Spacing4,
60
+ borderRadius: odysseyDesignTokens.BorderRadiusMain,
61
+ transition: `backgroundColor ${odysseyDesignTokens.TransitionDurationMain}, color ${odysseyDesignTokens.TransitionDurationMain}`,
62
+ cursor: "pointer",
63
+ "&:hover, [data-sortable-container='true']:has(button:hover, button:focus, button:focus-visible) &": {
61
64
  textDecoration: "none",
62
- color: `${odysseyDesignTokens.TypographyColorHeading} !important`,
63
- minHeight: odysseyDesignTokens.Spacing7,
64
- paddingBlock: odysseyDesignTokens.Spacing4,
65
- paddingInline: `calc(${odysseyDesignTokens.Spacing4} * ${contextValue.depth})`,
66
- borderRadius: odysseyDesignTokens.BorderRadiusMain,
67
- transition: `backgroundColor ${odysseyDesignTokens.TransitionDurationMain}, color ${odysseyDesignTokens.TransitionDurationMain}`,
68
- "&:hover": {
69
- textDecoration: "none",
70
- cursor: "pointer",
71
- backgroundColor: !isDisabled ? odysseyDesignTokens.HueNeutral50 : "inherit",
72
- ...(isDisabled && {
73
- color: "inherit",
74
- cursor: "default"
75
- }),
76
- ...(isSelected && {
77
- "&:hover": {
78
- backgroundColor: odysseyDesignTokens.HueBlue50
79
- }
80
- })
81
- },
65
+ backgroundColor: odysseyDesignTokens.HueNeutral50,
82
66
  ...(isSelected && {
83
- color: `${odysseyDesignTokens.TypographyColorAction} !important`,
84
- fontWeight: odysseyDesignTokens.TypographyWeightBodyBold
67
+ backgroundColor: odysseyDesignTokens.HueBlue50,
68
+ color: odysseyDesignTokens.TypographyColorAction
85
69
  }),
86
70
  ...(isDisabled && {
87
- color: `${odysseyDesignTokens.TypographyColorDisabled} !important`
88
- }),
89
- ...(contextValue.isCompact && {
90
- paddingBlock: odysseyDesignTokens.Spacing1,
91
- minHeight: odysseyDesignTokens.Spacing6
92
- }),
93
- "&:focus-visible": {
94
- outline: "none",
95
- boxShadow: `inset 0 0 0 3px ${odysseyDesignTokens.PalettePrimaryMain}`
96
- }
97
- };
98
- };
71
+ backgroundColor: "unset"
72
+ })
73
+ },
74
+ ...(isSelected && {
75
+ color: `${odysseyDesignTokens.TypographyColorAction}`,
76
+ fontWeight: odysseyDesignTokens.TypographyWeightBodyBold
77
+ }),
78
+ ...(isDisabled && {
79
+ cursor: "default",
80
+ color: `${odysseyDesignTokens.TypographyColorDisabled} !important`
81
+ }),
82
+ "&:focus-visible, &:focus": {
83
+ outline: "none",
84
+ boxShadow: `inset 0 0 0 2px ${odysseyDesignTokens.PalettePrimaryMain}`
85
+ }
86
+ });
87
+ export const getNavItemContentStyles = ({
88
+ odysseyDesignTokens,
89
+ contextValue
90
+ }) => ({
91
+ paddingInlineStart: `calc(${odysseyDesignTokens.Spacing4} * ${contextValue.depth} + ${odysseyDesignTokens.Spacing6})`,
92
+ ...(contextValue.depth === 1 && {
93
+ paddingInlineStart: odysseyDesignTokens.Spacing4
94
+ }),
95
+ ...(contextValue.isCompact && {
96
+ paddingBlock: odysseyDesignTokens.Spacing1
97
+ })
98
+ });
99
99
  const NavItemContentContainer = styled("div", {
100
100
  shouldForwardProp: prop => prop !== "odysseyDesignTokens" && prop != "contextValue" && prop !== "isDisabled" && prop !== "isSelected"
101
- })(GetNavItemContentStyles);
102
- const NavItemLinkContainer = styled(_Link, {
101
+ })(({
102
+ contextValue,
103
+ odysseyDesignTokens,
104
+ isDisabled,
105
+ isSelected
106
+ }) => ({
107
+ ...getBaseNavItemContentStyles({
108
+ odysseyDesignTokens,
109
+ isDisabled,
110
+ isSelected
111
+ }),
112
+ ...getNavItemContentStyles({
113
+ odysseyDesignTokens,
114
+ contextValue
115
+ })
116
+ }));
117
+ const StyledNavItemLink = styled(_Link, {
103
118
  shouldForwardProp: prop => prop !== "odysseyDesignTokens" && prop != "contextValue" && prop !== "isDisabled" && prop !== "isSelected"
104
- })(GetNavItemContentStyles);
119
+ })(({
120
+ contextValue,
121
+ odysseyDesignTokens,
122
+ isDisabled,
123
+ isSelected
124
+ }) => ({
125
+ ...getBaseNavItemContentStyles({
126
+ odysseyDesignTokens,
127
+ isDisabled,
128
+ isSelected
129
+ }),
130
+ ...getNavItemContentStyles({
131
+ odysseyDesignTokens,
132
+ contextValue
133
+ })
134
+ }));
105
135
  const SideNavItemContent = ({
106
136
  count,
107
137
  id,
@@ -113,9 +143,10 @@ const SideNavItemContent = ({
113
143
  statusLabel,
114
144
  endIcon,
115
145
  onClick,
116
- isSelected,
117
146
  isDisabled,
118
- scrollRef
147
+ isSelected,
148
+ scrollRef,
149
+ onItemSelected
119
150
  }) => {
120
151
  const sidenavItemContentContext = useSideNavItemContent();
121
152
  const contextValue = useMemo(() => sidenavItemContentContext, [sidenavItemContentContext]);
@@ -128,12 +159,19 @@ const SideNavItemContent = ({
128
159
  }
129
160
  };
130
161
  }, []);
131
- const sideNavItemContentKeyHandler = useCallback(event => {
162
+ const itemClickHandler = useCallback(id => {
163
+ return () => {
164
+ onItemSelected?.(id);
165
+ onClick?.();
166
+ };
167
+ }, [onClick, onItemSelected]);
168
+ const sideNavItemContentKeyHandler = useCallback((id, event) => {
132
169
  if (event?.key === "Enter") {
133
170
  event.preventDefault();
171
+ onItemSelected?.(id);
134
172
  onClick?.();
135
173
  }
136
- }, [onClick]);
174
+ }, [onClick, onItemSelected]);
137
175
  return _jsx(StyledSideNavListItem, {
138
176
  ref: localScrollRef,
139
177
  id: id,
@@ -160,8 +198,10 @@ const SideNavItemContent = ({
160
198
  contextValue: contextValue,
161
199
  isDisabled: isDisabled,
162
200
  tabIndex: 0,
163
- onClick: onClick,
164
- onKeyDown: sideNavItemContentKeyHandler,
201
+ role: "button",
202
+ onClick: itemClickHandler(id),
203
+ onKeyDown: event => sideNavItemContentKeyHandler(id, event),
204
+ isSelected: isSelected,
165
205
  children: _jsx(SideNavItemLinkContent, {
166
206
  count: count,
167
207
  label: label,
@@ -170,14 +210,14 @@ const SideNavItemContent = ({
170
210
  statusLabel: statusLabel,
171
211
  severity: severity
172
212
  })
173
- }) : _jsxs(NavItemLinkContainer, {
213
+ }) : _jsxs(StyledNavItemLink, {
174
214
  odysseyDesignTokens: odysseyDesignTokens,
175
215
  contextValue: contextValue,
176
216
  isDisabled: isDisabled,
177
217
  isSelected: isSelected,
178
218
  href: href,
179
219
  target: target,
180
- onClick: onClick,
220
+ onClick: itemClickHandler(id),
181
221
  children: [_jsx(SideNavItemLinkContent, {
182
222
  count: count,
183
223
  label: label,
@@ -1 +1 @@
1
- {"version":3,"file":"SideNavItemContent.js","names":["styled","useRef","useImperativeHandle","useCallback","memo","useMemo","useOdysseyDesignTokens","SideNavItemLinkContent","useSideNavItemContent","ExternalLinkIcon","jsx","_jsx","jsxs","_jsxs","StyledSideNavListItem","shouldForwardProp","prop","odysseyDesignTokens","isSelected","display","alignItems","backgroundColor","borderRadius","BorderRadiusMain","lineHeight","transition","TransitionDurationMain","color","TypographyColorAction","HueBlue50","marginBottom","Spacing2","scrollToNode","node","scrollIntoView","behavior","block","inline","GetNavItemContentStyles","contextValue","isDisabled","width","textDecoration","TypographyColorHeading","minHeight","Spacing7","paddingBlock","Spacing4","paddingInline","depth","cursor","HueNeutral50","fontWeight","TypographyWeightBodyBold","TypographyColorDisabled","isCompact","Spacing1","Spacing6","outline","boxShadow","PalettePrimaryMain","NavItemContentContainer","NavItemLinkContainer","_Link","SideNavItemContent","count","id","label","href","target","startIcon","severity","statusLabel","endIcon","onClick","scrollRef","sidenavItemContentContext","localScrollRef","current","sideNavItemContentKeyHandler","event","key","preventDefault","ref","disabled","undefined","children","tabIndex","onKeyDown","className","role","MemoizedSideNavItemContent","displayName"],"sources":["../../../src/labs/SideNav/SideNavItemContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport styled from \"@emotion/styled\";\nimport {\n useRef,\n useImperativeHandle,\n useCallback,\n memo,\n KeyboardEvent,\n useMemo,\n} from \"react\";\nimport { Link as NavItemLink } from \"@mui/material\";\nimport {\n type DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext\";\nimport { SideNavItemLinkContent } from \"./SideNavItemLinkContent\";\nimport type { SideNavItem } from \"./types\";\nimport {\n SideNavItemContentContextValue,\n useSideNavItemContent,\n} from \"./SideNavItemContentContext\";\nimport { ExternalLinkIcon } from \"../../icons.generated\";\n\nexport const StyledSideNavListItem = styled(\"li\", {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" && prop !== \"isSelected\",\n})<{\n odysseyDesignTokens: DesignTokens;\n isSelected?: boolean;\n disabled?: boolean;\n}>(({ odysseyDesignTokens, isSelected }) => ({\n display: \"flex\",\n alignItems: \"center\",\n backgroundColor: \"unset\",\n borderRadius: odysseyDesignTokens.BorderRadiusMain,\n lineHeight: 1.5,\n transition: `backgroundColor ${odysseyDesignTokens.TransitionDurationMain}, color ${odysseyDesignTokens.TransitionDurationMain}`,\n\n ...(isSelected && {\n color: `${odysseyDesignTokens.TypographyColorAction} !important`,\n backgroundColor: odysseyDesignTokens.HueBlue50,\n }),\n\n \"&:last-child\": {\n marginBottom: odysseyDesignTokens.Spacing2,\n },\n}));\n\nconst scrollToNode = (node: HTMLElement | null) => {\n if (node) {\n node?.scrollIntoView({\n behavior: \"instant\",\n block: \"center\",\n inline: \"nearest\",\n });\n }\n};\n\ntype ScrollIntoViewHandle = {\n scrollIntoView: () => void;\n};\n\nconst GetNavItemContentStyles = ({\n odysseyDesignTokens,\n contextValue,\n isDisabled,\n isSelected,\n}: {\n odysseyDesignTokens: DesignTokens;\n contextValue: SideNavItemContentContextValue;\n isDisabled?: boolean;\n isSelected?: boolean;\n}) => {\n return {\n display: \"flex\",\n alignItems: \"center\",\n width: \"100%\",\n textDecoration: \"none\",\n color: `${odysseyDesignTokens.TypographyColorHeading} !important`,\n minHeight: odysseyDesignTokens.Spacing7,\n paddingBlock: odysseyDesignTokens.Spacing4,\n paddingInline: `calc(${odysseyDesignTokens.Spacing4} * ${contextValue.depth})`,\n borderRadius: odysseyDesignTokens.BorderRadiusMain,\n transition: `backgroundColor ${odysseyDesignTokens.TransitionDurationMain}, color ${odysseyDesignTokens.TransitionDurationMain}`,\n\n \"&:hover\": {\n textDecoration: \"none\",\n cursor: \"pointer\",\n backgroundColor: !isDisabled\n ? odysseyDesignTokens.HueNeutral50\n : \"inherit\",\n\n ...(isDisabled && {\n color: \"inherit\",\n cursor: \"default\",\n }),\n\n ...(isSelected && {\n \"&:hover\": {\n backgroundColor: odysseyDesignTokens.HueBlue50,\n },\n }),\n },\n\n ...(isSelected && {\n color: `${odysseyDesignTokens.TypographyColorAction} !important`,\n fontWeight: odysseyDesignTokens.TypographyWeightBodyBold,\n }),\n\n ...(isDisabled && {\n color: `${odysseyDesignTokens.TypographyColorDisabled} !important`,\n }),\n\n ...(contextValue.isCompact && {\n paddingBlock: odysseyDesignTokens.Spacing1,\n minHeight: odysseyDesignTokens.Spacing6,\n }),\n\n \"&:focus-visible\": {\n outline: \"none\",\n boxShadow: `inset 0 0 0 3px ${odysseyDesignTokens.PalettePrimaryMain}`,\n },\n };\n};\n\nconst NavItemContentContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" &&\n prop != \"contextValue\" &&\n prop !== \"isDisabled\" &&\n prop !== \"isSelected\",\n})(GetNavItemContentStyles);\n\nconst NavItemLinkContainer = styled(NavItemLink, {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" &&\n prop != \"contextValue\" &&\n prop !== \"isDisabled\" &&\n prop !== \"isSelected\",\n})(GetNavItemContentStyles);\n\nconst SideNavItemContent = ({\n count,\n id,\n label,\n href,\n target,\n startIcon,\n severity,\n statusLabel,\n endIcon,\n onClick,\n isSelected,\n isDisabled,\n scrollRef,\n}: Pick<\n SideNavItem,\n | \"count\"\n | \"id\"\n | \"label\"\n | \"href\"\n | \"target\"\n | \"startIcon\"\n | \"severity\"\n | \"statusLabel\"\n | \"endIcon\"\n | \"onClick\"\n | \"isSelected\"\n | \"isDisabled\"\n> & {\n /**\n * The ref used to scroll to this item\n */\n scrollRef?: React.RefObject<ScrollIntoViewHandle>;\n}) => {\n const sidenavItemContentContext = useSideNavItemContent();\n const contextValue = useMemo(\n () => sidenavItemContentContext,\n [sidenavItemContentContext],\n );\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const localScrollRef = useRef<HTMLLIElement>(null);\n useImperativeHandle(\n scrollRef,\n () => {\n return {\n scrollIntoView: () => {\n scrollToNode(localScrollRef.current);\n },\n };\n },\n [],\n );\n\n const sideNavItemContentKeyHandler = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (event?.key === \"Enter\") {\n event.preventDefault();\n onClick?.();\n }\n },\n [onClick],\n );\n\n return (\n <StyledSideNavListItem\n ref={localScrollRef}\n id={id}\n key={id}\n isSelected={isSelected}\n disabled={isDisabled}\n aria-disabled={isDisabled}\n aria-current={isSelected ? \"page\" : undefined}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n {\n // Use Link for nav items with links and div for disabled or non-link items\n isDisabled ? (\n <NavItemContentContainer\n odysseyDesignTokens={odysseyDesignTokens}\n contextValue={contextValue}\n isDisabled={isDisabled}\n isSelected={isSelected}\n >\n <SideNavItemLinkContent\n count={count}\n label={label}\n startIcon={startIcon}\n endIcon={endIcon}\n statusLabel={statusLabel}\n severity={severity}\n />\n </NavItemContentContainer>\n ) : !href ? (\n <NavItemContentContainer\n odysseyDesignTokens={odysseyDesignTokens}\n contextValue={contextValue}\n isDisabled={isDisabled}\n tabIndex={0}\n onClick={onClick}\n onKeyDown={sideNavItemContentKeyHandler}\n >\n <SideNavItemLinkContent\n count={count}\n label={label}\n startIcon={startIcon}\n endIcon={endIcon}\n statusLabel={statusLabel}\n severity={severity}\n />\n </NavItemContentContainer>\n ) : (\n <NavItemLinkContainer\n odysseyDesignTokens={odysseyDesignTokens}\n contextValue={contextValue}\n isDisabled={isDisabled}\n isSelected={isSelected}\n href={href}\n target={target}\n onClick={onClick}\n >\n <SideNavItemLinkContent\n count={count}\n label={label}\n startIcon={startIcon}\n endIcon={endIcon}\n statusLabel={statusLabel}\n severity={severity}\n />\n {target === \"_blank\" && (\n <span className=\"Link-indicator\" role=\"presentation\">\n <ExternalLinkIcon />\n </span>\n )}\n </NavItemLinkContainer>\n )\n }\n </StyledSideNavListItem>\n );\n};\nconst MemoizedSideNavItemContent = memo(SideNavItemContent);\nMemoizedSideNavItemContent.displayName = \"SideNavItemContent\";\n\nexport { MemoizedSideNavItemContent as SideNavItemContent };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,SACEC,MAAM,EACNC,mBAAmB,EACnBC,WAAW,EACXC,IAAI,EAEJC,OAAO,QACF,OAAO;AAAC,SAIbC,sBAAsB;AAAA,SAEfC,sBAAsB;AAAA,SAI7BC,qBAAqB;AAAA,SAEdC,gBAAgB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEzB,OAA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BAAsB;QACrB0D,KAAK,EAAEA,KAAM;QACbE,KAAK,EAAEA,KAAM;QACbG,SAAS,EAAEA,SAAU;QACrBG,OAAO,EAAEA,OAAQ;QACjBD,WAAW,EAAEA,WAAY;QACzBD,QAAQ,EAAEA;MAAS,CACpB,CAAC,EACDF,MAAM,KAAK,QAAQ,IAClB1D,IAAA;QAAM8E,SAAS,EAAC,gBAAgB;QAACC,IAAI,EAAC,cAAc;QAAAJ,QAAA,EAClD3E,IAAA,CAACF,gBAAgB,IAAE;MAAC,CAChB,CACP;IAAA,CACmB;EACvB,GAnEEyD,EAqEgB,CAAC;AAE5B,CAAC;AACD,MAAMyB,0BAA0B,GAAGvF,IAAI,CAAC4D,kBAAkB,CAAC;AAC3D2B,0BAA0B,CAACC,WAAW,GAAG,oBAAoB;AAE7D,SAASD,0BAA0B,IAAI3B,kBAAkB"}
1
+ {"version":3,"file":"SideNavItemContent.js","names":["styled","useRef","useImperativeHandle","useCallback","memo","useMemo","useOdysseyDesignTokens","SideNavItemLinkContent","useSideNavItemContent","ExternalLinkIcon","jsx","_jsx","jsxs","_jsxs","StyledSideNavListItem","shouldForwardProp","prop","odysseyDesignTokens","isSelected","display","alignItems","backgroundColor","borderRadius","BorderRadiusMain","transition","TransitionDurationMain","color","TypographyColorAction","HueBlue50","scrollToNode","node","scrollIntoView","behavior","block","inline","getBaseNavItemContentStyles","isDisabled","width","textDecoration","TypographyColorHeading","minHeight","paddingBlock","Spacing3","paddingInlineEnd","Spacing4","cursor","HueNeutral50","fontWeight","TypographyWeightBodyBold","TypographyColorDisabled","outline","boxShadow","PalettePrimaryMain","getNavItemContentStyles","contextValue","paddingInlineStart","depth","Spacing6","isCompact","Spacing1","NavItemContentContainer","StyledNavItemLink","_Link","SideNavItemContent","count","id","label","href","target","startIcon","severity","statusLabel","endIcon","onClick","scrollRef","onItemSelected","sidenavItemContentContext","localScrollRef","current","itemClickHandler","sideNavItemContentKeyHandler","event","key","preventDefault","ref","disabled","undefined","children","tabIndex","role","onKeyDown","className","MemoizedSideNavItemContent","displayName"],"sources":["../../../src/labs/SideNav/SideNavItemContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport styled from \"@emotion/styled\";\nimport {\n useRef,\n useImperativeHandle,\n useCallback,\n memo,\n KeyboardEvent,\n useMemo,\n} from \"react\";\nimport { Link as NavItemLink } from \"@mui/material\";\nimport {\n type DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext\";\nimport { SideNavItemLinkContent } from \"./SideNavItemLinkContent\";\nimport type { SideNavItem } from \"./types\";\nimport {\n SideNavItemContentContextValue,\n useSideNavItemContent,\n} from \"./SideNavItemContentContext\";\nimport { ExternalLinkIcon } from \"../../icons.generated\";\n\nexport const StyledSideNavListItem = styled(\"li\", {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" && prop !== \"isSelected\",\n})<{\n odysseyDesignTokens: DesignTokens;\n isSelected?: boolean;\n disabled?: boolean;\n}>(({ odysseyDesignTokens, isSelected }) => ({\n display: \"flex\",\n alignItems: \"center\",\n backgroundColor: \"unset\",\n borderRadius: odysseyDesignTokens.BorderRadiusMain,\n transition: `backgroundColor ${odysseyDesignTokens.TransitionDurationMain}, color ${odysseyDesignTokens.TransitionDurationMain}`,\n\n ...(isSelected && {\n color: `${odysseyDesignTokens.TypographyColorAction} !important`,\n backgroundColor: odysseyDesignTokens.HueBlue50,\n }),\n}));\n\nconst scrollToNode = (node: HTMLElement | null) => {\n if (node) {\n node?.scrollIntoView({\n behavior: \"instant\",\n block: \"center\",\n inline: \"nearest\",\n });\n }\n};\n\ntype ScrollIntoViewHandle = {\n scrollIntoView: () => void;\n};\n\nexport const getBaseNavItemContentStyles = ({\n odysseyDesignTokens,\n isDisabled,\n isSelected,\n}: {\n odysseyDesignTokens: DesignTokens;\n isDisabled?: boolean;\n isSelected?: boolean;\n}) => ({\n display: \"flex\",\n alignItems: \"center\",\n width: \"100%\",\n textDecoration: \"none\",\n color: `${odysseyDesignTokens.TypographyColorHeading} !important`,\n minHeight: \"unset\",\n paddingBlock: odysseyDesignTokens.Spacing3,\n paddingInlineEnd: odysseyDesignTokens.Spacing4,\n borderRadius: odysseyDesignTokens.BorderRadiusMain,\n transition: `backgroundColor ${odysseyDesignTokens.TransitionDurationMain}, color ${odysseyDesignTokens.TransitionDurationMain}`,\n cursor: \"pointer\",\n\n // `[data-sortable-container='true']:has(button:hover) &` - when the sortable item's drag handle is hovered we want to trigger the same hover behavior as if you were hovering the actual item\n \"&:hover, [data-sortable-container='true']:has(button:hover, button:focus, button:focus-visible) &\":\n {\n textDecoration: \"none\",\n backgroundColor: odysseyDesignTokens.HueNeutral50,\n\n ...(isSelected && {\n backgroundColor: odysseyDesignTokens.HueBlue50,\n color: odysseyDesignTokens.TypographyColorAction,\n }),\n\n ...(isDisabled && {\n backgroundColor: \"unset\",\n }),\n },\n\n ...(isSelected && {\n color: `${odysseyDesignTokens.TypographyColorAction}`,\n fontWeight: odysseyDesignTokens.TypographyWeightBodyBold,\n }),\n\n ...(isDisabled && {\n cursor: \"default\",\n color: `${odysseyDesignTokens.TypographyColorDisabled} !important`,\n }),\n\n \"&:focus-visible, &:focus\": {\n outline: \"none\",\n boxShadow: `inset 0 0 0 2px ${odysseyDesignTokens.PalettePrimaryMain}`,\n },\n});\n\nexport const getNavItemContentStyles = ({\n odysseyDesignTokens,\n contextValue,\n}: {\n odysseyDesignTokens: DesignTokens;\n contextValue: SideNavItemContentContextValue;\n}) => ({\n paddingInlineStart: `calc(${odysseyDesignTokens.Spacing4} * ${contextValue.depth} + ${odysseyDesignTokens.Spacing6})`,\n\n ...(contextValue.depth === 1 && {\n paddingInlineStart: odysseyDesignTokens.Spacing4,\n }),\n\n ...(contextValue.isCompact && {\n paddingBlock: odysseyDesignTokens.Spacing1,\n }),\n});\n\nconst NavItemContentContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" &&\n prop != \"contextValue\" &&\n prop !== \"isDisabled\" &&\n prop !== \"isSelected\",\n})<{\n contextValue: SideNavItemContentContextValue;\n odysseyDesignTokens: DesignTokens;\n isSelected?: boolean;\n isDisabled?: boolean;\n}>(({ contextValue, odysseyDesignTokens, isDisabled, isSelected }) => ({\n ...getBaseNavItemContentStyles({\n odysseyDesignTokens,\n isDisabled,\n isSelected,\n }),\n\n ...getNavItemContentStyles({\n odysseyDesignTokens,\n contextValue,\n }),\n}));\n\nconst StyledNavItemLink = styled(NavItemLink, {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" &&\n prop != \"contextValue\" &&\n prop !== \"isDisabled\" &&\n prop !== \"isSelected\",\n})<{\n contextValue: SideNavItemContentContextValue;\n odysseyDesignTokens: DesignTokens;\n isSelected?: boolean;\n isDisabled?: boolean;\n}>(({ contextValue, odysseyDesignTokens, isDisabled, isSelected }) => ({\n ...getBaseNavItemContentStyles({\n odysseyDesignTokens,\n isDisabled,\n isSelected,\n }),\n\n ...getNavItemContentStyles({\n odysseyDesignTokens,\n contextValue,\n }),\n}));\n\nconst SideNavItemContent = ({\n count,\n id,\n label,\n href,\n target,\n startIcon,\n severity,\n statusLabel,\n endIcon,\n onClick,\n isDisabled,\n isSelected,\n scrollRef,\n onItemSelected,\n}: Pick<\n SideNavItem,\n | \"count\"\n | \"id\"\n | \"label\"\n | \"href\"\n | \"target\"\n | \"startIcon\"\n | \"severity\"\n | \"statusLabel\"\n | \"endIcon\"\n | \"onClick\"\n | \"isDisabled\"\n | \"isSelected\"\n> & {\n /**\n * The ref used to scroll to this item\n */\n scrollRef?: React.RefObject<ScrollIntoViewHandle>;\n onItemSelected?(selectedItemId: string): void;\n}) => {\n const sidenavItemContentContext = useSideNavItemContent();\n const contextValue = useMemo(\n () => sidenavItemContentContext,\n [sidenavItemContentContext],\n );\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const localScrollRef = useRef<HTMLLIElement>(null);\n useImperativeHandle(\n scrollRef,\n () => {\n return {\n scrollIntoView: () => {\n scrollToNode(localScrollRef.current);\n },\n };\n },\n [],\n );\n\n const itemClickHandler = useCallback(\n (id: string) => {\n return () => {\n onItemSelected?.(id);\n onClick?.();\n };\n },\n [onClick, onItemSelected],\n );\n\n const sideNavItemContentKeyHandler = useCallback(\n (id: string, event: KeyboardEvent<HTMLDivElement>) => {\n if (event?.key === \"Enter\") {\n event.preventDefault();\n onItemSelected?.(id);\n onClick?.();\n }\n },\n [onClick, onItemSelected],\n );\n\n return (\n <StyledSideNavListItem\n ref={localScrollRef}\n id={id}\n key={id}\n isSelected={isSelected}\n disabled={isDisabled}\n aria-disabled={isDisabled}\n aria-current={isSelected ? \"page\" : undefined}\n odysseyDesignTokens={odysseyDesignTokens}\n >\n {\n // Use Link for nav items with links and div for disabled or non-link items\n isDisabled ? (\n <NavItemContentContainer\n odysseyDesignTokens={odysseyDesignTokens}\n contextValue={contextValue}\n isDisabled={isDisabled}\n isSelected={isSelected}\n >\n <SideNavItemLinkContent\n count={count}\n label={label}\n startIcon={startIcon}\n endIcon={endIcon}\n statusLabel={statusLabel}\n severity={severity}\n />\n </NavItemContentContainer>\n ) : !href ? (\n <NavItemContentContainer\n odysseyDesignTokens={odysseyDesignTokens}\n contextValue={contextValue}\n isDisabled={isDisabled}\n tabIndex={0}\n role=\"button\"\n onClick={itemClickHandler(id)}\n onKeyDown={(event: KeyboardEvent<HTMLDivElement>) =>\n sideNavItemContentKeyHandler(id, event)\n }\n isSelected={isSelected}\n >\n <SideNavItemLinkContent\n count={count}\n label={label}\n startIcon={startIcon}\n endIcon={endIcon}\n statusLabel={statusLabel}\n severity={severity}\n />\n </NavItemContentContainer>\n ) : (\n <StyledNavItemLink\n odysseyDesignTokens={odysseyDesignTokens}\n contextValue={contextValue}\n isDisabled={isDisabled}\n isSelected={isSelected}\n href={href}\n target={target}\n onClick={itemClickHandler(id)}\n >\n <SideNavItemLinkContent\n count={count}\n label={label}\n startIcon={startIcon}\n endIcon={endIcon}\n statusLabel={statusLabel}\n severity={severity}\n />\n {target === \"_blank\" && (\n <span className=\"Link-indicator\" role=\"presentation\">\n <ExternalLinkIcon />\n </span>\n )}\n </StyledNavItemLink>\n )\n }\n </StyledSideNavListItem>\n );\n};\n\nconst MemoizedSideNavItemContent = memo(SideNavItemContent);\nMemoizedSideNavItemContent.displayName = \"SideNavItemContent\";\n\nexport { MemoizedSideNavItemContent as SideNavItemContent };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,SACEC,MAAM,EACNC,mBAAmB,EACnBC,WAAW,EACXC,IAAI,EAEJC,OAAO,QACF,OAAO;AAAC,SAIbC,sBAAsB;AAAA,SAEfC,sBAAsB;AAAA,SAI7BC,qBAAqB;AAAA,SAEdC,gBAAgB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEzB,OAAO,MAAMC,qBAAqB,GAAGd,MAAM,CAAC,IAAI,EAAE;EAChDe,iBAAiB,EAAGC,IAAI,IACtBA,IAAI,KAAK,qBAAqB,IAAIA,IAAI,KAAK;AAC/C,CAAC,CAAC,CAIC,CAAC;EAAEC,mBAAmB;EAAEC;AAAW,CAAC,MAAM;EAC3CC,OAAO,EAAE,MAAM;EACfC,UAAU,EAAE,QAAQ;EACpBC,eAAe,EAAE,OAAO;EACxBC,YAAY,EAAEL,mBAAmB,CAACM,gBAAgB;EAClDC,UAAU,EAAG,mBAAkBP,mBAAmB,CAACQ,sBAA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E,CAAE;MAC9ByB,SAAS,EAAGT,KAAoC,IAC9CD,4BAA4B,CAACf,EAAE,EAAEgB,KAAK,CACvC;MACD/D,UAAU,EAAEA,UAAW;MAAAqE,QAAA,EAEvB5E,IAAA,CAACJ,sBAAsB;QACrByD,KAAK,EAAEA,KAAM;QACbE,KAAK,EAAEA,KAAM;QACbG,SAAS,EAAEA,SAAU;QACrBG,OAAO,EAAEA,OAAQ;QACjBD,WAAW,EAAEA,WAAY;QACzBD,QAAQ,EAAEA;MAAS,CACpB;IAAC,CACqB,CAAC,GAE1BzD,KAAA,CAACgD,iBAAiB;MAChB5C,mBAAmB,EAAEA,mBAAoB;MACzCqC,YAAY,EAAEA,YAAa;MAC3BlB,UAAU,EAAEA,UAAW;MACvBlB,UAAU,EAAEA,UAAW;MACvBiD,IAAI,EAAEA,IAAK;MACXC,MAAM,EAAEA,MAAO;MACfK,OAAO,EAAEM,gBAAgB,CAACd,EAAE,CAAE;MAAAsB,QAAA,GAE9B5E,IAAA,CAACJ,sBAAsB;QACrByD,KAAK,EAAEA,KAAM;QACbE,KAAK,EAAEA,KAAM;QACbG,SAAS,EAAEA,SAAU;QACrBG,OAAO,EAAEA,OAAQ;QACjBD,WAAW,EAAEA,WAAY;QACzBD,QAAQ,EAAEA;MAAS,CACpB,CAAC,EACDF,MAAM,KAAK,QAAQ,IAClBzD,IAAA;QAAMgF,SAAS,EAAC,gBAAgB;QAACF,IAAI,EAAC,cAAc;QAAAF,QAAA,EAClD5E,IAAA,CAACF,gBAAgB,IAAE;MAAC,CAChB,CACP;IAAA,CACgB;EACpB,GAvEEwD,EAyEgB,CAAC;AAE5B,CAAC;AAED,MAAM2B,0BAA0B,GAAGxF,IAAI,CAAC2D,kBAAkB,CAAC;AAC3D6B,0BAA0B,CAACC,WAAW,GAAG,oBAAoB;AAE7D,SAASD,0BAA0B,IAAI7B,kBAAkB"}
@@ -13,6 +13,7 @@
13
13
  import { createContext, useContext } from "react";
14
14
  export const SideNavItemContentContext = createContext({
15
15
  isCompact: false,
16
+ isSortable: false,
16
17
  depth: 1
17
18
  });
18
19
  export const useSideNavItemContent = () => useContext(SideNavItemContentContext);
@@ -1 +1 @@
1
- {"version":3,"file":"SideNavItemContentContext.js","names":["createContext","useContext","SideNavItemContentContext","isCompact","depth","useSideNavItemContent"],"sources":["../../../src/labs/SideNav/SideNavItemContentContext.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { createContext, useContext } from \"react\";\n\nexport type SideNavItemContentContextValue = {\n isCompact?: boolean;\n depth: number;\n};\n\nexport const SideNavItemContentContext =\n createContext<SideNavItemContentContextValue>({\n isCompact: false,\n depth: 1,\n });\n\nexport const useSideNavItemContent = () =>\n useContext(SideNavItemContentContext);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAOjD,OAAO,MAAMC,yBAAyB,GACpCF,aAAa,CAAiC;EAC5CG,SAAS,EAAE,KAAK;EAChBC,KAAK,EAAE;AACT,CAAC,CAAC;AAEJ,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KACnCJ,UAAU,CAACC,yBAAyB,CAAC"}
1
+ {"version":3,"file":"SideNavItemContentContext.js","names":["createContext","useContext","SideNavItemContentContext","isCompact","isSortable","depth","useSideNavItemContent"],"sources":["../../../src/labs/SideNav/SideNavItemContentContext.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { createContext, useContext } from \"react\";\n\nexport type SideNavItemContentContextValue = {\n isCompact?: boolean;\n isSortable?: boolean;\n depth: number;\n};\n\nexport const SideNavItemContentContext =\n createContext<SideNavItemContentContextValue>({\n isCompact: false,\n isSortable: false,\n depth: 1,\n });\n\nexport const useSideNavItemContent = () =>\n useContext(SideNavItemContentContext);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAQjD,OAAO,MAAMC,yBAAyB,GACpCF,aAAa,CAAiC;EAC5CG,SAAS,EAAE,KAAK;EAChBC,UAAU,EAAE,KAAK;EACjBC,KAAK,EAAE;AACT,CAAC,CAAC;AAEJ,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KACnCL,UAAU,CAACC,yBAAyB,CAAC"}
@@ -29,8 +29,8 @@ const SideNavItemLabelContainer = styled("div", {
29
29
  display: "flex",
30
30
  flexWrap: "wrap",
31
31
  alignItems: "center",
32
- fontSize: odysseyDesignTokens.TypographyScale0,
33
- marginInlineStart: isIconVisible ? odysseyDesignTokens.Spacing2 : 0
32
+ fontSize: odysseyDesignTokens.TypographySizeBody,
33
+ marginInlineStart: isIconVisible ? odysseyDesignTokens.Spacing3 : 0
34
34
  }));
35
35
  const SideNavItemLinkContent = ({
36
36
  count,
@@ -1 +1 @@
1
- {"version":3,"file":"SideNavItemLinkContent.js","names":["styled","memo","useMemo","useOdysseyDesignTokens","Box","Status","Badge","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","SideNavItemLabelContainer","shouldForwardProp","prop","odysseyDesignTokens","isIconVisible","width","display","flexWrap","alignItems","fontSize","TypographyScale0","marginInlineStart","Spacing2","SideNavItemLinkContent","count","label","startIcon","endIcon","severity","statusLabel","sideNavItemContentStyles","gap","Spacing1","children","Boolean","sx","badgeContent","MemoizedSideNavItemLinkContent","displayName"],"sources":["../../../src/labs/SideNav/SideNavItemLinkContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport styled from \"@emotion/styled\";\nimport { memo, ReactNode, useMemo } from \"react\";\nimport {\n type DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext\";\nimport { Box } from \"../../Box\";\nimport { Status } from \"../../Status\";\nimport type { SideNavItem } from \"./types\";\nimport { Badge } from \"../../Badge\";\n\nconst SideNavItemLabelContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" && prop !== \"isIconVisible\",\n})<{\n odysseyDesignTokens: DesignTokens;\n isIconVisible: boolean;\n}>(({ odysseyDesignTokens, isIconVisible }) => ({\n width: \"100%\",\n display: \"flex\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n fontSize: odysseyDesignTokens.TypographyScale0,\n marginInlineStart: isIconVisible ? odysseyDesignTokens.Spacing2 : 0,\n}));\n\nconst SideNavItemLinkContent = ({\n count,\n label,\n startIcon,\n endIcon,\n severity,\n statusLabel,\n}: Pick<\n SideNavItem,\n \"count\" | \"label\" | \"startIcon\" | \"endIcon\" | \"severity\" | \"statusLabel\"\n>): ReactNode => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const sideNavItemContentStyles = useMemo(\n () => ({\n alignItems: \"center\",\n display: \"flex\",\n gap: odysseyDesignTokens.Spacing1,\n marginInlineStart: odysseyDesignTokens.Spacing2,\n }),\n [odysseyDesignTokens],\n );\n\n return (\n <>\n {startIcon && startIcon}\n <SideNavItemLabelContainer\n odysseyDesignTokens={odysseyDesignTokens}\n isIconVisible={Boolean(startIcon)}\n >\n {label}\n {!count && severity && (\n <Box sx={sideNavItemContentStyles}>\n {severity && (\n <Status severity={severity} label={statusLabel || \"\"} />\n )}\n </Box>\n )}\n {!severity && count && (\n <Box sx={sideNavItemContentStyles}>\n {count && <Badge badgeContent={count} />}\n </Box>\n )}\n </SideNavItemLabelContainer>\n {endIcon && endIcon}\n </>\n );\n};\nconst MemoizedSideNavItemLinkContent = memo(SideNavItemLinkContent);\nMemoizedSideNavItemLinkContent.displayName = \"SideNavItemLinkContent\";\n\nexport { MemoizedSideNavItemLinkContent as SideNavItemLinkContent };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,SAASC,IAAI,EAAaC,OAAO,QAAQ,OAAO;AAAC,SAG/CC,sBAAsB;AAAA,SAEfC,GAAG;AAAA,SACHC,MAAM;AAAA,SAENC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAEd,MAAMC,yBAAyB,GAAGb,MAAM,CAAC,KAAK,EAAE;EAC9Cc,iBAAiB,EAAGC,IAAI,IACtBA,IAAI,KAAK,qBAAqB,IAAIA,IAAI,KAAK;AAC/C,CAAC,CAAC,CAGC,CAAC;EAAEC,mBAAmB;EAAEC;AAAc,CAAC,MAAM;EAC9CC,KAAK,EAAE,MAAM;EACbC,OAAO,EAAE,MAAM;EACfC,QAAQ,EAAE,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,OAAO;EAAA,CACnB,CAAC;AAEP,CAAC;AACD,MAAMU,8BAA8B,GAAGvC,IAAI,CAACyB,sBAAsB,CAAC;AACnEc,8BAA8B,CAACC,WAAW,GAAG,wBAAwB;AAErE,SAASD,8BAA8B,IAAId,sBAAsB"}
1
+ {"version":3,"file":"SideNavItemLinkContent.js","names":["styled","memo","useMemo","useOdysseyDesignTokens","Box","Status","Badge","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","SideNavItemLabelContainer","shouldForwardProp","prop","odysseyDesignTokens","isIconVisible","width","display","flexWrap","alignItems","fontSize","TypographySizeBody","marginInlineStart","Spacing3","SideNavItemLinkContent","count","label","startIcon","endIcon","severity","statusLabel","sideNavItemContentStyles","gap","Spacing1","Spacing2","children","Boolean","sx","badgeContent","MemoizedSideNavItemLinkContent","displayName"],"sources":["../../../src/labs/SideNav/SideNavItemLinkContent.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport styled from \"@emotion/styled\";\nimport { memo, ReactNode, useMemo } from \"react\";\nimport {\n type DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext\";\nimport { Box } from \"../../Box\";\nimport { Status } from \"../../Status\";\nimport type { SideNavItem } from \"./types\";\nimport { Badge } from \"../../Badge\";\n\nconst SideNavItemLabelContainer = styled(\"div\", {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" && prop !== \"isIconVisible\",\n})<{\n odysseyDesignTokens: DesignTokens;\n isIconVisible: boolean;\n}>(({ odysseyDesignTokens, isIconVisible }) => ({\n width: \"100%\",\n display: \"flex\",\n flexWrap: \"wrap\",\n alignItems: \"center\",\n fontSize: odysseyDesignTokens.TypographySizeBody,\n marginInlineStart: isIconVisible ? odysseyDesignTokens.Spacing3 : 0,\n}));\n\nconst SideNavItemLinkContent = ({\n count,\n label,\n startIcon,\n endIcon,\n severity,\n statusLabel,\n}: Pick<\n SideNavItem,\n \"count\" | \"label\" | \"startIcon\" | \"endIcon\" | \"severity\" | \"statusLabel\"\n>): ReactNode => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n const sideNavItemContentStyles = useMemo(\n () => ({\n alignItems: \"center\",\n display: \"flex\",\n gap: odysseyDesignTokens.Spacing1,\n marginInlineStart: odysseyDesignTokens.Spacing2,\n }),\n [odysseyDesignTokens],\n );\n\n return (\n <>\n {startIcon && startIcon}\n <SideNavItemLabelContainer\n odysseyDesignTokens={odysseyDesignTokens}\n isIconVisible={Boolean(startIcon)}\n >\n {label}\n {!count && severity && (\n <Box sx={sideNavItemContentStyles}>\n {severity && (\n <Status severity={severity} label={statusLabel || \"\"} />\n )}\n </Box>\n )}\n {!severity && count && (\n <Box sx={sideNavItemContentStyles}>\n {count && <Badge badgeContent={count} />}\n </Box>\n )}\n </SideNavItemLabelContainer>\n {endIcon && endIcon}\n </>\n );\n};\nconst MemoizedSideNavItemLinkContent = memo(SideNavItemLinkContent);\nMemoizedSideNavItemLinkContent.displayName = \"SideNavItemLinkContent\";\n\nexport { MemoizedSideNavItemLinkContent as SideNavItemLinkContent };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,SAASC,IAAI,EAAaC,OAAO,QAAQ,OAAO;AAAC,SAG/CC,sBAAsB;AAAA,SAEfC,GAAG;AAAA,SACHC,MAAM;AAAA,SAENC,KAAK;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;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AQ,EAAEA,QAAS;UAACH,KAAK,EAAEI,WAAW,IAAI;QAAG,CAAE;MACxD,CACE,CACN,EACA,CAACD,QAAQ,IAAIJ,KAAK,IACjBnB,IAAA,CAACJ,GAAG;QAACmC,EAAE,EAAEN,wBAAyB;QAAAI,QAAA,EAC/BV,KAAK,IAAInB,IAAA,CAACF,KAAK;UAACkC,YAAY,EAAEb;QAAM,CAAE;MAAC,CACrC,CACN;IAAA,CACwB,CAAC,EAC3BG,OAAO,IAAIA,OAAO;EAAA,CACnB,CAAC;AAEP,CAAC;AACD,MAAMW,8BAA8B,GAAGxC,IAAI,CAACyB,sBAAsB,CAAC;AACnEe,8BAA8B,CAACC,WAAW,GAAG,wBAAwB;AAErE,SAASD,8BAA8B,IAAIf,sBAAsB"}
@@ -37,7 +37,7 @@ const StyledToggleButton = styled(_Button, {
37
37
  "&:hover, &:focus": {
38
38
  backgroundColor: "transparent",
39
39
  "#lineOne": {
40
- animation: "lineOne-animate-to-collapse 250ms cubic-bezier(0, 0, 0.2, 1)",
40
+ animation: `lineOne-animate-to-collapse ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,
41
41
  animationFillMode: "forwards",
42
42
  "@keyframes lineOne-animate-to-collapse": {
43
43
  "0%": {
@@ -52,7 +52,7 @@ const StyledToggleButton = styled(_Button, {
52
52
  }
53
53
  },
54
54
  "#lineTwo": {
55
- animation: "lineTwo-animate-to-collapse 250ms cubic-bezier(0, 0, 0.2, 1)",
55
+ animation: `lineTwo-animate-to-collapse ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,
56
56
  animationFillMode: "forwards",
57
57
  "@keyframes lineTwo-animate-to-collapse": {
58
58
  "0%": {
@@ -68,7 +68,7 @@ const StyledToggleButton = styled(_Button, {
68
68
  },
69
69
  ...(isSideNavCollapsed && {
70
70
  "#lineOne": {
71
- animation: "lineOne-animate-to-expand 250ms cubic-bezier(0, 0, 0.2, 1)",
71
+ animation: `lineOne-animate-to-expand ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,
72
72
  animationFillMode: "forwards",
73
73
  "@keyframes lineOne-animate-to-expand": {
74
74
  "0%": {
@@ -83,7 +83,7 @@ const StyledToggleButton = styled(_Button, {
83
83
  }
84
84
  },
85
85
  "#lineTwo": {
86
- animation: "lineTwo-animate-to-expand 250ms cubic-bezier(0, 0, 0.2, 1)",
86
+ animation: `lineTwo-animate-to-expand ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,
87
87
  animationFillMode: "forwards",
88
88
  "@keyframes lineTwo-animate-to-expand": {
89
89
  "0%": {
@@ -105,7 +105,7 @@ const StyledToggleButton = styled(_Button, {
105
105
  left: "50%",
106
106
  width: "2px",
107
107
  height: odysseyDesignTokens.Spacing4,
108
- backgroundColor: odysseyDesignTokens.HueNeutral500,
108
+ backgroundColor: odysseyDesignTokens.HueNeutral600,
109
109
  transform: "translate3d(-50%, -50%, 0)",
110
110
  transition: `transform ${odysseyDesignTokens.TransitionDurationMain}`
111
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SideNavToggleButton.js","names":["memo","useCallback","useImperativeHandle","useMemo","useRef","styled","useTranslation","MuiPropsContext","useOdysseyDesignTokens","Tooltip","jsx","_jsx","jsxs","_jsxs","StyledToggleButton","_Button","shouldForwardProp","prop","isSideNavCollapsed","odysseyDesignTokens","backgroundColor","position","width","Spacing6","height","border","zIndex","boxShadow","PalettePrimaryMain","outline","animation","animationFillMode","transform","span","top","left","Spacing4","HueNeutral500","transition","TransitionDurationMain","SideNavToggleButton","ariaControls","buttonRef","id","onClick","tabIndex","t","localButtonRef","focus","current","toggleLabel","renderButton","muiProps","ref","element","variant","children","ariaType","placement","text","Consumer","MemoizedSideNavToggleButton","displayName"],"sources":["../../../src/labs/SideNav/SideNavToggleButton.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 { Button as MuiButton } from \"@mui/material\";\nimport type { ButtonProps as MuiButtonProps } from \"@mui/material\";\nimport {\n HTMLAttributes,\n memo,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\nimport styled from \"@emotion/styled\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { FocusHandle } from \"../../inputUtils\";\nimport { MuiPropsContext, MuiPropsContextType } from \"../../MuiPropsContext\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext\";\nimport { Tooltip } from \"../../Tooltip\";\n\nconst StyledToggleButton = styled(MuiButton, {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" && prop !== \"isSideNavCollapsed\",\n})(\n ({\n isSideNavCollapsed,\n odysseyDesignTokens,\n }: {\n isSideNavCollapsed: boolean;\n odysseyDesignTokens: DesignTokens;\n }) => ({\n backgroundColor: \"transparent\",\n position: \"relative\",\n width: odysseyDesignTokens.Spacing6,\n height: odysseyDesignTokens.Spacing6,\n border: 0,\n zIndex: 2,\n\n \"&:focus-visible\": {\n boxShadow: `inset 0 0 0 2px ${odysseyDesignTokens.PalettePrimaryMain}`,\n outline: \"none\",\n },\n\n \"&:hover, &:focus\": {\n backgroundColor: \"transparent\",\n\n \"#lineOne\": {\n animation:\n \"lineOne-animate-to-collapse 250ms cubic-bezier(0, 0, 0.2, 1)\",\n animationFillMode: \"forwards\",\n \"@keyframes lineOne-animate-to-collapse\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(-90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -27%, 0) rotate(-45deg) scaleY(.75)\",\n },\n },\n },\n\n \"#lineTwo\": {\n animation:\n \"lineTwo-animate-to-collapse 250ms cubic-bezier(0, 0, 0.2, 1)\",\n animationFillMode: \"forwards\",\n \"@keyframes lineTwo-animate-to-collapse\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(-90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -73%, 0) rotate(-135deg) scaleY(.75)\",\n },\n },\n },\n\n ...(isSideNavCollapsed && {\n \"#lineOne\": {\n animation:\n \"lineOne-animate-to-expand 250ms cubic-bezier(0, 0, 0.2, 1)\",\n animationFillMode: \"forwards\",\n \"@keyframes lineOne-animate-to-expand\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform:\n \"translate3d(-50%, -73%, 0) rotate(135deg) scaleY(.75)\",\n },\n },\n },\n\n \"#lineTwo\": {\n animation:\n \"lineTwo-animate-to-expand 250ms cubic-bezier(0, 0, 0.2, 1)\",\n animationFillMode: \"forwards\",\n \"@keyframes lineTwo-animate-to-expand\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -27%, 0) rotate(45deg) scaleY(.75)\",\n },\n },\n },\n }),\n },\n\n span: {\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n width: \"2px\",\n height: odysseyDesignTokens.Spacing4,\n backgroundColor: odysseyDesignTokens.HueNeutral500,\n transform: \"translate3d(-50%, -50%, 0)\",\n transition: `transform ${odysseyDesignTokens.TransitionDurationMain}`,\n },\n }),\n);\n\nexport type SideNavToggleButtonProps = {\n /**\n * The ref forwarded to the Button\n */\n buttonRef?: React.RefObject<FocusHandle>;\n /**\n * The `id` of the item this button controls\n */\n ariaControls: string;\n /**\n * The ID of the Button\n */\n id?: string;\n isSideNavCollapsed: boolean;\n tabIndex?: HTMLAttributes<HTMLElement>[\"tabIndex\"];\n /**\n * The click event handler for the Button\n */\n onClick?: MuiButtonProps[\"onClick\"];\n onKeyDown?: MuiButtonProps[\"onKeyDown\"];\n};\n\nconst SideNavToggleButton = ({\n ariaControls,\n buttonRef,\n id,\n isSideNavCollapsed,\n onClick,\n tabIndex,\n}: SideNavToggleButtonProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n\n const localButtonRef = useRef<HTMLButtonElement | HTMLAnchorElement>(null);\n\n useImperativeHandle(\n buttonRef,\n () => ({\n focus: () => {\n localButtonRef.current?.focus();\n },\n }),\n [],\n );\n\n const toggleLabel = useMemo(\n () =>\n isSideNavCollapsed\n ? t(\"sidenav.toggle.expand\")\n : t(\"sidenav.toggle.collapse\"),\n [isSideNavCollapsed, t],\n );\n\n const renderButton = useCallback(\n (muiProps: MuiPropsContextType) => {\n return (\n <StyledToggleButton\n {...muiProps}\n aria-controls={ariaControls}\n aria-expanded={!isSideNavCollapsed}\n aria-label={toggleLabel}\n data-sidenav-toggle={true}\n id={id}\n isSideNavCollapsed={isSideNavCollapsed}\n odysseyDesignTokens={odysseyDesignTokens}\n onClick={onClick}\n ref={(element) => {\n if (element) {\n (\n localButtonRef as React.MutableRefObject<HTMLButtonElement>\n ).current = element;\n //@ts-expect-error ref is not an optional prop on the props context type\n muiProps?.ref?.(element);\n }\n }}\n tabIndex={tabIndex}\n variant=\"floating\"\n >\n <span id=\"lineOne\" />\n <span id=\"lineTwo\" />\n </StyledToggleButton>\n );\n },\n [\n ariaControls,\n id,\n isSideNavCollapsed,\n odysseyDesignTokens,\n onClick,\n tabIndex,\n toggleLabel,\n ],\n );\n\n return (\n <Tooltip ariaType=\"description\" placement=\"right\" text={toggleLabel}>\n <MuiPropsContext.Consumer>{renderButton}</MuiPropsContext.Consumer>\n </Tooltip>\n );\n};\n\nconst MemoizedSideNavToggleButton = memo(SideNavToggleButton);\nMemoizedSideNavToggleButton.displayName = \"SideNavToggleButton\";\n\nexport { MemoizedSideNavToggleButton as SideNavToggleButton };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAEEA,IAAI,EACJC,WAAW,EACXC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QACD,OAAO;AACd,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,cAAc,QAAQ,eAAe;AAAC,SAGtCC,eAAe;AAAA,SAGtBC,sBAAsB;AAAA,SAEfC,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEhB,MAAMC,kBAAkB,GAAGT,MAAM,CAAAU,OAAA,EAAY;EAC3CC,iBAAiB,EAAGC,IAAI,IACtBA,IAAI,KAAK,qBAAqB,IAAIA,IAAI,KAAK;AAC/C,CAAC,CAAC,CACA,CAAC;EACCC,kBAAkB;EAClBC;AAIF,CAAC,MAAM;EACLC,eAAe,EAAE,aAAa;EAC9BC,QAAQ,EAAE,UAAU;EACpBC,KAAK,EAAEH,mBAAmB,CAACI,QAAQ;EACnCC,MAAM,EAAEL,mBAAmB,CAACI,QAAQ;EACpCE,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE,CAAC;EAET,iBAAiB,EAAE;IACjBC,SAAS,EAAG,mBAAkBR,mBAAmB,CAACS,kBAAmB,EAAC;IACtEC,OAAO,EAAE;EACX,CAAC;EAED,kBAAkB,EAAE;IAClBT,eAAe,EAAE,aAAa;IAE9B,UAAU,EAAE;MACVU,SAAS,EACP,8DAA8D;MAChEC,iBAAiB,EAAE,UAAU;MAC7B,wCAAwC,EAAE;QACxC,IAAI,E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;MAAS,CAAE,CAAC;IAAA,CACH,CAAC;EAEzB,CAAC,EACD,CACEF,YAAY,EACZE,EAAE,EACFzB,kBAAkB,EAClBC,mBAAmB,EACnByB,OAAO,EACPC,QAAQ,EACRK,WAAW,CAEf,CAAC;EAED,OACEvC,IAAA,CAACF,OAAO;IAACgD,QAAQ,EAAC,aAAa;IAACC,SAAS,EAAC,OAAO;IAACC,IAAI,EAAET,WAAY;IAAAM,QAAA,EAClE7C,IAAA,CAACJ,eAAe,CAACqD,QAAQ;MAAAJ,QAAA,EAAEL;IAAY,CAA2B;EAAC,CAC5D,CAAC;AAEd,CAAC;AAED,MAAMU,2BAA2B,GAAG7D,IAAI,CAACwC,mBAAmB,CAAC;AAC7DqB,2BAA2B,CAACC,WAAW,GAAG,qBAAqB;AAE/D,SAASD,2BAA2B,IAAIrB,mBAAmB"}
1
+ {"version":3,"file":"SideNavToggleButton.js","names":["memo","useCallback","useImperativeHandle","useMemo","useRef","styled","useTranslation","MuiPropsContext","useOdysseyDesignTokens","Tooltip","jsx","_jsx","jsxs","_jsxs","StyledToggleButton","_Button","shouldForwardProp","prop","isSideNavCollapsed","odysseyDesignTokens","backgroundColor","position","width","Spacing6","height","border","zIndex","boxShadow","PalettePrimaryMain","outline","animation","TransitionDurationMain","animationFillMode","transform","span","top","left","Spacing4","HueNeutral600","transition","SideNavToggleButton","ariaControls","buttonRef","id","onClick","tabIndex","t","localButtonRef","focus","current","toggleLabel","renderButton","muiProps","ref","element","variant","children","ariaType","placement","text","Consumer","MemoizedSideNavToggleButton","displayName"],"sources":["../../../src/labs/SideNav/SideNavToggleButton.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 { Button as MuiButton } from \"@mui/material\";\nimport type { ButtonProps as MuiButtonProps } from \"@mui/material\";\nimport {\n HTMLAttributes,\n memo,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\nimport styled from \"@emotion/styled\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { FocusHandle } from \"../../inputUtils\";\nimport { MuiPropsContext, MuiPropsContextType } from \"../../MuiPropsContext\";\nimport {\n DesignTokens,\n useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext\";\nimport { Tooltip } from \"../../Tooltip\";\n\nconst StyledToggleButton = styled(MuiButton, {\n shouldForwardProp: (prop) =>\n prop !== \"odysseyDesignTokens\" && prop !== \"isSideNavCollapsed\",\n})(\n ({\n isSideNavCollapsed,\n odysseyDesignTokens,\n }: {\n isSideNavCollapsed: boolean;\n odysseyDesignTokens: DesignTokens;\n }) => ({\n backgroundColor: \"transparent\",\n position: \"relative\",\n width: odysseyDesignTokens.Spacing6,\n height: odysseyDesignTokens.Spacing6,\n border: 0,\n zIndex: 2,\n\n \"&:focus-visible\": {\n boxShadow: `inset 0 0 0 2px ${odysseyDesignTokens.PalettePrimaryMain}`,\n outline: \"none\",\n },\n\n \"&:hover, &:focus\": {\n backgroundColor: \"transparent\",\n\n \"#lineOne\": {\n animation: `lineOne-animate-to-collapse ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,\n animationFillMode: \"forwards\",\n \"@keyframes lineOne-animate-to-collapse\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(-90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -27%, 0) rotate(-45deg) scaleY(.75)\",\n },\n },\n },\n\n \"#lineTwo\": {\n animation: `lineTwo-animate-to-collapse ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,\n animationFillMode: \"forwards\",\n \"@keyframes lineTwo-animate-to-collapse\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(-90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -73%, 0) rotate(-135deg) scaleY(.75)\",\n },\n },\n },\n\n ...(isSideNavCollapsed && {\n \"#lineOne\": {\n animation: `lineOne-animate-to-expand ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,\n animationFillMode: \"forwards\",\n \"@keyframes lineOne-animate-to-expand\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform:\n \"translate3d(-50%, -73%, 0) rotate(135deg) scaleY(.75)\",\n },\n },\n },\n\n \"#lineTwo\": {\n animation: `lineTwo-animate-to-expand ${odysseyDesignTokens.TransitionDurationMain} cubic-bezier(0, 0, 0.2, 1)`,\n animationFillMode: \"forwards\",\n \"@keyframes lineTwo-animate-to-expand\": {\n \"0%\": {\n transform: \"translate3d(-50%, -50%, 0)\",\n },\n \"50%\": {\n transform: \"translate3d(-50%, -50%, 0) rotate(90deg) scaleY(.75)\",\n },\n \"100%\": {\n transform: \"translate3d(-50%, -27%, 0) rotate(45deg) scaleY(.75)\",\n },\n },\n },\n }),\n },\n\n span: {\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n width: \"2px\",\n height: odysseyDesignTokens.Spacing4,\n backgroundColor: odysseyDesignTokens.HueNeutral600,\n transform: \"translate3d(-50%, -50%, 0)\",\n transition: `transform ${odysseyDesignTokens.TransitionDurationMain}`,\n },\n }),\n);\n\nexport type SideNavToggleButtonProps = {\n /**\n * The ref forwarded to the Button\n */\n buttonRef?: React.RefObject<FocusHandle>;\n /**\n * The `id` of the item this button controls\n */\n ariaControls: string;\n /**\n * The ID of the Button\n */\n id?: string;\n isSideNavCollapsed: boolean;\n tabIndex?: HTMLAttributes<HTMLElement>[\"tabIndex\"];\n /**\n * The click event handler for the Button\n */\n onClick?: MuiButtonProps[\"onClick\"];\n onKeyDown?: MuiButtonProps[\"onKeyDown\"];\n};\n\nconst SideNavToggleButton = ({\n ariaControls,\n buttonRef,\n id,\n isSideNavCollapsed,\n onClick,\n tabIndex,\n}: SideNavToggleButtonProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n\n const localButtonRef = useRef<HTMLButtonElement | HTMLAnchorElement>(null);\n\n useImperativeHandle(\n buttonRef,\n () => ({\n focus: () => {\n localButtonRef.current?.focus();\n },\n }),\n [],\n );\n\n const toggleLabel = useMemo(\n () =>\n isSideNavCollapsed\n ? t(\"sidenav.toggle.expand\")\n : t(\"sidenav.toggle.collapse\"),\n [isSideNavCollapsed, t],\n );\n\n const renderButton = useCallback(\n (muiProps: MuiPropsContextType) => {\n return (\n <StyledToggleButton\n {...muiProps}\n aria-controls={ariaControls}\n aria-expanded={!isSideNavCollapsed}\n aria-label={toggleLabel}\n data-sidenav-toggle={true}\n id={id}\n isSideNavCollapsed={isSideNavCollapsed}\n odysseyDesignTokens={odysseyDesignTokens}\n onClick={onClick}\n ref={(element) => {\n if (element) {\n (\n localButtonRef as React.MutableRefObject<HTMLButtonElement>\n ).current = element;\n //@ts-expect-error ref is not an optional prop on the props context type\n muiProps?.ref?.(element);\n }\n }}\n tabIndex={tabIndex}\n variant=\"floating\"\n >\n <span id=\"lineOne\" />\n <span id=\"lineTwo\" />\n </StyledToggleButton>\n );\n },\n [\n ariaControls,\n id,\n isSideNavCollapsed,\n odysseyDesignTokens,\n onClick,\n tabIndex,\n toggleLabel,\n ],\n );\n\n return (\n <Tooltip ariaType=\"description\" placement=\"right\" text={toggleLabel}>\n <MuiPropsContext.Consumer>{renderButton}</MuiPropsContext.Consumer>\n </Tooltip>\n );\n};\n\nconst MemoizedSideNavToggleButton = memo(SideNavToggleButton);\nMemoizedSideNavToggleButton.displayName = \"SideNavToggleButton\";\n\nexport { MemoizedSideNavToggleButton as SideNavToggleButton };\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAEEA,IAAI,EACJC,WAAW,EACXC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QACD,OAAO;AACd,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAASC,cAAc,QAAQ,eAAe;AAAC,SAGtCC,eAAe;AAAA,SAGtBC,sBAAsB;AAAA,SAEfC,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEhB,MAAMC,kBAAkB,GAAGT,MAAM,CAAAU,OAAA,EAAY;EAC3CC,iBAAiB,EAAGC,IAAI,IACtBA,IAAI,KAAK,qBAAqB,IAAIA,IAAI,KAAK;AAC/C,CAAC,CAAC,CACA,CAAC;EACCC,kBAAkB;EAClBC;AAIF,CAAC,MAAM;EACLC,eAAe,EAAE,aAAa;EAC9BC,QAAQ,EAAE,UAAU;EACpBC,KAAK,EAAEH,mBAAmB,CAACI,QAAQ;EACnCC,MAAM,EAAEL,mBAAmB,CAACI,QAAQ;EACpCE,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE,CAAC;EAET,iBAAiB,EAAE;IACjBC,SAAS,EAAG,mBAAkBR,mBAAmB,CAACS,kBAAmB,EAAC;IACtEC,OAAO,EAAE;EACX,CAAC;EAED,kBAAkB,EAAE;IAClBT,eAAe,EAAE,aAAa;IAE9B,UAAU,EAAE;MACVU,SAAS,EAAG,+BAA8BX,mBAAmB,CAACY,sBAAuB,6BAA4B;MACjHC,iBAAiB,EAAE,UAAU;MAC7B,wCAAwC,EAAE;QACxC,IAAI,EAAE;UACJC,SAAS,EAAE;QACb,CAAC;QACD,KAAK,EAAE;UACL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,CAAE,CAAC,EACrBhC,IAAA;QAAMgC,EAAE,EAAC;MAAS,CAAE,CAAC;IAAA,CACH,CAAC;EAEzB,CAAC,EACD,CACEF,YAAY,EACZE,EAAE,EACFzB,kBAAkB,EAClBC,mBAAmB,EACnByB,OAAO,EACPC,QAAQ,EACRK,WAAW,CAEf,CAAC;EAED,OACEvC,IAAA,CAACF,OAAO;IAACgD,QAAQ,EAAC,aAAa;IAACC,SAAS,EAAC,OAAO;IAACC,IAAI,EAAET,WAAY;IAAAM,QAAA,EAClE7C,IAAA,CAACJ,eAAe,CAACqD,QAAQ;MAAAJ,QAAA,EAAEL;IAAY,CAA2B;EAAC,CAC5D,CAAC;AAEd,CAAC;AAED,MAAMU,2BAA2B,GAAG7D,IAAI,CAACwC,mBAAmB,CAAC;AAC7DqB,2BAA2B,CAACC,WAAW,GAAG,qBAAqB;AAE/D,SAASD,2BAA2B,IAAIrB,mBAAmB"}
@@ -0,0 +1,162 @@
1
+ /*!
2
+ * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import { createContext, useContext, useMemo } from "react";
14
+ import { useSortable } from "@dnd-kit/sortable";
15
+ import { CSS } from "@dnd-kit/utilities";
16
+ import styled from "@emotion/styled";
17
+ import { useOdysseyDesignTokens } from "../../../OdysseyDesignTokensContext.js";
18
+ import { useTranslation } from "react-i18next";
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
+ import { jsxs as _jsxs } from "react/jsx-runtime";
21
+ const SortableItemContext = createContext({
22
+ attributes: {},
23
+ listeners: undefined,
24
+ ref() {}
25
+ });
26
+ const StyledSortableListItem = styled("li", {
27
+ shouldForwardProp: prop => prop !== "odysseyDesignTokens" && prop !== "isSelected"
28
+ })(({
29
+ odysseyDesignTokens,
30
+ isSelected
31
+ }) => ({
32
+ position: "relative",
33
+ button: {
34
+ top: "50%",
35
+ left: odysseyDesignTokens.Spacing2,
36
+ transform: "translateY(-50%)"
37
+ },
38
+ svg: {
39
+ path: {
40
+ fill: "currentColor"
41
+ }
42
+ },
43
+ "&:has(a:hover, button:hover, a:focus, button:focus, a:focus-visible, button:focus-visible, [role='button']:hover, [role='button']:focus, [role='button']:focus-visible)": {
44
+ button: {
45
+ opacity: 1,
46
+ outlineWidth: 0
47
+ }
48
+ },
49
+ ...(isSelected && {
50
+ svg: {
51
+ path: {
52
+ fill: odysseyDesignTokens.TypographyColorAction
53
+ }
54
+ }
55
+ })
56
+ }));
57
+ const StyledUl = styled("ul")({
58
+ padding: 0,
59
+ listStyle: "none",
60
+ listStyleType: "none"
61
+ });
62
+ const StyledDragHandleButton = styled("button", {
63
+ shouldForwardProp: prop => prop !== "odysseyDesignTokens" && prop !== "isDragging"
64
+ })(({
65
+ odysseyDesignTokens,
66
+ isDragging
67
+ }) => ({
68
+ position: "absolute",
69
+ opacity: 0,
70
+ padding: odysseyDesignTokens.Spacing2,
71
+ border: "none",
72
+ backgroundColor: "transparent",
73
+ cursor: `${isDragging ? "grabbing" : "grab"}`,
74
+ transition: `opacity ${odysseyDesignTokens.TransitionDurationMain}`,
75
+ borderRadius: odysseyDesignTokens.BorderRadiusMain,
76
+ svg: {
77
+ display: "flex"
78
+ },
79
+ "&:focus, &:focus-visible": {
80
+ outline: "none",
81
+ boxShadow: `inset 0 0 0 2px ${odysseyDesignTokens.PalettePrimaryMain}`
82
+ }
83
+ }));
84
+ export const DragHandle = ({
85
+ isDragging
86
+ }) => {
87
+ const {
88
+ attributes,
89
+ listeners,
90
+ ref
91
+ } = useContext(SortableItemContext);
92
+ const odysseyDesignTokens = useOdysseyDesignTokens();
93
+ const {
94
+ t
95
+ } = useTranslation();
96
+ return _jsx(StyledDragHandleButton, {
97
+ ...attributes,
98
+ ...listeners,
99
+ odysseyDesignTokens: odysseyDesignTokens,
100
+ isDragging: isDragging,
101
+ ref: ref,
102
+ "aria-label": t("navigation.drag.handle"),
103
+ children: _jsx("svg", {
104
+ width: "16",
105
+ height: "16",
106
+ viewBox: "0 0 16 16",
107
+ fill: "none",
108
+ xmlns: "http://www.w3.org/2000/svg",
109
+ children: _jsx("path", {
110
+ fillRule: "evenodd",
111
+ clipRule: "evenodd",
112
+ d: "M6 2.33331C6 2.8856 5.55228 3.33331 5 3.33331C4.44772 3.33331 4 2.8856 4 2.33331C4 1.78103 4.44772 1.33331 5 1.33331C5.55228 1.33331 6 1.78103 6 2.33331ZM11 3.33331C11.5523 3.33331 12 2.8856 12 2.33331C12 1.78103 11.5523 1.33331 11 1.33331C10.4477 1.33331 10 1.78103 10 2.33331C10 2.8856 10.4477 3.33331 11 3.33331ZM11 7.11109C11.5523 7.11109 12 6.66338 12 6.11109C12 5.55881 11.5523 5.11109 11 5.11109C10.4477 5.11109 10 5.55881 10 6.11109C10 6.66338 10.4477 7.11109 11 7.11109ZM12 9.88887C12 10.4412 11.5523 10.8889 11 10.8889C10.4477 10.8889 10 10.4412 10 9.88887C10 9.33659 10.4477 8.88887 11 8.88887C11.5523 8.88887 12 9.33659 12 9.88887ZM11 14.6666C11.5523 14.6666 12 14.2189 12 13.6666C12 13.1144 11.5523 12.6666 11 12.6666C10.4477 12.6666 10 13.1144 10 13.6666C10 14.2189 10.4477 14.6666 11 14.6666ZM5 7.11109C5.55228 7.11109 6 6.66338 6 6.11109C6 5.55881 5.55228 5.11109 5 5.11109C4.44772 5.11109 4 5.55881 4 6.11109C4 6.66338 4.44772 7.11109 5 7.11109ZM6 9.88888C6 10.4412 5.55228 10.8889 5 10.8889C4.44772 10.8889 4 10.4412 4 9.88888C4 9.33659 4.44772 8.88888 5 8.88888C5.55228 8.88888 6 9.33659 6 9.88888ZM5 14.6666C5.55228 14.6666 6 14.2189 6 13.6666C6 13.1144 5.55228 12.6666 5 12.6666C4.44772 12.6666 4 13.1144 4 13.6666C4 14.2189 4.44772 14.6666 5 14.6666Z",
113
+ fill: "#3F59E4"
114
+ })
115
+ })
116
+ });
117
+ };
118
+ export const SortableItem = ({
119
+ id,
120
+ isDisabled,
121
+ isSelected,
122
+ children
123
+ }) => {
124
+ const {
125
+ attributes,
126
+ isDragging,
127
+ listeners,
128
+ setNodeRef,
129
+ setActivatorNodeRef,
130
+ transform,
131
+ transition
132
+ } = useSortable({
133
+ id
134
+ });
135
+ const context = useMemo(() => ({
136
+ attributes,
137
+ listeners,
138
+ ref: setActivatorNodeRef
139
+ }), [attributes, listeners, setActivatorNodeRef]);
140
+ const style = {
141
+ opacity: isDragging ? 0.4 : undefined,
142
+ transform: CSS.Translate.toString(transform),
143
+ transition
144
+ };
145
+ const odysseyDesignTokens = useOdysseyDesignTokens();
146
+ return _jsx(SortableItemContext.Provider, {
147
+ value: context,
148
+ children: _jsxs(StyledSortableListItem, {
149
+ "data-sortable-container": "true",
150
+ ref: setNodeRef,
151
+ style: style,
152
+ odysseyDesignTokens: odysseyDesignTokens,
153
+ isSelected: isSelected,
154
+ children: [!isDisabled && _jsx(DragHandle, {
155
+ isDragging: isDragging
156
+ }), _jsx(StyledUl, {
157
+ children: children
158
+ })]
159
+ })
160
+ });
161
+ };
162
+ //# sourceMappingURL=SortableItem.js.map