@kaizen/components 1.45.1 → 1.45.2

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.
@@ -3,6 +3,7 @@ import { OverrideClassName } from "../../types/OverrideClassName";
3
3
  import { ToolbarItems, EditorContentArray, EditorRows } from "../types";
4
4
  import { ProseMirrorState } from "../utils/prosemirror";
5
5
  type BaseRichTextEditorProps = {
6
+ id?: string;
6
7
  onChange: (content: ProseMirrorState.EditorState) => void;
7
8
  defaultValue: EditorContentArray;
8
9
  controls?: ToolbarItems[];
@@ -37,7 +38,7 @@ export type RichTextEditorProps = BaseRichTextEditorProps & (WithLabelText | Wit
37
38
  * {@link https://cultureamp.design/?path=/docs/components-richtexteditor--docs Storybook}
38
39
  */
39
40
  export declare const RichTextEditor: {
40
- ({ onChange, defaultValue, labelText, "aria-labelledby": labelledBy, "aria-describedby": describedBy, classNameOverride, controls, rows, dataError, onDataError, validationMessage, description, status, ...restProps }: RichTextEditorProps): JSX.Element;
41
+ ({ id, onChange, defaultValue, labelText, "aria-labelledby": labelledBy, "aria-describedby": describedBy, classNameOverride, controls, rows, dataError, onDataError, validationMessage, description, status, ...restProps }: RichTextEditorProps): JSX.Element;
41
42
  displayName: string;
42
43
  };
43
44
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaizen/components",
3
- "version": "1.45.1",
3
+ "version": "1.45.2",
4
4
  "description": "Kaizen component library",
5
5
  "author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
6
6
  "homepage": "https://cultureamp.design",
@@ -109,8 +109,8 @@
109
109
  "ts-node": "^10.9.2",
110
110
  "ts-patch": "^3.1.2",
111
111
  "typescript-transform-paths": "^3.4.7",
112
- "@kaizen/design-tokens": "10.3.20",
113
- "@kaizen/tailwind": "1.2.6"
112
+ "@kaizen/tailwind": "1.2.6",
113
+ "@kaizen/design-tokens": "10.3.20"
114
114
  },
115
115
  "peerDependencies": {
116
116
  "@cultureamp/i18n-react-intl": "^2.5.6",
@@ -30,6 +30,7 @@ import { buildKeymap } from "./utils/keymap"
30
30
  import styles from "./RichTextEditor.module.scss"
31
31
 
32
32
  type BaseRichTextEditorProps = {
33
+ id?: string
33
34
  onChange: (content: ProseMirrorState.EditorState) => void
34
35
  defaultValue: EditorContentArray
35
36
  controls?: ToolbarItems[]
@@ -70,6 +71,7 @@ export type RichTextEditorProps = BaseRichTextEditorProps &
70
71
  * {@link https://cultureamp.design/?path=/docs/components-richtexteditor--docs Storybook}
71
72
  */
72
73
  export const RichTextEditor = ({
74
+ id,
73
75
  onChange,
74
76
  defaultValue,
75
77
  labelText,
@@ -85,12 +87,13 @@ export const RichTextEditor = ({
85
87
  status = "default",
86
88
  ...restProps
87
89
  }: RichTextEditorProps): JSX.Element => {
88
- const reactId = useId()
90
+ const generatedId = useId()
89
91
  const [schema] = useState<ProseMirrorModel.Schema>(
90
92
  createSchemaFromControls(controls)
91
93
  )
92
- const [labelId] = useState<string>(labelledBy || reactId)
93
- const [editorId] = useState<string>(reactId)
94
+
95
+ const editorId = id || generatedId
96
+ const labelId = labelledBy || `${editorId}-rte-label`
94
97
  const validationMessageAria = validationMessage
95
98
  ? `${editorId}-rte-validation-message`
96
99
  : ""