@trycourier/react-designer 0.6.0 → 0.8.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 (105) hide show
  1. package/README.md +7 -5
  2. package/dist/cjs/index.js +70 -58
  3. package/dist/cjs/index.js.map +4 -4
  4. package/dist/cjs/styles.css +1473 -486
  5. package/dist/components/BrandEditor/Editor/BrandFooter/BrandFooter.d.ts +3 -1
  6. package/dist/components/Providers/TemplateProvider.d.ts +9 -0
  7. package/dist/components/Providers/store.d.ts +11 -0
  8. package/dist/components/TemplateEditor/Channels/Email/Email.d.ts +12 -2
  9. package/dist/components/TemplateEditor/Channels/Email/EmailLayout.d.ts +3 -1
  10. package/dist/components/TemplateEditor/Channels/Inbox/Inbox.d.ts +3 -0
  11. package/dist/components/TemplateEditor/Channels/Inbox/InboxLayout.d.ts +1 -1
  12. package/dist/components/TemplateEditor/Channels/Inbox/SideBar/useInboxButtonSync.d.ts +27 -0
  13. package/dist/components/TemplateEditor/Channels/MSTeams/MSTeamsLayout.d.ts +1 -1
  14. package/dist/components/TemplateEditor/Channels/Push/PushLayout.d.ts +1 -1
  15. package/dist/components/TemplateEditor/Channels/SMS/SMSLayout.d.ts +1 -1
  16. package/dist/components/TemplateEditor/Channels/Slack/SlackLayout.d.ts +1 -1
  17. package/dist/components/TemplateEditor/Layout/Layout.d.ts +1 -0
  18. package/dist/components/TemplateEditor/TemplateEditor.d.ts +19 -0
  19. package/dist/components/TemplateEditor/VariableViewModeSync.d.ts +3 -0
  20. package/dist/components/TemplateEditor/hooks/index.d.ts +1 -0
  21. package/dist/components/TemplateEditor/hooks/useEmailBackgroundColors.d.ts +9 -0
  22. package/dist/components/TemplateEditor/hooks/useEmailFontFamily.d.ts +10 -0
  23. package/dist/components/TemplateEditor/hooks/useFonts.d.ts +4 -0
  24. package/dist/components/TemplateEditor/hooks/useGoogleFontLoader.d.ts +5 -0
  25. package/dist/components/TemplateEditor/index.d.ts +1 -0
  26. package/dist/components/TemplateEditor/store.d.ts +20 -0
  27. package/dist/components/TranslationEditor/TranslationEditor.d.ts +17 -0
  28. package/dist/components/TranslationEditor/index.d.ts +1 -0
  29. package/dist/components/extensions/Blockquote/Blockquote.d.ts +4 -0
  30. package/dist/components/extensions/Button/Button.types.d.ts +10 -6
  31. package/dist/components/extensions/Button/inboxButtonStyle.d.ts +65 -0
  32. package/dist/components/extensions/ButtonRow/ButtonRow.types.d.ts +4 -0
  33. package/dist/components/extensions/Color/Color.d.ts +14 -0
  34. package/dist/components/extensions/ColumnCell/ColumnCell.types.d.ts +32 -0
  35. package/dist/components/extensions/{CustomCode/CustomCodeForm.d.ts → ColumnCell/ColumnCellForm.d.ts} +2 -2
  36. package/dist/components/extensions/ColumnCell/index.d.ts +2 -0
  37. package/dist/components/extensions/HTML/HTML.d.ts +11 -0
  38. package/dist/components/extensions/{CustomCode/CustomCode.types.d.ts → HTML/HTML.types.d.ts} +2 -2
  39. package/dist/components/extensions/HTML/HTMLComponent.d.ts +9 -0
  40. package/dist/components/extensions/HTML/HTMLForm.d.ts +9 -0
  41. package/dist/components/extensions/HTML/index.d.ts +6 -0
  42. package/dist/components/extensions/ImageBlock/components/ImageBlockView.d.ts +1 -3
  43. package/dist/components/extensions/Link/LinkBubble.d.ts +1 -0
  44. package/dist/components/extensions/List/List.types.d.ts +5 -0
  45. package/dist/components/extensions/MessagingChannelPaste/MessagingChannelPaste.d.ts +11 -0
  46. package/dist/components/extensions/MessagingChannelPaste/index.d.ts +2 -0
  47. package/dist/components/extensions/Variable/Variable.d.ts +5 -0
  48. package/dist/components/extensions/index.d.ts +3 -2
  49. package/dist/components/extensions/shared/conditionalAttribute.d.ts +19 -0
  50. package/dist/components/hooks/useVariables.d.ts +12 -7
  51. package/dist/components/ui/Blocks/HTMLBlock/HTMLBlock.d.ts +3 -0
  52. package/dist/components/ui/Blocks/HTMLBlock/index.d.ts +1 -0
  53. package/dist/components/ui/Blocks/index.d.ts +1 -1
  54. package/dist/components/ui/Conditions/ConditionGroupRow.d.ts +12 -0
  55. package/dist/components/ui/Conditions/ConditionRow.d.ts +11 -0
  56. package/dist/components/ui/Conditions/Conditions.d.ts +9 -0
  57. package/dist/components/ui/Conditions/ConditionsSection.d.ts +18 -0
  58. package/dist/components/ui/Conditions/index.d.ts +3 -0
  59. package/dist/components/ui/Conditions/useConditions.d.ts +13 -0
  60. package/dist/components/ui/ContentIcon/ContentIcon.d.ts +1 -1
  61. package/dist/components/ui/MainLayout/MainLayout.d.ts +1 -0
  62. package/dist/components/ui/TextMenu/components/ContentTypePicker.d.ts +1 -1
  63. package/dist/components/ui/TextMenu/components/TextColorButton.d.ts +6 -0
  64. package/dist/components/ui/TextMenu/config.d.ts +1 -0
  65. package/dist/components/ui/TextMenu/hooks/useTextmenuCommands.d.ts +2 -0
  66. package/dist/components/ui/TextMenu/hooks/useTextmenuStates.d.ts +2 -0
  67. package/dist/components/ui/Tooltip/types.d.ts +1 -1
  68. package/dist/components/ui/VariableEditor/VariableChipBase.d.ts +10 -0
  69. package/dist/components/ui/VariableEditor/VariableInput.d.ts +18 -0
  70. package/dist/components/ui-kit/Button/Button.d.ts +2 -2
  71. package/dist/components/ui-kit/FontSelect/FontSelect.d.ts +9 -0
  72. package/dist/components/ui-kit/FontSelect/index.d.ts +1 -0
  73. package/dist/components/ui-kit/Form/Form.d.ts +2 -1
  74. package/dist/components/ui-kit/InputColor/ColorPicker.d.ts +2 -1
  75. package/dist/components/ui-kit/InputColor/InputColor.d.ts +4 -1
  76. package/dist/components/ui-kit/PrefixInput/PrefixInput.d.ts +30 -0
  77. package/dist/components/ui-kit/PrefixInput/index.d.ts +2 -0
  78. package/dist/components/ui-kit/index.d.ts +2 -0
  79. package/dist/components/utils/resolveDataPath.d.ts +13 -0
  80. package/dist/components/utils/validateVariableName.d.ts +5 -2
  81. package/dist/esm/index.js +70 -58
  82. package/dist/esm/index.js.map +4 -4
  83. package/dist/esm/styles.css +1473 -486
  84. package/dist/hooks/useLocalization.d.ts +30 -0
  85. package/dist/index.d.ts +18 -4
  86. package/dist/lib/constants/block-defaults.d.ts +43 -0
  87. package/dist/lib/constants/email-editor-tiptap-styles.d.ts +62 -0
  88. package/dist/lib/index.d.ts +1 -0
  89. package/dist/lib/utils/brandColors.d.ts +15 -0
  90. package/dist/lib/utils/extractTextFields.d.ts +60 -0
  91. package/dist/lib/utils/fontFamily.d.ts +23 -0
  92. package/dist/lib/utils/index.d.ts +1 -0
  93. package/dist/styles.css +1473 -486
  94. package/dist/types/conditions.types.d.ts +21 -0
  95. package/dist/types/elemental.types.d.ts +70 -4
  96. package/dist/types/font.types.d.ts +8 -0
  97. package/dist/types/index.d.ts +1 -0
  98. package/dist/types/validation.types.d.ts +15 -3
  99. package/package.json +6 -1
  100. package/dist/components/extensions/CustomCode/CustomCode.d.ts +0 -11
  101. package/dist/components/extensions/CustomCode/CustomCodeComponent.d.ts +0 -9
  102. package/dist/components/extensions/CustomCode/index.d.ts +0 -6
  103. package/dist/components/ui/Blocks/CustomCodeBlock/CustomCodeBlock.d.ts +0 -3
  104. package/dist/components/ui/Blocks/CustomCodeBlock/index.d.ts +0 -1
  105. /package/dist/components/extensions/{CustomCode → HTML}/MonacoCodeEditor.d.ts +0 -0
