@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.
- package/package.json +11 -113
- package/src/apiClient/getServerApiClient.ts +131 -0
- package/src/apiClient/index.ts +86 -0
- package/src/index.ts +3 -0
- package/src/initClient.ts +32 -0
- package/src/types.ts +7 -0
- package/AppProvider/AnalyticsContainer.js +0 -56
- package/AppProvider/debug.js +0 -4
- package/AppProvider/index.tsx +0 -79
- package/access-control/ACLForm/components/GrantField/OpSelector.tsx +0 -129
- package/access-control/ACLForm/components/GrantField/ResourceSelector.tsx +0 -86
- package/access-control/ACLForm/components/GrantField/UsersSelector.tsx +0 -96
- package/access-control/ACLForm/components/GrantField/grant-field.scss +0 -26
- package/access-control/ACLForm/components/GrantField/icons/CheckMark.tsx +0 -16
- package/access-control/ACLForm/components/GrantField/icons/CollapseArrow.tsx +0 -14
- package/access-control/ACLForm/components/GrantField/icons/ExpandArrow.tsx +0 -14
- package/access-control/ACLForm/components/GrantField/index.tsx +0 -91
- package/access-control/ACLForm/components/GrantsList.tsx +0 -48
- package/access-control/ACLForm/components/RoleForm.tsx +0 -134
- package/access-control/ACLForm/components/RoleView.tsx +0 -115
- package/access-control/ACLForm/components/RolesList.tsx +0 -79
- package/access-control/ACLForm/components/constants.tsx +0 -1
- package/access-control/ACLForm/components/resolver.ts +0 -57
- package/access-control/ACLForm/components/role-form.scss +0 -19
- package/access-control/ACLForm/index.tsx +0 -48
- package/access-control/ACLModal/acl-modal.scss +0 -7
- package/access-control/ACLModal/index.tsx +0 -66
- package/access-control/PolicyEditor/TargetSelector/QueryBuilder.tsx +0 -48
- package/access-control/PolicyEditor/TargetSelector/index.tsx +0 -5
- package/access-control/PolicyEditor/TargetSelector/query-builder.scss +0 -9
- package/access-control/PolicyEditor/index.tsx +0 -165
- package/access-control/index.ts +0 -3
- package/apiClient.js +0 -15
- package/auth/authProps.js +0 -8
- package/auth/components/AccountsList/AccountListItem.js +0 -61
- package/auth/components/AccountsList/account-list-item.scss +0 -5
- package/auth/components/AccountsList/index.js +0 -17
- package/auth/components/Footer/index.js +0 -11
- package/auth/components/ForgotPassword/forgot-password.scss +0 -37
- package/auth/components/ForgotPassword/index.js +0 -114
- package/auth/components/SetNewPassword/index.js +0 -130
- package/auth/components/SetNewPassword/set-new-password.scss +0 -47
- package/auth/components/SignIn/SignInEmailForm.tsx +0 -115
- package/auth/components/SignIn/index.js +0 -69
- package/auth/components/SignIn/sign-in.scss +0 -56
- package/auth/components/SignOut/index.js +0 -144
- package/auth/components/SignOut/sign-out.scss +0 -34
- package/auth/components/SignUp/SignUpEmailForm.tsx +0 -98
- package/auth/components/SignUp/index.js +0 -66
- package/auth/components/SignUp/sign-up.scss +0 -56
- package/auth/getTenantId.js +0 -12
- package/auth/getUid.js +0 -11
- package/auth/helpers/redirectSignIn.native.js +0 -9
- package/auth/helpers/redirectSignIn.web.js +0 -7
- package/auth/index.js +0 -146
- package/auth/signOut.js +0 -20
- package/auth/useAuthRouter.js +0 -56
- package/env.d.ts +0 -3
- package/firebase/index.js +0 -1
- package/firebase/sw.js +0 -1
- package/form/FileInput/FileUploadContext.tsx +0 -162
- package/form/FileInput/FileUploadForm/index.tsx +0 -139
- package/form/FileInput/FileUploadForm/usePreventUnload.js +0 -21
- package/form/FileInput/UploadButton.tsx +0 -23
- package/form/FileInput/constants.ts +0 -16
- package/form/FileInput/file-input.scss +0 -1
- package/form/FileInput/index.tsx +0 -21
- package/form/FileInput/upload-worker/get_file_hash.js +0 -63
- package/form/FileInput/upload-worker/index.js +0 -16
- package/form/FileInput/upload-worker/no_compress_exts.ts +0 -33
- package/form/FileInput/upload-worker/upload_file.js +0 -129
- package/form/Form.tsx +0 -23
- package/form/Input.tsx +0 -62
- package/form/SubmitButton/index.tsx +0 -58
- package/form/hook-form.tsx +0 -7
- package/form/index.tsx +0 -5
- package/getBaseUrl.js +0 -14
- package/getObjectId.ts +0 -31
- package/hashState.js +0 -158
- package/helpers/createBatcher/index.js +0 -36
- package/helpers/getInitials.js +0 -39
- package/helpers/onReady.js +0 -15
- package/helpers/post.js +0 -18
- package/helpers/postRPC.js +0 -42
- package/helpers/useRPC.js +0 -41
- package/helpers/useStoredValue/batchedGetStoredValues.js +0 -30
- package/helpers/useStoredValue/index.js +0 -107
- package/helpers/useStoredValue/setStoredValues.js +0 -14
- package/i18n/en/rb.nav.json +0 -13
- package/i18n/en/rb.sign_in.json +0 -11
- package/i18n/en/rb.sign_out.json +0 -5
- package/i18n/fr/rb.sign_in.json +0 -11
- package/i18n/fr/rb.sign_out.json +0 -5
- package/i18n/index.js +0 -63
- package/index.js +0 -6
- package/isEqualValues.js +0 -47
- package/jest.config.js +0 -16
- package/notifications/Notification/index.js +0 -36
- package/notifications/Notification/notification.scss +0 -1
- package/notifications/NotificationItem/HeaderStatus.js +0 -93
- package/notifications/NotificationItem/index.js +0 -65
- package/notifications/NotificationItem/notification-item.scss +0 -25
- package/notifications/NotificationsContainer/index.js +0 -37
- package/notifications/NotificationsContainer/notifications-container.scss +0 -38
- package/notifications/NotificationsContainer/useLLTs.js +0 -28
- package/notifications/NotificationsContext/index.js +0 -71
- package/notifications/NotificationsContext/useNotificationsList.js +0 -75
- package/notifications/NotificationsSettingsModal/SettingsForm.js +0 -52
- package/notifications/NotificationsSettingsModal/index.js +0 -48
- package/notifications/NotificationsSettingsModal/notifications-settings.scss +0 -1
- package/notifications/config.js +0 -1
- package/notifications/index.js +0 -4
- package/page.js +0 -9
- package/publish-output.txt +0 -0
- package/rpc.js +0 -32
- package/rr-trace/get_fingerprint.js +0 -10
- package/rr-trace/get_perf_vitals.js +0 -24
- package/rr-trace/get_session_id.js +0 -29
- package/rr-trace/index.js +0 -138
- package/rr-trace/write_session_data.js +0 -86
- package/rts/boot.js +0 -3
- package/rts/getUseDocument.js +0 -21
- package/rts/getUseQuery/index.js +0 -233
- package/rts/getUseQuery/useData.js +0 -55
- package/rts/index.js +0 -10
- package/rts/rts.js +0 -243
- package/rts/signout.ts +0 -8
- package/rts/store/constants.js +0 -3
- package/rts/store/debug.js +0 -24
- package/rts/store/get_collection.js +0 -55
- package/rts/store/index.js +0 -100
- package/rts/store/replace_query_keys.js +0 -30
- package/rts/store/satisfies_projection.js +0 -32
- package/rts/store/update_docs.js +0 -47
- package/storage/index.jest.js +0 -15
- package/storage/index.native.js +0 -38
- package/storage/index.web.js +0 -25
- package/types.ts +0 -6
- package/ui/ActivityIndicator/index.js +0 -113
- package/ui/Avatar/index.native.js +0 -31
- package/ui/Avatar/index.web.js +0 -37
- package/ui/Avatar/styles.js +0 -41
- package/ui/ErrorBoundary/index.js +0 -12
- package/ui/ExpandableFloatView/exp.scss +0 -15
- package/ui/ExpandableFloatView/index.tsx +0 -123
- package/ui/ExpandableFloatView/useBackdrop.js +0 -45
- package/ui/LottiePlayer/LottiePlayer.js +0 -4
- package/ui/LottiePlayer/index.js +0 -8
- package/ui/Modal/HashStateModal.js +0 -30
- package/ui/Modal/Modal.js +0 -93
- package/ui/Modal/ModalForm/AlertBanner.js +0 -82
- package/ui/Modal/ModalForm/index.js +0 -188
- package/ui/Modal/ModalForm/modal-form.scss +0 -63
- package/ui/Modal/index.js +0 -10
- package/ui/Modal/modal.scss +0 -101
- package/ui/Modal/withHashStateModal.js +0 -24
- package/ui/RedboxError/index.js +0 -3
- package/ui/Search/SearchHistory/index.js +0 -45
- package/ui/Search/SearchHistory/search-history.scss +0 -9
- package/ui/Search/SearchHistory/useSearchHistory.tsx +0 -57
- package/ui/Search/SearchResults/index.tsx +0 -90
- package/ui/Search/index.tsx +0 -298
- package/ui/Search/search.scss +0 -0
- package/ui/SelectPills/index.tsx +0 -96
- package/ui/SelectPills/select-pills.scss +0 -66
- package/ui/Tabs/index.tsx +0 -161
- package/ui/Tabs/tabs.scss +0 -53
- package/ui/Tree/index.js +0 -257
- package/ui/Tree/model.js +0 -71
- package/ui/Tree/node.js +0 -112
- package/ui/Tree/tree.scss +0 -98
- package/ui/UserAvatar/default_colors.json +0 -82
- package/ui/UserAvatar/index.js +0 -55
- package/ui/View/index.tsx +0 -17
- package/ui/View/index.web.js +0 -44
- package/ui/animations/checkmark.json +0 -1
- package/ui/helpers/SizeContext/index.tsx +0 -11
- package/ui/helpers/helpers.scss +0 -61
- package/ui/helpers/index.ts +0 -6
- package/ui/helpers/stopEventPropagation.js +0 -5
- package/ui/helpers/useActiveListItemIndex/index.tsx +0 -45
- package/ui/helpers/useScrollSelectorIntoView/index.tsx +0 -14
- package/ui/helpers/useThrottledMeasure/index.js +0 -47
- package/ui/helpers/withSuspense/index.js +0 -37
- package/ui/icons/AddAccount.tsx +0 -5
- package/ui/icons/Billing.tsx +0 -6
- package/ui/icons/Close.tsx +0 -14
- package/ui/icons/Organization.tsx +0 -5
- package/ui/icons/Signout.tsx +0 -5
- package/ui/icons/index.tsx +0 -6
- package/ui/nav/AccountsDropdown/SwitchAccounts.tsx +0 -28
- package/ui/nav/AccountsDropdown/accounts-dropdown.scss +0 -51
- package/ui/nav/AccountsDropdown/index.tsx +0 -90
- package/ui/nav/AccountsToggle/index.tsx +0 -24
- package/ui/nav/ContentView/ContentViewContext.ts +0 -23
- package/ui/nav/ContentView/index.tsx +0 -115
- package/ui/nav/HeaderContainer/header.scss +0 -52
- package/ui/nav/HeaderContainer/index.tsx +0 -23
- package/ui/nav/HeaderContainer/variables.scss +0 -1
- package/ui/nav/MorphingDropdown/MorphingDropdownContext.tsx +0 -151
- package/ui/nav/MorphingDropdown/MorphingDropdownMenu.tsx +0 -38
- package/ui/nav/MorphingDropdown/MorphingDropdownPortal.tsx +0 -166
- package/ui/nav/MorphingDropdown/MorphingDropdownToggle.tsx +0 -34
- package/ui/nav/MorphingDropdown/index.tsx +0 -16
- package/ui/nav/MorphingDropdown/morphing-dropdown.scss +0 -35
- package/ui/nav/NotificationsDropdown/index.tsx +0 -52
- package/ui/nav/NotificationsDropdown/notifications-dropdown.scss +0 -5
- package/ui/nav/NotificationsToggle/NotificationsGlyph.tsx +0 -54
- package/ui/nav/NotificationsToggle/index.tsx +0 -12
- package/ui/nav/NotificationsToggle/notification-animation.json +0 -1
- package/ui/nav/NotificationsToggle/notifications-toggle.scss +0 -26
- package/ui/nav/SidebarContainer/index.tsx +0 -48
- package/ui/nav/SidebarContainer/sidebar-container.scss +0 -21
- package/ui/nav/SlideoutContainer/components/Body.tsx +0 -19
- package/ui/nav/SlideoutContainer/components/Header.tsx +0 -23
- package/ui/nav/SlideoutContainer/components/Wrapper.tsx +0 -46
- package/ui/nav/SlideoutContainer/index.tsx +0 -50
- package/ui/nav/SlideoutContainer/slideout-container.scss +0 -40
- package/ui/nav/index.ts +0 -13
- package/ui/oauth/GitHub.js +0 -38
- package/ui/oauth/getGitHubSigninUrl.js +0 -30
- package/ui/oauth/index.js +0 -9
- package/ui/oauth/oauth.scss +0 -16
- package/ui/sortable-hoc/AutoScroller.js +0 -76
- package/ui/sortable-hoc/DragHandle.js +0 -31
- package/ui/sortable-hoc/Manager.js +0 -54
- package/ui/sortable-hoc/README.md +0 -1
- package/ui/sortable-hoc/SortableContainer/defaultGetHelperDimensions.js +0 -7
- package/ui/sortable-hoc/SortableContainer/defaultShouldCancelStart.js +0 -24
- package/ui/sortable-hoc/SortableContainer/index.js +0 -994
- package/ui/sortable-hoc/SortableContainer/props.js +0 -81
- package/ui/sortable-hoc/SortableElement.js +0 -111
- package/ui/sortable-hoc/SortableHandle.js +0 -45
- package/ui/sortable-hoc/drag-handle.scss +0 -14
- package/ui/sortable-hoc/index.js +0 -9
- package/ui/sortable-hoc/utils.js +0 -292
- package/ui/springs.ts +0 -17
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import assert from "assert"
|
|
2
|
-
import {useState, useEffect, useRef, ReactNode} from "react"
|
|
3
|
-
import {createPortal} from "react-dom"
|
|
4
|
-
import {CSSTransition, TransitionGroup} from "react-transition-group"
|
|
5
|
-
|
|
6
|
-
import {motion} from "framer-motion"
|
|
7
|
-
|
|
8
|
-
import {SPRING_DEFAULT} from "../../springs"
|
|
9
|
-
|
|
10
|
-
import {useMorphingDropdown} from "./MorphingDropdownContext"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const RIGHT_OFFSET = 0
|
|
14
|
-
|
|
15
|
-
const getElementId = (id) => `header-dd-transition-${id}`
|
|
16
|
-
|
|
17
|
-
export const MorphingDropdownPortal = ({children}: {children: ReactNode}) => {
|
|
18
|
-
const portalElRef = useRef(document.createElement("div"))
|
|
19
|
-
const previousMountedIdRef = useRef(null)
|
|
20
|
-
const transitionNodeRef = useRef(null)
|
|
21
|
-
|
|
22
|
-
const dropdownContext = useMorphingDropdown()
|
|
23
|
-
const {portalId} = dropdownContext
|
|
24
|
-
|
|
25
|
-
const [animatedVals, setAnimatedVals] = useState({})
|
|
26
|
-
const [shouldAnimate, setShouldAnimate] = useState(false)
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
document.body.appendChild(portalElRef.current)
|
|
30
|
-
|
|
31
|
-
return () => {
|
|
32
|
-
document.body.removeChild(portalElRef.current)
|
|
33
|
-
}
|
|
34
|
-
}, [])
|
|
35
|
-
|
|
36
|
-
// on click outside dismiss
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
// do nothing if menu isn't open
|
|
39
|
-
if (!dropdownContext.activeId) {
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const onClick = (e) => {
|
|
44
|
-
const wrapperEl = document.getElementById(portalId)
|
|
45
|
-
|
|
46
|
-
// click is inside the menu itself, so don't do anything
|
|
47
|
-
if (wrapperEl.contains(e.target)) {
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// clicked outside, but we must ensure we didn't click on an anchor
|
|
52
|
-
let isInsideAnchor = false
|
|
53
|
-
const anchorElements = Array.from(document.querySelectorAll(".morphing-dropdown-anchor"))
|
|
54
|
-
anchorElements.forEach((anchorEl) => {
|
|
55
|
-
if (anchorEl.contains(e.target)) {
|
|
56
|
-
isInsideAnchor = true
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
// we have clicked, not in the menu and not on a menu anchor, dismiss
|
|
61
|
-
if (!isInsideAnchor) {
|
|
62
|
-
dropdownContext.setActiveId(null)
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
document.body.addEventListener("click", onClick)
|
|
67
|
-
|
|
68
|
-
return () => {
|
|
69
|
-
document.body.removeEventListener("click", onClick)
|
|
70
|
-
}
|
|
71
|
-
}, [dropdownContext.activeId])
|
|
72
|
-
|
|
73
|
-
//
|
|
74
|
-
dropdownContext.registerSetNextMountedHandler((id, rect) => {
|
|
75
|
-
const {height: nextHeight, width: nextWidth} = rect
|
|
76
|
-
|
|
77
|
-
const anchorElement = document.getElementById(`anchor-${id}`)
|
|
78
|
-
assert(anchorElement, "anchor element not found")
|
|
79
|
-
const anchorRect = anchorElement.getBoundingClientRect()
|
|
80
|
-
const centerX = anchorRect.x + anchorRect.width / 2
|
|
81
|
-
|
|
82
|
-
const viewportWidth = window.innerWidth
|
|
83
|
-
|
|
84
|
-
const nextAnimatedVals = {opacity: 1, height: nextHeight, width: nextWidth}
|
|
85
|
-
|
|
86
|
-
// LEFT
|
|
87
|
-
if (dropdownContext.side === "left") {
|
|
88
|
-
const nextLeft = centerX - nextWidth / 2
|
|
89
|
-
let left = 0 + nextLeft
|
|
90
|
-
|
|
91
|
-
if (left < 0) {
|
|
92
|
-
left = 0
|
|
93
|
-
// handles the right corner radius + border
|
|
94
|
-
document.getElementById(portalId).classList.add("docked-left")
|
|
95
|
-
} else {
|
|
96
|
-
document.getElementById(portalId).classList.remove("docked-left")
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
nextAnimatedVals.left = left
|
|
100
|
-
}
|
|
101
|
-
// RIGHT
|
|
102
|
-
else if (dropdownContext.side === "right") {
|
|
103
|
-
const nextRight = centerX + nextWidth / 2
|
|
104
|
-
let right = viewportWidth - nextRight
|
|
105
|
-
|
|
106
|
-
if (right < 0) {
|
|
107
|
-
right = 0
|
|
108
|
-
// handles the right corner radius + border
|
|
109
|
-
document.getElementById(portalId).classList.add("docked-right")
|
|
110
|
-
} else {
|
|
111
|
-
document.getElementById(portalId).classList.remove("docked-right")
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
nextAnimatedVals.right = right
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// do not animate on first mount / render
|
|
118
|
-
const isNewMount = !previousMountedIdRef.current
|
|
119
|
-
previousMountedIdRef.current = id
|
|
120
|
-
|
|
121
|
-
if (isNewMount) {
|
|
122
|
-
setShouldAnimate(false)
|
|
123
|
-
} else {
|
|
124
|
-
setShouldAnimate(true)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
setAnimatedVals(nextAnimatedVals)
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
dropdownContext.registerOnResetState(() => {
|
|
131
|
-
setShouldAnimate(false)
|
|
132
|
-
previousMountedIdRef.current = null
|
|
133
|
-
setAnimatedVals({opacity: 0})
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
const activeComp = children.find((c) => c.props.id === dropdownContext.activeId)
|
|
137
|
-
|
|
138
|
-
if (!activeComp) return null
|
|
139
|
-
|
|
140
|
-
return createPortal(
|
|
141
|
-
<motion.div
|
|
142
|
-
id={portalId}
|
|
143
|
-
className="morphing-dropdown-wrapper"
|
|
144
|
-
style={{position: "fixed", top: 45, right: RIGHT_OFFSET, overflow: "hidden"}}
|
|
145
|
-
transition={shouldAnimate ? SPRING_DEFAULT : {duration: 0}}
|
|
146
|
-
animate={animatedVals}
|
|
147
|
-
onMouseLeave={dropdownContext.applyMouseLeaveMenu}
|
|
148
|
-
>
|
|
149
|
-
<TransitionGroup>
|
|
150
|
-
<CSSTransition
|
|
151
|
-
id={getElementId(dropdownContext.activeId)}
|
|
152
|
-
key={dropdownContext.activeId}
|
|
153
|
-
nodeRef={transitionNodeRef}
|
|
154
|
-
timeout={60}
|
|
155
|
-
className="header-dropdown"
|
|
156
|
-
classNames="header-dropdown-fade"
|
|
157
|
-
unmountOnExit
|
|
158
|
-
in={true}
|
|
159
|
-
>
|
|
160
|
-
<div ref={transitionNodeRef} style={{position: "absolute", overflow: "hidden", minWidth: 100}}>{activeComp}</div>
|
|
161
|
-
</CSSTransition>
|
|
162
|
-
</TransitionGroup>
|
|
163
|
-
</motion.div>,
|
|
164
|
-
portalElRef.current,
|
|
165
|
-
)
|
|
166
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {CSSProperties, ReactNode} from "react"
|
|
2
|
-
import {useMorphingDropdown} from "./MorphingDropdownContext"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export const MorphingDropdownToggle = ({
|
|
6
|
-
id,
|
|
7
|
-
className = "",
|
|
8
|
-
style = {},
|
|
9
|
-
children,
|
|
10
|
-
}: {
|
|
11
|
-
id: string;
|
|
12
|
-
className?: string;
|
|
13
|
-
style?: CSSProperties;
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
}) => {
|
|
16
|
-
const morphingDropdown = useMorphingDropdown()
|
|
17
|
-
|
|
18
|
-
const onMouseEnter = () => {
|
|
19
|
-
morphingDropdown.applyMouseEnterToggle(id)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div
|
|
24
|
-
id={`anchor-${id}`}
|
|
25
|
-
className={cx("morphing-dropdown-anchor", className)}
|
|
26
|
-
onClick={() => morphingDropdown.setActiveId(id)}
|
|
27
|
-
onMouseEnter={onMouseEnter}
|
|
28
|
-
onMouseLeave={morphingDropdown.applyMouseLeaveToggle}
|
|
29
|
-
style={{cursor: "pointer", ...style}}
|
|
30
|
-
>
|
|
31
|
-
{children}
|
|
32
|
-
</div>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "./morphing-dropdown.scss"
|
|
2
|
-
|
|
3
|
-
import {MorphingDropdownPortal} from "./MorphingDropdownPortal"
|
|
4
|
-
import {useMorphingDropdown, MorphingDropdownProvider} from "./MorphingDropdownContext"
|
|
5
|
-
import {MorphingDropdownMenu} from "./MorphingDropdownMenu"
|
|
6
|
-
import {MorphingDropdownToggle} from "./MorphingDropdownToggle"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
MorphingDropdownPortal as Portal,
|
|
11
|
-
MorphingDropdownProvider as Provider,
|
|
12
|
-
MorphingDropdownMenu as Menu,
|
|
13
|
-
MorphingDropdownToggle as Toggle,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export {useMorphingDropdown}
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import Form from "react-bootstrap/Form"
|
|
2
|
-
import {useTranslation} from "react-i18next"
|
|
3
|
-
|
|
4
|
-
import {useStoredValue} from "../../../helpers/useStoredValue"
|
|
5
|
-
import {useHashState} from "../../../hashState"
|
|
6
|
-
|
|
7
|
-
import * as MorphingDropdown from "../MorphingDropdown"
|
|
8
|
-
|
|
9
|
-
import "./notifications-dropdown.scss"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export const NotificationsDropdown = ({id}) => {
|
|
13
|
-
const {t} = useTranslation("rb.nav")
|
|
14
|
-
|
|
15
|
-
const [isEnabled, setIsEnabled] = useStoredValue("has_notifications_enabled", "yes")
|
|
16
|
-
|
|
17
|
-
const {serializeHashState} = useHashState()
|
|
18
|
-
|
|
19
|
-
const onToggleNotifications = (e) => {
|
|
20
|
-
setIsEnabled(e.target.checked ? "yes" : "no")
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const onClickNotificationsSettings = () => {
|
|
24
|
-
serializeHashState({
|
|
25
|
-
showNotificationsSettingsModal: true,
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<MorphingDropdown.Menu id={id} style={{minWidth: 300}}>
|
|
31
|
-
<div className="text-light px-3">
|
|
32
|
-
<Form.Check
|
|
33
|
-
type="switch"
|
|
34
|
-
id="toggle-notifications-switch"
|
|
35
|
-
label={t("toggle_notifications")}
|
|
36
|
-
data-bs-theme="dark"
|
|
37
|
-
checked={isEnabled === "yes"}
|
|
38
|
-
onChange={onToggleNotifications}
|
|
39
|
-
/>
|
|
40
|
-
</div>
|
|
41
|
-
<div className="list-group" data-bs-theme="dark">
|
|
42
|
-
<button
|
|
43
|
-
className="list-group-item list-group-item-action"
|
|
44
|
-
onClick={onClickNotificationsSettings}
|
|
45
|
-
>
|
|
46
|
-
{t("notifications_settings")}
|
|
47
|
-
</button>
|
|
48
|
-
<button className="list-group-item list-group-item-action">List item23.. ..</button>
|
|
49
|
-
</div>
|
|
50
|
-
</MorphingDropdown.Menu>
|
|
51
|
-
)
|
|
52
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import {useRef, useEffect} from "react"
|
|
2
|
-
|
|
3
|
-
import LottiePlayer from "../../LottiePlayer"
|
|
4
|
-
|
|
5
|
-
import notifAnimation from "./notification-animation.json"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export const NotificationsGlyph = () => {
|
|
9
|
-
const playerRef = useRef(null)
|
|
10
|
-
|
|
11
|
-
const play = () => {
|
|
12
|
-
playerRef.current?.setSeeker(0, true)
|
|
13
|
-
playerRef.current?.play()
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const onPlay = () => {
|
|
18
|
-
play()
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
document.body.addEventListener("PLAY_NOTIF_ANIMATION", onPlay)
|
|
22
|
-
|
|
23
|
-
return () => {
|
|
24
|
-
document.body.removeEventListener("PLAY_NOTIF_ANIMATION", onPlay)
|
|
25
|
-
}
|
|
26
|
-
}, [])
|
|
27
|
-
|
|
28
|
-
const onPlayerMouseEnter = () => {
|
|
29
|
-
play()
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<div
|
|
34
|
-
className="player-wrapper h-100 d-flex align-items-center"
|
|
35
|
-
onMouseEnter={onPlayerMouseEnter}
|
|
36
|
-
>
|
|
37
|
-
<LottiePlayer
|
|
38
|
-
id="notifications-glyph-player"
|
|
39
|
-
ref={playerRef}
|
|
40
|
-
autoplay={false}
|
|
41
|
-
loop={false}
|
|
42
|
-
// speed={2}
|
|
43
|
-
keepLastFrame={true}
|
|
44
|
-
src={notifAnimation}
|
|
45
|
-
style={{
|
|
46
|
-
marginTop: -1,
|
|
47
|
-
height: "23px",
|
|
48
|
-
// width: "21px",
|
|
49
|
-
}}
|
|
50
|
-
// onEvent={this.onPlayerEvent}
|
|
51
|
-
/>
|
|
52
|
-
</div>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as MorphingDropdown from "../MorphingDropdown"
|
|
2
|
-
|
|
3
|
-
import {NotificationsGlyph} from "./NotificationsGlyph"
|
|
4
|
-
|
|
5
|
-
import "./notifications-toggle.scss"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export const NotificationsToggle = ({onClick}) => (
|
|
9
|
-
<MorphingDropdown.Toggle id="notifications" className="px-2">
|
|
10
|
-
<NotificationsGlyph />
|
|
11
|
-
</MorphingDropdown.Toggle>
|
|
12
|
-
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"v":"5.6.5","fr":24,"ip":0,"op":28,"w":30,"h":30,"nm":"bell","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"bell2 Outlines","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":3,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":8,"s":[11]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":12,"s":[-12]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":16,"s":[5]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":19,"s":[-7]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":22,"s":[3]},{"t":25,"s":[0]}],"ix":10},"p":{"a":0,"k":[14.93,4.945,0],"ix":2},"a":{"a":0,"k":[14.93,4.945,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.553,0],[0,0],[0,-0.553],[-0.552,0],[0,0],[0,0.553]],"o":[[0,0],[-0.552,0],[0,0.553],[0,0],[0.553,0],[0,-0.553]],"v":[[10,-1],[-10,-1],[-11,0],[-10,1],[10,1],[11,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[15,23],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,1.59],[0,0],[3.448,0.89],[0,0],[1.105,0],[0,-1.105],[0,0],[0,-3.726],[0,0],[0.609,-1.453],[0,0]],"o":[[0,0],[0,-3.726],[0,0],[0,-1.105],[-1.105,0],[0,0],[-3.448,0.89],[0,0],[0,1.59],[0,0],[-0.609,-1.452]],"v":[[8,3.894],[8,1.5],[2,-6.238],[2,-6.5],[0,-8.5],[-2,-6.5],[-2,-6.238],[-8,1.5],[-8,3.894],[-8.935,8.5],[8.935,8.5]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[15,11.5],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":28,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"mask","td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":3,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":8,"s":[11]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":12,"s":[-12]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":16,"s":[5]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":19,"s":[-7]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":22,"s":[3]},{"t":25,"s":[0]}],"ix":10},"p":{"a":0,"k":[14.938,5,0],"ix":2},"a":{"a":0,"k":[14.938,5,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.553,0],[0,0],[0,1.585],[0,0],[4.418,0],[0,-4.418],[0,0],[1.15,-1.893],[0,0],[0,-0.553],[-0.552,0],[0,0],[0,0.553]],"o":[[0,0],[-1.518,-2.129],[0,0],[0,-4.418],[-4.418,0],[0,0],[0,1.585],[0,0],[-0.552,0],[0,0.553],[0,0],[0.553,0],[0,-0.553]],"v":[[10,7.5],[9.923,7.5],[8,0.894],[8,-1.5],[0,-9.5],[-8,-1.5],[-8,0.894],[-9.925,7.5],[-10,7.5],[-11,8.5],[-9.938,9.313],[10.063,9.313],[11,8.5]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[15,14.5],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":28,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"tongue Outlines","tt":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":8,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":11,"s":[10]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":14,"s":[-19]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":17,"s":[8]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":20,"s":[-14]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":23,"s":[6]},{"t":25,"s":[0]}],"ix":10},"p":{"a":0,"k":[15,5.188,0],"ix":2},"a":{"a":0,"k":[3.25,-16.563,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[1.657,0],[0,-1.657],[-1.657,0],[0,1.657]],"o":[[-1.657,0],[0,1.657],[1.657,0],[0,-1.657]],"v":[[0,-3],[-3,0],[0,3],[3,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[3.25,3.25],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":28,"st":0,"bm":0}],"markers":[]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
@import "helpers";
|
|
2
|
-
|
|
3
|
-
#notifications-glyph-player {
|
|
4
|
-
position: relative;
|
|
5
|
-
|
|
6
|
-
path {
|
|
7
|
-
fill: $gray-200;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
&:hover {
|
|
11
|
-
path {
|
|
12
|
-
fill: $white;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
&::after {
|
|
17
|
-
content: "";
|
|
18
|
-
position: absolute;
|
|
19
|
-
top: 50%;
|
|
20
|
-
left: 0;
|
|
21
|
-
right: -2px;
|
|
22
|
-
height: 2px;
|
|
23
|
-
background: $red-500;
|
|
24
|
-
transform: rotate(45deg);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {createPortal} from "react-dom"
|
|
2
|
-
import {ResizableBox} from "react-resizable"
|
|
3
|
-
|
|
4
|
-
import {useContentViewContext} from "../ContentView/ContentViewContext"
|
|
5
|
-
|
|
6
|
-
import "./sidebar-container.scss"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const OPENED_MIN_WIDTH = 60
|
|
10
|
-
|
|
11
|
-
export const SidebarContainer = ({children}) => {
|
|
12
|
-
const {sidebarWidth, setSidebarWidth} = useContentViewContext()
|
|
13
|
-
|
|
14
|
-
const onResize = (e, data) => {
|
|
15
|
-
const width = data.size.width
|
|
16
|
-
|
|
17
|
-
// only apply new width if different from previous one
|
|
18
|
-
if (width !== sidebarWidth) {
|
|
19
|
-
setSidebarWidth(width)
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const containerElement = document.getElementById("sidebar-container")
|
|
24
|
-
|
|
25
|
-
if (!containerElement) return null
|
|
26
|
-
|
|
27
|
-
return createPortal((
|
|
28
|
-
<ResizableBox
|
|
29
|
-
id="sidebar"
|
|
30
|
-
width={sidebarWidth}
|
|
31
|
-
// style={{ position: "fixed", top: 45, bottom: 0, overflowX: "visible" }}
|
|
32
|
-
draggableOpts={{}}
|
|
33
|
-
handle={
|
|
34
|
-
<div
|
|
35
|
-
className="sidebar-resize-handle"
|
|
36
|
-
/>
|
|
37
|
-
}
|
|
38
|
-
resizeHandles={["e"]}
|
|
39
|
-
axis="x"
|
|
40
|
-
minConstraints={[OPENED_MIN_WIDTH]}
|
|
41
|
-
maxConstraints={[800]}
|
|
42
|
-
onResize={onResize}
|
|
43
|
-
style={{overflow: "hidden"}}
|
|
44
|
-
>
|
|
45
|
-
{children}
|
|
46
|
-
</ResizableBox>
|
|
47
|
-
), containerElement)
|
|
48
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
@import "helpers";
|
|
2
|
-
|
|
3
|
-
#sidebar-container {
|
|
4
|
-
position: fixed;
|
|
5
|
-
left: 0;
|
|
6
|
-
max-height: calc(100vh - 45px);
|
|
7
|
-
|
|
8
|
-
.sidebar-resize-handle {
|
|
9
|
-
z-index: 3;
|
|
10
|
-
|
|
11
|
-
// transform: translateX(2px);
|
|
12
|
-
position: absolute;
|
|
13
|
-
right: -2px;
|
|
14
|
-
top: 0;
|
|
15
|
-
display: block;
|
|
16
|
-
height: 100%;
|
|
17
|
-
width: 4px;
|
|
18
|
-
cursor: ew-resize;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {useContext} from "react"
|
|
2
|
-
import Offcanvas from "react-bootstrap/Offcanvas"
|
|
3
|
-
|
|
4
|
-
import ContentViewContext from "../../ContentView/ContentViewContext"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const Body = ({children}) => {
|
|
8
|
-
const contentViewContext = useContext(ContentViewContext)
|
|
9
|
-
|
|
10
|
-
if (contentViewContext.isDocked) {
|
|
11
|
-
return children
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<Offcanvas.Body className="d-flex flex-column px-0 pb-0">
|
|
16
|
-
{children}
|
|
17
|
-
</Offcanvas.Body>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {useContext} from "react"
|
|
2
|
-
import Offcanvas from "react-bootstrap/Offcanvas"
|
|
3
|
-
|
|
4
|
-
import {ContentViewContext} from "../../ContentView/ContentViewContext"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const Header = ({children}) => {
|
|
8
|
-
const contentViewContext = useContext(ContentViewContext)
|
|
9
|
-
|
|
10
|
-
if (contentViewContext.isDocked) {
|
|
11
|
-
return (
|
|
12
|
-
<div className="bg-light" style={{height: 41}}>
|
|
13
|
-
{children}
|
|
14
|
-
</div>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Offcanvas.Header closeButton>
|
|
20
|
-
<Offcanvas.Title>{children}</Offcanvas.Title>
|
|
21
|
-
</Offcanvas.Header>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import Offcanvas from "react-bootstrap/Offcanvas"
|
|
2
|
-
import {ResizableBox} from "react-resizable"
|
|
3
|
-
|
|
4
|
-
import {useContentViewContext} from "../../ContentView/ContentViewContext"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const Wrapper = ({onUpdateWidth, show, onHide, children}) => {
|
|
8
|
-
const contentViewContext = useContentViewContext()
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const onResize = (e, data) => {
|
|
12
|
-
const val = data.size.width
|
|
13
|
-
onUpdateWidth(val)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (contentViewContext.isDocked) {
|
|
17
|
-
return (
|
|
18
|
-
<ResizableBox
|
|
19
|
-
id="slideout-view-wrapper"
|
|
20
|
-
width={contentViewContext.sideItemViewWidth}
|
|
21
|
-
style={{position: "fixed", top: 45, right: 0, bottom: 0, overflowX: "visible"}}
|
|
22
|
-
draggableOpts={{}}
|
|
23
|
-
handle={<div className="slideout-view-resize-handle" />}
|
|
24
|
-
resizeHandles={["w"]}
|
|
25
|
-
axis="x"
|
|
26
|
-
minConstraints={[120]}
|
|
27
|
-
maxConstraints={[768]}
|
|
28
|
-
onResize={onResize}
|
|
29
|
-
>
|
|
30
|
-
<div className="h-100">{children}</div>
|
|
31
|
-
</ResizableBox>
|
|
32
|
-
)
|
|
33
|
-
} else {
|
|
34
|
-
return (
|
|
35
|
-
<Offcanvas
|
|
36
|
-
className="slideout-view-offcanvas"
|
|
37
|
-
placement="end"
|
|
38
|
-
backdropClassName="slideout-view-backdrop"
|
|
39
|
-
show={show}
|
|
40
|
-
onHide={onHide}
|
|
41
|
-
>
|
|
42
|
-
{children}
|
|
43
|
-
</Offcanvas>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {memo, ReactNode, useEffect} from "react"
|
|
2
|
-
import {createPortal} from "react-dom"
|
|
3
|
-
|
|
4
|
-
import {useContentViewContext} from "../ContentView/ContentViewContext"
|
|
5
|
-
|
|
6
|
-
import {Wrapper} from "./components/Wrapper"
|
|
7
|
-
import {Header} from "./components/Header"
|
|
8
|
-
import {Body} from "./components/Body"
|
|
9
|
-
|
|
10
|
-
import "./slideout-container.scss"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export const SlideoutContainer = memo(
|
|
14
|
-
({
|
|
15
|
-
children,
|
|
16
|
-
onHide,
|
|
17
|
-
isDocked = false,
|
|
18
|
-
header,
|
|
19
|
-
}: {
|
|
20
|
-
children: ReactNode;
|
|
21
|
-
onHide?: () => void;
|
|
22
|
-
isDocked?: boolean;
|
|
23
|
-
header?: ReactNode | string;
|
|
24
|
-
}) => {
|
|
25
|
-
const contentViewContext = useContentViewContext()
|
|
26
|
-
|
|
27
|
-
const {onUpdateSlideoutViewWidth: onUpdateWidth} = contentViewContext
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
contentViewContext.setIsDocked(isDocked)
|
|
31
|
-
|
|
32
|
-
return () => contentViewContext.setIsDocked(false)
|
|
33
|
-
}, [isDocked])
|
|
34
|
-
|
|
35
|
-
// if (!contentViewContext.isDocked) return null
|
|
36
|
-
// if (contentViewContext.isCollapsed && contentViewContext.isDocked) return null
|
|
37
|
-
|
|
38
|
-
const containerElement = document.getElementById("slideout-container")
|
|
39
|
-
if (!containerElement) return null
|
|
40
|
-
|
|
41
|
-
return createPortal(
|
|
42
|
-
<Wrapper onUpdateWidth={onUpdateWidth} show={true} onHide={onHide}>
|
|
43
|
-
{header && <Header>{header}</Header>}
|
|
44
|
-
|
|
45
|
-
<Body>{children}</Body>
|
|
46
|
-
</Wrapper>,
|
|
47
|
-
containerElement,
|
|
48
|
-
)
|
|
49
|
-
},
|
|
50
|
-
)
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
@import "helpers";
|
|
2
|
-
|
|
3
|
-
#slideout-view-wrapper {
|
|
4
|
-
border-left: 1px solid $border-color;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.slideout-view-resize-handle {
|
|
9
|
-
z-index: 3;
|
|
10
|
-
|
|
11
|
-
position: absolute;
|
|
12
|
-
left: -2px;
|
|
13
|
-
top: 0;
|
|
14
|
-
display: block;
|
|
15
|
-
height: 100%;
|
|
16
|
-
width: 4px;
|
|
17
|
-
cursor: ew-resize;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.slideout-view-offcanvas.offcanvas {
|
|
21
|
-
transition: none;
|
|
22
|
-
|
|
23
|
-
.offcanvas-header {
|
|
24
|
-
height: 45px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.offcanvas-title {
|
|
28
|
-
font-size: 1rem;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.offcanvas-body {
|
|
32
|
-
border-top: 1px solid $border-color;
|
|
33
|
-
font-size: $font-size-base;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.slideout-view-backdrop.offcanvas-backdrop {
|
|
38
|
-
transition-duration: 80ms;
|
|
39
|
-
color: $red-800;
|
|
40
|
-
}
|