@rpcbase/client 0.209.0 → 0.211.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.
@@ -0,0 +1,35 @@
1
+ @import "helpers";
2
+
3
+ $transition-duration: 60ms;
4
+
5
+ .morphing-dropdown-wrapper {
6
+ background: $gray-900;
7
+ border-bottom-left-radius: 5px;
8
+ border-bottom-right-radius: 5px;
9
+
10
+ &.docked-right {
11
+ border-bottom-right-radius: 0;
12
+ }
13
+
14
+ &.docked-left {
15
+ border-bottom-left-radius: 0;
16
+ }
17
+ }
18
+
19
+ .header-dropdown-fade-enter {
20
+ opacity: 0;
21
+ }
22
+
23
+ .header-dropdown-fade-enter-active {
24
+ opacity: 1;
25
+ transition: opacity $transition-duration;
26
+ }
27
+
28
+ .header-dropdown-fade-exit {
29
+ opacity: 1;
30
+ }
31
+
32
+ .header-dropdown-fade-exit-active {
33
+ opacity: 00;
34
+ transition: opacity $transition-duration;
35
+ }
package/ui/nav/index.ts CHANGED
@@ -1,4 +1,9 @@
1
- export * from "./Header"
1
+ export * from "./HeaderContainer"
2
2
  export * from "./SidebarContainer"
3
3
  export * from "./SlideoutContainer"
4
4
  export * from "./ContentView"
