@activecollab/components 2.0.571 → 2.0.573

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 (74) hide show
  1. package/dist/cjs/components/EditableContent/Styles.js +1 -1
  2. package/dist/cjs/components/EditableContent/Styles.js.map +1 -1
  3. package/dist/cjs/components/MainMenu/MainMenu.js +25 -13
  4. package/dist/cjs/components/MainMenu/MainMenu.js.map +1 -1
  5. package/dist/cjs/components/MainMenu/Styles.js +1 -1
  6. package/dist/cjs/components/MainMenu/Styles.js.map +1 -1
  7. package/dist/cjs/components/MainMenu/hooks.js +33 -2
  8. package/dist/cjs/components/MainMenu/hooks.js.map +1 -1
  9. package/dist/cjs/components/MainMenu/types.js +2 -1
  10. package/dist/cjs/components/MainMenu/types.js.map +1 -1
  11. package/dist/cjs/components/ScrollArea/ScrollArea.js +157 -0
  12. package/dist/cjs/components/ScrollArea/ScrollArea.js.map +1 -0
  13. package/dist/cjs/components/ScrollArea/Styles.js +17 -0
  14. package/dist/cjs/components/ScrollArea/Styles.js.map +1 -0
  15. package/dist/cjs/components/ScrollArea/index.js +17 -0
  16. package/dist/cjs/components/ScrollArea/index.js.map +1 -0
  17. package/dist/cjs/components/ViewSwitcher/Styles.js +37 -18
  18. package/dist/cjs/components/ViewSwitcher/Styles.js.map +1 -1
  19. package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js +12 -1
  20. package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
  21. package/dist/cjs/components/ViewSwitcher/ViewSwitcherMenu.js +12 -4
  22. package/dist/cjs/components/ViewSwitcher/ViewSwitcherMenu.js.map +1 -1
  23. package/dist/cjs/components/index.js +12 -0
  24. package/dist/cjs/components/index.js.map +1 -1
  25. package/dist/esm/components/EditableContent/Styles.d.ts.map +1 -1
  26. package/dist/esm/components/EditableContent/Styles.js +1 -1
  27. package/dist/esm/components/EditableContent/Styles.js.map +1 -1
  28. package/dist/esm/components/MainMenu/MainMenu.d.ts.map +1 -1
  29. package/dist/esm/components/MainMenu/MainMenu.js +25 -12
  30. package/dist/esm/components/MainMenu/MainMenu.js.map +1 -1
  31. package/dist/esm/components/MainMenu/Styles.d.ts.map +1 -1
  32. package/dist/esm/components/MainMenu/Styles.js +1 -1
  33. package/dist/esm/components/MainMenu/Styles.js.map +1 -1
  34. package/dist/esm/components/MainMenu/hooks.d.ts +1 -0
  35. package/dist/esm/components/MainMenu/hooks.d.ts.map +1 -1
  36. package/dist/esm/components/MainMenu/hooks.js +28 -1
  37. package/dist/esm/components/MainMenu/hooks.js.map +1 -1
  38. package/dist/esm/components/MainMenu/types.d.ts +1 -0
  39. package/dist/esm/components/MainMenu/types.d.ts.map +1 -1
  40. package/dist/esm/components/MainMenu/types.js +2 -1
  41. package/dist/esm/components/MainMenu/types.js.map +1 -1
  42. package/dist/esm/components/ScrollArea/ScrollArea.d.ts +39 -0
  43. package/dist/esm/components/ScrollArea/ScrollArea.d.ts.map +1 -0
  44. package/dist/esm/components/ScrollArea/ScrollArea.js +137 -0
  45. package/dist/esm/components/ScrollArea/ScrollArea.js.map +1 -0
  46. package/dist/esm/components/ScrollArea/Styles.d.ts +3 -0
  47. package/dist/esm/components/ScrollArea/Styles.d.ts.map +1 -0
  48. package/dist/esm/components/ScrollArea/Styles.js +10 -0
  49. package/dist/esm/components/ScrollArea/Styles.js.map +1 -0
  50. package/dist/esm/components/ScrollArea/index.d.ts +2 -0
  51. package/dist/esm/components/ScrollArea/index.d.ts.map +1 -0
  52. package/dist/esm/components/ScrollArea/index.js +2 -0
  53. package/dist/esm/components/ScrollArea/index.js.map +1 -0
  54. package/dist/esm/components/ViewSwitcher/Styles.d.ts +2 -0
  55. package/dist/esm/components/ViewSwitcher/Styles.d.ts.map +1 -1
  56. package/dist/esm/components/ViewSwitcher/Styles.js +36 -17
  57. package/dist/esm/components/ViewSwitcher/Styles.js.map +1 -1
  58. package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts +2 -0
  59. package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts.map +1 -1
  60. package/dist/esm/components/ViewSwitcher/ViewSwitcher.js +12 -1
  61. package/dist/esm/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
  62. package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.d.ts +4 -0
  63. package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.d.ts.map +1 -1
  64. package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.js +13 -5
  65. package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.js.map +1 -1
  66. package/dist/esm/components/index.d.ts +1 -0
  67. package/dist/esm/components/index.d.ts.map +1 -1
  68. package/dist/esm/components/index.js +1 -0
  69. package/dist/esm/components/index.js.map +1 -1
  70. package/dist/index.js +275 -43
  71. package/dist/index.js.map +1 -1
  72. package/dist/index.min.js +1 -1
  73. package/dist/index.min.js.map +1 -1
  74. package/package.json +2 -1
