@trycourier/react-designer 0.3.0 → 0.5.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 (70) hide show
  1. package/README.md +114 -2
  2. package/dist/cjs/index.js +61 -57
  3. package/dist/cjs/index.js.map +4 -4
  4. package/dist/cjs/styles.css +454 -145
  5. package/dist/components/BrandEditor/Editor/Editor.d.ts +16 -1
  6. package/dist/components/Providers/useTemplateActions.d.ts +2 -2
  7. package/dist/components/TemplateEditor/Channels/Email/Email.d.ts +1 -1
  8. package/dist/components/TemplateEditor/Channels/Email/EmailEditor.d.ts +2 -1
  9. package/dist/components/TemplateEditor/Channels/Email/EmailLayout.d.ts +1 -1
  10. package/dist/components/TemplateEditor/Channels/Email/SideBar/SideBarItemDetails/SideBarItemDetails.d.ts +2 -1
  11. package/dist/components/TemplateEditor/Channels/Inbox/Inbox.d.ts +1 -1
  12. package/dist/components/TemplateEditor/Channels/Inbox/InboxLayout.d.ts +1 -1
  13. package/dist/components/TemplateEditor/Channels/MSTeams/MSTeams.d.ts +1 -1
  14. package/dist/components/TemplateEditor/Channels/MSTeams/MSTeamsLayout.d.ts +1 -1
  15. package/dist/components/TemplateEditor/Channels/Push/Push.d.ts +1 -1
  16. package/dist/components/TemplateEditor/Channels/Push/PushLayout.d.ts +1 -1
  17. package/dist/components/TemplateEditor/Channels/SMS/SMS.d.ts +1 -1
  18. package/dist/components/TemplateEditor/Channels/SMS/SMSLayout.d.ts +1 -1
  19. package/dist/components/TemplateEditor/Channels/Slack/Slack.d.ts +1 -1
  20. package/dist/components/TemplateEditor/Channels/Slack/SlackLayout.d.ts +1 -1
  21. package/dist/components/TemplateEditor/Channels/useChannels.d.ts +8 -0
  22. package/dist/components/TemplateEditor/TemplateEditor.d.ts +16 -1
  23. package/dist/components/TemplateEditor/index.d.ts +2 -14
  24. package/dist/components/TemplateEditor/store.d.ts +10 -0
  25. package/dist/components/extensions/Blockquote/BlockquoteForm.d.ts +2 -1
  26. package/dist/components/extensions/Button/ButtonForm.d.ts +2 -1
  27. package/dist/components/extensions/Column/ColumnForm.d.ts +2 -1
  28. package/dist/components/extensions/CustomCode/CustomCodeForm.d.ts +2 -1
  29. package/dist/components/extensions/Divider/DividerForm.d.ts +2 -1
  30. package/dist/components/extensions/ImageBlock/components/ImageBlockForm.d.ts +2 -1
  31. package/dist/components/extensions/List/List.d.ts +15 -0
  32. package/dist/components/extensions/List/List.types.d.ts +38 -0
  33. package/dist/components/extensions/List/ListComponent.d.ts +12 -0
  34. package/dist/components/extensions/List/ListForm.d.ts +9 -0
  35. package/dist/components/extensions/List/index.d.ts +4 -0
  36. package/dist/components/extensions/ListItem/ListItem.d.ts +34 -0
  37. package/dist/components/extensions/ListItem/ListItem.types.d.ts +7 -0
  38. package/dist/components/extensions/ListItem/ListItemComponent.d.ts +7 -0
  39. package/dist/components/extensions/ListItem/index.d.ts +2 -0
  40. package/dist/components/extensions/TextBlock/TextBlockForm.d.ts +2 -1
  41. package/dist/components/extensions/Variable/Variable.d.ts +8 -4
  42. package/dist/components/extensions/Variable/Variable.types.d.ts +3 -14
  43. package/dist/components/extensions/Variable/VariableSuggestions.d.ts +7 -0
  44. package/dist/components/extensions/Variable/index.d.ts +1 -0
  45. package/dist/components/extensions/Variable/suggestion.d.ts +2 -0
  46. package/dist/components/extensions/extension-kit.d.ts +7 -2
  47. package/dist/components/extensions/index.d.ts +2 -0
  48. package/dist/components/ui/Blocks/ListBlock/ListBlock.d.ts +2 -0
  49. package/dist/components/ui/Blocks/ListBlock/index.d.ts +1 -0
  50. package/dist/components/ui/Blocks/index.d.ts +1 -0
  51. package/dist/components/ui/FormHeader/FormHeader.d.ts +3 -2
  52. package/dist/components/ui/SortableItemWrapper/SortableItemWrapper.d.ts +3 -1
  53. package/dist/components/ui/TextMenu/config.d.ts +2 -0
  54. package/dist/components/ui/TextMenu/hooks/useTextmenuCommands.d.ts +4 -0
  55. package/dist/components/ui/TextMenu/hooks/useTextmenuStates.d.ts +2 -0
  56. package/dist/components/ui/VariableEditor/VariableAutocomplete.d.ts +16 -0
  57. package/dist/components/ui/VariableEditor/VariableChipBase.d.ts +2 -0
  58. package/dist/components/ui-kit/Icon/UnorderedListIcon.d.ts +3 -0
  59. package/dist/components/ui-kit/Icon/index.d.ts +1 -1
  60. package/dist/esm/index.js +61 -57
  61. package/dist/esm/index.js.map +4 -4
  62. package/dist/esm/styles.css +454 -145
  63. package/dist/index.d.ts +14 -0
  64. package/dist/lib/utils/index.d.ts +1 -0
  65. package/dist/styles.css +454 -145
  66. package/dist/types/elemental.types.d.ts +6 -0
  67. package/dist/types/index.d.ts +1 -0
  68. package/dist/types/validation.types.d.ts +53 -0
  69. package/package.json +1 -1
  70. package/dist/components/ui-kit/Icon/BulletListIcon.d.ts +0 -3
