@activecollab/components 2.0.574 → 2.0.576

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 (121) hide show
  1. package/dist/cjs/components/MainMenu/MainMenu.js +44 -40
  2. package/dist/cjs/components/MainMenu/MainMenu.js.map +1 -1
  3. package/dist/cjs/components/MainMenu/MainMenuSettings.js +112 -0
  4. package/dist/cjs/components/MainMenu/MainMenuSettings.js.map +1 -0
  5. package/dist/cjs/components/MainMenu/Styles.js +8 -3
  6. package/dist/cjs/components/MainMenu/Styles.js.map +1 -1
  7. package/dist/cjs/components/MainMenu/hooks.js +1 -9
  8. package/dist/cjs/components/MainMenu/hooks.js.map +1 -1
  9. package/dist/cjs/components/MainMenu/types.js +4 -2
  10. package/dist/cjs/components/MainMenu/types.js.map +1 -1
  11. package/dist/cjs/components/Popper/Popper.js +14 -0
  12. package/dist/cjs/components/Popper/Popper.js.map +1 -1
  13. package/dist/cjs/components/Popper/anchorMove.js +42 -0
  14. package/dist/cjs/components/Popper/anchorMove.js.map +1 -0
  15. package/dist/cjs/components/ScrollArea/ScrollArea.js +5 -3
  16. package/dist/cjs/components/ScrollArea/ScrollArea.js.map +1 -1
  17. package/dist/cjs/components/ViewSettings/Styles.js +26 -0
  18. package/dist/cjs/components/ViewSettings/Styles.js.map +1 -0
  19. package/dist/cjs/components/ViewSettings/ViewSettings.js +96 -0
  20. package/dist/cjs/components/ViewSettings/ViewSettings.js.map +1 -0
  21. package/dist/cjs/components/ViewSettings/index.js +17 -0
  22. package/dist/cjs/components/ViewSettings/index.js.map +1 -0
  23. package/dist/cjs/components/ViewSwitcher/ApplyToAllTab.js +199 -0
  24. package/dist/cjs/components/ViewSwitcher/ApplyToAllTab.js.map +1 -0
  25. package/dist/cjs/components/ViewSwitcher/Styles.js +73 -61
  26. package/dist/cjs/components/ViewSwitcher/Styles.js.map +1 -1
  27. package/dist/cjs/components/ViewSwitcher/{ViewSwitcherMenu.js → SubViewSwitcher.js} +70 -22
  28. package/dist/cjs/components/ViewSwitcher/SubViewSwitcher.js.map +1 -0
  29. package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js +46 -184
  30. package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
  31. package/dist/cjs/components/ViewSwitcher/index.js +4 -4
  32. package/dist/cjs/components/ViewSwitcher/index.js.map +1 -1
  33. package/dist/cjs/components/ViewSwitcher/useApplyToAllOffer.js +179 -0
  34. package/dist/cjs/components/ViewSwitcher/useApplyToAllOffer.js.map +1 -0
  35. package/dist/cjs/components/index.js +12 -0
  36. package/dist/cjs/components/index.js.map +1 -1
  37. package/dist/cjs/presentation/shared/ActivityFeed.js +1 -2
  38. package/dist/cjs/presentation/shared/ActivityFeed.js.map +1 -1
  39. package/dist/esm/components/MainMenu/MainMenu.d.ts +6 -4
  40. package/dist/esm/components/MainMenu/MainMenu.d.ts.map +1 -1
  41. package/dist/esm/components/MainMenu/MainMenu.js +39 -40
  42. package/dist/esm/components/MainMenu/MainMenu.js.map +1 -1
  43. package/dist/esm/components/MainMenu/MainMenuSettings.d.ts +14 -0
  44. package/dist/esm/components/MainMenu/MainMenuSettings.d.ts.map +1 -0
  45. package/dist/esm/components/MainMenu/MainMenuSettings.js +84 -0
  46. package/dist/esm/components/MainMenu/MainMenuSettings.js.map +1 -0
  47. package/dist/esm/components/MainMenu/Styles.d.ts +11 -0
  48. package/dist/esm/components/MainMenu/Styles.d.ts.map +1 -1
  49. package/dist/esm/components/MainMenu/Styles.js +7 -2
  50. package/dist/esm/components/MainMenu/Styles.js.map +1 -1
  51. package/dist/esm/components/MainMenu/hooks.d.ts.map +1 -1
  52. package/dist/esm/components/MainMenu/hooks.js +1 -8
  53. package/dist/esm/components/MainMenu/hooks.js.map +1 -1
  54. package/dist/esm/components/MainMenu/types.d.ts +4 -2
  55. package/dist/esm/components/MainMenu/types.d.ts.map +1 -1
  56. package/dist/esm/components/MainMenu/types.js +4 -2
  57. package/dist/esm/components/MainMenu/types.js.map +1 -1
  58. package/dist/esm/components/Popper/Popper.d.ts.map +1 -1
  59. package/dist/esm/components/Popper/Popper.js +12 -0
  60. package/dist/esm/components/Popper/Popper.js.map +1 -1
  61. package/dist/esm/components/Popper/anchorMove.d.ts +4 -0
  62. package/dist/esm/components/Popper/anchorMove.d.ts.map +1 -0
  63. package/dist/esm/components/Popper/anchorMove.js +33 -0
  64. package/dist/esm/components/Popper/anchorMove.js.map +1 -0
  65. package/dist/esm/components/ScrollArea/ScrollArea.d.ts +2 -0
  66. package/dist/esm/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  67. package/dist/esm/components/ScrollArea/ScrollArea.js +5 -3
  68. package/dist/esm/components/ScrollArea/ScrollArea.js.map +1 -1
  69. package/dist/esm/components/ViewSettings/Styles.d.ts +4 -0
  70. package/dist/esm/components/ViewSettings/Styles.d.ts.map +1 -0
  71. package/dist/esm/components/ViewSettings/Styles.js +20 -0
  72. package/dist/esm/components/ViewSettings/Styles.js.map +1 -0
  73. package/dist/esm/components/ViewSettings/ViewSettings.d.ts +20 -0
  74. package/dist/esm/components/ViewSettings/ViewSettings.d.ts.map +1 -0
  75. package/dist/esm/components/ViewSettings/ViewSettings.js +87 -0
  76. package/dist/esm/components/ViewSettings/ViewSettings.js.map +1 -0
  77. package/dist/esm/components/ViewSettings/index.d.ts +2 -0
  78. package/dist/esm/components/ViewSettings/index.d.ts.map +1 -0
  79. package/dist/esm/components/ViewSettings/index.js +2 -0
  80. package/dist/esm/components/ViewSettings/index.js.map +1 -0
  81. package/dist/esm/components/ViewSwitcher/ApplyToAllTab.d.ts +24 -0
  82. package/dist/esm/components/ViewSwitcher/ApplyToAllTab.d.ts.map +1 -0
  83. package/dist/esm/components/ViewSwitcher/ApplyToAllTab.js +179 -0
  84. package/dist/esm/components/ViewSwitcher/ApplyToAllTab.js.map +1 -0
  85. package/dist/esm/components/ViewSwitcher/Styles.d.ts +15 -15
  86. package/dist/esm/components/ViewSwitcher/Styles.d.ts.map +1 -1
  87. package/dist/esm/components/ViewSwitcher/Styles.js +72 -60
  88. package/dist/esm/components/ViewSwitcher/Styles.js.map +1 -1
  89. package/dist/esm/components/ViewSwitcher/SubViewSwitcher.d.ts +50 -0
  90. package/dist/esm/components/ViewSwitcher/SubViewSwitcher.d.ts.map +1 -0
  91. package/dist/esm/components/ViewSwitcher/SubViewSwitcher.js +149 -0
  92. package/dist/esm/components/ViewSwitcher/SubViewSwitcher.js.map +1 -0
  93. package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts +8 -8
  94. package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts.map +1 -1
  95. package/dist/esm/components/ViewSwitcher/ViewSwitcher.js +48 -163
  96. package/dist/esm/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
  97. package/dist/esm/components/ViewSwitcher/index.d.ts +1 -1
  98. package/dist/esm/components/ViewSwitcher/index.d.ts.map +1 -1
  99. package/dist/esm/components/ViewSwitcher/index.js +1 -1
  100. package/dist/esm/components/ViewSwitcher/index.js.map +1 -1
  101. package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.d.ts +27 -0
  102. package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.d.ts.map +1 -0
  103. package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.js +159 -0
  104. package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.js.map +1 -0
  105. package/dist/esm/components/index.d.ts +1 -0
  106. package/dist/esm/components/index.d.ts.map +1 -1
  107. package/dist/esm/components/index.js +1 -0
  108. package/dist/esm/components/index.js.map +1 -1
  109. package/dist/esm/presentation/shared/ActivityFeed.d.ts.map +1 -1
  110. package/dist/esm/presentation/shared/ActivityFeed.js +1 -2
  111. package/dist/esm/presentation/shared/ActivityFeed.js.map +1 -1
  112. package/dist/index.js +1679 -1174
  113. package/dist/index.js.map +1 -1
  114. package/dist/index.min.js +1 -1
  115. package/dist/index.min.js.map +1 -1
  116. package/package.json +1 -1
  117. package/dist/cjs/components/ViewSwitcher/ViewSwitcherMenu.js.map +0 -1
  118. package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.d.ts +0 -39
  119. package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.d.ts.map +0 -1
  120. package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.js +0 -101
  121. package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Styles.js","names":["styled","keyframes","BoxSizingStyle","List","VIEW_SWITCHER_PROMPT_DELAY_MS","VIEW_SWITCHER_PROMPT_MS","VIEW_SWITCHER_APPLIED_MS","VIEW_SWITCHER_LEAVE_MS","StyledViewSwitcher","div","withConfig","displayName","componentId","StyledViewSwitcherTrack","StyledViewSwitcherOptions","StyledViewSwitcherOption","button","StyledViewSwitcherMenuOption","VIEW_SWITCHER_MENU_REVEAL_MS","VIEW_SWITCHER_MENU_GAP","menuReveal","menuConceal","menuClip","StyledViewSwitcherMenuRoot","StyledViewSwitcherMenuClip","StyledViewSwitcherMenuIcon","span","StyledViewSwitcherMenuList","StyledViewSwitcherMenuLabel","promptIn","promptOut","appliedIn","appliedIcon","StyledViewSwitcherPromptTitle","PROMPT_EASE","APPLIED_SWAP_MS","StyledViewSwitcherPrompt","StyledViewSwitcherPromptClip","StyledViewSwitcherPromptPill","StyledViewSwitcherAction","StyledViewSwitcherLine","i","StyledViewSwitcherDismiss","StyledViewSwitcherApplied"],"sources":["../../../../src/components/ViewSwitcher/Styles.ts"],"sourcesContent":["import styled, { keyframes } from \"styled-components\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { List } from \"../List\";\n\nexport const VIEW_SWITCHER_PROMPT_DELAY_MS = 100;\nexport const VIEW_SWITCHER_PROMPT_MS = 5000;\nexport const VIEW_SWITCHER_APPLIED_MS = 900;\nexport const VIEW_SWITCHER_LEAVE_MS = 200;\n\nexport const StyledViewSwitcher = styled.div`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n`;\n\nStyledViewSwitcher.displayName = \"StyledViewSwitcher\";\n\nexport const StyledViewSwitcherTrack = styled.div`\n ${BoxSizingStyle}\n position: relative;\n display: inline-flex;\n align-items: center;\n height: 32px;\n padding: 3px;\n border-radius: var(--ac-br-rounded);\n background-color: var(--color-theme-300);\n`;\n\nStyledViewSwitcherTrack.displayName = \"StyledViewSwitcherTrack\";\n\nexport const StyledViewSwitcherOptions = styled.div`\n display: inline-flex;\n align-items: center;\n`;\n\nStyledViewSwitcherOptions.displayName = \"StyledViewSwitcherOptions\";\n\nexport const StyledViewSwitcherOption = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: 34px;\n height: 26px;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: transparent;\n cursor: pointer;\n outline: none;\n transition: background-color 150ms ease, box-shadow 150ms ease;\n\n svg {\n width: 20px;\n height: 20px;\n fill: var(--color-theme-700);\n }\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-theme-900) 16%,\n transparent\n );\n }\n\n &[aria-checked=\"true\"] {\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-float);\n cursor: default;\n\n svg {\n fill: var(--color-theme-900);\n }\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherOption.displayName = \"StyledViewSwitcherOption\";\n\nexport const StyledViewSwitcherMenuOption = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 26px;\n margin: 0;\n padding: 0 8px 0 12px;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-float);\n color: var(--color-theme-900);\n font-size: calc(13px * var(--text-scale, 1));\n white-space: nowrap;\n cursor: pointer;\n outline: none;\n\n svg {\n flex-shrink: 0;\n fill: var(--color-theme-900);\n }\n\n &:has(.c-view-switcher-menu__icon) {\n padding-left: 8px;\n }\n\n .c-view-switcher-menu__values {\n display: inline-grid;\n }\n\n .c-view-switcher-menu__value {\n display: inline-flex;\n grid-area: 1 / 1;\n align-items: center;\n gap: 4px;\n visibility: hidden;\n }\n\n .c-view-switcher-menu__value[data-selected=\"true\"] {\n visibility: visible;\n }\n\n .c-view-switcher-menu__icon {\n display: inline-flex;\n flex-shrink: 0;\n }\n\n .c-view-switcher-menu__icon svg {\n width: 20px;\n height: 20px;\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherMenuOption.displayName = \"StyledViewSwitcherMenuOption\";\n\nconst VIEW_SWITCHER_MENU_REVEAL_MS = 200;\nconst VIEW_SWITCHER_MENU_GAP = 8;\n\nconst menuReveal = keyframes`\n from {\n grid-template-columns: 0fr;\n margin-right: -${VIEW_SWITCHER_MENU_GAP}px;\n }\n`;\n\nconst menuConceal = keyframes`\n to {\n grid-template-columns: 0fr;\n margin-right: -${VIEW_SWITCHER_MENU_GAP}px;\n }\n`;\n\nconst menuClip = keyframes`\n from,\n to {\n overflow: hidden;\n }\n`;\n\n// The width opens from nothing, so the controls beside the menu move aside with it.\nexport const StyledViewSwitcherMenuRoot = styled(StyledViewSwitcher)`\n display: inline-grid;\n grid-template-columns: 1fr;\n\n &[data-animate-in] {\n animation: ${menuReveal} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms\n cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n &[data-animate-in] > .c-view-switcher-menu__clip {\n animation: ${menuClip} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms;\n }\n\n &[data-leaving] {\n pointer-events: none;\n animation: ${menuConceal} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms\n cubic-bezier(0.4, 0, 0.2, 1) forwards;\n }\n\n &[data-leaving] > .c-view-switcher-menu__clip {\n overflow: hidden;\n }\n\n @media (prefers-reduced-motion: reduce) {\n &[data-animate-in],\n &[data-animate-in] > .c-view-switcher-menu__clip,\n &[data-leaving] {\n animation: none;\n }\n }\n`;\n\nStyledViewSwitcherMenuRoot.displayName = \"StyledViewSwitcherMenuRoot\";\n\nexport const StyledViewSwitcherMenuClip = styled.div`\n display: flex;\n min-width: 0;\n\n > * {\n flex-shrink: 0;\n }\n`;\n\nStyledViewSwitcherMenuClip.displayName = \"StyledViewSwitcherMenuClip\";\n\nexport const StyledViewSwitcherMenuIcon = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n margin-right: 8px;\n fill: var(--color-theme-900);\n`;\n\nStyledViewSwitcherMenuIcon.displayName = \"StyledViewSwitcherMenuIcon\";\n\nexport const StyledViewSwitcherMenuList = styled(List)`\n padding: 8px 0;\n`;\n\nStyledViewSwitcherMenuList.displayName = \"StyledViewSwitcherMenuList\";\n\nexport const StyledViewSwitcherMenuLabel = styled.span`\n flex: 1;\n\n &[data-selected=\"true\"] {\n font-weight: bold;\n color: var(--color-primary);\n }\n`;\n\nStyledViewSwitcherMenuLabel.displayName = \"StyledViewSwitcherMenuLabel\";\n\nconst promptIn = keyframes`\n from {\n opacity: 0;\n }\n`;\n\nconst promptOut = keyframes`\n to {\n clip-path: inset(0 0 0 100%);\n }\n`;\n\nconst appliedIn = keyframes`\n from {\n opacity: 0;\n transform: translateY(6px);\n }\n`;\n\nconst appliedIcon = keyframes`\n from {\n opacity: 0;\n transform: scale(0.4);\n }\n 60% {\n transform: scale(1.2);\n }\n`;\n\nexport const StyledViewSwitcherPromptTitle = styled.span`\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n`;\n\nStyledViewSwitcherPromptTitle.displayName = \"StyledViewSwitcherPromptTitle\";\n\nconst PROMPT_EASE = \"cubic-bezier(0.4, 0, 0.2, 1)\";\nconst APPLIED_SWAP_MS = 160;\n\n// The offer covers the buttons and keeps the width of the switcher, so nothing beside it moves.\nexport const StyledViewSwitcherPrompt = styled.div`\n ${BoxSizingStyle}\n position: absolute;\n top: 3px;\n right: 3px;\n bottom: 3px;\n z-index: 1;\n display: flex;\n min-width: calc(100% - 6px);\n animation: ${promptIn} ${VIEW_SWITCHER_LEAVE_MS}ms ${PROMPT_EASE};\n\n &[data-phase=\"applying\"],\n &[data-phase=\"applied\"] {\n pointer-events: none;\n }\n\n &[data-phase=\"applying\"] .c-view-switcher__prompt-pill {\n opacity: 0.7;\n }\n\n .c-view-switcher__action,\n .c-view-switcher__line,\n .c-view-switcher__dismiss {\n transition: opacity ${APPLIED_SWAP_MS}ms ${PROMPT_EASE},\n transform ${APPLIED_SWAP_MS}ms ${PROMPT_EASE},\n visibility 0s linear ${APPLIED_SWAP_MS}ms, background-color 150ms ease;\n }\n\n &[data-confirmed] .c-view-switcher__action,\n &[data-confirmed] .c-view-switcher__line,\n &[data-confirmed] .c-view-switcher__dismiss {\n visibility: hidden;\n opacity: 0;\n transform: translateY(-6px);\n }\n\n &[data-phase=\"leaving\"] {\n pointer-events: none;\n animation: ${promptOut} ${VIEW_SWITCHER_LEAVE_MS}ms ${PROMPT_EASE} forwards;\n }\n\n @media (prefers-reduced-motion: reduce) {\n animation: none;\n\n &[data-phase=\"leaving\"] {\n animation: none;\n }\n\n .c-view-switcher__action,\n .c-view-switcher__line,\n .c-view-switcher__dismiss,\n .c-view-switcher__prompt-pill {\n transition: none;\n }\n }\n`;\n\nStyledViewSwitcherPrompt.displayName = \"StyledViewSwitcherPrompt\";\n\nexport const StyledViewSwitcherPromptClip = styled.div`\n display: flex;\n flex: 1;\n min-width: 0;\n`;\n\nStyledViewSwitcherPromptClip.displayName = \"StyledViewSwitcherPromptClip\";\n\nexport const StyledViewSwitcherPromptPill = styled.div`\n ${BoxSizingStyle}\n position: relative;\n display: inline-flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n height: 26px;\n border-radius: var(--ac-br-rounded);\n background-color: var(--color-primary-opaque-300);\n color: var(--color-primary);\n font-size: calc(0.75rem * var(--text-scale, 1));\n font-weight: 500;\n white-space: nowrap;\n transition: opacity 150ms ease;\n`;\n\nStyledViewSwitcherPromptPill.displayName = \"StyledViewSwitcherPromptPill\";\n\nexport const StyledViewSwitcherAction = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 26px;\n margin: 0;\n padding: 0 2px 0 6px;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: transparent;\n color: inherit;\n font: inherit;\n cursor: pointer;\n outline: none;\n\n svg {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n fill: currentColor;\n }\n\n &:hover {\n color: var(--color-theme-900);\n }\n\n &:focus-visible {\n box-shadow: inset 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherAction.displayName = \"StyledViewSwitcherAction\";\n\nexport const StyledViewSwitcherLine = styled.i`\n flex-shrink: 0;\n width: 1px;\n height: 14px;\n margin: 0 1px 0 6px;\n background-color: color-mix(in srgb, var(--color-primary) 35%, transparent);\n`;\n\nStyledViewSwitcherLine.displayName = \"StyledViewSwitcherLine\";\n\nexport const StyledViewSwitcherDismiss = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n margin: 0 2px 0 0;\n padding: 0;\n border: 0;\n border-radius: 50%;\n background-color: transparent;\n cursor: pointer;\n outline: none;\n transition: background-color 150ms ease;\n\n svg {\n width: 16px;\n height: 16px;\n margin-left: -1px;\n fill: var(--color-theme-700);\n }\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-theme-900) 16%,\n transparent\n );\n }\n\n &:focus-visible {\n box-shadow: inset 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherDismiss.displayName = \"StyledViewSwitcherDismiss\";\n\nexport const StyledViewSwitcherApplied = styled.span`\n position: absolute;\n inset: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 4px;\n animation: ${appliedIn} ${APPLIED_SWAP_MS}ms ${PROMPT_EASE} 60ms backwards;\n\n svg {\n width: 16px;\n height: 16px;\n fill: currentColor;\n animation: ${appliedIcon} 250ms ease-out 60ms backwards;\n }\n\n @media (prefers-reduced-motion: reduce) {\n animation: none;\n\n svg {\n animation: none;\n }\n }\n`;\n\nStyledViewSwitcherApplied.displayName = \"StyledViewSwitcherApplied\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,SAAS,QAAQ,mBAAmB;AAErD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,IAAI,QAAQ,SAAS;AAE9B,OAAO,MAAMC,6BAA6B,GAAG,GAAG;AAChD,OAAO,MAAMC,uBAAuB,GAAG,IAAI;AAC3C,OAAO,MAAMC,wBAAwB,GAAG,GAAG;AAC3C,OAAO,MAAMC,sBAAsB,GAAG,GAAG;AAEzC,OAAO,MAAMC,kBAAkB,GAAGR,MAAM,CAACS,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,gDACxCV,cAAc,CAGjB;AAEDM,kBAAkB,CAACG,WAAW,GAAG,oBAAoB;AAErD,OAAO,MAAME,uBAAuB,GAAGb,MAAM,CAACS,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,0KAC7CV,cAAc,CAQjB;AAEDW,uBAAuB,CAACF,WAAW,GAAG,yBAAyB;AAE/D,OAAO,MAAMG,yBAAyB,GAAGd,MAAM,CAACS,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+CAGlD;AAEDE,yBAAyB,CAACH,WAAW,GAAG,2BAA2B;AAEnE,OAAO,MAAMI,wBAAwB,GAAGf,MAAM,CAACgB,MAAM,CAAAN,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,goBACjDV,cAAc,CA2CjB;AAEDa,wBAAwB,CAACJ,WAAW,GAAG,0BAA0B;AAEjE,OAAO,MAAMM,4BAA4B,GAAGjB,MAAM,CAACgB,MAAM,CAAAN,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,k1BACrDV,cAAc,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AC,WAAA;EAAAC,WAAA;AAAA,wIAM7C;AAED4B,sBAAsB,CAAC7B,WAAW,GAAG,wBAAwB;AAE7D,OAAO,MAAM+B,yBAAyB,GAAG1C,MAAM,CAACgB,MAAM,CAAAN,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,ueAClDV,cAAc,CAkCjB;AAEDwC,yBAAyB,CAAC/B,WAAW,GAAG,2BAA2B;AAEnE,OAAO,MAAMgC,yBAAyB,GAAG3C,MAAM,CAAC0B,IAAI,CAAAhB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,yTAOrCmB,SAAS,EAAII,eAAe,EAAMD,WAAW,EAM3CF,WAAW,CAU3B;AAEDW,yBAAyB,CAAChC,WAAW,GAAG,2BAA2B","ignoreList":[]}
