@activecollab/components 2.0.570 → 2.0.572

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 (162) hide show
  1. package/dist/cjs/components/Autocomplete/Autocomplete.js +1 -1
  2. package/dist/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
  3. package/dist/cjs/components/Autocomplete/Styles.js +1 -1
  4. package/dist/cjs/components/Autocomplete/Styles.js.map +1 -1
  5. package/dist/cjs/components/Dialog/Styles.js +1 -1
  6. package/dist/cjs/components/Dialog/Styles.js.map +1 -1
  7. package/dist/cjs/components/GlobalStyle.js +1 -1
  8. package/dist/cjs/components/GlobalStyle.js.map +1 -1
  9. package/dist/cjs/components/Icons/collection/ArrowUpCircle.js +61 -0
  10. package/dist/cjs/components/Icons/collection/ArrowUpCircle.js.map +1 -0
  11. package/dist/cjs/components/Icons/collection/Storage.js +61 -0
  12. package/dist/cjs/components/Icons/collection/Storage.js.map +1 -0
  13. package/dist/cjs/components/Icons/collection/index.js +14 -0
  14. package/dist/cjs/components/Icons/collection/index.js.map +1 -1
  15. package/dist/cjs/components/IdentityMark/Styles.js +7 -0
  16. package/dist/cjs/components/IdentityMark/Styles.js.map +1 -1
  17. package/dist/cjs/components/MainMenu/MainMenu.js +25 -13
  18. package/dist/cjs/components/MainMenu/MainMenu.js.map +1 -1
  19. package/dist/cjs/components/MainMenu/Styles.js +1 -1
  20. package/dist/cjs/components/MainMenu/Styles.js.map +1 -1
  21. package/dist/cjs/components/MainMenu/hooks.js +33 -2
  22. package/dist/cjs/components/MainMenu/hooks.js.map +1 -1
  23. package/dist/cjs/components/MainMenu/types.js +2 -1
  24. package/dist/cjs/components/MainMenu/types.js.map +1 -1
  25. package/dist/cjs/components/ObjectFormModal/Styles.js +2 -2
  26. package/dist/cjs/components/ObjectFormModal/Styles.js.map +1 -1
  27. package/dist/cjs/components/PillButton/PillButton.js +5 -2
  28. package/dist/cjs/components/PillButton/PillButton.js.map +1 -1
  29. package/dist/cjs/components/PillButton/Styles.js +3 -1
  30. package/dist/cjs/components/PillButton/Styles.js.map +1 -1
  31. package/dist/cjs/components/PillGroup/PillGroup.js.map +1 -1
  32. package/dist/cjs/components/PillGroup/Styles.js +4 -1
  33. package/dist/cjs/components/PillGroup/Styles.js.map +1 -1
  34. package/dist/cjs/components/PresenceCapsule/PresenceCapsule.js +11 -8
  35. package/dist/cjs/components/PresenceCapsule/PresenceCapsule.js.map +1 -1
  36. package/dist/cjs/components/PresenceCapsule/Styles.js +7 -8
  37. package/dist/cjs/components/PresenceCapsule/Styles.js.map +1 -1
  38. package/dist/cjs/components/PropertyList/Styles.js +1 -1
  39. package/dist/cjs/components/PropertyList/Styles.js.map +1 -1
  40. package/dist/cjs/components/Sheet/Sheet.js +5 -2
  41. package/dist/cjs/components/Sheet/Sheet.js.map +1 -1
  42. package/dist/cjs/components/Sheet/Styles.js +19 -14
  43. package/dist/cjs/components/Sheet/Styles.js.map +1 -1
  44. package/dist/cjs/components/SwatchPalette/swatchPalette.js +1 -1
  45. package/dist/cjs/components/SwatchPalette/swatchPalette.js.map +1 -1
  46. package/dist/cjs/components/SwatchPalette/swatchPalette.test.js +1 -1
  47. package/dist/cjs/components/SwatchPalette/swatchPalette.test.js.map +1 -1
  48. package/dist/cjs/components/ToastMessage/Styles.js +6 -6
  49. package/dist/cjs/components/ToastMessage/Styles.js.map +1 -1
  50. package/dist/cjs/components/Tooltip/Tooltip.js +5 -0
  51. package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
  52. package/dist/cjs/components/ViewSwitcher/Styles.js +71 -16
  53. package/dist/cjs/components/ViewSwitcher/Styles.js.map +1 -1
  54. package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js +112 -92
  55. package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
  56. package/dist/cjs/components/ViewSwitcher/ViewSwitcherMenu.js +12 -4
  57. package/dist/cjs/components/ViewSwitcher/ViewSwitcherMenu.js.map +1 -1
  58. package/dist/cjs/presentation/shared/ActivityFeed.js +1 -1
  59. package/dist/cjs/presentation/shared/ActivityFeed.js.map +1 -1
  60. package/dist/esm/components/Autocomplete/Autocomplete.js +1 -1
  61. package/dist/esm/components/Autocomplete/Autocomplete.js.map +1 -1
  62. package/dist/esm/components/Autocomplete/Styles.js +1 -1
  63. package/dist/esm/components/Autocomplete/Styles.js.map +1 -1
  64. package/dist/esm/components/Dialog/Styles.js +1 -1
  65. package/dist/esm/components/Dialog/Styles.js.map +1 -1
  66. package/dist/esm/components/GlobalStyle.d.ts.map +1 -1
  67. package/dist/esm/components/GlobalStyle.js +1 -1
  68. package/dist/esm/components/GlobalStyle.js.map +1 -1
  69. package/dist/esm/components/Icons/collection/ArrowUpCircle.d.ts +32 -0
  70. package/dist/esm/components/Icons/collection/ArrowUpCircle.d.ts.map +1 -0
  71. package/dist/esm/components/Icons/collection/ArrowUpCircle.js +54 -0
  72. package/dist/esm/components/Icons/collection/ArrowUpCircle.js.map +1 -0
  73. package/dist/esm/components/Icons/collection/Storage.d.ts +32 -0
  74. package/dist/esm/components/Icons/collection/Storage.d.ts.map +1 -0
  75. package/dist/esm/components/Icons/collection/Storage.js +54 -0
  76. package/dist/esm/components/Icons/collection/Storage.js.map +1 -0
  77. package/dist/esm/components/Icons/collection/index.d.ts +2 -0
  78. package/dist/esm/components/Icons/collection/index.d.ts.map +1 -1
  79. package/dist/esm/components/Icons/collection/index.js +2 -0
  80. package/dist/esm/components/Icons/collection/index.js.map +1 -1
  81. package/dist/esm/components/IdentityMark/Styles.d.ts +1 -1
  82. package/dist/esm/components/IdentityMark/Styles.d.ts.map +1 -1
  83. package/dist/esm/components/IdentityMark/Styles.js +7 -0
  84. package/dist/esm/components/IdentityMark/Styles.js.map +1 -1
  85. package/dist/esm/components/MainMenu/MainMenu.d.ts.map +1 -1
  86. package/dist/esm/components/MainMenu/MainMenu.js +25 -12
  87. package/dist/esm/components/MainMenu/MainMenu.js.map +1 -1
  88. package/dist/esm/components/MainMenu/Styles.d.ts.map +1 -1
  89. package/dist/esm/components/MainMenu/Styles.js +1 -1
  90. package/dist/esm/components/MainMenu/Styles.js.map +1 -1
  91. package/dist/esm/components/MainMenu/hooks.d.ts +1 -0
  92. package/dist/esm/components/MainMenu/hooks.d.ts.map +1 -1
  93. package/dist/esm/components/MainMenu/hooks.js +28 -1
  94. package/dist/esm/components/MainMenu/hooks.js.map +1 -1
  95. package/dist/esm/components/MainMenu/types.d.ts +1 -0
  96. package/dist/esm/components/MainMenu/types.d.ts.map +1 -1
  97. package/dist/esm/components/MainMenu/types.js +2 -1
  98. package/dist/esm/components/MainMenu/types.js.map +1 -1
  99. package/dist/esm/components/ObjectFormModal/Styles.js +2 -2
  100. package/dist/esm/components/ObjectFormModal/Styles.js.map +1 -1
  101. package/dist/esm/components/PillButton/PillButton.d.ts +3 -1
  102. package/dist/esm/components/PillButton/PillButton.d.ts.map +1 -1
  103. package/dist/esm/components/PillButton/PillButton.js +5 -2
  104. package/dist/esm/components/PillButton/PillButton.js.map +1 -1
  105. package/dist/esm/components/PillButton/Styles.d.ts.map +1 -1
  106. package/dist/esm/components/PillButton/Styles.js +3 -1
  107. package/dist/esm/components/PillButton/Styles.js.map +1 -1
  108. package/dist/esm/components/PillGroup/PillGroup.d.ts +2 -2
  109. package/dist/esm/components/PillGroup/PillGroup.d.ts.map +1 -1
  110. package/dist/esm/components/PillGroup/PillGroup.js.map +1 -1
  111. package/dist/esm/components/PillGroup/Styles.d.ts.map +1 -1
  112. package/dist/esm/components/PillGroup/Styles.js +2 -1
  113. package/dist/esm/components/PillGroup/Styles.js.map +1 -1
  114. package/dist/esm/components/PresenceCapsule/PresenceCapsule.d.ts +2 -2
  115. package/dist/esm/components/PresenceCapsule/PresenceCapsule.d.ts.map +1 -1
  116. package/dist/esm/components/PresenceCapsule/PresenceCapsule.js +11 -8
  117. package/dist/esm/components/PresenceCapsule/PresenceCapsule.js.map +1 -1
  118. package/dist/esm/components/PresenceCapsule/Styles.d.ts +1 -3
  119. package/dist/esm/components/PresenceCapsule/Styles.d.ts.map +1 -1
  120. package/dist/esm/components/PresenceCapsule/Styles.js +6 -5
  121. package/dist/esm/components/PresenceCapsule/Styles.js.map +1 -1
  122. package/dist/esm/components/PropertyList/Styles.js +1 -1
  123. package/dist/esm/components/PropertyList/Styles.js.map +1 -1
  124. package/dist/esm/components/Sheet/Sheet.d.ts +2 -0
  125. package/dist/esm/components/Sheet/Sheet.d.ts.map +1 -1
  126. package/dist/esm/components/Sheet/Sheet.js +6 -3
  127. package/dist/esm/components/Sheet/Sheet.js.map +1 -1
  128. package/dist/esm/components/Sheet/Styles.d.ts +1 -0
  129. package/dist/esm/components/Sheet/Styles.d.ts.map +1 -1
  130. package/dist/esm/components/Sheet/Styles.js +17 -12
  131. package/dist/esm/components/Sheet/Styles.js.map +1 -1
  132. package/dist/esm/components/SwatchPalette/swatchPalette.d.ts +1 -1
  133. package/dist/esm/components/SwatchPalette/swatchPalette.d.ts.map +1 -1
  134. package/dist/esm/components/SwatchPalette/swatchPalette.js +1 -1
  135. package/dist/esm/components/SwatchPalette/swatchPalette.js.map +1 -1
  136. package/dist/esm/components/SwatchPalette/swatchPalette.test.js +1 -1
  137. package/dist/esm/components/SwatchPalette/swatchPalette.test.js.map +1 -1
  138. package/dist/esm/components/ToastMessage/Styles.d.ts.map +1 -1
  139. package/dist/esm/components/ToastMessage/Styles.js +3 -3
  140. package/dist/esm/components/ToastMessage/Styles.js.map +1 -1
  141. package/dist/esm/components/Tooltip/Tooltip.d.ts.map +1 -1
  142. package/dist/esm/components/Tooltip/Tooltip.js +5 -0
  143. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  144. package/dist/esm/components/ViewSwitcher/Styles.d.ts +12 -3
  145. package/dist/esm/components/ViewSwitcher/Styles.d.ts.map +1 -1
  146. package/dist/esm/components/ViewSwitcher/Styles.js +70 -15
  147. package/dist/esm/components/ViewSwitcher/Styles.js.map +1 -1
  148. package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts +7 -2
  149. package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts.map +1 -1
  150. package/dist/esm/components/ViewSwitcher/ViewSwitcher.js +106 -89
  151. package/dist/esm/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
  152. package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.d.ts +4 -0
  153. package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.d.ts.map +1 -1
  154. package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.js +13 -5
  155. package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.js.map +1 -1
  156. package/dist/esm/presentation/shared/ActivityFeed.js +1 -1
  157. package/dist/esm/presentation/shared/ActivityFeed.js.map +1 -1
  158. package/dist/index.js +954 -693
  159. package/dist/index.js.map +1 -1
  160. package/dist/index.min.js +1 -1
  161. package/dist/index.min.js.map +1 -1
  162. package/package.json +1 -1
