@trycourier/react-designer 0.0.0-canary-20251209180312 → 0.0.0-canary-20251210115724

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 (26) hide show
  1. package/dist/cjs/index.js +54 -56
  2. package/dist/cjs/index.js.map +4 -4
  3. package/dist/cjs/styles.css +13 -25
  4. package/dist/components/BrandEditor/BrandEditor.d.ts +1 -1
  5. package/dist/components/BrandEditor/Editor/BrandFooter/BrandFooter.d.ts +1 -1
  6. package/dist/components/TemplateEditor/Channels/Email/EmailEditor.d.ts +1 -1
  7. package/dist/components/TemplateEditor/Channels/Email/SideBar/SideBarItemDetails/SideBarItemDetails.d.ts +1 -3
  8. package/dist/components/extensions/Button/ButtonForm.d.ts +1 -3
  9. package/dist/components/extensions/ImageBlock/components/ImageBlockForm.d.ts +1 -3
  10. package/dist/components/extensions/Variable/Variable.d.ts +5 -2
  11. package/dist/components/extensions/Variable/Variable.types.d.ts +2 -36
  12. package/dist/components/extensions/Variable/index.d.ts +0 -1
  13. package/dist/components/extensions/extension-kit.d.ts +0 -2
  14. package/dist/components/extensions/index.d.ts +1 -1
  15. package/dist/components/ui/TextInput/TextInput.d.ts +0 -3
  16. package/dist/components/ui/VariableEditor/VariableChipBase.d.ts +35 -0
  17. package/dist/components/ui/VariableEditor/shared.d.ts +2 -6
  18. package/dist/components/ui-kit/Icon/VariableIcon.d.ts +1 -1
  19. package/dist/esm/index.js +54 -56
  20. package/dist/esm/index.js.map +4 -4
  21. package/dist/esm/styles.css +13 -25
  22. package/dist/styles.css +13 -25
  23. package/package.json +1 -1
  24. package/dist/components/extensions/Variable/VariableSuggestions.d.ts +0 -7
  25. package/dist/components/extensions/Variable/VariableTypeHandler.d.ts +0 -6
  26. package/dist/components/extensions/Variable/suggestion.d.ts +0 -2
