@pushwoosh/dumb-components 1.1.229 → 1.1.230

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.
@@ -25,7 +25,9 @@ export const RichMessageEditor = ({
25
25
  title,
26
26
  initialValue,
27
27
  minHeight,
28
+ placeholder,
28
29
  error,
30
+ isErrored,
29
31
  canUsePersonalization,
30
32
  canUseEmoji,
31
33
  onChange,
@@ -123,6 +125,8 @@ export const RichMessageEditor = ({
123
125
  }),
124
126
  children: [_jsx(SlateEditable, {
125
127
  minHeight: minHeight,
128
+ placeholder: placeholder,
129
+ isErrored: isErrored || !!error,
126
130
  onFocus: () => {
127
131
  setIsFocused(true);
128
132
  const {
@@ -24,8 +24,12 @@ export type RichMessageEditorProps = {
24
24
  onChange: (value: string) => void;
25
25
  /** Minimum editor height (CSS value). */
26
26
  minHeight?: string;
27
+ /** Hint shown while the editor is empty. */
28
+ placeholder?: string;
27
29
  /** Error message; switches the field to the error state. */
28
30
  error?: ReactNode;
31
+ /** Draw the error border without an error message. */
32
+ isErrored?: boolean;
29
33
  /** Enable inserting personalization (dynamic-content) tokens. */
30
34
  canUsePersonalization?: boolean;
31
35
  /** Enable the emoji picker. */
@@ -12,6 +12,8 @@ type SlateEditor = {
12
12
  export declare const SlateEditor: FC<SlateEditor>;
13
13
  type SlateEditableProps = {
14
14
  minHeight?: string;
15
+ placeholder?: string;
16
+ isErrored?: boolean;
15
17
  onFocus?: () => void;
16
18
  onDelete: () => void;
17
19
  };
@@ -26,6 +26,8 @@ export const SlateEditor = ({
26
26
  };
27
27
  export const SlateEditable = ({
28
28
  minHeight,
29
+ placeholder,
30
+ isErrored,
29
31
  onFocus,
30
32
  onDelete
31
33
  }) => {
@@ -34,6 +36,8 @@ export const SlateEditable = ({
34
36
  });
35
37
  return _jsx(EditableStyled, {
36
38
  "$minHeight": minHeight,
39
+ "$isErrored": isErrored,
40
+ placeholder: placeholder,
37
41
  renderElement: renderElementPersistent,
38
42
  onFocus: onFocus
39
43
  });
@@ -15,4 +15,5 @@ export declare const EditableStyled: import("styled-components").StyledComponent
15
15
  disableDefaultStyles?: boolean | undefined;
16
16
  } & import("react").TextareaHTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>, any, {
17
17
  $minHeight?: string;
18
+ $isErrored?: boolean;
18
19
  }, never>;
@@ -4,6 +4,8 @@ import { Color, FontSize, FontWeight, ShapeRadius } from '@pushwoosh/kit-constan
4
4
  export const EditableStyled = styled(Editable).withConfig({
5
5
  displayName: "EditableStyled",
6
6
  componentId: "sc-1frhl1f-0"
7
- })(["font-weight:", ";font-size:", ";line-height:140%;padding:8px;color:", ";background:", ";caret-color:", ";border:1px solid ", ";border-radius:", ";overflow-x:auto;", " &:focus{border-color:", ";outline:none;}& > p{margin:4px 0;&:first-child{margin-top:0;}&:last-child{margin-bottom:0;}}"], FontWeight.REGULAR, FontSize.REGULAR, Color.MAIN, Color.CLEAR, Color.BRIGHT, Color.FORM, ShapeRadius.CONTROL, ({
7
+ })(["font-weight:", ";font-size:", ";line-height:140%;padding:8px;color:", ";background:", ";caret-color:", ";border:1px solid ", ";border-radius:", ";overflow-x:auto;", " & [data-slate-placeholder='true']{color:", ";opacity:1 !important;}&:focus{border-color:", ";outline:none;}& > p{position:relative;margin:4px 0;&:first-child{margin-top:0;}&:last-child{margin-bottom:0;}}"], FontWeight.REGULAR, FontSize.REGULAR, Color.MAIN, Color.CLEAR, Color.BRIGHT, ({
8
+ $isErrored
9
+ }) => $isErrored ? Color.DANGER : Color.FORM, ShapeRadius.CONTROL, ({
8
10
  $minHeight
9
- }) => $minHeight && `min-height: ${$minHeight};`, Color.BRIGHT);
11
+ }) => $minHeight && `min-height: ${$minHeight};`, Color.PHANTOM, Color.BRIGHT);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.1.229",
3
+ "version": "1.1.230",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",