@@ -14,7 +14,7 @@ export const MainMenuGlobalStyle = createGlobalStyle([".c-main-menu-favorites-po
14
14
  export const StyledMainMenu = styled.div.withConfig({
15
15
  displayName: "Styles__StyledMainMenu",
16
16
  componentId: "sc-17ibzh0-0"
17
- })(["", " &.c-main-menu--desktop{position:relative;left:10px;display:none;flex-direction:column;flex-shrink:0;height:100%;margin-right:4px;@media (min-width:", "){display:flex;}}&.c-main-menu--drawer{height:100%;}&.expanded{width:", "px;}&.collapsed{width:", "px;}&.expanded,&.collapsed{transition:width ", ";@media (max-width:", "){width:", "px;}}&.c-main-menu--drawer.c-main-menu--drawer{width:", "px;}.main-menu-panel{display:flex;flex:1;flex-direction:column;min-height:0;}&.main-menu-peek{width:", "px;}&.main-menu-peek .main-menu-panel{position:absolute;top:0;bottom:0;left:0;z-index:0;width:", "px;clip-path:inset( -100px ", "px -100px -100px );transition:clip-path 200ms cubic-bezier(0.25,0.46,0.45,0.94);&::before{content:\"\";position:absolute;inset:0 0 0 -10px;z-index:-1;background-color:var(--body-bg-main);box-shadow:var(--shadow-popover);}.collapse-expand-menu-icon{transform:rotate(180deg);}}&.main-menu-peek-open .main-menu-panel{clip-path:inset(-100px);}&.main-menu-peek::after{content:\"\";position:absolute;top:0;bottom:0;left:-10px;z-index:-1;width:", "px;}@media (prefers-reduced-motion:reduce){&.main-menu-peek .main-menu-panel{transition-duration:1ms;}}.main-menu-header{position:relative;display:flex;align-items:center;height:68px;overflow:hidden;}&.c-main-menu--desktop .main-menu-header{left:-10px;}.main-logo-url{position:absolute;left:30px;color:var(--color-secondary);transition:all ", ";path{fill:var(--color-secondary);}}.main-logo-long{transition:all ", ";path{fill:var(--color-secondary);}#logotype{opacity:1;transition:all ", ";will-change:opacity,transform;@media (max-width:", "){opacity:0;transform:translateX(-5%);}}}.main-logo-long__collapsed #logotype{opacity:0;transform:translateX(-5%);}.collapse-expand-menu{display:none;align-items:center;justify-content:center;width:0;height:100%;margin:0;padding:0;border:0;border-radius:0;background-color:var(--color-secondary);cursor:pointer;transition:all ", ";@media (min-width:", "){display:inline-flex;}.collapse-expand-menu-icon{display:none;fill:var(--page-paper-main);}}.main-menu-edit-button.main-menu-edit-button{opacity:0;transition:opacity ", ";}.main-menu-header .main-menu-edit-button.main-menu-edit-button{position:absolute;right:6px;transform:translateY(-2px);svg{fill:var(--color-theme-500);}&:hover svg,&:focus-visible svg{fill:var(--color-theme-900);}}&:hover .main-menu-edit-button.main-menu-edit-button,&:has(:focus-visible) .main-menu-edit-button.main-menu-edit-button,&.touch .main-menu-edit-button.main-menu-edit-button{opacity:1;}@media (hover:none){.main-menu-edit-button.main-menu-edit-button{opacity:1;}}&.collapsed .main-menu-edit-button.main-menu-edit-button{visibility:hidden;}@media (max-width:", "){&:not(.c-main-menu--drawer) .main-menu-edit-button.main-menu-edit-button{visibility:hidden;}}&:hover .collapse-expand-menu{width:4px;}.main-menu-header:hover{.main-logo-url{left:38px;@media (max-width:", "){left:30px;}}.collapse-expand-menu{width:16px;.collapse-expand-menu-icon{display:block;}}}.collapse-expand-menu.collapse-expand-menu:hover{width:24px;& + .main-logo-url{left:46px;@media (max-width:", "){left:30px;}}}.main-menu-socket{display:flex;flex:1 1 0%;flex-direction:column;height:100%;overflow-y:auto;}&.c-main-menu--drawer .main-menu-socket{height:calc(100dvh - 72px);}.main-menu-items{display:flex;flex-grow:1;min-height:0;}.main-menu-items-inner{margin:12px 0;overflow-x:hidden;}.main-menu-item-icon{flex-shrink:0;fill:var(--color-theme-700);opacity:0.7;}.main-menu-item{display:flex;align-items:center;height:40px;margin:0 12px 2px;padding:0 4px 0 12px;border-radius:var(--ac-br-8);text-decoration:none;&:hover{background-color:var(--color-theme-300);transition:all ", ";.main-menu-item-icon{fill:var(--color-theme-900);opacity:1;}.main-menu-item-text{color:var(--color-theme-900);}}&.main-menu-item-current{background-color:var(--color-secondary-200);.main-menu-item-icon{fill:var(--color-secondary);opacity:1;}.main-menu-item-text{color:var(--color-secondary);}}}.main-menu-item--between{justify-content:space-between;}.main-menu-item-start{display:flex;align-items:center;}.main-menu-item-label{min-width:0;margin-left:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.main-menu-projects{position:relative;}.main-menu-subnav.main-menu-subnav{padding:2px 0;.main-menu-subnav-item{margin:0;padding-right:0;padding-left:0;&:hover{background-color:unset;}}.main-menu-subnav-item-icon{flex-shrink:0;margin-right:8px;opacity:0.5;fill:var(--color-theme-700);}.main-menu-subnav-item-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.main-menu-item{width:100%;min-width:0;height:32px;margin-right:12px;margin-left:22px;padding:8px;}.main-menu-item:hover{.main-menu-subnav-item-icon{fill:var(--color-theme-900);}.main-menu-subnav-item-text{color:var(--color-theme-900);}}.main-menu-subnav-item-active,.main-menu-subnav-item-active:hover{background-color:var(--color-secondary-200);.main-menu-subnav-item-icon{fill:var(--color-secondary);}.main-menu-subnav-item-text{color:var(--color-secondary);}}}.menu-section-text{opacity:0.7;}.main-menu-item-text,.menu-section,.collapse-expand-menu-icon{transition:all ", ";}.menu-section{position:relative;display:flex;align-items:center;justify-content:space-between;margin:0 12px 8px;padding:0 4px 0 12px;clip-path:inset(-4px);}&.expanded{.main-menu-item-text{opacity:1;visibility:visible;}.menu-section{max-height:32px;opacity:1;}}&.collapsed{.collapse-expand-menu-icon{transform:rotate(180deg);}.main-menu-item-text{opacity:0;visibility:hidden;}.menu-section{max-height:0;opacity:0;}}@media (max-width:", "){&.collapsed .menu-section,&.expanded .menu-section{max-height:0;opacity:0;}&.collapsed .main-menu-item-text,&.expanded .main-menu-item-text{width:0;opacity:0;visibility:hidden;}&.c-main-menu--drawer.expanded{.menu-section{max-height:32px;opacity:1;}.main-menu-item-text{width:auto;opacity:1;visibility:visible;}}}.favorite-projects-menu-target{position:absolute;top:0;right:0;z-index:1;display:none;align-items:center;justify-content:center;width:10px;height:40px;border-radius:4px;cursor:pointer;&.collapsed{display:flex;}@media (max-width:", "){display:flex;}svg{transform:rotate(180deg);}}&.main-menu-can-peek:not(.main-menu-peek-open) .favorite-projects-menu-target{display:none;}&.main-menu-peek-open .favorite-projects-menu-target.collapsed{top:8px;right:16px;width:24px;height:24px;}.favorite-projects-menu-target:hover{background-color:var(--color-theme-300);svg{fill:var(--color-theme-900);}}.main-menu-item-current + .favorite-projects-menu-target:hover,.favorite-projects-menu-target.open{background-color:var(--color-secondary-200);svg{fill:var(--color-secondary);}}.main-menu-toggle{flex-shrink:0;transition:", ";&.is-closed{transform:rotate(180deg);}}.favorite-projects-list,.favorite-projects-list-target{display:flex;&.collapsed{display:none;}@media (max-width:", "){display:none;}}.favorite-projects-list-target{margin-left:auto;}&.c-main-menu--drawer{.favorite-projects-list.favorite-projects-list,.favorite-projects-list-target.is-mobile{display:flex;}}.favorite-projects-list{opacity:1;overflow:hidden;transition:all ", ";}.favorite-projects-list-collapsed{opacity:0;transition:all ", ";}.show-hidden-options-long{display:block;margin:12px 24px;cursor:pointer;&.collapsed{display:none;}@media (max-width:", "){display:none;}}.show-hidden-options-short{display:none;margin:12px 0;cursor:pointer;&.collapsed{display:block;}@media (max-width:", "){display:block;}}&.c-main-menu--drawer{.show-hidden-options-long.show-hidden-options-long{display:block;}.show-hidden-options-short.show-hidden-options-short{display:none;}}.main-menu-shortcuts{position:relative;}.shortcuts-expander{margin-left:auto;cursor:pointer;}.shortcuts-expander-collapsed{position:absolute;top:-11px;right:0;left:0;display:none;margin:0 auto;border-radius:100%;background-color:var(--body-bg-main);cursor:pointer;&.collapsed{display:block;}@media (max-width:", "){display:block;}}.shortcuts-list-separator.c-list-separator{margin:16px 12px 12px;transition:margin ", ";&.collapsed{margin:20px 12px;}@media (max-width:", "){margin:20px 12px;}}.add-shortcut{cursor:pointer;.main-menu-item-text.main-menu-item-text{color:var(--color-secondary);}.main-menu-item-icon.main-menu-item-icon{fill:var(--color-secondary);opacity:1;}&:hover{background-color:var(--color-primary-200);}&:focus{background-color:var(--color-primary-300);outline:none;}}.main-menu-item.main-menu-help{position:relative;flex-shrink:0;margin-top:16px;margin-bottom:16px;&:hover{cursor:pointer;}}.main-menu-help .main-menu-toggle.is-hidden{display:none;}.main-menu-item.main-menu-help--promo,.main-menu-item.main-menu-help--promo:hover,.main-menu-item.main-menu-help--promo.main-menu-item-current{background-color:var(--color-primary);}.main-menu-help-promo{display:flex;align-items:center;gap:12px;}.main-menu-help-promo-icon{flex-shrink:0;fill:var(--page-paper-main);}.main-menu-help-promo-text{display:flex;visibility:visible;@media (min-width:", "){visibility:hidden;}@media (min-width:", "){visibility:visible;}}.main-menu-help-badge.main-menu-help-badge{position:absolute;top:16px;right:4px;margin-right:8px;margin-left:auto;@media (min-width:", "){top:0;right:auto;left:0;}&.is-promo{right:6px;@media (min-width:", "){right:auto;}}&.is-static{@media (min-width:", "){position:static;}}}.main-menu-editor{display:flex;flex-direction:column;flex-grow:1;min-height:0;outline:none;}.main-menu-editor-header{margin-top:12px;}.main-menu-editor-action{margin-right:4px;}.main-menu-editor-list{display:flex;flex-grow:1;min-height:0;}.main-menu-editor-list-inner{overflow-x:hidden;}.main-menu-editor-row.c-list-item{margin:0 0 2px;padding-right:12px;padding-left:8px;}.main-menu-editor-row-box{width:100%;border-radius:var(--ac-br-8);}.main-menu-editor-row-inner{display:flex;align-items:center;width:100%;}.main-menu-editor-handle{margin-right:4px;cursor:move;}.main-menu-edit-item{display:flex;align-items:center;justify-content:space-between;width:100%;max-width:204px;height:40px;padding-right:4px;text-decoration:none;}.main-menu-edit-item-start{display:flex;align-items:center;min-width:0;}.main-menu-edit-item.hidden{.main-menu-item-icon,.main-menu-item-text{opacity:0.4;}}.main-menu-editor-shortcuts-title{display:flex;align-items:center;height:24px;margin:0 12px 8px;padding:0 12px;}.main-menu-drawer-close{position:absolute;top:16px;right:16px;@media (min-width:", "){display:none;}}"], BoxSizingStyle, SM, EXPANDED_WIDTH, COLLAPSED_WIDTH, TRANSITION, XL, COLLAPSED_WIDTH, EXPANDED_WIDTH, COLLAPSED_WIDTH, EXPANDED_WIDTH, EXPANDED_WIDTH - COLLAPSED_WIDTH, EXPANDED_WIDTH + 10, TRANSITION, TRANSITION, TRANSITION, XL, TRANSITION, XL, TRANSITION, XL, XL, XL, TRANSITION, TRANSITION, XL, XL, TOGGLE_TRANSITION, XL, TRANSITION, TRANSITION, XL, XL, XL, TRANSITION, XL, SM, XL, SM, SM, XL, SM);
17
+ })(["", " &.c-main-menu--desktop{position:relative;left:10px;display:none;flex-direction:column;flex-shrink:0;height:100%;margin-right:4px;@media (min-width:", "){display:flex;}}&.c-main-menu--drawer{height:100%;}&.expanded{width:", "px;}&.collapsed{width:", "px;}&.expanded,&.collapsed{transition:width ", ";@media (max-width:", "){width:", "px;}}&.c-main-menu--drawer.c-main-menu--drawer{width:", "px;}.main-menu-panel{display:flex;flex:1;flex-direction:column;min-height:0;}&.main-menu-peek{width:", "px;}&.main-menu-peek .main-menu-panel{position:absolute;top:0;bottom:0;left:0;z-index:0;width:", "px;clip-path:inset( -100px ", "px -100px -100px );transition:clip-path 200ms cubic-bezier(0.25,0.46,0.45,0.94);&::before{content:\"\";position:absolute;inset:0 0 0 -10px;z-index:-1;background-color:var(--body-bg-main);box-shadow:var(--shadow-popover);}}&.main-menu-peek-open .main-menu-panel{clip-path:inset(-100px);}&.main-menu-peek::after{content:\"\";position:absolute;top:0;bottom:0;left:-10px;z-index:-1;width:", "px;}@media (prefers-reduced-motion:reduce){&.main-menu-peek .main-menu-panel{transition-duration:1ms;}}.main-menu-header{position:relative;display:flex;align-items:center;height:68px;overflow:hidden;}&.c-main-menu--desktop .main-menu-header{left:-10px;}.main-logo-url{position:absolute;left:30px;color:var(--color-secondary);path{fill:var(--color-secondary);transition:fill ", ";}&:hover path,&:focus-visible path{fill:var(--color-theme-900);}}.main-logo-long{transition:all ", ";#logotype{opacity:1;transition:all ", ";will-change:opacity,transform;@media (max-width:", "){opacity:0;transform:translateX(-5%);}}}.main-logo-long__collapsed #logotype{opacity:0;transform:translateX(-5%);}.main-menu-collapse-tab{position:absolute;top:8px;left:-10px;z-index:4;display:none;width:30px;height:48px;margin:0;padding:0;border:0;background:none;font:inherit;cursor:pointer;@media (min-width:", "){display:block;}}.main-menu-collapse-tab-face{position:absolute;top:50%;left:0;display:flex;align-items:center;gap:6px;height:27px;max-width:4px;margin-top:-0.5px;padding:0;overflow:hidden;border-radius:0 4px 4px 0;background:var(--color-theme-500);white-space:nowrap;opacity:0;transform:translateY(-50%);transition:all 180ms ease;}.main-menu-collapse-tab-icon,.main-menu-collapse-tab-label{opacity:0;transition:opacity 150ms ease,", ";}.main-menu-collapse-tab-icon{flex-shrink:0;fill:var(--color-theme-700);}.main-menu-collapse-tab.is-collapsed .main-menu-collapse-tab-icon{transform:rotate(180deg);}.main-menu-collapse-tab-label{color:var(--color-theme-900);font-size:12px;font-weight:600;line-height:16px;}&:hover .main-menu-collapse-tab-face,&:has(:focus-visible) .main-menu-collapse-tab-face,&.touch .main-menu-collapse-tab-face{opacity:1;}@media (hover:none){.main-menu-collapse-tab-face{opacity:1;}}.main-menu-collapse-tab:hover .main-menu-collapse-tab-face,.main-menu-collapse-tab:focus-visible .main-menu-collapse-tab-face{height:39px;max-width:120px;padding:0 14px 0 10px;border:1px solid var(--popover-border);border-left:0;border-radius:0 10px 10px 0;background:linear-gradient( 180deg,var(--page-paper-main),color-mix(in srgb,var(--page-paper-main) 92%,var(--color-theme-500)) );box-shadow:0 1px 2px rgba(0,0,0,0.14),0 4px 14px rgba(0,0,0,0.145),inset 0 1px 0 rgba(255,255,255,0.07);opacity:1;}.main-menu-collapse-tab:hover .main-menu-collapse-tab-icon,.main-menu-collapse-tab:hover .main-menu-collapse-tab-label,.main-menu-collapse-tab:focus-visible .main-menu-collapse-tab-icon,.main-menu-collapse-tab:focus-visible .main-menu-collapse-tab-label{opacity:1;}.main-menu-edit-button.main-menu-edit-button{opacity:0;transition:opacity ", ";}.main-menu-header .main-menu-edit-button.main-menu-edit-button{position:absolute;right:6px;transform:translateY(-2px);svg{fill:var(--color-theme-500);}&:hover svg,&:focus-visible svg{fill:var(--color-theme-900);}}&:hover .main-menu-edit-button.main-menu-edit-button,&:has(:focus-visible) .main-menu-edit-button.main-menu-edit-button,&.touch .main-menu-edit-button.main-menu-edit-button{opacity:1;}@media (hover:none){.main-menu-edit-button.main-menu-edit-button{opacity:1;}}&.collapsed .main-menu-edit-button.main-menu-edit-button{visibility:hidden;}@media (max-width:", "){&:not(.c-main-menu--drawer) .main-menu-edit-button.main-menu-edit-button{visibility:hidden;}}.main-menu-socket{display:flex;flex:1 1 0%;flex-direction:column;height:100%;overflow-y:auto;}&.c-main-menu--drawer .main-menu-socket{height:calc(100dvh - 72px);}.main-menu-items{display:flex;flex-grow:1;min-height:0;}.main-menu-items-inner{margin:12px 0;overflow-x:hidden;}.main-menu-item-icon{flex-shrink:0;fill:var(--color-theme-700);opacity:0.7;}.main-menu-item{display:flex;align-items:center;height:40px;margin:0 12px 2px;padding:0 4px 0 12px;border-radius:var(--ac-br-8);text-decoration:none;&:hover{background-color:var(--color-theme-300);transition:all ", ";.main-menu-item-icon{fill:var(--color-theme-900);opacity:1;}.main-menu-item-text{color:var(--color-theme-900);}}&.main-menu-item-current{background-color:var(--color-secondary-200);.main-menu-item-icon{fill:var(--color-secondary);opacity:1;}.main-menu-item-text{color:var(--color-secondary);}}}.main-menu-item--between{justify-content:space-between;}.main-menu-item-start{display:flex;align-items:center;}.main-menu-item-label{min-width:0;margin-left:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.main-menu-projects{position:relative;}.main-menu-subnav.main-menu-subnav{padding:2px 0;.main-menu-subnav-item{margin:0;padding-right:0;padding-left:0;&:hover{background-color:unset;}}.main-menu-subnav-item-icon{flex-shrink:0;margin-right:8px;opacity:0.5;fill:var(--color-theme-700);}.main-menu-subnav-item-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.main-menu-item{width:100%;min-width:0;height:32px;margin-right:12px;margin-left:22px;padding:8px;}.main-menu-item:hover{.main-menu-subnav-item-icon{fill:var(--color-theme-900);}.main-menu-subnav-item-text{color:var(--color-theme-900);}}.main-menu-subnav-item-active,.main-menu-subnav-item-active:hover{background-color:var(--color-secondary-200);.main-menu-subnav-item-icon{fill:var(--color-secondary);}.main-menu-subnav-item-text{color:var(--color-secondary);}}}.menu-section-text{opacity:0.7;}.main-menu-item-text,.menu-section{transition:all ", ";}.menu-section{position:relative;display:flex;align-items:center;justify-content:space-between;margin:0 12px 8px;padding:0 4px 0 12px;clip-path:inset(-4px);}&.expanded{.main-menu-item-text{opacity:1;visibility:visible;}.menu-section{max-height:32px;opacity:1;}}&.collapsed{.main-menu-item-text{opacity:0;visibility:hidden;}.menu-section{max-height:0;opacity:0;}}@media (max-width:", "){&.collapsed .menu-section,&.expanded .menu-section{max-height:0;opacity:0;}&.collapsed .main-menu-item-text,&.expanded .main-menu-item-text{width:0;opacity:0;visibility:hidden;}&.c-main-menu--drawer.expanded{.menu-section{max-height:32px;opacity:1;}.main-menu-item-text{width:auto;opacity:1;visibility:visible;}}}.favorite-projects-menu-target{position:absolute;top:0;right:0;z-index:1;display:none;align-items:center;justify-content:center;width:10px;height:40px;border-radius:4px;cursor:pointer;&.collapsed{display:flex;}@media (max-width:", "){display:flex;}svg{transform:rotate(180deg);}}&.main-menu-can-peek:not(.main-menu-peek-open) .favorite-projects-menu-target{display:none;}&.main-menu-peek-open .favorite-projects-menu-target.collapsed{top:8px;right:16px;width:24px;height:24px;}.favorite-projects-menu-target:hover{background-color:var(--color-theme-300);svg{fill:var(--color-theme-900);}}.main-menu-item-current + .favorite-projects-menu-target:hover,.favorite-projects-menu-target.open{background-color:var(--color-secondary-200);svg{fill:var(--color-secondary);}}.main-menu-toggle{flex-shrink:0;transition:", ";&.is-closed{transform:rotate(180deg);}}.favorite-projects-list,.favorite-projects-list-target{display:flex;&.collapsed{display:none;}@media (max-width:", "){display:none;}}.favorite-projects-list-target{margin-left:auto;}&.c-main-menu--drawer{.favorite-projects-list.favorite-projects-list,.favorite-projects-list-target.is-mobile{display:flex;}}.favorite-projects-list{opacity:1;overflow:hidden;transition:all ", ";}.favorite-projects-list-collapsed{opacity:0;transition:all ", ";}.show-hidden-options-long{display:block;margin:12px 24px;cursor:pointer;&.collapsed{display:none;}@media (max-width:", "){display:none;}}.show-hidden-options-short{display:none;margin:12px 0;cursor:pointer;&.collapsed{display:block;}@media (max-width:", "){display:block;}}&.c-main-menu--drawer{.show-hidden-options-long.show-hidden-options-long{display:block;}.show-hidden-options-short.show-hidden-options-short{display:none;}}.main-menu-shortcuts{position:relative;}.shortcuts-expander{margin-left:auto;cursor:pointer;}.shortcuts-expander-collapsed{position:absolute;top:-11px;right:0;left:0;display:none;margin:0 auto;border-radius:100%;background-color:var(--body-bg-main);cursor:pointer;&.collapsed{display:block;}@media (max-width:", "){display:block;}}.shortcuts-list-separator.c-list-separator{margin:16px 12px 12px;transition:margin ", ";&.collapsed{margin:20px 12px;}@media (max-width:", "){margin:20px 12px;}}.add-shortcut{cursor:pointer;.main-menu-item-text.main-menu-item-text{color:var(--color-secondary);}.main-menu-item-icon.main-menu-item-icon{fill:var(--color-secondary);opacity:1;}&:hover{background-color:var(--color-primary-200);}&:focus{background-color:var(--color-primary-300);outline:none;}}.main-menu-item.main-menu-help{position:relative;flex-shrink:0;margin-top:16px;margin-bottom:16px;&:hover{cursor:pointer;}}.main-menu-help .main-menu-toggle.is-hidden{display:none;}.main-menu-item.main-menu-help--promo,.main-menu-item.main-menu-help--promo:hover,.main-menu-item.main-menu-help--promo.main-menu-item-current{background-color:var(--color-primary);}.main-menu-help-promo{display:flex;align-items:center;gap:12px;}.main-menu-help-promo-icon{flex-shrink:0;fill:var(--page-paper-main);}.main-menu-help-promo-text{display:flex;visibility:visible;@media (min-width:", "){visibility:hidden;}@media (min-width:", "){visibility:visible;}}.main-menu-help-badge.main-menu-help-badge{position:absolute;top:16px;right:4px;margin-right:8px;margin-left:auto;@media (min-width:", "){top:0;right:auto;left:0;}&.is-promo{right:6px;@media (min-width:", "){right:auto;}}&.is-static{@media (min-width:", "){position:static;}}}.main-menu-editor{display:flex;flex-direction:column;flex-grow:1;min-height:0;outline:none;}.main-menu-editor-header{margin-top:12px;}.main-menu-editor-action{margin-right:4px;}.main-menu-editor-list{display:flex;flex-grow:1;min-height:0;}.main-menu-editor-list-inner{overflow-x:hidden;}.main-menu-editor-row.c-list-item{margin:0 0 2px;padding-right:12px;padding-left:8px;}.main-menu-editor-row-box{width:100%;border-radius:var(--ac-br-8);}.main-menu-editor-row-inner{display:flex;align-items:center;width:100%;}.main-menu-editor-handle{margin-right:4px;cursor:move;}.main-menu-edit-item{display:flex;align-items:center;justify-content:space-between;width:100%;max-width:204px;height:40px;padding-right:4px;text-decoration:none;}.main-menu-edit-item-start{display:flex;align-items:center;min-width:0;}.main-menu-edit-item.hidden{.main-menu-item-icon,.main-menu-item-text{opacity:0.4;}}.main-menu-editor-shortcuts-title{display:flex;align-items:center;height:24px;margin:0 12px 8px;padding:0 12px;}.main-menu-drawer-close{position:absolute;top:16px;right:16px;@media (min-width:", "){display:none;}}"], BoxSizingStyle, SM, EXPANDED_WIDTH, COLLAPSED_WIDTH, TRANSITION, XL, COLLAPSED_WIDTH, EXPANDED_WIDTH, COLLAPSED_WIDTH, EXPANDED_WIDTH, EXPANDED_WIDTH - COLLAPSED_WIDTH, EXPANDED_WIDTH + 10, TRANSITION, TRANSITION, TRANSITION, XL, XL, TOGGLE_TRANSITION, TRANSITION, XL, TRANSITION, TRANSITION, XL, XL, TOGGLE_TRANSITION, XL, TRANSITION, TRANSITION, XL, XL, XL, TRANSITION, XL, SM, XL, SM, SM, XL, SM);
18
18
  StyledMainMenu.displayName = "StyledMainMenu";
19
19
 
20
20
  /* HelpAndSupportMenu.js: "tw:mt-3" on the first item, "tw:mb-3" on the last, "tw:shrink-0 tw:mr-3" on the icons */
