@activecollab/components 2.0.575 → 2.0.577
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.
- package/dist/cjs/components/Popper/Popper.js +14 -0
- package/dist/cjs/components/Popper/Popper.js.map +1 -1
- package/dist/cjs/components/Popper/anchorMove.js +42 -0
- package/dist/cjs/components/Popper/anchorMove.js.map +1 -0
- package/dist/cjs/components/ViewSettings/Styles.js +8 -3
- package/dist/cjs/components/ViewSettings/Styles.js.map +1 -1
- package/dist/cjs/components/ViewSettings/ViewSettings.js +64 -3
- package/dist/cjs/components/ViewSettings/ViewSettings.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/ApplyToAllTab.js +199 -0
- package/dist/cjs/components/ViewSwitcher/ApplyToAllTab.js.map +1 -0
- package/dist/cjs/components/ViewSwitcher/Styles.js +73 -61
- package/dist/cjs/components/ViewSwitcher/Styles.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/{ViewSwitcherMenu.js → SubViewSwitcher.js} +70 -22
- package/dist/cjs/components/ViewSwitcher/SubViewSwitcher.js.map +1 -0
- package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js +46 -184
- package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/index.js +4 -4
- package/dist/cjs/components/ViewSwitcher/index.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/useApplyToAllOffer.js +179 -0
- package/dist/cjs/components/ViewSwitcher/useApplyToAllOffer.js.map +1 -0
- package/dist/cjs/presentation/reports/allReports.js +6 -0
- package/dist/cjs/presentation/reports/allReports.js.map +1 -1
- package/dist/cjs/presentation/reports/controls.js +6 -3
- package/dist/cjs/presentation/reports/controls.js.map +1 -1
- package/dist/cjs/presentation/reports/expenses.js +946 -0
- package/dist/cjs/presentation/reports/expenses.js.map +1 -0
- package/dist/cjs/presentation/shared/ActivityFeed.js +1 -2
- package/dist/cjs/presentation/shared/ActivityFeed.js.map +1 -1
- package/dist/esm/components/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/components/Popper/Popper.js +12 -0
- package/dist/esm/components/Popper/Popper.js.map +1 -1
- package/dist/esm/components/Popper/anchorMove.d.ts +4 -0
- package/dist/esm/components/Popper/anchorMove.d.ts.map +1 -0
- package/dist/esm/components/Popper/anchorMove.js +33 -0
- package/dist/esm/components/Popper/anchorMove.js.map +1 -0
- package/dist/esm/components/ViewSettings/Styles.d.ts +1 -0
- package/dist/esm/components/ViewSettings/Styles.d.ts.map +1 -1
- package/dist/esm/components/ViewSettings/Styles.js +7 -2
- package/dist/esm/components/ViewSettings/Styles.js.map +1 -1
- package/dist/esm/components/ViewSettings/ViewSettings.d.ts +12 -0
- package/dist/esm/components/ViewSettings/ViewSettings.d.ts.map +1 -1
- package/dist/esm/components/ViewSettings/ViewSettings.js +66 -5
- package/dist/esm/components/ViewSettings/ViewSettings.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/ApplyToAllTab.d.ts +24 -0
- package/dist/esm/components/ViewSwitcher/ApplyToAllTab.d.ts.map +1 -0
- package/dist/esm/components/ViewSwitcher/ApplyToAllTab.js +179 -0
- package/dist/esm/components/ViewSwitcher/ApplyToAllTab.js.map +1 -0
- package/dist/esm/components/ViewSwitcher/Styles.d.ts +15 -15
- package/dist/esm/components/ViewSwitcher/Styles.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/Styles.js +72 -60
- package/dist/esm/components/ViewSwitcher/Styles.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/SubViewSwitcher.d.ts +50 -0
- package/dist/esm/components/ViewSwitcher/SubViewSwitcher.d.ts.map +1 -0
- package/dist/esm/components/ViewSwitcher/SubViewSwitcher.js +149 -0
- package/dist/esm/components/ViewSwitcher/SubViewSwitcher.js.map +1 -0
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts +8 -8
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.js +48 -163
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/index.d.ts +1 -1
- package/dist/esm/components/ViewSwitcher/index.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/index.js +1 -1
- package/dist/esm/components/ViewSwitcher/index.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.d.ts +27 -0
- package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.d.ts.map +1 -0
- package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.js +159 -0
- package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.js.map +1 -0
- package/dist/esm/presentation/reports/allReports.d.ts.map +1 -1
- package/dist/esm/presentation/reports/allReports.js +6 -0
- package/dist/esm/presentation/reports/allReports.js.map +1 -1
- package/dist/esm/presentation/reports/controls.d.ts +3 -1
- package/dist/esm/presentation/reports/controls.d.ts.map +1 -1
- package/dist/esm/presentation/reports/controls.js +6 -3
- package/dist/esm/presentation/reports/controls.js.map +1 -1
- package/dist/esm/presentation/reports/expenses.d.ts +62 -0
- package/dist/esm/presentation/reports/expenses.d.ts.map +1 -0
- package/dist/esm/presentation/reports/expenses.js +849 -0
- package/dist/esm/presentation/reports/expenses.js.map +1 -0
- package/dist/esm/presentation/shared/ActivityFeed.d.ts.map +1 -1
- package/dist/esm/presentation/shared/ActivityFeed.js +1 -2
- package/dist/esm/presentation/shared/ActivityFeed.js.map +1 -1
- package/dist/index.js +656 -280
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/ViewSwitcher/ViewSwitcherMenu.js.map +0 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.d.ts +0 -39
- package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.d.ts.map +0 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.js +0 -101
- package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export declare const VIEW_SWITCHER_PROMPT_DELAY_MS = 100;
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
2
|
+
export declare const VIEW_SWITCHER_APPLIED_MS = 1400;
|
|
3
|
+
export declare const VIEW_SWITCHER_OPEN_MS = 3000;
|
|
4
4
|
export declare const VIEW_SWITCHER_LEAVE_MS = 200;
|
|
5
5
|
export declare const StyledViewSwitcher: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
6
|
export declare const StyledViewSwitcherTrack: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
7
|
export declare const StyledViewSwitcherOptions: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
8
|
export declare const StyledViewSwitcherOption: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
9
|
+
export declare const StyledSubViewSwitcherOption: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
10
|
+
export declare const StyledSubViewSwitcherRoot: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
+
export declare const StyledSubViewSwitcherClip: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
|
+
export declare const StyledSubViewSwitcherIcon: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
13
|
+
export declare const StyledSubViewSwitcherList: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("..").ListProps & {
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
} & import("react").HTMLAttributes<HTMLUListElement> & import("react").RefAttributes<HTMLUListElement>> & {
|
|
16
16
|
Item: import("react").ForwardRefExoticComponent<import("..").ListItemProps & {
|
|
@@ -21,13 +21,13 @@ export declare const StyledViewSwitcherMenuList: import("styled-components").Sty
|
|
|
21
21
|
displayName: string;
|
|
22
22
|
};
|
|
23
23
|
}, any, {}, never>;
|
|
24
|
-
export declare const
|
|
24
|
+
export declare const StyledSubViewSwitcherLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
25
25
|
export declare const StyledViewSwitcherPromptTitle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
26
|
-
export declare const
|
|
27
|
-
export declare const
|
|
28
|
-
export declare const
|
|
29
|
-
export declare const
|
|
30
|
-
export declare const
|
|
31
|
-
export declare const
|
|
32
|
-
export declare const
|
|
26
|
+
export declare const TAB_RING = 2;
|
|
27
|
+
export declare const StyledApplyToAllTab: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
28
|
+
export declare const StyledApplyToAllSlide: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
29
|
+
export declare const StyledApplyToAllButton: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
30
|
+
export declare const StyledApplyToAllLine: import("styled-components").StyledComponent<"i", any, {}, never>;
|
|
31
|
+
export declare const StyledApplyToAllDismiss: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
32
|
+
export declare const StyledApplyToAllDone: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
33
33
|
//# sourceMappingURL=Styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/ViewSwitcher/Styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/ViewSwitcher/Styles.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,6BAA6B,MAAM,CAAC;AACjD,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAC7C,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,kBAAkB,oEAK9B,CAAC;AAIF,eAAO,MAAM,uBAAuB,oEAUnC,CAAC;AAIF,eAAO,MAAM,yBAAyB,oEAGrC,CAAC;AAIF,eAAO,MAAM,wBAAwB,uEA4CpC,CAAC;AAIF,eAAO,MAAM,2BAA2B,uEAwDvC,CAAC;AA6BF,eAAO,MAAM,yBAAyB,oEA8BrC,CAAC;AAIF,eAAO,MAAM,yBAAyB,oEAOrC,CAAC;AAIF,eAAO,MAAM,yBAAyB,qEAKrC,CAAC;AAIF,eAAO,MAAM,yBAAyB;;;;;;;;;;kBAErC,CAAC;AAIF,eAAO,MAAM,0BAA0B,qEAOtC,CAAC;AAIF,eAAO,MAAM,6BAA6B,qEAOzC,CAAC;AAQF,eAAO,MAAM,QAAQ,IAAI,CAAC;AAmC1B,eAAO,MAAM,mBAAmB,oEAiD/B,CAAC;AAKF,eAAO,MAAM,qBAAqB,oEAQjC,CAAC;AAKF,eAAO,MAAM,sBAAsB,uEAoClC,CAAC;AAKF,eAAO,MAAM,oBAAoB,kEAMhC,CAAC;AAIF,eAAO,MAAM,uBAAuB,uEA+BnC,CAAC;AAKF,eAAO,MAAM,oBAAoB,qEAgChC,CAAC"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import styled, { keyframes } from "styled-components";
|
|
2
|
+
import { layers } from "../../utils/layers";
|
|
3
|
+
import { DARK_THEME_SELECTOR } from "../../utils/themes";
|
|
2
4
|
import { BoxSizingStyle } from "../BoxSizingStyle";
|
|
3
5
|
import { List } from "../List";
|
|
4
6
|
export const VIEW_SWITCHER_PROMPT_DELAY_MS = 100;
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
+
export const VIEW_SWITCHER_APPLIED_MS = 1400;
|
|
8
|
+
export const VIEW_SWITCHER_OPEN_MS = 3000;
|
|
7
9
|
export const VIEW_SWITCHER_LEAVE_MS = 200;
|
|
8
10
|
export const StyledViewSwitcher = styled.div.withConfig({
|
|
9
11
|
displayName: "Styles__StyledViewSwitcher",
|
|
10
12
|
componentId: "sc-1cg2mte-0"
|
|
11
|
-
})(["", " display:inline-flex;flex-shrink:0;"], BoxSizingStyle);
|
|
13
|
+
})(["", " display:inline-flex;flex-shrink:0;isolation:isolate;"], BoxSizingStyle);
|
|
12
14
|
StyledViewSwitcher.displayName = "StyledViewSwitcher";
|
|
13
15
|
export const StyledViewSwitcherTrack = styled.div.withConfig({
|
|
14
16
|
displayName: "Styles__StyledViewSwitcherTrack",
|
|
15
17
|
componentId: "sc-1cg2mte-1"
|
|
16
|
-
})(["", " 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);
|
|
18
|
+
})(["", " position:relative;display:inline-flex;align-items:center;height:32px;padding:3px;border-radius:var(--ac-br-rounded);background-color:var(--color-theme-300);z-index:1;"], BoxSizingStyle);
|
|
17
19
|
StyledViewSwitcherTrack.displayName = "StyledViewSwitcherTrack";
|
|
18
20
|
export const StyledViewSwitcherOptions = styled.div.withConfig({
|
|
19
21
|
displayName: "Styles__StyledViewSwitcherOptions",
|
|
@@ -25,11 +27,11 @@ export const StyledViewSwitcherOption = styled.button.withConfig({
|
|
|
25
27
|
componentId: "sc-1cg2mte-3"
|
|
26
28
|
})(["", " 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);
|
|
27
29
|
StyledViewSwitcherOption.displayName = "StyledViewSwitcherOption";
|
|
28
|
-
export const
|
|
29
|
-
displayName: "
|
|
30
|
+
export const StyledSubViewSwitcherOption = styled.button.withConfig({
|
|
31
|
+
displayName: "Styles__StyledSubViewSwitcherOption",
|
|
30
32
|
componentId: "sc-1cg2mte-4"
|
|
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-
|
|
32
|
-
|
|
33
|
+
})(["", " 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-sub-view-switcher__icon){padding-left:8px;}.c-sub-view-switcher__values{display:inline-grid;}.c-sub-view-switcher__value{display:inline-flex;grid-area:1 / 1;align-items:center;gap:4px;visibility:hidden;}.c-sub-view-switcher__value[data-selected=\"true\"]{visibility:visible;}.c-sub-view-switcher__icon{display:inline-flex;flex-shrink:0;}.c-sub-view-switcher__icon svg{width:20px;height:20px;}&:focus-visible{box-shadow:0 0 0 2px var(--color-primary);}"], BoxSizingStyle);
|
|
34
|
+
StyledSubViewSwitcherOption.displayName = "StyledSubViewSwitcherOption";
|
|
33
35
|
const VIEW_SWITCHER_MENU_REVEAL_MS = 200;
|
|
34
36
|
const VIEW_SWITCHER_MENU_GAP = 8;
|
|
35
37
|
const menuReveal = keyframes(["from{grid-template-columns:0fr;margin-right:-", "px;}"], VIEW_SWITCHER_MENU_GAP);
|
|
@@ -37,77 +39,87 @@ const menuConceal = keyframes(["to{grid-template-columns:0fr;margin-right:-", "p
|
|
|
37
39
|
const menuClip = keyframes(["from,to{overflow:hidden;}"]);
|
|
38
40
|
|
|
39
41
|
// The width opens from nothing, so the controls beside the menu move aside with it.
|
|
40
|
-
export const
|
|
41
|
-
displayName: "
|
|
42
|
+
export const StyledSubViewSwitcherRoot = styled(StyledViewSwitcher).withConfig({
|
|
43
|
+
displayName: "Styles__StyledSubViewSwitcherRoot",
|
|
42
44
|
componentId: "sc-1cg2mte-5"
|
|
43
|
-
})(["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-
|
|
44
|
-
|
|
45
|
-
export const
|
|
46
|
-
displayName: "
|
|
45
|
+
})(["display:inline-grid;grid-template-columns:1fr;&[data-animate-in]{animation:", " ", "ms cubic-bezier(0.4,0,0.2,1);}&[data-animate-in] > .c-sub-view-switcher__clip{animation:", " ", "ms;}&[data-leaving]{pointer-events:none;animation:", " ", "ms cubic-bezier(0.4,0,0.2,1) forwards;}&[data-leaving] > .c-sub-view-switcher__clip{overflow:hidden;}@media (prefers-reduced-motion:reduce){&[data-animate-in],&[data-animate-in] > .c-sub-view-switcher__clip,&[data-leaving]{animation:none;}}"], menuReveal, VIEW_SWITCHER_MENU_REVEAL_MS, menuClip, VIEW_SWITCHER_MENU_REVEAL_MS, menuConceal, VIEW_SWITCHER_MENU_REVEAL_MS);
|
|
46
|
+
StyledSubViewSwitcherRoot.displayName = "StyledSubViewSwitcherRoot";
|
|
47
|
+
export const StyledSubViewSwitcherClip = styled.div.withConfig({
|
|
48
|
+
displayName: "Styles__StyledSubViewSwitcherClip",
|
|
47
49
|
componentId: "sc-1cg2mte-6"
|
|
48
50
|
})(["display:flex;min-width:0;> *{flex-shrink:0;}"]);
|
|
49
|
-
|
|
50
|
-
export const
|
|
51
|
-
displayName: "
|
|
51
|
+
StyledSubViewSwitcherClip.displayName = "StyledSubViewSwitcherClip";
|
|
52
|
+
export const StyledSubViewSwitcherIcon = styled.span.withConfig({
|
|
53
|
+
displayName: "Styles__StyledSubViewSwitcherIcon",
|
|
52
54
|
componentId: "sc-1cg2mte-7"
|
|
53
55
|
})(["display:inline-flex;flex-shrink:0;margin-right:8px;fill:var(--color-theme-900);"]);
|
|
54
|
-
|
|
55
|
-
export const
|
|
56
|
-
displayName: "
|
|
56
|
+
StyledSubViewSwitcherIcon.displayName = "StyledSubViewSwitcherIcon";
|
|
57
|
+
export const StyledSubViewSwitcherList = styled(List).withConfig({
|
|
58
|
+
displayName: "Styles__StyledSubViewSwitcherList",
|
|
57
59
|
componentId: "sc-1cg2mte-8"
|
|
58
60
|
})(["padding:8px 0;"]);
|
|
59
|
-
|
|
60
|
-
export const
|
|
61
|
-
displayName: "
|
|
61
|
+
StyledSubViewSwitcherList.displayName = "StyledSubViewSwitcherList";
|
|
62
|
+
export const StyledSubViewSwitcherLabel = styled.span.withConfig({
|
|
63
|
+
displayName: "Styles__StyledSubViewSwitcherLabel",
|
|
62
64
|
componentId: "sc-1cg2mte-9"
|
|
63
65
|
})(["flex:1;&[data-selected=\"true\"]{font-weight:bold;color:var(--color-primary);}"]);
|
|
64
|
-
|
|
65
|
-
const promptIn = keyframes(["from{opacity:0;}"]);
|
|
66
|
-
const promptOut = keyframes(["to{clip-path:inset(0 0 0 100%);}"]);
|
|
67
|
-
const appliedIn = keyframes(["from{opacity:0;transform:translateY(6px);}"]);
|
|
68
|
-
const appliedIcon = keyframes(["from{opacity:0;transform:scale(0.4);}60%{transform:scale(1.2);}"]);
|
|
66
|
+
StyledSubViewSwitcherLabel.displayName = "StyledSubViewSwitcherLabel";
|
|
69
67
|
export const StyledViewSwitcherPromptTitle = styled.span.withConfig({
|
|
70
68
|
displayName: "Styles__StyledViewSwitcherPromptTitle",
|
|
71
69
|
componentId: "sc-1cg2mte-10"
|
|
72
70
|
})(["position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;"]);
|
|
73
71
|
StyledViewSwitcherPromptTitle.displayName = "StyledViewSwitcherPromptTitle";
|
|
74
|
-
const
|
|
75
|
-
|
|
72
|
+
const TAB_EASE = "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
73
|
+
// The radius of a 32px control.
|
|
74
|
+
const CONTROL_RADIUS = 16;
|
|
75
|
+
// The green shows this much around the top and the sides of the control.
|
|
76
|
+
export const TAB_RING = 2;
|
|
77
|
+
const TAB_RADIUS = CONTROL_RADIUS + TAB_RING;
|
|
78
|
+
// The buttons sit this far inside the green, so their corners follow its corners.
|
|
79
|
+
const TAB_INSET = 3;
|
|
80
|
+
const BUTTON_RADIUS = TAB_RADIUS - TAB_INSET;
|
|
81
|
+
const slideOut = keyframes(["from{transform:translateY(-100%);}"]);
|
|
82
|
+
const slideIn = keyframes(["to{transform:translateY(-100%);}"]);
|
|
83
|
+
const appliedIcon = keyframes(["from{transform:scale(0.3);}60%{transform:scale(1.2);}"]);
|
|
84
|
+
const doneText = keyframes(["from{opacity:0;transform:translateX(-4px);}"]);
|
|
76
85
|
|
|
77
|
-
// The
|
|
78
|
-
export const
|
|
79
|
-
displayName: "
|
|
86
|
+
// The tab rings the control and clips its slide, which comes out from under the control.
|
|
87
|
+
export const StyledApplyToAllTab = styled.div.withConfig({
|
|
88
|
+
displayName: "Styles__StyledApplyToAllTab",
|
|
80
89
|
componentId: "sc-1cg2mte-11"
|
|
81
|
-
})(["", "
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
})(["", " z-index:", ";overflow:hidden;border-radius:", "px;--apply-to-all-fill:#1f9d5a;", " &{--apply-to-all-fill:#2f8f5e;}&[data-phase=\"applying\"],&[data-phase=\"applied\"],&[data-phase=\"leaving\"]{pointer-events:none;}&[data-phase=\"applying\"] .c-apply-to-all__button{opacity:0.7;}.c-apply-to-all__slide{animation:", " ", "ms ", ";}&[data-phase=\"leaving\"] .c-apply-to-all__slide{animation:", " ", "ms ", " forwards;}.c-apply-to-all__label{display:none;}&[data-labeled] .c-apply-to-all__label{display:inline;}&:not([data-labeled]) .c-apply-to-all__done-text{display:none;}@media (prefers-reduced-motion:reduce){.c-apply-to-all__slide,&[data-phase=\"leaving\"] .c-apply-to-all__slide{animation:none;}}"], BoxSizingStyle, layers.house - 1, TAB_RADIUS, DARK_THEME_SELECTOR, slideOut, VIEW_SWITCHER_LEAVE_MS, TAB_EASE, slideIn, VIEW_SWITCHER_LEAVE_MS, TAB_EASE);
|
|
91
|
+
StyledApplyToAllTab.displayName = "StyledApplyToAllTab";
|
|
92
|
+
|
|
93
|
+
// The green part of the tab. Its top sits under the control.
|
|
94
|
+
export const StyledApplyToAllSlide = styled.div.withConfig({
|
|
95
|
+
displayName: "Styles__StyledApplyToAllSlide",
|
|
85
96
|
componentId: "sc-1cg2mte-12"
|
|
86
|
-
})(["display:flex;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
})(["", " display:flex;align-items:center;padding:calc(var(--apply-to-all-tuck) + ", "px) ", "px ", "px;border-radius:inherit;background-color:var(--apply-to-all-fill);"], BoxSizingStyle, TAB_INSET, TAB_INSET, TAB_INSET);
|
|
98
|
+
StyledApplyToAllSlide.displayName = "StyledApplyToAllSlide";
|
|
99
|
+
|
|
100
|
+
// The apply button takes the room the dismiss button leaves, and only its outer bottom corner is round.
|
|
101
|
+
export const StyledApplyToAllButton = styled.button.withConfig({
|
|
102
|
+
displayName: "Styles__StyledApplyToAllButton",
|
|
90
103
|
componentId: "sc-1cg2mte-13"
|
|
91
|
-
})(["", "
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
})(["", " display:inline-flex;flex:1;align-items:center;justify-content:center;gap:4px;min-width:34px;height:26px;margin:0;padding:0;border:0;border-radius:0 0 0 ", "px;background-color:transparent;color:#fff;font-size:calc(0.75rem * var(--text-scale,1));font-weight:600;white-space:nowrap;cursor:pointer;outline:none;transition:background-color 150ms ease,opacity 150ms ease;svg{flex-shrink:0;width:20px;height:20px;fill:#fff;}&:hover{background-color:color-mix(in srgb,#fff 16%,transparent);}&:focus-visible{box-shadow:inset 0 0 0 2px #fff;}"], BoxSizingStyle, BUTTON_RADIUS);
|
|
105
|
+
StyledApplyToAllButton.displayName = "StyledApplyToAllButton";
|
|
106
|
+
|
|
107
|
+
// The line takes the height of the buttons.
|
|
108
|
+
export const StyledApplyToAllLine = styled.i.withConfig({
|
|
109
|
+
displayName: "Styles__StyledApplyToAllLine",
|
|
95
110
|
componentId: "sc-1cg2mte-14"
|
|
96
|
-
})(["
|
|
97
|
-
|
|
98
|
-
export const
|
|
99
|
-
displayName: "
|
|
111
|
+
})(["flex-shrink:0;width:1px;height:26px;margin:0 1px;background-color:color-mix(in srgb,#fff 35%,transparent);"]);
|
|
112
|
+
StyledApplyToAllLine.displayName = "StyledApplyToAllLine";
|
|
113
|
+
export const StyledApplyToAllDismiss = styled.button.withConfig({
|
|
114
|
+
displayName: "Styles__StyledApplyToAllDismiss",
|
|
100
115
|
componentId: "sc-1cg2mte-15"
|
|
101
|
-
})(["flex-shrink:0;width:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
116
|
+
})(["", " display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:26px;height:26px;margin:0;padding:0 2px;border:0;border-radius:0 0 ", "px 0;background-color:transparent;cursor:pointer;outline:none;transition:background-color 150ms ease;svg{width:20px;height:20px;fill:#fff;}&:hover{background-color:color-mix(in srgb,#fff 16%,transparent);}&:focus-visible{box-shadow:inset 0 0 0 2px #fff;}"], BoxSizingStyle, BUTTON_RADIUS);
|
|
117
|
+
StyledApplyToAllDismiss.displayName = "StyledApplyToAllDismiss";
|
|
118
|
+
|
|
119
|
+
// The confirmation takes the place of the buttons, at the size of the tab.
|
|
120
|
+
export const StyledApplyToAllDone = styled.span.withConfig({
|
|
121
|
+
displayName: "Styles__StyledApplyToAllDone",
|
|
105
122
|
componentId: "sc-1cg2mte-16"
|
|
106
|
-
})(["", " display:inline-flex;flex
|
|
107
|
-
|
|
108
|
-
export const StyledViewSwitcherApplied = styled.span.withConfig({
|
|
109
|
-
displayName: "Styles__StyledViewSwitcherApplied",
|
|
110
|
-
componentId: "sc-1cg2mte-17"
|
|
111
|
-
})(["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);
|
|
112
|
-
StyledViewSwitcherApplied.displayName = "StyledViewSwitcherApplied";
|
|
123
|
+
})(["", " display:inline-flex;flex:1;align-items:center;justify-content:center;gap:4px;height:26px;overflow:hidden;color:#fff;font-size:calc(0.75rem * var(--text-scale,1));font-weight:600;white-space:nowrap;svg{flex-shrink:0;width:18px;height:18px;fill:currentColor;animation:", " 320ms cubic-bezier(0.34,1.56,0.64,1);}.c-apply-to-all__done-text{animation:", " 220ms ", " 80ms backwards;}@media (prefers-reduced-motion:reduce){svg,.c-apply-to-all__done-text{animation:none;}}"], BoxSizingStyle, appliedIcon, doneText, TAB_EASE);
|
|
124
|
+
StyledApplyToAllDone.displayName = "StyledApplyToAllDone";
|
|
113
125
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["styled","keyframes","BoxSizingStyle","List","VIEW_SWITCHER_PROMPT_DELAY_MS","VIEW_SWITCHER_PROMPT_MS","VIEW_SWITCHER_APPLIED_MS","VIEW_SWITCHER_LEAVE_MS","StyledViewSwitcher","div","withConfig","displayName","componentId","StyledViewSwitcherTrack","StyledViewSwitcherOptions","StyledViewSwitcherOption","button","StyledViewSwitcherMenuOption","VIEW_SWITCHER_MENU_REVEAL_MS","VIEW_SWITCHER_MENU_GAP","menuReveal","menuConceal","menuClip","StyledViewSwitcherMenuRoot","StyledViewSwitcherMenuClip","StyledViewSwitcherMenuIcon","span","StyledViewSwitcherMenuList","StyledViewSwitcherMenuLabel","promptIn","promptOut","appliedIn","appliedIcon","StyledViewSwitcherPromptTitle","PROMPT_EASE","APPLIED_SWAP_MS","StyledViewSwitcherPrompt","StyledViewSwitcherPromptClip","StyledViewSwitcherPromptPill","StyledViewSwitcherAction","StyledViewSwitcherLine","i","StyledViewSwitcherDismiss","StyledViewSwitcherApplied"],"sources":["../../../../src/components/ViewSwitcher/Styles.ts"],"sourcesContent":["import styled, { keyframes } from \"styled-components\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { List } from \"../List\";\n\nexport const VIEW_SWITCHER_PROMPT_DELAY_MS = 100;\nexport const VIEW_SWITCHER_PROMPT_MS = 5000;\nexport const VIEW_SWITCHER_APPLIED_MS = 900;\nexport const VIEW_SWITCHER_LEAVE_MS = 200;\n\nexport const StyledViewSwitcher = styled.div`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n`;\n\nStyledViewSwitcher.displayName = \"StyledViewSwitcher\";\n\nexport const StyledViewSwitcherTrack = styled.div`\n ${BoxSizingStyle}\n position: relative;\n display: inline-flex;\n align-items: center;\n height: 32px;\n padding: 3px;\n border-radius: var(--ac-br-rounded);\n background-color: var(--color-theme-300);\n`;\n\nStyledViewSwitcherTrack.displayName = \"StyledViewSwitcherTrack\";\n\nexport const StyledViewSwitcherOptions = styled.div`\n display: inline-flex;\n align-items: center;\n`;\n\nStyledViewSwitcherOptions.displayName = \"StyledViewSwitcherOptions\";\n\nexport const StyledViewSwitcherOption = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: 34px;\n height: 26px;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: transparent;\n cursor: pointer;\n outline: none;\n transition: background-color 150ms ease, box-shadow 150ms ease;\n\n svg {\n width: 20px;\n height: 20px;\n fill: var(--color-theme-700);\n }\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-theme-900) 16%,\n transparent\n );\n }\n\n &[aria-checked=\"true\"] {\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-float);\n cursor: default;\n\n svg {\n fill: var(--color-theme-900);\n }\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherOption.displayName = \"StyledViewSwitcherOption\";\n\nexport const StyledViewSwitcherMenuOption = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 26px;\n margin: 0;\n padding: 0 8px 0 12px;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-float);\n color: var(--color-theme-900);\n font-size: calc(13px * var(--text-scale, 1));\n white-space: nowrap;\n cursor: pointer;\n outline: none;\n\n svg {\n flex-shrink: 0;\n fill: var(--color-theme-900);\n }\n\n &:has(.c-view-switcher-menu__icon) {\n padding-left: 8px;\n }\n\n .c-view-switcher-menu__values {\n display: inline-grid;\n }\n\n .c-view-switcher-menu__value {\n display: inline-flex;\n grid-area: 1 / 1;\n align-items: center;\n gap: 4px;\n visibility: hidden;\n }\n\n .c-view-switcher-menu__value[data-selected=\"true\"] {\n visibility: visible;\n }\n\n .c-view-switcher-menu__icon {\n display: inline-flex;\n flex-shrink: 0;\n }\n\n .c-view-switcher-menu__icon svg {\n width: 20px;\n height: 20px;\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherMenuOption.displayName = \"StyledViewSwitcherMenuOption\";\n\nconst VIEW_SWITCHER_MENU_REVEAL_MS = 200;\nconst VIEW_SWITCHER_MENU_GAP = 8;\n\nconst menuReveal = keyframes`\n from {\n grid-template-columns: 0fr;\n margin-right: -${VIEW_SWITCHER_MENU_GAP}px;\n }\n`;\n\nconst menuConceal = keyframes`\n to {\n grid-template-columns: 0fr;\n margin-right: -${VIEW_SWITCHER_MENU_GAP}px;\n }\n`;\n\nconst menuClip = keyframes`\n from,\n to {\n overflow: hidden;\n }\n`;\n\n// The width opens from nothing, so the controls beside the menu move aside with it.\nexport const StyledViewSwitcherMenuRoot = styled(StyledViewSwitcher)`\n display: inline-grid;\n grid-template-columns: 1fr;\n\n &[data-animate-in] {\n animation: ${menuReveal} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms\n cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n &[data-animate-in] > .c-view-switcher-menu__clip {\n animation: ${menuClip} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms;\n }\n\n &[data-leaving] {\n pointer-events: none;\n animation: ${menuConceal} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms\n cubic-bezier(0.4, 0, 0.2, 1) forwards;\n }\n\n &[data-leaving] > .c-view-switcher-menu__clip {\n overflow: hidden;\n }\n\n @media (prefers-reduced-motion: reduce) {\n &[data-animate-in],\n &[data-animate-in] > .c-view-switcher-menu__clip,\n &[data-leaving] {\n animation: none;\n }\n }\n`;\n\nStyledViewSwitcherMenuRoot.displayName = \"StyledViewSwitcherMenuRoot\";\n\nexport const StyledViewSwitcherMenuClip = styled.div`\n display: flex;\n min-width: 0;\n\n > * {\n flex-shrink: 0;\n }\n`;\n\nStyledViewSwitcherMenuClip.displayName = \"StyledViewSwitcherMenuClip\";\n\nexport const StyledViewSwitcherMenuIcon = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n margin-right: 8px;\n fill: var(--color-theme-900);\n`;\n\nStyledViewSwitcherMenuIcon.displayName = \"StyledViewSwitcherMenuIcon\";\n\nexport const StyledViewSwitcherMenuList = styled(List)`\n padding: 8px 0;\n`;\n\nStyledViewSwitcherMenuList.displayName = \"StyledViewSwitcherMenuList\";\n\nexport const StyledViewSwitcherMenuLabel = styled.span`\n flex: 1;\n\n &[data-selected=\"true\"] {\n font-weight: bold;\n color: var(--color-primary);\n }\n`;\n\nStyledViewSwitcherMenuLabel.displayName = \"StyledViewSwitcherMenuLabel\";\n\nconst promptIn = keyframes`\n from {\n opacity: 0;\n }\n`;\n\nconst promptOut = keyframes`\n to {\n clip-path: inset(0 0 0 100%);\n }\n`;\n\nconst appliedIn = keyframes`\n from {\n opacity: 0;\n transform: translateY(6px);\n }\n`;\n\nconst appliedIcon = keyframes`\n from {\n opacity: 0;\n transform: scale(0.4);\n }\n 60% {\n transform: scale(1.2);\n }\n`;\n\nexport const StyledViewSwitcherPromptTitle = styled.span`\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n`;\n\nStyledViewSwitcherPromptTitle.displayName = \"StyledViewSwitcherPromptTitle\";\n\nconst PROMPT_EASE = \"cubic-bezier(0.4, 0, 0.2, 1)\";\nconst APPLIED_SWAP_MS = 160;\n\n// The offer covers the buttons and keeps the width of the switcher, so nothing beside it moves.\nexport const StyledViewSwitcherPrompt = styled.div`\n ${BoxSizingStyle}\n position: absolute;\n top: 3px;\n right: 3px;\n bottom: 3px;\n z-index: 1;\n display: flex;\n min-width: calc(100% - 6px);\n animation: ${promptIn} ${VIEW_SWITCHER_LEAVE_MS}ms ${PROMPT_EASE};\n\n &[data-phase=\"applying\"],\n &[data-phase=\"applied\"] {\n pointer-events: none;\n }\n\n &[data-phase=\"applying\"] .c-view-switcher__prompt-pill {\n opacity: 0.7;\n }\n\n .c-view-switcher__action,\n .c-view-switcher__line,\n .c-view-switcher__dismiss {\n transition: opacity ${APPLIED_SWAP_MS}ms ${PROMPT_EASE},\n transform ${APPLIED_SWAP_MS}ms ${PROMPT_EASE},\n visibility 0s linear ${APPLIED_SWAP_MS}ms, background-color 150ms ease;\n }\n\n &[data-confirmed] .c-view-switcher__action,\n &[data-confirmed] .c-view-switcher__line,\n &[data-confirmed] .c-view-switcher__dismiss {\n visibility: hidden;\n opacity: 0;\n transform: translateY(-6px);\n }\n\n &[data-phase=\"leaving\"] {\n pointer-events: none;\n animation: ${promptOut} ${VIEW_SWITCHER_LEAVE_MS}ms ${PROMPT_EASE} forwards;\n }\n\n @media (prefers-reduced-motion: reduce) {\n animation: none;\n\n &[data-phase=\"leaving\"] {\n animation: none;\n }\n\n .c-view-switcher__action,\n .c-view-switcher__line,\n .c-view-switcher__dismiss,\n .c-view-switcher__prompt-pill {\n transition: none;\n }\n }\n`;\n\nStyledViewSwitcherPrompt.displayName = \"StyledViewSwitcherPrompt\";\n\nexport const StyledViewSwitcherPromptClip = styled.div`\n display: flex;\n flex: 1;\n min-width: 0;\n`;\n\nStyledViewSwitcherPromptClip.displayName = \"StyledViewSwitcherPromptClip\";\n\nexport const StyledViewSwitcherPromptPill = styled.div`\n ${BoxSizingStyle}\n position: relative;\n display: inline-flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n height: 26px;\n border-radius: var(--ac-br-rounded);\n background-color: var(--color-primary-opaque-300);\n color: var(--color-primary);\n font-size: calc(0.75rem * var(--text-scale, 1));\n font-weight: 500;\n white-space: nowrap;\n transition: opacity 150ms ease;\n`;\n\nStyledViewSwitcherPromptPill.displayName = \"StyledViewSwitcherPromptPill\";\n\nexport const StyledViewSwitcherAction = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 26px;\n margin: 0;\n padding: 0 2px 0 6px;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: transparent;\n color: inherit;\n font: inherit;\n cursor: pointer;\n outline: none;\n\n svg {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n fill: currentColor;\n }\n\n &:hover {\n color: var(--color-theme-900);\n }\n\n &:focus-visible {\n box-shadow: inset 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherAction.displayName = \"StyledViewSwitcherAction\";\n\nexport const StyledViewSwitcherLine = styled.i`\n flex-shrink: 0;\n width: 1px;\n height: 14px;\n margin: 0 1px 0 6px;\n background-color: color-mix(in srgb, var(--color-primary) 35%, transparent);\n`;\n\nStyledViewSwitcherLine.displayName = \"StyledViewSwitcherLine\";\n\nexport const StyledViewSwitcherDismiss = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n margin: 0 2px 0 0;\n padding: 0;\n border: 0;\n border-radius: 50%;\n background-color: transparent;\n cursor: pointer;\n outline: none;\n transition: background-color 150ms ease;\n\n svg {\n width: 16px;\n height: 16px;\n margin-left: -1px;\n fill: var(--color-theme-700);\n }\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-theme-900) 16%,\n transparent\n );\n }\n\n &:focus-visible {\n box-shadow: inset 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherDismiss.displayName = \"StyledViewSwitcherDismiss\";\n\nexport const StyledViewSwitcherApplied = styled.span`\n position: absolute;\n inset: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 4px;\n animation: ${appliedIn} ${APPLIED_SWAP_MS}ms ${PROMPT_EASE} 60ms backwards;\n\n svg {\n width: 16px;\n height: 16px;\n fill: currentColor;\n animation: ${appliedIcon} 250ms ease-out 60ms backwards;\n }\n\n @media (prefers-reduced-motion: reduce) {\n animation: none;\n\n svg {\n animation: none;\n }\n }\n`;\n\nStyledViewSwitcherApplied.displayName = \"StyledViewSwitcherApplied\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,SAAS,QAAQ,mBAAmB;AAErD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,IAAI,QAAQ,SAAS;AAE9B,OAAO,MAAMC,6BAA6B,GAAG,GAAG;AAChD,OAAO,MAAMC,uBAAuB,GAAG,IAAI;AAC3C,OAAO,MAAMC,wBAAwB,GAAG,GAAG;AAC3C,OAAO,MAAMC,sBAAsB,GAAG,GAAG;AAEzC,OAAO,MAAMC,kBAAkB,GAAGR,MAAM,CAACS,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,gDACxCV,cAAc,CAGjB;AAEDM,kBAAkB,CAACG,WAAW,GAAG,oBAAoB;AAErD,OAAO,MAAME,uBAAuB,GAAGb,MAAM,CAACS,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,0KAC7CV,cAAc,CAQjB;AAEDW,uBAAuB,CAACF,WAAW,GAAG,yBAAyB;AAE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GAAG,8BAA8B;AAEzE,OAAO,MAAM2B,4BAA4B,GAAGtC,MAAM,CAACS,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+UAClDV,cAAc,CAcjB;AAEDoC,4BAA4B,CAAC3B,WAAW,GAAG,8BAA8B;AAEzE,OAAO,MAAM4B,wBAAwB,GAAGvC,MAAM,CAACgB,MAAM,CAAAN,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,yYACjDV,cAAc,CA6BjB;AAEDqC,wBAAwB,CAAC5B,WAAW,GAAG,0BAA0B;AAEjE,OAAO,MAAM6B,sBAAsB,GAAGxC,MAAM,CAACyC,CAAC,CAAA/B,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wIAM7C;AAED4B,sBAAsB,CAAC7B,WAAW,GAAG,wBAAwB;AAE7D,OAAO,MAAM+B,yBAAyB,GAAG1C,MAAM,CAACgB,MAAM,CAAAN,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,ueAClDV,cAAc,CAkCjB;AAEDwC,yBAAyB,CAAC/B,WAAW,GAAG,2BAA2B;AAEnE,OAAO,MAAMgC,yBAAyB,GAAG3C,MAAM,CAAC0B,IAAI,CAAAhB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,yTAOrCmB,SAAS,EAAII,eAAe,EAAMD,WAAW,EAM3CF,WAAW,CAU3B;AAEDW,yBAAyB,CAAChC,WAAW,GAAG,2BAA2B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","keyframes","layers","DARK_THEME_SELECTOR","BoxSizingStyle","List","VIEW_SWITCHER_PROMPT_DELAY_MS","VIEW_SWITCHER_APPLIED_MS","VIEW_SWITCHER_OPEN_MS","VIEW_SWITCHER_LEAVE_MS","StyledViewSwitcher","div","withConfig","displayName","componentId","StyledViewSwitcherTrack","StyledViewSwitcherOptions","StyledViewSwitcherOption","button","StyledSubViewSwitcherOption","VIEW_SWITCHER_MENU_REVEAL_MS","VIEW_SWITCHER_MENU_GAP","menuReveal","menuConceal","menuClip","StyledSubViewSwitcherRoot","StyledSubViewSwitcherClip","StyledSubViewSwitcherIcon","span","StyledSubViewSwitcherList","StyledSubViewSwitcherLabel","StyledViewSwitcherPromptTitle","TAB_EASE","CONTROL_RADIUS","TAB_RING","TAB_RADIUS","TAB_INSET","BUTTON_RADIUS","slideOut","slideIn","appliedIcon","doneText","StyledApplyToAllTab","house","StyledApplyToAllSlide","StyledApplyToAllButton","StyledApplyToAllLine","i","StyledApplyToAllDismiss","StyledApplyToAllDone"],"sources":["../../../../src/components/ViewSwitcher/Styles.ts"],"sourcesContent":["import styled, { keyframes } from \"styled-components\";\n\nimport { layers } from \"../../utils/layers\";\nimport { DARK_THEME_SELECTOR } from \"../../utils/themes\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { List } from \"../List\";\n\nexport const VIEW_SWITCHER_PROMPT_DELAY_MS = 100;\nexport const VIEW_SWITCHER_APPLIED_MS = 1400;\nexport const VIEW_SWITCHER_OPEN_MS = 3000;\nexport const VIEW_SWITCHER_LEAVE_MS = 200;\n\nexport const StyledViewSwitcher = styled.div`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n isolation: isolate;\n`;\n\nStyledViewSwitcher.displayName = \"StyledViewSwitcher\";\n\nexport const StyledViewSwitcherTrack = styled.div`\n ${BoxSizingStyle}\n position: relative;\n display: inline-flex;\n align-items: center;\n height: 32px;\n padding: 3px;\n border-radius: var(--ac-br-rounded);\n background-color: var(--color-theme-300);\n z-index: 1;\n`;\n\nStyledViewSwitcherTrack.displayName = \"StyledViewSwitcherTrack\";\n\nexport const StyledViewSwitcherOptions = styled.div`\n display: inline-flex;\n align-items: center;\n`;\n\nStyledViewSwitcherOptions.displayName = \"StyledViewSwitcherOptions\";\n\nexport const StyledViewSwitcherOption = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: 34px;\n height: 26px;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: transparent;\n cursor: pointer;\n outline: none;\n transition: background-color 150ms ease, box-shadow 150ms ease;\n\n svg {\n width: 20px;\n height: 20px;\n fill: var(--color-theme-700);\n }\n\n &:hover {\n background-color: color-mix(\n in srgb,\n var(--color-theme-900) 16%,\n transparent\n );\n }\n\n &[aria-checked=\"true\"] {\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-float);\n cursor: default;\n\n svg {\n fill: var(--color-theme-900);\n }\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledViewSwitcherOption.displayName = \"StyledViewSwitcherOption\";\n\nexport const StyledSubViewSwitcherOption = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n align-items: center;\n gap: 4px;\n height: 26px;\n margin: 0;\n padding: 0 8px 0 12px;\n border: 0;\n border-radius: var(--ac-br-rounded);\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-float);\n color: var(--color-theme-900);\n font-size: calc(13px * var(--text-scale, 1));\n white-space: nowrap;\n cursor: pointer;\n outline: none;\n\n svg {\n flex-shrink: 0;\n fill: var(--color-theme-900);\n }\n\n &:has(.c-sub-view-switcher__icon) {\n padding-left: 8px;\n }\n\n .c-sub-view-switcher__values {\n display: inline-grid;\n }\n\n .c-sub-view-switcher__value {\n display: inline-flex;\n grid-area: 1 / 1;\n align-items: center;\n gap: 4px;\n visibility: hidden;\n }\n\n .c-sub-view-switcher__value[data-selected=\"true\"] {\n visibility: visible;\n }\n\n .c-sub-view-switcher__icon {\n display: inline-flex;\n flex-shrink: 0;\n }\n\n .c-sub-view-switcher__icon svg {\n width: 20px;\n height: 20px;\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--color-primary);\n }\n`;\n\nStyledSubViewSwitcherOption.displayName = \"StyledSubViewSwitcherOption\";\n\nconst VIEW_SWITCHER_MENU_REVEAL_MS = 200;\nconst VIEW_SWITCHER_MENU_GAP = 8;\n\nconst menuReveal = keyframes`\n from {\n grid-template-columns: 0fr;\n margin-right: -${VIEW_SWITCHER_MENU_GAP}px;\n }\n`;\n\nconst menuConceal = keyframes`\n to {\n grid-template-columns: 0fr;\n margin-right: -${VIEW_SWITCHER_MENU_GAP}px;\n }\n`;\n\nconst menuClip = keyframes`\n from,\n to {\n overflow: hidden;\n }\n`;\n\n// The width opens from nothing, so the controls beside the menu move aside with it.\nexport const StyledSubViewSwitcherRoot = styled(StyledViewSwitcher)`\n display: inline-grid;\n grid-template-columns: 1fr;\n\n &[data-animate-in] {\n animation: ${menuReveal} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms\n cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n &[data-animate-in] > .c-sub-view-switcher__clip {\n animation: ${menuClip} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms;\n }\n\n &[data-leaving] {\n pointer-events: none;\n animation: ${menuConceal} ${VIEW_SWITCHER_MENU_REVEAL_MS}ms\n cubic-bezier(0.4, 0, 0.2, 1) forwards;\n }\n\n &[data-leaving] > .c-sub-view-switcher__clip {\n overflow: hidden;\n }\n\n @media (prefers-reduced-motion: reduce) {\n &[data-animate-in],\n &[data-animate-in] > .c-sub-view-switcher__clip,\n &[data-leaving] {\n animation: none;\n }\n }\n`;\n\nStyledSubViewSwitcherRoot.displayName = \"StyledSubViewSwitcherRoot\";\n\nexport const StyledSubViewSwitcherClip = styled.div`\n display: flex;\n min-width: 0;\n\n > * {\n flex-shrink: 0;\n }\n`;\n\nStyledSubViewSwitcherClip.displayName = \"StyledSubViewSwitcherClip\";\n\nexport const StyledSubViewSwitcherIcon = styled.span`\n display: inline-flex;\n flex-shrink: 0;\n margin-right: 8px;\n fill: var(--color-theme-900);\n`;\n\nStyledSubViewSwitcherIcon.displayName = \"StyledSubViewSwitcherIcon\";\n\nexport const StyledSubViewSwitcherList = styled(List)`\n padding: 8px 0;\n`;\n\nStyledSubViewSwitcherList.displayName = \"StyledSubViewSwitcherList\";\n\nexport const StyledSubViewSwitcherLabel = styled.span`\n flex: 1;\n\n &[data-selected=\"true\"] {\n font-weight: bold;\n color: var(--color-primary);\n }\n`;\n\nStyledSubViewSwitcherLabel.displayName = \"StyledSubViewSwitcherLabel\";\n\nexport const StyledViewSwitcherPromptTitle = styled.span`\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n`;\n\nStyledViewSwitcherPromptTitle.displayName = \"StyledViewSwitcherPromptTitle\";\n\nconst TAB_EASE = \"cubic-bezier(0.4, 0, 0.2, 1)\";\n// The radius of a 32px control.\nconst CONTROL_RADIUS = 16;\n// The green shows this much around the top and the sides of the control.\nexport const TAB_RING = 2;\nconst TAB_RADIUS = CONTROL_RADIUS + TAB_RING;\n// The buttons sit this far inside the green, so their corners follow its corners.\nconst TAB_INSET = 3;\nconst BUTTON_RADIUS = TAB_RADIUS - TAB_INSET;\n\nconst slideOut = keyframes`\n from {\n transform: translateY(-100%);\n }\n`;\n\nconst slideIn = keyframes`\n to {\n transform: translateY(-100%);\n }\n`;\n\nconst appliedIcon = keyframes`\n from {\n transform: scale(0.3);\n }\n 60% {\n transform: scale(1.2);\n }\n`;\n\nconst doneText = keyframes`\n from {\n opacity: 0;\n transform: translateX(-4px);\n }\n`;\n\n// The tab rings the control and clips its slide, which comes out from under the control.\nexport const StyledApplyToAllTab = styled.div`\n ${BoxSizingStyle}\n z-index: ${layers.house - 1};\n overflow: hidden;\n border-radius: ${TAB_RADIUS}px;\n /* One green per theme kind, with enough contrast for the white check. */\n --apply-to-all-fill: #1f9d5a;\n\n ${DARK_THEME_SELECTOR} & {\n --apply-to-all-fill: #2f8f5e;\n }\n\n &[data-phase=\"applying\"],\n &[data-phase=\"applied\"],\n &[data-phase=\"leaving\"] {\n pointer-events: none;\n }\n\n &[data-phase=\"applying\"] .c-apply-to-all__button {\n opacity: 0.7;\n }\n\n .c-apply-to-all__slide {\n animation: ${slideOut} ${VIEW_SWITCHER_LEAVE_MS}ms ${TAB_EASE};\n }\n\n &[data-phase=\"leaving\"] .c-apply-to-all__slide {\n animation: ${slideIn} ${VIEW_SWITCHER_LEAVE_MS}ms ${TAB_EASE} forwards;\n }\n\n .c-apply-to-all__label {\n display: none;\n }\n\n /* A wide tab has room for the text of the apply button and of its confirmation. */\n &[data-labeled] .c-apply-to-all__label {\n display: inline;\n }\n\n &:not([data-labeled]) .c-apply-to-all__done-text {\n display: none;\n }\n\n @media (prefers-reduced-motion: reduce) {\n .c-apply-to-all__slide,\n &[data-phase=\"leaving\"] .c-apply-to-all__slide {\n animation: none;\n }\n }\n`;\n\nStyledApplyToAllTab.displayName = \"StyledApplyToAllTab\";\n\n// The green part of the tab. Its top sits under the control.\nexport const StyledApplyToAllSlide = styled.div`\n ${BoxSizingStyle}\n display: flex;\n align-items: center;\n padding: calc(var(--apply-to-all-tuck) + ${TAB_INSET}px) ${TAB_INSET}px\n ${TAB_INSET}px;\n border-radius: inherit;\n background-color: var(--apply-to-all-fill);\n`;\n\nStyledApplyToAllSlide.displayName = \"StyledApplyToAllSlide\";\n\n// The apply button takes the room the dismiss button leaves, and only its outer bottom corner is round.\nexport const StyledApplyToAllButton = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n gap: 4px;\n min-width: 34px;\n height: 26px;\n margin: 0;\n padding: 0;\n border: 0;\n border-radius: 0 0 0 ${BUTTON_RADIUS}px;\n background-color: transparent;\n color: #fff;\n font-size: calc(0.75rem * var(--text-scale, 1));\n font-weight: 600;\n white-space: nowrap;\n cursor: pointer;\n outline: none;\n transition: background-color 150ms ease, opacity 150ms ease;\n\n svg {\n flex-shrink: 0;\n width: 20px;\n height: 20px;\n fill: #fff;\n }\n\n &:hover {\n background-color: color-mix(in srgb, #fff 16%, transparent);\n }\n\n &:focus-visible {\n box-shadow: inset 0 0 0 2px #fff;\n }\n`;\n\nStyledApplyToAllButton.displayName = \"StyledApplyToAllButton\";\n\n// The line takes the height of the buttons.\nexport const StyledApplyToAllLine = styled.i`\n flex-shrink: 0;\n width: 1px;\n height: 26px;\n margin: 0 1px;\n background-color: color-mix(in srgb, #fff 35%, transparent);\n`;\n\nStyledApplyToAllLine.displayName = \"StyledApplyToAllLine\";\n\nexport const StyledApplyToAllDismiss = styled.button`\n ${BoxSizingStyle}\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n width: 26px;\n height: 26px;\n margin: 0;\n padding: 0 2px;\n border: 0;\n border-radius: 0 0 ${BUTTON_RADIUS}px 0;\n background-color: transparent;\n cursor: pointer;\n outline: none;\n transition: background-color 150ms ease;\n\n /* The same size as the check. */\n svg {\n width: 20px;\n height: 20px;\n fill: #fff;\n }\n\n &:hover {\n background-color: color-mix(in srgb, #fff 16%, transparent);\n }\n\n &:focus-visible {\n box-shadow: inset 0 0 0 2px #fff;\n }\n`;\n\nStyledApplyToAllDismiss.displayName = \"StyledApplyToAllDismiss\";\n\n// The confirmation takes the place of the buttons, at the size of the tab.\nexport const StyledApplyToAllDone = styled.span`\n ${BoxSizingStyle}\n display: inline-flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n gap: 4px;\n height: 26px;\n overflow: hidden;\n color: #fff;\n font-size: calc(0.75rem * var(--text-scale, 1));\n font-weight: 600;\n white-space: nowrap;\n\n svg {\n flex-shrink: 0;\n width: 18px;\n height: 18px;\n fill: currentColor;\n animation: ${appliedIcon} 320ms cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n .c-apply-to-all__done-text {\n animation: ${doneText} 220ms ${TAB_EASE} 80ms backwards;\n }\n\n @media (prefers-reduced-motion: reduce) {\n svg,\n .c-apply-to-all__done-text {\n animation: none;\n }\n }\n`;\n\nStyledApplyToAllDone.displayName = \"StyledApplyToAllDone\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,SAAS,QAAQ,mBAAmB;AAErD,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,mBAAmB,QAA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CAACkB,MAAM,CAAAN,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,qaAChDV,cAAc,EAUKiC,aAAa,CAoBnC;AAEDW,uBAAuB,CAACnC,WAAW,GAAG,yBAAyB;;AAE/D;AACA,OAAO,MAAMoC,oBAAoB,GAAGjD,MAAM,CAAC4B,IAAI,CAAAhB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+dAC3CV,cAAc,EAkBDoC,WAAW,EAIXC,QAAQ,EAAUT,QAAQ,CAS1C;AAEDiB,oBAAoB,CAACpC,WAAW,GAAG,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export interface SubViewSwitcherOption {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
/** DS icon element. */
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface SubViewSwitcherProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
9
|
+
options: SubViewSwitcherOption[];
|
|
10
|
+
/** Id of the selected option. */
|
|
11
|
+
value?: string;
|
|
12
|
+
onChange: (id: string) => void;
|
|
13
|
+
/** Accessible name of the trigger. The selected option follows it. */
|
|
14
|
+
"aria-label"?: string;
|
|
15
|
+
/** Opens with a clip from zero width when it mounts, and pushes the controls beside it aside. */
|
|
16
|
+
animateIn?: boolean;
|
|
17
|
+
/** Closes with the same clip. The parent removes the menu after it, 200 ms later. */
|
|
18
|
+
leaving?: boolean;
|
|
19
|
+
/** Turns on the check button that slides out after a choice. A result of false shows no confirmation. */
|
|
20
|
+
onApplyToAll?: (id: string) => unknown;
|
|
21
|
+
/** Tooltip and accessible name of the check button. */
|
|
22
|
+
applyToAllTitle?: string;
|
|
23
|
+
/** Text that a screen reader reads after the apply. */
|
|
24
|
+
appliedLabel?: string;
|
|
25
|
+
/** Tooltip and accessible name of the button that closes the extra action. */
|
|
26
|
+
/** Visible text of the apply button, shown where it has room. */
|
|
27
|
+
applyToAllLabel?: string;
|
|
28
|
+
dismissLabel?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @component SubViewSwitcher
|
|
32
|
+
* @description
|
|
33
|
+
* The sub view switcher, the second level of the main ViewSwitcher: a dropdown with the look of the checked option. It
|
|
34
|
+
* shows the icon and the name of the selected option and lists all options with their icons. Its width
|
|
35
|
+
* fits the widest option, so a new selection does not move the controls around it. With onApplyToAll, a
|
|
36
|
+
* choice slides a check button out from under its right end, the same as in ViewSwitcher.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* <SubViewSwitcher
|
|
40
|
+
* aria-label="Group by"
|
|
41
|
+
* options={[
|
|
42
|
+
* { id: "start_date", label: "Start Date", icon: <ClockIcon /> },
|
|
43
|
+
* { id: "date", label: "Due Date", icon: <CalendarIcon /> },
|
|
44
|
+
* ]}
|
|
45
|
+
* value={view}
|
|
46
|
+
* onChange={setView}
|
|
47
|
+
* />
|
|
48
|
+
*/
|
|
49
|
+
export declare const SubViewSwitcher: React.ForwardRefExoticComponent<SubViewSwitcherProps & React.RefAttributes<HTMLDivElement>>;
|
|
50
|
+
//# sourceMappingURL=SubViewSwitcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubViewSwitcher.d.ts","sourceRoot":"","sources":["../../../../src/components/ViewSwitcher/SubViewSwitcher.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,cAAc,EAEd,SAAS,EAIV,MAAM,OAAO,CAAC;AAoBf,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,oBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACxD,OAAO,EAAE,qBAAqB,EAAE,CAAC;IACjC,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iGAAiG;IACjG,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yGAAyG;IACzG,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,iEAAiE;IACjE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,eAAe,6FAyI3B,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["options", "value", "onChange", "aria-label", "animateIn", "leaving", "onApplyToAll", "applyToAllTitle", "appliedLabel", "applyToAllLabel", "dismissLabel", "className", "onKeyDown", "onBlur"];
|
|
4
|
+
import React, { forwardRef, useCallback, useRef, useState } from "react";
|
|
5
|
+
import classnames from "classnames";
|
|
6
|
+
import { ApplyToAllTab } from "./ApplyToAllTab";
|
|
7
|
+
import { StyledSubViewSwitcherClip, StyledSubViewSwitcherIcon, StyledSubViewSwitcherLabel, StyledSubViewSwitcherList, StyledSubViewSwitcherOption, StyledSubViewSwitcherRoot, StyledViewSwitcherTrack } from "./Styles";
|
|
8
|
+
import { useApplyToAllOffer } from "./useApplyToAllOffer";
|
|
9
|
+
import useForkRef from "../../utils/useForkRef";
|
|
10
|
+
import { ArrowDownSmallIcon } from "../Icons";
|
|
11
|
+
import { ListItem } from "../List";
|
|
12
|
+
import { Menu } from "../Menu";
|
|
13
|
+
/**
|
|
14
|
+
* @component SubViewSwitcher
|
|
15
|
+
* @description
|
|
16
|
+
* The sub view switcher, the second level of the main ViewSwitcher: a dropdown with the look of the checked option. It
|
|
17
|
+
* shows the icon and the name of the selected option and lists all options with their icons. Its width
|
|
18
|
+
* fits the widest option, so a new selection does not move the controls around it. With onApplyToAll, a
|
|
19
|
+
* choice slides a check button out from under its right end, the same as in ViewSwitcher.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <SubViewSwitcher
|
|
23
|
+
* aria-label="Group by"
|
|
24
|
+
* options={[
|
|
25
|
+
* { id: "start_date", label: "Start Date", icon: <ClockIcon /> },
|
|
26
|
+
* { id: "date", label: "Due Date", icon: <CalendarIcon /> },
|
|
27
|
+
* ]}
|
|
28
|
+
* value={view}
|
|
29
|
+
* onChange={setView}
|
|
30
|
+
* />
|
|
31
|
+
*/
|
|
32
|
+
export const SubViewSwitcher = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
33
|
+
var _options$find;
|
|
34
|
+
let options = _ref.options,
|
|
35
|
+
value = _ref.value,
|
|
36
|
+
onChange = _ref.onChange,
|
|
37
|
+
ariaLabel = _ref["aria-label"],
|
|
38
|
+
_ref$animateIn = _ref.animateIn,
|
|
39
|
+
animateIn = _ref$animateIn === void 0 ? false : _ref$animateIn,
|
|
40
|
+
_ref$leaving = _ref.leaving,
|
|
41
|
+
leaving = _ref$leaving === void 0 ? false : _ref$leaving,
|
|
42
|
+
onApplyToAll = _ref.onApplyToAll,
|
|
43
|
+
_ref$applyToAllTitle = _ref.applyToAllTitle,
|
|
44
|
+
applyToAllTitle = _ref$applyToAllTitle === void 0 ? "Apply to All Projects" : _ref$applyToAllTitle,
|
|
45
|
+
_ref$appliedLabel = _ref.appliedLabel,
|
|
46
|
+
appliedLabel = _ref$appliedLabel === void 0 ? "Applied" : _ref$appliedLabel,
|
|
47
|
+
_ref$applyToAllLabel = _ref.applyToAllLabel,
|
|
48
|
+
applyToAllLabel = _ref$applyToAllLabel === void 0 ? "All Projects?" : _ref$applyToAllLabel,
|
|
49
|
+
_ref$dismissLabel = _ref.dismissLabel,
|
|
50
|
+
dismissLabel = _ref$dismissLabel === void 0 ? "Dismiss" : _ref$dismissLabel,
|
|
51
|
+
className = _ref.className,
|
|
52
|
+
onKeyDown = _ref.onKeyDown,
|
|
53
|
+
onBlur = _ref.onBlur,
|
|
54
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
55
|
+
const _useState = useState(false),
|
|
56
|
+
open = _useState[0],
|
|
57
|
+
setOpen = _useState[1];
|
|
58
|
+
const selected = (_options$find = options.find(_ref2 => {
|
|
59
|
+
let id = _ref2.id;
|
|
60
|
+
return id === value;
|
|
61
|
+
})) != null ? _options$find : options[0];
|
|
62
|
+
const rootRef = useRef(null);
|
|
63
|
+
const handleRootRef = useForkRef(rootRef, ref);
|
|
64
|
+
const triggerRef = useRef(null);
|
|
65
|
+
const focusTrigger = useCallback(() => {
|
|
66
|
+
var _triggerRef$current;
|
|
67
|
+
return (_triggerRef$current = triggerRef.current) == null ? void 0 : _triggerRef$current.focus();
|
|
68
|
+
}, []);
|
|
69
|
+
const offer = useApplyToAllOffer({
|
|
70
|
+
rootRef,
|
|
71
|
+
onApplyToAll,
|
|
72
|
+
onRestoreFocus: focusTrigger
|
|
73
|
+
});
|
|
74
|
+
return /*#__PURE__*/React.createElement(StyledSubViewSwitcherRoot, _extends({
|
|
75
|
+
ref: handleRootRef,
|
|
76
|
+
"data-animate-in": animateIn || undefined,
|
|
77
|
+
"data-leaving": leaving || undefined,
|
|
78
|
+
className: classnames("c-sub-view-switcher", className),
|
|
79
|
+
onKeyDown: event => {
|
|
80
|
+
onKeyDown == null || onKeyDown(event);
|
|
81
|
+
offer.handleKeyDown(event);
|
|
82
|
+
},
|
|
83
|
+
onBlur: event => {
|
|
84
|
+
onBlur == null || onBlur(event);
|
|
85
|
+
offer.handleBlur(event);
|
|
86
|
+
}
|
|
87
|
+
}, rest), /*#__PURE__*/React.createElement(StyledSubViewSwitcherClip, {
|
|
88
|
+
className: "c-sub-view-switcher__clip"
|
|
89
|
+
}, /*#__PURE__*/React.createElement(Menu, {
|
|
90
|
+
open: open,
|
|
91
|
+
onOpen: () => setOpen(true),
|
|
92
|
+
onClose: () => setOpen(false),
|
|
93
|
+
position: "bottom-end",
|
|
94
|
+
target: /*#__PURE__*/React.createElement(StyledViewSwitcherTrack, {
|
|
95
|
+
className: "c-view-switcher__track"
|
|
96
|
+
}, /*#__PURE__*/React.createElement(StyledSubViewSwitcherOption, {
|
|
97
|
+
ref: triggerRef,
|
|
98
|
+
type: "button",
|
|
99
|
+
"aria-haspopup": "menu",
|
|
100
|
+
"aria-expanded": open,
|
|
101
|
+
"aria-label": ariaLabel ? ariaLabel + ": " + (selected == null ? void 0 : selected.label) : selected == null ? void 0 : selected.label,
|
|
102
|
+
className: "c-sub-view-switcher__trigger"
|
|
103
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
104
|
+
className: "c-sub-view-switcher__values"
|
|
105
|
+
}, options.map(_ref3 => {
|
|
106
|
+
let id = _ref3.id,
|
|
107
|
+
label = _ref3.label,
|
|
108
|
+
icon = _ref3.icon;
|
|
109
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
110
|
+
key: id,
|
|
111
|
+
"aria-hidden": id !== (selected == null ? void 0 : selected.id),
|
|
112
|
+
"data-selected": id === (selected == null ? void 0 : selected.id),
|
|
113
|
+
className: "c-sub-view-switcher__value"
|
|
114
|
+
}, icon ? /*#__PURE__*/React.createElement("span", {
|
|
115
|
+
className: "c-sub-view-switcher__icon"
|
|
116
|
+
}, icon) : null, label);
|
|
117
|
+
})), /*#__PURE__*/React.createElement(ArrowDownSmallIcon, null)))
|
|
118
|
+
}, /*#__PURE__*/React.createElement(StyledSubViewSwitcherList, null, options.map(_ref4 => {
|
|
119
|
+
let id = _ref4.id,
|
|
120
|
+
label = _ref4.label,
|
|
121
|
+
icon = _ref4.icon;
|
|
122
|
+
return /*#__PURE__*/React.createElement(ListItem, {
|
|
123
|
+
key: id,
|
|
124
|
+
"aria-selected": id === (selected == null ? void 0 : selected.id),
|
|
125
|
+
onClick: () => {
|
|
126
|
+
setOpen(false);
|
|
127
|
+
if (id !== value) {
|
|
128
|
+
onChange(id);
|
|
129
|
+
offer.show(id);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}, icon ? /*#__PURE__*/React.createElement(StyledSubViewSwitcherIcon, null, icon) : null, /*#__PURE__*/React.createElement(StyledSubViewSwitcherLabel, {
|
|
133
|
+
"data-selected": id === (selected == null ? void 0 : selected.id)
|
|
134
|
+
}, label));
|
|
135
|
+
}))), offer.isShown ? /*#__PURE__*/React.createElement(ApplyToAllTab, {
|
|
136
|
+
ref: offer.tabRef,
|
|
137
|
+
phase: offer.phase,
|
|
138
|
+
isConfirmed: offer.isConfirmed,
|
|
139
|
+
title: applyToAllTitle,
|
|
140
|
+
appliedLabel: appliedLabel,
|
|
141
|
+
onApply: offer.apply,
|
|
142
|
+
onDismiss: offer.leave,
|
|
143
|
+
onHold: offer.hold,
|
|
144
|
+
dismissLabel: dismissLabel,
|
|
145
|
+
applyToAllLabel: applyToAllLabel
|
|
146
|
+
}) : null));
|
|
147
|
+
});
|
|
148
|
+
SubViewSwitcher.displayName = "SubViewSwitcher";
|
|
149
|
+
//# sourceMappingURL=SubViewSwitcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubViewSwitcher.js","names":["React","forwardRef","useCallback","useRef","useState","classnames","ApplyToAllTab","StyledSubViewSwitcherClip","StyledSubViewSwitcherIcon","StyledSubViewSwitcherLabel","StyledSubViewSwitcherList","StyledSubViewSwitcherOption","StyledSubViewSwitcherRoot","StyledViewSwitcherTrack","useApplyToAllOffer","useForkRef","ArrowDownSmallIcon","ListItem","Menu","SubViewSwitcher","_ref","ref","_options$find","options","value","onChange","ariaLabel","_ref$animateIn","animateIn","_ref$leaving","leaving","onApplyToAll","_ref$applyToAllTitle","applyToAllTitle","_ref$appliedLabel","appliedLabel","_ref$applyToAllLabel","applyToAllLabel","_ref$dismissLabel","dismissLabel","className","onKeyDown","onBlur","rest","_objectWithoutPropertiesLoose","_excluded","_useState","open","setOpen","selected","find","_ref2","id","rootRef","handleRootRef","triggerRef","focusTrigger","_triggerRef$current","current","focus","offer","onRestoreFocus","createElement","_extends","undefined","event","handleKeyDown","handleBlur","onOpen","onClose","position","target","type","label","map","_ref3","icon","key","_ref4","onClick","show","isShown","tabRef","phase","isConfirmed","title","onApply","apply","onDismiss","leave","onHold","hold","displayName"],"sources":["../../../../src/components/ViewSwitcher/SubViewSwitcher.tsx"],"sourcesContent":["import React, {\n FocusEvent,\n forwardRef,\n HTMLAttributes,\n KeyboardEvent,\n ReactNode,\n useCallback,\n useRef,\n useState,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { ApplyToAllTab } from \"./ApplyToAllTab\";\nimport {\n StyledSubViewSwitcherClip,\n StyledSubViewSwitcherIcon,\n StyledSubViewSwitcherLabel,\n StyledSubViewSwitcherList,\n StyledSubViewSwitcherOption,\n StyledSubViewSwitcherRoot,\n StyledViewSwitcherTrack,\n} from \"./Styles\";\nimport { useApplyToAllOffer } from \"./useApplyToAllOffer\";\nimport useForkRef from \"../../utils/useForkRef\";\nimport { ArrowDownSmallIcon } from \"../Icons\";\nimport { ListItem } from \"../List\";\nimport { Menu } from \"../Menu\";\n\nexport interface SubViewSwitcherOption {\n id: string;\n label: string;\n /** DS icon element. */\n icon?: ReactNode;\n}\n\nexport interface SubViewSwitcherProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n options: SubViewSwitcherOption[];\n /** Id of the selected option. */\n value?: string;\n onChange: (id: string) => void;\n /** Accessible name of the trigger. The selected option follows it. */\n \"aria-label\"?: string;\n /** Opens with a clip from zero width when it mounts, and pushes the controls beside it aside. */\n animateIn?: boolean;\n /** Closes with the same clip. The parent removes the menu after it, 200 ms later. */\n leaving?: boolean;\n /** Turns on the check button that slides out after a choice. A result of false shows no confirmation. */\n onApplyToAll?: (id: string) => unknown;\n /** Tooltip and accessible name of the check button. */\n applyToAllTitle?: string;\n /** Text that a screen reader reads after the apply. */\n appliedLabel?: string;\n /** Tooltip and accessible name of the button that closes the extra action. */\n /** Visible text of the apply button, shown where it has room. */\n applyToAllLabel?: string;\n dismissLabel?: string;\n}\n\n/**\n * @component SubViewSwitcher\n * @description\n * The sub view switcher, the second level of the main ViewSwitcher: a dropdown with the look of the checked option. It\n * shows the icon and the name of the selected option and lists all options with their icons. Its width\n * fits the widest option, so a new selection does not move the controls around it. With onApplyToAll, a\n * choice slides a check button out from under its right end, the same as in ViewSwitcher.\n *\n * @example\n * <SubViewSwitcher\n * aria-label=\"Group by\"\n * options={[\n * { id: \"start_date\", label: \"Start Date\", icon: <ClockIcon /> },\n * { id: \"date\", label: \"Due Date\", icon: <CalendarIcon /> },\n * ]}\n * value={view}\n * onChange={setView}\n * />\n */\nexport const SubViewSwitcher = forwardRef<HTMLDivElement, SubViewSwitcherProps>(\n (\n {\n options,\n value,\n onChange,\n \"aria-label\": ariaLabel,\n animateIn = false,\n leaving = false,\n onApplyToAll,\n applyToAllTitle = \"Apply to All Projects\",\n appliedLabel = \"Applied\",\n applyToAllLabel = \"All Projects?\",\n dismissLabel = \"Dismiss\",\n className,\n onKeyDown,\n onBlur,\n ...rest\n },\n ref\n ) => {\n const [open, setOpen] = useState(false);\n const selected = options.find(({ id }) => id === value) ?? options[0];\n const rootRef = useRef<HTMLDivElement | null>(null);\n const handleRootRef = useForkRef(rootRef, ref);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const focusTrigger = useCallback(() => triggerRef.current?.focus(), []);\n const offer = useApplyToAllOffer<string>({\n rootRef,\n onApplyToAll,\n onRestoreFocus: focusTrigger,\n });\n\n return (\n <StyledSubViewSwitcherRoot\n ref={handleRootRef}\n data-animate-in={animateIn || undefined}\n data-leaving={leaving || undefined}\n className={classnames(\"c-sub-view-switcher\", className)}\n onKeyDown={(event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n offer.handleKeyDown(event);\n }}\n onBlur={(event: FocusEvent<HTMLDivElement>) => {\n onBlur?.(event);\n offer.handleBlur(event);\n }}\n {...rest}\n >\n <StyledSubViewSwitcherClip className=\"c-sub-view-switcher__clip\">\n <Menu\n open={open}\n onOpen={() => setOpen(true)}\n onClose={() => setOpen(false)}\n position=\"bottom-end\"\n target={\n <StyledViewSwitcherTrack className=\"c-view-switcher__track\">\n <StyledSubViewSwitcherOption\n ref={triggerRef}\n type=\"button\"\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-label={\n ariaLabel\n ? `${ariaLabel}: ${selected?.label}`\n : selected?.label\n }\n className=\"c-sub-view-switcher__trigger\"\n >\n <span className=\"c-sub-view-switcher__values\">\n {options.map(({ id, label, icon }) => (\n <span\n key={id}\n aria-hidden={id !== selected?.id}\n data-selected={id === selected?.id}\n className=\"c-sub-view-switcher__value\"\n >\n {icon ? (\n <span className=\"c-sub-view-switcher__icon\">\n {icon}\n </span>\n ) : null}\n {label}\n </span>\n ))}\n </span>\n <ArrowDownSmallIcon />\n </StyledSubViewSwitcherOption>\n </StyledViewSwitcherTrack>\n }\n >\n <StyledSubViewSwitcherList>\n {options.map(({ id, label, icon }) => (\n <ListItem\n key={id}\n aria-selected={id === selected?.id}\n onClick={() => {\n setOpen(false);\n\n if (id !== value) {\n onChange(id);\n offer.show(id);\n }\n }}\n >\n {icon ? (\n <StyledSubViewSwitcherIcon>\n {icon}\n </StyledSubViewSwitcherIcon>\n ) : null}\n <StyledSubViewSwitcherLabel\n data-selected={id === selected?.id}\n >\n {label}\n </StyledSubViewSwitcherLabel>\n </ListItem>\n ))}\n </StyledSubViewSwitcherList>\n </Menu>\n {offer.isShown ? (\n <ApplyToAllTab\n ref={offer.tabRef}\n phase={offer.phase}\n isConfirmed={offer.isConfirmed}\n title={applyToAllTitle}\n appliedLabel={appliedLabel}\n onApply={offer.apply}\n onDismiss={offer.leave}\n onHold={offer.hold}\n dismissLabel={dismissLabel}\n applyToAllLabel={applyToAllLabel}\n />\n ) : null}\n </StyledSubViewSwitcherClip>\n </StyledSubViewSwitcherRoot>\n );\n }\n);\n\nSubViewSwitcher.displayName = \"SubViewSwitcher\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAEVC,UAAU,EAIVC,WAAW,EACXC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SACEC,yBAAyB,EACzBC,yBAAyB,EACzBC,0BAA0B,EAC1BC,yBAAyB,EACzBC,2BAA2B,EAC3BC,yBAAyB,EACzBC,uBAAuB,QAClB,UAAU;AACjB,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,SAASC,kBAAkB,QAAQ,UAAU;AAC7C,SAASC,QAAQ,QAAQ,SAAS;AAClC,SAASC,IAAI,QAAQ,SAAS;AAiC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,gBAAGlB,UAAU,CACvC,CAAAmB,IAAA,EAkBEC,GAAG,KACA;EAAA,IAAAC,aAAA;EAAA,IAjBDC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IACLC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACMC,SAAS,GAAAN,IAAA,CAAvB,YAAY;IAAAO,cAAA,GAAAP,IAAA,CACZQ,SAAS;IAATA,SAAS,GAAAD,cAAA,cAAG,KAAK,GAAAA,cAAA;IAAAE,YAAA,GAAAT,I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