Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update neetocommons/pure imports to neeto-cist #922

Merged
merged 8 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"neetofilters": ["node_modules/@bigbinary/neeto-filters-frontend"],
"neetomolecules": ["node_modules/@bigbinary/neeto-molecules"],
"neetomolecules/*": ["node_modules/@bigbinary/neeto-molecules/*"],
"neetocist": ["node_modules/@bigbinary/neeto-cist"],
"neetocist/*": ["node_modules/@bigbinary/neeto-cist/*"],
// You can add custom project specific paths below this comment
"common": ["src/common"],
"common/*": ["src/common/*"]
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"@bigbinary/babel-preset-neeto": "^1.0.4",
"@bigbinary/eslint-plugin-neeto": "^1.0.54",
"@bigbinary/neeto-audit-frontend": "2.0.1",
"@bigbinary/neeto-commons-frontend": "^2.0.128",
"@bigbinary/neeto-cist": "^1.0.2",
AkhilXavier95 marked this conversation as resolved.
Show resolved Hide resolved
"@bigbinary/neeto-commons-frontend": "^2.1.29",
"@bigbinary/neeto-icons": "1.11.0",
"@bigbinary/neeto-molecules": "^1.0.94",
"@bigbinary/neetoui": "4.4.0",
Expand Down Expand Up @@ -153,6 +154,7 @@
},
"peerDependencies": {
"@bigbinary/babel-preset-neeto": "latest",
"@bigbinary/neeto-cist": "latest",
"@bigbinary/neeto-commons-frontend": "latest",
"@bigbinary/neeto-icons": "latest",
"@bigbinary/neeto-molecules": "latest",
Expand Down
4 changes: 1 addition & 3 deletions resolve.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const path = require("path");

module.exports = {
alias: {
common: path.resolve(__dirname, "./src/common"),
},
alias: { common: path.resolve(__dirname, "./src/common") },
};
2 changes: 1 addition & 1 deletion src/components/Attachments/Attachment.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from "react";

import { removeBy } from "neetocommons/pure";
import { removeBy } from "neetocist";
import { withEventTargetValue } from "neetocommons/utils";
import { MenuVertical, Close } from "neetoicons";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Attachments/Preview.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useRef } from "react";

import { findIndexBy } from "neetocommons/pure";
import { findIndexBy } from "neetocist";
import { Download, Left, Right } from "neetoicons";
import { Modal, Typography, Button } from "neetoui";
import { isEmpty } from "ramda";
Expand Down
29 changes: 12 additions & 17 deletions src/components/Attachments/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useRef, useEffect, useState, useImperativeHandle } from "react";

