@datarobot/design-system 28.4.0 → 28.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 (38) hide show
  1. package/cjs/chat/chat-message-body.js +9 -4
  2. package/cjs/chat/hocs.d.ts +1 -1
  3. package/cjs/chat/hocs.js +21 -22
  4. package/cjs/chat/index.d.ts +2 -0
  5. package/cjs/chat/index.js +14 -0
  6. package/cjs/text-editor/inline-text-editor.d.ts +3 -1
  7. package/cjs/text-editor/inline-text-editor.js +6 -2
  8. package/cjs/text-editor/text-editor-constants.d.ts +0 -2
  9. package/cjs/text-editor/text-editor-constants.js +0 -8
  10. package/cjs/text-editor/text-editor-content.d.ts +2 -1
  11. package/cjs/text-editor/text-editor-content.js +22 -2
  12. package/cjs/text-editor/text-editor-header.js +2 -9
  13. package/cjs/text-editor/text-editor-helpers.d.ts +1 -0
  14. package/cjs/text-editor/text-editor-helpers.js +22 -17
  15. package/cjs/text-editor/text-editor.d.ts +5 -1
  16. package/cjs/text-editor/text-editor.js +31 -6
  17. package/esm/chat/chat-message-body.js +9 -4
  18. package/esm/chat/hocs.d.ts +1 -1
  19. package/esm/chat/hocs.js +21 -22
  20. package/esm/chat/index.d.ts +2 -0
  21. package/esm/chat/index.js +2 -0
  22. package/esm/text-editor/inline-text-editor.d.ts +3 -1
  23. package/esm/text-editor/inline-text-editor.js +6 -2
  24. package/esm/text-editor/text-editor-constants.d.ts +0 -2
  25. package/esm/text-editor/text-editor-constants.js +0 -6
  26. package/esm/text-editor/text-editor-content.d.ts +2 -1
  27. package/esm/text-editor/text-editor-content.js +22 -2
  28. package/esm/text-editor/text-editor-header.js +3 -10
  29. package/esm/text-editor/text-editor-helpers.d.ts +1 -0
  30. package/esm/text-editor/text-editor-helpers.js +22 -18
  31. package/esm/text-editor/text-editor.d.ts +5 -1
  32. package/esm/text-editor/text-editor.js +33 -8
  33. package/js/bundle/bundle.js +175 -127
  34. package/js/bundle/bundle.min.js +1 -1
  35. package/js/bundle/index.d.ts +22 -5
  36. package/package.json +1 -1
  37. package/styles/index.css +10 -0
  38. package/styles/index.min.css +1 -1
@@ -25,6 +25,7 @@ import { IconLookup } from '@fortawesome/fontawesome-svg-core';
25
25
  import React, { MouseEvent } from 'react';
26
26
  import React, { ReactNode } from 'react';
27
27
  import { Editor, Descendant } from 'slate';
28
+ import { ReactEditor } from 'slate-react';
28
29
  import { Descendant } from 'slate';
29
30
  import { RenderElementProps } from 'slate-react';
30
31
  import React, { ChangeEvent, KeyboardEventHandler } from 'react';
@@ -781,6 +782,13 @@ export type ChatProps = {
781
782
  };
782
783
  export const Chat: React.MemoExoticComponent<React.ForwardRefExoticComponent<ChatProps & React.RefAttributes<HTMLUListElement>>>;
783
784
 
785
+ function CharactersCounterBase({ currLength, maxLength, getCharactersCounterString, }: CharactersCounterProps): import("react/jsx-runtime").JSX.Element;
786
+ namespace CharactersCounterBase {
787
+ var displayName: string;
788
+ }
789
+ export const CharactersCounter: React.MemoExoticComponent<typeof CharactersCounterBase>;
790
+ export {};
791
+
784
792
  export function isMentionElement(type: string): boolean;
785
793
  export function getMentionsCount(nodes: CustomElement[]): number;
786
794
  /** This function synchronises slate editor chidren with value prop.
@@ -789,6 +797,9 @@ export function getMentionsCount(nodes: CustomElement[]): number;
789
797
  */