package/README.md CHANGED
@@ -35,14 +35,14 @@ pnpm add @trycourier/react-designer
35
35
 
36
36
  ### Bundle Size and Dependencies
37
37
 
38
- The package includes Monaco Editor for the Custom Code block feature. Monaco Editor is loaded dynamically (lazy-loaded) only when the Custom Code feature is actually used, minimizing the impact on your initial bundle size.
38
+ The package includes Monaco Editor for the HTML block feature. Monaco Editor is loaded dynamically (lazy-loaded) only when the HTML block feature is actually used, minimizing the impact on your initial bundle size.
39
39
 
40
40
  **Monaco Editor Deduplication**
41
41
 
42
42
  If your application already uses `@monaco-editor/react`, modern bundlers (Webpack 5, Vite, etc.) will likely deduplicate the dependency automatically. This package uses relaxed version ranges (`@monaco-editor/react`: `>=4.0.0 <6.0.0` and `monaco-editor`: `>=0.40.0 <1.0.0`) to maximize the chances of deduplication with consumer installations.
43
43
 
44
44
  To minimize bundle size:
45
- - Monaco Editor is lazy-loaded and only fetched when Custom Code blocks are used
45
+ - Monaco Editor is lazy-loaded and only fetched when HTML blocks are used
46
46
  - Modern bundlers will attempt deduplication when version ranges overlap
