@activecollab/components 2.0.570 → 2.0.571

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 (134) 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/ObjectFormModal/Styles.js +2 -2
  18. package/dist/cjs/components/ObjectFormModal/Styles.js.map +1 -1
  19. package/dist/cjs/components/PillButton/PillButton.js +5 -2
  20. package/dist/cjs/components/PillButton/PillButton.js.map +1 -1
  21. package/dist/cjs/components/PillButton/Styles.js +3 -1
  22. package/dist/cjs/components/PillButton/Styles.js.map +1 -1
  23. package/dist/cjs/components/PillGroup/PillGroup.js.map +1 -1
  24. package/dist/cjs/components/PillGroup/Styles.js +4 -1
  25. package/dist/cjs/components/PillGroup/Styles.js.map +1 -1
  26. package/dist/cjs/components/PresenceCapsule/PresenceCapsule.js +11 -8
  27. package/dist/cjs/components/PresenceCapsule/PresenceCapsule.js.map +1 -1
  28. package/dist/cjs/components/PresenceCapsule/Styles.js +7 -8
  29. package/dist/cjs/components/PresenceCapsule/Styles.js.map +1 -1
  30. package/dist/cjs/components/PropertyList/Styles.js +1 -1
  31. package/dist/cjs/components/PropertyList/Styles.js.map +1 -1
  32. package/dist/cjs/components/Sheet/Sheet.js +5 -2
  33. package/dist/cjs/components/Sheet/Sheet.js.map +1 -1
  34. package/dist/cjs/components/Sheet/Styles.js +19 -14
  35. package/dist/cjs/components/Sheet/Styles.js.map +1 -1
  36. package/dist/cjs/components/SwatchPalette/swatchPalette.js +1 -1
  37. package/dist/cjs/components/SwatchPalette/swatchPalette.js.map +1 -1
  38. package/dist/cjs/components/SwatchPalette/swatchPalette.test.js +1 -1
  39. package/dist/cjs/components/SwatchPalette/swatchPalette.test.js.map +1 -1
  40. package/dist/cjs/components/ToastMessage/Styles.js +6 -6
  41. package/dist/cjs/components/ToastMessage/Styles.js.map +1 -1
  42. package/dist/cjs/components/Tooltip/Tooltip.js +5 -0
  43. package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
  44. package/dist/cjs/components/ViewSwitcher/Styles.js +53 -17
  45. package/dist/cjs/components/ViewSwitcher/Styles.js.map +1 -1
  46. package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js +101 -92
  47. package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
  48. package/dist/cjs/presentation/shared/ActivityFeed.js +1 -1
  49. package/dist/cjs/presentation/shared/ActivityFeed.js.map +1 -1
  50. package/dist/esm/components/Autocomplete/Autocomplete.js +1 -1
  51. package/dist/esm/components/Autocomplete/Autocomplete.js.map +1 -1
  52. package/dist/esm/components/Autocomplete/Styles.js +1 -1
  53. package/dist/esm/components/Autocomplete/Styles.js.map +1 -1
  54. package/dist/esm/components/Dialog/Styles.js +1 -1
  55. package/dist/esm/components/Dialog/Styles.js.map +1 -1
  56. package/dist/esm/components/GlobalStyle.d.ts.map +1 -1
  57. package/dist/esm/components/GlobalStyle.js +1 -1
  58. package/dist/esm/components/GlobalStyle.js.map +1 -1
  59. package/dist/esm/components/Icons/collection/ArrowUpCircle.d.ts +32 -0
  60. package/dist/esm/components/Icons/collection/ArrowUpCircle.d.ts.map +1 -0
  61. package/dist/esm/components/Icons/collection/ArrowUpCircle.js +54 -0
  62. package/dist/esm/components/Icons/collection/ArrowUpCircle.js.map +1 -0
  63. package/dist/esm/components/Icons/collection/Storage.d.ts +32 -0
  64. package/dist/esm/components/Icons/collection/Storage.d.ts.map +1 -0
  65. package/dist/esm/components/Icons/collection/Storage.js +54 -0
  66. package/dist/esm/components/Icons/collection/Storage.js.map +1 -0
  67. package/dist/esm/components/Icons/collection/index.d.ts +2 -0
  68. package/dist/esm/components/Icons/collection/index.d.ts.map +1 -1
  69. package/dist/esm/components/Icons/collection/index.js +2 -0
  70. package/dist/esm/components/Icons/collection/index.js.map +1 -1
  71. package/dist/esm/components/IdentityMark/Styles.d.ts +1 -1
  72. package/dist/esm/components/IdentityMark/Styles.d.ts.map +1 -1
  73. package/dist/esm/components/IdentityMark/Styles.js +7 -0
  74. package/dist/esm/components/IdentityMark/Styles.js.map +1 -1
  75. package/dist/esm/components/ObjectFormModal/Styles.js +2 -2
  76. package/dist/esm/components/ObjectFormModal/Styles.js.map +1 -1
  77. package/dist/esm/components/PillButton/PillButton.d.ts +3 -1
  78. package/dist/esm/components/PillButton/PillButton.d.ts.map +1 -1
  79. package/dist/esm/components/PillButton/PillButton.js +5 -2
  80. package/dist/esm/components/PillButton/PillButton.js.map +1 -1
  81. package/dist/esm/components/PillButton/Styles.d.ts.map +1 -1
  82. package/dist/esm/components/PillButton/Styles.js +3 -1
  83. package/dist/esm/components/PillButton/Styles.js.map +1 -1
  84. package/dist/esm/components/PillGroup/PillGroup.d.ts +2 -2
  85. package/dist/esm/components/PillGroup/PillGroup.d.ts.map +1 -1
  86. package/dist/esm/components/PillGroup/PillGroup.js.map +1 -1
  87. package/dist/esm/components/PillGroup/Styles.d.ts.map +1 -1
  88. package/dist/esm/components/PillGroup/Styles.js +2 -1
  89. package/dist/esm/components/PillGroup/Styles.js.map +1 -1
  90. package/dist/esm/components/PresenceCapsule/PresenceCapsule.d.ts +2 -2
  91. package/dist/esm/components/PresenceCapsule/PresenceCapsule.d.ts.map +1 -1
  92. package/dist/esm/components/PresenceCapsule/PresenceCapsule.js +11 -8
  93. package/dist/esm/components/PresenceCapsule/PresenceCapsule.js.map +1 -1
  94. package/dist/esm/components/PresenceCapsule/Styles.d.ts +1 -3
  95. package/dist/esm/components/PresenceCapsule/Styles.d.ts.map +1 -1
  96. package/dist/esm/components/PresenceCapsule/Styles.js +6 -5
  97. package/dist/esm/components/PresenceCapsule/Styles.js.map +1 -1
  98. package/dist/esm/components/PropertyList/Styles.js +1 -1
  99. package/dist/esm/components/PropertyList/Styles.js.map +1 -1
  100. package/dist/esm/components/Sheet/Sheet.d.ts +2 -0
  101. package/dist/esm/components/Sheet/Sheet.d.ts.map +1 -1
  102. package/dist/esm/components/Sheet/Sheet.js +6 -3
  103. package/dist/esm/components/Sheet/Sheet.js.map +1 -1
  104. package/dist/esm/components/Sheet/Styles.d.ts +1 -0
  105. package/dist/esm/components/Sheet/Styles.d.ts.map +1 -1
  106. package/dist/esm/components/Sheet/Styles.js +17 -12
  107. package/dist/esm/components/Sheet/Styles.js.map +1 -1
  108. package/dist/esm/components/SwatchPalette/swatchPalette.d.ts +1 -1
  109. package/dist/esm/components/SwatchPalette/swatchPalette.d.ts.map +1 -1
  110. package/dist/esm/components/SwatchPalette/swatchPalette.js +1 -1
  111. package/dist/esm/components/SwatchPalette/swatchPalette.js.map +1 -1
  112. package/dist/esm/components/SwatchPalette/swatchPalette.test.js +1 -1
  113. package/dist/esm/components/SwatchPalette/swatchPalette.test.js.map +1 -1
  114. package/dist/esm/components/ToastMessage/Styles.d.ts.map +1 -1
  115. package/dist/esm/components/ToastMessage/Styles.js +3 -3
  116. package/dist/esm/components/ToastMessage/Styles.js.map +1 -1
  117. package/dist/esm/components/Tooltip/Tooltip.d.ts.map +1 -1
  118. package/dist/esm/components/Tooltip/Tooltip.js +5 -0
  119. package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
  120. package/dist/esm/components/ViewSwitcher/Styles.d.ts +10 -3
  121. package/dist/esm/components/ViewSwitcher/Styles.d.ts.map +1 -1
  122. package/dist/esm/components/ViewSwitcher/Styles.js +52 -16
  123. package/dist/esm/components/ViewSwitcher/Styles.js.map +1 -1
  124. package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts +5 -2
  125. package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts.map +1 -1
  126. package/dist/esm/components/ViewSwitcher/ViewSwitcher.js +95 -89
  127. package/dist/esm/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
  128. package/dist/esm/presentation/shared/ActivityFeed.js +1 -1
  129. package/dist/esm/presentation/shared/ActivityFeed.js.map +1 -1
  130. package/dist/index.js +853 -674
  131. package/dist/index.js.map +1 -1
  132. package/dist/index.min.js +1 -1
  133. package/dist/index.min.js.map +1 -1
  134. package/package.json +1 -1
