@rpcbase/client 0.227.0 → 0.231.0

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 (237) hide show
  1. package/package.json +11 -113
  2. package/src/apiClient/getServerApiClient.ts +131 -0
  3. package/src/apiClient/index.ts +86 -0
  4. package/src/index.ts +3 -0
  5. package/src/initClient.ts +32 -0
  6. package/src/types.ts +7 -0
  7. package/AppProvider/AnalyticsContainer.js +0 -56
  8. package/AppProvider/debug.js +0 -4
  9. package/AppProvider/index.tsx +0 -79
  10. package/access-control/ACLForm/components/GrantField/OpSelector.tsx +0 -129
  11. package/access-control/ACLForm/components/GrantField/ResourceSelector.tsx +0 -86
  12. package/access-control/ACLForm/components/GrantField/UsersSelector.tsx +0 -96
  13. package/access-control/ACLForm/components/GrantField/grant-field.scss +0 -26
  14. package/access-control/ACLForm/components/GrantField/icons/CheckMark.tsx +0 -16
  15. package/access-control/ACLForm/components/GrantField/icons/CollapseArrow.tsx +0 -14
  16. package/access-control/ACLForm/components/GrantField/icons/ExpandArrow.tsx +0 -14
  17. package/access-control/ACLForm/components/GrantField/index.tsx +0 -91
  18. package/access-control/ACLForm/components/GrantsList.tsx +0 -48
  19. package/access-control/ACLForm/components/RoleForm.tsx +0 -134
  20. package/access-control/ACLForm/components/RoleView.tsx +0 -115
  21. package/access-control/ACLForm/components/RolesList.tsx +0 -79
  22. package/access-control/ACLForm/components/constants.tsx +0 -1
  23. package/access-control/ACLForm/components/resolver.ts +0 -57
  24. package/access-control/ACLForm/components/role-form.scss +0 -19
  25. package/access-control/ACLForm/index.tsx +0 -48
  26. package/access-control/ACLModal/acl-modal.scss +0 -7
  27. package/access-control/ACLModal/index.tsx +0 -66
  28. package/access-control/PolicyEditor/TargetSelector/QueryBuilder.tsx +0 -48
  29. package/access-control/PolicyEditor/TargetSelector/index.tsx +0 -5
  30. package/access-control/PolicyEditor/TargetSelector/query-builder.scss +0 -9
  31. package/access-control/PolicyEditor/index.tsx +0 -165
  32. package/access-control/index.ts +0 -3
  33. package/apiClient.js +0 -15
  34. package/auth/authProps.js +0 -8
  35. package/auth/components/AccountsList/AccountListItem.js +0 -61
  36. package/auth/components/AccountsList/account-list-item.scss +0 -5
  37. package/auth/components/AccountsList/index.js +0 -17
  38. package/auth/components/Footer/index.js +0 -11
  39. package/auth/components/ForgotPassword/forgot-password.scss +0 -37
  40. package/auth/components/ForgotPassword/index.js +0 -114
  41. package/auth/components/SetNewPassword/index.js +0 -130
  42. package/auth/components/SetNewPassword/set-new-password.scss +0 -47
  43. package/auth/components/SignIn/SignInEmailForm.tsx +0 -115
  44. package/auth/components/SignIn/index.js +0 -69
  45. package/auth/components/SignIn/sign-in.scss +0 -56
  46. package/auth/components/SignOut/index.js +0 -144
  47. package/auth/components/SignOut/sign-out.scss +0 -34
  48. package/auth/components/SignUp/SignUpEmailForm.tsx +0 -98
  49. package/auth/components/SignUp/index.js +0 -66
  50. package/auth/components/SignUp/sign-up.scss +0 -56
  51. package/auth/getTenantId.js +0 -12
  52. package/auth/getUid.js +0 -11
  53. package/auth/helpers/redirectSignIn.native.js +0 -9
  54. package/auth/helpers/redirectSignIn.web.js +0 -7
  55. package/auth/index.js +0 -146
  56. package/auth/signOut.js +0 -20
  57. package/auth/useAuthRouter.js +0 -56
  58. package/env.d.ts +0 -3
  59. package/firebase/index.js +0 -1
  60. package/firebase/sw.js +0 -1
  61. package/form/FileInput/FileUploadContext.tsx +0 -162
  62. package/form/FileInput/FileUploadForm/index.tsx +0 -139
  63. package/form/FileInput/FileUploadForm/usePreventUnload.js +0 -21
  64. package/form/FileInput/UploadButton.tsx +0 -23
  65. package/form/FileInput/constants.ts +0 -16
  66. package/form/FileInput/file-input.scss +0 -1
  67. package/form/FileInput/index.tsx +0 -21
  68. package/form/FileInput/upload-worker/get_file_hash.js +0 -63
  69. package/form/FileInput/upload-worker/index.js +0 -16
  70. package/form/FileInput/upload-worker/no_compress_exts.ts +0 -33
  71. package/form/FileInput/upload-worker/upload_file.js +0 -129
  72. package/form/Form.tsx +0 -23
  73. package/form/Input.tsx +0 -62
  74. package/form/SubmitButton/index.tsx +0 -58
  75. package/form/hook-form.tsx +0 -7
  76. package/form/index.tsx +0 -5
  77. package/getBaseUrl.js +0 -14
  78. package/getObjectId.ts +0 -31
  79. package/hashState.js +0 -158
  80. package/helpers/createBatcher/index.js +0 -36
  81. package/helpers/getInitials.js +0 -39
  82. package/helpers/onReady.js +0 -15
  83. package/helpers/post.js +0 -18
  84. package/helpers/postRPC.js +0 -42
  85. package/helpers/useRPC.js +0 -41
  86. package/helpers/useStoredValue/batchedGetStoredValues.js +0 -30
  87. package/helpers/useStoredValue/index.js +0 -107
  88. package/helpers/useStoredValue/setStoredValues.js +0 -14
  89. package/i18n/en/rb.nav.json +0 -13
  90. package/i18n/en/rb.sign_in.json +0 -11
  91. package/i18n/en/rb.sign_out.json +0 -5
  92. package/i18n/fr/rb.sign_in.json +0 -11
  93. package/i18n/fr/rb.sign_out.json +0 -5
  94. package/i18n/index.js +0 -63
  95. package/index.js +0 -6
  96. package/isEqualValues.js +0 -47
  97. package/jest.config.js +0 -16
  98. package/notifications/Notification/index.js +0 -36
  99. package/notifications/Notification/notification.scss +0 -1
  100. package/notifications/NotificationItem/HeaderStatus.js +0 -93
  101. package/notifications/NotificationItem/index.js +0 -65
  102. package/notifications/NotificationItem/notification-item.scss +0 -25
  103. package/notifications/NotificationsContainer/index.js +0 -37
  104. package/notifications/NotificationsContainer/notifications-container.scss +0 -38
  105. package/notifications/NotificationsContainer/useLLTs.js +0 -28
  106. package/notifications/NotificationsContext/index.js +0 -71
  107. package/notifications/NotificationsContext/useNotificationsList.js +0 -75
  108. package/notifications/NotificationsSettingsModal/SettingsForm.js +0 -52
  109. package/notifications/NotificationsSettingsModal/index.js +0 -48
  110. package/notifications/NotificationsSettingsModal/notifications-settings.scss +0 -1
  111. package/notifications/config.js +0 -1
  112. package/notifications/index.js +0 -4
  113. package/page.js +0 -9
  114. package/publish-output.txt +0 -0
  115. package/rpc.js +0 -32
  116. package/rr-trace/get_fingerprint.js +0 -10
  117. package/rr-trace/get_perf_vitals.js +0 -24
  118. package/rr-trace/get_session_id.js +0 -29
  119. package/rr-trace/index.js +0 -138
  120. package/rr-trace/write_session_data.js +0 -86
  121. package/rts/boot.js +0 -3
  122. package/rts/getUseDocument.js +0 -21
  123. package/rts/getUseQuery/index.js +0 -233
  124. package/rts/getUseQuery/useData.js +0 -55
  125. package/rts/index.js +0 -10
  126. package/rts/rts.js +0 -243
  127. package/rts/signout.ts +0 -8
  128. package/rts/store/constants.js +0 -3
  129. package/rts/store/debug.js +0 -24
  130. package/rts/store/get_collection.js +0 -55
  131. package/rts/store/index.js +0 -100
  132. package/rts/store/replace_query_keys.js +0 -30
  133. package/rts/store/satisfies_projection.js +0 -32
  134. package/rts/store/update_docs.js +0 -47
  135. package/storage/index.jest.js +0 -15
  136. package/storage/index.native.js +0 -38
  137. package/storage/index.web.js +0 -25
  138. package/types.ts +0 -6
  139. package/ui/ActivityIndicator/index.js +0 -113
  140. package/ui/Avatar/index.native.js +0 -31
  141. package/ui/Avatar/index.web.js +0 -37
  142. package/ui/Avatar/styles.js +0 -41
  143. package/ui/ErrorBoundary/index.js +0 -12
  144. package/ui/ExpandableFloatView/exp.scss +0 -15
  145. package/ui/ExpandableFloatView/index.tsx +0 -123
  146. package/ui/ExpandableFloatView/useBackdrop.js +0 -45
  147. package/ui/LottiePlayer/LottiePlayer.js +0 -4
  148. package/ui/LottiePlayer/index.js +0 -8
  149. package/ui/Modal/HashStateModal.js +0 -30
  150. package/ui/Modal/Modal.js +0 -93
  151. package/ui/Modal/ModalForm/AlertBanner.js +0 -82
  152. package/ui/Modal/ModalForm/index.js +0 -188
  153. package/ui/Modal/ModalForm/modal-form.scss +0 -63
  154. package/ui/Modal/index.js +0 -10
  155. package/ui/Modal/modal.scss +0 -101
  156. package/ui/Modal/withHashStateModal.js +0 -24
  157. package/ui/RedboxError/index.js +0 -3
  158. package/ui/Search/SearchHistory/index.js +0 -45
  159. package/ui/Search/SearchHistory/search-history.scss +0 -9
  160. package/ui/Search/SearchHistory/useSearchHistory.tsx +0 -57
  161. package/ui/Search/SearchResults/index.tsx +0 -90
  162. package/ui/Search/index.tsx +0 -298
  163. package/ui/Search/search.scss +0 -0
  164. package/ui/SelectPills/index.tsx +0 -96
  165. package/ui/SelectPills/select-pills.scss +0 -66
  166. package/ui/Tabs/index.tsx +0 -161
  167. package/ui/Tabs/tabs.scss +0 -53
  168. package/ui/Tree/index.js +0 -257
  169. package/ui/Tree/model.js +0 -71
  170. package/ui/Tree/node.js +0 -112
  171. package/ui/Tree/tree.scss +0 -98
  172. package/ui/UserAvatar/default_colors.json +0 -82
  173. package/ui/UserAvatar/index.js +0 -55
  174. package/ui/View/index.tsx +0 -17
  175. package/ui/View/index.web.js +0 -44
  176. package/ui/animations/checkmark.json +0 -1
  177. package/ui/helpers/SizeContext/index.tsx +0 -11
  178. package/ui/helpers/helpers.scss +0 -61
  179. package/ui/helpers/index.ts +0 -6
  180. package/ui/helpers/stopEventPropagation.js +0 -5
  181. package/ui/helpers/useActiveListItemIndex/index.tsx +0 -45
  182. package/ui/helpers/useScrollSelectorIntoView/index.tsx +0 -14
  183. package/ui/helpers/useThrottledMeasure/index.js +0 -47
  184. package/ui/helpers/withSuspense/index.js +0 -37
  185. package/ui/icons/AddAccount.tsx +0 -5
  186. package/ui/icons/Billing.tsx +0 -6
  187. package/ui/icons/Close.tsx +0 -14
  188. package/ui/icons/Organization.tsx +0 -5
  189. package/ui/icons/Signout.tsx +0 -5
  190. package/ui/icons/index.tsx +0 -6
  191. package/ui/nav/AccountsDropdown/SwitchAccounts.tsx +0 -28
  192. package/ui/nav/AccountsDropdown/accounts-dropdown.scss +0 -51
  193. package/ui/nav/AccountsDropdown/index.tsx +0 -90
  194. package/ui/nav/AccountsToggle/index.tsx +0 -24
  195. package/ui/nav/ContentView/ContentViewContext.ts +0 -23
  196. package/ui/nav/ContentView/index.tsx +0 -115
  197. package/ui/nav/HeaderContainer/header.scss +0 -52
  198. package/ui/nav/HeaderContainer/index.tsx +0 -23
  199. package/ui/nav/HeaderContainer/variables.scss +0 -1
  200. package/ui/nav/MorphingDropdown/MorphingDropdownContext.tsx +0 -151
  201. package/ui/nav/MorphingDropdown/MorphingDropdownMenu.tsx +0 -38
  202. package/ui/nav/MorphingDropdown/MorphingDropdownPortal.tsx +0 -166
  203. package/ui/nav/MorphingDropdown/MorphingDropdownToggle.tsx +0 -34
  204. package/ui/nav/MorphingDropdown/index.tsx +0 -16
  205. package/ui/nav/MorphingDropdown/morphing-dropdown.scss +0 -35
  206. package/ui/nav/NotificationsDropdown/index.tsx +0 -52
  207. package/ui/nav/NotificationsDropdown/notifications-dropdown.scss +0 -5
  208. package/ui/nav/NotificationsToggle/NotificationsGlyph.tsx +0 -54
  209. package/ui/nav/NotificationsToggle/index.tsx +0 -12
  210. package/ui/nav/NotificationsToggle/notification-animation.json +0 -1
  211. package/ui/nav/NotificationsToggle/notifications-toggle.scss +0 -26
  212. package/ui/nav/SidebarContainer/index.tsx +0 -48
  213. package/ui/nav/SidebarContainer/sidebar-container.scss +0 -21
  214. package/ui/nav/SlideoutContainer/components/Body.tsx +0 -19
  215. package/ui/nav/SlideoutContainer/components/Header.tsx +0 -23
  216. package/ui/nav/SlideoutContainer/components/Wrapper.tsx +0 -46
  217. package/ui/nav/SlideoutContainer/index.tsx +0 -50
  218. package/ui/nav/SlideoutContainer/slideout-container.scss +0 -40
  219. package/ui/nav/index.ts +0 -13
  220. package/ui/oauth/GitHub.js +0 -38
  221. package/ui/oauth/getGitHubSigninUrl.js +0 -30
  222. package/ui/oauth/index.js +0 -9
  223. package/ui/oauth/oauth.scss +0 -16
  224. package/ui/sortable-hoc/AutoScroller.js +0 -76
  225. package/ui/sortable-hoc/DragHandle.js +0 -31
  226. package/ui/sortable-hoc/Manager.js +0 -54
  227. package/ui/sortable-hoc/README.md +0 -1
  228. package/ui/sortable-hoc/SortableContainer/defaultGetHelperDimensions.js +0 -7
  229. package/ui/sortable-hoc/SortableContainer/defaultShouldCancelStart.js +0 -24
  230. package/ui/sortable-hoc/SortableContainer/index.js +0 -994
  231. package/ui/sortable-hoc/SortableContainer/props.js +0 -81
  232. package/ui/sortable-hoc/SortableElement.js +0 -111
  233. package/ui/sortable-hoc/SortableHandle.js +0 -45
  234. package/ui/sortable-hoc/drag-handle.scss +0 -14
  235. package/ui/sortable-hoc/index.js +0 -9
  236. package/ui/sortable-hoc/utils.js +0 -292
  237. package/ui/springs.ts +0 -17
