@crystallize/design-system 1.17.5 → 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 +12 -0
- package/dist/index.css +30 -36
- package/dist/index.d.ts +4 -4
- package/dist/index.js +11 -7
- package/dist/index.mjs +11 -7
- package/package.json +1 -1
- package/src/action-menu/action-item.tsx +2 -2
- package/src/action-menu/action-menu.css +1 -13
- package/src/action-menu/action-menu.test.tsx +2 -2
- package/src/dropdown-menu/dropdown-menu-root.tsx +10 -9
- package/src/dropdown-menu/dropdown-menu.css +25 -10
- package/src/icon-button/icon-button.css +1 -1
- package/src/rich-text-editor/plugins/ActionsPlugin/index.tsx +8 -5
- package/src/rich-text-editor/plugins/ToolbarPlugin/index.tsx +9 -5
- package/src/rich-text-editor/rich-text-editor.css +0 -4
- package/src/rich-text-editor/rich-text-editor.tsx +5 -1
- package/src/rich-text-editor/types/types.ts +1 -0
- package/src/switch/switch.css +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
9
|
+
## 1.17.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 30a9c6c: Extend the dropdown menu component to take a `modal` as a prop and pass it to the root element.
|
|
14
|
+
|
|
3
15
|
## 1.17.5
|
|
4
16
|
|
|
5
17
|
### 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
|
|
1338
|
-
|
|
1339
|
-
|
|
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
|
|
1342
|
-
|
|
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,
|
|
23
|
+
declare function Item({ children, className, ...delegated }: ItemProps): JSX.Element;
|
|
24
24
|
|
|
25
25
|
type DropdownMenuItemProps = DropdownMenuPrimitive.MenuItemProps & {
|
|
26
26
|
children: React.ReactNode;
|
|
@@ -34,15 +34,14 @@ type DropdownMenuLabelProps = {
|
|
|
34
34
|
declare function DropdownMenuLabel({ children }: DropdownMenuLabelProps): JSX.Element;
|
|
35
35
|
|
|
36
36
|
type Container = HTMLElement | null | undefined;
|
|
37
|
-
type DropdownMenuRootProps = DropdownMenuPrimitive.MenuContentProps & {
|
|
37
|
+
type DropdownMenuRootProps = DropdownMenuPrimitive.MenuContentProps & Pick<DropdownMenuPrimitive.DropdownMenuProps, 'onOpenChange' | 'modal'> & {
|
|
38
38
|
children: ReactNode;
|
|
39
39
|
content: ReactNode;
|
|
40
40
|
alignContent?: 'start' | 'center' | 'end';
|
|
41
41
|
disabled?: boolean;
|
|
42
|
-
onOpenChange?: (open: boolean) => void;
|
|
43
42
|
container?: Container;
|
|
44
43
|
};
|
|
45
|
-
declare function DropdownMenuRoot({ children, content, alignContent, disabled, onOpenChange, container, ...delegated }: DropdownMenuRootProps): JSX.Element;
|
|
44
|
+
declare function DropdownMenuRoot({ children, content, alignContent, disabled, onOpenChange, container, modal, ...delegated }: DropdownMenuRootProps): JSX.Element;
|
|
46
45
|
|
|
47
46
|
declare const DropdownMenu: {
|
|
48
47
|
Root: typeof DropdownMenuRoot;
|
|
@@ -413,6 +412,7 @@ type CrystallizeRichTextActionMenuItem = {
|
|
|
413
412
|
title: string;
|
|
414
413
|
action: () => void;
|
|
415
414
|
type?: 'default' | 'danger';
|
|
415
|
+
disabled?: boolean;
|
|
416
416
|
};
|
|
417
417
|
|
|
418
418
|
type TRichTextBase = {
|
package/dist/index.js
CHANGED
|
@@ -29124,6 +29124,7 @@ function DropdownMenuRoot({
|
|
|
29124
29124
|
disabled,
|
|
29125
29125
|
onOpenChange,
|
|
29126
29126
|
container,
|
|
29127
|
+
modal,
|
|
29127
29128
|
...delegated
|
|
29128
29129
|
}) {
|
|
29129
29130
|
const contentProps = {
|
|
@@ -29135,6 +29136,7 @@ function DropdownMenuRoot({
|
|
|
29135
29136
|
};
|
|
29136
29137
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DropdownMenuPrimitive3.Root, {
|
|
29137
29138
|
onOpenChange,
|
|
29139
|
+
modal,
|
|
29138
29140
|
children: [
|
|
29139
29141
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive3.Trigger, {
|
|
29140
29142
|
disabled,
|
|
@@ -29165,10 +29167,9 @@ var DropdownMenu = {
|
|
|
29165
29167
|
// src/action-menu/action-item.tsx
|
|
29166
29168
|
var import_class_variance_authority5 = require("class-variance-authority");
|
|
29167
29169
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
29168
|
-
function Item2({ children, className,
|
|
29170
|
+
function Item2({ children, className, ...delegated }) {
|
|
29169
29171
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenu.Item, {
|
|
29170
29172
|
...delegated,
|
|
29171
|
-
onClick: onSelect,
|
|
29172
29173
|
className: (0, import_class_variance_authority5.cx)(className, ["c-action-menu-item"]),
|
|
29173
29174
|
children
|
|
29174
29175
|
});
|
|
@@ -37088,10 +37089,7 @@ async function copyJson(editor) {
|
|
|
37088
37089
|
console.warn("Copy failed", error);
|
|
37089
37090
|
}
|
|
37090
37091
|
}
|
|
37091
|
-
function ActionsPlugin({
|
|
37092
|
-
append,
|
|
37093
|
-
prepend
|
|
37094
|
-
}) {
|
|
37092
|
+
function ActionsPlugin({ append, prepend, disabled }) {
|
|
37095
37093
|
const [editor] = (0, import_LexicalComposerContext10.useLexicalComposerContext)();
|
|
37096
37094
|
const tr = useTr();
|
|
37097
37095
|
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(ActionMenu, {
|
|
@@ -37099,6 +37097,7 @@ function ActionsPlugin({
|
|
|
37099
37097
|
!prepend ? null : prepend.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ActionMenu.Item, {
|
|
37100
37098
|
onSelect: actionItem.action,
|
|
37101
37099
|
className: actionItem.type === "danger" ? "danger" : "",
|
|
37100
|
+
disabled: actionItem.disabled,
|
|
37102
37101
|
children: actionItem.title
|
|
37103
37102
|
}, actionItem.title)),
|
|
37104
37103
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ActionMenu.Item, {
|
|
@@ -37106,6 +37105,7 @@ function ActionsPlugin({
|
|
|
37106
37105
|
children: tr("actionCopyJSON")
|
|
37107
37106
|
}),
|
|
37108
37107
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ActionMenu.Item, {
|
|
37108
|
+
disabled,
|
|
37109
37109
|
className: "danger",
|
|
37110
37110
|
onSelect: () => {
|
|
37111
37111
|
editor.dispatchCommand(import_lexical14.CLEAR_EDITOR_COMMAND, void 0);
|
|
@@ -37116,6 +37116,7 @@ function ActionsPlugin({
|
|
|
37116
37116
|
!append ? null : append.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(ActionMenu.Item, {
|
|
37117
37117
|
onSelect: actionItem.action,
|
|
37118
37118
|
className: actionItem.type === "danger" ? "danger" : "",
|
|
37119
|
+
disabled: actionItem.disabled,
|
|
37119
37120
|
children: actionItem.title
|
|
37120
37121
|
}, actionItem.title))
|
|
37121
37122
|
]
|
|
@@ -37391,7 +37392,8 @@ function Divider() {
|
|
|
37391
37392
|
}
|
|
37392
37393
|
function ToolbarPlugin({
|
|
37393
37394
|
actionsMenuPrepend,
|
|
37394
|
-
actionsMenuAppend
|
|
37395
|
+
actionsMenuAppend,
|
|
37396
|
+
disabled
|
|
37395
37397
|
}) {
|
|
37396
37398
|
const [editor] = (0, import_LexicalComposerContext11.useLexicalComposerContext)();
|
|
37397
37399
|
const [activeEditor, setActiveEditor] = (0, import_react121.useState)(editor);
|
|
@@ -37816,6 +37818,7 @@ function ToolbarPlugin({
|
|
|
37816
37818
|
]
|
|
37817
37819
|
}),
|
|
37818
37820
|
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ActionsPlugin, {
|
|
37821
|
+
disabled,
|
|
37819
37822
|
prepend: actionsMenuPrepend,
|
|
37820
37823
|
append: actionsMenuAppend
|
|
37821
37824
|
})
|
|
@@ -38002,6 +38005,7 @@ function RichTextEditorWithoutContext({
|
|
|
38002
38005
|
ignoreSelectionChange: true
|
|
38003
38006
|
}),
|
|
38004
38007
|
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(ToolbarPlugin, {
|
|
38008
|
+
disabled,
|
|
38005
38009
|
actionsMenuPrepend,
|
|
38006
38010
|
actionsMenuAppend
|
|
38007
38011
|
}),
|
package/dist/index.mjs
CHANGED
|
@@ -236,6 +236,7 @@ function DropdownMenuRoot({
|
|
|
236
236
|
disabled,
|
|
237
237
|
onOpenChange,
|
|
238
238
|
container,
|
|
239
|
+
modal,
|
|
239
240
|
...delegated
|
|
240
241
|
}) {
|
|
241
242
|
const contentProps = {
|
|
@@ -247,6 +248,7 @@ function DropdownMenuRoot({
|
|
|
247
248
|
};
|
|
248
249
|
return /* @__PURE__ */ jsxs3(DropdownMenuPrimitive3.Root, {
|
|
249
250
|
onOpenChange,
|
|
251
|
+
modal,
|
|
250
252
|
children: [
|
|
251
253
|
/* @__PURE__ */ jsx6(DropdownMenuPrimitive3.Trigger, {
|
|
252
254
|
disabled,
|
|
@@ -277,10 +279,9 @@ var DropdownMenu = {
|
|
|
277
279
|
// src/action-menu/action-item.tsx
|
|
278
280
|
import { cx as cx3 } from "class-variance-authority";
|
|
279
281
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
280
|
-
function Item2({ children, className,
|
|
282
|
+
function Item2({ children, className, ...delegated }) {
|
|
281
283
|
return /* @__PURE__ */ jsx7(DropdownMenu.Item, {
|
|
282
284
|
...delegated,
|
|
283
|
-
onClick: onSelect,
|
|
284
285
|
className: cx3(className, ["c-action-menu-item"]),
|
|
285
286
|
children
|
|
286
287
|
});
|
|
@@ -8282,10 +8283,7 @@ async function copyJson(editor) {
|
|
|
8282
8283
|
console.warn("Copy failed", error);
|
|
8283
8284
|
}
|
|
8284
8285
|
}
|
|
8285
|
-
function ActionsPlugin({
|
|
8286
|
-
append,
|
|
8287
|
-
prepend
|
|
8288
|
-
}) {
|
|
8286
|
+
function ActionsPlugin({ append, prepend, disabled }) {
|
|
8289
8287
|
const [editor] = useLexicalComposerContext10();
|
|
8290
8288
|
const tr = useTr();
|
|
8291
8289
|
return /* @__PURE__ */ jsxs110(ActionMenu, {
|
|
@@ -8293,6 +8291,7 @@ function ActionsPlugin({
|
|
|
8293
8291
|
!prepend ? null : prepend.map((actionItem) => /* @__PURE__ */ jsx134(ActionMenu.Item, {
|
|
8294
8292
|
onSelect: actionItem.action,
|
|
8295
8293
|
className: actionItem.type === "danger" ? "danger" : "",
|
|
8294
|
+
disabled: actionItem.disabled,
|
|
8296
8295
|
children: actionItem.title
|
|
8297
8296
|
}, actionItem.title)),
|
|
8298
8297
|
/* @__PURE__ */ jsx134(ActionMenu.Item, {
|
|
@@ -8300,6 +8299,7 @@ function ActionsPlugin({
|
|
|
8300
8299
|
children: tr("actionCopyJSON")
|
|
8301
8300
|
}),
|
|
8302
8301
|
/* @__PURE__ */ jsx134(ActionMenu.Item, {
|
|
8302
|
+
disabled,
|
|
8303
8303
|
className: "danger",
|
|
8304
8304
|
onSelect: () => {
|
|
8305
8305
|
editor.dispatchCommand(CLEAR_EDITOR_COMMAND, void 0);
|
|
@@ -8310,6 +8310,7 @@ function ActionsPlugin({
|
|
|
8310
8310
|
!append ? null : append.map((actionItem) => /* @__PURE__ */ jsx134(ActionMenu.Item, {
|
|
8311
8311
|
onSelect: actionItem.action,
|
|
8312
8312
|
className: actionItem.type === "danger" ? "danger" : "",
|
|
8313
|
+
disabled: actionItem.disabled,
|
|
8313
8314
|
children: actionItem.title
|
|
8314
8315
|
}, actionItem.title))
|
|
8315
8316
|
]
|
|
@@ -8585,7 +8586,8 @@ function Divider() {
|
|
|
8585
8586
|
}
|
|
8586
8587
|
function ToolbarPlugin({
|
|
8587
8588
|
actionsMenuPrepend,
|
|
8588
|
-
actionsMenuAppend
|
|
8589
|
+
actionsMenuAppend,
|
|
8590
|
+
disabled
|
|
8589
8591
|
}) {
|
|
8590
8592
|
const [editor] = useLexicalComposerContext11();
|
|
8591
8593
|
const [activeEditor, setActiveEditor] = useState9(editor);
|
|
@@ -9010,6 +9012,7 @@ function ToolbarPlugin({
|
|
|
9010
9012
|
]
|
|
9011
9013
|
}),
|
|
9012
9014
|
/* @__PURE__ */ jsx136(ActionsPlugin, {
|
|
9015
|
+
disabled,
|
|
9013
9016
|
prepend: actionsMenuPrepend,
|
|
9014
9017
|
append: actionsMenuAppend
|
|
9015
9018
|
})
|
|
@@ -9196,6 +9199,7 @@ function RichTextEditorWithoutContext({
|
|
|
9196
9199
|
ignoreSelectionChange: true
|
|
9197
9200
|
}),
|
|
9198
9201
|
/* @__PURE__ */ jsx137(ToolbarPlugin, {
|
|
9202
|
+
disabled,
|
|
9199
9203
|
actionsMenuPrepend,
|
|
9200
9204
|
actionsMenuAppend
|
|
9201
9205
|
}),
|
package/package.json
CHANGED
|
@@ -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,
|
|
10
|
+
export function Item({ children, className, ...delegated }: ItemProps) {
|
|
11
11
|
return (
|
|
12
|
-
<DropdownMenu.Item {...delegated}
|
|
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
|
|
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
|
|
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 =
|
|
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
|
|
@@ -3,14 +3,14 @@ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
|
3
3
|
|
|
4
4
|
export type Container = HTMLElement | null | undefined;
|
|
5
5
|
|
|
6
|
-
export type DropdownMenuRootProps = DropdownMenuPrimitive.MenuContentProps &
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
6
|
+
export type DropdownMenuRootProps = DropdownMenuPrimitive.MenuContentProps &
|
|
7
|
+
Pick<DropdownMenuPrimitive.DropdownMenuProps, 'onOpenChange' | 'modal'> & {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
content: ReactNode;
|
|
10
|
+
alignContent?: 'start' | 'center' | 'end';
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
container?: Container;
|
|
13
|
+
};
|
|
14
14
|
|
|
15
15
|
export function DropdownMenuRoot({
|
|
16
16
|
children,
|
|
@@ -19,6 +19,7 @@ export function DropdownMenuRoot({
|
|
|
19
19
|
disabled,
|
|
20
20
|
onOpenChange,
|
|
21
21
|
container,
|
|
22
|
+
modal,
|
|
22
23
|
...delegated
|
|
23
24
|
}: DropdownMenuRootProps) {
|
|
24
25
|
const contentProps = {
|
|
@@ -30,7 +31,7 @@ export function DropdownMenuRoot({
|
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
return (
|
|
33
|
-
<DropdownMenuPrimitive.Root onOpenChange={onOpenChange}>
|
|
34
|
+
<DropdownMenuPrimitive.Root onOpenChange={onOpenChange} modal={modal}>
|
|
34
35
|
<DropdownMenuPrimitive.Trigger disabled={disabled} asChild>
|
|
35
36
|
{children}
|
|
36
37
|
</DropdownMenuPrimitive.Trigger>
|
|
@@ -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
|
|
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
|
-
|
|
23
|
-
|
|
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
|
-
|
|
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 {
|
|
@@ -25,13 +25,13 @@ async function copyJson(editor: LexicalEditor) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
append,
|
|
30
|
-
prepend,
|
|
31
|
-
}: {
|
|
28
|
+
type ActionsPluginProps = {
|
|
32
29
|
append?: CrystallizeRichTextActionMenuItem[];
|
|
33
30
|
prepend?: CrystallizeRichTextActionMenuItem[];
|
|
34
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -140,7 +140,11 @@ function RichTextEditorWithoutContext({
|
|
|
140
140
|
return (
|
|
141
141
|
<>
|
|
142
142
|
<OnChangePlugin onChange={onLocalChange} ignoreSelectionChange />
|
|
143
|
-
<ToolbarPlugin
|
|
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}
|
package/src/switch/switch.css
CHANGED
|
@@ -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
|
|
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 {
|