@trycourier/react-designer 0.5.1 → 0.7.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/README.md +75 -3
- package/dist/cjs/index.js +66 -58
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/styles.css +579 -249
- package/dist/components/BrandEditor/Editor/BrandFooter/BrandFooter.d.ts +3 -1
- package/dist/components/Providers/TemplateProvider.d.ts +2 -0
- package/dist/components/TemplateEditor/Channels/Email/EmailEditor.d.ts +3 -1
- package/dist/components/TemplateEditor/Channels/Inbox/Inbox.d.ts +3 -0
- package/dist/components/TemplateEditor/Channels/Inbox/InboxEditor.d.ts +3 -1
- package/dist/components/TemplateEditor/Channels/MSTeams/MSTeams.d.ts +6 -1
- package/dist/components/TemplateEditor/Channels/MSTeams/MSTeamsEditor.d.ts +3 -1
- package/dist/components/TemplateEditor/Channels/MSTeams/SideBar/MSTeamsSideBarItemDetails.d.ts +8 -0
- package/dist/components/TemplateEditor/Channels/MSTeams/SideBar/index.d.ts +1 -0
- package/dist/components/TemplateEditor/Channels/MSTeams/index.d.ts +1 -1
- package/dist/components/TemplateEditor/Channels/Push/PushEditor.d.ts +3 -1
- package/dist/components/TemplateEditor/Channels/SMS/SMSEditor.d.ts +3 -1
- package/dist/components/TemplateEditor/Channels/Slack/Slack.d.ts +6 -1
- package/dist/components/TemplateEditor/Channels/Slack/SlackEditor.d.ts +3 -1
- package/dist/components/TemplateEditor/Layout/Layout.d.ts +1 -0
- package/dist/components/TemplateEditor/TemplateEditor.d.ts +2 -0
- package/dist/components/TemplateEditor/VariableViewModeSync.d.ts +27 -0
- package/dist/components/TemplateEditor/index.d.ts +2 -1
- package/dist/components/TemplateEditor/store.d.ts +19 -1
- package/dist/components/extensions/Blockquote/Blockquote.d.ts +4 -0
- package/dist/components/extensions/Button/Button.d.ts +0 -3
- package/dist/components/extensions/Button/Button.types.d.ts +8 -4
- package/dist/components/extensions/Button/ButtonComponent.d.ts +2 -3
- package/dist/components/extensions/Button/buttonUtils.d.ts +13 -0
- package/dist/components/extensions/HardBreak/HardBreak.d.ts +12 -0
- package/dist/components/extensions/HardBreak/index.d.ts +1 -0
- package/dist/components/extensions/ImageBlock/components/ImageBlockView.d.ts +1 -3
- package/dist/components/extensions/List/List.d.ts +0 -1
- package/dist/components/extensions/List/List.types.d.ts +0 -10
- package/dist/components/extensions/List/ListForm.d.ts +6 -1
- package/dist/components/extensions/MessagingChannelPaste/MessagingChannelPaste.d.ts +11 -0
- package/dist/components/extensions/MessagingChannelPaste/index.d.ts +2 -0
- package/dist/components/extensions/Variable/Variable.d.ts +5 -0
- package/dist/components/extensions/Variable/index.d.ts +2 -0
- package/dist/components/extensions/Variable/variable-storage.types.d.ts +26 -0
- package/dist/components/extensions/Variable/variable-storage.utils.d.ts +72 -0
- package/dist/components/extensions/extension-kit.d.ts +17 -0
- package/dist/components/extensions/index.d.ts +1 -1
- package/dist/components/ui/TextMenu/components/ContentTypePicker.d.ts +1 -1
- package/dist/components/ui/TextMenu/hooks/useTextmenuCommands.d.ts +0 -1
- package/dist/components/ui/TextMenu/hooks/useTextmenuStates.d.ts +1 -0
- package/dist/components/ui/VariableEditor/VariableChipBase.d.ts +8 -0
- package/dist/components/ui/VariableEditor/VariableInput.d.ts +18 -0
- package/dist/components/ui-kit/Button/Button.d.ts +1 -1
- package/dist/components/ui-kit/Toggle/Toggle.d.ts +2 -2
- package/dist/components/ui-kit/ToggleGroup/ToggleGroup.d.ts +2 -2
- package/dist/components/utils/shadowDomDndFix.d.ts +47 -0
- package/dist/esm/index.js +65 -57
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/styles.css +579 -249
- package/dist/hooks/useAutoSave.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/lib/constants/block-defaults.d.ts +43 -0
- package/dist/lib/constants/email-editor-tiptap-styles.d.ts +62 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/testHelpers.d.ts +21 -1
- package/dist/lib/utils/convertElementalToTiptap/convertElementalToTiptap.d.ts +6 -1
- package/dist/lib/utils/getTitle/index.d.ts +1 -1
- package/dist/lib/utils/getTitle/preserveStorageFormat.d.ts +7 -0
- package/dist/styles.css +579 -249
- package/dist/types/elemental.types.d.ts +3 -6
- package/package.json +6 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Color } from "@tiptap/extension-color";
|
|
2
2
|
export { Dropcursor } from "@tiptap/extension-dropcursor";
|
|
3
|
-
export { HardBreak } from "
|
|
3
|
+
export { HardBreak } from "./HardBreak";
|
|
4
4
|
export { History } from "@tiptap/extension-history";
|
|
5
5
|
export { Placeholder } from "@tiptap/extension-placeholder";
|
|
6
6
|
export { TextAlign } from "@tiptap/extension-text-align";
|
|
@@ -19,4 +19,4 @@ export interface ContentTypePickerProps {
|
|
|
19
19
|
options: ContentPickerOptions;
|
|
20
20
|
containerRef?: RefObject<HTMLDivElement>;
|
|
21
21
|
}
|
|
22
|
-
export declare const ContentTypePicker: ({ options, containerRef }: ContentTypePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const ContentTypePicker: ({ options, containerRef }: ContentTypePickerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -33,5 +33,13 @@ export interface VariableChipBaseProps {
|
|
|
33
33
|
getColors?: (isInvalid: boolean, hasValue: boolean) => VariableColors;
|
|
34
34
|
/** Whether the chip is read-only (prevents editing) */
|
|
35
35
|
readOnly?: boolean;
|
|
36
|
+
/** Formatting styles derived from TipTap marks (bold, italic, underline, strikethrough) */
|
|
37
|
+
formattingStyle?: React.CSSProperties;
|
|
38
|
+
/** Whether the chip is within the current text selection */
|
|
39
|
+
isSelected?: boolean;
|
|
40
|
+
/** Called when the chip is clicked for selection (not editing) */
|
|
41
|
+
onSelect?: () => void;
|
|
42
|
+
/** Called after editing is committed (suggestion selected or blur confirmed) to restore editor focus */
|
|
43
|
+
onCommit?: () => void;
|
|
36
44
|
}
|
|
37
45
|
export declare const VariableChipBase: React.FC<VariableChipBaseProps>;
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariableEditorBaseProps } from "./shared";
|
|
3
|
+
/**
|
|
4
|
+
* Determines if a click landed in the empty space of a VariableInput and returns
|
|
5
|
+
* the correct target position to place the caret, or null if no correction is needed.
|
|
6
|
+
*
|
|
7
|
+
* This handles two cases where the browser's native click handler misplaces the caret
|
|
8
|
+
* inside a flex-layout ProseMirror editor with non-editable variable chip nodes:
|
|
9
|
+
*
|
|
10
|
+
* Case 1 (depth === 0): posAtCoords returned {inside: -1}, meaning the click didn't
|
|
11
|
+
* land inside any node. The resolved position is at the doc level.
|
|
12
|
+
*
|
|
13
|
+
* Case 2 (depth > 0, clickX past content): posAtCoords returned a paragraph-level
|
|
14
|
+
* position, but the click coordinates are past the visible content's right edge.
|
|
15
|
+
* Common when content ends with a variable chip.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveEmptySpaceClick(posDepth: number, pos: number, paragraphContentSize: number, clickX: number, endCoordsRight: number | null): {
|
|
18
|
+
targetPos: number;
|
|
19
|
+
bias: -1 | 1;
|
|
20
|
+
} | null;
|
|
3
21
|
export interface VariableInputProps extends VariableEditorBaseProps {
|
|
4
22
|
/** Whether the input is read-only */
|
|
5
23
|
readOnly?: boolean;
|
|
@@ -3,7 +3,7 @@ import type { ButtonHTMLAttributes } from "react";
|
|
|
3
3
|
export type ButtonVariant = "primary" | "secondary" | "tertiary" | "quaternary" | "outline" | "ghost" | "link";
|
|
4
4
|
export type ButtonSize = "medium" | "small" | "icon" | "iconSmall";
|
|
5
5
|
export declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "link" | "primary" | "secondary" | "tertiary" | "quaternary" | "
|
|
6
|
+
variant?: "link" | "primary" | "secondary" | "tertiary" | "quaternary" | "ghost" | "outline" | null | undefined;
|
|
7
7
|
size?: "icon" | "small" | "medium" | "iconSmall" | null | undefined;
|
|
8
8
|
active?: boolean | null | undefined;
|
|
9
9
|
disabled?: boolean | null | undefined;
|
|
@@ -2,11 +2,11 @@ import * as React from "react";
|
|
|
2
2
|
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
3
3
|
import { type VariantProps } from "class-variance-authority";
|
|
4
4
|
declare const toggleVariants: (props?: ({
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "default" | "outline" | null | undefined;
|
|
6
6
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare const Toggle: React.ForwardRefExoticComponent<Omit<TogglePrimitive.ToggleProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "default" | "outline" | null | undefined;
|
|
10
10
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
|
|
12
12
|
export { Toggle, toggleVariants };
|
|
@@ -2,11 +2,11 @@ import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
declare const ToggleGroup: React.ForwardRefExoticComponent<((Omit<ToggleGroupPrimitive.ToggleGroupSingleProps & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<ToggleGroupPrimitive.ToggleGroupMultipleProps & React.RefAttributes<HTMLDivElement>, "ref">) & VariantProps<(props?: ({
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "default" | "outline" | null | undefined;
|
|
6
6
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string>) & React.RefAttributes<HTMLDivElement>>;
|
|
8
8
|
declare const ToggleGroupItem: React.ForwardRefExoticComponent<Omit<ToggleGroupPrimitive.ToggleGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "default" | "outline" | null | undefined;
|
|
10
10
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
|
|
12
12
|
export { ToggleGroup, ToggleGroupItem };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shadow DOM Drag-and-Drop Fix for pragmatic-drag-and-drop
|
|
3
|
+
*
|
|
4
|
+
* This utility fixes the known incompatibility between pragmatic-drag-and-drop
|
|
5
|
+
* and Shadow DOM. The library uses `event.target` to look up draggable elements
|
|
6
|
+
* in a registry, but Shadow DOM re-targets events to the shadow host when they
|
|
7
|
+
* cross the shadow boundary, breaking the registry lookup.
|
|
8
|
+
*
|
|
9
|
+
* Solution: Monkey-patch `Event.prototype.target` to return the actual element
|
|
10
|
+
* from `composedPath()[0]` for drag events originating from the shadow DOM.
|
|
11
|
+
*
|
|
12
|
+
* **Known Limitation**: The `dragHandle` option in pragmatic-drag-and-drop does
|
|
13
|
+
* not work correctly with this fix. Elements will be draggable from anywhere,
|
|
14
|
+
* not just from the designated drag handle. This is due to how pragmatic-drag-and-drop
|
|
15
|
+
* internally validates handle interactions.
|
|
16
|
+
*
|
|
17
|
+
* @see https://github.com/atlassian/pragmatic-drag-and-drop/issues/15
|
|
18
|
+
* @see https://github.com/atlassian/pragmatic-drag-and-drop/issues/116
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Applies a fix for drag-and-drop events inside a Shadow DOM.
|
|
22
|
+
*
|
|
23
|
+
* This function monkey-patches `Event.prototype.target` to return the actual
|
|
24
|
+
* element from `composedPath()[0]` for drag and pointer events that originate
|
|
25
|
+
* from within the specified shadow root.
|
|
26
|
+
*
|
|
27
|
+
* **Important**: This is a global patch that affects all drag events while active.
|
|
28
|
+
* Call the returned cleanup function when the shadow DOM is unmounted.
|
|
29
|
+
*
|
|
30
|
+
* **Known Limitation**: Drag handles (`dragHandle` option) do not work correctly
|
|
31
|
+
* with this fix. Elements will be draggable from anywhere on the element.
|
|
32
|
+
*
|
|
33
|
+
* @param shadowRoot - The shadow root to apply the fix to
|
|
34
|
+
* @returns A cleanup function to restore the original behavior
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* useEffect(() => {
|
|
39
|
+
* const shadowRoot = containerRef.current?.shadowRoot;
|
|
40
|
+
* if (shadowRoot) {
|
|
41
|
+
* const cleanup = applyShadowDomDndFix(shadowRoot);
|
|
42
|
+
* return cleanup;
|
|
43
|
+
* }
|
|
44
|
+
* }, []);
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function applyShadowDomDndFix(shadowRoot: ShadowRoot): () => void;
|