@@ -1 +1 @@
1
- {"version":3,"file":"Styles.js","names":["styled","createGlobalStyle","BoxSizingStyle","List","SM","XL","NARROW_SCREEN","COLLAPSED_WIDTH","EXPANDED_WIDTH","TRANSITION","TOGGLE_TRANSITION","MainMenuGlobalStyle","StyledMainMenu","div","withConfig","displayName","componentId","StyledHelpList","StyledFavoritesMenuList"],"sources":["../../../../src/components/MainMenu/Styles.ts"],"sourcesContent":["import styled, { createGlobalStyle } from \"styled-components\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { List } from \"../List\";\n\nexport const SM = \"640px\";\nexport const XL = \"1280px\";\nexport const NARROW_SCREEN = `(max-width: ${XL})`;\nexport const COLLAPSED_WIDTH = 72;\nexport const EXPANDED_WIDTH = 240;\n\nconst TRANSITION = \"200ms ease\";\nconst TOGGLE_TRANSITION = \"transform 200ms cubic-bezier(0.4, 0, 0.2, 1)\";\n\n// The popper of a menu sits in a portal, out of reach of the menu styles.\nexport const MainMenuGlobalStyle = createGlobalStyle`\n .c-main-menu-favorites-popper {\n padding: 4px;\n }\n`;\n\nexport const StyledMainMenu = styled.div`\n ${BoxSizingStyle}\n\n /* MainMenu.js \"tw:relative tw:left-2.5 tw:hidden tw:sm:flex tw:flex-col tw:h-full tw:mr-1 tw:shrink-0\" */\n &.c-main-menu--desktop {\n position: relative;\n left: 10px;\n display: none;\n flex-direction: column;\n flex-shrink: 0;\n height: 100%;\n margin-right: 4px;\n\n @media (min-width: ${SM}) {\n display: flex;\n }\n }\n\n /* MainMenuMobile.js \"tw:flex-col tw:h-full tw:w-60\": a block, as wide as the drawer */\n &.c-main-menu--drawer {\n height: 100%;\n }\n\n &.expanded {\n width: ${EXPANDED_WIDTH}px;\n }\n\n &.collapsed {\n width: ${COLLAPSED_WIDTH}px;\n }\n\n &.expanded,\n &.collapsed {\n transition: width ${TRANSITION};\n\n @media (max-width: ${XL}) {\n width: ${COLLAPSED_WIDTH}px;\n }\n }\n\n &.c-main-menu--drawer.c-main-menu--drawer {\n width: ${EXPANDED_WIDTH}px;\n }\n\n .main-menu-panel {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n }\n\n &.main-menu-peek {\n width: ${COLLAPSED_WIDTH}px;\n }\n\n /* The menu sits 10px from the edge, so the backdrop reaches back to cover that strip too. */\n &.main-menu-peek .main-menu-panel {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 0;\n width: ${EXPANDED_WIDTH}px;\n clip-path: inset(\n -100px ${EXPANDED_WIDTH - COLLAPSED_WIDTH}px -100px -100px\n );\n transition: clip-path 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);\n\n &::before {\n content: \"\";\n position: absolute;\n inset: 0 0 0 -10px;\n z-index: -1;\n background-color: var(--body-bg-main);\n box-shadow: var(--shadow-popover);\n }\n\n .collapse-expand-menu-icon {\n transform: rotate(180deg);\n }\n }\n\n &.main-menu-peek-open .main-menu-panel {\n clip-path: inset(-100px);\n }\n\n /* A clipped part of the panel takes no pointer, so this strip holds the hover while the clip opens. */\n &.main-menu-peek::after {\n content: \"\";\n position: absolute;\n top: 0;\n bottom: 0;\n left: -10px;\n z-index: -1;\n width: ${EXPANDED_WIDTH + 10}px;\n }\n\n @media (prefers-reduced-motion: reduce) {\n &.main-menu-peek .main-menu-panel {\n transition-duration: 1ms;\n }\n }\n\n /* \"main-menu-header tw:-left-2.5 tw:flex tw:items-center tw:overflow-hidden\" */\n .main-menu-header {\n position: relative;\n display: flex;\n align-items: center;\n height: 68px;\n overflow: hidden;\n }\n\n &.c-main-menu--desktop .main-menu-header {\n left: -10px;\n }\n\n .main-logo-url {\n position: absolute;\n left: 30px;\n color: var(--color-secondary);\n transition: all ${TRANSITION};\n\n path {\n fill: var(--color-secondary);\n }\n }\n\n .main-logo-long {\n transition: all ${TRANSITION};\n\n path {\n fill: var(--color-secondary);\n }\n\n #logotype {\n opacity: 1;\n transition: all ${TRANSITION};\n will-change: opacity, transform;\n\n @media (max-width: ${XL}) {\n opacity: 0;\n transform: translateX(-5%);\n }\n }\n }\n\n .main-logo-long__collapsed #logotype {\n opacity: 0;\n transform: translateX(-5%);\n }\n\n /* \"tw:hidden tw:xl:inline-flex collapse-expand-menu tw:h-full tw:justify-center tw:items-center\" */\n .collapse-expand-menu {\n display: none;\n align-items: center;\n justify-content: center;\n width: 0;\n height: 100%;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0;\n background-color: var(--color-secondary);\n cursor: pointer;\n transition: all ${TRANSITION};\n\n @media (min-width: ${XL}) {\n display: inline-flex;\n }\n\n .collapse-expand-menu-icon {\n display: none;\n fill: var(--page-paper-main);\n }\n }\n\n /* Opacity, not visibility: a hidden button cannot take the focus, so Tab would skip it. */\n .main-menu-edit-button.main-menu-edit-button {\n opacity: 0;\n transition: opacity ${TRANSITION};\n }\n\n /* MainMenu.js \"tw:absolute tw:right-1.5 tw:-translate-y-0.5\" and the theme-500 icon */\n .main-menu-header .main-menu-edit-button.main-menu-edit-button {\n position: absolute;\n right: 6px;\n transform: translateY(-2px);\n\n svg {\n fill: var(--color-theme-500);\n }\n\n &:hover svg,\n &:focus-visible svg {\n fill: var(--color-theme-900);\n }\n }\n\n &:hover .main-menu-edit-button.main-menu-edit-button,\n &:has(:focus-visible) .main-menu-edit-button.main-menu-edit-button,\n &.touch .main-menu-edit-button.main-menu-edit-button {\n opacity: 1;\n }\n\n @media (hover: none) {\n .main-menu-edit-button.main-menu-edit-button {\n opacity: 1;\n }\n }\n\n /* Where its section is collapsed the button cannot open the editor, so it stays out of the tab order. */\n &.collapsed .main-menu-edit-button.main-menu-edit-button {\n visibility: hidden;\n }\n\n @media (max-width: ${XL}) {\n &:not(.c-main-menu--drawer) .main-menu-edit-button.main-menu-edit-button {\n visibility: hidden;\n }\n }\n\n &:hover .collapse-expand-menu {\n width: 4px;\n }\n\n .main-menu-header:hover {\n .main-logo-url {\n left: 38px;\n\n @media (max-width: ${XL}) {\n left: 30px;\n }\n }\n\n .collapse-expand-menu {\n width: 16px;\n\n .collapse-expand-menu-icon {\n display: block;\n }\n }\n }\n\n .collapse-expand-menu.collapse-expand-menu:hover {\n width: 24px;\n\n & + .main-logo-url {\n left: 46px;\n\n @media (max-width: ${XL}) {\n left: 30px;\n }\n }\n }\n\n /* \"tw:flex tw:flex-col tw:grow tw:flex-1 tw:h-full tw:overflow-y-auto\" */\n .main-menu-socket {\n display: flex;\n flex: 1 1 0%;\n flex-direction: column;\n height: 100%;\n overflow-y: auto;\n }\n\n /* MainMenuMobile.js \"tw:h-[calc(100dvh-72px)]\" */\n &.c-main-menu--drawer .main-menu-socket {\n height: calc(100dvh - 72px);\n }\n\n /* MainMenuItems.js \"tw:flex tw:min-h-0 tw:grow\" around the scrollbars, and \"tw:my-3 tw:overflow-x-hidden\" */\n .main-menu-items {\n display: flex;\n flex-grow: 1;\n min-height: 0;\n }\n\n .main-menu-items-inner {\n margin: 12px 0;\n overflow-x: hidden;\n }\n\n .main-menu-item-icon {\n flex-shrink: 0;\n fill: var(--color-theme-700);\n opacity: 0.7;\n }\n\n /* MainMenuItemWrapper.js \"main-menu-item tw:flex tw:items-center tw:no-underline tw:h-10 tw:pl-3 tw:pr-1 tw:mx-3\" */\n .main-menu-item {\n display: flex;\n align-items: center;\n height: 40px;\n margin: 0 12px 2px;\n padding: 0 4px 0 12px;\n border-radius: var(--ac-br-8);\n text-decoration: none;\n\n &:hover {\n background-color: var(--color-theme-300);\n transition: all ${TRANSITION};\n\n .main-menu-item-icon {\n fill: var(--color-theme-900);\n opacity: 1;\n }\n\n .main-menu-item-text {\n color: var(--color-theme-900);\n }\n }\n\n &.main-menu-item-current {\n background-color: var(--color-secondary-200);\n\n .main-menu-item-icon {\n fill: var(--color-secondary);\n opacity: 1;\n }\n\n .main-menu-item-text {\n color: var(--color-secondary);\n }\n }\n }\n\n .main-menu-item--between {\n justify-content: space-between;\n }\n\n .main-menu-item-start {\n display: flex;\n align-items: center;\n }\n\n /* MainMenuItemInner.js \"tw:ml-3 tw:truncate tw:min-w-0\" */\n .main-menu-item-label {\n min-width: 0;\n margin-left: 12px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .main-menu-projects {\n position: relative;\n }\n\n /* FavoriteProjectOption.js */\n .main-menu-subnav.main-menu-subnav {\n padding: 2px 0;\n\n .main-menu-subnav-item {\n margin: 0;\n padding-right: 0;\n padding-left: 0;\n\n &:hover {\n background-color: unset;\n }\n }\n\n .main-menu-subnav-item-icon {\n flex-shrink: 0;\n margin-right: 8px;\n opacity: 0.5;\n fill: var(--color-theme-700);\n }\n\n .main-menu-subnav-item-text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .main-menu-item {\n width: 100%;\n min-width: 0;\n height: 32px;\n margin-right: 12px;\n margin-left: 22px;\n padding: 8px;\n }\n\n .main-menu-item:hover {\n .main-menu-subnav-item-icon {\n fill: var(--color-theme-900);\n }\n\n .main-menu-subnav-item-text {\n color: var(--color-theme-900);\n }\n }\n\n .main-menu-subnav-item-active,\n .main-menu-subnav-item-active:hover {\n background-color: var(--color-secondary-200);\n\n .main-menu-subnav-item-icon {\n fill: var(--color-secondary);\n }\n\n .main-menu-subnav-item-text {\n color: var(--color-secondary);\n }\n }\n }\n\n .menu-section-text {\n opacity: 0.7;\n }\n\n .main-menu-item-text,\n .menu-section,\n .collapse-expand-menu-icon {\n transition: all ${TRANSITION};\n }\n\n /* \"tw:mb-2 tw:mx-3 tw:pl-3 tw:pr-1 tw:flex tw:justify-between tw:items-center menu-section\" */\n .menu-section {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 0 12px 8px;\n padding: 0 4px 0 12px;\n /* The height clips the heading as it opens and closes, so its text is never squeezed. The 4px keep a focus ring. */\n clip-path: inset(-4px);\n }\n\n &.expanded {\n .main-menu-item-text {\n opacity: 1;\n visibility: visible;\n }\n\n .menu-section {\n max-height: 32px;\n opacity: 1;\n }\n }\n\n &.collapsed {\n .collapse-expand-menu-icon {\n transform: rotate(180deg);\n }\n\n .main-menu-item-text {\n opacity: 0;\n visibility: hidden;\n }\n\n .menu-section {\n max-height: 0;\n opacity: 0;\n }\n }\n\n @media (max-width: ${XL}) {\n &.collapsed .menu-section,\n &.expanded .menu-section {\n max-height: 0;\n opacity: 0;\n }\n\n &.collapsed .main-menu-item-text,\n &.expanded .main-menu-item-text {\n width: 0;\n opacity: 0;\n visibility: hidden;\n }\n\n /* The narrow screen collapses the sidebar, never the drawer. */\n &.c-main-menu--drawer.expanded {\n .menu-section {\n max-height: 32px;\n opacity: 1;\n }\n\n .main-menu-item-text {\n width: auto;\n opacity: 1;\n visibility: visible;\n }\n }\n }\n\n /* FavoriteProjectsMenu.js target */\n .favorite-projects-menu-target {\n position: absolute;\n top: 0;\n right: 0;\n z-index: 1;\n display: none;\n align-items: center;\n justify-content: center;\n width: 10px;\n height: 40px;\n border-radius: 4px;\n cursor: pointer;\n\n &.collapsed {\n display: flex;\n }\n\n @media (max-width: ${XL}) {\n display: flex;\n }\n\n svg {\n transform: rotate(180deg);\n }\n }\n\n &.main-menu-can-peek:not(.main-menu-peek-open)\n .favorite-projects-menu-target {\n display: none;\n }\n\n /* Where the drawer toggle sits in the expanded menu. */\n &.main-menu-peek-open .favorite-projects-menu-target.collapsed {\n top: 8px;\n right: 16px;\n width: 24px;\n height: 24px;\n }\n\n .favorite-projects-menu-target:hover {\n background-color: var(--color-theme-300);\n\n svg {\n fill: var(--color-theme-900);\n }\n }\n\n .main-menu-item-current + .favorite-projects-menu-target:hover,\n .favorite-projects-menu-target.open {\n background-color: var(--color-secondary-200);\n\n svg {\n fill: var(--color-secondary);\n }\n }\n\n /* ExpandToggle.jsx \"tw:transition-transform tw:duration-200\", up when expanded */\n .main-menu-toggle {\n flex-shrink: 0;\n transition: ${TOGGLE_TRANSITION};\n\n &.is-closed {\n transform: rotate(180deg);\n }\n }\n\n .favorite-projects-list,\n .favorite-projects-list-target {\n display: flex;\n\n &.collapsed {\n display: none;\n }\n\n @media (max-width: ${XL}) {\n display: none;\n }\n }\n\n .favorite-projects-list-target {\n margin-left: auto;\n }\n\n &.c-main-menu--drawer {\n .favorite-projects-list.favorite-projects-list,\n .favorite-projects-list-target.is-mobile {\n display: flex;\n }\n }\n\n .favorite-projects-list {\n opacity: 1;\n overflow: hidden;\n transition: all ${TRANSITION};\n }\n\n .favorite-projects-list-collapsed {\n opacity: 0;\n transition: all ${TRANSITION};\n }\n\n /* HiddenOptionList.js */\n .show-hidden-options-long {\n display: block;\n margin: 12px 24px;\n cursor: pointer;\n\n &.collapsed {\n display: none;\n }\n\n @media (max-width: ${XL}) {\n display: none;\n }\n }\n\n .show-hidden-options-short {\n display: none;\n margin: 12px 0;\n cursor: pointer;\n\n &.collapsed {\n display: block;\n }\n\n @media (max-width: ${XL}) {\n display: block;\n }\n }\n\n &.c-main-menu--drawer {\n .show-hidden-options-long.show-hidden-options-long {\n display: block;\n }\n\n .show-hidden-options-short.show-hidden-options-short {\n display: none;\n }\n }\n\n /* Shortcuts/List.js */\n .main-menu-shortcuts {\n position: relative;\n }\n\n .shortcuts-expander {\n margin-left: auto;\n cursor: pointer;\n }\n\n .shortcuts-expander-collapsed {\n position: absolute;\n top: -11px;\n right: 0;\n left: 0;\n display: none;\n margin: 0 auto;\n border-radius: 100%;\n background-color: var(--body-bg-main);\n cursor: pointer;\n\n &.collapsed {\n display: block;\n }\n\n @media (max-width: ${XL}) {\n display: block;\n }\n }\n\n .shortcuts-list-separator.c-list-separator {\n margin: 16px 12px 12px;\n transition: margin ${TRANSITION};\n\n &.collapsed {\n margin: 20px 12px;\n }\n\n @media (max-width: ${XL}) {\n margin: 20px 12px;\n }\n }\n\n .add-shortcut {\n cursor: pointer;\n\n .main-menu-item-text.main-menu-item-text {\n color: var(--color-secondary);\n }\n\n .main-menu-item-icon.main-menu-item-icon {\n fill: var(--color-secondary);\n opacity: 1;\n }\n\n &:hover {\n background-color: var(--color-primary-200);\n }\n\n &:focus {\n background-color: var(--color-primary-300);\n outline: none;\n }\n }\n\n /* HelpAndSupportMenu.js target \"tw:relative main-menu-item tw:shrink-0 tw:my-4 tw:hover:cursor-pointer\" */\n .main-menu-item.main-menu-help {\n position: relative;\n flex-shrink: 0;\n margin-top: 16px;\n margin-bottom: 16px;\n\n &:hover {\n cursor: pointer;\n }\n }\n\n .main-menu-help .main-menu-toggle.is-hidden {\n display: none;\n }\n\n /* HelpAndSupportMenu.js \"tw:bg-primary\": a promotion in place of Help & Support */\n .main-menu-item.main-menu-help--promo,\n .main-menu-item.main-menu-help--promo:hover,\n .main-menu-item.main-menu-help--promo.main-menu-item-current {\n background-color: var(--color-primary);\n }\n\n .main-menu-help-promo {\n display: flex;\n align-items: center;\n gap: 12px;\n }\n\n .main-menu-help-promo-icon {\n flex-shrink: 0;\n fill: var(--page-paper-main);\n }\n\n /* \"tw:flex tw:visible tw:sm:invisible tw:xl:visible\" */\n .main-menu-help-promo-text {\n display: flex;\n visibility: visible;\n\n @media (min-width: ${SM}) {\n visibility: hidden;\n }\n\n @media (min-width: ${XL}) {\n visibility: visible;\n }\n }\n\n /* \"new-features-badge tw:absolute tw:right-1 tw:top-4 tw:sm:top-0 tw:sm:left-0 tw:sm:right-auto tw:ml-auto tw:mr-2\" */\n .main-menu-help-badge.main-menu-help-badge {\n position: absolute;\n top: 16px;\n right: 4px;\n margin-right: 8px;\n margin-left: auto;\n\n @media (min-width: ${SM}) {\n top: 0;\n right: auto;\n left: 0;\n }\n\n &.is-promo {\n right: 6px;\n\n @media (min-width: ${SM}) {\n right: auto;\n }\n }\n\n &.is-static {\n @media (min-width: ${XL}) {\n position: static;\n }\n }\n }\n\n /* MainMenuItemsEditor.js \"tw:flex tw:flex-col tw:min-h-0 tw:grow tw:outline-none\" */\n .main-menu-editor {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n min-height: 0;\n outline: none;\n }\n\n /* Editor/Header.js \"tw:mt-3\" */\n .main-menu-editor-header {\n margin-top: 12px;\n }\n\n .main-menu-editor-action {\n margin-right: 4px;\n }\n\n .main-menu-editor-list {\n display: flex;\n flex-grow: 1;\n min-height: 0;\n }\n\n .main-menu-editor-list-inner {\n overflow-x: hidden;\n }\n\n /* DraggableListItem.js \"tw:pr-3 tw:pl-2 tw:mt-0\" with marginBottom 2px */\n .main-menu-editor-row.c-list-item {\n margin: 0 0 2px;\n padding-right: 12px;\n padding-left: 8px;\n }\n\n .main-menu-editor-row-box {\n width: 100%;\n border-radius: var(--ac-br-8);\n }\n\n .main-menu-editor-row-inner {\n display: flex;\n align-items: center;\n width: 100%;\n }\n\n .main-menu-editor-handle {\n margin-right: 4px;\n cursor: move;\n }\n\n /* Editor/MainMenuItem.js \"main-menu-edit-item tw:h-10 tw:w-full tw:pr-1\" with maxWidth 204px */\n .main-menu-edit-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n max-width: 204px;\n height: 40px;\n padding-right: 4px;\n text-decoration: none;\n }\n\n .main-menu-edit-item-start {\n display: flex;\n align-items: center;\n min-width: 0;\n }\n\n .main-menu-edit-item.hidden {\n .main-menu-item-icon,\n .main-menu-item-text {\n opacity: 0.4;\n }\n }\n\n /* \"tw:flex tw:items-center tw:h-6 tw:mb-2 tw:mx-3 tw:px-3 menu-section-text\" */\n .main-menu-editor-shortcuts-title {\n display: flex;\n align-items: center;\n height: 24px;\n margin: 0 12px 8px;\n padding: 0 12px;\n }\n\n /* MainMenuMobile.js \"tw:absolute tw:right-4 tw:top-4 tw:sm:hidden\" */\n .main-menu-drawer-close {\n position: absolute;\n top: 16px;\n right: 16px;\n\n @media (min-width: ${SM}) {\n display: none;\n }\n }\n`;\n\nStyledMainMenu.displayName = \"StyledMainMenu\";\n\n/* HelpAndSupportMenu.js: \"tw:mt-3\" on the first item, \"tw:mb-3\" on the last, \"tw:shrink-0 tw:mr-3\" on the icons */\nexport const StyledHelpList = styled(List)`\n outline: 2px solid transparent;\n outline-offset: 2px;\n\n .c-list-item > svg:first-child {\n flex-shrink: 0;\n margin-right: 12px;\n }\n\n .c-list-item:first-child {\n margin-top: 12px;\n }\n\n .c-list-item:last-child {\n margin-bottom: 12px;\n }\n\n .main-menu-help-entry-text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .main-menu-help-entry-badge {\n margin-left: auto;\n }\n\n /* an entry with a link: \"tw:no-underline\" */\n a.c-list-item {\n text-decoration: none;\n }\n\n .main-menu-help-entry.is-primary {\n color: var(--color-primary);\n\n > svg:first-child {\n fill: var(--color-primary);\n }\n }\n\n /* \"tw:justify-between tw:gap-3\" */\n .main-menu-help-entry-text.has-end {\n margin-right: 12px;\n }\n\n .main-menu-help-entry-end {\n flex-shrink: 0;\n margin-left: auto;\n }\n`;\n\nStyledHelpList.displayName = \"StyledHelpList\";\n\n/* FavoriteProjectsMenu.js \"tw:py-2\", FavoriteProjectMenuOption.js */\nexport const StyledFavoritesMenuList = styled(List)`\n padding: 8px 0;\n\n .c-list-item {\n padding-right: 0;\n padding-left: 0;\n }\n\n .favorite-project-menu-option {\n display: flex;\n align-items: center;\n justify-content: space-between;\n box-sizing: border-box;\n width: 100%;\n padding: 0 16px;\n color: var(--color-theme-900);\n text-decoration: none;\n\n svg {\n flex-shrink: 0;\n margin-right: 8px;\n opacity: 0.5;\n }\n\n &.favorite-project-menu-option-active {\n background-color: var(--color-secondary-200);\n\n svg {\n fill: var(--color-secondary);\n }\n\n .favorite-project-menu-option-text {\n color: var(--color-secondary);\n }\n }\n }\n\n .favorite-project-menu-option-text {\n flex: 1;\n padding-right: 8px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n`;\n\nStyledFavoritesMenuList.displayName = \"StyledFavoritesMenuList\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,iBAAiB,QAAQ,mBAAmB;AAE7D,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,IAAI,QAAQ,SAAS;AAE9B,OAAO,MAAMC,EAAE,GAAG,OAAO;AACzB,OAAO,MAAMC,EAAE,GAAG,QAAQ;AAC1B,OAAO,MAAMC,aAAa,oBAAkBD,EAAE,MAAG;AACjD,OAAO,MAAME,eAAe,GAAG,EAAE;AACjC,OAAO,MAAMC,cAAc,GAAG,GAAG;AAEjC,MAAMC,UAAU,GAAG,YAAY;AAC/B,MAAMC,iBAAiB,GAAG,8CAA8C;;AAExE;AACA,OAAO,MAAMC,mBAAmB,GAAGV,iBAAiB,iDAInD;AAED,OAAO,MAAMW,cAAc,GAAGZ,MAAM,CAACa,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,utUACpCd,cAAc,EAYOE,EAAE,EAWdI,cAAc,EAIdD,eAAe,EAKJE,UAAU,EAETJ,EAAE,EACZE,eAAe,EAKjBC,cAAc,EAWdD,eAAe,EAUfC,cAAc,EAEZA,cAAc,GAAGD,eAAe,EA8BlCC,cAAc,GAAG,EAAE,EA0BVC,UAAU,EAQVA,UAAU,EAQRA,UAAU,EAGPJ,EAAE,EAyBPI,UAAU,EAEPJ,EAAE,EAaDI,UAAU,EAoCbJ,EAAE,EAcEA,EAAE,EAoBFA,EAAE,EAkDLI,UAAU,EAmHZA,UAAU,EA2CTJ,EAAE,EA+CAA,EAAE,EA0CTK,iBAAiB,EAeVL,EAAE,EAmBLI,UAAU,EAKVA,UAAU,EAaPJ,EAAE,EAcFA,EAAE,EAwCFA,EAAE,EAOFI,UAAU,EAMVJ,EAAE,EAkEFD,EAAE,EAIFC,EAAE,EAaFD,EAAE,EASAA,EAAE,EAMFC,EAAE,EAiGJD,EAAE,CAI1B;AAEDQ,cAAc,CAACG,WAAW,GAAG,gBAAgB;;AAE7C;AACA,OAAO,MAAME,cAAc,GAAGjB,MAAM,CAACG,IAAI,CAAC,CAAAW,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,ilBAiDzC;AAEDC,cAAc,CAACF,WAAW,GAAG,gBAAgB;;AAE7C;AACA,OAAO,MAAMG,uBAAuB,GAAGlB,MAAM,CAACG,IAAI,CAAC,CAAAW,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,8lBA4ClD;AAEDE,uBAAuB,CAACH,WAAW,GAAG,yBAAyB","ignoreList":[]}
1
+ {"version":3,"file":"Styles.js","names":["styled","createGlobalStyle","BoxSizingStyle","List","SM","XL","NARROW_SCREEN","COLLAPSED_WIDTH","EXPANDED_WIDTH","TRANSITION","TOGGLE_TRANSITION","MainMenuGlobalStyle","StyledMainMenu","div","withConfig","displayName","componentId","StyledHelpList","StyledFavoritesMenuList"],"sources":["../../../../src/components/MainMenu/Styles.ts"],"sourcesContent":["import styled, { createGlobalStyle } from \"styled-components\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { List } from \"../List\";\n\nexport const SM = \"640px\";\nexport const XL = \"1280px\";\nexport const NARROW_SCREEN = `(max-width: ${XL})`;\nexport const COLLAPSED_WIDTH = 72;\nexport const EXPANDED_WIDTH = 240;\n\nconst TRANSITION = \"200ms ease\";\nconst TOGGLE_TRANSITION = \"transform 200ms cubic-bezier(0.4, 0, 0.2, 1)\";\n\n// The popper of a menu sits in a portal, out of reach of the menu styles.\nexport const MainMenuGlobalStyle = createGlobalStyle`\n .c-main-menu-favorites-popper {\n padding: 4px;\n }\n`;\n\nexport const StyledMainMenu = styled.div`\n ${BoxSizingStyle}\n\n /* MainMenu.js \"tw:relative tw:left-2.5 tw:hidden tw:sm:flex tw:flex-col tw:h-full tw:mr-1 tw:shrink-0\" */\n &.c-main-menu--desktop {\n position: relative;\n left: 10px;\n display: none;\n flex-direction: column;\n flex-shrink: 0;\n height: 100%;\n margin-right: 4px;\n\n @media (min-width: ${SM}) {\n display: flex;\n }\n }\n\n /* MainMenuMobile.js \"tw:flex-col tw:h-full tw:w-60\": a block, as wide as the drawer */\n &.c-main-menu--drawer {\n height: 100%;\n }\n\n &.expanded {\n width: ${EXPANDED_WIDTH}px;\n }\n\n &.collapsed {\n width: ${COLLAPSED_WIDTH}px;\n }\n\n &.expanded,\n &.collapsed {\n transition: width ${TRANSITION};\n\n @media (max-width: ${XL}) {\n width: ${COLLAPSED_WIDTH}px;\n }\n }\n\n &.c-main-menu--drawer.c-main-menu--drawer {\n width: ${EXPANDED_WIDTH}px;\n }\n\n .main-menu-panel {\n display: flex;\n flex: 1;\n flex-direction: column;\n min-height: 0;\n }\n\n &.main-menu-peek {\n width: ${COLLAPSED_WIDTH}px;\n }\n\n /* The menu sits 10px from the edge, so the backdrop reaches back to cover that strip too. */\n &.main-menu-peek .main-menu-panel {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 0;\n width: ${EXPANDED_WIDTH}px;\n clip-path: inset(\n -100px ${EXPANDED_WIDTH - COLLAPSED_WIDTH}px -100px -100px\n );\n transition: clip-path 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);\n\n &::before {\n content: \"\";\n position: absolute;\n inset: 0 0 0 -10px;\n z-index: -1;\n background-color: var(--body-bg-main);\n box-shadow: var(--shadow-popover);\n }\n }\n\n &.main-menu-peek-open .main-menu-panel {\n clip-path: inset(-100px);\n }\n\n /* A clipped part of the panel takes no pointer, so this strip holds the hover while the clip opens. */\n &.main-menu-peek::after {\n content: \"\";\n position: absolute;\n top: 0;\n bottom: 0;\n left: -10px;\n z-index: -1;\n width: ${EXPANDED_WIDTH + 10}px;\n }\n\n @media (prefers-reduced-motion: reduce) {\n &.main-menu-peek .main-menu-panel {\n transition-duration: 1ms;\n }\n }\n\n /* \"main-menu-header tw:-left-2.5 tw:flex tw:items-center tw:overflow-hidden\" */\n .main-menu-header {\n position: relative;\n display: flex;\n align-items: center;\n height: 68px;\n overflow: hidden;\n }\n\n &.c-main-menu--desktop .main-menu-header {\n left: -10px;\n }\n\n /* On hover the logo takes the hover color of the menu items. */\n .main-logo-url {\n position: absolute;\n left: 30px;\n color: var(--color-secondary);\n\n path {\n fill: var(--color-secondary);\n transition: fill ${TRANSITION};\n }\n\n &:hover path,\n &:focus-visible path {\n fill: var(--color-theme-900);\n }\n }\n\n .main-logo-long {\n transition: all ${TRANSITION};\n\n #logotype {\n opacity: 1;\n transition: all ${TRANSITION};\n will-change: opacity, transform;\n\n @media (max-width: ${XL}) {\n opacity: 0;\n transform: translateX(-5%);\n }\n }\n }\n\n .main-logo-long__collapsed #logotype {\n opacity: 0;\n transform: translateX(-5%);\n }\n\n /* The tab sits in the free strip left of the logo. It floats, so the menu keeps its layout. */\n .main-menu-collapse-tab {\n position: absolute;\n top: 8px;\n left: -10px;\n z-index: 4;\n display: none;\n width: 30px;\n height: 48px;\n margin: 0;\n padding: 0;\n border: 0;\n background: none;\n font: inherit;\n cursor: pointer;\n\n @media (min-width: ${XL}) {\n display: block;\n }\n }\n\n .main-menu-collapse-tab-face {\n position: absolute;\n top: 50%;\n left: 0;\n display: flex;\n align-items: center;\n gap: 6px;\n height: 27px;\n max-width: 4px;\n margin-top: -0.5px;\n padding: 0;\n overflow: hidden;\n border-radius: 0 4px 4px 0;\n background: var(--color-theme-500);\n white-space: nowrap;\n opacity: 0;\n transform: translateY(-50%);\n transition: all 180ms ease;\n }\n\n .main-menu-collapse-tab-icon,\n .main-menu-collapse-tab-label {\n opacity: 0;\n transition: opacity 150ms ease, ${TOGGLE_TRANSITION};\n }\n\n .main-menu-collapse-tab-icon {\n flex-shrink: 0;\n fill: var(--color-theme-700);\n }\n\n .main-menu-collapse-tab.is-collapsed .main-menu-collapse-tab-icon {\n transform: rotate(180deg);\n }\n\n .main-menu-collapse-tab-label {\n color: var(--color-theme-900);\n font-size: 12px;\n font-weight: 600;\n line-height: 16px;\n }\n\n &:hover .main-menu-collapse-tab-face,\n &:has(:focus-visible) .main-menu-collapse-tab-face,\n &.touch .main-menu-collapse-tab-face {\n opacity: 1;\n }\n\n @media (hover: none) {\n .main-menu-collapse-tab-face {\n opacity: 1;\n }\n }\n\n .main-menu-collapse-tab:hover .main-menu-collapse-tab-face,\n .main-menu-collapse-tab:focus-visible .main-menu-collapse-tab-face {\n height: 39px;\n max-width: 120px;\n padding: 0 14px 0 10px;\n border: 1px solid var(--popover-border);\n border-left: 0;\n border-radius: 0 10px 10px 0;\n background: linear-gradient(\n 180deg,\n var(--page-paper-main),\n color-mix(in srgb, var(--page-paper-main) 92%, var(--color-theme-500))\n );\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14), 0 4px 14px rgba(0, 0, 0, 0.145),\n inset 0 1px 0 rgba(255, 255, 255, 0.07);\n opacity: 1;\n }\n\n .main-menu-collapse-tab:hover .main-menu-collapse-tab-icon,\n .main-menu-collapse-tab:hover .main-menu-collapse-tab-label,\n .main-menu-collapse-tab:focus-visible .main-menu-collapse-tab-icon,\n .main-menu-collapse-tab:focus-visible .main-menu-collapse-tab-label {\n opacity: 1;\n }\n\n /* Opacity, not visibility: a hidden button cannot take the focus, so Tab would skip it. */\n .main-menu-edit-button.main-menu-edit-button {\n opacity: 0;\n transition: opacity ${TRANSITION};\n }\n\n /* MainMenu.js \"tw:absolute tw:right-1.5 tw:-translate-y-0.5\" and the theme-500 icon */\n .main-menu-header .main-menu-edit-button.main-menu-edit-button {\n position: absolute;\n right: 6px;\n transform: translateY(-2px);\n\n svg {\n fill: var(--color-theme-500);\n }\n\n &:hover svg,\n &:focus-visible svg {\n fill: var(--color-theme-900);\n }\n }\n\n &:hover .main-menu-edit-button.main-menu-edit-button,\n &:has(:focus-visible) .main-menu-edit-button.main-menu-edit-button,\n &.touch .main-menu-edit-button.main-menu-edit-button {\n opacity: 1;\n }\n\n @media (hover: none) {\n .main-menu-edit-button.main-menu-edit-button {\n opacity: 1;\n }\n }\n\n /* Where its section is collapsed the button cannot open the editor, so it stays out of the tab order. */\n &.collapsed .main-menu-edit-button.main-menu-edit-button {\n visibility: hidden;\n }\n\n @media (max-width: ${XL}) {\n &:not(.c-main-menu--drawer) .main-menu-edit-button.main-menu-edit-button {\n visibility: hidden;\n }\n }\n\n /* \"tw:flex tw:flex-col tw:grow tw:flex-1 tw:h-full tw:overflow-y-auto\" */\n .main-menu-socket {\n display: flex;\n flex: 1 1 0%;\n flex-direction: column;\n height: 100%;\n overflow-y: auto;\n }\n\n /* MainMenuMobile.js \"tw:h-[calc(100dvh-72px)]\" */\n &.c-main-menu--drawer .main-menu-socket {\n height: calc(100dvh - 72px);\n }\n\n /* MainMenuItems.js \"tw:flex tw:min-h-0 tw:grow\" around the scrollbars, and \"tw:my-3 tw:overflow-x-hidden\" */\n .main-menu-items {\n display: flex;\n flex-grow: 1;\n min-height: 0;\n }\n\n .main-menu-items-inner {\n margin: 12px 0;\n overflow-x: hidden;\n }\n\n .main-menu-item-icon {\n flex-shrink: 0;\n fill: var(--color-theme-700);\n opacity: 0.7;\n }\n\n /* MainMenuItemWrapper.js \"main-menu-item tw:flex tw:items-center tw:no-underline tw:h-10 tw:pl-3 tw:pr-1 tw:mx-3\" */\n .main-menu-item {\n display: flex;\n align-items: center;\n height: 40px;\n margin: 0 12px 2px;\n padding: 0 4px 0 12px;\n border-radius: var(--ac-br-8);\n text-decoration: none;\n\n &:hover {\n background-color: var(--color-theme-300);\n transition: all ${TRANSITION};\n\n .main-menu-item-icon {\n fill: var(--color-theme-900);\n opacity: 1;\n }\n\n .main-menu-item-text {\n color: var(--color-theme-900);\n }\n }\n\n &.main-menu-item-current {\n background-color: var(--color-secondary-200);\n\n .main-menu-item-icon {\n fill: var(--color-secondary);\n opacity: 1;\n }\n\n .main-menu-item-text {\n color: var(--color-secondary);\n }\n }\n }\n\n .main-menu-item--between {\n justify-content: space-between;\n }\n\n .main-menu-item-start {\n display: flex;\n align-items: center;\n }\n\n /* MainMenuItemInner.js \"tw:ml-3 tw:truncate tw:min-w-0\" */\n .main-menu-item-label {\n min-width: 0;\n margin-left: 12px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .main-menu-projects {\n position: relative;\n }\n\n /* FavoriteProjectOption.js */\n .main-menu-subnav.main-menu-subnav {\n padding: 2px 0;\n\n .main-menu-subnav-item {\n margin: 0;\n padding-right: 0;\n padding-left: 0;\n\n &:hover {\n background-color: unset;\n }\n }\n\n .main-menu-subnav-item-icon {\n flex-shrink: 0;\n margin-right: 8px;\n opacity: 0.5;\n fill: var(--color-theme-700);\n }\n\n .main-menu-subnav-item-text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .main-menu-item {\n width: 100%;\n min-width: 0;\n height: 32px;\n margin-right: 12px;\n margin-left: 22px;\n padding: 8px;\n }\n\n .main-menu-item:hover {\n .main-menu-subnav-item-icon {\n fill: var(--color-theme-900);\n }\n\n .main-menu-subnav-item-text {\n color: var(--color-theme-900);\n }\n }\n\n .main-menu-subnav-item-active,\n .main-menu-subnav-item-active:hover {\n background-color: var(--color-secondary-200);\n\n .main-menu-subnav-item-icon {\n fill: var(--color-secondary);\n }\n\n .main-menu-subnav-item-text {\n color: var(--color-secondary);\n }\n }\n }\n\n .menu-section-text {\n opacity: 0.7;\n }\n\n .main-menu-item-text,\n .menu-section {\n transition: all ${TRANSITION};\n }\n\n /* \"tw:mb-2 tw:mx-3 tw:pl-3 tw:pr-1 tw:flex tw:justify-between tw:items-center menu-section\" */\n .menu-section {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 0 12px 8px;\n padding: 0 4px 0 12px;\n /* The height clips the heading as it opens and closes, so its text is never squeezed. The 4px keep a focus ring. */\n clip-path: inset(-4px);\n }\n\n &.expanded {\n .main-menu-item-text {\n opacity: 1;\n visibility: visible;\n }\n\n .menu-section {\n max-height: 32px;\n opacity: 1;\n }\n }\n\n &.collapsed {\n .main-menu-item-text {\n opacity: 0;\n visibility: hidden;\n }\n\n .menu-section {\n max-height: 0;\n opacity: 0;\n }\n }\n\n @media (max-width: ${XL}) {\n &.collapsed .menu-section,\n &.expanded .menu-section {\n max-height: 0;\n opacity: 0;\n }\n\n &.collapsed .main-menu-item-text,\n &.expanded .main-menu-item-text {\n width: 0;\n opacity: 0;\n visibility: hidden;\n }\n\n /* The narrow screen collapses the sidebar, never the drawer. */\n &.c-main-menu--drawer.expanded {\n .menu-section {\n max-height: 32px;\n opacity: 1;\n }\n\n .main-menu-item-text {\n width: auto;\n opacity: 1;\n visibility: visible;\n }\n }\n }\n\n /* FavoriteProjectsMenu.js target */\n .favorite-projects-menu-target {\n position: absolute;\n top: 0;\n right: 0;\n z-index: 1;\n display: none;\n align-items: center;\n justify-content: center;\n width: 10px;\n height: 40px;\n border-radius: 4px;\n cursor: pointer;\n\n &.collapsed {\n display: flex;\n }\n\n @media (max-width: ${XL}) {\n display: flex;\n }\n\n svg {\n transform: rotate(180deg);\n }\n }\n\n &.main-menu-can-peek:not(.main-menu-peek-open)\n .favorite-projects-menu-target {\n display: none;\n }\n\n /* Where the drawer toggle sits in the expanded menu. */\n &.main-menu-peek-open .favorite-projects-menu-target.collapsed {\n top: 8px;\n right: 16px;\n width: 24px;\n height: 24px;\n }\n\n .favorite-projects-menu-target:hover {\n background-color: var(--color-theme-300);\n\n svg {\n fill: var(--color-theme-900);\n }\n }\n\n .main-menu-item-current + .favorite-projects-menu-target:hover,\n .favorite-projects-menu-target.open {\n background-color: var(--color-secondary-200);\n\n svg {\n fill: var(--color-secondary);\n }\n }\n\n /* ExpandToggle.jsx \"tw:transition-transform tw:duration-200\", up when expanded */\n .main-menu-toggle {\n flex-shrink: 0;\n transition: ${TOGGLE_TRANSITION};\n\n &.is-closed {\n transform: rotate(180deg);\n }\n }\n\n .favorite-projects-list,\n .favorite-projects-list-target {\n display: flex;\n\n &.collapsed {\n display: none;\n }\n\n @media (max-width: ${XL}) {\n display: none;\n }\n }\n\n .favorite-projects-list-target {\n margin-left: auto;\n }\n\n &.c-main-menu--drawer {\n .favorite-projects-list.favorite-projects-list,\n .favorite-projects-list-target.is-mobile {\n display: flex;\n }\n }\n\n .favorite-projects-list {\n opacity: 1;\n overflow: hidden;\n transition: all ${TRANSITION};\n }\n\n .favorite-projects-list-collapsed {\n opacity: 0;\n transition: all ${TRANSITION};\n }\n\n /* HiddenOptionList.js */\n .show-hidden-options-long {\n display: block;\n margin: 12px 24px;\n cursor: pointer;\n\n &.collapsed {\n display: none;\n }\n\n @media (max-width: ${XL}) {\n display: none;\n }\n }\n\n .show-hidden-options-short {\n display: none;\n margin: 12px 0;\n cursor: pointer;\n\n &.collapsed {\n display: block;\n }\n\n @media (max-width: ${XL}) {\n display: block;\n }\n }\n\n &.c-main-menu--drawer {\n .show-hidden-options-long.show-hidden-options-long {\n display: block;\n }\n\n .show-hidden-options-short.show-hidden-options-short {\n display: none;\n }\n }\n\n /* Shortcuts/List.js */\n .main-menu-shortcuts {\n position: relative;\n }\n\n .shortcuts-expander {\n margin-left: auto;\n cursor: pointer;\n }\n\n .shortcuts-expander-collapsed {\n position: absolute;\n top: -11px;\n right: 0;\n left: 0;\n display: none;\n margin: 0 auto;\n border-radius: 100%;\n background-color: var(--body-bg-main);\n cursor: pointer;\n\n &.collapsed {\n display: block;\n }\n\n @media (max-width: ${XL}) {\n display: block;\n }\n }\n\n .shortcuts-list-separator.c-list-separator {\n margin: 16px 12px 12px;\n transition: margin ${TRANSITION};\n\n &.collapsed {\n margin: 20px 12px;\n }\n\n @media (max-width: ${XL}) {\n margin: 20px 12px;\n }\n }\n\n .add-shortcut {\n cursor: pointer;\n\n .main-menu-item-text.main-menu-item-text {\n color: var(--color-secondary);\n }\n\n .main-menu-item-icon.main-menu-item-icon {\n fill: var(--color-secondary);\n opacity: 1;\n }\n\n &:hover {\n background-color: var(--color-primary-200);\n }\n\n &:focus {\n background-color: var(--color-primary-300);\n outline: none;\n }\n }\n\n /* HelpAndSupportMenu.js target \"tw:relative main-menu-item tw:shrink-0 tw:my-4 tw:hover:cursor-pointer\" */\n .main-menu-item.main-menu-help {\n position: relative;\n flex-shrink: 0;\n margin-top: 16px;\n margin-bottom: 16px;\n\n &:hover {\n cursor: pointer;\n }\n }\n\n .main-menu-help .main-menu-toggle.is-hidden {\n display: none;\n }\n\n /* HelpAndSupportMenu.js \"tw:bg-primary\": a promotion in place of Help & Support */\n .main-menu-item.main-menu-help--promo,\n .main-menu-item.main-menu-help--promo:hover,\n .main-menu-item.main-menu-help--promo.main-menu-item-current {\n background-color: var(--color-primary);\n }\n\n .main-menu-help-promo {\n display: flex;\n align-items: center;\n gap: 12px;\n }\n\n .main-menu-help-promo-icon {\n flex-shrink: 0;\n fill: var(--page-paper-main);\n }\n\n /* \"tw:flex tw:visible tw:sm:invisible tw:xl:visible\" */\n .main-menu-help-promo-text {\n display: flex;\n visibility: visible;\n\n @media (min-width: ${SM}) {\n visibility: hidden;\n }\n\n @media (min-width: ${XL}) {\n visibility: visible;\n }\n }\n\n /* \"new-features-badge tw:absolute tw:right-1 tw:top-4 tw:sm:top-0 tw:sm:left-0 tw:sm:right-auto tw:ml-auto tw:mr-2\" */\n .main-menu-help-badge.main-menu-help-badge {\n position: absolute;\n top: 16px;\n right: 4px;\n margin-right: 8px;\n margin-left: auto;\n\n @media (min-width: ${SM}) {\n top: 0;\n right: auto;\n left: 0;\n }\n\n &.is-promo {\n right: 6px;\n\n @media (min-width: ${SM}) {\n right: auto;\n }\n }\n\n &.is-static {\n @media (min-width: ${XL}) {\n position: static;\n }\n }\n }\n\n /* MainMenuItemsEditor.js \"tw:flex tw:flex-col tw:min-h-0 tw:grow tw:outline-none\" */\n .main-menu-editor {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n min-height: 0;\n outline: none;\n }\n\n /* Editor/Header.js \"tw:mt-3\" */\n .main-menu-editor-header {\n margin-top: 12px;\n }\n\n .main-menu-editor-action {\n margin-right: 4px;\n }\n\n .main-menu-editor-list {\n display: flex;\n flex-grow: 1;\n min-height: 0;\n }\n\n .main-menu-editor-list-inner {\n overflow-x: hidden;\n }\n\n /* DraggableListItem.js \"tw:pr-3 tw:pl-2 tw:mt-0\" with marginBottom 2px */\n .main-menu-editor-row.c-list-item {\n margin: 0 0 2px;\n padding-right: 12px;\n padding-left: 8px;\n }\n\n .main-menu-editor-row-box {\n width: 100%;\n border-radius: var(--ac-br-8);\n }\n\n .main-menu-editor-row-inner {\n display: flex;\n align-items: center;\n width: 100%;\n }\n\n .main-menu-editor-handle {\n margin-right: 4px;\n cursor: move;\n }\n\n /* Editor/MainMenuItem.js \"main-menu-edit-item tw:h-10 tw:w-full tw:pr-1\" with maxWidth 204px */\n .main-menu-edit-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n max-width: 204px;\n height: 40px;\n padding-right: 4px;\n text-decoration: none;\n }\n\n .main-menu-edit-item-start {\n display: flex;\n align-items: center;\n min-width: 0;\n }\n\n .main-menu-edit-item.hidden {\n .main-menu-item-icon,\n .main-menu-item-text {\n opacity: 0.4;\n }\n }\n\n /* \"tw:flex tw:items-center tw:h-6 tw:mb-2 tw:mx-3 tw:px-3 menu-section-text\" */\n .main-menu-editor-shortcuts-title {\n display: flex;\n align-items: center;\n height: 24px;\n margin: 0 12px 8px;\n padding: 0 12px;\n }\n\n /* MainMenuMobile.js \"tw:absolute tw:right-4 tw:top-4 tw:sm:hidden\" */\n .main-menu-drawer-close {\n position: absolute;\n top: 16px;\n right: 16px;\n\n @media (min-width: ${SM}) {\n display: none;\n }\n }\n`;\n\nStyledMainMenu.displayName = \"StyledMainMenu\";\n\n/* HelpAndSupportMenu.js: \"tw:mt-3\" on the first item, \"tw:mb-3\" on the last, \"tw:shrink-0 tw:mr-3\" on the icons */\nexport const StyledHelpList = styled(List)`\n outline: 2px solid transparent;\n outline-offset: 2px;\n\n .c-list-item > svg:first-child {\n flex-shrink: 0;\n margin-right: 12px;\n }\n\n .c-list-item:first-child {\n margin-top: 12px;\n }\n\n .c-list-item:last-child {\n margin-bottom: 12px;\n }\n\n .main-menu-help-entry-text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .main-menu-help-entry-badge {\n margin-left: auto;\n }\n\n /* an entry with a link: \"tw:no-underline\" */\n a.c-list-item {\n text-decoration: none;\n }\n\n .main-menu-help-entry.is-primary {\n color: var(--color-primary);\n\n > svg:first-child {\n fill: var(--color-primary);\n }\n }\n\n /* \"tw:justify-between tw:gap-3\" */\n .main-menu-help-entry-text.has-end {\n margin-right: 12px;\n }\n\n .main-menu-help-entry-end {\n flex-shrink: 0;\n margin-left: auto;\n }\n`;\n\nStyledHelpList.displayName = \"StyledHelpList\";\n\n/* FavoriteProjectsMenu.js \"tw:py-2\", FavoriteProjectMenuOption.js */\nexport const StyledFavoritesMenuList = styled(List)`\n padding: 8px 0;\n\n .c-list-item {\n padding-right: 0;\n padding-left: 0;\n }\n\n .favorite-project-menu-option {\n display: flex;\n align-items: center;\n justify-content: space-between;\n box-sizing: border-box;\n width: 100%;\n padding: 0 16px;\n color: var(--color-theme-900);\n text-decoration: none;\n\n svg {\n flex-shrink: 0;\n margin-right: 8px;\n opacity: 0.5;\n }\n\n &.favorite-project-menu-option-active {\n background-color: var(--color-secondary-200);\n\n svg {\n fill: var(--color-secondary);\n }\n\n .favorite-project-menu-option-text {\n color: var(--color-secondary);\n }\n }\n }\n\n .favorite-project-menu-option-text {\n flex: 1;\n padding-right: 8px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n`;\n\nStyledFavoritesMenuList.displayName = \"StyledFavoritesMenuList\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,iBAAiB,QAAQ,mBAAmB;AAE7D,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,IAAI,QAA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MAAMG,uBAAuB,GAAGlB,MAAM,CAACG,IAAI,CAAC,CAAAW,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,8lBA4ClD;AAEDE,uBAAuB,CAACH,WAAW,GAAG,yBAAyB","ignoreList":[]}
@@ -4,6 +4,7 @@ export declare const useControllable: <T>(value: T | undefined, defaultValue: T,
4
4
  export declare const useMediaQuery: (query: string) => boolean;
5
5
  export declare const useHasOpenPopup: (rootRef: RefObject<HTMLElement>, isWatching: boolean) => boolean;
6
6
  export declare const usePointerInside: (rootRef: RefObject<HTMLElement>, isWatching: boolean) => readonly [boolean, (inside: boolean) => void];
7
+ export declare const usePeekHold: (rootRef: RefObject<HTMLElement>) => readonly [boolean, import("react").Dispatch<import("react").SetStateAction<boolean>>];
7
8
  export declare const useDialogOpen: (isWatching: boolean, onOpen: () => void) => void;
8
9
  export declare const useOpenMenuPointer: (rootRef: RefObject<HTMLElement>, isActive: boolean, onPointer: (inside: boolean) => void) => void;
9
10
  /** The states and the labels that the desktop menu and the drawer resolve the same way. */
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../src/components/MainMenu/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAMV,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,kBAAkB,EAClB,eAAe,EAChB,MAAM,SAAS,CAAC;AAIjB,eAAO,MAAM,eAAe,GAAI,CAAC,EAC/B,OAAO,CAAC,GAAG,SAAS,EACpB,cAAc,CAAC,EACf,WAAW,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,KAC5B,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAgBxB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,OAsB7C,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,SAAS,SAAS,CAAC,WAAW,CAAC,EAC/B,YAAY,OAAO,KAClB,OA2BF,CAAC;AAwBF,eA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AY,OAAO,EAAE,QAAQ,MAAM,IAAI,SAuBpE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,SAAS,SAAS,CAAC,WAAW,CAAC,EAC/B,UAAU,OAAO,EACjB,WAAW,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,SAkBrC,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,eAAe,GAAI,OAAO,kBAAkB;;;8CAvOpC,IAAI;;8CAAJ,IAAI;;;;;CA0RxB,CAAC"}
@@ -74,6 +74,9 @@ const isPointerOverMenu = (root, event) => {
74
74
  // The menu sits on the left edge of the page, so the gutter on its left counts too.
75
75
  return event.clientX < right && event.clientY >= top && event.clientY < bottom;
76
76
  };
77
+
78
+ // The pointer on the tab of a closed menu must not open the peek, because the click there changes the mode.
79
+ const isOnTabOfClosedMenu = (root, event) => !(root != null && root.classList.contains("main-menu-peek")) && Boolean(event.target.closest == null ? void 0 : event.target.closest(".main-menu-collapse-tab"));
77
80
  export const usePointerInside = (rootRef, isWatching) => {
78
81
  const _useState4 = useState(false),
79
82
  isInside = _useState4[0],
@@ -96,7 +99,11 @@ export const usePointerInside = (rootRef, isWatching) => {
96
99
  leaveTimer.current = setTimeout(() => setIsInside(false), LEAVE_DELAY_MS);
97
100
  }
98
101
  };
99
- const handleOver = event => update(isPointerOverMenu(rootRef.current, event));
102
+ const handleOver = event => {
103
+ if (!isOnTabOfClosedMenu(rootRef.current, event)) {
104
+ update(isPointerOverMenu(rootRef.current, event));
105
+ }
106
+ };
100
107
  const handleOut = event => {
101
108
  if (!event.relatedTarget) {
102
109
  update(false);
@@ -113,6 +120,26 @@ export const usePointerInside = (rootRef, isWatching) => {
113
120
  return [isInside, setPointerInside];
114
121
  };
115
122
 
123
+ // After a collapse the pointer is still over the menu, so only a leave brings the peek back.
124
+ export const usePeekHold = rootRef => {
125
+ const _useState5 = useState(false),
126
+ isHeld = _useState5[0],
127
+ setIsHeld = _useState5[1];
128
+ useEffect(() => {
129
+ if (!isHeld) {
130
+ return undefined;
131
+ }
132
+ const release = event => {
133
+ if (!isPointerOverMenu(rootRef.current, event)) {
134
+ setIsHeld(false);
135
+ }
136
+ };
137
+ document.addEventListener("mouseover", release, true);
138
+ return () => document.removeEventListener("mouseover", release, true);
139
+ }, [rootRef, isHeld]);
140
+ return [isHeld, setIsHeld];
141
+ };
142
+
116
143
  // The listeners run only while the menu is fully open.
117
144
  // Every Dialog is a native modal <dialog>, and showModal sends no event to listen for.
118
145
  export const useDialogOpen = (isWatching, onOpen) => {
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","names":["useCallback","useEffect","useMemo","useRef","useState","DEFAULT_MAIN_MENU_LABELS","LEAVE_DELAY_MS","useControllable","value","defaultValue","onChange","_useState","own","setOwn","isControlled","undefined","setValue","next","useMediaQuery","query","getMatch","window","matchMedia","matches","_useState2","setMatches","list","update","addEventListener","removeEventListener","useHasOpenPopup","rootRef","isWatching","_useState3","hasOpenPopup","setHasOpenPopup","root","current","Boolean","querySelector","observer","MutationObserver","observe","subtree","attributes","attributeFilter","disconnect","isPointerOverMenu","event","_root$querySelector","document","contains","target","_getBoundingClientRec","getBoundingClientRect","right","top","bottom","clientX","clientY","usePointerInside","_useState4","isInside","setIsInside","leaveTimer","setPointerInside","inside","clearTimeout","setTimeout","handleOver","handleOut","relatedTarget","useDialogOpen","onOpen","check","body","childList","useOpenMenuPointer","isActive","onPointer","handlePointer","useMainMenuData","props","_props$defaultFavorit","_props$defaultShortcu","_props$defaultEditMod","labels","_extends","_useControllable","favoritesExpanded","defaultFavoritesExpanded","onFavoritesExpandedChange","setFavoritesExpanded","_useControllable2","shortcutsExpanded","defaultShortcutsExpanded","onShortcutsExpandedChange","setShortcutsExpanded","_useControllable3","editMode","defaultEditMode","onEditModeChange","setEditMode","editButtonRef","returnFocusRef","enterEditMode","exitEditMode","returnFocus","_editButtonRef$curren","focus"],"sources":["../../../../src/components/MainMenu/hooks.ts"],"sourcesContent":["import {\n RefObject,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport {\n DEFAULT_MAIN_MENU_LABELS,\n IMainMenuDataProps,\n IMainMenuLabels,\n} from \"./types\";\n\nconst LEAVE_DELAY_MS = 150;\n\nexport const useControllable = <T>(\n value: T | undefined,\n defaultValue: T,\n onChange?: (value: T) => void\n): [T, (value: T) => void] => {\n const [own, setOwn] = useState(defaultValue);\n const isControlled = value !== undefined;\n\n const setValue = useCallback(\n (next: T) => {\n if (!isControlled) {\n setOwn(next);\n }\n\n onChange?.(next);\n },\n [isControlled, onChange]\n );\n\n return [isControlled ? value : own, setValue];\n};\n\nexport const useMediaQuery = (query: string): boolean => {\n const getMatch = () =>\n typeof window !== \"undefined\" && typeof window.matchMedia === \"function\"\n ? window.matchMedia(query).matches\n : false;\n const [matches, setMatches] = useState(getMatch);\n\n useEffect(() => {\n if (typeof window.matchMedia !== \"function\") {\n return undefined;\n }\n\n const list = window.matchMedia(query);\n const update = () => setMatches(list.matches);\n\n update();\n list.addEventListener?.(\"change\", update);\n\n return () => list.removeEventListener?.(\"change\", update);\n }, [query]);\n\n return matches;\n};\n\nexport const useHasOpenPopup = (\n rootRef: RefObject<HTMLElement>,\n isWatching: boolean\n): boolean => {\n const [hasOpenPopup, setHasOpenPopup] = useState(false);\n\n useEffect(() => {\n const root = rootRef.current;\n\n if (!isWatching || !root) {\n setHasOpenPopup(false);\n\n return undefined;\n }\n\n const update = () =>\n setHasOpenPopup(Boolean(root.querySelector('[aria-expanded=\"true\"]')));\n const observer = new MutationObserver(update);\n\n update();\n observer.observe(root, {\n subtree: true,\n attributes: true,\n attributeFilter: [\"aria-expanded\"],\n });\n\n return () => observer.disconnect();\n }, [rootRef, isWatching]);\n\n return hasOpenPopup;\n};\n\n// Native events on the document: a React leave misses a node removed under the pointer and counts portals as inside.\n// A popup lays an overlay over the page, so the target alone does not tell where the pointer is.\nconst isPointerOverMenu = (root: HTMLElement | null, event: MouseEvent) => {\n // A modal dialog covers the menu, so the pointer cannot reach the menu.\n if (!root || document.querySelector(\"dialog[open]\")) {\n return false;\n }\n\n if (root.contains(event.target as Node)) {\n return true;\n }\n\n const { right, top, bottom } = (\n root.querySelector(\".main-menu-panel\") ?? root\n ).getBoundingClientRect();\n\n // The menu sits on the left edge of the page, so the gutter on its left counts too.\n return (\n event.clientX < right && event.clientY >= top && event.clientY < bottom\n );\n};\n\nexport const usePointerInside = (\n rootRef: RefObject<HTMLElement>,\n isWatching: boolean\n) => {\n const [isInside, setIsInside] = useState(false);\n const leaveTimer = useRef<ReturnType<typeof setTimeout>>();\n\n const setPointerInside = useCallback((inside: boolean) => {\n clearTimeout(leaveTimer.current);\n setIsInside(inside);\n }, []);\n\n useEffect(() => {\n if (!isWatching) {\n setIsInside(false);\n\n return undefined;\n }\n\n const update = (inside: boolean) => {\n clearTimeout(leaveTimer.current);\n\n if (inside) {\n setIsInside(true);\n } else {\n leaveTimer.current = setTimeout(\n () => setIsInside(false),\n LEAVE_DELAY_MS\n );\n }\n };\n\n const handleOver = (event: MouseEvent) =>\n update(isPointerOverMenu(rootRef.current, event));\n const handleOut = (event: MouseEvent) => {\n if (!event.relatedTarget) {\n update(false);\n }\n };\n\n document.addEventListener(\"mouseover\", handleOver, true);\n document.addEventListener(\"mouseout\", handleOut, true);\n\n return () => {\n clearTimeout(leaveTimer.current);\n document.removeEventListener(\"mouseover\", handleOver, true);\n document.removeEventListener(\"mouseout\", handleOut, true);\n };\n }, [rootRef, isWatching]);\n\n return [isInside, setPointerInside] as const;\n};\n\n// The listeners run only while the menu is fully open.\n// Every Dialog is a native modal <dialog>, and showModal sends no event to listen for.\nexport const useDialogOpen = (isWatching: boolean, onOpen: () => void) => {\n useEffect(() => {\n if (!isWatching) {\n return undefined;\n }\n\n const check = () => {\n if (document.querySelector(\"dialog[open]\")) {\n onOpen();\n }\n };\n const observer = new MutationObserver(check);\n\n check();\n observer.observe(document.body, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: [\"open\"],\n });\n\n return () => observer.disconnect();\n }, [isWatching, onOpen]);\n};\n\nexport const useOpenMenuPointer = (\n rootRef: RefObject<HTMLElement>,\n isActive: boolean,\n onPointer: (inside: boolean) => void\n) => {\n useEffect(() => {\n if (!isActive) {\n return undefined;\n }\n\n const handlePointer = (event: MouseEvent) =>\n onPointer(isPointerOverMenu(rootRef.current, event));\n\n document.addEventListener(\"mousemove\", handlePointer, true);\n document.addEventListener(\"click\", handlePointer, true);\n\n return () => {\n document.removeEventListener(\"mousemove\", handlePointer, true);\n document.removeEventListener(\"click\", handlePointer, true);\n };\n }, [rootRef, isActive, onPointer]);\n};\n\n/** The states and the labels that the desktop menu and the drawer resolve the same way. */\nexport const useMainMenuData = (props: IMainMenuDataProps) => {\n const labels: IMainMenuLabels = useMemo(\n () => ({ ...DEFAULT_MAIN_MENU_LABELS, ...props.labels }),\n [props.labels]\n );\n const [favoritesExpanded, setFavoritesExpanded] = useControllable(\n props.favoritesExpanded,\n props.defaultFavoritesExpanded ?? false,\n props.onFavoritesExpandedChange\n );\n const [shortcutsExpanded, setShortcutsExpanded] = useControllable(\n props.shortcutsExpanded,\n props.defaultShortcutsExpanded ?? true,\n props.onShortcutsExpandedChange\n );\n const [editMode, setEditMode] = useControllable(\n props.editMode,\n props.defaultEditMode ?? false,\n props.onEditModeChange\n );\n const editButtonRef = useRef<HTMLButtonElement>(null);\n const returnFocusRef = useRef(false);\n\n const enterEditMode = useCallback(() => setEditMode(true), [setEditMode]);\n const exitEditMode = useCallback(\n (returnFocus = true) => {\n returnFocusRef.current = returnFocus;\n setEditMode(false);\n },\n [setEditMode]\n );\n\n // Leaving edit mode mounts a new edit button, so the focus moves to it once it is there.\n useEffect(() => {\n if (!editMode && returnFocusRef.current) {\n returnFocusRef.current = false;\n editButtonRef.current?.focus();\n }\n }, [editMode]);\n\n return {\n labels,\n favoritesExpanded,\n setFavoritesExpanded,\n shortcutsExpanded,\n setShortcutsExpanded,\n editMode,\n enterEditMode,\n exitEditMode,\n editButtonRef,\n };\n};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AC;;EAED;EACArG,SAAS,CAAC,MAAM;IACd,IAAI,CAACkG,QAAQ,IAAIK,cAAc,CAACnE,OAAO,EAAE;MAAA,IAAAuE,qBAAA;MACvCJ,cAAc,CAACnE,OAAO,GAAG,KAAK;MAC9B,CAAAuE,qBAAA,GAAAL,aAAa,CAAClE,OAAO,aAArBuE,qBAAA,CAAuBC,KAAK,CAAC,CAAC;IAChC;EACF,CAAC,EAAE,CAACV,QAAQ,CAAC,CAAC;EAEd,OAAO;IACLb,MAAM;IACNG,iBAAiB;IACjBG,oBAAoB;IACpBE,iBAAiB;IACjBG,oBAAoB;IACpBE,QAAQ;IACRM,aAAa;IACbC,YAAY;IACZH;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"hooks.js","names":["useCallback","useEffect","useMemo","useRef","useState","DEFAULT_MAIN_MENU_LABELS","LEAVE_DELAY_MS","useControllable","value","defaultValue","onChange","_useState","own","setOwn","isControlled","undefined","setValue","next","useMediaQuery","query","getMatch","window","matchMedia","matches","_useState2","setMatches","list","update","addEventListener","removeEventListener","useHasOpenPopup","rootRef","isWatching","_useState3","hasOpenPopup","setHasOpenPopup","root","current","Boolean","querySelector","observer","MutationObserver","observe","subtree","attributes","attributeFilter","disconnect","isPointerOverMenu","event","_root$querySelector","document","contains","target","_getBoundingClientRec","getBoundingClientRect","right","top","bottom","clientX","clientY","isOnTabOfClosedMenu","classList","closest","usePointerInside","_useState4","isInside","setIsInside","leaveTimer","setPointerInside","inside","clearTimeout","setTimeout","handleOver","handleOut","relatedTarget","usePeekHold","_useState5","isHeld","setIsHeld","release","useDialogOpen","onOpen","check","body","childList","useOpenMenuPointer","isActive","onPointer","handlePointer","useMainMenuData","props","_props$defaultFavorit","_props$defaultShortcu","_props$defaultEditMod","labels","_extends","_useControllable","favoritesExpanded","defaultFavoritesExpanded","onFavoritesExpandedChange","setFavoritesExpanded","_useControllable2","shortcutsExpanded","defaultShortcutsExpanded","onShortcutsExpandedChange","setShortcutsExpanded","_useControllable3","editMode","defaultEditMode","onEditModeChange","setEditMode","editButtonRef","returnFocusRef","enterEditMode","exitEditMode","returnFocus","_editButtonRef$curren","focus"],"sources":["../../../../src/components/MainMenu/hooks.ts"],"sourcesContent":["import {\n RefObject,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport {\n DEFAULT_MAIN_MENU_LABELS,\n IMainMenuDataProps,\n IMainMenuLabels,\n} from \"./types\";\n\nconst LEAVE_DELAY_MS = 150;\n\nexport const useControllable = <T>(\n value: T | undefined,\n defaultValue: T,\n onChange?: (value: T) => void\n): [T, (value: T) => void] => {\n const [own, setOwn] = useState(defaultValue);\n const isControlled = value !== undefined;\n\n const setValue = useCallback(\n (next: T) => {\n if (!isControlled) {\n setOwn(next);\n }\n\n onChange?.(next);\n },\n [isControlled, onChange]\n );\n\n return [isControlled ? value : own, setValue];\n};\n\nexport const useMediaQuery = (query: string): boolean => {\n const getMatch = () =>\n typeof window !== \"undefined\" && typeof window.matchMedia === \"function\"\n ? window.matchMedia(query).matches\n : false;\n const [matches, setMatches] = useState(getMatch);\n\n useEffect(() => {\n if (typeof window.matchMedia !== \"function\") {\n return undefined;\n }\n\n const list = window.matchMedia(query);\n const update = () => setMatches(list.matches);\n\n update();\n list.addEventListener?.(\"change\", update);\n\n return () => list.removeEventListener?.(\"change\", update);\n }, [query]);\n\n return matches;\n};\n\nexport const useHasOpenPopup = (\n rootRef: RefObject<HTMLElement>,\n isWatching: boolean\n): boolean => {\n const [hasOpenPopup, setHasOpenPopup] = useState(false);\n\n useEffect(() => {\n const root = rootRef.current;\n\n if (!isWatching || !root) {\n setHasOpenPopup(false);\n\n return undefined;\n }\n\n const update = () =>\n setHasOpenPopup(Boolean(root.querySelector('[aria-expanded=\"true\"]')));\n const observer = new MutationObserver(update);\n\n update();\n observer.observe(root, {\n subtree: true,\n attributes: true,\n attributeFilter: [\"aria-expanded\"],\n });\n\n return () => observer.disconnect();\n }, [rootRef, isWatching]);\n\n return hasOpenPopup;\n};\n\n// Native events on the document: a React leave misses a node removed under the pointer and counts portals as inside.\n// A popup lays an overlay over the page, so the target alone does not tell where the pointer is.\nconst isPointerOverMenu = (root: HTMLElement | null, event: MouseEvent) => {\n // A modal dialog covers the menu, so the pointer cannot reach the menu.\n if (!root || document.querySelector(\"dialog[open]\")) {\n return false;\n }\n\n if (root.contains(event.target as Node)) {\n return true;\n }\n\n const { right, top, bottom } = (\n root.querySelector(\".main-menu-panel\") ?? root\n ).getBoundingClientRect();\n\n // The menu sits on the left edge of the page, so the gutter on its left counts too.\n return (\n event.clientX < right && event.clientY >= top && event.clientY < bottom\n );\n};\n\n// The pointer on the tab of a closed menu must not open the peek, because the click there changes the mode.\nconst isOnTabOfClosedMenu = (root: HTMLElement | null, event: MouseEvent) =>\n !root?.classList.contains(\"main-menu-peek\") &&\n Boolean((event.target as Element).closest?.(\".main-menu-collapse-tab\"));\n\nexport const usePointerInside = (\n rootRef: RefObject<HTMLElement>,\n isWatching: boolean\n) => {\n const [isInside, setIsInside] = useState(false);\n const leaveTimer = useRef<ReturnType<typeof setTimeout>>();\n\n const setPointerInside = useCallback((inside: boolean) => {\n clearTimeout(leaveTimer.current);\n setIsInside(inside);\n }, []);\n\n useEffect(() => {\n if (!isWatching) {\n setIsInside(false);\n\n return undefined;\n }\n\n const update = (inside: boolean) => {\n clearTimeout(leaveTimer.current);\n\n if (inside) {\n setIsInside(true);\n } else {\n leaveTimer.current = setTimeout(\n () => setIsInside(false),\n LEAVE_DELAY_MS\n );\n }\n };\n\n const handleOver = (event: MouseEvent) => {\n if (!isOnTabOfClosedMenu(rootRef.current, event)) {\n update(isPointerOverMenu(rootRef.current, event));\n }\n };\n const handleOut = (event: MouseEvent) => {\n if (!event.relatedTarget) {\n update(false);\n }\n };\n\n document.addEventListener(\"mouseover\", handleOver, true);\n document.addEventListener(\"mouseout\", handleOut, true);\n\n return () => {\n clearTimeout(leaveTimer.current);\n document.removeEventListener(\"mouseover\", handleOver, true);\n document.removeEventListener(\"mouseout\", handleOut, true);\n };\n }, [rootRef, isWatching]);\n\n return [isInside, setPointerInside] as const;\n};\n\n// After a collapse the pointer is still over the menu, so only a leave brings the peek back.\nexport const usePeekHold = (rootRef: RefObject<HTMLElement>) => {\n const [isHeld, setIsHeld] = useState(false);\n\n useEffect(() => {\n if (!isHeld) {\n return undefined;\n }\n\n const release = (event: MouseEvent) => {\n if (!isPointerOverMenu(rootRef.current, event)) {\n setIsHeld(false);\n }\n };\n\n document.addEventListener(\"mouseover\", release, true);\n\n return () => document.removeEventListener(\"mouseover\", release, true);\n }, [rootRef, isHeld]);\n\n return [isHeld, setIsHeld] as const;\n};\n\n// The listeners run only while the menu is fully open.\n// Every Dialog is a native modal <dialog>, and showModal sends no event to listen for.\nexport const useDialogOpen = (isWatching: boolean, onOpen: () => void) => {\n useEffect(() => {\n if (!isWatching) {\n return undefined;\n }\n\n const check = () => {\n if (document.querySelector(\"dialog[open]\")) {\n onOpen();\n }\n };\n const observer = new MutationObserver(check);\n\n check();\n observer.observe(document.body, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: [\"open\"],\n });\n\n return () => observer.disconnect();\n }, [isWatching, onOpen]);\n};\n\nexport const useOpenMenuPointer = (\n rootRef: RefObject<HTMLElement>,\n isActive: boolean,\n onPointer: (inside: boolean) => void\n) => {\n useEffect(() => {\n if (!isActive) {\n return undefined;\n }\n\n const handlePointer = (event: MouseEvent) =>\n onPointer(isPointerOverMenu(rootRef.current, event));\n\n document.addEventListener(\"mousemove\", handlePointer, true);\n document.addEventListener(\"click\", handlePointer, true);\n\n return () => {\n document.removeEventListener(\"mousemove\", handlePointer, true);\n document.removeEventListener(\"click\", handlePointer, true);\n };\n }, [rootRef, isActive, onPointer]);\n};\n\n/** The states and the labels that the desktop menu and the drawer resolve the same way. */\nexport const useMainMenuData = (props: IMainMenuDataProps) => {\n const labels: IMainMenuLabels = useMemo(\n () => ({ ...DEFAULT_MAIN_MENU_LABELS, ...props.labels }),\n [props.labels]\n );\n const [favoritesExpanded, setFavoritesExpanded] = useControllable(\n props.favoritesExpanded,\n props.defaultFavoritesExpanded ?? false,\n props.onFavoritesExpandedChange\n );\n const [shortcutsExpanded, setShortcutsExpanded] = useControllable(\n props.shortcutsExpanded,\n props.defaultShortcutsExpanded ?? true,\n props.onShortcutsExpandedChange\n );\n const [editMode, setEditMode] = useControllable(\n props.editMode,\n props.defaultEditMode ?? false,\n props.onEditModeChange\n );\n const editButtonRef = useRef<HTMLButtonElement>(null);\n const returnFocusRef = useRef(false);\n\n const enterEditMode = useCallback(() => setEditMode(true), [setEditMode]);\n const exitEditMode = useCallback(\n (returnFocus = true) => {\n returnFocusRef.current = returnFocus;\n setEditMode(false);\n },\n [setEditMode]\n );\n\n // Leaving edit mode mounts a new edit button, so the focus moves to it once it is there.\n useEffect(() => {\n if (!editMode && returnFocusRef.current) {\n returnFocusRef.current = false;\n editButtonRef.current?.focus();\n }\n }, [editMode]);\n\n return {\n labels,\n favoritesExpanded,\n setFavoritesExpanded,\n shortcutsExpanded,\n setShortcutsExpanded,\n editMode,\n enterEditMode,\n exitEditMode,\n editButtonRef,\n };\n};\n"],"mappings":";AAAA,SAEEA,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SACEC,wBAAwB,QAGnB,SAAS;AAEhB,MAAMC,cAAc,GAAG,GAAG;AAE1B,OAAO,MAAMC,eAAe,GAAGA,CAC7BC,KAAoB,EACpBC,YAAe,EACfC,QAA6B,KACD;EAC5B,MAAAC,SAAA,GAAsBP,QAAQ,CAACK,YAAY,CAAC;IAArCG,GAAG,GAAAD,SAAA;IAAEE,MAAM,GAAAF,SAAA;EAClB,MAAMG,YAAY,GAAGN,KAAK,KAAKO,SAAS;EAExC,MAAMC,QAAQ,GAAGhB,WAAW,CACzBiB,IAAO,IAAK;IACX,IAAI,CAACH,YAAY,EAAE;MACjBD,MAAM,CAACI,IAAI,CAAC;IACd;IAEAP,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AAA,GAAI,KAAK,EAC9BH,KAAK,CAACmB,gBACR,CAAC;IAJMF,QAAQ,GAAAD,iBAAA;IAAEI,WAAW,GAAAJ,iBAAA;EAK5B,MAAMK,aAAa,GAAG5G,MAAM,CAAoB,IAAI,CAAC;EACrD,MAAM6G,cAAc,GAAG7G,MAAM,CAAC,KAAK,CAAC;EAEpC,MAAM8G,aAAa,GAAGjH,WAAW,CAAC,MAAM8G,WAAW,CAAC,IAAI,CAAC,EAAE,CAACA,WAAW,CAAC,CAAC;EACzE,MAAMI,YAAY,GAAGlH,WAAW,CAC9B,UAACmH,WAAW,EAAY;IAAA,IAAvBA,WAAW;MAAXA,WAAW,GAAG,IAAI;IAAA;IACjBH,cAAc,CAAC3E,OAAO,GAAG8E,WAAW;IACpCL,WAAW,CAAC,KAAK,CAAC;EACpB,CAAC,EACD,CAACA,WAAW,CACd,CAAC;;EAED;EACA7G,SAAS,CAAC,MAAM;IACd,IAAI,CAAC0G,QAAQ,IAAIK,cAAc,CAAC3E,OAAO,EAAE;MAAA,IAAA+E,qBAAA;MACvCJ,cAAc,CAAC3E,OAAO,GAAG,KAAK;MAC9B,CAAA+E,qBAAA,GAAAL,aAAa,CAAC1E,OAAO,aAArB+E,qBAAA,CAAuBC,KAAK,CAAC,CAAC;IAChC;EACF,CAAC,EAAE,CAACV,QAAQ,CAAC,CAAC;EAEd,OAAO;IACLb,MAAM;IACNG,iBAAiB;IACjBG,oBAAoB;IACpBE,iBAAiB;IACjBG,oBAAoB;IACpBE,QAAQ;IACRM,aAAa;IACbC,YAAY;IACZH;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -67,6 +67,7 @@ export interface MainMenuEditResult {
67
67
  export interface IMainMenuLabels {
68
68
  customizeMenu: string;
69
69
  collapse: string;
70
+ expand: string;
70
71
  menu: string;
71
72
  edit: string;
72
73
  shortcuts: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/MainMenu/types.ts"],"names":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gB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,qDAAqD;IACrD,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAClD,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC5D,8EAA8E;IAC9E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CACnC"}
@@ -2,7 +2,8 @@
2
2
 
3
3
  export const DEFAULT_MAIN_MENU_LABELS = {
4
4
  customizeMenu: "Customize Menu",
5
- collapse: "Collapse or expand the menu",
5
+ collapse: "Collapse",
6
+ expand: "Expand",
6
7
  menu: "MENU",
7
8
  edit: "Edit",
8
9
  shortcuts: "SHORTCUTS",
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["DEFAULT_MAIN_MENU_LABELS","customizeMenu","collapse","menu","edit","shortcuts","addNew","showMore","showLess","more","less","helpAndSupport","editing","restoreDefault","save","cancel","show","hide","delete","restore","close"],"sources":["../../../../src/components/MainMenu/types.ts"],"sourcesContent":["import { ComponentType, MouseEvent, ReactNode, SVGProps } from \"react\";\n\nexport type MainMenuIcon = ComponentType<SVGProps<SVGSVGElement>>;\n\nexport interface MainMenuItemData {\n /** The key of the item, for example \"projects\". The \"projects\" item carries the favorite projects. */\n id: string;\n text: string;\n icon: MainMenuIcon;\n href?: string;\n /** The `id` of the link, for example a target of a feature pointer. */\n elementId?: string;\n /** Marks the item current, besides `currentItem`, for example on a page under another item. */\n current?: boolean;\n /** Opens the link in a new tab with \"_blank\". */\n target?: string;\n rel?: string;\n /** A click on the link, before `onNavigate`. */\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n}\n\nexport interface MainMenuShortcutData {\n id: number | string;\n name: string;\n icon: MainMenuIcon;\n href?: string;\n /** Marks the shortcut current, for example when its page is open. */\n current?: boolean;\n /** Opens the link in a new tab with \"_blank\", for example an external shortcut. */\n target?: string;\n rel?: string;\n /** A click on the link, before `onNavigate`. */\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n}\n\nexport interface MainMenuFavoriteData {\n id: number | string;\n /** The display name, with the project number when the account shows it. */\n name: string;\n href?: string;\n}\n\nexport interface MainMenuHelpEntry {\n id: string;\n text: string;\n icon: MainMenuIcon;\n onClick?: (event: MouseEvent<HTMLElement>) => void;\n /** A count in a red badge after the text, for example the unseen new features. */\n badge?: number;\n /** Makes the entry a link. The menu closes on its click. */\n href?: string;\n target?: string;\n rel?: string;\n /** \"primary\" draws the text and the icon in the primary color, for example a promotion. */\n tone?: \"primary\";\n /** Content at the end of the entry, for example a discount chip. */\n end?: ReactNode;\n /** The `id` of the text, for example a target of a feature pointer. */\n elementId?: string;\n className?: string;\n tabIndex?: number;\n}\n\n/** A promotion in place of the Help & Support item: a primary filled item with its own icon and text. */\nexport interface MainMenuHelpPromo {\n label: string;\n icon: MainMenuIcon;\n}\n\nexport interface MainMenuEditResult {\n hidden: string[];\n deleted: Array<number | string>;\n}\n\nexport interface IMainMenuLabels {\n customizeMenu: string;\n collapse: string;\n menu: string;\n edit: string;\n shortcuts: string;\n addNew: string;\n showMore: string;\n showLess: string;\n more: string;\n less: string;\n helpAndSupport: string;\n editing: string;\n restoreDefault: string;\n save: string;\n cancel: string;\n show: string;\n hide: string;\n delete: string;\n restore: string;\n close: string;\n}\n\nexport const DEFAULT_MAIN_MENU_LABELS: IMainMenuLabels = {\n customizeMenu: \"Customize Menu\",\n collapse: \"Collapse or expand the menu\",\n menu: \"MENU\",\n edit: \"Edit\",\n shortcuts: \"SHORTCUTS\",\n addNew: \"Add new\",\n showMore: \"Show more\",\n showLess: \"Show less\",\n more: \"More\",\n less: \"Less\",\n helpAndSupport: \"Help & Support\",\n editing: \"EDITING\",\n restoreDefault: \"Restore Default\",\n save: \"Save\",\n cancel: \"Cancel\",\n show: \"Show\",\n hide: \"Hide\",\n delete: \"Delete\",\n restore: \"Restore\",\n close: \"Close\",\n};\n\n/** The data and the handlers that the desktop menu and the drawer share. */\nexport interface IMainMenuDataProps {\n /** The items in their saved order. */\n items: MainMenuItemData[];\n /** The ids of the hidden items. They show under \"Show more\", and dimmed in the editor. */\n hiddenItems?: string[];\n /** The id of the item of the current page. */\n currentItem?: string;\n /** The favorite projects under the Projects item. */\n favorites?: MainMenuFavoriteData[];\n /** The id of the favorite project of the current page. */\n currentFavorite?: number | string;\n /** The favorite projects show under Projects. Uncontrolled when not set. */\n favoritesExpanded?: boolean;\n defaultFavoritesExpanded?: boolean;\n onFavoritesExpandedChange?: (expanded: boolean) => void;\n /** The shortcuts section. Not set, the menu has no shortcuts section. */\n shortcuts?: MainMenuShortcutData[];\n /** The shortcuts show under their heading. Uncontrolled when not set. */\n shortcutsExpanded?: boolean;\n defaultShortcutsExpanded?: boolean;\n onShortcutsExpandedChange?: (expanded: boolean) => void;\n /** The \"Add new\" row of the shortcuts. */\n onAddShortcut?: () => void;\n /** The groups of the Help & Support menu, with a separator between two groups. */\n helpEntries?: MainMenuHelpEntry[][];\n /** A count in a red badge on the Help & Support item. */\n helpBadge?: number;\n /** The Help & Support item looks current, for example on the New Features page. */\n helpCurrent?: boolean;\n /** Draws the Help & Support item as a promotion. */\n helpPromo?: MainMenuHelpPromo;\n /** The `id` of the Help & Support item, for example a target of a feature pointer. */\n helpId?: string;\n /** A part right above Help & Support, for example a development tool. */\n beforeHelp?: ReactNode;\n /** The `id` of the Show more block, for example a target of a feature pointer. */\n showMoreId?: string;\n /** Draws an editor of the app in place of the DS editor. `exit` leaves edit mode, and moves the focus back to the edit button when `returnFocus` is true. */\n renderEditor?: (exit: (returnFocus?: boolean) => void) => ReactNode;\n /** The editor shows in place of the items. Uncontrolled when not set. */\n editMode?: boolean;\n defaultEditMode?: boolean;\n onEditModeChange?: (editMode: boolean) => void;\n /** Save in the editor. The menu leaves edit mode. */\n onSaveEdit?: (result: MainMenuEditResult) => void;\n /** The link of the logo. */\n homeHref?: string;\n /** A click on any link of the menu, for example to route in the app. */\n onNavigate?: (event: MouseEvent<HTMLAnchorElement>) => void;\n /** A touch screen: the edit button always shows, as under `(hover: none)`. */\n touch?: boolean;\n labels?: Partial<IMainMenuLabels>;\n}\n"],"mappings":"AA+DA;;AAkCA,OAAO,MAAMA,wBAAyC,GAAG;EACvDC,aAAa,EAAE,gBAAgB;EAC/BC,QAAQ,EAAE,6BAA6B;EACvCC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,SAAS,EAAE,WAAW;EACtBC,MAAM,EAAE,SAAS;EACjBC,QAAQ,EAAE,WAAW;EACrBC,QAAQ,EAAE,WAAW;EACrBC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,cAAc,EAAE,gBAAgB;EAChCC,OAAO,EAAE,SAAS;EAClBC,cAAc,EAAE,iBAAiB;EACjCC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,QAAQ;EAChBC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,QAAQ;EAChBC,OAAO,EAAE,SAAS;EAClBC,KAAK,EAAE;AACT,CAAC;;AAED","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":["DEFAULT_MAIN_MENU_LABELS","customizeMenu","collapse","expand","menu","edit","shortcuts","addNew","showMore","showLess","more","less","helpAndSupport","editing","restoreDefault","save","cancel","show","hide","delete","restore","close"],"sources":["../../../../src/components/MainMenu/types.ts"],"sourcesContent":["import { ComponentType, MouseEvent, ReactNode, SVGProps } from \"react\";\n\nexport type MainMenuIcon = ComponentType<SVGProps<SVGSVGElement>>;\n\nexport interface MainMenuItemData {\n /** The key of the item, for example \"projects\". The \"projects\" item carries the favorite projects. */\n id: string;\n text: string;\n icon: MainMenuIcon;\n href?: string;\n /** The `id` of the link, for example a target of a feature pointer. */\n elementId?: string;\n /** Marks the item current, besides `currentItem`, for example on a page under another item. */\n current?: boolean;\n /** Opens the link in a new tab with \"_blank\". */\n target?: string;\n rel?: string;\n /** A click on the link, before `onNavigate`. */\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n}\n\nexport interface MainMenuShortcutData {\n id: number | string;\n name: string;\n icon: MainMenuIcon;\n href?: string;\n /** Marks the shortcut current, for example when its page is open. */\n current?: boolean;\n /** Opens the link in a new tab with \"_blank\", for example an external shortcut. */\n target?: string;\n rel?: string;\n /** A click on the link, before `onNavigate`. */\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n}\n\nexport interface MainMenuFavoriteData {\n id: number | string;\n /** The display name, with the project number when the account shows it. */\n name: string;\n href?: string;\n}\n\nexport interface MainMenuHelpEntry {\n id: string;\n text: string;\n icon: MainMenuIcon;\n onClick?: (event: MouseEvent<HTMLElement>) => void;\n /** A count in a red badge after the text, for example the unseen new features. */\n badge?: number;\n /** Makes the entry a link. The menu closes on its click. */\n href?: string;\n target?: string;\n rel?: string;\n /** \"primary\" draws the text and the icon in the primary color, for example a promotion. */\n tone?: \"primary\";\n /** Content at the end of the entry, for example a discount chip. */\n end?: ReactNode;\n /** The `id` of the text, for example a target of a feature pointer. */\n elementId?: string;\n className?: string;\n tabIndex?: number;\n}\n\n/** A promotion in place of the Help & Support item: a primary filled item with its own icon and text. */\nexport interface MainMenuHelpPromo {\n label: string;\n icon: MainMenuIcon;\n}\n\nexport interface MainMenuEditResult {\n hidden: string[];\n deleted: Array<number | string>;\n}\n\nexport interface IMainMenuLabels {\n customizeMenu: string;\n collapse: string;\n expand: string;\n menu: string;\n edit: string;\n shortcuts: string;\n addNew: string;\n showMore: string;\n showLess: string;\n more: string;\n less: string;\n helpAndSupport: string;\n editing: string;\n restoreDefault: string;\n save: string;\n cancel: string;\n show: string;\n hide: string;\n delete: string;\n restore: string;\n close: string;\n}\n\nexport const DEFAULT_MAIN_MENU_LABELS: IMainMenuLabels = {\n customizeMenu: \"Customize Menu\",\n collapse: \"Collapse\",\n expand: \"Expand\",\n menu: \"MENU\",\n edit: \"Edit\",\n shortcuts: \"SHORTCUTS\",\n addNew: \"Add new\",\n showMore: \"Show more\",\n showLess: \"Show less\",\n more: \"More\",\n less: \"Less\",\n helpAndSupport: \"Help & Support\",\n editing: \"EDITING\",\n restoreDefault: \"Restore Default\",\n save: \"Save\",\n cancel: \"Cancel\",\n show: \"Show\",\n hide: \"Hide\",\n delete: \"Delete\",\n restore: \"Restore\",\n close: \"Close\",\n};\n\n/** The data and the handlers that the desktop menu and the drawer share. */\nexport interface IMainMenuDataProps {\n /** The items in their saved order. */\n items: MainMenuItemData[];\n /** The ids of the hidden items. They show under \"Show more\", and dimmed in the editor. */\n hiddenItems?: string[];\n /** The id of the item of the current page. */\n currentItem?: string;\n /** The favorite projects under the Projects item. */\n favorites?: MainMenuFavoriteData[];\n /** The id of the favorite project of the current page. */\n currentFavorite?: number | string;\n /** The favorite projects show under Projects. Uncontrolled when not set. */\n favoritesExpanded?: boolean;\n defaultFavoritesExpanded?: boolean;\n onFavoritesExpandedChange?: (expanded: boolean) => void;\n /** The shortcuts section. Not set, the menu has no shortcuts section. */\n shortcuts?: MainMenuShortcutData[];\n /** The shortcuts show under their heading. Uncontrolled when not set. */\n shortcutsExpanded?: boolean;\n defaultShortcutsExpanded?: boolean;\n onShortcutsExpandedChange?: (expanded: boolean) => void;\n /** The \"Add new\" row of the shortcuts. */\n onAddShortcut?: () => void;\n /** The groups of the Help & Support menu, with a separator between two groups. */\n helpEntries?: MainMenuHelpEntry[][];\n /** A count in a red badge on the Help & Support item. */\n helpBadge?: number;\n /** The Help & Support item looks current, for example on the New Features page. */\n helpCurrent?: boolean;\n /** Draws the Help & Support item as a promotion. */\n helpPromo?: MainMenuHelpPromo;\n /** The `id` of the Help & Support item, for example a target of a feature pointer. */\n helpId?: string;\n /** A part right above Help & Support, for example a development tool. */\n beforeHelp?: ReactNode;\n /** The `id` of the Show more block, for example a target of a feature pointer. */\n showMoreId?: string;\n /** Draws an editor of the app in place of the DS editor. `exit` leaves edit mode, and moves the focus back to the edit button when `returnFocus` is true. */\n renderEditor?: (exit: (returnFocus?: boolean) => void) => ReactNode;\n /** The editor shows in place of the items. Uncontrolled when not set. */\n editMode?: boolean;\n defaultEditMode?: boolean;\n onEditModeChange?: (editMode: boolean) => void;\n /** Save in the editor. The menu leaves edit mode. */\n onSaveEdit?: (result: MainMenuEditResult) => void;\n /** The link of the logo. */\n homeHref?: string;\n /** A click on any link of the menu, for example to route in the app. */\n onNavigate?: (event: MouseEvent<HTMLAnchorElement>) => void;\n /** A touch screen: the edit button always shows, as under `(hover: none)`. */\n touch?: boolean;\n labels?: Partial<IMainMenuLabels>;\n}\n"],"mappings":"AA+DA;;AAmCA,OAAO,MAAMA,wBAAyC,GAAG;EACvDC,aAAa,EAAE,gBAAgB;EAC/BC,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,QAAQ;EAChBC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,SAAS,EAAE,WAAW;EACtBC,MAAM,EAAE,SAAS;EACjBC,QAAQ,EAAE,WAAW;EACrBC,QAAQ,EAAE,WAAW;EACrBC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,cAAc,EAAE,gBAAgB;EAChCC,OAAO,EAAE,SAAS;EAClBC,cAAc,EAAE,iBAAiB;EACjCC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,QAAQ;EAChBC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,QAAQ;EAChBC,OAAO,EAAE,SAAS;EAClBC,KAAK,EAAE;AACT,CAAC;;AAED","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ import React, { CSSProperties, ReactNode } from "react";
2
+ export interface ScrollAreaValues {
3
+ /** The vertical position, from 0 at the top to 1 at the bottom. */
4
+ top: number;
5
+ /** The horizontal position, from 0 at the left to 1 at the right. */
6
+ left: number;
7
+ scrollTop: number;
8
+ scrollLeft: number;
9
+ scrollWidth: number;
10
+ scrollHeight: number;
11
+ clientWidth: number;
12
+ clientHeight: number;
13
+ }
14
+ export interface ScrollAreaHandle {
15
+ /** The element that scrolls. */
16
+ readonly view: HTMLDivElement | null;
17
+ getValues: () => ScrollAreaValues;
18
+ getScrollLeft: () => number;
19
+ getScrollTop: () => number;
20
+ scrollLeft: (left?: number) => void;
21
+ scrollTop: (top?: number) => void;
22
+ scrollToRight: () => void;
23
+ scrollToBottom: () => void;
24
+ }
25
+ export interface ScrollAreaProps {
26
+ children?: ReactNode;
27
+ className?: string;
28
+ style?: CSSProperties;
29
+ /** If true, the area is as high as its content, up to autoHeightMax. */
30
+ autoHeight?: boolean;
31
+ autoHeightMin?: number | string;
32
+ autoHeightMax?: number | string;
33
+ onScroll?: (event: Event) => void;
34
+ /** Called with the scroll values on every scroll and on every change of size. */
35
+ onUpdate?: (values: ScrollAreaValues) => void;
36
+ }
37
+ /** Scrollbars that look the same in every browser: they show while the content scrolls, and grow under the pointer. Needs the overlayscrollbars CSS once in the app. */
38
+ export declare const ScrollArea: React.ForwardRefExoticComponent<ScrollAreaProps & React.RefAttributes<ScrollAreaHandle>>;
39
+ //# sourceMappingURL=ScrollArea.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScrollArea.d.ts","sourceRoot":"","sources":["../../../../src/components/ScrollArea/ScrollArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,SAAS,EAKV,MAAM,OAAO,CAAC;AAOf,MAAM,WAAW,gBAAgB;IAC/B,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,gCAAgC;IAChC,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IACrC,SAAS,EAAE,MAAM,gBAAgB,CAAC;IAClC,aAAa,EAAE,MAAM,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,wEAAwE;IACxE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC,iFAAiF;IACjF,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC/C;AA2BD,wKAAwK;AACxK,eAAO,MAAM,UAAU,0FA0GtB,CAAC"}
@@ -0,0 +1,137 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React, { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
3
+ import classnames from "classnames";
4
+ import { OverlayScrollbars } from "overlayscrollbars";
5
+ import { SCROLL_AREA_THEME, StyledScrollArea } from "./Styles";
6
+ const ratio = (position, range) => range > 0 ? position / range : 0;
7
+ const valuesOf = view => {
8
+ const _ref = view != null ? view : {},
9
+ _ref$scrollTop = _ref.scrollTop,
10
+ scrollTop = _ref$scrollTop === void 0 ? 0 : _ref$scrollTop,
11
+ _ref$scrollLeft = _ref.scrollLeft,
12
+ scrollLeft = _ref$scrollLeft === void 0 ? 0 : _ref$scrollLeft,
13
+ _ref$scrollWidth = _ref.scrollWidth,
14
+ scrollWidth = _ref$scrollWidth === void 0 ? 0 : _ref$scrollWidth,
15
+ _ref$scrollHeight = _ref.scrollHeight,
16
+ scrollHeight = _ref$scrollHeight === void 0 ? 0 : _ref$scrollHeight,
17
+ _ref$clientWidth = _ref.clientWidth,
18
+ clientWidth = _ref$clientWidth === void 0 ? 0 : _ref$clientWidth,
19
+ _ref$clientHeight = _ref.clientHeight,
20
+ clientHeight = _ref$clientHeight === void 0 ? 0 : _ref$clientHeight;
21
+ return {
22
+ top: ratio(scrollTop, scrollHeight - clientHeight),
23
+ left: ratio(scrollLeft, scrollWidth - clientWidth),
24
+ scrollTop,
25
+ scrollLeft,
26
+ scrollWidth,
27
+ scrollHeight,
28
+ clientWidth,
29
+ clientHeight
30
+ };
31
+ };
32
+
33
+ /** Scrollbars that look the same in every browser: they show while the content scrolls, and grow under the pointer. Needs the overlayscrollbars CSS once in the app. */
34
+ export const ScrollArea = /*#__PURE__*/forwardRef((_ref2, ref) => {
35
+ let children = _ref2.children,
36
+ className = _ref2.className,
37
+ style = _ref2.style,
38
+ _ref2$autoHeight = _ref2.autoHeight,
39
+ autoHeight = _ref2$autoHeight === void 0 ? false : _ref2$autoHeight,
40
+ autoHeightMin = _ref2.autoHeightMin,
41
+ autoHeightMax = _ref2.autoHeightMax,
42
+ onScroll = _ref2.onScroll,
43
+ onUpdate = _ref2.onUpdate;
44
+ const hostRef = useRef(null);
45
+ const viewRef = useRef(null);
46
+ const handlersRef = useRef({
47
+ onScroll,
48
+ onUpdate
49
+ });
50
+ handlersRef.current = {
51
+ onScroll,
52
+ onUpdate
53
+ };
54
+ useImperativeHandle(ref, () => ({
55
+ get view() {
56
+ return viewRef.current;
57
+ },
58
+ getValues: () => valuesOf(viewRef.current),
59
+ getScrollLeft: () => {
60
+ var _viewRef$current$scro, _viewRef$current;
61
+ return (_viewRef$current$scro = (_viewRef$current = viewRef.current) == null ? void 0 : _viewRef$current.scrollLeft) != null ? _viewRef$current$scro : 0;
62
+ },
63
+ getScrollTop: () => {
64
+ var _viewRef$current$scro2, _viewRef$current2;
65
+ return (_viewRef$current$scro2 = (_viewRef$current2 = viewRef.current) == null ? void 0 : _viewRef$current2.scrollTop) != null ? _viewRef$current$scro2 : 0;
66
+ },
67
+ scrollLeft: function (left) {
68
+ if (left === void 0) {
69
+ left = 0;
70
+ }
71
+ if (viewRef.current) viewRef.current.scrollLeft = left;
72
+ },
73
+ scrollTop: function (top) {
74
+ if (top === void 0) {
75
+ top = 0;
76
+ }
77
+ if (viewRef.current) viewRef.current.scrollTop = top;
78
+ },
79
+ scrollToRight: () => {
80
+ if (viewRef.current) {
81
+ viewRef.current.scrollLeft = viewRef.current.scrollWidth;
82
+ }
83
+ },
84
+ scrollToBottom: () => {
85
+ if (viewRef.current) {
86
+ viewRef.current.scrollTop = viewRef.current.scrollHeight;
87
+ }
88
+ }
89
+ }), []);
90
+ useEffect(() => {
91
+ const host = hostRef.current;
92
+ const viewport = viewRef.current;
93
+ if (!host || !viewport) return undefined;
94
+ const update = () => handlersRef.current.onUpdate == null ? void 0 : handlersRef.current.onUpdate(valuesOf(viewRef.current));
95
+ const instance = OverlayScrollbars({
96
+ target: host,
97
+ elements: {
98
+ viewport
99
+ }
100
+ }, {
101
+ scrollbars: {
102
+ theme: SCROLL_AREA_THEME,
103
+ autoHide: "scroll",
104
+ autoHideDelay: 800
105
+ }
106
+ }, {
107
+ initialized: update,
108
+ updated: update,
109
+ scroll: (_instance, event) => {
110
+ handlersRef.current.onScroll == null || handlersRef.current.onScroll(event);
111
+ update();
112
+ }
113
+ });
114
+ return () => instance.destroy();
115
+ }, []);
116
+ return /*#__PURE__*/React.createElement(StyledScrollArea, {
117
+ ref: hostRef,
118
+ className: classnames("c-scroll-area", className),
119
+ style: autoHeight ? _extends({}, style, {
120
+ height: "auto",
121
+ minHeight: autoHeightMin,
122
+ maxHeight: autoHeightMax
123
+ }) : _extends({
124
+ width: "100%",
125
+ height: "100%"
126
+ }, style),
127
+ "data-overlayscrollbars-initialize": ""
128
+ }, /*#__PURE__*/React.createElement("div", {
129
+ ref: viewRef,
130
+ className: "c-scroll-area__view",
131
+ style: autoHeight ? {
132
+ maxHeight: autoHeightMax
133
+ } : undefined
134
+ }, children));
135
+ });
136
+ ScrollArea.displayName = "ScrollArea";
137
+ //# sourceMappingURL=ScrollArea.js.map