jamespot-react-components 1.0.193 → 1.0.194

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.
@@ -1,18 +1,16 @@
1
1
  import * as React from 'react';
2
- import { Editor } from '@tiptap/react';
3
2
  import { JRCWritableFormInputProps } from '../JRCFormFieldRender';
4
- import { EventHandler, EventOrValueHandler } from 'redux-form';
5
- import { FormRichTextFieldOptionsProps, FormRichTextFieldToolbarProps } from '../../JRCInputRichText/JRCInputRichText';
6
3
  import { DataCy } from '../../../../../types/dataAttributes';
7
- /**
8
- * This component is used with redux-form (studio) and with react-hook-form!!
9
- * @deprecated Use JRCInputTinyMCE instead
10
- */
11
- export declare const MenuBar: ({ editor, toolbarOptions, isFixed, }: {
12
- editor: Editor | null;
13
- toolbarOptions: FormRichTextFieldToolbarProps[] | '*';
14
- isFixed: boolean;
15
- }) => React.JSX.Element | null;
4
+ import { MentionQuery } from '../../JRCInputTinyMCERaw/JRCInputTinyMCERaw';
5
+ import { TinyMCECommonOptions } from 'jamespot-user-api';
6
+ export type FormRichTextFieldOptionsProps = {
7
+ commonOptions: TinyMCECommonOptions;
8
+ mentionsQueries: {
9
+ users: MentionQuery;
10
+ tags: MentionQuery;
11
+ contents: MentionQuery;
12
+ };
13
+ };
16
14
  export type RichTextValue = {
17
15
  html: string;
18
16
  text: string;
@@ -21,24 +19,23 @@ export type FormRichTextFieldProps = {
21
19
  name: string;
22
20
  placeholder?: string;
23
21
  value: Partial<RichTextValue> | undefined;
24
- onFocus: EventHandler<React.FocusEvent>;
25
- onBlur: EventOrValueHandler<React.FocusEvent>;
26
22
  onChange: (value: RichTextValue) => void;
27
23
  readOnly?: boolean;
28
24
  } & DataCy;
25
+ /**
26
+ * This component is used with redux-form (studio) and with react-hook-form!!
27
+ */
29
28
  export declare const FormRichTextField: React.ForwardRefExoticComponent<{
30
29
  name: string;
31
30
  placeholder?: string | undefined;
32
31
  value: Partial<RichTextValue> | undefined;
33
- onFocus: EventHandler<React.FocusEvent>;
34
- onBlur: EventOrValueHandler<React.FocusEvent>;
35
32
  onChange: (value: RichTextValue) => void;
36
33
  readOnly?: boolean | undefined;
37
34
  } & DataCy & {
38
35
  inplace?: boolean | undefined;
39
36
  isComponentVisible?: boolean | undefined;
40
37
  } & {
41
- options?: FormRichTextFieldOptionsProps | undefined;
38
+ options: FormRichTextFieldOptionsProps;
42
39
  } & React.RefAttributes<unknown>>;
43
40
  /**
44
41
  * Component used as a <input type="text"/>
@@ -46,4 +43,6 @@ export declare const FormRichTextField: React.ForwardRefExoticComponent<{
46
43
  * validation props: required
47
44
  * @returns JSX.Element
48
45
  */
49
- export declare const JRCFormRichTextField: (props: JRCWritableFormInputProps) => React.JSX.Element;
46
+ export declare const JRCFormRichTextField: (props: JRCWritableFormInputProps & {
47
+ tinyMCE: FormRichTextFieldOptionsProps;
48
+ }) => React.JSX.Element;
@@ -1,5 +1,8 @@
1
+ import { FormRichTextFieldOptionsProps } from './JRCFormRichTextField';
1
2
  import { JRCWritableFormInputProps } from '../JRCFormFieldRender';
2
3
  import { Meta, Story } from '@storybook/react';
3
4
  declare const _default: Meta<import("@storybook/react").Args>;
4
5
  export default _default;
5
- export declare const RichText: Story<JRCWritableFormInputProps>;
6
+ export declare const RichText: Story<JRCWritableFormInputProps & {
7
+ tinyMCE: FormRichTextFieldOptionsProps;
8
+ }>;
@@ -4,6 +4,7 @@ import { DataCy } from '../../../../types/dataAttributes';
4
4
  import { JRCInputFieldProps } from '../Common/JRCFormFieldRenderer.types';
5
5
  import { FieldValues } from 'react-hook-form/dist/types';
6
6
  import { PartialBy } from '../../../../types/utils';
7
+ export declare const ReadOnlyBorder: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
8
  type CheckboxOption<TFieldValues> = {
8
9
  label: string | JSX.Element;
9
10
  value: string | number | TFieldValues;
@@ -18,9 +18,12 @@ export type JRCInputTinyMCERawProps = DataCy & {
18
18
  token?: string;
19
19
  commonOptions: TinyMCECommonOptions;
20
20
  additionalExtensions?: Array<TinyMCEExtension>;
21
- value: string;
21
+ value: string | {
22
+ html: string;
23
+ text: string;
24
+ };
22
25
  onBlur?: () => void;
23
- onChange: (v: string) => void;
26
+ onChange: (html: string, text: string) => void;
24
27
  ref?: LegacyRef<Editor>;
25
28
  tinymceScriptSrc?: string;
26
29
  autoFocus?: boolean;
@@ -33,5 +36,6 @@ export type JRCInputTinyMCERawProps = DataCy & {
33
36
  };
34
37
  height?: number;
35
38
  autofocus?: boolean;
39
+ readOnly?: boolean;
36
40
  };
37
41
  export declare const JRCInputTinyMCERaw: ({ dataCy, token, value, onBlur, onChange, mentionsQueries, tinymceScriptSrc, autoFocus, inline, placeholder, additionalExtensions, ref, height, autofocus, ...props }: JRCInputTinyMCERawProps) => React.JSX.Element;
@@ -9,7 +9,7 @@ type FlexBoxProps = Omit<FastCssProps, 'display'> & {
9
9
  childFull?: boolean;
10
10
  };
11
11
  export declare const JRCFlexBox: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Omit<FastCssProps, "display"> & {
12
- direction?: "row" | "column" | "column-reverse" | "row-reverse" | undefined;
12
+ direction?: "row" | "column" | "row-reverse" | "column-reverse" | undefined;
13
13
  inline?: boolean | undefined;
14
14
  flex?: string | boolean | undefined;
15
15
  gap?: number | undefined;
@@ -51,7 +51,6 @@ export { JRCFormTextField } from './components/Form/Input/Deprecated/JRCFormText
51
51
  export { JRCFormTextarea, JRCFormTextareaField, } from './components/Form/Input/Deprecated/JRCFormTextarea/JRCFormTextarea';
52
52
  export { JRCFormUrlField } from './components/Form/Input/Deprecated/JRCFormURL/JRCFormUrl';
53
53
  export { JRCInputCheckbox, JRCInputCheckboxRaw } from './components/Form/Input/JRCInputCheckbox/JRCInputCheckbox';
54
- export { JRCInputReorderCheckbox } from './components/Form/Input/JRCInputCheckbox/JRCInputReorderCheckbox';
55
54
  export { JRCInputToggleRaw } from './components/Form/Input/JRCInputCheckbox/JRCInputToggle';
56
55
  export { JRCCheckbox } from './components/Form/Input/JRCInputCheckbox/components/JRCCheckbox';
57
56
  export { JRCInputColor } from './components/Form/Input/JRCInputColor/JRCInputColor';
@@ -62,7 +61,7 @@ export { JRCInputEmail } from './components/Form/Input/JRCInputEmail/JRCInputEma
62
61
  export { JRCInputFile } from './components/Form/Input/JRCInputFile/JRCInputFile';
63
62
  export { JRCInputFileAdvancedRaw } from './components/Form/Input/JRCInputFileAdvanced/JRCInputFileAdvancedRaw';
64
63
  export { JRCInputImage } from './components/Form/Input/JRCInputImage/JRCInputImage';
65
- export { JRCInputRichText } from './components/Form/Input/JRCInputRichText/JRCInputRichText';
64
+ export { JRCInputReorderCheckbox } from './components/Form/Input/JRCInputCheckbox/JRCInputReorderCheckbox';
66
65
  export { JRCInputSearchRaw } from './components/Form/Input/JRCInputSearchRaw/JRCInputSearchRaw';
67
66
  export { JRCInputPassword } from './components/Form/Input/JRCInputText/JRCInputPassword';
68
67
  export { JRCInputNumber, JRCInputText } from './components/Form/Input/JRCInputText/JRCInputText';
@@ -35,7 +35,7 @@ export type { JRCFormInputFileFieldProps } from './components/Form/Input/Depreca
35
35
  export type { JRCFormInputImageProps, JRCFormInputImageFieldProps, } from './components/Form/Input/Deprecated/JRCFormImage/JRCFormImage';
36
36
  export type { JRCFormRangeProps } from './components/Form/Input/Deprecated/JRCFormRange/JRCFormRange';
37
37
  export type { JRCFormReceiveACopyInputProps } from './components/Form/Input/Deprecated/JRCFormReceiveACopy/JRCFormReceiveACopy';
38
- export type { RichTextValue, FormRichTextFieldProps, } from './components/Form/Input/Deprecated/JRCFormRichText/JRCFormRichTextField';
38
+ export type { FormRichTextFieldProps } from './components/Form/Input/Deprecated/JRCFormRichText/JRCFormRichTextField';
39
39
  export type { JRCFormSelectProps } from './components/Form/Input/Deprecated/JRCFormSelect/JRCFormSelect';
40
40
  export type { JRCFormSendAlertInputProps } from './components/Form/Input/Deprecated/JRCFormSendAlert/JRCFormSendAlert';
41
41
  export type { JRCGridProps } from './components/JRCGrid/JRCGrid';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jamespot-react-components",
3
- "version": "1.0.193",
3
+ "version": "1.0.194",
4
4
  "description": "",
5
5
  "main": "./build/jamespot-react-components.js",
6
6
  "types": "./build/src/index.d.ts",
@@ -78,22 +78,10 @@
78
78
  },
79
79
  "dependencies": {
80
80
  "@tinymce/tinymce-react": "^4.3.0",
81
- "@tiptap/core": "^2.0.3",
82
- "@tiptap/extension-character-count": "^2.0.3",
83
- "@tiptap/extension-color": "^2.0.3",
84
- "@tiptap/extension-link": "^2.0.3",
85
- "@tiptap/extension-mention": "^2.0.3",
86
- "@tiptap/extension-placeholder": "^2.0.3",
87
- "@tiptap/extension-text-align": "^2.0.3",
88
- "@tiptap/extension-text-style": "^2.0.3",
89
- "@tiptap/extension-underline": "^2.0.3",
90
- "@tiptap/react": "^2.0.3",
91
- "@tiptap/starter-kit": "^2.0.3",
92
- "@tiptap/suggestion": "^2.0.3",
93
81
  "chroma-js": "^2.1.1",
94
82
  "classnames": "^2.3.1",
95
83
  "dompurify": "^3.0.5",
96
- "jamespot-user-api": "^1.0.165",
84
+ "jamespot-user-api": "^1.0.166",
97
85
  "moment": "2.29.4",
98
86
  "react": "^17.x",
99
87
  "react-beautiful-dnd": "^13.1.1",
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { SuggestionProps } from '@tiptap/suggestion';
3
- import { AudienceAutocomplete } from 'jamespot-user-api';
4
- type Props = Pick<SuggestionProps<AudienceAutocomplete>, 'items' | 'command'>;
5
- export type MentionListRef = {
6
- onKeyDown: (props: {
7
- event: KeyboardEvent;
8
- }) => boolean;
9
- };
10
- export declare const MentionList: React.ForwardRefExoticComponent<Props & React.RefAttributes<MentionListRef>>;
11
- export {};
@@ -1,4 +0,0 @@
1
- export declare const CSSItems: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
2
- export declare const CSSItem: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
3
- selected: boolean;
4
- }, never>;
@@ -1,14 +0,0 @@
1
- import { AudienceAutocomplete } from 'jamespot-user-api';
2
- declare const _default: {
3
- char: string;
4
- items: ({ query }: {
5
- query: string;
6
- }) => Promise<AudienceAutocomplete[]>;
7
- render: () => {
8
- onStart: (props: any) => void;
9
- onUpdate(props: any): void;
10
- onKeyDown(props: any): boolean;
11
- onExit(): void;
12
- };
13
- };
14
- export default _default;
@@ -1,18 +0,0 @@
1
- import { Extension } from '@tiptap/react';
2
- /**
3
- * FontSize - Custom Extension
4
- * editor.commands.setFontSize(e.target.value) :set the font-size.
5
- * Made with help of:
6
- * - https://stackoverflow.com/questions/70564092/tiptap-font-size-react
7
- * - https://github.com/ueberdosis/tiptap/blob/main/packages/extension-text-align/src/text-align.ts
8
- * - open PR about this: https://github.com/ueberdosis/tiptap/pull/1990
9
- */
10
- declare module '@tiptap/core' {
11
- interface Commands<ReturnType> {
12
- fontSize: {
13
- setFontSize: (fontSize: number) => ReturnType;
14
- unsetFontSize: () => ReturnType;
15
- };
16
- }
17
- }
18
- export declare const FontSize: Extension<any, any>;
@@ -1,26 +0,0 @@
1
- import * as React from 'react';
2
- import { JRCInputFieldProps } from '../Common/JRCFormFieldRenderer.types';
3
- import { FieldValues } from 'react-hook-form/dist/types';
4
- /**
5
- * Component used as a <input type="text"/>
6
- * @param props JRCInputFieldProps
7
- * validation props: required
8
- * @returns JSX.Element
9
- */
10
- export type FormRichTextFieldToolbarProps = 'font-size' | 'text-color' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'list-ul' | 'list-ol' | 'align-left' | 'align-center' | 'align-right' | 'align-justify' | 'link' | 'undo' | 'redo' | 'edit-html';
11
- export type FormRichTextFieldOptionsProps = {
12
- richTextFixedToolbar: boolean;
13
- richTextCustomToolbar: Array<FormRichTextFieldToolbarProps>;
14
- richTextHideCharactersCount: boolean;
15
- richTextDefaultFontSize: string;
16
- richTextFontSize?: string;
17
- richTextColor?: string;
18
- richTextLinkColor?: string;
19
- };
20
- export declare function JRCInputRichText<T extends FieldValues = FieldValues>({ dataCy, ...props }: {
21
- options?: FormRichTextFieldOptionsProps;
22
- } & {
23
- isComponentVisible?: boolean;
24
- inplace?: boolean;
25
- placeholder?: string;
26
- } & JRCInputFieldProps<T>): React.JSX.Element;
@@ -1,7 +0,0 @@
1
- import { JRCInputFieldProps } from '../Common/JRCFormFieldRenderer.types';
2
- import { Meta, Story } from '@storybook/react';
3
- declare const _default: Meta<import("@storybook/react").Args>;
4
- export default _default;
5
- export declare const InputRichText: Story<JRCInputFieldProps<{
6
- text: string;
7
- }>>;