790
798
  export function resetNodes(editor: Editor, nodes: Descendant[]): void;
791
799
 
800
+ export const withMaxLength: (maxLength: number | undefined) => (editor: ReactEditor) => ReactEditor;
801
+ export const withMentions: (editor: any) => any;
802
+
792
803
  export const DEFAULT_VALUE: Descendant[];
793
804
  export const CUSTOM_ELEMENT_TYPES: {
794
805
  mention: string;
@@ -6247,6 +6258,8 @@ export type TextEditorComponentProps = {
6247
6258
  onBlur?: () => void;
6248
6259
  deleteEditorContentButtonAriaLabel: string;
6249
6260
  id: string;
6261
+ maxLength?: number;
6262
+ getCharactersCounterString?: (count: number) => string;
6250
6263
  };
6251
6264
  export type TextEditorProps = {
6252
6265
  name: string;
@@ -6303,12 +6316,14 @@ export type TextEditorProps = {
6303
6316
  linkInputLabelText?: string;
6304
6317
  deleteEditorContentButtonAriaLabel: string;
6305
6318
  id?: string;
6319
+ maxLength?: number;
6320
+ getCharactersCounterString?: (count: number) => string;
6306
6321
  };
6307
6322
  /**
6308
6323
  * @midnight-gray-supported
6309
6324
  * @alpine-light-supported
6310
6325
  * */
6311
- export default function TextEditor({ name, header, type, value, initialValue, validity, label, placeholder, autoFocus, readOnly, testId, contentTestId, contentAriaLabel, className, height, enabledTools, toolbarPosition, elementRender, leafRender, onChange, onCancel, onSave, tooltipTextBold, tooltipTextItalic, tooltipTextUnderline, tooltipTextSuperscript, tooltipTextLink, tooltipTextRemoveLink, tooltipTextBulletedList, tooltipTextNumberedList, tooltipTextClearFormatting, tooltipTextCode, urlIsRequiredMessage, enterValidUrlMessage, saveButtonText, headingLargeText, headingMediumText, headingSmallText, regularText, validationErrorWarningMessage, linkInputLabelText, deleteEditorContentButtonAriaLabel, id, }: TextEditorProps): import("react/jsx-runtime").JSX.Element;
6326
+ export default function TextEditor({ name, header, type, value, initialValue, validity, label, placeholder, autoFocus, readOnly, testId, contentTestId, contentAriaLabel, className, height, enabledTools, toolbarPosition, elementRender, leafRender, onChange, onCancel, onSave, tooltipTextBold, tooltipTextItalic, tooltipTextUnderline, tooltipTextSuperscript, tooltipTextLink, tooltipTextRemoveLink, tooltipTextBulletedList, tooltipTextNumberedList, tooltipTextClearFormatting, tooltipTextCode, urlIsRequiredMessage, enterValidUrlMessage, saveButtonText, headingLargeText, headingMediumText, headingSmallText, regularText, validationErrorWarningMessage, linkInputLabelText, deleteEditorContentButtonAriaLabel, id, maxLength, getCharactersCounterString, }: TextEditorProps): import("react/jsx-runtime").JSX.Element;
6312
6327
 
6313
6328
  import './edited-text.less';
6314
6329
  export type EditedTextComponentProps = {
@@ -6357,8 +6372,10 @@ export type InlineTextEditorProps = {
6357
6372
  readOnly?: boolean;
6358
6373
  deleteEditorContentButtonAriaLabel?: string;
6359
6374
  autoFocus?: boolean;
6375
+ maxLength?: number;
6376
+ getCharactersCounterString?: (count: number) => string;
6360
6377
  };
6361
- export default function InlineTextEditor({ name, type, readOnly, initialValue, placeholder, ariaLabel, className, enabledTools, header, toolbarPosition, height, onCancel, onSave, autoFocus, deleteEditorContentButtonAriaLabel, }: InlineTextEditorProps): import("react/jsx-runtime").JSX.Element;
6378
+ export default function InlineTextEditor({ name, type, readOnly, initialValue, placeholder, ariaLabel, className, enabledTools, header, toolbarPosition, height, onCancel, onSave, autoFocus, deleteEditorContentButtonAriaLabel, maxLength, getCharactersCounterString, }: InlineTextEditorProps): import("react/jsx-runtime").JSX.Element;
6362
6379
 
6363
6380
  export type TextEditorEngine = BaseEditor & ReactEditor & HistoryEditor & EditorInterface;
6364
6381
  export const MARK_TYPES: {
@@ -6431,8 +6448,6 @@ export interface SlateReact {
6431
6448
  Slate: FC<SlateComponent>;
6432
6449
  withReact: typeof withReact;
6433
6450
  }
6434
- export function instanceOfContentChild(obj: TextEditorValue | TextEditorValueChild): obj is TextEditorValueChild;
6435
- export function instanceOfContent(obj: TextEditorValue | TextEditorValueChild): obj is TextEditorValue;
6436
6451
  export const TEXT_EDITOR_DEFAULT_VALUE: TextEditorValue[];
6437
6452
  export const TEXT_EDITOR_DEFAULT_TOOLS: TextEditorTool[];
6438
6453
  export interface TextEditorToolbarLabels {
@@ -6481,6 +6496,7 @@ export function isEmptyTextEditorValue(value: TextEditorValue[]): boolean;
6481
6496
  * @returns {boolean}
6482
6497
  */
6483
6498
  export function isLongerTextEditorValueThan(value: TextEditorValue[] | TextEditorValueChild[], maxLength?: number): boolean;
6499
+ export function getTextEditorValueLength(value: TextEditorValue[] | TextEditorValueChild[]): number;
6484
6500
  /**
6485
6501
  * @param {Array} value - the type of value is defined with TextEditorValue
6486
6502
  * @param {number} maxTextLines
@@ -8426,8 +8442,9 @@ export type TextEditorContentProps = {
8426
8442
  leafRender?: FC<LeafProps>;
8427
8443
  onBlur?: () => void;
8428
8444
  onFocus?: () => void;
8445
+ maxLength?: number;
8429
8446
  };
8430
- export default function TextEditorContent({ ariaAttrs, testId, placeholder, readOnly, autoFocus, isScrollable, elementRender, leafRender, onBlur, onFocus, }: TextEditorContentProps): import("react/jsx-runtime").JSX.Element;
8447
+ export default function TextEditorContent({ ariaAttrs, testId, placeholder, readOnly, autoFocus, isScrollable, elementRender, leafRender, onBlur, onFocus, maxLength, }: TextEditorContentProps): import("react/jsx-runtime").JSX.Element;
8431
8448
 
8432
8449
  export type TourHandlerFunction = () => void;
8433
8450
  export type SkipTourHandlerFunction = (stepNumber: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarobot/design-system",
3
- "version": "28.4.0",
3
+ "version": "28.5.0",
4
4
  "description": "DataRobot react components library",
5
5
  "scripts": {
6
6
  "build": "node ../../tools/build-lib.js",
package/styles/index.css CHANGED
@@ -13041,6 +13041,16 @@ table.simple-table.sublevel tr td {
13041
13041
  color: var(--text-primary);
13042
13042
  fill: var(--text-primary);
13043
13043
  }
13044
+ .text-editor .characters-counter {
13045
+ font-family: 'Inter', sans-serif;
13046
+ font-size: 0.75rem;
13047
+ font-weight: 400;
13048
+ line-height: 1rem;
13049
+ letter-spacing: normal;
13050
+ color: var(--text-secondary);
13051
+ fill: var(--text-secondary);
13052
+ margin: 0.25rem;
13053
+ }
13044
13054
 
13045
13055
  /*!****************************************************************************************************************************************************************************************************************************************************!*\
13046
13056
  !*** css ../../node_modules/css-loader/dist/cjs.js!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!../../node_modules/less-loader/dist/cjs.js??ruleSet[1].rules[3].use[3]!./src/components/text-editor/edited-text.less ***!