5
+
6
+ import * as MorphingDropdown from "./MorphingDropdown"
7
+
8
+
9
+ export {MorphingDropdown}
@@ -1,120 +0,0 @@
1
- /* @flow */
2
- import {motion} from "framer-motion"
3
- import {useRef, useState, useImperativeHandle, forwardRef} from "react"
4
-
5
- import {SPRING_DEFAULT} from "../springs"
6
- import useBackdrop from "./useBackdrop"
7
-
8
- import "./exp.scss"
9
-
10
-
11
- export const ExpandableFloatView = forwardRef(
12
- ({renderContent, containerRef, onGetExpandedRect, targetRef, ...props}, ref) => {
13
- const parentRef = useRef(null)
14
- const wrapperRef = useRef(null)
15
-
16
- const isOpen = useRef(false)
17
- const openedFromRect = useRef(null)
18
-
19
- const [animatedVals, setAnimatedVals] = useState({})
20
-
21
- const getRect = () => {
22
- const boundingRect = containerRef.current.getBoundingClientRect()
23
- const rect = {
24
- left: `${boundingRect.x}px`,
25
- top: `${boundingRect.top}px`,
26
- right: `${window.innerWidth - boundingRect.right}px`,
27
- bottom: `${window.innerHeight - boundingRect.bottom}px`,
28
- }
29
-
30
- return rect
31
- }
32
-
33
- const onOpen = () => {
34
- showBackdrop()
35
-
36
- isOpen.current = true
37
-
38
- const expandedRect = onGetExpandedRect()
39
-
40
- requestAnimationFrame(() => {
41
- // set the wrapper ref to current + fixed
42
- const rect = getRect()
43
- openedFromRect.current = rect
44
-
45
- const newStyle = {
46
- position: "fixed",
47
- top: rect.top,
48
- right: rect.right,
49
- bottom: rect.bottom,
50
- left: rect.left,
51
- zIndex: 1000,
52
- }
53
- Object.keys(newStyle).forEach((k) => {
54
- wrapperRef.current.style[k] = newStyle[k]
55
- })
56
-
57
- document.body.appendChild(wrapperRef.current)
58
-
59
- setAnimatedVals(expandedRect)
60
- })
61
- }
62
-
63
- const onClose = () => {
64
- isOpen.current = false
65
-
66
- const returnToRect = openedFromRect.current
67
- setAnimatedVals({
68
- top: returnToRect.top,
69
- right: returnToRect.right,
70
- bottom: returnToRect.bottom,
71
- left: returnToRect.left,
72
- zIndex: "unset",
73
- })
74
- }
75
-
76
- const onToggle = () => {
77
- if (isOpen.current) {
78
- onClose()
79
- } else {
80
- onOpen()
81
- }
82
- }
83
-
84
- // BACKDROP
85
- const {showBackdrop} = useBackdrop(isOpen, onToggle)
86
- // BACKDROP
87
-
88
- useImperativeHandle(ref, () => {
89
- return {
90
- open: () => {
91
- onOpen()
92
- },
93
- toggle: () => {
94
- onToggle()
95
- },
96
- close: () => onClose(),
97
- }
98
- })
99
-
100
- return (
101
- <>
102
- <div ref={parentRef}>
103
- <motion.div
104
- ref={wrapperRef}
105
- style={{
106
- inset: "unset",
107
- // zIndex: 10000,
108
- // ...styleProps,
109
- }}
110
- transition={SPRING_DEFAULT}
111
- animate={{...animatedVals}}
112
- onClick={(e) => e.stopPropagation()}
113
- >
114
- {renderContent({})}
115
- </motion.div>
116
- </div>
117
- </>
118
- )
119
- },
120
- )
package/ui/View/index.js DELETED
@@ -1,12 +0,0 @@
1
- /* @flow */
2
- import {forwardRef} from "react"
3
- import {View as RNView} from "react-native"
4
-
5
-
6
- export const View = forwardRef(({children, ...props}, ref) => {
7
- return (
8
- <RNView ref={ref} {...props}>
9
- {children}
10
- </RNView>
11
- )
12
- })
@@ -1,150 +0,0 @@
1
- /* eslint-disable */
2
- import assert from "assert"
3
- import {useState, useEffect} from "react"
4
-
5
- import apiClient from "../../../apiClient"
6
-
7
- // import SearchAnything from "components/search/SearchAnything"
8
-
9
- // import LogoNav from "./components/LogoNav"
10
-
11
- // Env Selector
12
- // import useFilteredEnvs from "./components/EnvSelector/useFilteredEnvs"
13
- // import EnvSelectorToggle from "./components/EnvSelector/Toggle"
14
- // import EnvSelectorDropdown from "./components/EnvSelector/Dropdown"
15
- // Group Selector
16
- // import useFilteredGroups from "./components/GroupSelector/useFilteredGroups"
17
- // import GroupSelectorToggle from "./components/GroupSelector/Toggle"
18
- // import GroupSelectorDropdown from "./components/GroupSelector/Dropdown"
19
-
20
- // import MorphingDropdown from "./components/MorphingDropdown"
21
-
22
- // import AccountsToggle from "./components/AccountsToggle"
23
- // import NotificationsToggle from "./components/NotificationsToggle"
24
- // import EnvSettingsToggle from "./components/EnvSettingsToggle"
25
- // import PublishControl from "./components/PublishControl"
26
-
27
- // import AccountsDropdown from "./components/AccountsDropdown"
28
- // import NotificationsDropdown from "./components/NotificationsDropdown"
29
- // import PhoneDropdown from "components/phone/PhoneDropdown"
30
- // import EnvSettingsDropdown from "./components/EnvSettingsDropdown"
31
-
32
- import "./header.scss"
33
-
34
-
35
- const DefaultHeader = () => {
36
- return (
37
- <>
38
- <LogoNav isSignedIn={false} />
39
-
40
- <div className="nav-default d-flex flex-row justify-content-between w-100">
41
- <div className="d-flex flex-row"></div>
42
-
43
- <div className="d-flex flex-row">
44
- <a className="nav-link px-2 me-2 fw-bold" href="/signin">
45
- Sign In
46
- </a>
47
- </div>
48
- </div>
49
- </>
50
- )
51
- }
52
-
53
- const SignedInHeader = () => {
54
- const loc = window.location.pathname
55
-
56
- const [accounts, setAccounts] = useState([])
57
-
58
- const {envs, activeEnv, setFilter: setEnvsFilter} = useFilteredEnvs()
59
- const {groups, activeGroup, setFilter: setGroupsFilter} = useFilteredGroups()
60
-
61
- useEffect(() => {
62
- // TODO: useapi hook with cache
63
- const load = async() => {
64
- const res = await apiClient.post("/api/v1/auth/get_accounts")
65
- assert(res.data.status === "ok")
66
- setAccounts(res.data.accounts)
67
- // console.log("accounts", res.data.accounts)
68
- }
69
-
70
- load()
71
- }, [])
72
-
73
- return (
74
- <>
75
- <MorphingDropdown.Provider side="left">
76
- <LogoNav isSignedIn={true} />
77
-
78
- <EnvSelectorToggle activeEnv={activeEnv} />
79
- <GroupSelectorToggle activeGroup={activeGroup} />
80
-
81
- <MorphingDropdown.Portal>
82
- <EnvSelectorDropdown
83
- id="env-selector"
84
- envs={envs}
85
- activeEnv={activeEnv}
86
- setFilter={setEnvsFilter}
87
- />
88
-
89
- <GroupSelectorDropdown
90
- id="group-selector"
91
- groups={groups}
92
- activeGroup={activeGroup}
93
- setFilter={setGroupsFilter}
94
- />
95
- </MorphingDropdown.Portal>
96
- </MorphingDropdown.Provider>
97
-
98
- {/* Search anything */}
99
- <SearchAnything />
100
-
101
- <div className="ms-auto d-none d-md-flex flex-row text-truncate">
102
- <a className="nav-link mx-2 px-1" href="/docs">
103
- Docs
104
- </a>
105
- <a
106
- className={cx("nav-link px-1", {active: loc.startsWith("/marketplace")})}
107
- href="/marketplace"
108
- >
109
- Marketplace
110
- </a>
111
- </div>
112
-
113
- <PublishControl />
114
-
115
- {/* Phone */}
116
- <PhoneDropdown />
117
-
118
- <MorphingDropdown.Provider side="right">
119
- {/* WARNING: update the anchor-${ids} on the toggle to match the menus if adding or removing */}
120
- <NotificationsToggle />
121
-
122
- <EnvSettingsToggle />
123
-
124
- <AccountsToggle />
125
-
126
- <MorphingDropdown.Portal>
127
- {/* Notifications */}
128
- <NotificationsDropdown id="notifications" />
129
-
130
- {/* Env Settings */}
131
- <EnvSettingsDropdown id="env-setup" />
132
-
133
- {/* Accounts + Org */}
134
- <AccountsDropdown id="accounts" accounts={accounts} />
135
- </MorphingDropdown.Portal>
136
- </MorphingDropdown.Provider>
137
- </>
138
- )
139
- }
140
-
141
- export const Header = ({isSignedIn}) => {
142
- return (
143
- <nav
144
- id="main-header-nav"
145
- className={"d-flex align-items-center fixed-top bg-dark flex-md-nowrap shadow p-0 text-light"}
146
- >
147
- this is my header yo
148
- </nav>
149
- )
150
- }
File without changes