@@ -3,16 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.VIEW_SWITCHER_RESIZE_MS = exports.VIEW_SWITCHER_PROMPT_MS = exports.VIEW_SWITCHER_LEAVE_MS = exports.VIEW_SWITCHER_APPLIED_MS = exports.StyledViewSwitcherTrack = exports.StyledViewSwitcherPromptTitle = exports.StyledViewSwitcherPrompt = exports.StyledViewSwitcherOption = exports.StyledViewSwitcherMenuOption = exports.StyledViewSwitcherMenuList = exports.StyledViewSwitcherMenuLabel = exports.StyledViewSwitcherMenuIcon = exports.StyledViewSwitcher = void 0;
6
+ exports.VIEW_SWITCHER_PROMPT_MS = exports.VIEW_SWITCHER_PROMPT_DELAY_MS = exports.VIEW_SWITCHER_LEAVE_MS = exports.VIEW_SWITCHER_APPLIED_MS = exports.StyledViewSwitcherTrack = exports.StyledViewSwitcherPromptTitle = exports.StyledViewSwitcherPromptPill = exports.StyledViewSwitcherPromptClip = exports.StyledViewSwitcherPrompt = exports.StyledViewSwitcherOptions = exports.StyledViewSwitcherOption = exports.StyledViewSwitcherMenuRoot = exports.StyledViewSwitcherMenuOption = exports.StyledViewSwitcherMenuList = exports.StyledViewSwitcherMenuLabel = exports.StyledViewSwitcherMenuIcon = exports.StyledViewSwitcherMenuClip = exports.StyledViewSwitcherLine = exports.StyledViewSwitcherDismiss = exports.StyledViewSwitcherApplied = exports.StyledViewSwitcherAction = exports.StyledViewSwitcher = void 0;
7
7
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
8
  var _BoxSizingStyle = require("../BoxSizingStyle");
9
9
  var _List = require("../List");
10
- var _PillGroup = require("../PillGroup");
11
10
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
11
+ var VIEW_SWITCHER_PROMPT_DELAY_MS = exports.VIEW_SWITCHER_PROMPT_DELAY_MS = 100;
12
12
  var VIEW_SWITCHER_PROMPT_MS = exports.VIEW_SWITCHER_PROMPT_MS = 5000;