47
47
  - Consider using the same version of `@monaco-editor/react` in your project if you're also using Monaco Editor directly
48
48
 
@@ -291,7 +291,9 @@ Type `{{variableName}}` directly in the editor. The variable will be automatical
291
291
 
292
292
  ### Variable Autocomplete
293
293
 
294
- When you provide a `variables` prop, the editor shows an autocomplete dropdown when users type `{{`. This guides users to select from available variables and helps prevent typos.
294
+ When you provide a `variables` prop, the editor enables variable functionality: typing `{{` creates variable chips, the variable toolbar button is shown, and an autocomplete dropdown guides users to select from available variables.
295
+
296
+ > **Note:** If the `variables` prop is not provided (or is `undefined`), all variable functionality is disabled — the variable toolbar button is hidden and typing `{{` will not create variable chips. To enable variables without autocomplete suggestions, pass an empty object: `variables={{}}`.
295
297
 
296
298
  ```tsx
297
299
  import "@trycourier/react-designer/styles.css";
@@ -789,7 +791,7 @@ The Editor component is the core element that provides the template editing inte
789
791
  | theme | ThemeObj \| cssClass | | Controls the visual appearance of the editor. Can be a Theme object with styling properties or a CSS class name. |
790
792
  | value | ElementalContent | | Initial content for the editor in ElementalContent format. Used as the starting template when the editor loads. |
791
793
  | variableValidation | VariableValidationConfig | | Configuration for custom variable validation. Allows restricting which variable names are allowed and defining behavior on validation failure. See [Variable Validation](#variable-validation) section for details. |
792
- | variables | Record<string, any> | | Variables available for autocomplete suggestions. When provided, typing `{{` shows a dropdown with matching variables. See [Variable Autocomplete](#variable-autocomplete) section for details. |
794
+ | variables | Record<string, any> | | Variables available for autocomplete suggestions. When provided, typing `{{` shows a dropdown with matching variables. When not provided (`undefined`), all variable functionality is disabled (toolbar button hidden, `{{` typing does not create chips). Pass `{}` to enable variables without suggestions. See [Variable Autocomplete](#variable-autocomplete) section for details. |
793
795
  | disableVariablesAutocomplete | boolean | false | When `true`, disables variable autocomplete and allows users to type any variable name directly. When `false` (default), shows autocomplete dropdown with variables from the `variables` prop. |
794
796
 
795
797
  ### Multi-Channel Routing
@@ -847,7 +849,7 @@ The Brand Editor component accepts properties that allow you to customize its be
847
849
  | theme | ThemeObj \| cssClass | | Controls the visual appearance of the editor. Can be a Theme object with styling properties or a CSS class name. |
848
850
  | value | BrandSettings | | Initial brand settings values to populate the editor with, including colors, logo, social links, and header style preferences. |
849
851
  | variableValidation | VariableValidationConfig | | Configuration for custom variable validation. See [Variable Validation](#variable-validation) section for details. |
850
- | variables | Record<string, any> | | Variables available for autocomplete suggestions. When provided, typing `{{` shows a dropdown with matching variables. |
852
+ | variables | Record<string, any> | | Variables available for autocomplete suggestions. When not provided, all variable functionality is disabled. Pass `{}` to enable without suggestions. |
851
853
  | disableVariablesAutocomplete | boolean | false | When `true`, disables variable autocomplete and allows users to type any variable name directly. |
852
854
 
853
855
  ### Brand Provider