@crystallize/design-system 1.17.6 → 1.18.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @crystallize/design-system
2
2
 
3
+ ## 1.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7d5e071: Add z-index 100 to the dropdown menu content so it goes the same as dialog. There is an issue where opening a dropdown in modal would show the dropdown behind and thus be not visible.
8
+
3
9
  ## 1.17.6
4
10
 
5
11
  ### Patch Changes
package/dist/index.css CHANGED
@@ -1180,7 +1180,6 @@ button {
1180
1180
  }
1181
1181
  .c-action-menu-item {
1182
1182
  display: flex;
1183
- cursor: pointer;
1184
1183
  align-items: center;
1185
1184
  gap: 0.5rem;
1186
1185
  padding-left: 1.25rem;
@@ -1208,20 +1207,6 @@ button {
1208
1207
  font-weight: 500;
1209
1208
  color: rgb(var(--c-color-gray));
1210
1209
  }
1211
- .c-action-menu-item:hover {
1212
- --tw-bg-opacity: 1;
1213
- background-color: rgb(var(--c-color-gray-50-900) / var(--tw-bg-opacity));
1214
- }
1215
- .c-action-menu-item:focus {
1216
- --tw-bg-opacity: 1;
1217
- background-color: rgb(var(--c-color-gray-50-900) / var(--tw-bg-opacity));
1218
- outline: 2px solid transparent;
1219
- outline-offset: 2px;
1220
- }
1221
- .c-action-menu-item.danger {
1222
- --tw-text-opacity: 1;
1223
- color: rgb(var(--c-color-pink-600-300) / var(--tw-text-opacity));
1224
- }
1225
1210
  .c-action-menu-item-separator {
1226
1211
  margin: 0px;
1227
1212
  height: 1px;
@@ -1240,6 +1225,7 @@ button {
1240
1225
  .c-dropdown-menu-content {
1241
1226
  animation-duration: 0.4s;
1242
1227
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
1228
+ z-index: 100;
1243
1229
  --tw-shadow: 0 2px 4px rgba(130,138,144,0.15);
1244
1230
  --tw-shadow-colored: 0 2px 4px var(--tw-shadow-color);
1245
1231
  box-shadow:
@@ -1288,7 +1274,6 @@ button {
1288
1274
  .c-dropdown-menu-item {
1289
1275
  display: flex;
1290
1276
  height: 2.5rem;
1291
- cursor: pointer;
1292
1277
  align-items: center;
1293
1278
  --tw-bg-opacity: 1;
1294
1279
  background-color: rgb(var(--c-color-elevate) / var(--tw-bg-opacity));
@@ -1313,20 +1298,35 @@ button {
1313
1298
  font-size: 0.75rem;
1314
1299
  line-height: 1rem;
1315
1300
  font-weight: 500;
1301
+ }
1302
+ .c-dropdown-menu-item:first-child {
1303
+ border-top-left-radius: 0.25rem;
1304
+ border-top-right-radius: 0.25rem;
1305
+ }
1306
+ .c-dropdown-menu-item:last-child {
1307
+ border-bottom-left-radius: 0.25rem;
1308
+ border-bottom-right-radius: 0.25rem;
1309
+ }
1310
+ .c-dropdown-menu-item:not([data-disabled]) {
1311
+ cursor: pointer;
1316
1312
  --tw-text-opacity: 1;
1317
1313
  color: rgb(var(--c-color-gray-700-200) / var(--tw-text-opacity));
1318
1314
  }
1319
- .c-dropdown-menu-item:hover,
1320
- .c-dropdown-menu-item:focus,
1321
- .c-dropdown-menu-item:focus-visible,
1322
- .c-dropdown-menu-item:hover.selected,
1323
- .c-dropdown-menu-item:focus.selected,
1324
- .c-dropdown-menu-item:focus-visible.selected {
1315
+ .c-dropdown-menu-item:not([data-disabled]):hover,
1316
+ .c-dropdown-menu-item:not([data-disabled]):focus,
1317
+ .c-dropdown-menu-item:not([data-disabled]):focus-visible,
1318
+ .c-dropdown-menu-item:not([data-disabled]):hover.selected,
1319
+ .c-dropdown-menu-item:not([data-disabled]):focus.selected,
1320
+ .c-dropdown-menu-item:not([data-disabled]):focus-visible.selected {
1325
1321
  --tw-bg-opacity: 1;
1326
1322
  background-color: rgb(var(--c-color-gray-50-900) / var(--tw-bg-opacity));
1327
1323
  outline: 2px solid transparent;
1328
1324
  outline-offset: 2px;
1329
1325
  }
1326
+ .c-dropdown-menu-item[data-disabled] {
1327
+ cursor: not-allowed;
1328
+ color: rgb(var(--c-color-gray-700-200) / 0.5);
1329
+ }
1330
1330
  .c-dropdown-menu-item.selected {
1331
1331
  --tw-bg-opacity: 1;
1332
1332
  background-color: rgb(var(--c-color-gray-50-900) / var(--tw-bg-opacity));
@@ -1334,13 +1334,12 @@ button {
1334
1334
  --tw-text-opacity: 1;
1335
1335
  color: rgb(var(--c-color-green-500-400) / var(--tw-text-opacity));
1336
1336
  }
1337
- .c-dropdown-menu-item:first-child {
1338
- border-top-left-radius: 0.25rem;
1339
- border-top-right-radius: 0.25rem;
1337
+ .c-dropdown-menu-item.danger {
1338
+ --tw-text-opacity: 1;
1339
+ color: rgb(var(--c-color-pink-600-300) / var(--tw-text-opacity));
1340
1340
  }
1341
- .c-dropdown-menu-item:last-child {
1342
- border-bottom-left-radius: 0.25rem;
1343
- border-bottom-right-radius: 0.25rem;
1341
+ .c-dropdown-menu-item.danger[data-disabled] {
1342
+ color: rgb(var(--c-color-pink-600-300) / 0.5);
1344
1343
  }
1345
1344
  @keyframes slideUp {
1346
1345
  from {
@@ -1562,9 +1561,6 @@ button {
1562
1561
  font-weight: 500;
1563
1562
  }
1564
1563
  .c-icon-button:disabled {
1565
- --tw-scale-x: 1;
1566
- --tw-scale-y: 1;
1567
- transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
1568
1564
  cursor: default;
1569
1565
  --tw-shadow: 0 0 #0000;
1570
1566
  --tw-shadow-colored: 0 0 #0000;
@@ -2666,10 +2662,6 @@ button {
2666
2662
  border-bottom-left-radius: 0.375rem;
2667
2663
  border-bottom-right-radius: 0.375rem;
2668
2664
  }
2669
- .c-rich-text-editor .c-rte-editor-container:not(.disabled) {
2670
- --tw-bg-opacity: 1;
2671
- background-color: rgb(255 255 255 / var(--tw-bg-opacity));
2672
- }
2673
2665
  .c-rich-text-editor .c-rte-editor {
2674
2666
  position: relative;
2675
2667
  }
@@ -3653,7 +3645,6 @@ button {
3653
3645
  position: relative;
3654
3646
  height: 1.5rem;
3655
3647
  width: 2.75rem;
3656
- cursor: pointer;
3657
3648
  border-radius: 9999px;
3658
3649
  border-width: 1px;
3659
3650
  border-style: solid;
@@ -3674,6 +3665,9 @@ button {
3674
3665
  outline: 2px solid transparent;
3675
3666
  outline-offset: 2px;
3676
3667
  }
3668
+ .c-switch-root:enabled {
3669
+ cursor: pointer;
3670
+ }
3677
3671
  .c-switch-root:disabled {
3678
3672
  opacity: 0.4;
3679
3673
  }
package/dist/index.d.ts CHANGED
@@ -20,7 +20,7 @@ declare function Separator({ className }: SeparatorProps): JSX.Element;
20
20
  type ItemProps = DropdownMenuItemProps$1 & {
21
21
  onSelect?: (event: React.MouseEvent<HTMLDivElement>) => void;
22
22
  };
23
- declare function Item({ children, className, onSelect, ...delegated }: ItemProps): JSX.Element;
23
+ declare function Item({ children, className, ...delegated }: ItemProps): JSX.Element;
24
24
 
25
25
  type DropdownMenuItemProps = DropdownMenuPrimitive.MenuItemProps & {
26
26
  children: React.ReactNode;
@@ -412,6 +412,7 @@ type CrystallizeRichTextActionMenuItem = {
412
412
  title: string;
413
413
  action: () => void;
414
414
  type?: 'default' | 'danger';
415
+ disabled?: boolean;
415
416
  };
416
417
 
417
418
  type TRichTextBase = {
package/dist/index.js CHANGED
@@ -29167,10 +29167,9 @@ var DropdownMenu = {
29167
29167
  // src/action-menu/action-item.tsx
29168
29168
  var import_class_variance_authority5 = require("class-variance-authority");
29169
29169
  var import_jsx_runtime7 = require("react/jsx-runtime");
29170
- function Item2({ children, className, onSelect, ...delegated }) {
29170
+ function Item2({ children, className, ...delegated }) {
29171
29171
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenu.Item, {
29172
29172
  ...delegated,
29173
- onClick: onSelect,
29174
29173
  className: (0, import_class_variance_authority5.cx)(className, ["c-action-menu-item"]),
29175
29174
  children
29176
29175
  });
@@ -37090,10 +37089,7 @@ async function copyJson(editor) {
37090
37089
  console.warn("Copy failed", error);
37091
37090
  }
37092
37091
  }
37093
- function ActionsPlugin({
37094
- append,
37095
- prepend
37096
- }) {
37092
+ function ActionsPlugin({ append, prepend, disabled }) {
37097
37093
  const [editor] = (0, import_LexicalComposerContext10.useLexicalComposerContext)();
37098
37094
  const tr = useTr();
37099
37095
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(ActionMenu, {
@@ -37101,6 +37097,7 @@ function ActionsPlugin({
37101
37097
  !prepend ? null : prepend.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ActionMenu.Item, {
37102
37098
  onSelect: actionItem.action,
37103
37099
  className: actionItem.type === "danger" ? "danger" : "",
37100
+ disabled: actionItem.disabled,
37104
37101
  children: actionItem.title
37105
37102
  }, actionItem.title)),
37106
37103
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ActionMenu.Item, {
@@ -37108,6 +37105,7 @@ function ActionsPlugin({
37108
37105
  children: tr("actionCopyJSON")
37109
37106
  }),
37110
37107
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ActionMenu.Item, {
37108
+ disabled,
37111
37109
  className: "danger",
37112
37110
  onSelect: () => {
37113
37111
  editor.dispatchCommand(import_lexical14.CLEAR_EDITOR_COMMAND, void 0);
@@ -37118,6 +37116,7 @@ function ActionsPlugin({
37118
37116
  !append ? null : append.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ActionMenu.Item, {
37119
37117
  onSelect: actionItem.action,
37120
37118
  className: actionItem.type === "danger" ? "danger" : "",
37119
+ disabled: actionItem.disabled,
37121
37120
  children: actionItem.title
37122
37121
  }, actionItem.title))
37123
37122
  ]
@@ -37393,7 +37392,8 @@ function Divider() {
37393
37392
  }
37394
37393
  function ToolbarPlugin({
37395
37394
  actionsMenuPrepend,
37396
- actionsMenuAppend
37395
+ actionsMenuAppend,
37396
+ disabled
37397
37397
  }) {
37398
37398
  const [editor] = (0, import_LexicalComposerContext11.useLexicalComposerContext)();
37399
37399
  const [activeEditor, setActiveEditor] = (0, import_react121.useState)(editor);
@@ -37818,6 +37818,7 @@ function ToolbarPlugin({
37818
37818
  ]
37819
37819
  }),
37820
37820
  /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ActionsPlugin, {
37821
+ disabled,
37821
37822
  prepend: actionsMenuPrepend,
37822
37823
  append: actionsMenuAppend
37823
37824
  })
@@ -38004,6 +38005,7 @@ function RichTextEditorWithoutContext({
38004
38005
  ignoreSelectionChange: true
38005
38006
  }),
38006
38007
  /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(ToolbarPlugin, {
38008
+ disabled,
38007
38009
  actionsMenuPrepend,
38008
38010
  actionsMenuAppend
38009
38011
  }),
package/dist/index.mjs CHANGED
@@ -279,10 +279,9 @@ var DropdownMenu = {
279
279
  // src/action-menu/action-item.tsx
280
280
  import { cx as cx3 } from "class-variance-authority";
281
281
  import { jsx as jsx7 } from "react/jsx-runtime";
282
- function Item2({ children, className, onSelect, ...delegated }) {
282
+ function Item2({ children, className, ...delegated }) {
283
283
  return /* @__PURE__ */ jsx7(DropdownMenu.Item, {
284
284
  ...delegated,
285
- onClick: onSelect,
286
285
  className: cx3(className, ["c-action-menu-item"]),
287
286
  children
288
287
  });
@@ -8284,10 +8283,7 @@ async function copyJson(editor) {
8284
8283
  console.warn("Copy failed", error);
8285
8284
  }
8286
8285
  }
8287
- function ActionsPlugin({
8288
- append,
8289
- prepend
8290
- }) {
8286
+ function ActionsPlugin({ append, prepend, disabled }) {
8291
8287
  const [editor] = useLexicalComposerContext10();
8292
8288
  const tr = useTr();
8293
8289
  return /* @__PURE__ */ jsxs110(ActionMenu, {
@@ -8295,6 +8291,7 @@ function ActionsPlugin({
8295
8291
  !prepend ? null : prepend.map((actionItem) => /* @__PURE__ */ jsx134(ActionMenu.Item, {
8296
8292
  onSelect: actionItem.action,
8297
8293
  className: actionItem.type === "danger" ? "danger" : "",
8294
+ disabled: actionItem.disabled,
8298
8295
  children: actionItem.title
8299
8296
  }, actionItem.title)),
8300
8297
  /* @__PURE__ */ jsx134(ActionMenu.Item, {
@@ -8302,6 +8299,7 @@ function ActionsPlugin({
8302
8299
  children: tr("actionCopyJSON")
8303
8300
  }),
8304
8301
  /* @__PURE__ */ jsx134(ActionMenu.Item, {
8302
+ disabled,
8305
8303
  className: "danger",
8306
8304
  onSelect: () => {
8307
8305
  editor.dispatchCommand(CLEAR_EDITOR_COMMAND, void 0);
@@ -8312,6 +8310,7 @@ function ActionsPlugin({
8312
8310
  !append ? null : append.map((actionItem) => /* @__PURE__ */ jsx134(ActionMenu.Item, {
8313
8311
  onSelect: actionItem.action,
8314
8312
  className: actionItem.type === "danger" ? "danger" : "",
8313
+ disabled: actionItem.disabled,
8315
8314
  children: actionItem.title
8316
8315
  }, actionItem.title))
8317
8316
  ]
@@ -8587,7 +8586,8 @@ function Divider() {
8587
8586
  }
8588
8587
  function ToolbarPlugin({
8589
8588
  actionsMenuPrepend,
8590
- actionsMenuAppend
8589
+ actionsMenuAppend,
8590
+ disabled
8591
8591
  }) {
8592
8592
  const [editor] = useLexicalComposerContext11();
8593
8593
  const [activeEditor, setActiveEditor] = useState9(editor);
@@ -9012,6 +9012,7 @@ function ToolbarPlugin({
9012
9012
  ]
9013
9013
  }),
9014
9014
  /* @__PURE__ */ jsx136(ActionsPlugin, {
9015
+ disabled,
9015
9016
  prepend: actionsMenuPrepend,
9016
9017
  append: actionsMenuAppend
9017
9018
  })
@@ -9198,6 +9199,7 @@ function RichTextEditorWithoutContext({
9198
9199
  ignoreSelectionChange: true
9199
9200
  }),
9200
9201
  /* @__PURE__ */ jsx137(ToolbarPlugin, {
9202
+ disabled,
9201
9203
  actionsMenuPrepend,
9202
9204
  actionsMenuAppend
9203
9205
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystallize/design-system",
3
- "version": "1.17.6",
3
+ "version": "1.18.0",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -7,9 +7,9 @@ type ItemProps = DropdownMenuItemProps & {
7
7
  onSelect?: (event: React.MouseEvent<HTMLDivElement>) => void;
8
8
  };
9
9
 
10
- export function Item({ children, className, onSelect, ...delegated }: ItemProps) {
10
+ export function Item({ children, className, ...delegated }: ItemProps) {
11
11
  return (
12
- <DropdownMenu.Item {...delegated} onClick={onSelect} className={cx(className, ['c-action-menu-item'])}>
12
+ <DropdownMenu.Item {...delegated} className={cx(className, ['c-action-menu-item'])}>
13
13
  {children}
14
14
  </DropdownMenu.Item>
15
15
  );
@@ -45,19 +45,7 @@
45
45
  }
46
46
 
47
47
  .c-action-menu-item {
48
- @apply flex cursor-pointer items-center gap-2 px-5 py-2.5 font-sans text-sm font-medium text-gray;
49
-
50
- &:hover {
51
- @apply bg-gray-50-900;
52
- }
53
-
54
- &:focus {
55
- @apply bg-gray-50-900 outline-none;
56
- }
57
-
58
- &.danger {
59
- @apply text-pink-600-300;
60
- }
48
+ @apply flex items-center gap-2 px-5 py-2.5 font-sans text-sm font-medium text-gray;
61
49
  }
62
50
 
63
51
  .c-action-menu-item-separator {
@@ -19,7 +19,7 @@ describe('ActionMenu', () => {
19
19
  const callbackThatShouldNotBeExecuted = vi.fn();
20
20
  const user = userEvent.setup();
21
21
 
22
- const touchableProps = { onSelect: onSelectOption, onClick: onSelectOption };
22
+ const touchableProps = { onSelect: onSelectOption };
23
23
  const touchablePropsThatShouldNotBeCalled = {
24
24
  onSelect: callbackThatShouldNotBeExecuted,
25
25
  onClick: callbackThatShouldNotBeExecuted,
@@ -36,7 +36,7 @@ describe('ActionMenu', () => {
36
36
  await user.click(triggerButton);
37
37
 
38
38
  // The user should be able to see the dropdown menu
39
- const dropdownMenu = await screen.getByRole('menu');
39
+ const dropdownMenu = screen.getByRole('menu');
40
40
  expect(dropdownMenu).toBeInTheDocument();
41
41
 
42
42
  // The user should be able to see the list of options
@@ -1,7 +1,7 @@
1
1
  .c-dropdown-menu-content {
2
2
  animation-duration: 0.4s;
3
3
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
4
- @apply shadow;
4
+ @apply z-[100] shadow;
5
5
  }
6
6
 
7
7
  .c-dropdown-menu-content[data-side='top'] {
@@ -17,22 +17,37 @@
17
17
  }
18
18
 
19
19
  .c-dropdown-menu-item {
20
- @apply flex h-10 cursor-pointer items-center bg-elevate px-4 font-sans text-xs font-medium text-gray-700-200;
20
+ @apply flex h-10 items-center bg-elevate px-4 font-sans text-xs font-medium;
21
+ @apply first:rounded-tl first:rounded-tr last:rounded-bl last:rounded-br;
22
+
23
+ &:not([data-disabled]) {
24
+ @apply cursor-pointer text-gray-700-200;
25
+
26
+ &:hover,
27
+ &:focus,
28
+ &:focus-visible,
29
+ &:hover.selected,
30
+ &:focus.selected,
31
+ &:focus-visible.selected {
32
+ @apply bg-gray-50-900 outline-none;
33
+ }
34
+ }
21
35
 
22
- &:hover,
23
- &:focus,
24
- &:focus-visible,
25
- &:hover.selected,
26
- &:focus.selected,
27
- &:focus-visible.selected {
28
- @apply bg-gray-50-900 outline-none;
36
+ &[data-disabled] {
37
+ @apply cursor-not-allowed text-gray-700-200/50;
29
38
  }
30
39
 
31
40
  &.selected {
32
41
  @apply bg-gray-50-900 font-bold text-green-500-400;
33
42
  }
34
43
 
35
- @apply first:rounded-tl first:rounded-tr last:rounded-bl last:rounded-br;
44
+ &.danger {
45
+ @apply text-pink-600-300;
46
+
47
+ &[data-disabled] {
48
+ @apply text-pink-600-300/50;
49
+ }
50
+ }
36
51
  }
37
52
 
38
53
  @keyframes slideUp {
@@ -2,7 +2,7 @@
2
2
  @apply flex cursor-pointer appearance-none items-center justify-center rounded border-none bg-transparent p-0 font-medium;
3
3
 
4
4
  &:disabled {
5
- @apply scale-100 cursor-default shadow-none;
5
+ @apply cursor-default shadow-none;
6
6
  }
7
7
 
8
8
  &:enabled {
@@ -25,13 +25,13 @@ async function copyJson(editor: LexicalEditor) {
25
25
  }
26
26
  }
27
27
 
28
- export default function ActionsPlugin({
29
- append,
30
- prepend,
31
- }: {
28
+ type ActionsPluginProps = {
32
29
  append?: CrystallizeRichTextActionMenuItem[];
33
30
  prepend?: CrystallizeRichTextActionMenuItem[];
34
- }): JSX.Element {
31
+ disabled?: boolean;
32
+ };
33
+
34
+ export default function ActionsPlugin({ append, prepend, disabled }: ActionsPluginProps): JSX.Element {
35
35
  const [editor] = useLexicalComposerContext();
36
36
  const tr = useTr();
37
37
 
@@ -44,12 +44,14 @@ export default function ActionsPlugin({
44
44
  key={actionItem.title}
45
45
  onSelect={actionItem.action}
46
46
  className={actionItem.type === 'danger' ? 'danger' : ''}
47
+ disabled={actionItem.disabled}
47
48
  >
48
49
  {actionItem.title}
49
50
  </ActionMenu.Item>
50
51
  ))}
51
52
  <ActionMenu.Item onSelect={() => copyJson(editor)}>{tr('actionCopyJSON')}</ActionMenu.Item>
52
53
  <ActionMenu.Item
54
+ disabled={disabled}
53
55
  className="danger"
54
56
  onSelect={() => {
55
57
  editor.dispatchCommand(CLEAR_EDITOR_COMMAND, undefined);
@@ -65,6 +67,7 @@ export default function ActionsPlugin({
65
67
  key={actionItem.title}
66
68
  onSelect={actionItem.action}
67
69
  className={actionItem.type === 'danger' ? 'danger' : ''}
70
+ disabled={actionItem.disabled}
68
71
  >
69
72
  {actionItem.title}
70
73
  </ActionMenu.Item>
@@ -279,13 +279,17 @@ function Divider(): JSX.Element {
279
279
  return <div className="c-rte-toolbar__divider" />;
280
280
  }
281
281
 
282
+ type ToolbarPluginProps = {
283
+ actionsMenuPrepend?: CrystallizeRichTextActionMenuItem[];
284
+ actionsMenuAppend?: CrystallizeRichTextActionMenuItem[];
285
+ disabled?: boolean;
286
+ };
287
+
282
288
  export default function ToolbarPlugin({
283
289
  actionsMenuPrepend,
284
290
  actionsMenuAppend,
285
- }: {
286
- actionsMenuPrepend?: CrystallizeRichTextActionMenuItem[];
287
- actionsMenuAppend?: CrystallizeRichTextActionMenuItem[];
288
- }): JSX.Element {
291
+ disabled,
292
+ }: ToolbarPluginProps): JSX.Element {
289
293
  const [editor] = useLexicalComposerContext();
290
294
  const [activeEditor, setActiveEditor] = useState(editor);
291
295
  const [blockType, setBlockType] = useState<keyof typeof blockTypeToBlockName>('paragraph');
@@ -686,7 +690,7 @@ export default function ToolbarPlugin({
686
690
  </Dialog>
687
691
  )}
688
692
  </div>
689
- <ActionsPlugin prepend={actionsMenuPrepend} append={actionsMenuAppend} />
693
+ <ActionsPlugin disabled={disabled} prepend={actionsMenuPrepend} append={actionsMenuAppend} />
690
694
  </div>
691
695
  );
692
696
  }
@@ -40,10 +40,6 @@
40
40
  @apply relative mt-2 cursor-text rounded-bl-md rounded-br-md;
41
41
  }
42
42
 
43
- .c-rte-editor-container:not(.disabled) {
44
- @apply bg-white;
45
- }
46
-
47
43
  .c-rte-editor {
48
44
  @apply relative;
49
45
  }
@@ -140,7 +140,11 @@ function RichTextEditorWithoutContext({
140
140
  return (
141
141
  <>
142
142
  <OnChangePlugin onChange={onLocalChange} ignoreSelectionChange />
143
- <ToolbarPlugin actionsMenuPrepend={actionsMenuPrepend} actionsMenuAppend={actionsMenuAppend} />
143
+ <ToolbarPlugin
144
+ disabled={disabled}
145
+ actionsMenuPrepend={actionsMenuPrepend}
146
+ actionsMenuAppend={actionsMenuAppend}
147
+ />
144
148
  {slotPreContent}
145
149
  <div className={`c-rte-editor-container ${disabled ? 'disabled' : ''}`}>
146
150
  {maxLength != null ? <MaxLengthPlugin maxLength={maxLength} /> : null}
@@ -2,4 +2,5 @@ export type CrystallizeRichTextActionMenuItem = {
2
2
  title: string;
3
3
  action: () => void;
4
4
  type?: 'default' | 'danger';
5
+ disabled?: boolean;
5
6
  };
@@ -1,6 +1,6 @@
1
1
  .c-switch-root {
2
2
  /* @apply radix-state-checked:border-[#528693] radix-state-checked:bg-neptune h-4 w-7 rounded-full border border-solid border-[#52869399] bg-[#9095a84d] p-0 focus:outline-none focus:ring-1 focus:ring-[#528693] focus:ring-offset-1 disabled:opacity-40; */
3
- @apply relative h-6 w-11 cursor-pointer rounded-full border border-solid border-purple-200-700 bg-purple-50-900 pl-0.5 transition-all hover:border-purple-300-600 focus:outline-none disabled:opacity-40 data-[state=checked]:border-green-400-500 data-[state=checked]:bg-cyan-100-800;
3
+ @apply relative h-6 w-11 rounded-full border border-solid border-purple-200-700 bg-purple-50-900 pl-0.5 transition-all hover:border-purple-300-600 focus:outline-none enabled:cursor-pointer disabled:opacity-40 data-[state=checked]:border-green-400-500 data-[state=checked]:bg-cyan-100-800;
4
4
  }
5
5
 
6
6
  .c-switch-thumb {