@@ -1,11 +1,10 @@
1
1
  import styled, { keyframes } from "styled-components";
2
2
  import { BoxSizingStyle } from "../BoxSizingStyle";
3
3
  import { List } from "../List";
4
- import { PillGroup } from "../PillGroup";
4
+ export const VIEW_SWITCHER_PROMPT_DELAY_MS = 100;
5
5
  export const VIEW_SWITCHER_PROMPT_MS = 5000;
6
- export const VIEW_SWITCHER_RESIZE_MS = 200;
7
6
  export const VIEW_SWITCHER_APPLIED_MS = 900;
8
- export const VIEW_SWITCHER_LEAVE_MS = 150;
7
+ export const VIEW_SWITCHER_LEAVE_MS = 200;
9
8
  export const StyledViewSwitcher = styled.div.withConfig({
10
9
  displayName: "Styles__StyledViewSwitcher",
11
10
  componentId: "sc-1cg2mte-0"
@@ -14,45 +13,82 @@ StyledViewSwitcher.displayName = "StyledViewSwitcher";
14
13
  export const StyledViewSwitcherTrack = styled.div.withConfig({
15
14
  displayName: "Styles__StyledViewSwitcherTrack",
16
15
  componentId: "sc-1cg2mte-1"
17
- })(["", " 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, VIEW_SWITCHER_RESIZE_MS);
16
+ })(["", " display:inline-flex;align-items:center;height:32px;padding:3px;border-radius:var(--ac-br-rounded);background-color:var(--color-theme-300);"], BoxSizingStyle);
18
17
  StyledViewSwitcherTrack.displayName = "StyledViewSwitcherTrack";
18
+ export const StyledViewSwitcherOptions = styled.div.withConfig({
19
+ displayName: "Styles__StyledViewSwitcherOptions",
20
+ componentId: "sc-1cg2mte-2"
21
+ })(["display:inline-flex;align-items:center;"]);
22
+ StyledViewSwitcherOptions.displayName = "StyledViewSwitcherOptions";
19
23
  export const StyledViewSwitcherOption = styled.button.withConfig({
20
24
  displayName: "Styles__StyledViewSwitcherOption",
21
- componentId: "sc-1cg2mte-2"
25
+ componentId: "sc-1cg2mte-3"
22
26
  })(["", " 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);
23
27
  StyledViewSwitcherOption.displayName = "StyledViewSwitcherOption";
24
28
  export const StyledViewSwitcherMenuOption = styled.button.withConfig({
25
29
  displayName: "Styles__StyledViewSwitcherMenuOption",
26
- componentId: "sc-1cg2mte-3"
30
+ componentId: "sc-1cg2mte-4"
27
31
  })(["", " 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);
28
32
  StyledViewSwitcherMenuOption.displayName = "StyledViewSwitcherMenuOption";
29
33
  export const StyledViewSwitcherMenuIcon = styled.span.withConfig({
30
34
  displayName: "Styles__StyledViewSwitcherMenuIcon",
31
- componentId: "sc-1cg2mte-4"
35
+ componentId: "sc-1cg2mte-5"
32
36
  })(["display:inline-flex;flex-shrink:0;margin-right:8px;fill:var(--color-theme-900);"]);
33
37
  StyledViewSwitcherMenuIcon.displayName = "StyledViewSwitcherMenuIcon";
34
38
  export const StyledViewSwitcherMenuList = styled(List).withConfig({
35
39
  displayName: "Styles__StyledViewSwitcherMenuList",
36
- componentId: "sc-1cg2mte-5"
40
+ componentId: "sc-1cg2mte-6"
37
41
  })(["padding:8px 0;"]);
38
42
  StyledViewSwitcherMenuList.displayName = "StyledViewSwitcherMenuList";
39
43
  export const StyledViewSwitcherMenuLabel = styled.span.withConfig({
40
44
  displayName: "Styles__StyledViewSwitcherMenuLabel",
41
- componentId: "sc-1cg2mte-6"
45
+ componentId: "sc-1cg2mte-7"
42
46
  })(["flex:1;&[data-selected=\"true\"]{font-weight:bold;color:var(--color-primary);}"]);
43
47
  StyledViewSwitcherMenuLabel.displayName = "StyledViewSwitcherMenuLabel";
44
- const promptIn = keyframes(["from{opacity:0;}"]);
45
- const promptOut = keyframes(["to{opacity:0;transform:scale(0.96);}"]);
46
- const promptTimeLeft = keyframes(["to{transform:scaleX(0);}"]);
48
+ const promptIn = keyframes(["from{grid-template-columns:0fr;opacity:0;}"]);
49
+ const promptOut = keyframes(["to{grid-template-columns:0fr;opacity:0;}"]);
50
+ const appliedIn = keyframes(["from{opacity:0;transform:translateY(6px);}"]);
47
51
  const appliedIcon = keyframes(["from{opacity:0;transform:scale(0.4);}60%{transform:scale(1.2);}"]);
48
52
  export const StyledViewSwitcherPromptTitle = styled.span.withConfig({
49
53
  displayName: "Styles__StyledViewSwitcherPromptTitle",
50
- componentId: "sc-1cg2mte-7"
54
+ componentId: "sc-1cg2mte-8"
51
55
  })(["position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;"]);
52
56
  StyledViewSwitcherPromptTitle.displayName = "StyledViewSwitcherPromptTitle";
53
- export const StyledViewSwitcherPrompt = styled(PillGroup).withConfig({
57
+ const PROMPT_EASE = "cubic-bezier(0.4, 0, 0.2, 1)";
58
+ const APPLIED_SWAP_MS = 160;
59
+ export const StyledViewSwitcherPrompt = styled.div.withConfig({
54
60
  displayName: "Styles__StyledViewSwitcherPrompt",
55
- componentId: "sc-1cg2mte-8"
56
- })(["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);
61
+ componentId: "sc-1cg2mte-9"
62
+ })(["", " display:grid;flex-shrink:0;grid-template-columns:1fr;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, 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);
57
63
  StyledViewSwitcherPrompt.displayName = "StyledViewSwitcherPrompt";
64
+ export const StyledViewSwitcherPromptClip = styled.div.withConfig({
65
+ displayName: "Styles__StyledViewSwitcherPromptClip",
66
+ componentId: "sc-1cg2mte-10"
67
+ })(["display:flex;min-width:0;overflow:hidden;"]);
68
+ StyledViewSwitcherPromptClip.displayName = "StyledViewSwitcherPromptClip";
69
+ export const StyledViewSwitcherPromptPill = styled.div.withConfig({
70
+ displayName: "Styles__StyledViewSwitcherPromptPill",
71
+ componentId: "sc-1cg2mte-11"
72
+ })(["", " position:relative;display:inline-flex;flex-shrink:0;align-items:center;height:26px;margin-right:2px;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);
73
+ StyledViewSwitcherPromptPill.displayName = "StyledViewSwitcherPromptPill";
74
+ export const StyledViewSwitcherAction = styled.button.withConfig({
75
+ displayName: "Styles__StyledViewSwitcherAction",
76
+ componentId: "sc-1cg2mte-12"
77
+ })(["", " 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);
78
+ StyledViewSwitcherAction.displayName = "StyledViewSwitcherAction";
79
+ export const StyledViewSwitcherLine = styled.i.withConfig({
80
+ displayName: "Styles__StyledViewSwitcherLine",
81
+ componentId: "sc-1cg2mte-13"
82
+ })(["flex-shrink:0;width:1px;height:14px;margin:0 1px 0 6px;background-color:color-mix(in srgb,var(--color-primary) 35%,transparent);"]);
83
+ StyledViewSwitcherLine.displayName = "StyledViewSwitcherLine";
84
+ export const StyledViewSwitcherDismiss = styled.button.withConfig({
85
+ displayName: "Styles__StyledViewSwitcherDismiss",
86
+ componentId: "sc-1cg2mte-14"
87
+ })(["", " 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);
88
+ StyledViewSwitcherDismiss.displayName = "StyledViewSwitcherDismiss";
89
+ export const StyledViewSwitcherApplied = styled.span.withConfig({
90
+ displayName: "Styles__StyledViewSwitcherApplied",
91
+ componentId: "sc-1cg2mte-15"
92
+ })(["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);
93
+ StyledViewSwitcherApplied.displayName = "StyledViewSwitcherApplied";
58
94
  //# sourceMappingURL=Styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Styles.js","names":["styled","keyframes","BoxSizingStyle","List","PillGroup","VIEW_SWITCHER_PROMPT_MS","VIEW_SWITCHER_RESIZE_MS","VIEW_SWITCHER_APPLIED_MS","VIEW_SWITCHER_LEAVE_MS","StyledViewSwitcher","div","withConfig","displayName","componentId","StyledViewSwitcherTrack","StyledViewSwitcherOption","button","StyledViewSwitcherMenuOption","StyledViewSwitcherMenuIcon","span","StyledViewSwitcherMenuList","StyledViewSwitcherMenuLabel","promptIn","promptOut","promptTimeLeft","appliedIcon","StyledViewSwitcherPromptTitle","StyledViewSwitcherPrompt"],"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,OAAOA,MAAM,IAAIC,SAAS,QAAQ,mBAAmB;AAErD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,IAAI,QAAQ,SAAS;AAC9B,SAASC,SAAS,QAAQ,cAAc;AAExC,OAAO,MAAMC,uBAAuB,GAAG,IAAI;AAC3C,OAAO,MAAMC,uBAAuB,GAAG,GAAG;AAC1C,OAAO,MAAMC,wB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S,sBAIzB;AAED,MAAMsB,SAAS,GAAGtB,SAAS,0CAK1B;AAED,MAAMuB,cAAc,GAAGvB,SAAS,8BAI/B;AAED,MAAMwB,WAAW,GAAGxB,SAAS,qEAQ5B;AAED,OAAO,MAAMyB,6BAA6B,GAAG1B,MAAM,CAACmB,IAAI,CAAAR,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,uGAOvD;AAEDa,6BAA6B,CAACd,WAAW,GAAG,+BAA+B;AAE3E,OAAO,MAAMe,wBAAwB,GAAG3B,MAAM,CAACI,SAAS,CAAC,CAAAO,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wgCAG1CS,QAAQ,EAyBNE,cAAc,EAAInB,uBAAuB,EAiCvCoB,WAAW,EAMbF,SAAS,EAAIf,sBAAsB,CAEnD;AAEDmB,wBAAwB,CAACf,WAAW,GAAG,0BAA0B","ignoreList":[]}
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","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 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\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 grid-template-columns: 0fr;\n opacity: 0;\n }\n`;\n\nconst promptOut = keyframes`\n to {\n grid-template-columns: 0fr;\n opacity: 0;\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\nexport const StyledViewSwitcherPrompt = styled.div`\n ${BoxSizingStyle}\n display: grid;\n flex-shrink: 0;\n grid-template-columns: 1fr;\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 min-width: 0;\n overflow: hidden;\n`;\n\nStyledViewSwitcherPromptClip.displayName = \"StyledViewSwitcherPromptClip\";\n\nexport const StyledViewSwitcherPromptPill = styled.div`\n ${BoxSizingStyle}\n position: relative;\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n height: 26px;\n margin-right: 2px;\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,wJAC7CV,cAAc,CAOjB;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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OrCY,SAAS,EAAII,eAAe,EAAMD,WAAW,EAM3CF,WAAW,CAU3B;AAEDW,yBAAyB,CAACzB,WAAW,GAAG,2BAA2B","ignoreList":[]}
@@ -15,8 +15,10 @@ 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
- /** Extra action button text. */
18
+ /** Short visible text of the extra action. */
19
19
  applyToAllLabel?: string;
20
+ /** Tooltip and accessible name of the extra action. */
21
+ applyToAllTitle?: string;
20
22
  /** Accessible name of the extra action group. Defaults to "Now in {label}". */
21
23
  offerTitle?: (view: ViewSwitcherView) => ReactNode;
22
24
  /** Accessible name of the button that dismisses the extra action. */
@@ -28,7 +30,8 @@ export interface ViewSwitcherProps extends Omit<HTMLAttributes<HTMLDivElement>,
28
30
  * @component ViewSwitcher
29
31
  * @description
30
32
  * Icon-only radiogroup that switches the view of a page. A tooltip shows the view name on hover.
31
- * With onApplyToAll, a switch replaces the buttons with an extra action for five seconds.
33
+ * With onApplyToAll, a switch or a click on the checked view opens a compact extra action beside the buttons
34
+ * after a short delay, for five seconds.
32
35
  *
33
36
  * @example
34
37
  * <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,EAOV,MAAM,OAAO,CAAC;AAoBf,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,EAA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AAE,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;CACvB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,0FA+TxB,CAAC"}
@@ -1,18 +1,18 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["views", "value", "onChange", "aria-label", "onApplyToAll", "applyToAllLabel", "offerTitle", "dismissLabel", "appliedLabel", "className", "onKeyDown", "onBlur"];
4
- import React, { forwardRef, useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
3
+ const _excluded = ["views", "value", "onChange", "aria-label", "onApplyToAll", "applyToAllLabel", "applyToAllTitle", "offerTitle", "dismissLabel", "appliedLabel", "className", "onKeyDown", "onBlur"];
4
+ import React, { forwardRef, useCallback, useEffect, useId, useRef, useState } from "react";
5
5
  import classnames from "classnames";
6
- import { StyledViewSwitcher, StyledViewSwitcherOption, StyledViewSwitcherPrompt, StyledViewSwitcherPromptTitle, StyledViewSwitcherTrack, VIEW_SWITCHER_APPLIED_MS, VIEW_SWITCHER_LEAVE_MS, VIEW_SWITCHER_PROMPT_MS, VIEW_SWITCHER_RESIZE_MS } from "./Styles";
6
+ import { StyledViewSwitcher, StyledViewSwitcherAction, StyledViewSwitcherApplied, StyledViewSwitcherDismiss, StyledViewSwitcherLine, StyledViewSwitcherOption, StyledViewSwitcherOptions, StyledViewSwitcherPrompt, StyledViewSwitcherPromptClip, StyledViewSwitcherPromptPill, StyledViewSwitcherPromptTitle, StyledViewSwitcherTrack, VIEW_SWITCHER_APPLIED_MS, VIEW_SWITCHER_LEAVE_MS, VIEW_SWITCHER_PROMPT_DELAY_MS, VIEW_SWITCHER_PROMPT_MS } from "./Styles";
7
7
  import useForkRef from "../../utils/useForkRef";
8
- import { CheckIcon, CloseIcon } from "../Icons";
9
- import { PillButton } from "../PillButton";
8
+ import { CheckIcon, CloseSmallIcon } from "../Icons";
10
9
  import { Tooltip } from "../Tooltip";
11
10
  /**
12
11
  * @component ViewSwitcher
13
12
  * @description
14
13
  * Icon-only radiogroup that switches the view of a page. A tooltip shows the view name on hover.
15
- * With onApplyToAll, a switch replaces the buttons with an extra action for five seconds.
14
+ * With onApplyToAll, a switch or a click on the checked view opens a compact extra action beside the buttons
15
+ * after a short delay, for five seconds.
16
16
  *
17
17
  * @example
18
18
  * <ViewSwitcher
@@ -35,7 +35,9 @@ export const ViewSwitcher = /*#__PURE__*/forwardRef((_ref, ref) => {
35
35
  ariaLabel = _ref$ariaLabel === void 0 ? "View" : _ref$ariaLabel,
36
36
  onApplyToAll = _ref.onApplyToAll,
37
37
  _ref$applyToAllLabel = _ref.applyToAllLabel,
38
- applyToAllLabel = _ref$applyToAllLabel === void 0 ? "Apply to All Projects" : _ref$applyToAllLabel,
38
+ applyToAllLabel = _ref$applyToAllLabel === void 0 ? "All Projects" : _ref$applyToAllLabel,
39
+ _ref$applyToAllTitle = _ref.applyToAllTitle,
40
+ applyToAllTitle = _ref$applyToAllTitle === void 0 ? "Apply to All Projects" : _ref$applyToAllTitle,
39
41
  offerTitle = _ref.offerTitle,
40
42
  _ref$dismissLabel = _ref.dismissLabel,
41
43
  dismissLabel = _ref$dismissLabel === void 0 ? "Dismiss" : _ref$dismissLabel,
@@ -47,20 +49,23 @@ export const ViewSwitcher = /*#__PURE__*/forwardRef((_ref, ref) => {
47
49
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
48
50
  const rootRef = useRef(null);
49
51
  const handleRootRef = useForkRef(rootRef, ref);
50
- const trackRef = useRef(null);
51
52
  const optionRefs = useRef({});
52
- const offerActionRef = useRef(null);
53
+ const promptRef = useRef(null);
53
54
  const _useState = useState(null),
54
55
  offerId = _useState[0],
55
56
  setOfferId = _useState[1];
56
- const _useState2 = useState("open"),
57
+ const _useState2 = useState("waiting"),
57
58
  offerPhase = _useState2[0],
58
59
  setOfferPhase = _useState2[1];
60
+ const _useState3 = useState(false),
61
+ isConfirmed = _useState3[0],
62
+ setIsConfirmed = _useState3[1];
59
63
  const offerTitleId = useId();
60
- const closedWidthRef = useRef(0);
61
- const wasOfferOpenRef = useRef(false);
64
+ const offerIdRef = useRef(offerId);
65
+ const offerPhaseRef = useRef(offerPhase);
62
66
  const restoreFocusRef = useRef(false);
63
- const resizeTimerRef = useRef();
67
+ offerIdRef.current = offerId;
68
+ offerPhaseRef.current = offerPhase;
64
69
  const checkedIndex = views.findIndex(_ref2 => {
65
70
  let id = _ref2.id;
66
71
  return id === value;
@@ -71,14 +76,21 @@ export const ViewSwitcher = /*#__PURE__*/forwardRef((_ref, ref) => {
71
76
  return id === offerId;
72
77
  });
73
78
  const select = useCallback(id => {
79
+ // A click on the checked view also offers the extra action.
74
80
  if (id === value) {
81
+ const isOfferUp = offerIdRef.current && ["open", "applying", "applied"].includes(offerPhaseRef.current);
82
+ if (onApplyToAll && !isOfferUp) {
83
+ setOfferPhase("waiting");
84
+ setIsConfirmed(false);
85
+ setOfferId(id);
86
+ }
75
87
  return;
76
88
  }
77
89
  onChange(id);
78
90
  if (onApplyToAll) {
79
- var _trackRef$current$off, _trackRef$current;
80
- closedWidthRef.current = (_trackRef$current$off = (_trackRef$current = trackRef.current) == null ? void 0 : _trackRef$current.offsetWidth) != null ? _trackRef$current$off : 0;
81
- setOfferPhase("open");
91
+ // An open prompt stays for the next switch, and only a new one waits.
92
+ setOfferPhase(phase => offerIdRef.current && phase === "open" ? "open" : "waiting");
93
+ setIsConfirmed(false);
82
94
  setOfferId(id);
83
95
  }
84
96
  }, [onApplyToAll, onChange, value]);
@@ -92,72 +104,48 @@ export const ViewSwitcher = /*#__PURE__*/forwardRef((_ref, ref) => {
92
104
  (_optionRefs$current$t = optionRefs.current[tabStopId]) == null || _optionRefs$current$t.focus();
93
105
  }
94
106
  }, [tabStopId]);
95
- const closeOffer = useCallback(restoreFocus => {
96
- restoreFocusRef.current = restoreFocus;
97
- setOfferId(null);
98
- }, []);
99
-
100
- // The buttons and the prompt take turns in the track, so the track holds its width from one to the other.
101
- useLayoutEffect(() => {
102
- const track = trackRef.current;
103
- const isOpen = Boolean(offerId);
104
- const wasOpen = wasOfferOpenRef.current;
105
- wasOfferOpenRef.current = isOpen;
106
- if (!track || isOpen === wasOpen) {
107
- return;
108
- }
109
- clearTimeout(resizeTimerRef.current);
110
- const from = isOpen ? closedWidthRef.current : track.offsetWidth;
111
- track.style.width = "";
112
- const natural = track.offsetWidth;
113
- const to = isOpen ? Math.max(natural, from) : natural;
114
- track.style.overflow = "hidden";
115
- track.style.width = from + "px";
116
- // Without this read the browser skips the start width, and nothing animates.
117
- void track.offsetWidth;
118
- track.style.width = to + "px";
119
- if (isOpen) {
120
- var _offerActionRef$curre;
121
- (_offerActionRef$curre = offerActionRef.current) == null || _offerActionRef$curre.focus({
122
- preventScroll: true
123
- });
107
+ const leave = useCallback(() => {
108
+ var _promptRef$current;
109
+ restoreFocusRef.current = Boolean((_promptRef$current = promptRef.current) == null ? void 0 : _promptRef$current.contains(document.activeElement));
110
+ if (offerPhaseRef.current === "waiting") {
111
+ setOfferId(null);
124
112
  return;
125
113
  }
126
- resizeTimerRef.current = setTimeout(() => {
127
- track.style.width = "";
128
- track.style.overflow = "";
129
- }, VIEW_SWITCHER_RESIZE_MS);
130
- if (restoreFocusRef.current) {
114
+ setOfferPhase("leaving");
115
+ }, []);
116
+ useEffect(() => {
117
+ if (!offerId && restoreFocusRef.current) {
131
118
  restoreFocusRef.current = false;
132
119
  focusChecked();
133
120
  }
134
121
  }, [focusChecked, offerId]);
135
- useEffect(() => () => clearTimeout(resizeTimerRef.current), []);
136
122
  useEffect(() => {
137
123
  if (!offerId || offerPhase === "applying") {
138
124
  return undefined;
139
125
  }
126
+ if (offerPhase === "waiting") {
127
+ const timer = setTimeout(() => setOfferPhase("open"), VIEW_SWITCHER_PROMPT_DELAY_MS);
128
+ return () => clearTimeout(timer);
129
+ }
140
130
  if (offerPhase === "leaving") {
141
- const timer = setTimeout(() => {
142
- closeOffer(isInside(document.activeElement));
143
- }, VIEW_SWITCHER_LEAVE_MS);
131
+ const timer = setTimeout(() => setOfferId(null), VIEW_SWITCHER_LEAVE_MS);
144
132
  return () => clearTimeout(timer);
145
133
  }
146
- const timer = setTimeout(() => setOfferPhase("leaving"), offerPhase === "applied" ? VIEW_SWITCHER_APPLIED_MS : VIEW_SWITCHER_PROMPT_MS);
134
+ const timer = setTimeout(leave, offerPhase === "applied" ? VIEW_SWITCHER_APPLIED_MS : VIEW_SWITCHER_PROMPT_MS);
147
135
  return () => clearTimeout(timer);
148
- }, [closeOffer, offerId, offerPhase]);
136
+ }, [leave, offerId, offerPhase]);
149
137
  useEffect(() => {
150
138
  if (!offerId) {
151
139
  return undefined;
152
140
  }
153
- const closeOutside = event => {
141
+ const leaveOutside = event => {
154
142
  if (!isInside(event.target)) {
155
- setOfferId(null);
143
+ leave();
156
144
  }
157
145
  };
158
- document.addEventListener("mousedown", closeOutside);
159
- return () => document.removeEventListener("mousedown", closeOutside);
160
- }, [offerId]);
146
+ document.addEventListener("mousedown", leaveOutside);
147
+ return () => document.removeEventListener("mousedown", leaveOutside);
148
+ }, [leave, offerId]);
161
149
  const handleOptionKeyDown = (event, index) => {
162
150
  var _optionRefs$current$i;
163
151
  const last = views.length - 1;
@@ -183,34 +171,42 @@ export const ViewSwitcher = /*#__PURE__*/forwardRef((_ref, ref) => {
183
171
  if (event.key !== "Escape" || !offerId) {
184
172
  return;
185
173
  }
174
+ if (offerPhase === "waiting") {
175
+ leave();
176
+ return;
177
+ }
186
178
 
187
179
  // A native dialog around the switcher would take an Escape that is not prevented as its own close request.
188
180
  event.preventDefault();
189
181
  event.stopPropagation();
190
- closeOffer(true);
182
+ leave();
191
183
  };
192
184
  const handleRootBlur = event => {
193
185
  onBlur == null || onBlur(event);
194
186
  const next = event.relatedTarget;
195
- if (next && !isInside(next)) {
196
- setOfferId(null);
187
+ if (offerId && next && !isInside(next)) {
188
+ leave();
197
189
  }
198
190
  };
199
191
  const applyToAll = async () => {
192
+ var _promptRef$current2;
200
193
  if (!offerId || !onApplyToAll || offerPhase !== "open") {
201
194
  return;
202
195
  }
203
196
  let isApplied = false;
197
+
198
+ // The action hides while it confirms, so the focus goes back to the views now.
199
+ if ((_promptRef$current2 = promptRef.current) != null && _promptRef$current2.contains(document.activeElement)) {
200
+ focusChecked();
201
+ }
204
202
  setOfferPhase("applying");
205
203
  try {
206
204
  isApplied = (await onApplyToAll(offerId)) !== false;
207
205
  } finally {
208
- setOfferPhase(isApplied ? "applied" : "leaving");
209
- }
210
- };
211
- const dismiss = () => {
212
- if (offerPhase === "open") {
213
- setOfferPhase("leaving");
206
+ if (offerIdRef.current === offerId) {
207
+ setIsConfirmed(isApplied);
208
+ setOfferPhase(isApplied ? "applied" : "leaving");
209
+ }
214
210
  }
215
211
  };
216
212
  return /*#__PURE__*/React.createElement(StyledViewSwitcher, _extends({
@@ -219,32 +215,42 @@ export const ViewSwitcher = /*#__PURE__*/forwardRef((_ref, ref) => {
219
215
  onKeyDown: handleRootKeyDown,
220
216
  onBlur: handleRootBlur
221
217
  }, rest), /*#__PURE__*/React.createElement(StyledViewSwitcherTrack, {
222
- ref: trackRef,
223
- role: offerView ? undefined : "radiogroup",
224
- "aria-label": offerView ? undefined : ariaLabel,
225
218
  className: "c-view-switcher__track"
226
- }, offerView ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledViewSwitcherPromptTitle, {
227
- id: offerTitleId
228
- }, offerTitle ? offerTitle(offerView) : "Now in " + offerView.label), /*#__PURE__*/React.createElement(StyledViewSwitcherPrompt, {
219
+ }, offerView && offerPhase !== "waiting" ? /*#__PURE__*/React.createElement(StyledViewSwitcherPrompt, {
220
+ ref: promptRef,
221
+ role: "group",
229
222
  "aria-labelledby": offerTitleId,
230
223
  className: "c-view-switcher__prompt",
231
- "data-phase": offerPhase
232
- }, /*#__PURE__*/React.createElement(PillButton, {
233
- ref: offerActionRef,
224
+ "data-phase": offerPhase,
225
+ "data-confirmed": isConfirmed || undefined
226
+ }, /*#__PURE__*/React.createElement(StyledViewSwitcherPromptTitle, {
227
+ id: offerTitleId
228
+ }, offerTitle ? offerTitle(offerView) : "Now in " + offerView.label), /*#__PURE__*/React.createElement(StyledViewSwitcherPromptClip, null, /*#__PURE__*/React.createElement(StyledViewSwitcherPromptPill, {
229
+ className: "c-view-switcher__prompt-pill"
230
+ }, /*#__PURE__*/React.createElement(Tooltip, {
231
+ title: applyToAllTitle,
232
+ placement: "bottom"
233
+ }, /*#__PURE__*/React.createElement(StyledViewSwitcherAction, {
234
234
  type: "button",
235
- tone: "accent",
236
- icon: offerPhase === "applied" ? /*#__PURE__*/React.createElement(CheckIcon, null) : undefined,
237
- placeholder: offerPhase === "applied" ? appliedLabel : applyToAllLabel,
235
+ "aria-label": applyToAllTitle,
236
+ className: "c-view-switcher__action",
238
237
  onClick: applyToAll
239
- }), offerPhase === "applied" ? null : /*#__PURE__*/React.createElement(PillButton, {
238
+ }, /*#__PURE__*/React.createElement(CheckIcon, null), applyToAllLabel)), /*#__PURE__*/React.createElement(StyledViewSwitcherLine, {
239
+ className: "c-view-switcher__line"
240
+ }), /*#__PURE__*/React.createElement(Tooltip, {
241
+ title: dismissLabel,
242
+ placement: "bottom"
243
+ }, /*#__PURE__*/React.createElement(StyledViewSwitcherDismiss, {
240
244
  type: "button",
241
- tone: "accent",
242
- iconOnly: true,
243
- icon: /*#__PURE__*/React.createElement(CloseIcon, null),
244
245
  "aria-label": dismissLabel,
245
246
  className: "c-view-switcher__dismiss",
246
- onClick: dismiss
247
- }))) : null, offerView ? null : views.map((view, index) => {
247
+ onClick: leave
248
+ }, /*#__PURE__*/React.createElement(CloseSmallIcon, null))), isConfirmed ? /*#__PURE__*/React.createElement(StyledViewSwitcherApplied, {
249
+ role: "status"
250
+ }, /*#__PURE__*/React.createElement(CheckIcon, null), appliedLabel) : null))) : null, /*#__PURE__*/React.createElement(StyledViewSwitcherOptions, {
251
+ role: "radiogroup",
252
+ "aria-label": ariaLabel
253
+ }, views.map((view, index) => {
248
254
  const checked = view.id === value;
249
255
  return /*#__PURE__*/React.createElement(Tooltip, {
250
256
  key: view.id,
@@ -263,7 +269,7 @@ export const ViewSwitcher = /*#__PURE__*/forwardRef((_ref, ref) => {
263
269
  onClick: () => select(view.id),
264
270
  onKeyDown: event => handleOptionKeyDown(event, index)
265
271
  }, view.icon));
266
- })));
272
+ }))));
267
273
  });
268
274
  ViewSwitcher.displayName = "ViewSwitcher";
269
275
  //# sourceMappingURL=ViewSwitcher.js.map