13
- var VIEW_SWITCHER_RESIZE_MS = exports.VIEW_SWITCHER_RESIZE_MS = 200;
14
13
  var VIEW_SWITCHER_APPLIED_MS = exports.VIEW_SWITCHER_APPLIED_MS = 900;
15
- var VIEW_SWITCHER_LEAVE_MS = exports.VIEW_SWITCHER_LEAVE_MS = 150;
14
+ var VIEW_SWITCHER_LEAVE_MS = exports.VIEW_SWITCHER_LEAVE_MS = 200;
16
15
  var StyledViewSwitcher = exports.StyledViewSwitcher = _styledComponents.default.div.withConfig({
17
16
  displayName: "Styles__StyledViewSwitcher",
18
17
  componentId: "sc-1cg2mte-0"
@@ -21,45 +20,101 @@ StyledViewSwitcher.displayName = "StyledViewSwitcher";
21
20
  var StyledViewSwitcherTrack = exports.StyledViewSwitcherTrack = _styledComponents.default.div.withConfig({
22
21
  displayName: "Styles__StyledViewSwitcherTrack",
23
22
  componentId: "sc-1cg2mte-1"
24
- })(["", " display:inline-flex;align-items:center;justify-content:flex-end;height:32px;padding:3px;border-radius:var(--ac-br-rounded);background-color:var(--color-theme-300);transition:width ", "ms cubic-bezier(0.4,0,0.2,1);@media (prefers-reduced-motion:reduce){transition:none;}"], _BoxSizingStyle.BoxSizingStyle, VIEW_SWITCHER_RESIZE_MS);
23
+ })(["", " position:relative;display:inline-flex;align-items:center;height:32px;padding:3px;border-radius:var(--ac-br-rounded);background-color:var(--color-theme-300);"], _BoxSizingStyle.BoxSizingStyle);
25
24
  StyledViewSwitcherTrack.displayName = "StyledViewSwitcherTrack";
25
+ var StyledViewSwitcherOptions = exports.StyledViewSwitcherOptions = _styledComponents.default.div.withConfig({
26
+ displayName: "Styles__StyledViewSwitcherOptions",
27
+ componentId: "sc-1cg2mte-2"
28
+ })(["display:inline-flex;align-items:center;"]);
29
+ StyledViewSwitcherOptions.displayName = "StyledViewSwitcherOptions";
26
30
  var StyledViewSwitcherOption = exports.StyledViewSwitcherOption = _styledComponents.default.button.withConfig({
27
31
  displayName: "Styles__StyledViewSwitcherOption",
28
- componentId: "sc-1cg2mte-2"
32
+ componentId: "sc-1cg2mte-3"
29
33
  })(["", " display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:34px;height:26px;margin:0;padding:0;border:0;border-radius:var(--ac-br-rounded);background-color:transparent;cursor:pointer;outline:none;transition:background-color 150ms ease,box-shadow 150ms ease;svg{width:20px;height:20px;fill:var(--color-theme-700);}&:hover{background-color:color-mix( in srgb,var(--color-theme-900) 16%,transparent );}&[aria-checked=\"true\"]{background-color:var(--page-paper-main);box-shadow:var(--shadow-float);cursor:default;svg{fill:var(--color-theme-900);}}&:focus-visible{box-shadow:0 0 0 2px var(--color-primary);}"], _BoxSizingStyle.BoxSizingStyle);
30
34
  StyledViewSwitcherOption.displayName = "StyledViewSwitcherOption";
31
35
  var StyledViewSwitcherMenuOption = exports.StyledViewSwitcherMenuOption = _styledComponents.default.button.withConfig({
32
36
  displayName: "Styles__StyledViewSwitcherMenuOption",
33
- componentId: "sc-1cg2mte-3"
37
+ componentId: "sc-1cg2mte-4"
34
38
  })(["", " display:inline-flex;align-items:center;gap:4px;height:26px;margin:0;padding:0 8px 0 12px;border:0;border-radius:var(--ac-br-rounded);background-color:var(--page-paper-main);box-shadow:var(--shadow-float);color:var(--color-theme-900);font-size:calc(13px * var(--text-scale,1));white-space:nowrap;cursor:pointer;outline:none;svg{flex-shrink:0;fill:var(--color-theme-900);}&:has(.c-view-switcher-menu__icon){padding-left:8px;}.c-view-switcher-menu__values{display:inline-grid;}.c-view-switcher-menu__value{display:inline-flex;grid-area:1 / 1;align-items:center;gap:4px;visibility:hidden;}.c-view-switcher-menu__value[data-selected=\"true\"]{visibility:visible;}.c-view-switcher-menu__icon{display:inline-flex;flex-shrink:0;}.c-view-switcher-menu__icon svg{width:20px;height:20px;}&:focus-visible{box-shadow:0 0 0 2px var(--color-primary);}"], _BoxSizingStyle.BoxSizingStyle);
35
39
  StyledViewSwitcherMenuOption.displayName = "StyledViewSwitcherMenuOption";
40
+ var VIEW_SWITCHER_MENU_REVEAL_MS = 200;
41
+ var VIEW_SWITCHER_MENU_GAP = 8;
42
+ var menuReveal = (0, _styledComponents.keyframes)(["from{grid-template-columns:0fr;margin-right:-", "px;}"], VIEW_SWITCHER_MENU_GAP);
43
+ var menuConceal = (0, _styledComponents.keyframes)(["to{grid-template-columns:0fr;margin-right:-", "px;}"], VIEW_SWITCHER_MENU_GAP);
44
+ var menuClip = (0, _styledComponents.keyframes)(["from,to{overflow:hidden;}"]);
45
+
46
+ // The width opens from nothing, so the controls beside the menu move aside with it.
47
+ var StyledViewSwitcherMenuRoot = exports.StyledViewSwitcherMenuRoot = (0, _styledComponents.default)(StyledViewSwitcher).withConfig({
48
+ displayName: "Styles__StyledViewSwitcherMenuRoot",
49
+ componentId: "sc-1cg2mte-5"
50
+ })(["display:inline-grid;grid-template-columns:1fr;&[data-animate-in]{animation:", " ", "ms cubic-bezier(0.4,0,0.2,1);}&[data-animate-in] > .c-view-switcher-menu__clip{animation:", " ", "ms;}&[data-leaving]{pointer-events:none;animation:", " ", "ms cubic-bezier(0.4,0,0.2,1) forwards;}&[data-leaving] > .c-view-switcher-menu__clip{overflow:hidden;}@media (prefers-reduced-motion:reduce){&[data-animate-in],&[data-animate-in] > .c-view-switcher-menu__clip,&[data-leaving]{animation:none;}}"], menuReveal, VIEW_SWITCHER_MENU_REVEAL_MS, menuClip, VIEW_SWITCHER_MENU_REVEAL_MS, menuConceal, VIEW_SWITCHER_MENU_REVEAL_MS);
51
+ StyledViewSwitcherMenuRoot.displayName = "StyledViewSwitcherMenuRoot";
52
+ var StyledViewSwitcherMenuClip = exports.StyledViewSwitcherMenuClip = _styledComponents.default.div.withConfig({
53
+ displayName: "Styles__StyledViewSwitcherMenuClip",
54
+ componentId: "sc-1cg2mte-6"
55
+ })(["display:flex;min-width:0;> *{flex-shrink:0;}"]);
56
+ StyledViewSwitcherMenuClip.displayName = "StyledViewSwitcherMenuClip";
36
57
  var StyledViewSwitcherMenuIcon = exports.StyledViewSwitcherMenuIcon = _styledComponents.default.span.withConfig({
37
58
  displayName: "Styles__StyledViewSwitcherMenuIcon",
38
- componentId: "sc-1cg2mte-4"
59
+ componentId: "sc-1cg2mte-7"
39
60
  })(["display:inline-flex;flex-shrink:0;margin-right:8px;fill:var(--color-theme-900);"]);
