@trycourier/react-designer 0.3.0 → 0.4.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.
Files changed (37) hide show
  1. package/README.md +114 -2
  2. package/dist/cjs/index.js +55 -55
  3. package/dist/cjs/index.js.map +4 -4
  4. package/dist/cjs/styles.css +34 -0
  5. package/dist/components/BrandEditor/Editor/Editor.d.ts +16 -1
  6. package/dist/components/TemplateEditor/Channels/Email/Email.d.ts +1 -1
  7. package/dist/components/TemplateEditor/Channels/Email/EmailEditor.d.ts +2 -1
  8. package/dist/components/TemplateEditor/Channels/Email/EmailLayout.d.ts +1 -1
  9. package/dist/components/TemplateEditor/Channels/Inbox/Inbox.d.ts +1 -1
  10. package/dist/components/TemplateEditor/Channels/Inbox/InboxLayout.d.ts +1 -1
  11. package/dist/components/TemplateEditor/Channels/MSTeams/MSTeams.d.ts +1 -1
  12. package/dist/components/TemplateEditor/Channels/MSTeams/MSTeamsLayout.d.ts +1 -1
  13. package/dist/components/TemplateEditor/Channels/Push/Push.d.ts +1 -1
  14. package/dist/components/TemplateEditor/Channels/Push/PushLayout.d.ts +1 -1
  15. package/dist/components/TemplateEditor/Channels/SMS/SMS.d.ts +1 -1
  16. package/dist/components/TemplateEditor/Channels/SMS/SMSLayout.d.ts +1 -1
  17. package/dist/components/TemplateEditor/Channels/Slack/Slack.d.ts +1 -1
  18. package/dist/components/TemplateEditor/Channels/Slack/SlackLayout.d.ts +1 -1
  19. package/dist/components/TemplateEditor/Channels/useChannels.d.ts +8 -0
  20. package/dist/components/TemplateEditor/TemplateEditor.d.ts +16 -1
  21. package/dist/components/TemplateEditor/index.d.ts +1 -1
  22. package/dist/components/TemplateEditor/store.d.ts +10 -0
  23. package/dist/components/extensions/Variable/Variable.d.ts +8 -4
  24. package/dist/components/extensions/Variable/Variable.types.d.ts +3 -14
  25. package/dist/components/extensions/Variable/VariableSuggestions.d.ts +7 -0
  26. package/dist/components/extensions/Variable/index.d.ts +1 -0
  27. package/dist/components/extensions/Variable/suggestion.d.ts +2 -0
  28. package/dist/components/extensions/extension-kit.d.ts +7 -2
  29. package/dist/components/ui/VariableEditor/VariableAutocomplete.d.ts +16 -0
  30. package/dist/esm/index.js +55 -55
  31. package/dist/esm/index.js.map +4 -4
  32. package/dist/esm/styles.css +34 -0
  33. package/dist/index.d.ts +1 -0
  34. package/dist/styles.css +34 -0
  35. package/dist/types/index.d.ts +1 -0
  36. package/dist/types/validation.types.d.ts +53 -0
  37. package/package.json +1 -1