@@ -1,51 +0,0 @@
1
- @import "../../helpers/helpers";
2
- @import "helpers";
3
-
4
- // #nav-account-dropdown {
5
- // .accounts-glyph > svg {
6
- // fill: $gray-200;
7
- //
8
- // &:hover {
9
- // fill: $white;
10
- // }
11
- // }
12
- // }
13
-
14
- #accounts-dropdown-menu {
15
- color: $gray-100;
16
-
17
- .menu-header {
18
- color: $gray-500;
19
- }
20
-
21
- .account-list-item {
22
- @include px(2);
23
- @include py(2);
24
-
25
- cursor: pointer;
26
- color: $gray-400;
27
-
28
- &:hover {
29
- background: $gray-800;
30
- }
31
-
32
- &:active {
33
- background: $black;
34
- }
35
- }
36
- }
37
-
38
- .account-dropdown-icon {
39
- width: 18px;
40
- height: 18px;
41
-
42
- & path {
43
- fill: $gray-400;
44
- }
45
- }
46
-
47
- .account-dropdown-item:hover {
48
- .account-dropdown-icon path {
49
- fill: $white;
50
- }
51
- }
@@ -1,90 +0,0 @@
1
- import {useTranslation} from "react-i18next"
2
- import Dropdown from "react-bootstrap/Dropdown"
3
-
4
- import {getUid} from "../../../auth/getUid"
5
- import {useHashState} from "../../../hashState"
6
-
7
- import {UserAvatar} from "../../UserAvatar"
8
-
9
- import * as MorphingDropdown from "../MorphingDropdown"
10
-
11
- import {AddAccountIcon, BillingIcon, OrganizationIcon, SignoutIcon} from "../../icons"
12
-
13
- import {SwitchAccounts} from "./SwitchAccounts"
14
-
15
- import "./accounts-dropdown.scss"
16
-
17
-
18
- export const AccountsDropdown = ({id, accounts}) => {
19
- const {t} = useTranslation("rb.nav")
20
-
21
- const uid = getUid()
22
-
23
- const {serializeHashState} = useHashState()
24
-
25
- const showAccountSettings = () => {
26
- serializeHashState({
27
- showAccountSettingsModal: true,
28
- })
29
- }
30
-
31
- return (
32
- <MorphingDropdown.Menu id={id}>
33
- <div
34
- id="accounts-dropdown-menu"
35
- className="list-group"
36
- data-bs-theme="dark"
37
- style={{width: 200}}
38
- >
39
- <div>{t("account_settings")}</div>
40
- <div
41
- id="btn-dd-account-settings"
42
- role="button"
43
- className="list-group-item account-dropdown-item ps-1 d-flex align-items-center justify-content-start cursor-pointer"
44
- onClick={showAccountSettings}
45
- >
46
- <div className="me-1">
47
- <UserAvatar userId={uid} />
48
- </div>
49
- {t("account_settings")}
50
- </div>
51
-
52
- <div className="list-group-item account-dropdown-item" role="button">
53
- <OrganizationIcon
54
- className="account-dropdown-icon me-2"
55
- style={{marginLeft: -10, marginTop: -2}}
56
- />
57
- {t("organization")}
58
- </div>
59
- <div className="list-group-item account-dropdown-item" role="button">
60
- <BillingIcon
61
- className="account-dropdown-icon me-2"
62
- style={{marginLeft: -10, marginTop: -2}}
63
- />
64
- Billing
65
- </div>
66
- <Dropdown.Divider />
67
-
68
- <SwitchAccounts accounts={accounts} />
69
-
70
- <Dropdown.Divider />
71
-
72
- <a href="/signin" className="list-group-item account-dropdown-item">
73
- <AddAccountIcon
74
- className="account-dropdown-icon me-2"
75
- style={{marginLeft: -10, marginTop: -2}}
76
- />
77
- Add Account
78
- </a>
79
- <Dropdown.Divider />
80
- <a href="/signout" className="list-group-item account-dropdown-item">
81
- <SignoutIcon
82
- className="account-dropdown-icon me-2"
83
- style={{marginLeft: -10, marginTop: -2}}
84
- />
85
- Sign Out
86
- </a>
87
- </div>
88
- </MorphingDropdown.Menu>
89
- )
90
- }
@@ -1,24 +0,0 @@
1
- import {useEffect} from "react"
2
- import {getUid} from "../../../auth/getUid"
3
-
4
- import {UserAvatar} from "../../UserAvatar"
5
-
6
- import * as MorphingDropdown from "../MorphingDropdown"
7
-
8
-
9
- export const AccountsToggle = () => {
10
- const uid = getUid()
11
-
12
- useEffect(() => {
13
- console.log("WOWOWO", uid)
14
- })
15
-
16
- return (
17
- <MorphingDropdown.Toggle
18
- id="accounts"
19
- className="ps-1 pe-2 h-100 d-flex justify-content-center align-items-center"
20
- >
21
- <UserAvatar userId={uid} size={"medium"} />
22
- </MorphingDropdown.Toggle>
23
- )
24
- }
@@ -1,23 +0,0 @@
1
- import {Dispatch, SetStateAction, createContext, useContext} from "react"
2
-
3
-
4
- type ContentViewContextType = {
5
- storageKeyPrefix: string;
6
- isDocked: boolean;
7
- setIsDocked: (value: boolean) => void;
8
- sideItemViewWidth: number;
9
- onUpdateSlideoutViewWidth: () => void;
10
- contentViewWidth: number;
11
- contentViewHeight: number;
12
- sidebarWidth: number;
13
- setSidebarWidth: Dispatch<SetStateAction<number>>;
14
- headerHeight: number;
15
- };
16
-
17
- export const ContentViewContext = createContext<ContentViewContextType>(
18
- undefined!,
19
- )
20
-
21
- export default ContentViewContext
22
-
23
- export const useContentViewContext = () => useContext(ContentViewContext)
@@ -1,115 +0,0 @@
1
- import {useState, memo, ReactNode, useMemo} from "react"
2
-
3
- import {useStoredValue} from "../../../helpers/useStoredValue"
4
- import {useThrottledMeasure} from "../../helpers/useThrottledMeasure"
5
-
6
- import ContentViewContext from "./ContentViewContext"
7
- import getUid from "../../../auth/getUid"
8
-
9
-
10
- const DEFAULT_SIDEBAR_WIDTH = 200
11
-
12
- const SIDEVIEW_WIDTH = "sideview_width"
13
-
14
- export const ContentView = memo(
15
- ({
16
- header,
17
- headerHeight = 45,
18
- children,
19
- storageKeyPrefix: _storageKeyPrefix,
20
- }: {
21
- header: ReactNode;
22
- headerHeight?: number;
23
- children: ReactNode;
24
- storageKeyPrefix?: string;
25
- }) => {
26
- const uid = getUid()
27
-
28
- const [isDocked, setIsDocked] = useState(false)
29
-
30
- const [
31
- contentViewRef,
32
- {width: contentViewWidth, height: contentViewHeight},
33
- ] = useThrottledMeasure()
34
-
35
- const storageKeyPrefix = _storageKeyPrefix
36
- ? _storageKeyPrefix
37
- : uid || "unknown"
38
-
39
- const sidebarWidthKey = `${storageKeyPrefix}.sidebar_width`
40
- const [sidebarWidth, setSidebarWidth] = useStoredValue(
41
- sidebarWidthKey,
42
- DEFAULT_SIDEBAR_WIDTH,
43
- )
44
-
45
- const getKey = (k) => `${storageKeyPrefix}.content_view.${k}`
46
-
47
- const [sideItemViewWidth, setSlideoutViewWidth] = useStoredValue(
48
- getKey(SIDEVIEW_WIDTH),
49
- 320,
50
- )
51
-
52
- const onUpdateSlideoutViewWidth = (width) => {
53
- setSlideoutViewWidth(width)
54
- }
55
-
56
- const contentWidthOffset = useMemo(() => {
57
- if (isDocked) {
58
- return sidebarWidth + sideItemViewWidth
59
- } else {
60
- return sidebarWidth
61
- }
62
- }, [isDocked, sidebarWidth, sideItemViewWidth])
63
-
64
- // don't render anything before values are initialized
65
- if (
66
- typeof sidebarWidth === "undefined" ||
67
- typeof sideItemViewWidth === "undefined"
68
- )
69
- return null
70
-
71
- return (
72
- <ContentViewContext
73
- value={{
74
- storageKeyPrefix,
75
- isDocked,
76
- setIsDocked,
77
- sideItemViewWidth,
78
- onUpdateSlideoutViewWidth,
79
- contentViewWidth,
80
- contentViewHeight,
81
- sidebarWidth,
82
- setSidebarWidth,
83
- headerHeight,
84
- }}
85
- >
86
- {header}
87
- <div
88
- className=""
89
- style={{
90
- display: "flex",
91
- flexDirection: "row",
92
- }}
93
- >
94
- <div id="sidebar-container" style={{top: headerHeight}} />
95
-
96
- <div
97
- ref={contentViewRef}
98
- key={`content-wrapper-${"content_view_"}`}
99
- style={{
100
- width: `calc(100vw - ${contentWidthOffset}px)`,
101
- height: `calc(100vh - ${headerHeight}px)`,
102
- marginTop: headerHeight,
103
- overflowY: "scroll",
104
- marginLeft: sidebarWidth,
105
- }}
106
- >
107
- {children}
108
- </div>
109
- </div>
110
-
111
- <div id="slideout-container" />
112
- </ContentViewContext>
113
- )
114
- },
115
- )
@@ -1,52 +0,0 @@
1
- @import "helpers";
2
-
3
- @import "./variables";
4
-
5
- $brand-v-padding: 11px;
6
- $account-max-width: 160px;
7
- $img-size: 32px;
8
- $img-border-radius: 3px;
9
-
10
- #header-container {
11
- border-bottom: 1px solid $black;
12
- background-color: $black !important;
13
-
14
- .nav-link {
15
- color: $gray-200;
16
-
17
- &.active {
18
- font-weight: bold;
19
- color: $white;
20
- text-shadow: lighten(rgba($blue, 0.6), 80%) 1px 0 8px;
21
- }
22
- }
23
- }
24
-
25
- .current-account-subtitle {
26
- color: $gray-900;
27
- max-width: $account-max-width;
28
- }
29
-
30
- .accounts-list-item {
31
- display: flex !important;
32
- flex-direction: row !important;
33
- align-items: center;
34
-
35
- .text-truncate {
36
- max-width: $account-max-width;
37
- }
38
-
39
- img {
40
- width: $img-size;
41
- height: $img-size;
42
- border-radius: $img-border-radius;
43
- }
44
-
45
- .account-info {
46
- max-width: 130px;
47
- }
48
-
49
- .account-info-small {
50
- color: $gray-600;
51
- }
52
- }
@@ -1,23 +0,0 @@
1
- import {ReactNode} from "react"
2
-
3
- import "./header.scss"
4
- import {useContentViewContext} from "../ContentView/ContentViewContext"
5
-
6
-
7
- export const HeaderContainer = ({children}: { children: ReactNode }) => {
8
- const contentViewContext = useContentViewContext()
9
-
10
- if (!children || !contentViewContext) return null
11
-
12
- return (
13
- <nav
14
- id="header-container"
15
- className={
16
- "d-flex align-items-center fixed-top bg-dark flex-md-nowrap shadow p-0 text-light"
17
- }
18
- style={{height: contentViewContext.headerHeight}}
19
- >
20
- {children}
21
- </nav>
22
- )
23
- }
@@ -1 +0,0 @@
1
- $header-height: 44px;
@@ -1,151 +0,0 @@
1
- import assert from "assert"
2
- import {
3
- ReactNode,
4
- createContext,
5
- useContext,
6
- useId,
7
- useRef,
8
- useState,
9
- useEffect,
10
- useCallback,
11
- } from "react"
12
-
13
-
14
- const TOGGLE_OFF_DELAY = 180
15
-
16
- export const MorphingDropdownContext = createContext(undefined!)
17
-
18
- export const useMorphingDropdown = () => useContext(MorphingDropdownContext)
19
-
20
- export const MorphingDropdownProvider = ({
21
- children,
22
- side,
23
- }: {
24
- children: ReactNode;
25
- side: "left" | "right";
26
- }) => {
27
- const portalId = useId()
28
-
29
- const setNextMountedRectRef = useRef(() => null)
30
- const onResetStateRef = useRef(() => null)
31
- const mousePosRef = useRef({x: 0, y: 0})
32
- const isMouseOverToggleRef = useRef(false)
33
-
34
- const [activeId, _setActiveId] = useState()
35
-
36
- useEffect(() => {
37
- assert(["left", "right"].includes(side))
38
- }, [])
39
-
40
- useEffect(() => {
41
- const listener = (e) => {
42
- mousePosRef.current = {
43
- x: e.pageX,
44
- y: e.pageY,
45
- }
46
- }
47
-
48
- document.addEventListener("mousemove", listener)
49
-
50
- return () => {
51
- document.removeEventListener("mousemove", listener)
52
- }
53
- }, [])
54
-
55
- const setActiveId = useCallback((nextId) => {
56
- let shouldReset = false
57
- _setActiveId((currentId) => {
58
- if (nextId === currentId || nextId === null) {
59
- shouldReset = true
60
-
61
- return null
62
- } else return nextId
63
- })
64
-
65
- if (shouldReset) {
66
- const fn = onResetStateRef.current
67
- if (typeof fn === "function") {
68
- fn()
69
- }
70
- }
71
- }, [])
72
-
73
- const close = useCallback(() => {
74
- setActiveId(null)
75
- }, [setActiveId])
76
-
77
- const hideAfterMouseLeave = useCallback(() => {
78
- // hovering a toggle, skip
79
- if (isMouseOverToggleRef.current) return
80
-
81
- // check if we are hovering the menu's portal
82
- const portalEl = document.getElementById(portalId)
83
-
84
- if (!portalEl) {
85
- setActiveId(null)
86
- return
87
- }
88
-
89
- // portal exists, check if cursor is hovering it
90
- const rect = portalEl.getBoundingClientRect()
91
- const {x: mouseX, y: mouseY} = mousePosRef.current
92
-
93
- const isHovering =
94
- mouseX >= rect.left &&
95
- mouseX <= rect.right &&
96
- mouseY >= rect.top &&
97
- mouseY <= rect.bottom
98
-
99
- if (!isHovering) {
100
- setActiveId(null)
101
- return
102
- }
103
- }, [])
104
-
105
- const registerSetNextMountedHandler = (fn) => {
106
- setNextMountedRectRef.current = fn
107
- }
108
-
109
- const registerOnResetState = (fn) => {
110
- onResetStateRef.current = fn
111
- }
112
-
113
- // when a toggle is hovered
114
- const applyMouseEnterToggle = (id) => {
115
- isMouseOverToggleRef.current = true
116
- _setActiveId(id)
117
- }
118
-
119
- const applyMouseLeaveToggle = () => {
120
- isMouseOverToggleRef.current = false
121
- setTimeout(() => {
122
- hideAfterMouseLeave()
123
- }, TOGGLE_OFF_DELAY)
124
- }
125
-
126
- const applyMouseLeaveMenu = () => {
127
- setTimeout(() => {
128
- hideAfterMouseLeave()
129
- }, TOGGLE_OFF_DELAY)
130
- }
131
-
132
- return (
133
- <MorphingDropdownContext.Provider
134
- value={{
135
- registerSetNextMountedHandler,
136
- setNextMountedRect: setNextMountedRectRef.current,
137
- registerOnResetState,
138
- applyMouseEnterToggle,
139
- applyMouseLeaveToggle,
140
- applyMouseLeaveMenu,
141
- activeId,
142
- setActiveId,
143
- close,
144
- side,
145
- portalId,
146
- }}
147
- >
148
- {children}
149
- </MorphingDropdownContext.Provider>
150
- )
151
- }
@@ -1,38 +0,0 @@
1
- import assert from "assert"
2
- import {useRef, useLayoutEffect} from "react"
3
-
4
- import {useMorphingDropdown} from "./MorphingDropdownContext"
5
-
6
-
7
- export const MorphingDropdownMenu = ({
8
- ref: parentRef,
9
- id,
10
- style = {},
11
- children,
12
- className = "",
13
- ...props
14
- }) => {
15
- assert(id, "missing dropdown menu id")
16
-
17
- const selfRef = useRef(null)
18
-
19
- const dropdownContext = useMorphingDropdown()
20
-
21
- const ref = parentRef || selfRef
22
-
23
- useLayoutEffect(() => {
24
- const rect = ref.current.getBoundingClientRect()
25
- dropdownContext.setNextMountedRect(id, rect)
26
- }, [])
27
-
28
- return (
29
- <div
30
- ref={ref}
31
- {...props}
32
- className={cx("text-light", className)}
33
- style={{...style}}
34
- >
35
- {children}
36
- </div>
37
- )
38
- }