@crystallize/design-system 1.10.0 → 1.11.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 (26) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/index.css +15 -17
  3. package/dist/index.d.ts +8 -1
  4. package/dist/index.js +469 -442
  5. package/dist/index.mjs +407 -385
  6. package/package.json +1 -1
  7. package/src/rich-text-editor/i18n/i18n.test.ts +14 -0
  8. package/src/rich-text-editor/i18n/index.tsx +64 -0
  9. package/src/rich-text-editor/i18n/translations/en.ts +66 -0
  10. package/src/rich-text-editor/i18n/types.ts +62 -0
  11. package/src/rich-text-editor/plugins/ActionsPlugin/index.tsx +5 -22
  12. package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.tsx +4 -1
  13. package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.tsx +11 -1
  14. package/src/rich-text-editor/plugins/CodeActionMenuPlugin/index.tsx +2 -1
  15. package/src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx +23 -5
  16. package/src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx +21 -10
  17. package/src/rich-text-editor/plugins/TabFocusPlugin/index.tsx +4 -12
  18. package/src/rich-text-editor/plugins/TableActionMenuPlugin/index.tsx +23 -14
  19. package/src/rich-text-editor/plugins/ToolbarPlugin/index.tsx +33 -33
  20. package/src/rich-text-editor/plugins/ToolbarPlugin/insert-table.tsx +6 -4
  21. package/src/rich-text-editor/rich-text-editor.css +6 -0
  22. package/src/rich-text-editor/rich-text-editor.stories.tsx +10 -0
  23. package/src/rich-text-editor/rich-text-editor.tsx +15 -9
  24. package/src/rich-text-editor/ui/LinkPreview.tsx +3 -1
  25. package/src/rich-text-editor/ui/ContentEditable.css +0 -13
  26. package/src/rich-text-editor/ui/ContentEditable.tsx +0 -15
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @crystallize/design-system
2
2
 
3
+ ## 1.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e621c3b: Rich text editor now supports passing translations, via `labelTranslations` as a prop.
8
+
3
9
  ## 1.10.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.css CHANGED
@@ -2975,6 +2975,21 @@ button {
2975
2975
  outline: 2px solid rgb(60, 132, 244);
2976
2976
  user-select: none;
2977
2977
  }
2978
+ .c-rich-text-editor .ContentEditable__root {
2979
+ tab-size: 1;
2980
+ min-height: calc(100% - 16px);
2981
+ position: relative;
2982
+ display: block;
2983
+ border-width: 0px;
2984
+ padding-left: 1.5rem;
2985
+ padding-right: 1.5rem;
2986
+ padding-top: 0.5rem;
2987
+ padding-bottom: 0.5rem;
2988
+ padding-top: 0px !important;
2989
+ font-size: 0.875rem;
2990
+ line-height: 1.25rem;
2991
+ outline-width: 0px;
2992
+ }
2978
2993
  .c-rich-text-editor .TableNode__contentEditable {
2979
2994
  min-height: 20px;
2980
2995
  border: 0px;
@@ -3854,20 +3869,3 @@ button {
3854
3869
  .CrystallizeRTEditorTheme__embedBlockFocus {
3855
3870
  outline: 2px solid rgb(60, 132, 244);
3856
3871
  }
3857
-
3858
- /* src/rich-text-editor/ui/ContentEditable.css */
3859
- .ContentEditable__root {
3860
- tab-size: 1;
3861
- min-height: calc(100% - 16px);
3862
- position: relative;
3863
- display: block;
3864
- border-width: 0px;
3865
- padding-left: 1.5rem;
3866
- padding-right: 1.5rem;
3867
- padding-top: 0.5rem;
3868
- padding-bottom: 0.5rem;
3869
- padding-top: 0px !important;
3870
- font-size: 0.875rem;
3871
- line-height: 1.25rem;
3872
- outline-width: 0px;
3873
- }
package/dist/index.d.ts CHANGED
@@ -296,6 +296,11 @@ declare const tagStyles: (props?: ({
296
296
  type TagProps = ComponentProps<'span'> & TagStylesProps;
297
297
  declare function Tag({ children, className, variant, ...delegated }: TagProps): JSX.Element;
298
298
 
299
+ type I18NKeys = 'actionClearTextFormatting' | 'actionTextFormattingOptions' | 'actionFormatAsStrongLabel' | 'actionFormatAsStrongTitle' | 'actionFormatAsStrongTitleApple' | 'actionFormatAsEmphasizedLabel' | 'actionFormatAsEmphasizedTitle' | 'actionFormatAsEmphasizedTitleApple' | 'actionFormatAsUnderlinedLabel' | 'actionFormatAsUnderlinedTitle' | 'actionFormatAsUnderlinedTitleApple' | 'actionFormatWithStrikethroughLabel' | 'actionFormatWithStrikethroughTitle' | 'actionFormatWithSubscriptLabel' | 'actionFormatWithSubscriptTitle' | 'actionFormatWithSuperscriptLabel' | 'actionFormatWithSuperscriptTitle' | 'actionCopyJSON' | 'actionClear' | 'actionFormatCode' | 'actionCopyCode' | 'actionInsertCodeBlock' | 'actionInsertlink' | 'actionTableInsertRowsAbove' | 'actionTableInsertRowsAbove_plural' | 'actionTableInsertRowsBelow' | 'actionTableInsertRowsBelow_plural' | 'actionTableInsertColumnsBefore' | 'actionTableInsertColumnsBefore_plural' | 'actionTableInsertColumnsAfter' | 'actionTableInsertColumnsAfter_plural' | 'actionTableAddRowHeader' | 'actionTableRemoveRowHeader' | 'actionTableAddColumnHeader' | 'actionTableRemoveColumnHeader' | 'actionTableDeleteColumn' | 'actionTableDeleteRow' | 'actionTableDeleteTable' | 'actionTableOpenOptions' | 'actionUndoLabel' | 'actionUndoTitle' | 'actionUndoTitleApple' | 'actionRedoLabel' | 'actionRedoTitle' | 'actionRedoTitleApple' | 'codeSelectLanguage' | 'linkEditorLink' | 'linkEditorRel' | 'linkEditorTarget' | 'linkEditorCommit' | 'linkEditorEdit' | 'linkPreviewReplaceTextWithTitle' | 'horizontalRule' | 'table' | 'insertTableTitle' | 'insertTableDescription' | 'insertTableRows' | 'insertTableColumns' | 'insertTableCommit';
300
+ type I18N = Record<I18NKeys, string>;
301
+
302
+ type SupportedLanguages = 'en';
303
+
299
304
  declare const CODE_ALL_NAME_OPTIONS: {
300
305
  readonly javascript: "js";
301
306
  readonly md: "markdown";
@@ -396,8 +401,10 @@ type TRichTextBase = {
396
401
  slotPreContent?: ReactNode;
397
402
  maxLength?: number;
398
403
  editable?: boolean;
404
+ language?: SupportedLanguages;
405
+ labelTranslations?: I18N;
399
406
  };
400
- declare function RichTextEditor({ initialData, editable, ...rest }: TRichTextBase & {
407
+ declare function RichTextEditor({ initialData, editable, language, labelTranslations, ...rest }: TRichTextBase & {
401
408
  initialData?: CrystallizeRichText;
402
409
  }): JSX.Element;
403
410