1
+ {"version":3,"file":"Styles.js","names":["styled","keyframes","layers","DARK_THEME_SELECTOR","BoxSizingStyle","List","VIEW_SWITCHER_PROMPT_DELAY_MS","VIEW_SWITCHER_APPLIED_MS","VIEW_SWITCHER_OPEN_MS","VIEW_SWITCHER_LEAVE_MS","StyledViewSwitcher","div","withConfig","displayName","componentId","StyledViewSwitcherTrack","StyledViewSwitcherOptions","StyledViewSwitcherOption","button","StyledSubViewSwitcherOption","VIEW_SWITCHER_MENU_REVEAL_MS","VIEW_SWITCHER_MENU_GAP","menuReveal","menuConceal","menuClip","StyledSubViewSwitcherRoot","StyledSubViewSwitcherClip","StyledSubViewSwitcherIcon","span","StyledSubViewSwitcherList","StyledSubViewSwitcherLabel","StyledViewSwitcherPromptTitle","TAB_EASE","CONTROL_RADIUS","TAB_RING","TAB_RADIUS","TAB_INSET","BUTTON_RADIUS","slideOut","slideIn","appliedIcon","doneText","StyledApplyToAllTab","house","StyledApplyToAllSlide","StyledApplyToAllButton","StyledApplyToAllLine","i","StyledApplyToAllDismiss","StyledApplyToAllDone"],"sources":["../../../../src/components/ViewSwitcher/Styles.ts"],"sourcesContent":["import styled, { keyframes } from \"styled-components\";\n\nimport { layers } from \"../../utils/layers\";\nimport { DARK_THEME_SELECTOR } from \"../../utils/themes\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { List } from \"../List\";\n\nexport const VIEW_SWITCHER_PROMPT_DELAY_MS = 100;\nexport const VIEW_SWITCHER_APPLIED_MS = 1400;\nexport const VIEW_SWITCHER_OPEN_MS = 3000;\nexport const VIEW_SWITCHER_LEAVE_MS = 200;\n\nexport const StyledViewSwitcher = styled.div`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n isolation: isolate;\n`;\n\nStyledViewSwitcher.displayName = \"StyledViewSwitcher\";\n\nexport const StyledViewSwitcherTrack = styled.div`\n ${BoxSizingStyle}\n position: relative;\n display: inline-flex;\n align-items: center;\n height: 32px;\n padding: 3px;\n border-radius: var(--ac-br-rounded);\n background-color: var(--color-theme-300);\n z-index: 1;\n`;\n\nStyledViewSwitcherTrack.displayName = \"StyledViewSwitcherTrack\";\n\nexport const StyledViewSwitcherOptions = styled.div`\n display: inline-flex;\n align-items: center;\n`;\n\nStyledViewSwitcherOptions.displayName = \"StyledViewSwitcherOptions\";\n\nexport const StyledViewSwitcherOption = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: 34px;\n height: 26px;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: transparent;\n cursor: pointer;\n outline: none;\n transition: background-color 150ms ease, box-shadow 150ms ease;\n\n svg {\n width: 20px;\n height: 20px;\n fill: var(--color-theme-700);\n }\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-theme-900) 16%,\n transparent\n );\n }\n\n &[aria-checked=\"true\"] {\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-float);\n cursor: default;\n\n svg {\n fill: var(--color-theme-900);\n }\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherOption.displayName = \"StyledViewSwitcherOption\";\n\nexport const StyledSubViewSwitcherOption = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 26px;\n margin: 0;\n padding: 0 8px 0 12px;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-float);\n color: var(--color-theme-900);\n font-size: calc(13px * var(--text-scale, 1));\n white-space: nowrap;\n cursor: pointer;\n outline: none;\n\n svg {\n flex-shrink: 0;\n fill: var(--color-theme-900);\n }\n\n &:has(.c-sub-view-switcher__icon) {\n padding-left: 8px;\n }\n\n .c-sub-view-switcher__values {\n display: inline-grid;\n }\n\n .c-sub-view-switcher__value {\n display: inline-flex;\n grid-area: 1 / 1;\n align-items: center;\n gap: 4px;\n visibility: hidden;\n }\n\n .c-sub-view-switcher__value[data-selected=\"true\"] {\n visibility: visible;\n }\n\n .c-sub-view-switcher__icon {\n display: inline-flex;\n flex-shrink: 0;\n }\n\n .c-sub-view-switcher__icon svg {\n width: 20px;\n height: 20px;\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledSubViewSwitcherOption.displayName = \"StyledSubViewSwitcherOption\";\n\nconst VIEW_SWITCHER_MENU_REVEAL_MS = 200;\nconst VIEW_SWITCHER_MENU_GAP = 8;\n\nconst menuReveal = keyframes`\n from {\n grid-template-columns: 0fr;\n margin-right: -${VIEW_SWITCHER_MENU_GAP}px;\n }\n`;\n\nconst menuConceal = keyframes`\n to {\n grid-template-columns: 0fr;\n margin-right: -${VIEW_SWITCHER_MENU_GAP}px;\n }\n`;\n\nconst menuClip = keyframes`\n from,\n to {\n overflow: hidden;\n }\n`;\n\n// The width opens from nothing, so the controls beside the menu move aside with it.\nexport const StyledSubViewSwitcherRoot = styled(StyledViewSwitcher)`\n display: inline-grid;\n grid-template-columns: 1fr;\n\n &[data-animate-in] {\n animation: ${menuReveal} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms\n cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n &[data-animate-in] > .c-sub-view-switcher__clip {\n animation: ${menuClip} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms;\n }\n\n &[data-leaving] {\n pointer-events: none;\n animation: ${menuConceal} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms\n cubic-bezier(0.4, 0, 0.2, 1) forwards;\n }\n\n &[data-leaving] > .c-sub-view-switcher__clip {\n overflow: hidden;\n }\n\n @media (prefers-reduced-motion: reduce) {\n &[data-animate-in],\n &[data-animate-in] > .c-sub-view-switcher__clip,\n &[data-leaving] {\n animation: none;\n }\n }\n`;\n\nStyledSubViewSwitcherRoot.displayName = \"StyledSubViewSwitcherRoot\";\n\nexport const StyledSubViewSwitcherClip = styled.div`\n display: flex;\n min-width: 0;\n\n > * {\n flex-shrink: 0;\n }\n`;\n\nStyledSubViewSwitcherClip.displayName = \"StyledSubViewSwitcherClip\";\n\nexport const StyledSubViewSwitcherIcon = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n margin-right: 8px;\n fill: var(--color-theme-900);\n`;\n\nStyledSubViewSwitcherIcon.displayName = \"StyledSubViewSwitcherIcon\";\n\nexport const StyledSubViewSwitcherList = styled(List)`\n padding: 8px 0;\n`;\n\nStyledSubViewSwitcherList.displayName = \"StyledSubViewSwitcherList\";\n\nexport const StyledSubViewSwitcherLabel = styled.span`\n flex: 1;\n\n &[data-selected=\"true\"] {\n font-weight: bold;\n color: var(--color-primary);\n }\n`;\n\nStyledSubViewSwitcherLabel.displayName = \"StyledSubViewSwitcherLabel\";\n\nexport const StyledViewSwitcherPromptTitle = styled.span`\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n`;\n\nStyledViewSwitcherPromptTitle.displayName = \"StyledViewSwitcherPromptTitle\";\n\nconst TAB_EASE = \"cubic-bezier(0.4, 0, 0.2, 1)\";\n// The radius of a 32px control.\nconst CONTROL_RADIUS = 16;\n// The green shows this much around the top and the sides of the control.\nexport const TAB_RING = 2;\nconst TAB_RADIUS = CONTROL_RADIUS + TAB_RING;\n// The buttons sit this far inside the green, so their corners follow its corners.\nconst TAB_INSET = 3;\nconst BUTTON_RADIUS = TAB_RADIUS - TAB_INSET;\n\nconst slideOut = keyframes`\n from {\n transform: translateY(-100%);\n }\n`;\n\nconst slideIn = keyframes`\n to {\n transform: translateY(-100%);\n }\n`;\n\nconst appliedIcon = keyframes`\n from {\n transform: scale(0.3);\n }\n 60% {\n transform: scale(1.2);\n }\n`;\n\nconst doneText = keyframes`\n from {\n opacity: 0;\n transform: translateX(-4px);\n }\n`;\n\n// The tab rings the control and clips its slide, which comes out from under the control.\nexport const StyledApplyToAllTab = styled.div`\n ${BoxSizingStyle}\n z-index: ${layers.house - 1};\n overflow: hidden;\n border-radius: ${TAB_RADIUS}px;\n /* One green per theme kind, with enough contrast for the white check. */\n --apply-to-all-fill: #1f9d5a;\n\n ${DARK_THEME_SELECTOR} & {\n --apply-to-all-fill: #2f8f5e;\n }\n\n &[data-phase=\"applying\"],\n &[data-phase=\"applied\"],\n &[data-phase=\"leaving\"] {\n pointer-events: none;\n }\n\n &[data-phase=\"applying\"] .c-apply-to-all__button {\n opacity: 0.7;\n }\n\n .c-apply-to-all__slide {\n animation: ${slideOut} ${VIEW_SWITCHER_LEAVE_MS}ms ${TAB_EASE};\n }\n\n &[data-phase=\"leaving\"] .c-apply-to-all__slide {\n animation: ${slideIn} ${VIEW_SWITCHER_LEAVE_MS}ms ${TAB_EASE} forwards;\n }\n\n .c-apply-to-all__label {\n display: none;\n }\n\n /* A wide tab has room for the text of the apply button and of its confirmation. */\n &[data-labeled] .c-apply-to-all__label {\n display: inline;\n }\n\n &:not([data-labeled]) .c-apply-to-all__done-text {\n display: none;\n }\n\n @media (prefers-reduced-motion: reduce) {\n .c-apply-to-all__slide,\n &[data-phase=\"leaving\"] .c-apply-to-all__slide {\n animation: none;\n }\n }\n`;\n\nStyledApplyToAllTab.displayName = \"StyledApplyToAllTab\";\n\n// The green part of the tab. Its top sits under the control.\nexport const StyledApplyToAllSlide = styled.div`\n ${BoxSizingStyle}\n display: flex;\n align-items: center;\n padding: calc(var(--apply-to-all-tuck) + ${TAB_INSET}px) ${TAB_INSET}px\n ${TAB_INSET}px;\n border-radius: inherit;\n background-color: var(--apply-to-all-fill);\n`;\n\nStyledApplyToAllSlide.displayName = \"StyledApplyToAllSlide\";\n\n// The apply button takes the room the dismiss button leaves, and only its outer bottom corner is round.\nexport const StyledApplyToAllButton = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n gap: 4px;\n min-width: 34px;\n height: 26px;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0 0 0 ${BUTTON_RADIUS}px;\n background-color: transparent;\n color: #fff;\n font-size: calc(0.75rem * var(--text-scale, 1));\n font-weight: 600;\n white-space: nowrap;\n cursor: pointer;\n outline: none;\n transition: background-color 150ms ease, opacity 150ms ease;\n\n svg {\n flex-shrink: 0;\n width: 20px;\n height: 20px;\n fill: #fff;\n }\n\n &:hover {\n background-color: color-mix(in srgb, #fff 16%, transparent);\n }\n\n &:focus-visible {\n box-shadow: inset 0 0 0 2px #fff;\n }\n`;\n\nStyledApplyToAllButton.displayName = \"StyledApplyToAllButton\";\n\n// The line takes the height of the buttons.\nexport const StyledApplyToAllLine = styled.i`\n flex-shrink: 0;\n width: 1px;\n height: 26px;\n margin: 0 1px;\n background-color: color-mix(in srgb, #fff 35%, transparent);\n`;\n\nStyledApplyToAllLine.displayName = \"StyledApplyToAllLine\";\n\nexport const StyledApplyToAllDismiss = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: 26px;\n height: 26px;\n margin: 0;\n padding: 0 2px;\n border: 0;\n border-radius: 0 0 ${BUTTON_RADIUS}px 0;\n background-color: transparent;\n cursor: pointer;\n outline: none;\n transition: background-color 150ms ease;\n\n /* The same size as the check. */\n svg {\n width: 20px;\n height: 20px;\n fill: #fff;\n }\n\n &:hover {\n background-color: color-mix(in srgb, #fff 16%, transparent);\n }\n\n &:focus-visible {\n box-shadow: inset 0 0 0 2px #fff;\n }\n`;\n\nStyledApplyToAllDismiss.displayName = \"StyledApplyToAllDismiss\";\n\n// The confirmation takes the place of the buttons, at the size of the tab.\nexport const StyledApplyToAllDone = styled.span`\n ${BoxSizingStyle}\n display: inline-flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n gap: 4px;\n height: 26px;\n overflow: hidden;\n color: #fff;\n font-size: calc(0.75rem * var(--text-scale, 1));\n font-weight: 600;\n white-space: nowrap;\n\n svg {\n flex-shrink: 0;\n width: 18px;\n height: 18px;\n fill: currentColor;\n animation: ${appliedIcon} 320ms cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n .c-apply-to-all__done-text {\n animation: ${doneText} 220ms ${TAB_EASE} 80ms backwards;\n }\n\n @media (prefers-reduced-motion: reduce) {\n svg,\n .c-apply-to-all__done-text {\n animation: none;\n }\n }\n`;\n\nStyledApplyToAllDone.displayName = \"StyledApplyToAllDone\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,SAAS,QAAQ,mBAAmB;AAErD,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,mBAAmB,QAAQ,oBAAoB;AACxD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,IAAI,QAAQ,SAAS;AAE9B,OAAO,MAAMC,6BAA6B,GAAG,GAAG;AAChD,OAAO,MAAMC,wBAAwB,GAAG,IAAI;AAC5C,OAAO,MAAMC,qBAAqB,GAAG,IAAI;AACzC,OAAO,MAAMC,sBAAsB,GAAG,GAAG;AAEzC,OAAO,MAAMC,kBAAkB,GAAGV,MAAM,CAACW,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,kEACxCV,cAAc,CAIjB;AAEDM,kBAAkB,CAACG,WAAW,GAAG,oBAAoB;AAErD,OAAO,MAAME,uBAAuB,GAAGf,MAA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ViewSwitcherOption {
3
+ id: string;
4
+ label: string;
5
+ /** DS icon element. */
6
+ icon?: ReactNode;
7
+ }
8
+ export interface SubViewSwitcherProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
9
+ options: SubViewSwitcherOption[];
10
+ /** Id of the selected option. */
11
+ value?: string;
12
+ onChange: (id: string) => void;
13
+ /** Accessible name of the trigger. The selected option follows it. */
14
+ "aria-label"?: string;
15
+ /** Opens with a clip from zero width when it mounts, and pushes the controls beside it aside. */
16
+ animateIn?: boolean;
17
+ /** Closes with the same clip. The parent removes the menu after it, 200 ms later. */
18
+ leaving?: boolean;
19
+ /** Turns on the check button that slides out after a choice. A result of false shows no confirmation. */
20
+ onApplyToAll?: (id: string) => unknown;
21
+ /** Tooltip and accessible name of the check button. */
22
+ applyToAllTitle?: string;
23
+ /** Text that a screen reader reads after the apply. */
24
+ appliedLabel?: string;
25
+ /** Tooltip and accessible name of the button that closes the extra action. */
26
+ /** Visible text of the apply button, shown where it has room. */
27
+ applyToAllLabel?: string;
28
+ dismissLabel?: string;
29
+ }
30
+ /**
31
+ * @component SubViewSwitcher
32
+ * @description
33
+ * The sub view switcher, the second level of the main ViewSwitcher: a dropdown with the look of the checked option. It
34
+ * shows the icon and the name of the selected option and lists all options with their icons. Its width
35
+ * fits the widest option, so a new selection does not move the controls around it. With onApplyToAll, a
36
+ * choice slides a check button out from under its right end, the same as in ViewSwitcher.
37
+ *
38
+ * @example
39
+ * <SubViewSwitcher
40
+ * aria-label="Group by"
41
+ * options={[
42
+ * { id: "start_date", label: "Start Date", icon: <ClockIcon /> },
43
+ * { id: "date", label: "Due Date", icon: <CalendarIcon /> },
44
+ * ]}
45
+ * value={view}
46
+ * onChange={setView}
47
+ * />
48
+ */
49
+ export declare const SubViewSwitcher: React.ForwardRefExoticComponent<SubViewSwitcherProps & React.RefAttributes<HTMLDivElement>>;
50
+ //# sourceMappingURL=SubViewSwitcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubViewSwitcher.d.ts","sourceRoot":"","sources":["../../../../src/components/ViewSwitcher/SubViewSwitcher.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,cAAc,EAEd,SAAS,EAIV,MAAM,OAAO,CAAC;AAoBf,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,oBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACxD,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iGAAiG;IACjG,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yGAAyG;IACzG,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,iEAAiE;IACjE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,eAAe,6FAyI3B,CAAC"}
@@ -0,0 +1,149 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["options", "value", "onChange", "aria-label", "animateIn", "leaving", "onApplyToAll", "applyToAllTitle", "appliedLabel", "applyToAllLabel", "dismissLabel", "className", "onKeyDown", "onBlur"];
4
+ import React, { forwardRef, useCallback, useRef, useState } from "react";
5
+ import classnames from "classnames";
6
+ import { ApplyToAllTab } from "./ApplyToAllTab";
7
+ import { StyledSubViewSwitcherClip, StyledSubViewSwitcherIcon, StyledSubViewSwitcherLabel, StyledSubViewSwitcherList, StyledSubViewSwitcherOption, StyledSubViewSwitcherRoot, StyledViewSwitcherTrack } from "./Styles";
8
+ import { useApplyToAllOffer } from "./useApplyToAllOffer";
9
+ import useForkRef from "../../utils/useForkRef";
10
+ import { ArrowDownSmallIcon } from "../Icons";
11
+ import { ListItem } from "../List";
12
+ import { Menu } from "../Menu";
13
+ /**
14
+ * @component SubViewSwitcher
15
+ * @description
16
+ * The sub view switcher, the second level of the main ViewSwitcher: a dropdown with the look of the checked option. It
17
+ * shows the icon and the name of the selected option and lists all options with their icons. Its width
18
+ * fits the widest option, so a new selection does not move the controls around it. With onApplyToAll, a
19
+ * choice slides a check button out from under its right end, the same as in ViewSwitcher.
20
+ *
21
+ * @example
22
+ * <SubViewSwitcher
23
+ * aria-label="Group by"
24
+ * options={[
25
+ * { id: "start_date", label: "Start Date", icon: <ClockIcon /> },
26
+ * { id: "date", label: "Due Date", icon: <CalendarIcon /> },
27
+ * ]}
28
+ * value={view}
29
+ * onChange={setView}
30
+ * />
31
+ */
32
+ export const SubViewSwitcher = /*#__PURE__*/forwardRef((_ref, ref) => {
33
+ var _options$find;
34
+ let options = _ref.options,
35
+ value = _ref.value,
36
+ onChange = _ref.onChange,
37
+ ariaLabel = _ref["aria-label"],
38
+ _ref$animateIn = _ref.animateIn,
39
+ animateIn = _ref$animateIn === void 0 ? false : _ref$animateIn,
40
+ _ref$leaving = _ref.leaving,
41
+ leaving = _ref$leaving === void 0 ? false : _ref$leaving,
42
+ onApplyToAll = _ref.onApplyToAll,
43
+ _ref$applyToAllTitle = _ref.applyToAllTitle,
44
+ applyToAllTitle = _ref$applyToAllTitle === void 0 ? "Apply to All Projects" : _ref$applyToAllTitle,
45
+ _ref$appliedLabel = _ref.appliedLabel,
46
+ appliedLabel = _ref$appliedLabel === void 0 ? "Applied" : _ref$appliedLabel,
47
+ _ref$applyToAllLabel = _ref.applyToAllLabel,
48
+ applyToAllLabel = _ref$applyToAllLabel === void 0 ? "All Projects?" : _ref$applyToAllLabel,
49
+ _ref$dismissLabel = _ref.dismissLabel,
50
+ dismissLabel = _ref$dismissLabel === void 0 ? "Dismiss" : _ref$dismissLabel,
51
+ className = _ref.className,
52
+ onKeyDown = _ref.onKeyDown,
53
+ onBlur = _ref.onBlur,
54
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
55
+ const _useState = useState(false),
56
+ open = _useState[0],
57
+ setOpen = _useState[1];
58
+ const selected = (_options$find = options.find(_ref2 => {
59
+ let id = _ref2.id;
60
+ return id === value;
61
+ })) != null ? _options$find : options[0];
62
+ const rootRef = useRef(null);
63
+ const handleRootRef = useForkRef(rootRef, ref);
64
+ const triggerRef = useRef(null);
65
+ const focusTrigger = useCallback(() => {
66
+ var _triggerRef$current;
67
+ return (_triggerRef$current = triggerRef.current) == null ? void 0 : _triggerRef$current.focus();
68
+ }, []);
69
+ const offer = useApplyToAllOffer({
70
+ rootRef,
71
+ onApplyToAll,
72
+ onRestoreFocus: focusTrigger
73
+ });
74
+ return /*#__PURE__*/React.createElement(StyledSubViewSwitcherRoot, _extends({
75
+ ref: handleRootRef,
76
+ "data-animate-in": animateIn || undefined,
77
+ "data-leaving": leaving || undefined,
78
+ className: classnames("c-sub-view-switcher", className),
79
+ onKeyDown: event => {
80
+ onKeyDown == null || onKeyDown(event);
81
+ offer.handleKeyDown(event);
82
+ },
83
+ onBlur: event => {
84
+ onBlur == null || onBlur(event);
85
+ offer.handleBlur(event);
86
+ }
87
+ }, rest), /*#__PURE__*/React.createElement(StyledSubViewSwitcherClip, {
88
+ className: "c-sub-view-switcher__clip"
89
+ }, /*#__PURE__*/React.createElement(Menu, {
90
+ open: open,
91
+ onOpen: () => setOpen(true),
92
+ onClose: () => setOpen(false),
93
+ position: "bottom-end",
94
+ target: /*#__PURE__*/React.createElement(StyledViewSwitcherTrack, {
95
+ className: "c-view-switcher__track"
96
+ }, /*#__PURE__*/React.createElement(StyledSubViewSwitcherOption, {
97
+ ref: triggerRef,
98
+ type: "button",
99
+ "aria-haspopup": "menu",
100
+ "aria-expanded": open,
101
+ "aria-label": ariaLabel ? ariaLabel + ": " + (selected == null ? void 0 : selected.label) : selected == null ? void 0 : selected.label,
102
+ className: "c-sub-view-switcher__trigger"
103
+ }, /*#__PURE__*/React.createElement("span", {
104
+ className: "c-sub-view-switcher__values"
105
+ }, options.map(_ref3 => {
106
+ let id = _ref3.id,
107
+ label = _ref3.label,
108
+ icon = _ref3.icon;
109
+ return /*#__PURE__*/React.createElement("span", {
110
+ key: id,
111
+ "aria-hidden": id !== (selected == null ? void 0 : selected.id),
112
+ "data-selected": id === (selected == null ? void 0 : selected.id),
113
+ className: "c-sub-view-switcher__value"
114
+ }, icon ? /*#__PURE__*/React.createElement("span", {
115
+ className: "c-sub-view-switcher__icon"
116
+ }, icon) : null, label);
117
+ })), /*#__PURE__*/React.createElement(ArrowDownSmallIcon, null)))
118
+ }, /*#__PURE__*/React.createElement(StyledSubViewSwitcherList, null, options.map(_ref4 => {
119
+ let id = _ref4.id,
120
+ label = _ref4.label,
121
+ icon = _ref4.icon;
122
+ return /*#__PURE__*/React.createElement(ListItem, {
123
+ key: id,
124
+ "aria-selected": id === (selected == null ? void 0 : selected.id),
125
+ onClick: () => {
126
+ setOpen(false);
127
+ if (id !== value) {
128
+ onChange(id);
129
+ offer.show(id);
130
+ }
131
+ }
132
+ }, icon ? /*#__PURE__*/React.createElement(StyledSubViewSwitcherIcon, null, icon) : null, /*#__PURE__*/React.createElement(StyledSubViewSwitcherLabel, {
133
+ "data-selected": id === (selected == null ? void 0 : selected.id)
134
+ }, label));
135
+ }))), offer.isShown ? /*#__PURE__*/React.createElement(ApplyToAllTab, {
136
+ ref: offer.tabRef,
137
+ phase: offer.phase,
138
+ isConfirmed: offer.isConfirmed,
139
+ title: applyToAllTitle,
140
+ appliedLabel: appliedLabel,
141
+ onApply: offer.apply,
142
+ onDismiss: offer.leave,
143
+ onHold: offer.hold,
144
+ dismissLabel: dismissLabel,
145
+ applyToAllLabel: applyToAllLabel
146
+ }) : null));
147
+ });
148
+ SubViewSwitcher.displayName = "SubViewSwitcher";
149
+ //# sourceMappingURL=SubViewSwitcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubViewSwitcher.js","names":["React","forwardRef","useCallback","useRef","useState","classnames","ApplyToAllTab","StyledSubViewSwitcherClip","StyledSubViewSwitcherIcon","StyledSubViewSwitcherLabel","StyledSubViewSwitcherList","StyledSubViewSwitcherOption","StyledSubViewSwitcherRoot","StyledViewSwitcherTrack","useApplyToAllOffer","useForkRef","ArrowDownSmallIcon","ListItem","Menu","SubViewSwitcher","_ref","ref","_options$find","options","value","onChange","ariaLabel","_ref$animateIn","animateIn","_ref$leaving","leaving","onApplyToAll","_ref$applyToAllTitle","applyToAllTitle","_ref$appliedLabel","appliedLabel","_ref$applyToAllLabel","applyToAllLabel","_ref$dismissLabel","dismissLabel","className","onKeyDown","onBlur","rest","_objectWithoutPropertiesLoose","_excluded","_useState","open","setOpen","selected","find","_ref2","id","rootRef","handleRootRef","triggerRef","focusTrigger","_triggerRef$current","current","focus","offer","onRestoreFocus","createElement","_extends","undefined","event","handleKeyDown","handleBlur","onOpen","onClose","position","target","type","label","map","_ref3","icon","key","_ref4","onClick","show","isShown","tabRef","phase","isConfirmed","title","onApply","apply","onDismiss","leave","onHold","hold","displayName"],"sources":["../../../../src/components/ViewSwitcher/SubViewSwitcher.tsx"],"sourcesContent":["import React, {\n FocusEvent,\n forwardRef,\n HTMLAttributes,\n KeyboardEvent,\n ReactNode,\n useCallback,\n useRef,\n useState,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { ApplyToAllTab } from \"./ApplyToAllTab\";\nimport {\n StyledSubViewSwitcherClip,\n StyledSubViewSwitcherIcon,\n StyledSubViewSwitcherLabel,\n StyledSubViewSwitcherList,\n StyledSubViewSwitcherOption,\n StyledSubViewSwitcherRoot,\n StyledViewSwitcherTrack,\n} from \"./Styles\";\nimport { useApplyToAllOffer } from \"./useApplyToAllOffer\";\nimport useForkRef from \"../../utils/useForkRef\";\nimport { ArrowDownSmallIcon } from \"../Icons\";\nimport { ListItem } from \"../List\";\nimport { Menu } from \"../Menu\";\n\nexport interface SubViewSwitcherOption {\n id: string;\n label: string;\n /** DS icon element. */\n icon?: ReactNode;\n}\n\nexport interface SubViewSwitcherProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n options: SubViewSwitcherOption[];\n /** Id of the selected option. */\n value?: string;\n onChange: (id: string) => void;\n /** Accessible name of the trigger. The selected option follows it. */\n \"aria-label\"?: string;\n /** Opens with a clip from zero width when it mounts, and pushes the controls beside it aside. */\n animateIn?: boolean;\n /** Closes with the same clip. The parent removes the menu after it, 200 ms later. */\n leaving?: boolean;\n /** Turns on the check button that slides out after a choice. A result of false shows no confirmation. */\n onApplyToAll?: (id: string) => unknown;\n /** Tooltip and accessible name of the check button. */\n applyToAllTitle?: string;\n /** Text that a screen reader reads after the apply. */\n appliedLabel?: string;\n /** Tooltip and accessible name of the button that closes the extra action. */\n /** Visible text of the apply button, shown where it has room. */\n applyToAllLabel?: string;\n dismissLabel?: string;\n}\n\n/**\n * @component SubViewSwitcher\n * @description\n * The sub view switcher, the second level of the main ViewSwitcher: a dropdown with the look of the checked option. It\n * shows the icon and the name of the selected option and lists all options with their icons. Its width\n * fits the widest option, so a new selection does not move the controls around it. With onApplyToAll, a\n * choice slides a check button out from under its right end, the same as in ViewSwitcher.\n *\n * @example\n * <SubViewSwitcher\n * aria-label=\"Group by\"\n * options={[\n * { id: \"start_date\", label: \"Start Date\", icon: <ClockIcon /> },\n * { id: \"date\", label: \"Due Date\", icon: <CalendarIcon /> },\n * ]}\n * value={view}\n * onChange={setView}\n * />\n */\nexport const SubViewSwitcher = forwardRef<HTMLDivElement, SubViewSwitcherProps>(\n (\n {\n options,\n value,\n onChange,\n \"aria-label\": ariaLabel,\n animateIn = false,\n leaving = false,\n onApplyToAll,\n applyToAllTitle = \"Apply to All Projects\",\n appliedLabel = \"Applied\",\n applyToAllLabel = \"All Projects?\",\n dismissLabel = \"Dismiss\",\n className,\n onKeyDown,\n onBlur,\n ...rest\n },\n ref\n ) => {\n const [open, setOpen] = useState(false);\n const selected = options.find(({ id }) => id === value) ?? options[0];\n const rootRef = useRef<HTMLDivElement | null>(null);\n const handleRootRef = useForkRef(rootRef, ref);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const focusTrigger = useCallback(() => triggerRef.current?.focus(), []);\n const offer = useApplyToAllOffer<string>({\n rootRef,\n onApplyToAll,\n onRestoreFocus: focusTrigger,\n });\n\n return (\n <StyledSubViewSwitcherRoot\n ref={handleRootRef}\n data-animate-in={animateIn || undefined}\n data-leaving={leaving || undefined}\n className={classnames(\"c-sub-view-switcher\", className)}\n onKeyDown={(event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n offer.handleKeyDown(event);\n }}\n onBlur={(event: FocusEvent<HTMLDivElement>) => {\n onBlur?.(event);\n offer.handleBlur(event);\n }}\n {...rest}\n >\n <StyledSubViewSwitcherClip className=\"c-sub-view-switcher__clip\">\n <Menu\n open={open}\n onOpen={() => setOpen(true)}\n onClose={() => setOpen(false)}\n position=\"bottom-end\"\n target={\n <StyledViewSwitcherTrack className=\"c-view-switcher__track\">\n <StyledSubViewSwitcherOption\n ref={triggerRef}\n type=\"button\"\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-label={\n ariaLabel\n ? `${ariaLabel}: ${selected?.label}`\n : selected?.label\n }\n className=\"c-sub-view-switcher__trigger\"\n >\n <span className=\"c-sub-view-switcher__values\">\n {options.map(({ id, label, icon }) => (\n <span\n key={id}\n aria-hidden={id !== selected?.id}\n data-selected={id === selected?.id}\n className=\"c-sub-view-switcher__value\"\n >\n {icon ? (\n <span className=\"c-sub-view-switcher__icon\">\n {icon}\n </span>\n ) : null}\n {label}\n </span>\n ))}\n </span>\n <ArrowDownSmallIcon />\n </StyledSubViewSwitcherOption>\n </StyledViewSwitcherTrack>\n }\n >\n <StyledSubViewSwitcherList>\n {options.map(({ id, label, icon }) => (\n <ListItem\n key={id}\n aria-selected={id === selected?.id}\n onClick={() => {\n setOpen(false);\n\n if (id !== value) {\n onChange(id);\n offer.show(id);\n }\n }}\n >\n {icon ? (\n <StyledSubViewSwitcherIcon>\n {icon}\n </StyledSubViewSwitcherIcon>\n ) : null}\n <StyledSubViewSwitcherLabel\n data-selected={id === selected?.id}\n >\n {label}\n </StyledSubViewSwitcherLabel>\n </ListItem>\n ))}\n </StyledSubViewSwitcherList>\n </Menu>\n {offer.isShown ? (\n <ApplyToAllTab\n ref={offer.tabRef}\n phase={offer.phase}\n isConfirmed={offer.isConfirmed}\n title={applyToAllTitle}\n appliedLabel={appliedLabel}\n onApply={offer.apply}\n onDismiss={offer.leave}\n onHold={offer.hold}\n dismissLabel={dismissLabel}\n applyToAllLabel={applyToAllLabel}\n />\n ) : null}\n </StyledSubViewSwitcherClip>\n </StyledSubViewSwitcherRoot>\n );\n }\n);\n\nSubViewSwitcher.displayName = \"SubViewSwitcher\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAEVC,UAAU,EAIVC,WAAW,EACXC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SACEC,yBAAyB,EACzBC,yBAAyB,EACzBC,0BAA0B,EAC1BC,yBAAyB,EACzBC,2BAA2B,EAC3BC,yBAAyB,EACzBC,uBAAuB,QAClB,UAAU;AACjB,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,SAASC,kBAAkB,QAAQ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KAAK,CAAC2B,KAAM;IACrBC,SAAS,EAAE5B,KAAK,CAAC6B,KAAM;IACvBC,MAAM,EAAE9B,KAAK,CAAC+B,IAAK;IACnBpD,YAAY,EAAEA,YAAa;IAC3BF,eAAe,EAAEA;EAAgB,CAClC,CAAC,GACA,IACqB,CACF,CAAC;AAEhC,CACF,CAAC;AAEDlB,eAAe,CAACyE,WAAW,GAAG,iBAAiB","ignoreList":[]}
@@ -15,25 +15,25 @@ export interface ViewSwitcherProps extends Omit<HTMLAttributes<HTMLDivElement>,
15
15
  "aria-label"?: string;
