@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
package/ui/nav/index.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from "./AccountsDropdown"
|
|
2
|
-
export * from "./AccountsToggle"
|
|
3
|
-
export * from "./ContentView"
|
|
4
|
-
export * from "./HeaderContainer"
|
|
5
|
-
export * from "./NotificationsDropdown"
|
|
6
|
-
export * from "./NotificationsToggle"
|
|
7
|
-
export * from "./SidebarContainer"
|
|
8
|
-
export * from "./SlideoutContainer"
|
|
9
|
-
|
|
10
|
-
import * as MorphingDropdown from "./MorphingDropdown"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export {MorphingDropdown}
|
package/ui/oauth/GitHub.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
import {useEffect, useState} from "react"
|
|
3
|
-
import useLocation from "react-use/lib/useLocation"
|
|
4
|
-
|
|
5
|
-
import getGitHubSigninUrl from "./getGitHubSigninUrl"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export const GitHub = ({text, className = ""}) => {
|
|
9
|
-
const location = useLocation()
|
|
10
|
-
|
|
11
|
-
const [url, setUrl] = useState(getGitHubSigninUrl())
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
const newUrl = getGitHubSigninUrl()
|
|
15
|
-
setUrl(newUrl)
|
|
16
|
-
}, [location])
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<a href={url}
|
|
20
|
-
className={cx("sign-in-github-btn p-2 btn-lg", className)}
|
|
21
|
-
style={{}}>
|
|
22
|
-
<div style={{}} className="me-2">
|
|
23
|
-
<svg height="28px" width="28px" viewBox="0 0 16 16" style={{fill: "currentColor"}}>
|
|
24
|
-
<path fillRule={"evenodd"} d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38
|
|
25
|
-
0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01
|
|
26
|
-
1.08.58 1.23.82.72 1.21 1.87.87
|
|
27
|
-
2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12
|
|
28
|
-
0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08
|
|
29
|
-
2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0
|
|
30
|
-
.21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/>
|
|
31
|
-
</svg>
|
|
32
|
-
</div>
|
|
33
|
-
<div className="">
|
|
34
|
-
{text} with GitHub
|
|
35
|
-
</div>
|
|
36
|
-
</a>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
import {GITHUB_OAUTH_CLIENT_ID} from "env"
|
|
3
|
-
|
|
4
|
-
// https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes
|
|
5
|
-
const DEFAULT_SCOPES = []
|
|
6
|
-
|
|
7
|
-
const getGitHubSigninUrl = () => {
|
|
8
|
-
const params = new URLSearchParams(window.location.search)
|
|
9
|
-
const scopes = params.get("scopes") || ""
|
|
10
|
-
const state = params.get("state")
|
|
11
|
-
|
|
12
|
-
let reqScopes = DEFAULT_SCOPES.join("")
|
|
13
|
-
if (reqScopes && scopes) {
|
|
14
|
-
reqScopes += `%20${scopes}`
|
|
15
|
-
} else if (scopes) {
|
|
16
|
-
reqScopes = scopes
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let authUrl = `https://github.com/login/oauth/authorize?client_id=${GITHUB_OAUTH_CLIENT_ID}`
|
|
20
|
-
if (reqScopes) {
|
|
21
|
-
authUrl += `&scope=${reqScopes}`
|
|
22
|
-
}
|
|
23
|
-
if (state) {
|
|
24
|
-
authUrl += `&state=${state}`
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return authUrl
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default getGitHubSigninUrl
|
package/ui/oauth/index.js
DELETED
package/ui/oauth/oauth.scss
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
@import "helpers";
|
|
2
|
-
|
|
3
|
-
.sign-in-github-btn {
|
|
4
|
-
display: inline-flex;
|
|
5
|
-
align-items: center;
|
|
6
|
-
background-color: #24292E;
|
|
7
|
-
font-size: 1.25rem;
|
|
8
|
-
color: $gray-200;
|
|
9
|
-
text-decoration: none;
|
|
10
|
-
|
|
11
|
-
border-radius: $border-radius;
|
|
12
|
-
|
|
13
|
-
&:hover {
|
|
14
|
-
color: $white;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
export default class AutoScroller {
|
|
3
|
-
constructor(container, onScrollCallback) {
|
|
4
|
-
this.container = container
|
|
5
|
-
this.onScrollCallback = onScrollCallback
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
clear() {
|
|
9
|
-
if (this.interval == null) {
|
|
10
|
-
return
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
clearInterval(this.interval)
|
|
14
|
-
this.interval = null
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
update({translate, minTranslate, maxTranslate, width, height}) {
|
|
18
|
-
const direction = {
|
|
19
|
-
x: 0,
|
|
20
|
-
y: 0,
|
|
21
|
-
}
|
|
22
|
-
const speed = {
|
|
23
|
-
x: 1,
|
|
24
|
-
y: 1,
|
|
25
|
-
}
|
|
26
|
-
const acceleration = {
|
|
27
|
-
x: 10,
|
|
28
|
-
y: 10,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const {scrollTop, scrollLeft, scrollHeight, scrollWidth, clientHeight, clientWidth} =
|
|
32
|
-
this.container
|
|
33
|
-
|
|
34
|
-
const isTop = scrollTop === 0
|
|
35
|
-
const isBottom = scrollHeight - scrollTop - clientHeight === 0
|
|
36
|
-
const isLeft = scrollLeft === 0
|
|
37
|
-
const isRight = scrollWidth - scrollLeft - clientWidth === 0
|
|
38
|
-
|
|
39
|
-
if (translate.y >= maxTranslate.y - height / 2 && !isBottom) {
|
|
40
|
-
// Scroll Down
|
|
41
|
-
direction.y = 1
|
|
42
|
-
speed.y = acceleration.y * Math.abs((maxTranslate.y - height / 2 - translate.y) / height)
|
|
43
|
-
} else if (translate.x >= maxTranslate.x - width / 2 && !isRight) {
|
|
44
|
-
// Scroll Right
|
|
45
|
-
direction.x = 1
|
|
46
|
-
speed.x = acceleration.x * Math.abs((maxTranslate.x - width / 2 - translate.x) / width)
|
|
47
|
-
} else if (translate.y <= minTranslate.y + height / 2 && !isTop) {
|
|
48
|
-
// Scroll Up
|
|
49
|
-
direction.y = -1
|
|
50
|
-
speed.y = acceleration.y * Math.abs((translate.y - height / 2 - minTranslate.y) / height)
|
|
51
|
-
} else if (translate.x <= minTranslate.x + width / 2 && !isLeft) {
|
|
52
|
-
// Scroll Left
|
|
53
|
-
direction.x = -1
|
|
54
|
-
speed.x = acceleration.x * Math.abs((translate.x - width / 2 - minTranslate.x) / width)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (this.interval) {
|
|
58
|
-
this.clear()
|
|
59
|
-
this.isAutoScrolling = false
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (direction.x !== 0 || direction.y !== 0) {
|
|
63
|
-
this.interval = setInterval(() => {
|
|
64
|
-
this.isAutoScrolling = true
|
|
65
|
-
const offset = {
|
|
66
|
-
left: speed.x * direction.x,
|
|
67
|
-
top: speed.y * direction.y,
|
|
68
|
-
}
|
|
69
|
-
this.container.scrollTop += offset.top
|
|
70
|
-
this.container.scrollLeft += offset.left
|
|
71
|
-
|
|
72
|
-
this.onScrollCallback(offset)
|
|
73
|
-
}, 5)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
import SortableHandle from "./SortableHandle"
|
|
3
|
-
|
|
4
|
-
import "./drag-handle.scss"
|
|
5
|
-
|
|
6
|
-
const DragHandle = SortableHandle(({ref, variant = "bars", className = ""}) => {
|
|
7
|
-
let icon
|
|
8
|
-
if (variant === "bars") {
|
|
9
|
-
icon = (
|
|
10
|
-
<svg width={18} height={18} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50">
|
|
11
|
-
<path
|
|
12
|
-
fill={"currentColor"}
|
|
13
|
-
d="M 25 0 C 24.746094 0 24.476563 0.0859375 24.28125 0.28125 L 17.28125 7.28125 C 16.996094 7.566406 16.90625 8 17.0625 8.375 C 17.21875 8.746094 17.597656 9 18 9 L 32.03125 9 C 32.582031 9 33.03125 8.550781 33.03125 8 C 33.03125 7.664063 32.847656 7.367188 32.59375 7.1875 L 25.71875 0.28125 C 25.523438 0.0859375 25.253906 0 25 0 Z M 2 13 L 2 17 L 48 17 L 48 13 Z M 2 23 L 2 27 L 48 27 L 48 23 Z M 2 33 L 2 37 L 48 37 L 48 33 Z M 18 41 C 17.597656 41 17.21875 41.25 17.0625 41.625 C 16.90625 42 16.996094 42.433594 17.28125 42.71875 L 24.28125 49.71875 C 24.476563 49.914063 24.742188 50 25 50 C 25.257813 50 25.523438 49.914063 25.71875 49.71875 L 32.71875 42.71875 C 33.003906 42.433594 33.09375 42 32.9375 41.625 C 32.785156 41.25 32.402344 41 32 41 Z"
|
|
14
|
-
/>
|
|
15
|
-
</svg>
|
|
16
|
-
)
|
|
17
|
-
} else if (variant === "dots") {
|
|
18
|
-
icon = (
|
|
19
|
-
<svg width={18} height={18} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30">
|
|
20
|
-
<path
|
|
21
|
-
fill={"currentColor"}
|
|
22
|
-
d="M 9 2 A 3 3 0 0 0 6 5 A 3 3 0 0 0 9 8 A 3 3 0 0 0 12 5 A 3 3 0 0 0 9 2 z M 21 2 A 3 3 0 0 0 18 5 A 3 3 0 0 0 21 8 A 3 3 0 0 0 24 5 A 3 3 0 0 0 21 2 z M 9 12 A 3 3 0 0 0 6 15 A 3 3 0 0 0 9 18 A 3 3 0 0 0 12 15 A 3 3 0 0 0 9 12 z M 21 12 A 3 3 0 0 0 18 15 A 3 3 0 0 0 21 18 A 3 3 0 0 0 24 15 A 3 3 0 0 0 21 12 z M 9 22 A 3 3 0 0 0 6 25 A 3 3 0 0 0 9 28 A 3 3 0 0 0 12 25 A 3 3 0 0 0 9 22 z M 21 22 A 3 3 0 0 0 18 25 A 3 3 0 0 0 21 28 A 3 3 0 0 0 24 25 A 3 3 0 0 0 21 22 z"
|
|
23
|
-
/>
|
|
24
|
-
</svg>
|
|
25
|
-
)
|
|
26
|
-
} else throw new Error("DragHandle unknown variant")
|
|
27
|
-
|
|
28
|
-
return <div ref={ref} className={cx("sortable-drag-handle", className)}>{icon}</div>
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
export default DragHandle
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
export default class Manager {
|
|
3
|
-
refs = {}
|
|
4
|
-
|
|
5
|
-
add(collection, ref) {
|
|
6
|
-
if (!this.refs[collection]) {
|
|
7
|
-
this.refs[collection] = []
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
this.refs[collection].push(ref)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
remove(collection, ref) {
|
|
14
|
-
const index = this.getIndex(collection, ref)
|
|
15
|
-
|
|
16
|
-
if (index !== -1) {
|
|
17
|
-
this.refs[collection].splice(index, 1)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
isActive() {
|
|
22
|
-
return this.active
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getActive() {
|
|
26
|
-
return this.refs[this.active.collection].find(
|
|
27
|
-
// eslint-disable-next-line eqeqeq
|
|
28
|
-
({node}) => node.sortableInfo.index == this.active.index,
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getIndex(collection, ref) {
|
|
33
|
-
return this.refs[collection].indexOf(ref)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
getOrderedRefs(collection = this.active.collection) {
|
|
37
|
-
return this.refs[collection].sort(sortByIndex)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function sortByIndex(
|
|
42
|
-
{
|
|
43
|
-
node: {
|
|
44
|
-
sortableInfo: {index: index1},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
node: {
|
|
49
|
-
sortableInfo: {index: index2},
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
) {
|
|
53
|
-
return index1 - index2
|
|
54
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
forked from https://github.com/clauderic/react-sortable-hoc
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
import {NodeType, closest} from "../utils"
|
|
3
|
-
|
|
4
|
-
export default function defaultShouldCancelStart(event) {
|
|
5
|
-
// Cancel sorting if the event target is an `input`, `textarea`, `select` or `option`
|
|
6
|
-
const interactiveElements = [
|
|
7
|
-
NodeType.Input,
|
|
8
|
-
NodeType.Textarea,
|
|
9
|
-
NodeType.Select,
|
|
10
|
-
NodeType.Option,
|
|
11
|
-
NodeType.Button,
|
|
12
|
-
]
|
|
13
|
-
|
|
14
|
-
if (interactiveElements.indexOf(event.target.tagName) !== -1) {
|
|
15
|
-
// Return true to cancel sorting
|
|
16
|
-
return true
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (closest(event.target, (el) => el.contentEditable === "true")) {
|
|
20
|
-
return true
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return false
|
|
24
|
-
}
|