import DropTarget from "@uppy/drop-target";
import classnames from "classnames";
import { removeById, noop } from "neetocommons/pure";
import { removeById, noop } from "neetocist";
import { Button, Toastr } from "neetoui";
import { concat, isEmpty, isNil } from "ramda";
import { useTranslation } from "react-i18next";
Expand Down Expand Up @@ -133,10 +133,7 @@ const Attachments = (
useEffect(() => {
uppy.on("upload-progress", handleUploadProgress);
if (dragDropRef?.current) {
uppy.use(DropTarget, {
target: dragDropRef.current,
onDrop,
});
uppy.use(DropTarget, { target: dragDropRef.current, onDrop });
}

return () => {
Expand All @@ -153,21 +150,21 @@ const Attachments = (
<div className="ne-attachments__items">
{attachments.map(attachment => (
<Attachment
attachment={attachment}
attachments={attachments}
disabled={disabled}
{...{
attachment,
attachments,
disabled,
onChange,
setSelectedAttachment,
showToastr,
}}
key={attachment.signedId}
setSelectedAttachment={setSelectedAttachment}
showToastr={showToastr}
onChange={onChange}
/>
))}
{pendingAttachments.map(attachment => (
<AttachmentProgress
attachment={attachment}
{...{ attachment, removeUploadingFile, uppy }}
key={attachment.id}
removeUploadingFile={removeUploadingFile}
uppy={uppy}
/>
))}
</div>
Expand Down Expand Up @@ -197,9 +194,7 @@ const Attachments = (
}}
/>
<Preview
attachments={attachments}
selectedAttachment={selectedAttachment}
setSelectedAttachment={setSelectedAttachment}
{...{ attachments, selectedAttachment, setSelectedAttachment }}
onClose={() => setSelectedAttachment({})}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";

import classnames from "classnames";
import { init, SearchIndex } from "emoji-mart";
import { isNotEmpty } from "neetocommons/pure";
import { isNotEmpty } from "neetocist";
import { Spinner } from "neetoui";
import { isEmpty } from "ramda";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { noop } from "neetocommons/pure";
import { noop } from "neetocist";
import {
Paragraph,
TextH1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { noop } from "neetocommons/pure";
import { noop } from "neetocist";

function updateColumns(node, colgroup, table, cellMinWidth) {
let totalWidth = 0;
Expand Down
14 changes: 3 additions & 11 deletions src/components/Editor/FormikEditor.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { forwardRef } from "react";

import { FastField } from "formik";
import { noop } from "neetocommons/pure";
import { noop } from "neetocist";

import Editor from ".";

Expand All @@ -16,20 +16,12 @@ const FormikEditor = (
},
ref
) => (
<FastField
mentions={mentions}
name={name}
shouldUpdate={shouldUpdate}
variables={variables}
>
<FastField {...{ mentions, name, shouldUpdate, variables }}>
{({ field, form, meta }) => (
<Editor
error={meta.touched ? meta.error : ""}
initialValue={field.value}
mentions={mentions}
name={name}
ref={ref}
variables={variables}
{...{ mentions, name, ref, variables }}
onBlur={() => form.setFieldTouched(name, true)}
onChange={value => {
form.setFieldValue(name, value);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Editor/MediaUploader/Progress.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect } from "react";

import { removeById } from "neetocommons/pure";
import { removeById } from "neetocist";
import { Close } from "neetoicons";
import { Button, Typography } from "neetoui";
import { useTranslation } from "react-i18next";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Editor/Menu/Fixed/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useMemo, useRef, useState } from "react";

import classNames from "classnames";
import { isNotEmpty } from "neetocommons/pure";
import { isNotEmpty } from "neetocist";
import { Left, Right } from "neetoicons";
import DynamicVariables from "neetomolecules/DynamicVariables";
import { Button } from "neetoui";
Expand Down
6 changes: 2 additions & 4 deletions src/components/Editor/Menu/Headless/Option/UI/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

import classnames from "classnames";
import { noop } from "neetocommons/pure";
import { noop } from "neetocist";
import { Tooltip } from "neetoui";

const Button = ({
Expand All @@ -22,10 +22,8 @@ const Button = ({
>
<button
className={classnames("ne-headless-btn", { [className]: className })}
disabled={disabled}
type="button"
onClick={onClick}
{...otherProps}
{...{ disabled, onClick, ...otherProps }}
>
{icon && <Icon aria-hidden="true" key="2" size={18} />}
</button>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Editor/Menu/Headless/Option/UI/Dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from "react";

import Tippy from "@tippyjs/react";
import classnames from "classnames";
import { noop } from "neetocommons/pure";
import { noop } from "neetocist";

import Button from "./Button";

Expand Down Expand Up @@ -63,13 +63,13 @@ const Dropdown = ({
mounted && <div className="ne-headless-dropdown__popup">{children}</div>
}
onClickOutside={onClose}
onClose={onClose}
{...{ onClose }}
onHidden={() => setMounted(false)}
onMount={() => setMounted(true)}
{...otherProps}
>
<span>
<Button icon={icon} onClick={onClick} {...buttonProps} />
<Button {...{ icon, onClick, ...buttonProps }} />
</span>
</Tippy>
);
Expand Down
3 changes: 2 additions & 1 deletion src/components/Editor/Menu/Headless/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import i18n from "i18next";
import { noop } from "neetocommons/pure";
import { noop } from "neetocist";
import {
TextBold,
TextItalic,
Expand All @@ -24,6 +24,7 @@ import { assoc } from "ramda";

const { t } = i18n;

// eslint-disable-next-line @bigbinary/neeto/use-camel-case-or-pascal-case-for-function-names
export const MENU_OPTIONS = ({
editor,
tooltips,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Editor/Menu/Headless/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import i18n from "i18next";
import { findBy, noop } from "neetocommons/pure";
import { findBy, noop } from "neetocist";
import {
TextBold,
TextItalic,
Expand Down
16 changes: 9 additions & 7 deletions src/components/Editor/Menu/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from "react";

import { noop } from "neetocommons/pure";
import { noop } from "neetocist";
import { assoc, isEmpty } from "ramda";

import BubbleMenu from "./Bubble";
Expand Down Expand Up @@ -60,13 +60,15 @@ const Menu = props => {

return (
<MenuComponent
{...props}
handleUploadAttachments={handleUploadAttachments}
isEmojiPickerActive={isEmojiPickerActive}
mediaUploader={mediaUploader}
{...{
...props,
handleUploadAttachments,
isEmojiPickerActive,
mediaUploader,
setIsEmojiPickerActive,
setMediaUploader,
}}
options={menuOptions}
setIsEmojiPickerActive={setIsEmojiPickerActive}
setMediaUploader={setMediaUploader}
unsplashApiKey={editorSecrets.unsplash}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Editor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useImperativeHandle, useState, useRef } from "react";

import { useEditor, EditorContent } from "@tiptap/react";
import classnames from "classnames";
import { noop, slugify } from "neetocommons/pure";
import { noop, slugify } from "neetocist";
import { useFuncDebounce } from "neetocommons/react-utils";
import { Label } from "neetoui";
import { EditorView } from "prosemirror-view";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Editor/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isNotEmpty } from "neetocommons/pure";
import { isNotEmpty } from "neetocist";
import { Slice, Fragment, Node } from "prosemirror-model";
import { Selection } from "prosemirror-state";

Expand Down
2 changes: 1 addition & 1 deletion src/components/EditorContent/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";

import hljs from "highlight.js/lib/common";
import { lowlight } from "lowlight";
import { findBy } from "neetocommons/pure";
import { findBy } from "neetocist";
import { isEmpty } from "ramda";
import { renderToString } from "react-dom/server";

Expand Down
7 changes: 2 additions & 5 deletions src/hooks/useUppyUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState } from "react";

import Uppy from "@uppy/core";
import { useUppy } from "@uppy/react";
import { noop } from "neetocommons/pure";
import { noop } from "neetocist";
import { Toastr } from "neetoui";
import { useTranslation } from "react-i18next";

Expand Down Expand Up @@ -32,10 +32,7 @@ const useUppyUploader = ({ uppyConfig, onSuccess = noop }) => {
};

const uppy = useUppy(() =>
new Uppy({
...uppyConfig,
onBeforeFileAdded,
})
new Uppy({ ...uppyConfig, onBeforeFileAdded })
.use(ActiveStorageUpload, {
directUploadUrl: DIRECT_UPLOAD_ENDPOINT,
...UPPY_UPLOAD_CONFIG,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/DirectUpload/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { noop } from "neetocommons/pure";
import { noop } from "neetocist";

import directUploadsApi from "apis/direct_uploads";

Expand Down
2 changes: 1 addition & 1 deletion stories/Walkthroughs/Attachments/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { noop } from "neetocommons/pure";
import { noop } from "neetocist";

export const ATTACHMENTS_TABLE_COLUMNS = ["Prop", "Description"];

Expand Down
12 changes: 11 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1776,16 +1776,26 @@
ramda "0.29.0"
simple-git "3.19.1"

"@bigbinary/neeto-cist@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@bigbinary/neeto-cist/-/neeto-cist-1.0.2.tgz#555b53938a18d705764d2d31460317bd9c1a16ae"
integrity sha512-DF8gV10co1APpC4086uEHBwR9rtLqxCACEYRwgET7vdqDjp6WtuqpR0XEjgC621D22XDrRW4ADTZgxHWVNUvbA==

"@bigbinary/[email protected]":
version "2.0.101"
resolved "https://registry.yarnpkg.com/@bigbinary/neeto-commons-frontend/-/neeto-commons-frontend-2.0.101.tgz#5ff5a0c8b894d05a7925ffa4875199822360aae1"
integrity sha512-vfoiZp25hKGFw+Ex8yPsFv7lOxDqJ8njfAdDmSGdIpOJH+tqdSRudZLizMPca288swoaBB64PzmqH8jmFNFPMg==

"@bigbinary/neeto-commons-frontend@^2.0.128", "@bigbinary/neeto-commons-frontend@^2.0.63":
"@bigbinary/neeto-commons-frontend@^2.0.63":
version "2.0.128"
resolved "https://registry.yarnpkg.com/@bigbinary/neeto-commons-frontend/-/neeto-commons-frontend-2.0.128.tgz#10e80349e8a276eb44d00af6476ff0b48b860601"
integrity sha512-+Ktm07BxHEsMWhnAQUMcxbN25T7RwbuB2C4jkZYgRQ8OnTbVcDfUdwJ+rQVGDklekqShYIzNBTgpNYbDXcJf3A==

"@bigbinary/neeto-commons-frontend@^2.1.29":
version "2.1.29"
resolved "https://registry.yarnpkg.com/@bigbinary/neeto-commons-frontend/-/neeto-commons-frontend-2.1.29.tgz#4ab5408381818ccfa670aaa2a6bb8cfa5041c2c3"
integrity sha512-AAgDrymCSPCnH7Swh/KYsRXpjFBmiOsytay1Rw2zmykhjhov6lVCLtri0Mqm8aXoN1ZJD1kMX+kyULMzAfSnBw==

"@bigbinary/[email protected]":
version "1.11.0"
resolved "https://registry.yarnpkg.com/@bigbinary/neeto-icons/-/neeto-icons-1.11.0.tgz#d2c2b9ef1d3c82784ffba15fdf02af47aa37e3a7"
Expand Down
Loading