@@ -1000,6 +1000,9 @@ body {
1000
1000
  .courier-z-50 {
1001
1001
  z-index: 50;
1002
1002
  }
1003
+ .courier-z-\[9999\] {
1004
+ z-index: 9999;
1005
+ }
1003
1006
  .courier-z-\[999\] {
1004
1007
  z-index: 999;
1005
1008
  }
@@ -1276,6 +1279,9 @@ body {
1276
1279
  .courier-h-px {
1277
1280
  height: 1px;
1278
1281
  }
1282
+ .courier-max-h-60 {
1283
+ max-height: 15rem;
1284
+ }
1279
1285
  .courier-max-h-\[88px\] {
1280
1286
  max-height: 88px;
1281
1287
  }
@@ -4645,6 +4651,10 @@ body {
4645
4651
  .hover\:courier-bg-card:hover {
4646
4652
  background-color: var(--card);
4647
4653
  }
4654
+ .hover\:courier-bg-gray-100:hover {
4655
+ --tw-bg-opacity: 1;
4656
+ background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
4657
+ }
4648
4658
  .hover\:courier-bg-neutral-100:hover {
4649
4659
  --tw-bg-opacity: 1;
4650
4660
  background-color: rgb(245 245 245 / var(--tw-bg-opacity, 1));
@@ -4686,12 +4696,20 @@ body {
4686
4696
  .focus\:courier-bg-accent:focus {
4687
4697
  background-color: var(--accent);
4688
4698
  }
4699
+ .focus\:courier-bg-gray-100:focus {
4700
+ --tw-bg-opacity: 1;
4701
+ background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
4702
+ }
4689
4703
  .focus\:courier-text-accent-foreground:focus {
4690
4704
  color: var(--accent-foreground);
4691
4705
  }
4692
4706
  .focus\:courier-text-foreground:focus {
4693
4707
  color: var(--foreground);
4694
4708
  }
4709
+ .focus\:courier-outline-none:focus {
4710
+ outline: 2px solid transparent;
4711
+ outline-offset: 2px;
4712
+ }
4695
4713
  .focus-visible\:courier-outline-none:focus-visible {
4696
4714
  outline: 2px solid transparent;
4697
4715
  outline-offset: 2px;
@@ -4913,6 +4931,14 @@ body {
4913
4931
  .dark\:courier-bg-foreground:is(.courier-dark *) {
4914
4932
  background-color: var(--foreground);
4915
4933
  }
4934
+ .dark\:courier-bg-gray-700:is(.courier-dark *) {
4935
+ --tw-bg-opacity: 1;
4936
+ background-color: rgb(55 65 81 / var(--tw-bg-opacity, 1));
4937
+ }
4938
+ .dark\:courier-bg-gray-800:is(.courier-dark *) {
4939
+ --tw-bg-opacity: 1;
4940
+ background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1));
4941
+ }
4916
4942
  .dark\:courier-bg-neutral-700:is(.courier-dark *) {
4917
4943
  --tw-bg-opacity: 1;
4918
4944
  background-color: rgb(64 64 64 / var(--tw-bg-opacity, 1));
@@ -4981,6 +5007,10 @@ body {
4981
5007
  .dark\:courier-outline-neutral-300:is(.courier-dark *) {
4982
5008
  outline-color: #d4d4d4;
4983
5009
  }
5010
+ .dark\:hover\:courier-bg-gray-700:hover:is(.courier-dark *) {
5011
+ --tw-bg-opacity: 1;
5012
+ background-color: rgb(55 65 81 / var(--tw-bg-opacity, 1));
5013
+ }
4984
5014
  .dark\:hover\:courier-bg-neutral-600:hover:is(.courier-dark *) {
4985
5015
  --tw-bg-opacity: 1;
4986
5016
  background-color: rgb(82 82 82 / var(--tw-bg-opacity, 1));
@@ -5022,6 +5052,10 @@ body {
5022
5052
  --tw-text-opacity: 1;
5023
5053
  color: rgb(239 68 68 / var(--tw-text-opacity, 1));
5024
5054
  }
5055
+ .dark\:focus\:courier-bg-gray-700:focus:is(.courier-dark *) {
5056
+ --tw-bg-opacity: 1;
5057
+ background-color: rgb(55 65 81 / var(--tw-bg-opacity, 1));
5058
+ }
5025
5059
  .dark\:active\:courier-bg-neutral-700:active:is(.courier-dark *) {
5026
5060
  --tw-bg-opacity: 1;
5027
5061
  background-color: rgb(64 64 64 / var(--tw-bg-opacity, 1));
@@ -1,11 +1,26 @@
1
+ import type { VariableValidationConfig } from "@/types/validation.types";
1
2
  import type { BrandEditorFormValues } from "../BrandEditor.types";
2
3
  export interface EditorProps {
3
4
  hidePublish?: boolean;
4
5
  autoSaveDebounce?: number;
5
6
  autoSave?: boolean;
6
7
  templateEditor?: boolean;
7
- /** @deprecated The variables prop is no longer used. Users can now type any variable directly without autocomplete suggestions. */
8
+ /**
9
+ * Variables available for autocomplete suggestions.
10
+ * When provided, typing {{ will show a dropdown with matching variables.
11
+ */
8
12
  variables?: Record<string, unknown>;
13
+ /**
14
+ * When true, disables variable autocomplete and allows users to type any variable name.
15
+ * When false (default), shows autocomplete dropdown with variables from the `variables` prop.
16
+ * @default false
17
+ */
18
+ disableVariablesAutocomplete?: boolean;
19
+ /**
20
+ * Configuration for custom variable validation.
21
+ * Allows restricting which variable names are allowed and defining behavior on validation failure.
22
+ */
23
+ variableValidation?: VariableValidationConfig;
9
24
  value?: BrandEditorFormValues;
10
25
  }
11
26
  export declare const Editor: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<EditorProps & import("react").RefAttributes<HTMLDivElement>>>;
@@ -20,7 +20,7 @@ interface BrandSettingsData {
20
20
  mediumLink?: string;
21
21
  xLink?: string;
22
22
  }
23
- export interface EmailProps extends Pick<TemplateEditorProps, "hidePublish" | "brandEditor" | "channels" | "variables" | "theme" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
23
+ export interface EmailProps extends Pick<TemplateEditorProps, "hidePublish" | "brandEditor" | "channels" | "variables" | "disableVariablesAutocomplete" | "theme" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
24
24
  isLoading?: boolean;
25
25
  headerRenderer?: ({ hidePublish, channels, routing, }: {
26
26
  hidePublish?: boolean;
@@ -5,8 +5,9 @@ export interface EmailEditorProps {
5
5
  readOnly?: boolean;
6
6
  subject?: string | null;
7
7
  variables?: Record<string, unknown>;
8
+ disableVariablesAutocomplete?: boolean;
8
9
  onDestroy?: () => void;
9
10
  onUpdate?: (editor: Editor) => void;
10
11
  }
11
- declare const EmailEditor: ({ value, readOnly, onDestroy, onUpdate, subject: propSubject, }: EmailEditorProps) => import("react/jsx-runtime").JSX.Element;
12
+ declare const EmailEditor: ({ value, readOnly, onDestroy, onUpdate, subject: propSubject, variables, disableVariablesAutocomplete, }: EmailEditorProps) => import("react/jsx-runtime").JSX.Element;
12
13
  export default EmailEditor;
@@ -6,4 +6,4 @@ export declare const EmailEditorMain: import("react").ForwardRefExoticComponent<
6
6
  } & import("react").RefAttributes<HTMLDivElement>>;
7
7
  export interface EmailLayoutProps extends EmailProps {
8
8
  }
9
- export declare const EmailLayout: ({ variables, theme, isLoading, hidePublish, channels, brandEditor, routing, colorScheme, ...rest }: EmailLayoutProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const EmailLayout: ({ variables, disableVariablesAutocomplete, theme, isLoading, hidePublish, channels, brandEditor, routing, colorScheme, ...rest }: EmailLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -21,7 +21,7 @@ export interface InboxRenderProps {
21
21
  editor: Editor;
22
22
  }) => void;
23
23
  }
24
- export interface InboxProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
24
+ export interface InboxProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "disableVariablesAutocomplete" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
25
25
  readOnly?: boolean;
26
26
  headerRenderer?: ({ hidePublish, channels, routing, }: {
27
27
  hidePublish?: boolean;
@@ -1,4 +1,4 @@
1
1
  import type { InboxProps } from "./Inbox";
2
2
  export interface InboxLayoutProps extends InboxProps {
3
3
  }
4
- export declare const InboxLayout: ({ hidePublish, theme, variables, channels, routing, colorScheme, ...rest }: InboxLayoutProps) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const InboxLayout: ({ hidePublish, theme, variables, disableVariablesAutocomplete, channels, routing, colorScheme, ...rest }: InboxLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -28,7 +28,7 @@ export interface MSTeamsRenderProps {
28
28
  selectedNode: Node | null;
29
29
  msteamsEditor: Editor | null;
30
30
  }
31
- export interface MSTeamsProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
31
+ export interface MSTeamsProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "disableVariablesAutocomplete" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
32
32
  readOnly?: boolean;
33
33
  headerRenderer?: ({ hidePublish, channels, routing, }: {
34
34
  hidePublish?: boolean;
@@ -4,4 +4,4 @@ export interface MSTeamsLayoutProps extends MSTeamsProps {
4
4
  }
5
5
  export declare const MSTeamsEditorContainer: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
6
6
  export declare const MSTeamsEditorMain: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
7
- export declare const MSTeamsLayout: ({ hidePublish, theme, variables, channels, routing, colorScheme, }: MSTeamsLayoutProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const MSTeamsLayout: ({ hidePublish, theme, variables, disableVariablesAutocomplete, channels, routing, colorScheme, }: MSTeamsLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -18,7 +18,7 @@ export interface PushRenderProps {
18
18
  editor: Editor;
19
19
  }) => void;
20
20
  }
21
- export interface PushProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
21
+ export interface PushProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "disableVariablesAutocomplete" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
22
22
  readOnly?: boolean;
23
23
  headerRenderer?: ({ hidePublish, channels, routing, }: {
24
24
  hidePublish?: boolean;
@@ -1,4 +1,4 @@
1
1
  import type { PushProps } from "./Push";
2
2
  export interface PushLayoutProps extends PushProps {
3
3
  }
4
- export declare const PushLayout: ({ hidePublish, theme, variables, channels, routing, ...rest }: PushLayoutProps) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const PushLayout: ({ hidePublish, theme, variables, disableVariablesAutocomplete, channels, routing, ...rest }: PushLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -19,7 +19,7 @@ export interface SMSRenderProps {
19
19
  editor: Editor;
20
20
  }) => void;
21
21
  }
22
- export interface SMSProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
22
+ export interface SMSProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "disableVariablesAutocomplete" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
23
23
  readOnly?: boolean;
24
24
  headerRenderer?: ({ hidePublish, channels, routing, }: {
25
25
  hidePublish?: boolean;
@@ -1,4 +1,4 @@
1
1
  import type { SMSProps } from "./SMS";
2
2
  export interface SMSLayoutProps extends SMSProps {
3
3
  }
4
- export declare const SMSLayout: ({ hidePublish, theme, variables, channels, routing, colorScheme, ...rest }: SMSLayoutProps) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const SMSLayout: ({ hidePublish, theme, variables, disableVariablesAutocomplete, channels, routing, colorScheme, ...rest }: SMSLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -28,7 +28,7 @@ export interface SlackRenderProps {
28
28
  selectedNode: Node | null;
29
29
  slackEditor: Editor | null;
30
30
  }
31
- export interface SlackProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
31
+ export interface SlackProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "disableVariablesAutocomplete" | "channels" | "routing" | "value" | "colorScheme">, Omit<HTMLAttributes<HTMLDivElement>, "value" | "onChange"> {
32
32
  readOnly?: boolean;
33
33
  headerRenderer?: ({ hidePublish, channels, routing, }: {
34
34
  hidePublish?: boolean;
@@ -4,4 +4,4 @@ export interface SlackLayoutProps extends SlackProps {
4
4
  }
5
5
  export declare const SlackEditorContainer: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
6
6
  export declare const SlackEditorMain: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
7
- export declare const SlackLayout: ({ hidePublish, theme, variables, channels, routing, colorScheme, }: SlackLayoutProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const SlackLayout: ({ hidePublish, theme, variables, disableVariablesAutocomplete, channels, routing, colorScheme, }: SlackLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,13 @@
1
1
  import { type Channel, type ChannelType } from "@/store";
2
+ import type { ElementalNode } from "@/types/elemental.types";
2
3
  import type { TemplateEditorProps } from "../TemplateEditor";
4
+ export declare const getChannelDefaults: (type: ChannelType) => {
5
+ elements: ElementalNode[];
6
+ raw?: {
7
+ title?: string;
8
+ text?: string;
9
+ };
10
+ };
3
11
  export declare const useChannels: ({ channels, routing, }: {
4
12
  /** @deprecated Use routing.channels instead. Will be removed in a future version. */
5
13
  channels?: ChannelType[];
@@ -1,4 +1,5 @@
1
1
  import type { ElementalContent } from "@/types/elemental.types";
2
+ import type { VariableValidationConfig } from "@/types/validation.types";
2
3
  import type { HTMLAttributes } from "react";
3
4
  import type { ChannelType } from "../../store";
4
5
  import type { BrandEditorProps } from "../BrandEditor";
@@ -8,8 +9,22 @@ export interface TemplateEditorProps extends Omit<HTMLAttributes<HTMLDivElement>
8
9
  theme?: Theme | string;
9
10
  value?: ElementalContent | null;
10
11
  onChange?: (value: ElementalContent) => void;
11
- /** @deprecated The variables prop is no longer used. Users can now type any variable directly without autocomplete suggestions. */
12
+ /**
13
+ * Variables available for autocomplete suggestions.
14
+ * When provided, typing {{ will show a dropdown with matching variables.
15
+ */
12
16
  variables?: Record<string, unknown>;
17
+ /**
18
+ * When true, disables variable autocomplete and allows users to type any variable name.
19
+ * When false (default), shows autocomplete dropdown with variables from the `variables` prop.
20
+ * @default false
21
+ */
22
+ disableVariablesAutocomplete?: boolean;
23
+ /**
24
+ * Configuration for custom variable validation.
25
+ * Allows restricting which variable names are allowed and defining behavior on validation failure.
26
+ */
27
+ variableValidation?: VariableValidationConfig;
13
28
  hidePublish?: boolean;
14
29
  autoSave?: boolean;
15
30
  autoSaveDebounce?: number;
@@ -4,7 +4,7 @@ export { TextMenu } from "@/components/ui/TextMenu";
4
4
  export { cn, convertElementalToTiptap, convertTiptapToElemental } from "@/lib/utils";
5
5
  export { VariableInput, VariableTextarea } from "@/components/ui/VariableEditor";
6
6
  export { getFlattenedVariables } from "@/components/utils/getFlattenedVariables";
7
- export { useChannels } from "./Channels";
7
+ export { useChannels, getChannelDefaults } from "./Channels";
8
8
  export { default as EmailEditor } from "./Channels/Email/EmailEditor";
9
9
  export * from "./TemplateEditor";
10
10
  export { SideBar as EmailSideBar, SideBarItemDetails as EmailSideBarItemDetails, } from "./Channels/Email/SideBar";
@@ -1,4 +1,5 @@
1
1
  import type { ElementalContent } from "@/types/elemental.types";
2
+ import type { VariableValidationConfig } from "@/types/validation.types";
2
3
  import type { Editor } from "@tiptap/react";
3
4
  export declare const subjectAtom: import("jotai").PrimitiveAtom<string | null> & {
4
5
  init: string | null;
@@ -29,6 +30,15 @@ export declare const isSidebarExpandedAtom: import("jotai").PrimitiveAtom<boolea
29
30
  export declare const variableValuesAtom: import("jotai").PrimitiveAtom<Record<string, string>> & {
30
31
  init: Record<string, string>;
31
32
  };
33
+ export declare const availableVariablesAtom: import("jotai").PrimitiveAtom<Record<string, unknown>> & {
34
+ init: Record<string, unknown>;
35
+ };
36
+ export declare const disableVariablesAutocompleteAtom: import("jotai").PrimitiveAtom<boolean> & {
37
+ init: boolean;
38
+ };
39
+ export declare const variableValidationAtom: import("jotai").PrimitiveAtom<VariableValidationConfig | undefined> & {
40
+ init: VariableValidationConfig | undefined;
41
+ };
32
42
  export declare const isDraggingAtom: import("jotai").PrimitiveAtom<boolean> & {
33
43
  init: boolean;
34
44
  };
@@ -1,16 +1,20 @@
1
1
  import { Extension, Node } from "@tiptap/core";
2
- import type { VariableNodeOptions } from "./Variable.types";
2
+ import type { VariableNodeOptions, VariableOptions } from "./Variable.types";
3
3
  export declare const VariableNode: Node<VariableNodeOptions, any>;
4
4
  /**
5
5
  * Extension that inserts an empty variable chip when user types {{
6
+ * This is used when autocomplete is disabled (disableVariablesAutocomplete=true)
6
7
  */
7
8
  export declare const VariableInputRule: Extension<any, any>;
8
9
  /**
9
- * @deprecated Use `VariableInputRule` instead. This alias will be removed in a future major version.
10
+ * Extension that provides variable autocomplete suggestions.
11
+ * When user types {{, shows a dropdown with available variables.
12
+ * Pass `variables` option to configure available variables.
13
+ * Pass `disableSuggestions: true` to disable autocomplete (falls back to VariableInputRule behavior).
10
14
  */
11
- export declare const Variable: Extension<any, any>;
15
+ export declare const Variable: Extension<VariableOptions, any>;
12
16
  /**
13
- * @deprecated This extension has been removed. Variable conversion now happens via VariableInputRule.
17
+ * @deprecated This extension has been removed. Variable conversion now happens via VariableInputRule or Variable.
14
18
  * This is a no-op extension provided for backwards compatibility and will be removed in a future major version.
15
19
  */
16
20
  export declare const VariableTypeHandler: Extension<any, any>;
@@ -8,28 +8,21 @@ export interface VariableNodeAttributes {
8
8
  isInvalid: boolean;
9
9
  }
10
10
  /**
11
- * @deprecated This interface has been removed as the suggestion feature was removed.
12
- * Provided for backwards compatibility and will be removed in a future major version.
11
+ * Options for the Variable suggestion extension that provides autocomplete.
13
12
  */
14
13
  export interface VariableOptions {
15
14
  HTMLAttributes?: Record<string, unknown>;
16
15
  suggestion?: Partial<SuggestionOptions>;
16
+ /** Variables available for autocomplete suggestions */
17
17
  variables?: Record<string, unknown>;
18
+ /** When true, disables the autocomplete dropdown */
18
19
  disableSuggestions?: boolean;
19
20
  }
20
- /**
21
- * @deprecated This interface has been removed as the suggestion feature was removed.
22
- * Provided for backwards compatibility and will be removed in a future major version.
23
- */
24
21
  export interface VariableCommandProps {
25
22
  editor: Editor;
26
23
  range: Range;
27
24
  props: string;
28
25
  }
29
- /**
30
- * @deprecated This interface has been removed as the suggestion feature was removed.
31
- * Provided for backwards compatibility and will be removed in a future major version.
32
- */
33
26
  export interface VariableSuggestionProps {
34
27
  editor: Editor;
35
28
  range: Range;
@@ -42,10 +35,6 @@ export interface VariableSuggestionProps {
42
35
  }) => void;
43
36
  selected: number;
44
37
  }
45
- /**
46
- * @deprecated This interface has been removed as the suggestion feature was removed.
47
- * Provided for backwards compatibility and will be removed in a future major version.
48
- */
49
38
  export interface VariableSuggestionsProps extends SuggestionProps {
50
39
  items: string[];
51
40
  command: (item: string) => void;
@@ -0,0 +1,7 @@
1
+ interface VariableSuggestionsProps {
2
+ items: string[];
3
+ command: (item: string) => void;
4
+ selected: number;
5
+ }
6
+ export declare const VariableSuggestions: React.FC<VariableSuggestionsProps>;
7
+ export {};
@@ -1,3 +1,4 @@
1
1
  export * from "./Variable";
2
2
  export * from "./Variable.types";
3
3
  export * from "./VariablePaste";
4
+ export * from "./VariableSuggestions";
@@ -0,0 +1,2 @@
1
+ import type { SuggestionOptions } from "@tiptap/suggestion";
2
+ export declare const suggestion: Partial<SuggestionOptions>;
@@ -1,6 +1,11 @@
1
1
  import type { Node } from "@tiptap/pm/model";
2
- export declare const ExtensionKit: (options?: {
2
+ export interface ExtensionKitOptions {
3
3
  setSelectedNode?: (node: Node) => void;
4
4
  shouldHandleClick?: () => boolean;
5
- }) => (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Mark<import("@tiptap/extension-underline").UnderlineOptions, any>)[];
5
+ /** Variables available for autocomplete suggestions */
6
+ variables?: Record<string, unknown>;
7
+ /** When true, disables variable autocomplete and allows typing any variable */
8
+ disableVariablesAutocomplete?: boolean;
9
+ }
10
+ export declare const ExtensionKit: (options?: ExtensionKitOptions) => (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Mark<import("@tiptap/extension-underline").UnderlineOptions, any>)[];
6
11
  export default ExtensionKit;
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ export interface VariableAutocompleteProps {
3
+ /** List of variable suggestions to show */
4
+ items: string[];
5
+ /** Called when an item is selected */
6
+ onSelect: (item: string) => void;
7
+ /** Currently selected index */
8
+ selectedIndex: number;
9
+ /** Reference element to position the dropdown near */
10
+ anchorRef: React.RefObject<HTMLElement>;
11
+ }
12
+ /**
13
+ * Autocomplete dropdown for variable suggestions.
14
+ * Shows a list of available variables that can be selected.
15
+ */
16
+ export declare const VariableAutocomplete: React.FC<VariableAutocompleteProps>;