@@ -25,6 +25,12 @@ export interface ElementalListNode extends IsElementalNode {
25
25
  /** Allows bullets to be rendered using an image */
26
26
  imgSrc?: string;
27
27
  imgHref?: string;
28
+ /** Border/marker color for list bullets or numbers */
29
+ border_color?: string;
30
+ /** Border width in pixels (e.g., "2px" or "2") */
31
+ border_size?: string;
32
+ /** Padding (e.g., "10px" or "10px 20px") */
33
+ padding?: string;
28
34
  }
29
35
  export interface ElementalListItemNode extends IsElementalNode {
30
36
  type: "list-item";
@@ -1,3 +1,4 @@
1
1
  export * from "./tiptap.types";
2
2
  export * from "./elemental.types";
3
3
  export * from "./elemental.schema";
4
+ export * from "./validation.types";
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Configuration for custom variable validation in the editor.
3
+ * Allows consumers to restrict which variable names are allowed and
4
+ * define the behavior when validation fails.
5
+ */
6
+ export interface VariableValidationConfig {
7
+ /**
8
+ * Custom validator function that runs AFTER built-in format validation passes
9
+ * (unless `overrideFormatValidation` is true).
10
+ *
11
+ * @param variableName - The variable name to validate (without curly braces)
12
+ * @returns true if the variable is allowed, false otherwise
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * // Only allow variables from a predefined list
17
+ * validate: (name) => ['user.name', 'user.email', 'order.total'].includes(name)
18
+ * ```
19
+ */
20
+ validate?: (variableName: string) => boolean;
21
+ /**
22
+ * Behavior when validation fails.
23
+ * - 'mark': Keep the chip with invalid styling (default, shows red styling)
24
+ * - 'remove': Delete the chip entirely
25
+ *
26
+ * @default 'mark'
27
+ */
28
+ onInvalid?: "mark" | "remove";
29
+ /**
30
+ * Message to show as a toast notification when validation fails.
31
+ * Can be a static string or a function that receives the variable name
32
+ * for dynamic messages.
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * // Static message
37
+ * invalidMessage: "This variable is not available"
38
+ *
39
+ * // Dynamic message
40
+ * invalidMessage: (name) => `Variable "${name}" is not in the allowed list`
41
+ * ```
42
+ */
43
+ invalidMessage?: string | ((variableName: string) => string);
44
+ /**
45
+ * If true, bypasses the built-in format validation entirely.
46
+ * Only the custom `validate` function will be used for validation.
47
+ *
48
+ * Use with caution - invalid formats may cause issues with downstream processing.
49
+ *
50
+ * @default false
51
+ */
52
+ overrideFormatValidation?: boolean;
53
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trycourier/react-designer",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "React-based rich text designer component",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -1,3 +0,0 @@
1
- import type { IconProps } from "./Icon";
2
- export declare const BulletListIcon: ({ color, active, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
3
- export default BulletListIcon;