@@ -922,6 +922,9 @@ body {
922
922
  .courier-left-0 {
923
923
  left: 0px;
924
924
  }
925
+ .courier-left-1 {
926
+ left: 0.25rem;
927
+ }
925
928
  .courier-left-2 {
926
929
  left: 0.5rem;
927
930
  }
@@ -1024,6 +1027,10 @@ body {
1024
1027
  margin-left: -1rem;
1025
1028
  margin-right: -1rem;
1026
1029
  }
1030
+ .courier-mx-0\.5 {
1031
+ margin-left: 0.125rem;
1032
+ margin-right: 0.125rem;
1033
+ }
1027
1034
  .courier-mx-1 {
1028
1035
  margin-left: 0.25rem;
1029
1036
  margin-right: 0.25rem;
@@ -1269,9 +1276,6 @@ body {
1269
1276
  .courier-h-px {
1270
1277
  height: 1px;
1271
1278
  }
1272
- .courier-max-h-60 {
1273
- max-height: 15rem;
1274
- }
1275
1279
  .courier-max-h-\[88px\] {
1276
1280
  max-height: 88px;
1277
1281
  }
@@ -1395,6 +1399,9 @@ body {
1395
1399
  .courier-min-w-\[16rem\] {
1396
1400
  min-width: 16rem;
1397
1401
  }
1402
+ .courier-min-w-\[1ch\] {
1403
+ min-width: 1ch;
1404
+ }
1398
1405
  .courier-min-w-\[2rem\] {
1399
1406
  min-width: 2rem;
1400
1407
  }
@@ -2143,6 +2150,9 @@ body {
2143
2150
  .courier-text-center {
2144
2151
  text-align: center;
2145
2152
  }
2153
+ .courier-align-middle {
2154
+ vertical-align: middle;
2155
+ }
2146
2156
  .courier-font-mono {
2147
2157
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
2148
2158
  }
@@ -2241,10 +2251,6 @@ body {
2241
2251
  .courier-text-accent-foreground {
2242
2252
  color: var(--accent-foreground);
2243
2253
  }
2244
- .courier-text-amber-800 {
2245
- --tw-text-opacity: 1;
2246
- color: rgb(146 64 14 / var(--tw-text-opacity, 1));
2247
- }
2248
2254
  .courier-text-blue-700 {
2249
2255
  --tw-text-opacity: 1;
2250
2256
  color: rgb(29 78 216 / var(--tw-text-opacity, 1));
@@ -4512,10 +4518,6 @@ body {
4512
4518
  .hover\:courier-bg-card:hover {
4513
4519
  background-color: var(--card);
4514
4520
  }
4515
- .hover\:courier-bg-gray-100:hover {
4516
- --tw-bg-opacity: 1;
4517
- background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
4518
- }
4519
4521
  .hover\:courier-bg-neutral-100:hover {
4520
4522
  --tw-bg-opacity: 1;
4521
4523
  background-color: rgb(245 245 245 / var(--tw-bg-opacity, 1));
@@ -4557,20 +4559,12 @@ body {
4557
4559
  .focus\:courier-bg-accent:focus {
4558
4560
  background-color: var(--accent);
4559
4561
  }
4560
- .focus\:courier-bg-gray-100:focus {
4561
- --tw-bg-opacity: 1;
4562
- background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
4563
- }
4564
4562
  .focus\:courier-text-accent-foreground:focus {
4565
4563
  color: var(--accent-foreground);
4566
4564
  }
4567
4565
  .focus\:courier-text-foreground:focus {
4568
4566
  color: var(--foreground);
4569
4567
  }
4570
- .focus\:courier-outline-none:focus {
4571
- outline: 2px solid transparent;
4572
- outline-offset: 2px;
4573
- }
4574
4568
  .focus-visible\:courier-outline-none:focus-visible {
4575
4569
  outline: 2px solid transparent;
4576
4570
  outline-offset: 2px;
@@ -4977,9 +4971,6 @@ body {
4977
4971
  .\[\&\>svg\]\:courier-shrink-0>svg {
4978
4972
  flex-shrink: 0;
4979
4973
  }
4980
- .\[\&_\.ProseMirror\]\:courier-flex .ProseMirror {
4981
- display: flex;
4982
- }
4983
4974
  .\[\&_\.ProseMirror\]\:courier-h-\[25px\] .ProseMirror {
4984
4975
  height: 25px;
4985
4976
  }
@@ -4989,9 +4980,6 @@ body {
4989
4980
  .\[\&_\.ProseMirror\]\:courier-flex-1 .ProseMirror {
4990
4981
  flex: 1 1 0%;
4991
4982
  }
4992
- .\[\&_\.ProseMirror\]\:courier-items-end .ProseMirror {
4993
- align-items: flex-end;
4994
- }
4995
4983
  .\[\&_\.ProseMirror\]\:courier-border-none .ProseMirror {
4996
4984
  border-style: none;
4997
4985
  }
@@ -1,6 +1,6 @@
1
1
  import type { Theme } from "../ui-kit/ThemeProvider/ThemeProvider.types";
2
2
  import { type EditorProps } from "./Editor";
3
- export interface BrandEditorProps extends Omit<EditorProps, "disableVariableAutocomplete"> {
3
+ export interface BrandEditorProps extends EditorProps {
4
4
  theme?: Theme | string;
5
5
  colorScheme?: "light" | "dark";
6
6
  }
@@ -14,5 +14,5 @@ interface BrandFooterProps {
14
14
  transaction: Transaction;
15
15
  }) => void;
16
16
  }
17
- export declare const BrandFooter: import("react").MemoExoticComponent<({ variables, facebookLink, linkedinLink, instagramLink, mediumLink, xLink, readOnly, value, onUpdate, }: BrandFooterProps) => import("react/jsx-runtime").JSX.Element>;
17
+ export declare const BrandFooter: import("react").MemoExoticComponent<({ facebookLink, linkedinLink, instagramLink, mediumLink, xLink, readOnly, value, onUpdate, }: BrandFooterProps) => import("react/jsx-runtime").JSX.Element>;
18
18
  export {};
@@ -8,5 +8,5 @@ export interface EmailEditorProps {
8
8
  onDestroy?: () => void;
9
9
  onUpdate?: (editor: Editor) => void;
10
10
  }
11
- declare const EmailEditor: ({ value, readOnly, variables, onDestroy, onUpdate, subject: propSubject, }: EmailEditorProps) => import("react/jsx-runtime").JSX.Element;
11
+ declare const EmailEditor: ({ value, readOnly, onDestroy, onUpdate, subject: propSubject, }: EmailEditorProps) => import("react/jsx-runtime").JSX.Element;
12
12
  export default EmailEditor;
@@ -3,7 +3,5 @@ import type { Editor } from "@tiptap/react";
3
3
  export interface SideBarItemDetailsProps {
4
4
  element?: ProseMirrorNode;
5
5
  editor: Editor | null;
6
- /** Whether to disable variable autocomplete suggestions in sidebar inputs */
7
- disableVariableAutocomplete?: boolean;
8
6
  }
9
- export declare const SideBarItemDetails: ({ element, editor, disableVariableAutocomplete, }: SideBarItemDetailsProps) => import("react/jsx-runtime").JSX.Element | null;
7
+ export declare const SideBarItemDetails: ({ element, editor }: SideBarItemDetailsProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -3,8 +3,6 @@ import type { Editor } from "@tiptap/react";
3
3
  interface ButtonFormProps {
4
4
  element?: ProseMirrorNode;
5
5
  editor: Editor | null;
6
- /** Whether to disable variable autocomplete suggestions */
7
- disableVariableAutocomplete?: boolean;
8
6
  }
9
- export declare const ButtonForm: ({ element, editor, disableVariableAutocomplete, }: ButtonFormProps) => import("react/jsx-runtime").JSX.Element | null;
7
+ export declare const ButtonForm: ({ element, editor }: ButtonFormProps) => import("react/jsx-runtime").JSX.Element | null;
10
8
  export {};
@@ -3,7 +3,5 @@ import type { Editor } from "@tiptap/react";
3
3
  export interface ImageBlockFormProps {
4
4
  element?: ProseMirrorNode;
5
5
  editor: Editor | null;
6
- /** Whether to disable variable autocomplete suggestions */
7
- disableVariableAutocomplete?: boolean;
8
6
  }
9
- export declare const ImageBlockForm: ({ element, editor, disableVariableAutocomplete, }: ImageBlockFormProps) => import("react/jsx-runtime").JSX.Element | null;
7
+ export declare const ImageBlockForm: ({ element, editor }: ImageBlockFormProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,4 +1,7 @@
1
1
  import { Extension, Node } from "@tiptap/core";
2
- import type { VariableNodeOptions, VariableOptions } from "./Variable.types";
2
+ import type { VariableNodeOptions } from "./Variable.types";
3
3
  export declare const VariableNode: Node<VariableNodeOptions, any>;
4
- export declare const Variable: Extension<VariableOptions, any>;
4
+ /**
5
+ * Extension that inserts an empty variable chip when user types {{
6
+ */
7
+ export declare const VariableInputRule: Extension<any, any>;
@@ -1,41 +1,7 @@
1
- import type { Editor, Range } from "@tiptap/core";
2
- import type { SuggestionOptions, SuggestionProps } from "@tiptap/suggestion";
3
- interface Props {
4
- editor: Editor;
5
- range: Range;
6
- clientRect: () => DOMRect | null;
7
- items: string[];
8
- command: (props: {
9
- editor: Editor;
10
- range: Range;
11
- props: string;
12
- }) => void;
13
- }
14
- export interface VariableOptions {
15
- HTMLAttributes?: Record<string, unknown>;
16
- suggestion?: Partial<SuggestionOptions>;
17
- variables?: Record<string, unknown>;
18
- disableSuggestions?: boolean;
19
- }
20
- export interface VariableCommandProps {
21
- editor: Editor;
22
- range: Range;
23
- props: string;
24
- }
25
- export interface VariableSuggestionProps extends Props {
26
- selected: number;
27
- }
28
1
  export interface VariableNodeOptions {
29
2
  HTMLAttributes?: Record<string, unknown>;
30
3
  }
31
4
  export interface VariableNodeAttributes {
32
- id: string | null;
33
- }
34
- export interface VariableSuggestionsProps extends SuggestionProps {
35
- items: string[];
36
- command: (item: string) => void;
37
- editor: Editor;
38
- query: string;
39
- selected: number;
5
+ id: string;
6
+ isInvalid: boolean;
40
7
  }
41
- export {};
@@ -1,4 +1,3 @@
1
1
  export * from "./Variable";
2
2
  export * from "./Variable.types";
3
3
  export * from "./VariablePaste";
4
- export * from "./VariableTypeHandler";
@@ -1,8 +1,6 @@
1
1
  import type { Node } from "@tiptap/pm/model";
2
2
  export declare const ExtensionKit: (options?: {
3
- variables?: Record<string, unknown>;
4
3
  setSelectedNode?: (node: Node) => void;
5
4
  shouldHandleClick?: () => boolean;
6
- disableVariableAutocomplete?: boolean;
7
5
  }) => (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Mark<import("@tiptap/extension-underline").UnderlineOptions, any>)[];
8
6
  export default ExtensionKit;
@@ -27,4 +27,4 @@ export { Paragraph } from "./Paragraph";
27
27
  export { Selection } from "./Selection";
28
28
  export { SlashMenu } from "./SlashMenu";
29
29
  export { UniqueId } from "./UniqueId";
30
- export { Variable, VariableNode, VariablePaste, VariableTypeHandler } from "./Variable";
30
+ export { VariableNode, VariableInputRule, VariablePaste } from "./Variable";
@@ -1,11 +1,8 @@
1
1
  import * as React from "react";
2
2
  export interface TextInputProps extends Omit<React.ComponentProps<"input">, "as" | "onChange"> {
3
3
  as?: "Input" | "Textarea";
4
- variables?: string[];
5
4
  autoResize?: boolean;
6
5
  onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
7
6
  onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
8
- /** Whether to disable variable autocomplete suggestions */
9
- disableVariableAutocomplete?: boolean;
10
7
  }
11
8
  export declare const TextInput: React.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ export declare const MAX_VARIABLE_LENGTH = 50;
3
+ export declare const MAX_DISPLAY_LENGTH = 24;
4
+ export interface VariableColors {
5
+ bgColor: string;
6
+ borderColor: string;
7
+ iconColor: string;
8
+ textColor: string;
9
+ }
10
+ export interface VariableChipBaseProps {
11
+ /** The variable name/id */
12
+ variableId: string;
13
+ /** Whether the variable is currently invalid */
14
+ isInvalid: boolean;
15
+ /** Called when attributes should be updated */
16
+ onUpdateAttributes: (attrs: {
17
+ id: string;
18
+ isInvalid: boolean;
19
+ }) => void;
20
+ /** Called when the node should be deleted */
21
+ onDelete: () => void;
22
+ /** Icon component to render */
23
+ icon: React.ReactNode;
24
+ /** Optional value to display (e.g., for variables with known values) */
25
+ value?: string;
26
+ /** Whether to use single-click (true) or double-click (false) to edit */
27
+ singleClickToEdit?: boolean;
28
+ /** Additional class names for the outer span */
29
+ className?: string;
30
+ /** Override text color (e.g., for button context) */
31
+ textColorOverride?: string;
32
+ /** Custom color getter function */
33
+ getColors?: (isInvalid: boolean, hasValue: boolean) => VariableColors;
34
+ }
35
+ export declare const VariableChipBase: React.FC<VariableChipBaseProps>;
@@ -9,8 +9,8 @@ export declare const VariableChipIcon: React.FC<{
9
9
  color?: string;
10
10
  }>;
11
11
  /**
12
- * Standalone variable view component
13
- * Does not depend on external jotai stores
12
+ * Standalone variable view component with editing support
13
+ * Used in VariableInput and VariableTextarea components
14
14
  */
15
15
  export declare const SimpleVariableView: React.FC<NodeViewProps>;
16
16
  /**
@@ -34,16 +34,12 @@ export interface VariableEditorBaseProps {
34
34
  value?: string;
35
35
  /** Called when the value changes */
36
36
  onChange?: (value: string) => void;
37
- /** List of available variable names for autocomplete */
38
- variables?: string[];
39
37
  /** Placeholder text */
40
38
  placeholder?: string;
41
39
  /** Additional CSS classes */
42
40
  className?: string;
43
41
  /** Whether the input is disabled */
44
42
  disabled?: boolean;
45
- /** Whether to disable variable autocomplete suggestions */
46
- disableVariableAutocomplete?: boolean;
47
43
  /** Called when the input gains focus */
48
44
  onFocus?: () => void;
49
45
  /** Called when the input loses focus */
@@ -1,3 +1,3 @@
1
1
  import type { IconProps } from "./Icon";
2
- export declare const VariableIcon: ({ color, active, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const VariableIcon: ({ width, height, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default VariableIcon;