40
61
  StyledViewSwitcherMenuIcon.displayName = "StyledViewSwitcherMenuIcon";
41
62
  var StyledViewSwitcherMenuList = exports.StyledViewSwitcherMenuList = (0, _styledComponents.default)(_List.List).withConfig({
42
63
  displayName: "Styles__StyledViewSwitcherMenuList",
43
- componentId: "sc-1cg2mte-5"
64
+ componentId: "sc-1cg2mte-8"
44
65
  })(["padding:8px 0;"]);
45
66
  StyledViewSwitcherMenuList.displayName = "StyledViewSwitcherMenuList";
46
67
  var StyledViewSwitcherMenuLabel = exports.StyledViewSwitcherMenuLabel = _styledComponents.default.span.withConfig({
47
68
  displayName: "Styles__StyledViewSwitcherMenuLabel",
48
- componentId: "sc-1cg2mte-6"
69
+ componentId: "sc-1cg2mte-9"
49
70
  })(["flex:1;&[data-selected=\"true\"]{font-weight:bold;color:var(--color-primary);}"]);
50
71
  StyledViewSwitcherMenuLabel.displayName = "StyledViewSwitcherMenuLabel";
51
72
  var promptIn = (0, _styledComponents.keyframes)(["from{opacity:0;}"]);
52
- var promptOut = (0, _styledComponents.keyframes)(["to{opacity:0;transform:scale(0.96);}"]);
53
- var promptTimeLeft = (0, _styledComponents.keyframes)(["to{transform:scaleX(0);}"]);
73
+ var promptOut = (0, _styledComponents.keyframes)(["to{clip-path:inset(0 0 0 100%);}"]);
74
+ var appliedIn = (0, _styledComponents.keyframes)(["from{opacity:0;transform:translateY(6px);}"]);
54
75
  var appliedIcon = (0, _styledComponents.keyframes)(["from{opacity:0;transform:scale(0.4);}60%{transform:scale(1.2);}"]);
55
76
  var StyledViewSwitcherPromptTitle = exports.StyledViewSwitcherPromptTitle = _styledComponents.default.span.withConfig({
56
77
  displayName: "Styles__StyledViewSwitcherPromptTitle",
57
- componentId: "sc-1cg2mte-7"
78
+ componentId: "sc-1cg2mte-10"
58
79
  })(["position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;"]);
59
80
  StyledViewSwitcherPromptTitle.displayName = "StyledViewSwitcherPromptTitle";
60
- var StyledViewSwitcherPrompt = exports.StyledViewSwitcherPrompt = (0, _styledComponents.default)(_PillGroup.PillGroup).withConfig({
81
+ var PROMPT_EASE = "cubic-bezier(0.4, 0, 0.2, 1)";
82
+ var APPLIED_SWAP_MS = 160;
83
+
84
+ // The offer covers the buttons and keeps the width of the switcher, so nothing beside it moves.
85
+ var StyledViewSwitcherPrompt = exports.StyledViewSwitcherPrompt = _styledComponents.default.div.withConfig({
61
86
  displayName: "Styles__StyledViewSwitcherPrompt",
62
- componentId: "sc-1cg2mte-8"
63
- })(["flex:1 0 auto;max-width:none;animation:", " 150ms ease-out;.c-pill-button:not(.c-pill-button--icon-only){flex:1 0 auto;justify-content:center;font-size:calc(0.75rem * var(--text-scale,1));}& > .c-pill-button:not(.c-pill-button--icon-only){white-space:nowrap;}.c-view-switcher__dismiss{position:relative;width:32px;overflow:hidden;}.c-view-switcher__dismiss::before{content:\"\";position:absolute;inset:0;background-color:color-mix(in srgb,var(--color-primary) 25%,transparent);transform-origin:left;animation:", " ", "ms linear forwards;}.c-view-switcher__dismiss > *{position:relative;}&[data-phase=\"applying\"]{pointer-events:none;.c-pill-button{opacity:0.7;}.c-view-switcher__dismiss::before{animation-play-state:paused;}}&[data-phase=\"applied\"]{pointer-events:none;.c-pill-button{background-color:color-mix( in srgb,var(--color-primary) 30%,transparent );}.c-pill-button svg{width:16px;height:16px;animation:", " 250ms ease-out;}}&[data-phase=\"leaving\"]{pointer-events:none;animation:", " ", "ms ease-in forwards;}"], promptIn, promptTimeLeft, VIEW_SWITCHER_PROMPT_MS, appliedIcon, promptOut, VIEW_SWITCHER_LEAVE_MS);
87
+ componentId: "sc-1cg2mte-11"
88
+ })(["", " position:absolute;top:3px;right:3px;bottom:3px;z-index:1;display:flex;min-width:calc(100% - 6px);animation:", " ", "ms ", ";&[data-phase=\"applying\"],&[data-phase=\"applied\"]{pointer-events:none;}&[data-phase=\"applying\"] .c-view-switcher__prompt-pill{opacity:0.7;}.c-view-switcher__action,.c-view-switcher__line,.c-view-switcher__dismiss{transition:opacity ", "ms ", ",transform ", "ms ", ",visibility 0s linear ", "ms,background-color 150ms ease;}&[data-confirmed] .c-view-switcher__action,&[data-confirmed] .c-view-switcher__line,&[data-confirmed] .c-view-switcher__dismiss{visibility:hidden;opacity:0;transform:translateY(-6px);}&[data-phase=\"leaving\"]{pointer-events:none;animation:", " ", "ms ", " forwards;}@media (prefers-reduced-motion:reduce){animation:none;&[data-phase=\"leaving\"]{animation:none;}.c-view-switcher__action,.c-view-switcher__line,.c-view-switcher__dismiss,.c-view-switcher__prompt-pill{transition:none;}}"], _BoxSizingStyle.BoxSizingStyle, promptIn, VIEW_SWITCHER_LEAVE_MS, PROMPT_EASE, APPLIED_SWAP_MS, PROMPT_EASE, APPLIED_SWAP_MS, PROMPT_EASE, APPLIED_SWAP_MS, promptOut, VIEW_SWITCHER_LEAVE_MS, PROMPT_EASE);
64
89
  StyledViewSwitcherPrompt.displayName = "StyledViewSwitcherPrompt";
