@crystallize/design-system 1.11.3 → 1.11.5
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 +28 -9
- package/dist/index.d.ts +38 -31
- package/dist/index.js +91 -67
- package/dist/index.mjs +55 -31
- package/package.json +4 -3
- package/src/action-menu/ActionMenu.stories.tsx +12 -0
- package/src/action-menu/action-menu.css +22 -3
- package/src/action-menu/action-menu.test.tsx +53 -0
- package/src/action-menu/action-menu.tsx +26 -5
- package/src/button/button.test.tsx +22 -0
- package/src/dropdown-menu/dropdown-menu-root.tsx +16 -10
- package/src/dropdown-menu/dropdown-menu.css +1 -1
- package/src/dropdown-menu/index.ts +3 -1
- package/src/popover/index.ts +1 -0
- package/src/popover/popover-close.tsx +18 -0
- package/src/popover/popover.css +11 -0
- package/src/popover/popover.stories.tsx +48 -0
- package/src/popover/popover.tsx +45 -0
- package/src/rich-text-editor/plugins/ActionsPlugin/index.tsx +4 -2
- package/src/rich-text-editor/tests/rich-text-editor-code.test.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @crystallize/design-system
|
|
2
2
|
|
|
3
|
+
## 1.11.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f7cb015: Allow to pass a portal container, in order to attach the menu on the Dialog cases
|
|
8
|
+
|
|
9
|
+
## 1.11.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 1bb27da: Add portal component to the ActionMenu and data-testid property
|
|
14
|
+
|
|
3
15
|
## 1.11.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.css
CHANGED
|
@@ -640,6 +640,9 @@ button {
|
|
|
640
640
|
.h-full {
|
|
641
641
|
height: 100%;
|
|
642
642
|
}
|
|
643
|
+
.w-1\/2 {
|
|
644
|
+
width: 50%;
|
|
645
|
+
}
|
|
643
646
|
.w-4 {
|
|
644
647
|
width: 1rem;
|
|
645
648
|
}
|
|
@@ -878,6 +881,9 @@ button {
|
|
|
878
881
|
padding-top: 0.5rem;
|
|
879
882
|
padding-bottom: 0.5rem;
|
|
880
883
|
}
|
|
884
|
+
.pt-14 {
|
|
885
|
+
padding-top: 3.5rem;
|
|
886
|
+
}
|
|
881
887
|
.text-center {
|
|
882
888
|
text-align: center;
|
|
883
889
|
}
|
|
@@ -1199,8 +1205,6 @@ button {
|
|
|
1199
1205
|
/* src/action-menu/action-menu.css */
|
|
1200
1206
|
.c-action-menu {
|
|
1201
1207
|
display: flex;
|
|
1202
|
-
height: 2rem;
|
|
1203
|
-
width: 2rem;
|
|
1204
1208
|
flex-shrink: 0;
|
|
1205
1209
|
--tw-rotate: 0deg;
|
|
1206
1210
|
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));
|
|
@@ -1212,7 +1216,6 @@ button {
|
|
|
1212
1216
|
border-radius: 0.375rem;
|
|
1213
1217
|
border-style: none;
|
|
1214
1218
|
background-color: transparent;
|
|
1215
|
-
padding: 0.25rem;
|
|
1216
1219
|
outline-offset: -1px;
|
|
1217
1220
|
transition-property:
|
|
1218
1221
|
color,
|
|
@@ -1230,8 +1233,6 @@ button {
|
|
|
1230
1233
|
transition-duration: 150ms;
|
|
1231
1234
|
}
|
|
1232
1235
|
.c-action-menu-dot {
|
|
1233
|
-
height: 4px;
|
|
1234
|
-
width: 4px;
|
|
1235
1236
|
border-radius: 9999px;
|
|
1236
1237
|
background-color: rgb(var(--c-color-gray));
|
|
1237
1238
|
}
|
|
@@ -1261,15 +1262,33 @@ button {
|
|
|
1261
1262
|
--tw-bg-opacity: 1;
|
|
1262
1263
|
background-color: rgb(var(--c-color-purple-100-800) / var(--tw-bg-opacity));
|
|
1263
1264
|
}
|
|
1265
|
+
.c-action-menu-xs {
|
|
1266
|
+
height: 1.5rem;
|
|
1267
|
+
width: 1.5rem;
|
|
1268
|
+
padding: 0.125rem;
|
|
1269
|
+
}
|
|
1270
|
+
.c-action-menu-xs .c-action-menu-dot {
|
|
1271
|
+
height: 0.125rem;
|
|
1272
|
+
width: 0.125rem;
|
|
1273
|
+
}
|
|
1274
|
+
.c-action-menu-sm {
|
|
1275
|
+
height: 2rem;
|
|
1276
|
+
width: 2rem;
|
|
1277
|
+
padding: 0.25rem;
|
|
1278
|
+
}
|
|
1279
|
+
.c-action-menu-sm .c-action-menu-dot {
|
|
1280
|
+
height: 0.25rem;
|
|
1281
|
+
width: 0.25rem;
|
|
1282
|
+
}
|
|
1264
1283
|
.c-action-menu-item {
|
|
1265
1284
|
display: flex;
|
|
1266
1285
|
cursor: pointer;
|
|
1267
1286
|
align-items: center;
|
|
1268
1287
|
gap: 0.5rem;
|
|
1269
|
-
padding-top: 0.625rem;
|
|
1270
|
-
padding-bottom: 0.625rem;
|
|
1271
1288
|
padding-left: 1.25rem;
|
|
1272
1289
|
padding-right: 1.25rem;
|
|
1290
|
+
padding-top: 0.625rem;
|
|
1291
|
+
padding-bottom: 0.625rem;
|
|
1273
1292
|
font-family:
|
|
1274
1293
|
Roboto,
|
|
1275
1294
|
ui-sans-serif,
|
|
@@ -1400,12 +1419,12 @@ button {
|
|
|
1400
1419
|
outline-offset: 2px;
|
|
1401
1420
|
}
|
|
1402
1421
|
.c-dropdown-menu-item:first-child {
|
|
1403
|
-
border-top-right-radius: 0.25rem;
|
|
1404
1422
|
border-top-left-radius: 0.25rem;
|
|
1423
|
+
border-top-right-radius: 0.25rem;
|
|
1405
1424
|
}
|
|
1406
1425
|
.c-dropdown-menu-item:last-child {
|
|
1407
|
-
border-bottom-right-radius: 0.25rem;
|
|
1408
1426
|
border-bottom-left-radius: 0.25rem;
|
|
1427
|
+
border-bottom-right-radius: 0.25rem;
|
|
1409
1428
|
}
|
|
1410
1429
|
|
|
1411
1430
|
/* src/avatar/avatar.css */
|
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { HTMLAttributes, ReactNode, ComponentPropsWithRef, ComponentProps, RefAt
|
|
|
3
3
|
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
4
4
|
import * as class_variance_authority from 'class-variance-authority';
|
|
5
5
|
import { VariantProps } from 'class-variance-authority';
|
|
6
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
6
7
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
7
8
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
8
|
-
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
9
9
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
10
10
|
import * as ProgressPrimitives from '@radix-ui/react-progress';
|
|
11
11
|
import * as _radix_ui_react_select from '@radix-ui/react-select';
|
|
@@ -19,11 +19,45 @@ type ItemProps = HTMLAttributes<HTMLLIElement> & {
|
|
|
19
19
|
};
|
|
20
20
|
declare function Item({ children, className, onSelect }: ItemProps): JSX.Element;
|
|
21
21
|
|
|
22
|
-
type
|
|
22
|
+
type DropdownMenuItemProps = DropdownMenuPrimitive.MenuItemProps & {
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
};
|
|
25
|
+
declare function DropdownMenuItem({ children, className, ...delegated }: DropdownMenuItemProps): JSX.Element;
|
|
26
|
+
|
|
27
|
+
type DropdownMenuLabelProps = {
|
|
23
28
|
children: ReactNode;
|
|
29
|
+
};
|
|
30
|
+
declare function DropdownMenuLabel({ children }: DropdownMenuLabelProps): JSX.Element;
|
|
31
|
+
|
|
32
|
+
type Container = HTMLElement | null | undefined;
|
|
33
|
+
type DropdownMenuRootProps = DropdownMenuPrimitive.MenuContentProps & {
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
content: ReactNode;
|
|
36
|
+
alignContent?: 'start' | 'center' | 'end';
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
onOpenChange?: (open: boolean) => void;
|
|
39
|
+
container?: Container;
|
|
40
|
+
};
|
|
41
|
+
declare function DropdownMenuRoot({ children, content, alignContent, disabled, onOpenChange, container, ...delegated }: DropdownMenuRootProps): JSX.Element;
|
|
42
|
+
|
|
43
|
+
declare const DropdownMenu: {
|
|
44
|
+
Root: typeof DropdownMenuRoot;
|
|
45
|
+
Item: typeof DropdownMenuItem;
|
|
46
|
+
Label: typeof DropdownMenuLabel;
|
|
47
|
+
Separator: react.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuSeparatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
48
|
+
Portal: react.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
type ButtonStylesProps$1 = VariantProps<typeof buttonStyles$2>;
|
|
52
|
+
declare const buttonStyles$2: (props?: ({
|
|
53
|
+
size?: "xs" | "sm" | null | undefined;
|
|
54
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
55
|
+
type ActionMenuProps = ButtonStylesProps$1 & {
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
container?: Container;
|
|
24
58
|
tabIndex?: number;
|
|
25
59
|
};
|
|
26
|
-
declare function ActionMenu({ children, tabIndex }: ActionMenuProps): JSX.Element;
|
|
60
|
+
declare function ActionMenu({ children, container, tabIndex, size }: ActionMenuProps): JSX.Element;
|
|
27
61
|
declare namespace ActionMenu {
|
|
28
62
|
var Item: typeof Item;
|
|
29
63
|
var Separator: typeof Separator;
|
|
@@ -184,33 +218,6 @@ declare function showInfo(delegated: DialogFuncProps): {
|
|
|
184
218
|
};
|
|
185
219
|
declare function destroyAll(): void;
|
|
186
220
|
|
|
187
|
-
type DropdownMenuItemProps = DropdownMenuPrimitive.MenuItemProps & {
|
|
188
|
-
children: ReactNode;
|
|
189
|
-
};
|
|
190
|
-
declare function DropdownMenuItem({ children, className, ...delegated }: DropdownMenuItemProps): JSX.Element;
|
|
191
|
-
|
|
192
|
-
type DropdownMenuLabelProps = {
|
|
193
|
-
children: ReactNode;
|
|
194
|
-
};
|
|
195
|
-
declare function DropdownMenuLabel({ children }: DropdownMenuLabelProps): JSX.Element;
|
|
196
|
-
|
|
197
|
-
type DropdownMenuRootProps = DropdownMenuPrimitive.MenuContentProps & {
|
|
198
|
-
children: ReactNode;
|
|
199
|
-
content: ReactNode;
|
|
200
|
-
alignContent?: 'start' | 'center' | 'end';
|
|
201
|
-
disabled?: boolean;
|
|
202
|
-
onOpenChange?: (open: boolean) => void;
|
|
203
|
-
};
|
|
204
|
-
declare function DropdownMenuRoot({ children, content, alignContent, disabled, onOpenChange, ...delegated }: DropdownMenuRootProps): JSX.Element;
|
|
205
|
-
|
|
206
|
-
declare const DropdownMenu: {
|
|
207
|
-
Root: typeof DropdownMenuRoot;
|
|
208
|
-
Item: typeof DropdownMenuItem;
|
|
209
|
-
Label: typeof DropdownMenuLabel;
|
|
210
|
-
Separator: react.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuSeparatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
211
|
-
Portal: react.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
|
|
212
|
-
};
|
|
213
|
-
|
|
214
221
|
type IconButtonStylesProps = VariantProps<typeof buttonStyles>;
|
|
215
222
|
declare const buttonStyles: (props?: ({
|
|
216
223
|
variant?: "default" | "elevate" | null | undefined;
|
|
@@ -484,4 +491,4 @@ declare const tokens: {
|
|
|
484
491
|
card: string;
|
|
485
492
|
};
|
|
486
493
|
|
|
487
|
-
export { ActionMenu, Avatar, Button, ButtonProps, Card, Checkbox, CheckboxProps, CheckboxRef, CrystallizeRichText, CrystallizeRichTextActionMenuItem, Dialog, DropdownMenu, Icon, IconButton, IconButtonProps, InlineRadio, Input, InputWithLabel, Label, Progress, Radio, RichTextEditor, Select, Slider, Spinner, Tag, buttonTokens, cardToken, destroyAll, showConfirm, showDialog, showError, showInfo, showWarning, tokens };
|
|
494
|
+
export { ActionMenu, Avatar, Button, ButtonProps, Card, Checkbox, CheckboxProps, CheckboxRef, Container, CrystallizeRichText, CrystallizeRichTextActionMenuItem, Dialog, DropdownMenu, DropdownMenuRootProps, Icon, IconButton, IconButtonProps, InlineRadio, Input, InputWithLabel, Label, Progress, Radio, RichTextEditor, Select, Slider, Spinner, Tag, buttonTokens, cardToken, destroyAll, showConfirm, showDialog, showError, showInfo, showWarning, tokens };
|
package/dist/index.js
CHANGED
|
@@ -251,6 +251,9 @@ function Card({ children, className, variant, ...delegated }) {
|
|
|
251
251
|
// src/card/index.ts
|
|
252
252
|
var cardToken = "c-card";
|
|
253
253
|
|
|
254
|
+
// src/action-menu/action-menu.tsx
|
|
255
|
+
var import_class_variance_authority7 = require("class-variance-authority");
|
|
256
|
+
|
|
254
257
|
// src/dropdown-menu/index.ts
|
|
255
258
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
256
259
|
|
|
@@ -282,9 +285,10 @@ var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
|
282
285
|
function DropdownMenuRoot({
|
|
283
286
|
children,
|
|
284
287
|
content,
|
|
285
|
-
alignContent = "
|
|
288
|
+
alignContent = "center",
|
|
286
289
|
disabled,
|
|
287
290
|
onOpenChange,
|
|
291
|
+
container,
|
|
288
292
|
...delegated
|
|
289
293
|
}) {
|
|
290
294
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DropdownMenuPrimitive3.Root, {
|
|
@@ -295,12 +299,15 @@ function DropdownMenuRoot({
|
|
|
295
299
|
asChild: true,
|
|
296
300
|
children
|
|
297
301
|
}),
|
|
298
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive3.
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive3.Portal, {
|
|
303
|
+
container,
|
|
304
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive3.Content, {
|
|
305
|
+
align: alignContent,
|
|
306
|
+
sideOffset: 5,
|
|
307
|
+
className: "c-dropdown-menu-content",
|
|
308
|
+
...delegated,
|
|
309
|
+
children: content
|
|
310
|
+
})
|
|
304
311
|
})
|
|
305
312
|
]
|
|
306
313
|
});
|
|
@@ -338,15 +345,28 @@ function Separator2({ className }) {
|
|
|
338
345
|
|
|
339
346
|
// src/action-menu/action-menu.tsx
|
|
340
347
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
341
|
-
|
|
348
|
+
var buttonStyles2 = (0, import_class_variance_authority7.cva)("c-action-menu", {
|
|
349
|
+
variants: {
|
|
350
|
+
size: {
|
|
351
|
+
xs: "c-action-menu-xs",
|
|
352
|
+
sm: "c-action-menu-sm"
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
defaultVariants: {
|
|
356
|
+
size: "sm"
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
function ActionMenu({ children, container, tabIndex, size }) {
|
|
342
360
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownMenu.Root, {
|
|
343
361
|
content: children,
|
|
344
362
|
alignContent: "center",
|
|
363
|
+
container,
|
|
345
364
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", {
|
|
365
|
+
"aria-label": "more options",
|
|
366
|
+
className: buttonStyles2({ size }),
|
|
367
|
+
"data-testid": "action-menu-button",
|
|
346
368
|
tabIndex,
|
|
347
369
|
type: "button",
|
|
348
|
-
className: "c-action-menu",
|
|
349
|
-
"aria-label": "more options",
|
|
350
370
|
children: [
|
|
351
371
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", {
|
|
352
372
|
className: "sr-only",
|
|
@@ -370,7 +390,7 @@ ActionMenu.Separator = Separator2;
|
|
|
370
390
|
|
|
371
391
|
// src/avatar/avatar.tsx
|
|
372
392
|
var import_react3 = require("react");
|
|
373
|
-
var
|
|
393
|
+
var import_class_variance_authority8 = require("class-variance-authority");
|
|
374
394
|
|
|
375
395
|
// src/avatar/get-initials.ts
|
|
376
396
|
var getInitials = (name) => {
|
|
@@ -381,7 +401,7 @@ var getInitials = (name) => {
|
|
|
381
401
|
|
|
382
402
|
// src/avatar/avatar.tsx
|
|
383
403
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
384
|
-
var avatarClassName = (0,
|
|
404
|
+
var avatarClassName = (0, import_class_variance_authority8.cva)(["c-avatar"], {
|
|
385
405
|
variants: {
|
|
386
406
|
size: {
|
|
387
407
|
md: "c-avatar-md",
|
|
@@ -443,7 +463,7 @@ var destroyFns = [];
|
|
|
443
463
|
|
|
444
464
|
// src/dialog/dialog.tsx
|
|
445
465
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
|
|
446
|
-
var
|
|
466
|
+
var import_class_variance_authority9 = require("class-variance-authority");
|
|
447
467
|
|
|
448
468
|
// src/iconography/add.tsx
|
|
449
469
|
var import_react5 = require("react");
|
|
@@ -2972,7 +2992,7 @@ var IconMap = {
|
|
|
2972
2992
|
info: Icon.Info,
|
|
2973
2993
|
warning: Icon.Warning
|
|
2974
2994
|
};
|
|
2975
|
-
var dialogContentStyles = (0,
|
|
2995
|
+
var dialogContentStyles = (0, import_class_variance_authority9.cva)("c-dialog", {
|
|
2976
2996
|
variants: {
|
|
2977
2997
|
withIcon: {
|
|
2978
2998
|
true: "c-dialog-with-icon"
|
|
@@ -3022,7 +3042,7 @@ function DialogContent({ children, closable = true, type, className, container,
|
|
|
3022
3042
|
}
|
|
3023
3043
|
function DialogTitle({ className, ...delegated }) {
|
|
3024
3044
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DialogPrimitive.Title, {
|
|
3025
|
-
className: (0,
|
|
3045
|
+
className: (0, import_class_variance_authority9.cx)("c-dialog-title", className),
|
|
3026
3046
|
...delegated
|
|
3027
3047
|
});
|
|
3028
3048
|
}
|
|
@@ -3263,9 +3283,9 @@ function destroyAll() {
|
|
|
3263
3283
|
|
|
3264
3284
|
// src/icon-button/icon-button.tsx
|
|
3265
3285
|
var import_react54 = require("react");
|
|
3266
|
-
var
|
|
3286
|
+
var import_class_variance_authority10 = require("class-variance-authority");
|
|
3267
3287
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
3268
|
-
var
|
|
3288
|
+
var buttonStyles3 = (0, import_class_variance_authority10.cva)(["c-icon-button"], {
|
|
3269
3289
|
variants: {
|
|
3270
3290
|
variant: {
|
|
3271
3291
|
default: "",
|
|
@@ -3289,7 +3309,7 @@ var IconButton = (0, import_react54.forwardRef)(
|
|
|
3289
3309
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", {
|
|
3290
3310
|
ref,
|
|
3291
3311
|
type,
|
|
3292
|
-
className:
|
|
3312
|
+
className: buttonStyles3({ size, variant, className }),
|
|
3293
3313
|
...delegated,
|
|
3294
3314
|
children
|
|
3295
3315
|
});
|
|
@@ -3299,9 +3319,9 @@ IconButton.displayName = "Button";
|
|
|
3299
3319
|
|
|
3300
3320
|
// src/inline-radio/inline-radio.tsx
|
|
3301
3321
|
var RadioGroupPrimitive = __toESM(require("@radix-ui/react-radio-group"));
|
|
3302
|
-
var
|
|
3322
|
+
var import_class_variance_authority11 = require("class-variance-authority");
|
|
3303
3323
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
3304
|
-
var inlineRadioGroupStyles = (0,
|
|
3324
|
+
var inlineRadioGroupStyles = (0, import_class_variance_authority11.cva)("c-inline-radio-group", {
|
|
3305
3325
|
variants: {
|
|
3306
3326
|
size: {
|
|
3307
3327
|
xs: "c-inline-radio-group-xs",
|
|
@@ -3323,7 +3343,7 @@ function InlineRadioGroup({ size, className, ...delegated }) {
|
|
|
3323
3343
|
function InlineRadioItem({ children, className, ...delegated }) {
|
|
3324
3344
|
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(RadioGroupPrimitive.Item, {
|
|
3325
3345
|
...delegated,
|
|
3326
|
-
className: (0,
|
|
3346
|
+
className: (0, import_class_variance_authority11.cx)("c-inline-radio", className),
|
|
3327
3347
|
children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(RadioGroupPrimitive.Indicator, {
|
|
3328
3348
|
forceMount: true,
|
|
3329
3349
|
children
|
|
@@ -3337,13 +3357,13 @@ var InlineRadio = {
|
|
|
3337
3357
|
|
|
3338
3358
|
// src/input-with-label/input-with-label.tsx
|
|
3339
3359
|
var import_react58 = require("react");
|
|
3340
|
-
var
|
|
3360
|
+
var import_class_variance_authority14 = require("class-variance-authority");
|
|
3341
3361
|
|
|
3342
3362
|
// src/input/input.tsx
|
|
3343
|
-
var
|
|
3363
|
+
var import_class_variance_authority12 = require("class-variance-authority");
|
|
3344
3364
|
var import_react55 = require("react");
|
|
3345
3365
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
3346
|
-
var inputStyles = (0,
|
|
3366
|
+
var inputStyles = (0, import_class_variance_authority12.cva)(["c-input"], {
|
|
3347
3367
|
variants: {},
|
|
3348
3368
|
defaultVariants: {}
|
|
3349
3369
|
});
|
|
@@ -3359,12 +3379,12 @@ Input.displayName = "Input";
|
|
|
3359
3379
|
|
|
3360
3380
|
// src/label/label.tsx
|
|
3361
3381
|
var import_react56 = require("react");
|
|
3362
|
-
var
|
|
3382
|
+
var import_class_variance_authority13 = require("class-variance-authority");
|
|
3363
3383
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
3364
3384
|
var Label2 = (0, import_react56.forwardRef)(({ className, ...delegated }, ref) => {
|
|
3365
3385
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("label", {
|
|
3366
3386
|
ref,
|
|
3367
|
-
className: (0,
|
|
3387
|
+
className: (0, import_class_variance_authority13.cx)("c-label", className),
|
|
3368
3388
|
...delegated
|
|
3369
3389
|
});
|
|
3370
3390
|
});
|
|
@@ -3393,7 +3413,7 @@ var Triangle = (0, import_react57.forwardRef)((delegated, ref) => {
|
|
|
3393
3413
|
|
|
3394
3414
|
// src/input-with-label/input-with-label.tsx
|
|
3395
3415
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
3396
|
-
var inputWithLabelStyles = (0,
|
|
3416
|
+
var inputWithLabelStyles = (0, import_class_variance_authority14.cva)(["c-input-with-label"], {
|
|
3397
3417
|
variants: {
|
|
3398
3418
|
variant: {
|
|
3399
3419
|
default: "",
|
|
@@ -3420,7 +3440,7 @@ var InputWithLabel = (0, import_react58.forwardRef)(
|
|
|
3420
3440
|
className: "c-input-with-label-input-wrap",
|
|
3421
3441
|
children: [
|
|
3422
3442
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Input, {
|
|
3423
|
-
className: (0,
|
|
3443
|
+
className: (0, import_class_variance_authority14.cx)("c-input-with-label-input", className),
|
|
3424
3444
|
ref,
|
|
3425
3445
|
id,
|
|
3426
3446
|
...delegated
|
|
@@ -3441,11 +3461,11 @@ InputWithLabel.displayName = "InputWithLabel";
|
|
|
3441
3461
|
|
|
3442
3462
|
// src/progress/progress.tsx
|
|
3443
3463
|
var ProgressPrimitives = __toESM(require("@radix-ui/react-progress"));
|
|
3444
|
-
var
|
|
3464
|
+
var import_class_variance_authority15 = require("class-variance-authority");
|
|
3445
3465
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
3446
3466
|
function Progress({ className, value }) {
|
|
3447
3467
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ProgressPrimitives.Root, {
|
|
3448
|
-
className: (0,
|
|
3468
|
+
className: (0, import_class_variance_authority15.cx)(className, "c-progress-root"),
|
|
3449
3469
|
value,
|
|
3450
3470
|
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ProgressPrimitives.Indicator, {
|
|
3451
3471
|
className: "c-progress-indicator",
|
|
@@ -3494,9 +3514,9 @@ SelectItem.displayName = "SelectItem";
|
|
|
3494
3514
|
// src/select/select-root.tsx
|
|
3495
3515
|
var import_react60 = require("react");
|
|
3496
3516
|
var SelectPrimitives2 = __toESM(require("@radix-ui/react-select"));
|
|
3497
|
-
var
|
|
3517
|
+
var import_class_variance_authority16 = require("class-variance-authority");
|
|
3498
3518
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
3499
|
-
var selectTriggerStyles = (0,
|
|
3519
|
+
var selectTriggerStyles = (0, import_class_variance_authority16.cva)("c-select-trigger", {
|
|
3500
3520
|
variants: {
|
|
3501
3521
|
size: {
|
|
3502
3522
|
xs: "c-select-trigger-xs",
|
|
@@ -3556,12 +3576,12 @@ var Select = {
|
|
|
3556
3576
|
|
|
3557
3577
|
// src/slider/slider.tsx
|
|
3558
3578
|
var SliderPrimitive = __toESM(require("@radix-ui/react-slider"));
|
|
3559
|
-
var
|
|
3579
|
+
var import_class_variance_authority17 = require("class-variance-authority");
|
|
3560
3580
|
var import_react61 = require("react");
|
|
3561
3581
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
3562
3582
|
var Slider = (0, import_react61.forwardRef)(({ className, transparentRange, ...delegated }, ref) => {
|
|
3563
3583
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(SliderPrimitive.Root, {
|
|
3564
|
-
className: (0,
|
|
3584
|
+
className: (0, import_class_variance_authority17.cx)("c-slider-root", className),
|
|
3565
3585
|
ref,
|
|
3566
3586
|
...delegated,
|
|
3567
3587
|
children: [
|
|
@@ -3579,9 +3599,9 @@ var Slider = (0, import_react61.forwardRef)(({ className, transparentRange, ...d
|
|
|
3579
3599
|
});
|
|
3580
3600
|
|
|
3581
3601
|
// src/tag/tag.tsx
|
|
3582
|
-
var
|
|
3602
|
+
var import_class_variance_authority18 = require("class-variance-authority");
|
|
3583
3603
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
3584
|
-
var tagStyles = (0,
|
|
3604
|
+
var tagStyles = (0, import_class_variance_authority18.cva)("c-tag", {
|
|
3585
3605
|
variants: {
|
|
3586
3606
|
variant: {
|
|
3587
3607
|
default: "",
|
|
@@ -3601,7 +3621,7 @@ function Tag({ children, className, variant, ...delegated }) {
|
|
|
3601
3621
|
}
|
|
3602
3622
|
|
|
3603
3623
|
// src/rich-text-editor/rich-text-editor.tsx
|
|
3604
|
-
var
|
|
3624
|
+
var import_react78 = require("react");
|
|
3605
3625
|
var import_LexicalAutoFocusPlugin = require("@lexical/react/LexicalAutoFocusPlugin");
|
|
3606
3626
|
var import_LexicalClearEditorPlugin = require("@lexical/react/LexicalClearEditorPlugin");
|
|
3607
3627
|
var import_LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
@@ -5712,7 +5732,7 @@ function TableActionMenuPlugin({
|
|
|
5712
5732
|
}
|
|
5713
5733
|
|
|
5714
5734
|
// src/rich-text-editor/plugins/ToolbarPlugin/index.tsx
|
|
5715
|
-
var
|
|
5735
|
+
var import_react77 = require("react");
|
|
5716
5736
|
var import_lexical16 = require("lexical");
|
|
5717
5737
|
var import_code9 = require("@lexical/code");
|
|
5718
5738
|
var import_link6 = require("@lexical/link");
|
|
@@ -5725,6 +5745,7 @@ var import_selection3 = require("@lexical/selection");
|
|
|
5725
5745
|
var import_utils4 = require("@lexical/utils");
|
|
5726
5746
|
|
|
5727
5747
|
// src/rich-text-editor/plugins/ActionsPlugin/index.tsx
|
|
5748
|
+
var import_react75 = require("react");
|
|
5728
5749
|
var import_lexical15 = require("lexical");
|
|
5729
5750
|
var import_LexicalComposerContext10 = require("@lexical/react/LexicalComposerContext");
|
|
5730
5751
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
@@ -5742,11 +5763,14 @@ function ActionsPlugin({
|
|
|
5742
5763
|
}) {
|
|
5743
5764
|
const [editor] = (0, import_LexicalComposerContext10.useLexicalComposerContext)();
|
|
5744
5765
|
const tr = useTr();
|
|
5766
|
+
const actionMenuAnchorRef = (0, import_react75.useRef)(null);
|
|
5745
5767
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", {
|
|
5768
|
+
ref: actionMenuAnchorRef,
|
|
5746
5769
|
className: "z-50 flex items-center ",
|
|
5747
5770
|
children: [
|
|
5748
5771
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", {}),
|
|
5749
5772
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(ActionMenu, {
|
|
5773
|
+
container: actionMenuAnchorRef.current,
|
|
5750
5774
|
children: [
|
|
5751
5775
|
!prepend ? null : prepend.map((actionItem) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ActionMenu.Item, {
|
|
5752
5776
|
onSelect: actionItem.action,
|
|
@@ -5777,12 +5801,12 @@ function ActionsPlugin({
|
|
|
5777
5801
|
}
|
|
5778
5802
|
|
|
5779
5803
|
// src/rich-text-editor/plugins/ToolbarPlugin/insert-table.tsx
|
|
5780
|
-
var
|
|
5804
|
+
var import_react76 = require("react");
|
|
5781
5805
|
var import_table5 = require("@lexical/table");
|
|
5782
5806
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
5783
5807
|
function InsertTableDialog({ activeEditor }) {
|
|
5784
|
-
const [rows, setRows] = (0,
|
|
5785
|
-
const [columns, setColumns] = (0,
|
|
5808
|
+
const [rows, setRows] = (0, import_react76.useState)("5");
|
|
5809
|
+
const [columns, setColumns] = (0, import_react76.useState)("5");
|
|
5786
5810
|
const tr = useTr();
|
|
5787
5811
|
const onClick = () => {
|
|
5788
5812
|
if (parseInt(rows) < 1 || parseInt(columns) < 1) {
|
|
@@ -6050,23 +6074,23 @@ function ToolbarPlugin({
|
|
|
6050
6074
|
actionsMenuAppend
|
|
6051
6075
|
}) {
|
|
6052
6076
|
const [editor] = (0, import_LexicalComposerContext11.useLexicalComposerContext)();
|
|
6053
|
-
const [activeEditor, setActiveEditor] = (0,
|
|
6054
|
-
const [blockType, setBlockType] = (0,
|
|
6055
|
-
const [selectedElementKey, setSelectedElementKey] = (0,
|
|
6056
|
-
const [isLink, setIsLink] = (0,
|
|
6057
|
-
const [isBold, setIsBold] = (0,
|
|
6058
|
-
const [isItalic, setIsItalic] = (0,
|
|
6059
|
-
const [isUnderline, setIsUnderline] = (0,
|
|
6060
|
-
const [isStrikethrough, setIsStrikethrough] = (0,
|
|
6061
|
-
const [isSubscript, setIsSubscript] = (0,
|
|
6062
|
-
const [isSuperscript, setIsSuperscript] = (0,
|
|
6063
|
-
const [isCode, setIsCode] = (0,
|
|
6064
|
-
const [canUndo, setCanUndo] = (0,
|
|
6065
|
-
const [canRedo, setCanRedo] = (0,
|
|
6077
|
+
const [activeEditor, setActiveEditor] = (0, import_react77.useState)(editor);
|
|
6078
|
+
const [blockType, setBlockType] = (0, import_react77.useState)("paragraph");
|
|
6079
|
+
const [selectedElementKey, setSelectedElementKey] = (0, import_react77.useState)(null);
|
|
6080
|
+
const [isLink, setIsLink] = (0, import_react77.useState)(false);
|
|
6081
|
+
const [isBold, setIsBold] = (0, import_react77.useState)(false);
|
|
6082
|
+
const [isItalic, setIsItalic] = (0, import_react77.useState)(false);
|
|
6083
|
+
const [isUnderline, setIsUnderline] = (0, import_react77.useState)(false);
|
|
6084
|
+
const [isStrikethrough, setIsStrikethrough] = (0, import_react77.useState)(false);
|
|
6085
|
+
const [isSubscript, setIsSubscript] = (0, import_react77.useState)(false);
|
|
6086
|
+
const [isSuperscript, setIsSuperscript] = (0, import_react77.useState)(false);
|
|
6087
|
+
const [isCode, setIsCode] = (0, import_react77.useState)(false);
|
|
6088
|
+
const [canUndo, setCanUndo] = (0, import_react77.useState)(false);
|
|
6089
|
+
const [canRedo, setCanRedo] = (0, import_react77.useState)(false);
|
|
6066
6090
|
const tr = useTr();
|
|
6067
|
-
const [codeLanguage, setCodeLanguage] = (0,
|
|
6068
|
-
const [isEditable, setIsEditable] = (0,
|
|
6069
|
-
const updateToolbar = (0,
|
|
6091
|
+
const [codeLanguage, setCodeLanguage] = (0, import_react77.useState)("");
|
|
6092
|
+
const [isEditable, setIsEditable] = (0, import_react77.useState)(() => editor.isEditable());
|
|
6093
|
+
const updateToolbar = (0, import_react77.useCallback)(() => {
|
|
6070
6094
|
const selection = (0, import_lexical16.$getSelection)();
|
|
6071
6095
|
if ((0, import_lexical16.$isRangeSelection)(selection)) {
|
|
6072
6096
|
const anchorNode = selection.anchor.getNode();
|
|
@@ -6113,7 +6137,7 @@ function ToolbarPlugin({
|
|
|
6113
6137
|
}
|
|
6114
6138
|
}
|
|
6115
6139
|
}, [activeEditor]);
|
|
6116
|
-
(0,
|
|
6140
|
+
(0, import_react77.useEffect)(() => {
|
|
6117
6141
|
return editor.registerCommand(
|
|
6118
6142
|
import_lexical16.SELECTION_CHANGE_COMMAND,
|
|
6119
6143
|
(_payload, newEditor) => {
|
|
@@ -6124,7 +6148,7 @@ function ToolbarPlugin({
|
|
|
6124
6148
|
import_lexical16.COMMAND_PRIORITY_CRITICAL
|
|
6125
6149
|
);
|
|
6126
6150
|
}, [editor, updateToolbar]);
|
|
6127
|
-
(0,
|
|
6151
|
+
(0, import_react77.useEffect)(() => {
|
|
6128
6152
|
return (0, import_utils4.mergeRegister)(
|
|
6129
6153
|
editor.registerEditableListener((editable) => {
|
|
6130
6154
|
setIsEditable(editable);
|
|
@@ -6152,7 +6176,7 @@ function ToolbarPlugin({
|
|
|
6152
6176
|
)
|
|
6153
6177
|
);
|
|
6154
6178
|
}, [activeEditor, editor, updateToolbar]);
|
|
6155
|
-
const clearFormatting = (0,
|
|
6179
|
+
const clearFormatting = (0, import_react77.useCallback)(() => {
|
|
6156
6180
|
activeEditor.update(() => {
|
|
6157
6181
|
const selection = (0, import_lexical16.$getSelection)();
|
|
6158
6182
|
if ((0, import_lexical16.$isRangeSelection)(selection)) {
|
|
@@ -6170,14 +6194,14 @@ function ToolbarPlugin({
|
|
|
6170
6194
|
}
|
|
6171
6195
|
});
|
|
6172
6196
|
}, [activeEditor]);
|
|
6173
|
-
const insertLink = (0,
|
|
6197
|
+
const insertLink = (0, import_react77.useCallback)(() => {
|
|
6174
6198
|
if (!isLink) {
|
|
6175
6199
|
editor.dispatchCommand(import_link6.TOGGLE_LINK_COMMAND, sanitizeUrl("https://"));
|
|
6176
6200
|
} else {
|
|
6177
6201
|
editor.dispatchCommand(import_link6.TOGGLE_LINK_COMMAND, null);
|
|
6178
6202
|
}
|
|
6179
6203
|
}, [editor, isLink]);
|
|
6180
|
-
const onCodeLanguageSelect = (0,
|
|
6204
|
+
const onCodeLanguageSelect = (0, import_react77.useCallback)(
|
|
6181
6205
|
(value) => {
|
|
6182
6206
|
activeEditor.update(() => {
|
|
6183
6207
|
if (selectedElementKey !== null) {
|
|
@@ -6641,18 +6665,18 @@ function RichTextEditorWithoutContext({
|
|
|
6641
6665
|
children: placeholderText ?? ""
|
|
6642
6666
|
});
|
|
6643
6667
|
const [editor] = (0, import_LexicalComposerContext12.useLexicalComposerContext)();
|
|
6644
|
-
const [floatingAnchorElem, setFloatingAnchorElem] = (0,
|
|
6645
|
-
const [isSmallWidthViewport, setIsSmallWidthViewport] = (0,
|
|
6646
|
-
const firstOnChangeTriggeredRef = (0,
|
|
6668
|
+
const [floatingAnchorElem, setFloatingAnchorElem] = (0, import_react78.useState)(null);
|
|
6669
|
+
const [isSmallWidthViewport, setIsSmallWidthViewport] = (0, import_react78.useState)(false);
|
|
6670
|
+
const firstOnChangeTriggeredRef = (0, import_react78.useRef)(!autoFocus);
|
|
6647
6671
|
const onRef = (_floatingAnchorElem) => {
|
|
6648
6672
|
if (_floatingAnchorElem !== null) {
|
|
6649
6673
|
setFloatingAnchorElem(_floatingAnchorElem);
|
|
6650
6674
|
}
|
|
6651
6675
|
};
|
|
6652
|
-
(0,
|
|
6676
|
+
(0, import_react78.useEffect)(() => {
|
|
6653
6677
|
editor.setEditable(editable || false);
|
|
6654
6678
|
}, [editable, editor]);
|
|
6655
|
-
(0,
|
|
6679
|
+
(0, import_react78.useEffect)(() => {
|
|
6656
6680
|
const updateViewPortWidth = () => {
|
|
6657
6681
|
const isNextSmallWidthViewport = window.matchMedia("(max-width: 1025px)").matches;
|
|
6658
6682
|
if (isNextSmallWidthViewport !== isSmallWidthViewport) {
|