16
16
  /** Turns on the extra action offered after a switch. A result of false shows no confirmation. */
17
17
  onApplyToAll?: (id: string) => unknown;
18
- /** Short visible text of the extra action. */
19
- applyToAllLabel?: string;
20
18
  /** Tooltip and accessible name of the extra action. */
21
19
  applyToAllTitle?: string;
22
20
  /** Accessible name of the extra action group. Defaults to "Now in {label}". */
23
21
  offerTitle?: (view: ViewSwitcherView) => ReactNode;
24
- /** Accessible name of the button that dismisses the extra action. */
25
- dismissLabel?: string;
26
- /** Text that confirms the extra action. */
22
+ /** Text that a screen reader reads after the extra action. */
27
23
  appliedLabel?: string;
24
+ /** Tooltip and accessible name of the button that closes the extra action. */
25
+ /** Visible text of the apply button, shown where it has room. */
26
+ applyToAllLabel?: string;
27
+ dismissLabel?: string;
28
28
  /** A new value opens the extra action for the checked view, for a change made outside the buttons. */
29
29
  offerKey?: string | number;
30
30
  }
31
31
  /**
32
32
  * @component ViewSwitcher
33
33
  * @description
34
- * Icon-only radiogroup that switches the view of a page. A tooltip shows the view name on hover.
35
- * With onApplyToAll, a switch or a click on the checked view opens a compact extra action beside the buttons
36
- * after a short delay, for five seconds.
34
+ * The main view switcher: an icon-only radiogroup that switches the view of a page. A tooltip shows the view name on hover.
35
+ * With onApplyToAll, a switch or a click on the checked view slides a check button out from under the right end
36
+ * after a short delay. It applies the view to all projects, and a click outside closes it.
37
37
  *
38
38
  * @example
39
39
  * <ViewSwitcher
@@ -1 +1 @@
1
- {"version":3,"file":"ViewSwitcher.d.ts","sourceRoot":"","sources":["../../../../src/components/ViewSwitcher/ViewSwitcher.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,cAAc,EAEd,SAAS,EAMV,MAAM,OAAO,CAAC;AA0Bf,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACxD,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iGAAiG;IACjG,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,SAAS,CAAC;IACnD,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sGAAsG;IACtG,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,0FA8UxB,CAAC"}
1
+ {"version":3,"file":"ViewSwitcher.d.ts","sourceRoot":"","sources":["../../../../src/components/ViewSwitcher/ViewSwitcher.tsx"],"names":[],"mappings":"AAA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