90
+ var StyledViewSwitcherPromptClip = exports.StyledViewSwitcherPromptClip = _styledComponents.default.div.withConfig({
91
+ displayName: "Styles__StyledViewSwitcherPromptClip",
92
+ componentId: "sc-1cg2mte-12"
93
+ })(["display:flex;flex:1;min-width:0;"]);
94
+ StyledViewSwitcherPromptClip.displayName = "StyledViewSwitcherPromptClip";
95
+ var StyledViewSwitcherPromptPill = exports.StyledViewSwitcherPromptPill = _styledComponents.default.div.withConfig({
96
+ displayName: "Styles__StyledViewSwitcherPromptPill",
97
+ componentId: "sc-1cg2mte-13"
98
+ })(["", " position:relative;display:inline-flex;flex:1;align-items:center;justify-content:center;height:26px;border-radius:var(--ac-br-rounded);background-color:var(--color-primary-opaque-300);color:var(--color-primary);font-size:calc(0.75rem * var(--text-scale,1));font-weight:500;white-space:nowrap;transition:opacity 150ms ease;"], _BoxSizingStyle.BoxSizingStyle);
99
+ StyledViewSwitcherPromptPill.displayName = "StyledViewSwitcherPromptPill";
100
+ var StyledViewSwitcherAction = exports.StyledViewSwitcherAction = _styledComponents.default.button.withConfig({
101
+ displayName: "Styles__StyledViewSwitcherAction",
102
+ componentId: "sc-1cg2mte-14"
103
+ })(["", " display:inline-flex;align-items:center;gap:4px;height:26px;margin:0;padding:0 2px 0 6px;border:0;border-radius:var(--ac-br-rounded);background-color:transparent;color:inherit;font:inherit;cursor:pointer;outline:none;svg{flex-shrink:0;width:16px;height:16px;fill:currentColor;}&:hover{color:var(--color-theme-900);}&:focus-visible{box-shadow:inset 0 0 0 2px var(--color-primary);}"], _BoxSizingStyle.BoxSizingStyle);
104
+ StyledViewSwitcherAction.displayName = "StyledViewSwitcherAction";
105
+ var StyledViewSwitcherLine = exports.StyledViewSwitcherLine = _styledComponents.default.i.withConfig({
106
+ displayName: "Styles__StyledViewSwitcherLine",
107
+ componentId: "sc-1cg2mte-15"
108
+ })(["flex-shrink:0;width:1px;height:14px;margin:0 1px 0 6px;background-color:color-mix(in srgb,var(--color-primary) 35%,transparent);"]);
109
+ StyledViewSwitcherLine.displayName = "StyledViewSwitcherLine";
110
+ var StyledViewSwitcherDismiss = exports.StyledViewSwitcherDismiss = _styledComponents.default.button.withConfig({
111
+ displayName: "Styles__StyledViewSwitcherDismiss",
112
+ componentId: "sc-1cg2mte-16"
113
+ })(["", " display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:22px;height:22px;margin:0 2px 0 0;padding:0;border:0;border-radius:50%;background-color:transparent;cursor:pointer;outline:none;transition:background-color 150ms ease;svg{width:16px;height:16px;margin-left:-1px;fill:var(--color-theme-700);}&:hover{background-color:color-mix( in srgb,var(--color-theme-900) 16%,transparent );}&:focus-visible{box-shadow:inset 0 0 0 2px var(--color-primary);}"], _BoxSizingStyle.BoxSizingStyle);
114
+ StyledViewSwitcherDismiss.displayName = "StyledViewSwitcherDismiss";
115
+ var StyledViewSwitcherApplied = exports.StyledViewSwitcherApplied = _styledComponents.default.span.withConfig({
116
+ displayName: "Styles__StyledViewSwitcherApplied",
117
+ componentId: "sc-1cg2mte-17"
118
+ })(["position:absolute;inset:0;display:inline-flex;align-items:center;justify-content:center;gap:4px;animation:", " ", "ms ", " 60ms backwards;svg{width:16px;height:16px;fill:currentColor;animation:", " 250ms ease-out 60ms backwards;}@media (prefers-reduced-motion:reduce){animation:none;svg{animation:none;}}"], appliedIn, APPLIED_SWAP_MS, PROMPT_EASE, appliedIcon);
119
+ StyledViewSwitcherApplied.displayName = "StyledViewSwitcherApplied";
65
120
  //# sourceMappingURL=Styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Styles.js","names":["_styledComponents","_interopRequireWildcard","require","_BoxSizingStyle","_List","_PillGroup","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","VIEW_SWITCHER_PROMPT_MS","exports","VIEW_SWITCHER_RESIZE_MS","VIEW_SWITCHER_APPLIED_MS","VIEW_SWITCHER_LEAVE_MS","StyledViewSwitcher","styled","div","withConfig","displayName","componentId","BoxSizingStyle","StyledViewSwitcherTrack","StyledViewSwitcherOption","button","StyledViewSwitcherMenuOption","StyledViewSwitcherMenuIcon","span","StyledViewSwitcherMenuList","List","StyledViewSwitcherMenuLabel","promptIn","keyframes","promptOut","promptTimeLeft","appliedIcon","StyledViewSwitcherPromptTitle","StyledViewSwitcherPrompt","PillGroup"],"sources":["../../../../src/components/ViewSwitcher/Styles.ts"],"sourcesContent":["import styled, { keyframes } from \"styled-components\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { List } from \"../List\";\nimport { PillGroup } from \"../PillGroup\";\n\nexport const VIEW_SWITCHER_PROMPT_MS = 5000;\nexport const VIEW_SWITCHER_RESIZE_MS = 200;\nexport const VIEW_SWITCHER_APPLIED_MS = 900;\nexport const VIEW_SWITCHER_LEAVE_MS = 150;\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 display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n height: 32px;\n padding: 3px;\n border-radius: var(--ac-br-rounded);\n background-color: var(--color-theme-300);\n transition: width ${VIEW_SWITCHER_RESIZE_MS}ms cubic-bezier(0.4, 0, 0.2, 1);\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n`;\n\nStyledViewSwitcherTrack.displayName = \"StyledViewSwitcherTrack\";\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\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 opacity: 0;\n transform: scale(0.96);\n }\n`;\n\nconst promptTimeLeft = keyframes`\n to {\n transform: scaleX(0);\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\nexport const StyledViewSwitcherPrompt = styled(PillGroup)`\n flex: 1 0 auto;\n max-width: none;\n animation: ${promptIn} 150ms ease-out;\n\n .c-pill-button:not(.c-pill-button--icon-only) {\n flex: 1 0 auto;\n justify-content: center;\n font-size: calc(0.75rem * var(--text-scale, 1));\n }\n\n & > .c-pill-button:not(.c-pill-button--icon-only) {\n white-space: nowrap;\n }\n\n .c-view-switcher__dismiss {\n position: relative;\n width: 32px;\n overflow: hidden;\n }\n\n /* The fill goes down to nothing when the prompt dismisses itself. */\n .c-view-switcher__dismiss::before {\n content: \"\";\n position: absolute;\n inset: 0;\n background-color: color-mix(in srgb, var(--color-primary) 25%, transparent);\n transform-origin: left;\n animation: ${promptTimeLeft} ${VIEW_SWITCHER_PROMPT_MS}ms linear forwards;\n }\n\n .c-view-switcher__dismiss > * {\n position: relative;\n }\n\n &[data-phase=\"applying\"] {\n pointer-events: none;\n\n .c-pill-button {\n opacity: 0.7;\n }\n\n .c-view-switcher__dismiss::before {\n animation-play-state: paused;\n }\n }\n\n &[data-phase=\"applied\"] {\n pointer-events: none;\n\n .c-pill-button {\n background-color: color-mix(\n in srgb,\n var(--color-primary) 30%,\n transparent\n );\n }\n\n .c-pill-button svg {\n width: 16px;\n height: 16px;\n animation: ${appliedIcon} 250ms ease-out;\n }\n }\n\n &[data-phase=\"leaving\"] {\n pointer-events: none;\n animation: ${promptOut} ${VIEW_SWITCHER_LEAVE_MS}ms ease-in forwards;\n }\n`;\n\nStyledViewSwitcherPrompt.displayName = \"StyledViewSwitcherPrompt\";\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAAyC,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,wBAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CA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AW,GAAG,+BAA+B;AAEpE,IAAMkB,wBAAwB,GAAA1B,OAAA,CAAA0B,wBAAA,GAAG,IAAArB,yBAAM,EAACsB,oBAAS,CAAC,CAAApB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wgCAG1CW,QAAQ,EAyBNG,cAAc,EAAIxB,uBAAuB,EAiCvCyB,WAAW,EAMbF,SAAS,EAAInB,sBAAsB,CAEnD;AAEDuB,wBAAwB,CAAClB,WAAW,GAAG,0BAA0B","ignoreList":[]}
1
+ {"version":3,"file":"Styles.js","names":["_styledComponents","_interopRequireWildcard","require","_BoxSizingStyle","_List","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","VIEW_SWITCHER_PROMPT_DELAY_MS","exports","VIEW_SWITCHER_PROMPT_MS","VIEW_SWITCHER_APPLIED_MS","VIEW_SWITCHER_LEAVE_MS","StyledViewSwitcher","styled","div","withConfig","displayName","componentId","BoxSizingStyle","StyledViewSwitcherTrack","StyledViewSwitcherOptions","StyledViewSwitcherOption","button","StyledViewSwitcherMenuOption","VIEW_SWITCHER_MENU_REVEAL_MS","VIEW_SWITCHER_MENU_GAP","menuReveal","keyframes","menuConceal","menuClip","StyledViewSwitcherMenuRoot","StyledViewSwitcherMenuClip","StyledViewSwitcherMenuIcon","span","StyledViewSwitcherMenuList","List","StyledViewSwitcherMenuLabel","promptIn","promptOut","appliedIn","appliedIcon","StyledViewSwitcherPromptTitle","PROMPT_EASE","APPLIED_SWAP_MS","StyledViewSwitcherPrompt","StyledViewSwitcherPromptClip","StyledViewSwitcherPromptPill","StyledViewSwitcherAction","StyledViewSwitcherLine","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,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAA+B,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,wBAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,cAAAM,EAAA,IAAAd,CAAA,gBAAAc,EAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,EAAA,OAAAP,CAAA,IAAAD,CAAA,GAAAW,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAA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AG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+UAClDC,8BAAc,CAcjB;AAED4B,4BAA4B,CAAC9B,WAAW,GAAG,8BAA8B;AAElE,IAAM+B,wBAAwB,GAAAvC,OAAA,CAAAuC,wBAAA,GAAGlC,yBAAM,CAACS,MAAM,CAAAP,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,yYACjDC,8BAAc,CA6BjB;AAED6B,wBAAwB,CAAC/B,WAAW,GAAG,0BAA0B;AAE1D,IAAMgC,sBAAsB,GAAAxC,OAAA,CAAAwC,sBAAA,GAAGnC,yBAAM,CAACnB,CAAC,CAAAqB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wIAM7C;AAED+B,sBAAsB,CAAChC,WAAW,GAAG,wBAAwB;AAEtD,IAAMiC,yBAAyB,GAAAzC,OAAA,CAAAyC,yBAAA,GAAGpC,yBAAM,CAACS,MAAM,CAAAP,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,ueAClDC,8BAAc,CAkCjB;AAED+B,yBAAyB,CAACjC,WAAW,GAAG,2BAA2B;AAE5D,IAAMkC,yBAAyB,GAAA1C,OAAA,CAAA0C,yBAAA,GAAGrC,yBAAM,CAACoB,IAAI,CAAAlB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,yTAOrCsB,SAAS,EAAII,eAAe,EAAMD,WAAW,EAM3CF,WAAW,CAU3B;AAEDU,yBAAyB,CAAClC,WAAW,GAAG,2BAA2B","ignoreList":[]}
@@ -9,9 +9,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
9
9
  var _Styles = require("./Styles");
10
10
  var _useForkRef = _interopRequireDefault(require("../../utils/useForkRef"));
11
11
  var _Icons = require("../Icons");
12
- var _PillButton = require("../PillButton");
13
12
  var _Tooltip = require("../Tooltip");
14
- var _excluded = ["views", "value", "onChange", "aria-label", "onApplyToAll", "applyToAllLabel", "offerTitle", "dismissLabel", "appliedLabel", "className", "onKeyDown", "onBlur"];
13
+ var _excluded = ["views", "value", "onChange", "aria-label", "onApplyToAll", "applyToAllLabel", "applyToAllTitle", "offerTitle", "dismissLabel", "appliedLabel", "offerKey", "className", "onKeyDown", "onBlur"];
15
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
15
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
17
16
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
@@ -27,7 +26,8 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
27
26
  * @component ViewSwitcher
28
27
  * @description
29
28
  * Icon-only radiogroup that switches the view of a page. A tooltip shows the view name on hover.
30
- * With onApplyToAll, a switch replaces the buttons with an extra action for five seconds.
29
+ * With onApplyToAll, a switch or a click on the checked view opens a compact extra action beside the buttons
30
+ * after a short delay, for five seconds.
31
31
  *
32
32
  * @example
33
33
  * <ViewSwitcher
@@ -50,34 +50,41 @@ var ViewSwitcher = exports.ViewSwitcher = /*#__PURE__*/(0, _react.forwardRef)(fu
50
50
  ariaLabel = _ref$ariaLabel === void 0 ? "View" : _ref$ariaLabel,
51
51
  onApplyToAll = _ref.onApplyToAll,
52
52
  _ref$applyToAllLabel = _ref.applyToAllLabel,
53
- applyToAllLabel = _ref$applyToAllLabel === void 0 ? "Apply to All Projects" : _ref$applyToAllLabel,
53
+ applyToAllLabel = _ref$applyToAllLabel === void 0 ? "All Projects" : _ref$applyToAllLabel,
54
+ _ref$applyToAllTitle = _ref.applyToAllTitle,
55
+ applyToAllTitle = _ref$applyToAllTitle === void 0 ? "Apply to All Projects" : _ref$applyToAllTitle,
54
56
  offerTitle = _ref.offerTitle,
55
57
  _ref$dismissLabel = _ref.dismissLabel,
56
58
  dismissLabel = _ref$dismissLabel === void 0 ? "Dismiss" : _ref$dismissLabel,
57
59
  _ref$appliedLabel = _ref.appliedLabel,
58
60
  appliedLabel = _ref$appliedLabel === void 0 ? "Applied" : _ref$appliedLabel,
61
+ offerKey = _ref.offerKey,
59
62
  className = _ref.className,
60
63
  onKeyDown = _ref.onKeyDown,
61
64
  onBlur = _ref.onBlur,
62
65
  rest = _objectWithoutProperties(_ref, _excluded);
63
66
  var rootRef = (0, _react.useRef)(null);
64
67
  var handleRootRef = (0, _useForkRef.default)(rootRef, ref);
65
- var trackRef = (0, _react.useRef)(null);
66
68
  var optionRefs = (0, _react.useRef)({});
67
- var offerActionRef = (0, _react.useRef)(null);
69
+ var promptRef = (0, _react.useRef)(null);
68
70
  var _useState = (0, _react.useState)(null),
69
71
  _useState2 = _slicedToArray(_useState, 2),
70
72
  offerId = _useState2[0],
71
73
  setOfferId = _useState2[1];
72
- var _useState3 = (0, _react.useState)("open"),
74
+ var _useState3 = (0, _react.useState)("waiting"),
73
75
  _useState4 = _slicedToArray(_useState3, 2),
74
76
  offerPhase = _useState4[0],
75
77
  setOfferPhase = _useState4[1];
78
+ var _useState5 = (0, _react.useState)(false),
79
+ _useState6 = _slicedToArray(_useState5, 2),
80
+ isConfirmed = _useState6[0],
81
+ setIsConfirmed = _useState6[1];
76
82
  var offerTitleId = (0, _react.useId)();
77
- var closedWidthRef = (0, _react.useRef)(0);
78
- var wasOfferOpenRef = (0, _react.useRef)(false);
83
+ var offerIdRef = (0, _react.useRef)(offerId);
84
+ var offerPhaseRef = (0, _react.useRef)(offerPhase);
79
85
  var restoreFocusRef = (0, _react.useRef)(false);
80
- var resizeTimerRef = (0, _react.useRef)();
86
+ offerIdRef.current = offerId;
87
+ offerPhaseRef.current = offerPhase;
81
88
  var checkedIndex = views.findIndex(function (_ref2) {
82
89
  var id = _ref2.id;
83
90
  return id === value;
@@ -88,17 +95,36 @@ var ViewSwitcher = exports.ViewSwitcher = /*#__PURE__*/(0, _react.forwardRef)(fu
88
95
  return id === offerId;
89
96
  });
90
97
  var select = (0, _react.useCallback)(function (id) {
98
+ // A click on the checked view also offers the extra action.
91
99
  if (id === value) {
100
+ var isOfferUp = offerIdRef.current && ["open", "applying", "applied"].includes(offerPhaseRef.current);
101
+ if (onApplyToAll && !isOfferUp) {
102
+ setOfferPhase("waiting");
103
+ setIsConfirmed(false);
104
+ setOfferId(id);
105
+ }
92
106
  return;
93
107
  }
94
108
  onChange(id);
95
109
  if (onApplyToAll) {
96
- var _trackRef$current$off, _trackRef$current;
97
- closedWidthRef.current = (_trackRef$current$off = (_trackRef$current = trackRef.current) === null || _trackRef$current === void 0 ? void 0 : _trackRef$current.offsetWidth) !== null && _trackRef$current$off !== void 0 ? _trackRef$current$off : 0;
98
- setOfferPhase("open");
110
+ // An open prompt stays for the next switch, and only a new one waits.
111
+ setOfferPhase(function (phase) {
112
+ return offerIdRef.current && phase === "open" ? "open" : "waiting";
113
+ });
114
+ setIsConfirmed(false);
99
115
  setOfferId(id);
100
116
  }
101
117
  }, [onApplyToAll, onChange, value]);
118
+ var seenOfferKeyRef = (0, _react.useRef)(offerKey);
119
+ (0, _react.useEffect)(function () {
120
+ if (seenOfferKeyRef.current === offerKey) {
121
+ return;
122
+ }
123
+ seenOfferKeyRef.current = offerKey;
124
+ if (value) {
125
+ select(value);
126
+ }
127
+ }, [offerKey, select, value]);
102
128
  var isInside = function isInside(node) {
103
129
  var _rootRef$current;
104
130
  return Boolean(node && ((_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.contains(node)));
@@ -109,84 +135,60 @@ var ViewSwitcher = exports.ViewSwitcher = /*#__PURE__*/(0, _react.forwardRef)(fu
109
135
  (_optionRefs$current$t = optionRefs.current[tabStopId]) === null || _optionRefs$current$t === void 0 || _optionRefs$current$t.focus();
110
136
  }
111
137
  }, [tabStopId]);
112
- var closeOffer = (0, _react.useCallback)(function (restoreFocus) {
113
- restoreFocusRef.current = restoreFocus;
114
- setOfferId(null);
115
- }, []);
116
-
117
- // The buttons and the prompt take turns in the track, so the track holds its width from one to the other.
118
- (0, _react.useLayoutEffect)(function () {
119
- var track = trackRef.current;
120
- var isOpen = Boolean(offerId);
121
- var wasOpen = wasOfferOpenRef.current;
122
- wasOfferOpenRef.current = isOpen;
123
- if (!track || isOpen === wasOpen) {
124
- return;
125
- }
126
- clearTimeout(resizeTimerRef.current);
127
- var from = isOpen ? closedWidthRef.current : track.offsetWidth;
128
- track.style.width = "";
129
- var natural = track.offsetWidth;
130
- var to = isOpen ? Math.max(natural, from) : natural;
131
- track.style.overflow = "hidden";
132
- track.style.width = "".concat(from, "px");
133
- // Without this read the browser skips the start width, and nothing animates.
134
- void track.offsetWidth;
135
- track.style.width = "".concat(to, "px");
136
- if (isOpen) {
137
- var _offerActionRef$curre;
138
- (_offerActionRef$curre = offerActionRef.current) === null || _offerActionRef$curre === void 0 || _offerActionRef$curre.focus({
139
- preventScroll: true
140
- });
138
+ var leave = (0, _react.useCallback)(function () {
139
+ var _promptRef$current;
140
+ restoreFocusRef.current = Boolean((_promptRef$current = promptRef.current) === null || _promptRef$current === void 0 ? void 0 : _promptRef$current.contains(document.activeElement));
141
+ if (offerPhaseRef.current === "waiting") {
142
+ setOfferId(null);
141
143
  return;
142
144
  }
143
- resizeTimerRef.current = setTimeout(function () {
144
- track.style.width = "";
145
- track.style.overflow = "";
146
- }, _Styles.VIEW_SWITCHER_RESIZE_MS);
147
- if (restoreFocusRef.current) {
145
+ setOfferPhase("leaving");
146
+ }, []);
147
+ (0, _react.useEffect)(function () {
148
+ if (!offerId && restoreFocusRef.current) {
148
149
  restoreFocusRef.current = false;
149
150
  focusChecked();
150
151
  }
151
152
  }, [focusChecked, offerId]);
152
- (0, _react.useEffect)(function () {
153
- return function () {
154
- return clearTimeout(resizeTimerRef.current);
155
- };
156
- }, []);
157
153
  (0, _react.useEffect)(function () {
158
154
  if (!offerId || offerPhase === "applying") {
159
155
  return undefined;
160
156
  }
161
- if (offerPhase === "leaving") {
157
+ if (offerPhase === "waiting") {
162
158
  var _timer = setTimeout(function () {
163
- closeOffer(isInside(document.activeElement));
164
- }, _Styles.VIEW_SWITCHER_LEAVE_MS);
159
+ return setOfferPhase("open");
160
+ }, _Styles.VIEW_SWITCHER_PROMPT_DELAY_MS);
165
161
  return function () {
166
162
  return clearTimeout(_timer);
167
163
  };
168
164
  }
169
- var timer = setTimeout(function () {
170
- return setOfferPhase("leaving");
171
- }, offerPhase === "applied" ? _Styles.VIEW_SWITCHER_APPLIED_MS : _Styles.VIEW_SWITCHER_PROMPT_MS);
165
+ if (offerPhase === "leaving") {
166
+ var _timer2 = setTimeout(function () {
167
+ return setOfferId(null);
168
+ }, _Styles.VIEW_SWITCHER_LEAVE_MS);
169
+ return function () {
170
+ return clearTimeout(_timer2);
171
+ };
172
+ }
173
+ var timer = setTimeout(leave, offerPhase === "applied" ? _Styles.VIEW_SWITCHER_APPLIED_MS : _Styles.VIEW_SWITCHER_PROMPT_MS);
172
174
  return function () {
173
175
  return clearTimeout(timer);
174
176
  };
175
- }, [closeOffer, offerId, offerPhase]);
177
+ }, [leave, offerId, offerPhase]);
176
178
  (0, _react.useEffect)(function () {
177
179
  if (!offerId) {
178
180
  return undefined;
179
181
  }
180
- var closeOutside = function closeOutside(event) {
182
+ var leaveOutside = function leaveOutside(event) {
181
183
  if (!isInside(event.target)) {
182
- setOfferId(null);
184
+ leave();
183
185
  }
184
186
  };
185
- document.addEventListener("mousedown", closeOutside);
187
+ document.addEventListener("mousedown", leaveOutside);
186
188
  return function () {
187
- return document.removeEventListener("mousedown", closeOutside);
189
+ return document.removeEventListener("mousedown", leaveOutside);
188
190
  };
189
- }, [offerId]);
191
+ }, [leave, offerId]);
190
192
  var handleOptionKeyDown = function handleOptionKeyDown(event, index) {
191
193
  var _optionRefs$current$i;
192
194
  var last = views.length - 1;
@@ -212,34 +214,42 @@ var ViewSwitcher = exports.ViewSwitcher = /*#__PURE__*/(0, _react.forwardRef)(fu
212
214
  if (event.key !== "Escape" || !offerId) {
213
215
  return;
214
216
  }
217
+ if (offerPhase === "waiting") {
218
+ leave();
219
+ return;
220
+ }
215
221
 
216
222
  // A native dialog around the switcher would take an Escape that is not prevented as its own close request.
217
223
  event.preventDefault();
218
224
  event.stopPropagation();
219
- closeOffer(true);
225
+ leave();
220
226
  };
221
227
  var handleRootBlur = function handleRootBlur(event) {
222
228
  onBlur === null || onBlur === void 0 || onBlur(event);
223
229
  var next = event.relatedTarget;
224
- if (next && !isInside(next)) {
225
- setOfferId(null);
230
+ if (offerId && next && !isInside(next)) {
231
+ leave();
226
232
  }
227
233
  };
228
234
  var applyToAll = async function applyToAll() {
235
+ var _promptRef$current2;
229
236
  if (!offerId || !onApplyToAll || offerPhase !== "open") {
230
237
  return;
231
238
  }
232
239
  var isApplied = false;
240
+
241
+ // The action hides while it confirms, so the focus goes back to the views now.
242
+ if ((_promptRef$current2 = promptRef.current) !== null && _promptRef$current2 !== void 0 && _promptRef$current2.contains(document.activeElement)) {
243
+ focusChecked();
244
+ }
233
245
  setOfferPhase("applying");
234
246
  try {
235
247
  isApplied = (await onApplyToAll(offerId)) !== false;
236
248
  } finally {
237
- setOfferPhase(isApplied ? "applied" : "leaving");
238
- }
239
- };
240
- var dismiss = function dismiss() {
241
- if (offerPhase === "open") {
242
- setOfferPhase("leaving");
249
+ if (offerIdRef.current === offerId) {
250
+ setIsConfirmed(isApplied);
251
+ setOfferPhase(isApplied ? "applied" : "leaving");
252
+ }
243
253
  }
244
254
  };
245
255
  return /*#__PURE__*/_react.default.createElement(_Styles.StyledViewSwitcher, _extends({
@@ -248,32 +258,42 @@ var ViewSwitcher = exports.ViewSwitcher = /*#__PURE__*/(0, _react.forwardRef)(fu
248
258
  onKeyDown: handleRootKeyDown,
249
259
  onBlur: handleRootBlur
250
260
  }, rest), /*#__PURE__*/_react.default.createElement(_Styles.StyledViewSwitcherTrack, {
251
- ref: trackRef,
252
- role: offerView ? undefined : "radiogroup",
253
- "aria-label": offerView ? undefined : ariaLabel,
254
261
  className: "c-view-switcher__track"
255
- }, offerView ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Styles.StyledViewSwitcherPromptTitle, {
256
- id: offerTitleId
257
- }, offerTitle ? offerTitle(offerView) : "Now in ".concat(offerView.label)), /*#__PURE__*/_react.default.createElement(_Styles.StyledViewSwitcherPrompt, {
262
+ }, offerView && offerPhase !== "waiting" ? /*#__PURE__*/_react.default.createElement(_Styles.StyledViewSwitcherPrompt, {
263
+ ref: promptRef,
264
+ role: "group",
258
265
  "aria-labelledby": offerTitleId,
259
266
  className: "c-view-switcher__prompt",
260
- "data-phase": offerPhase
261
- }, /*#__PURE__*/_react.default.createElement(_PillButton.PillButton, {
262
- ref: offerActionRef,
267
+ "data-phase": offerPhase,
268
+ "data-confirmed": isConfirmed || undefined
269
+ }, /*#__PURE__*/_react.default.createElement(_Styles.StyledViewSwitcherPromptTitle, {
270
+ id: offerTitleId
271
+ }, offerTitle ? offerTitle(offerView) : "Now in ".concat(offerView.label)), /*#__PURE__*/_react.default.createElement(_Styles.StyledViewSwitcherPromptClip, null, /*#__PURE__*/_react.default.createElement(_Styles.StyledViewSwitcherPromptPill, {
272
+ className: "c-view-switcher__prompt-pill"
273
+ }, /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
274
+ title: applyToAllTitle,
275
+ placement: "bottom"
276
+ }, /*#__PURE__*/_react.default.createElement(_Styles.StyledViewSwitcherAction, {
263
277
  type: "button",
264
- tone: "accent",
265
- icon: offerPhase === "applied" ? /*#__PURE__*/_react.default.createElement(_Icons.CheckIcon, null) : undefined,
266
- placeholder: offerPhase === "applied" ? appliedLabel : applyToAllLabel,
278
+ "aria-label": applyToAllTitle,
279
+ className: "c-view-switcher__action",
267
280
  onClick: applyToAll
268
- }), offerPhase === "applied" ? null : /*#__PURE__*/_react.default.createElement(_PillButton.PillButton, {
281
+ }, /*#__PURE__*/_react.default.createElement(_Icons.CheckIcon, null), applyToAllLabel)), /*#__PURE__*/_react.default.createElement(_Styles.StyledViewSwitcherLine, {
282
+ className: "c-view-switcher__line"
283
+ }), /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
284
+ title: dismissLabel,
285
+ placement: "bottom"
286
+ }, /*#__PURE__*/_react.default.createElement(_Styles.StyledViewSwitcherDismiss, {
269
287
  type: "button",
270
- tone: "accent",
271
- iconOnly: true,
272
- icon: /*#__PURE__*/_react.default.createElement(_Icons.CloseIcon, null),
273
288
  "aria-label": dismissLabel,
274
289
  className: "c-view-switcher__dismiss",
275
- onClick: dismiss
276
- }))) : null, offerView ? null : views.map(function (view, index) {
290
+ onClick: leave
291
+ }, /*#__PURE__*/_react.default.createElement(_Icons.CloseSmallIcon, null))), isConfirmed ? /*#__PURE__*/_react.default.createElement(_Styles.StyledViewSwitcherApplied, {
292
+ role: "status"
293
+ }, /*#__PURE__*/_react.default.createElement(_Icons.CheckIcon, null), appliedLabel) : null))) : null, /*#__PURE__*/_react.default.createElement(_Styles.StyledViewSwitcherOptions, {
294
+ role: "radiogroup",
295
+ "aria-label": ariaLabel
296
+ }, views.map(function (view, index) {
277
297
  var checked = view.id === value;
278
298
  return /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
279
299
  key: view.id,
@@ -296,7 +316,7 @@ var ViewSwitcher = exports.ViewSwitcher = /*#__PURE__*/(0, _react.forwardRef)(fu
296
316
  return handleOptionKeyDown(event, index);
297
317
  }
298
318
  }, view.icon));
299
- })));
319
+ }))));
300
320
  });
301
321
  ViewSwitcher.displayName = "ViewSwitcher";
302
322
  //# sourceMappingURL=ViewSwitcher.js.map