@uipath/apollo-wind 2.42.0 → 2.43.1
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/dist/components/ui/combobox.cjs +1 -1
- package/dist/components/ui/combobox.js +1 -1
- package/dist/components/ui/dropdown-menu.cjs +12 -2
- package/dist/components/ui/dropdown-menu.d.ts +8 -1
- package/dist/components/ui/dropdown-menu.js +12 -2
- package/dist/components/ui/index.cjs +22 -22
- package/dist/components/ui/label.cjs +2 -2
- package/dist/components/ui/label.d.ts +4 -4
- package/dist/components/ui/label.js +2 -2
- package/dist/components/ui/multi-select.cjs +2 -2
- package/dist/components/ui/multi-select.js +2 -2
- package/dist/components/ui/prompt-editor/components/EditorToolbar.cjs +3 -3
- package/dist/components/ui/prompt-editor/components/EditorToolbar.d.ts +2 -1
- package/dist/components/ui/prompt-editor/components/EditorToolbar.js +3 -3
- package/dist/components/ui/prompt-editor/prompt-editor.cjs +30 -7
- package/dist/components/ui/prompt-editor/prompt-editor.d.ts +9 -1
- package/dist/components/ui/prompt-editor/prompt-editor.js +31 -8
- package/dist/styles.css +17 -6
- package/package.json +1 -1
|
@@ -50,7 +50,7 @@ const combobox_Combobox = /*#__PURE__*/ external_react_namespaceObject.forwardRe
|
|
|
50
50
|
role: "combobox",
|
|
51
51
|
"aria-expanded": open,
|
|
52
52
|
"aria-label": selectedItem ? selectedItem.label : placeholder,
|
|
53
|
-
className: (0, index_cjs_namespaceObject.cn)('w-[280px] justify-between future:rounded-xl future:border-0 future:bg-surface-overlay future:hover:bg-surface-hover future:font-normal future:text-muted-foreground', className),
|
|
53
|
+
className: (0, index_cjs_namespaceObject.cn)('w-[280px] justify-between future:h-10 future:rounded-xl future:border-0 future:bg-surface-overlay future:px-4 future:gap-4 future:hover:bg-surface-hover future:font-normal future:text-muted-foreground future:focus-visible:ring-offset-2 future:focus-visible:ring-offset-background', className),
|
|
54
54
|
disabled: disabled,
|
|
55
55
|
children: [
|
|
56
56
|
selectedItem ? selectedItem.label : placeholder,
|
|
@@ -22,7 +22,7 @@ const combobox_Combobox = /*#__PURE__*/ forwardRef(function({ items, value, onVa
|
|
|
22
22
|
role: "combobox",
|
|
23
23
|
"aria-expanded": open,
|
|
24
24
|
"aria-label": selectedItem ? selectedItem.label : placeholder,
|
|
25
|
-
className: cn('w-[280px] justify-between future:rounded-xl future:border-0 future:bg-surface-overlay future:hover:bg-surface-hover future:font-normal future:text-muted-foreground', className),
|
|
25
|
+
className: cn('w-[280px] justify-between future:h-10 future:rounded-xl future:border-0 future:bg-surface-overlay future:px-4 future:gap-4 future:hover:bg-surface-hover future:font-normal future:text-muted-foreground future:focus-visible:ring-offset-2 future:focus-visible:ring-offset-background', className),
|
|
26
26
|
disabled: disabled,
|
|
27
27
|
children: [
|
|
28
28
|
selectedItem ? selectedItem.label : placeholder,
|
|
@@ -52,11 +52,21 @@ const DropdownMenu = (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)
|
|
|
52
52
|
...props
|
|
53
53
|
});
|
|
54
54
|
DropdownMenu.displayName = 'DropdownMenu';
|
|
55
|
-
const DropdownMenuTrigger = /*#__PURE__*/ external_react_namespaceObject.forwardRef((
|
|
55
|
+
const DropdownMenuTrigger = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, field, error, errorId, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'aria-errormessage': ariaErrorMessage, ...props }, ref)=>{
|
|
56
|
+
const describedBy = [
|
|
57
|
+
ariaDescribedBy,
|
|
58
|
+
error ? errorId : void 0
|
|
59
|
+
].filter(Boolean).join(' ');
|
|
60
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_dropdown_menu_namespaceObject.Trigger, {
|
|
56
61
|
ref: ref,
|
|
57
62
|
"data-slot": "dropdown-menu-trigger",
|
|
63
|
+
className: (0, index_cjs_namespaceObject.cn)(field && 'future:h-10 future:rounded-xl future:border-0 future:bg-surface-overlay future:px-4 future:gap-4 future:font-normal future:text-muted-foreground future:hover:bg-surface-hover', error && 'border-error ring-1 ring-error/20 future:ring-error/40', className),
|
|
64
|
+
"aria-describedby": describedBy || void 0,
|
|
65
|
+
"aria-errormessage": error ? errorId ?? ariaErrorMessage : ariaErrorMessage,
|
|
66
|
+
"aria-invalid": error ? true : ariaInvalid,
|
|
58
67
|
...props
|
|
59
|
-
})
|
|
68
|
+
});
|
|
69
|
+
});
|
|
60
70
|
DropdownMenuTrigger.displayName = react_dropdown_menu_namespaceObject.Trigger.displayName;
|
|
61
71
|
const DropdownMenuGroup = /*#__PURE__*/ external_react_namespaceObject.forwardRef((props, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_dropdown_menu_namespaceObject.Group, {
|
|
62
72
|
ref: ref,
|
|
@@ -5,7 +5,14 @@ declare const DropdownMenu: {
|
|
|
5
5
|
(props: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
displayName: string;
|
|
7
7
|
};
|
|
8
|
-
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> &
|
|
8
|
+
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
9
|
+
/** Apply the Future theme field treatment when the trigger is used as a form control. */
|
|
10
|
+
field?: boolean;
|
|
11
|
+
/** Field-specific validation feedback rendered below the trigger by the consumer. */
|
|
12
|
+
error?: React.ReactNode;
|
|
13
|
+
/** Optional id for the validation message referenced by aria-describedby. */
|
|
14
|
+
errorId?: string;
|
|
15
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
9
16
|
declare const DropdownMenuGroup: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
17
|
declare const DropdownMenuPortal: {
|
|
11
18
|
(props: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,11 +10,21 @@ const DropdownMenu = (props)=>/*#__PURE__*/ jsx(Root, {
|
|
|
10
10
|
...props
|
|
11
11
|
});
|
|
12
12
|
DropdownMenu.displayName = 'DropdownMenu';
|
|
13
|
-
const DropdownMenuTrigger = /*#__PURE__*/ forwardRef((props, ref)
|
|
13
|
+
const DropdownMenuTrigger = /*#__PURE__*/ forwardRef(({ className, field, error, errorId, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'aria-errormessage': ariaErrorMessage, ...props }, ref)=>{
|
|
14
|
+
const describedBy = [
|
|
15
|
+
ariaDescribedBy,
|
|
16
|
+
error ? errorId : void 0
|
|
17
|
+
].filter(Boolean).join(' ');
|
|
18
|
+
return /*#__PURE__*/ jsx(Trigger, {
|
|
14
19
|
ref: ref,
|
|
15
20
|
"data-slot": "dropdown-menu-trigger",
|
|
21
|
+
className: cn(field && 'future:h-10 future:rounded-xl future:border-0 future:bg-surface-overlay future:px-4 future:gap-4 future:font-normal future:text-muted-foreground future:hover:bg-surface-hover', error && 'border-error ring-1 ring-error/20 future:ring-error/40', className),
|
|
22
|
+
"aria-describedby": describedBy || void 0,
|
|
23
|
+
"aria-errormessage": error ? errorId ?? ariaErrorMessage : ariaErrorMessage,
|
|
24
|
+
"aria-invalid": error ? true : ariaInvalid,
|
|
16
25
|
...props
|
|
17
|
-
})
|
|
26
|
+
});
|
|
27
|
+
});
|
|
18
28
|
DropdownMenuTrigger.displayName = Trigger.displayName;
|
|
19
29
|
const DropdownMenuGroup = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx(Group, {
|
|
20
30
|
ref: ref,
|
|
@@ -15,7 +15,7 @@ var __webpack_modules__ = {
|
|
|
15
15
|
"./avatar" (module) {
|
|
16
16
|
module.exports = require("./avatar.cjs");
|
|
17
17
|
},
|
|
18
|
-
"
|
|
18
|
+
"@/components/ui/badge" (module) {
|
|
19
19
|
module.exports = require("./badge.cjs");
|
|
20
20
|
},
|
|
21
21
|
"./breadcrumb" (module) {
|
|
@@ -27,7 +27,7 @@ var __webpack_modules__ = {
|
|
|
27
27
|
"@/components/ui/button" (module) {
|
|
28
28
|
module.exports = require("./button.cjs");
|
|
29
29
|
},
|
|
30
|
-
"
|
|
30
|
+
"./calendar" (module) {
|
|
31
31
|
module.exports = require("./calendar.cjs");
|
|
32
32
|
},
|
|
33
33
|
"./card" (module) {
|
|
@@ -36,10 +36,10 @@ var __webpack_modules__ = {
|
|
|
36
36
|
"./chart" (module) {
|
|
37
37
|
module.exports = require("./chart.cjs");
|
|
38
38
|
},
|
|
39
|
-
"
|
|
39
|
+
"@/components/ui/checkbox" (module) {
|
|
40
40
|
module.exports = require("./checkbox.cjs");
|
|
41
41
|
},
|
|
42
|
-
"
|
|
42
|
+
"@/components/ui/collapsible" (module) {
|
|
43
43
|
module.exports = require("./collapsible.cjs");
|
|
44
44
|
},
|
|
45
45
|
"./combobox" (module) {
|
|
@@ -48,7 +48,7 @@ var __webpack_modules__ = {
|
|
|
48
48
|
"@/components/ui/command" (module) {
|
|
49
49
|
module.exports = require("./command.cjs");
|
|
50
50
|
},
|
|
51
|
-
"
|
|
51
|
+
"@/components/ui/context-menu" (module) {
|
|
52
52
|
module.exports = require("./context-menu.cjs");
|
|
53
53
|
},
|
|
54
54
|
"./data-table" (module) {
|
|
@@ -66,10 +66,10 @@ var __webpack_modules__ = {
|
|
|
66
66
|
"./drawer" (module) {
|
|
67
67
|
module.exports = require("./drawer.cjs");
|
|
68
68
|
},
|
|
69
|
-
"
|
|
69
|
+
"@/components/ui/dropdown-menu" (module) {
|
|
70
70
|
module.exports = require("./dropdown-menu.cjs");
|
|
71
71
|
},
|
|
72
|
-
"
|
|
72
|
+
"@/components/ui/editable-cell" (module) {
|
|
73
73
|
module.exports = require("./editable-cell.cjs");
|
|
74
74
|
},
|
|
75
75
|
"./empty-state" (module) {
|
|
@@ -81,16 +81,16 @@ var __webpack_modules__ = {
|
|
|
81
81
|
"./form-field" (module) {
|
|
82
82
|
module.exports = require("./form-field.cjs");
|
|
83
83
|
},
|
|
84
|
-
"
|
|
84
|
+
"@/components/ui/hover-card" (module) {
|
|
85
85
|
module.exports = require("./hover-card.cjs");
|
|
86
86
|
},
|
|
87
87
|
"@/components/ui/input-group" (module) {
|
|
88
88
|
module.exports = require("./input-group.cjs");
|
|
89
89
|
},
|
|
90
|
-
"
|
|
90
|
+
"@/components/ui/input" (module) {
|
|
91
91
|
module.exports = require("./input.cjs");
|
|
92
92
|
},
|
|
93
|
-
"
|
|
93
|
+
"@/components/ui/label" (module) {
|
|
94
94
|
module.exports = require("./label.cjs");
|
|
95
95
|
},
|
|
96
96
|
"./layout" (module) {
|
|
@@ -165,7 +165,7 @@ var __webpack_modules__ = {
|
|
|
165
165
|
"./tabs" (module) {
|
|
166
166
|
module.exports = require("./tabs.cjs");
|
|
167
167
|
},
|
|
168
|
-
"
|
|
168
|
+
"@/components/ui/textarea" (module) {
|
|
169
169
|
module.exports = require("./textarea.cjs");
|
|
170
170
|
},
|
|
171
171
|
"./toggle-group" (module) {
|
|
@@ -265,7 +265,7 @@ var __webpack_exports__ = {};
|
|
|
265
265
|
"default"
|
|
266
266
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_avatar__rspack_import_4[__rspack_import_key];
|
|
267
267
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
268
|
-
var _badge__rspack_import_5 = __webpack_require__("
|
|
268
|
+
var _badge__rspack_import_5 = __webpack_require__("@/components/ui/badge");
|
|
269
269
|
var __rspack_reexport = {};
|
|
270
270
|
for(const __rspack_import_key in _badge__rspack_import_5)if ([
|
|
271
271
|
"TreeView",
|
|
@@ -293,7 +293,7 @@ var __webpack_exports__ = {};
|
|
|
293
293
|
"default"
|
|
294
294
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_button_group__rspack_import_8[__rspack_import_key];
|
|
295
295
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
296
|
-
var _calendar__rspack_import_9 = __webpack_require__("
|
|
296
|
+
var _calendar__rspack_import_9 = __webpack_require__("./calendar");
|
|
297
297
|
var __rspack_reexport = {};
|
|
298
298
|
for(const __rspack_import_key in _calendar__rspack_import_9)if ([
|
|
299
299
|
"TreeView",
|
|
@@ -314,14 +314,14 @@ var __webpack_exports__ = {};
|
|
|
314
314
|
"default"
|
|
315
315
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_chart__rspack_import_11[__rspack_import_key];
|
|
316
316
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
317
|
-
var _checkbox__rspack_import_12 = __webpack_require__("
|
|
317
|
+
var _checkbox__rspack_import_12 = __webpack_require__("@/components/ui/checkbox");
|
|
318
318
|
var __rspack_reexport = {};
|
|
319
319
|
for(const __rspack_import_key in _checkbox__rspack_import_12)if ([
|
|
320
320
|
"TreeView",
|
|
321
321
|
"default"
|
|
322
322
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_checkbox__rspack_import_12[__rspack_import_key];
|
|
323
323
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
324
|
-
var _collapsible__rspack_import_13 = __webpack_require__("
|
|
324
|
+
var _collapsible__rspack_import_13 = __webpack_require__("@/components/ui/collapsible");
|
|
325
325
|
var __rspack_reexport = {};
|
|
326
326
|
for(const __rspack_import_key in _collapsible__rspack_import_13)if ([
|
|
327
327
|
"TreeView",
|
|
@@ -342,7 +342,7 @@ var __webpack_exports__ = {};
|
|
|
342
342
|
"default"
|
|
343
343
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_command__rspack_import_15[__rspack_import_key];
|
|
344
344
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
345
|
-
var _context_menu__rspack_import_16 = __webpack_require__("
|
|
345
|
+
var _context_menu__rspack_import_16 = __webpack_require__("@/components/ui/context-menu");
|
|
346
346
|
var __rspack_reexport = {};
|
|
347
347
|
for(const __rspack_import_key in _context_menu__rspack_import_16)if ([
|
|
348
348
|
"TreeView",
|
|
@@ -384,14 +384,14 @@ var __webpack_exports__ = {};
|
|
|
384
384
|
"default"
|
|
385
385
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_drawer__rspack_import_21[__rspack_import_key];
|
|
386
386
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
387
|
-
var _dropdown_menu__rspack_import_22 = __webpack_require__("
|
|
387
|
+
var _dropdown_menu__rspack_import_22 = __webpack_require__("@/components/ui/dropdown-menu");
|
|
388
388
|
var __rspack_reexport = {};
|
|
389
389
|
for(const __rspack_import_key in _dropdown_menu__rspack_import_22)if ([
|
|
390
390
|
"TreeView",
|
|
391
391
|
"default"
|
|
392
392
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_dropdown_menu__rspack_import_22[__rspack_import_key];
|
|
393
393
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
394
|
-
var _editable_cell__rspack_import_23 = __webpack_require__("
|
|
394
|
+
var _editable_cell__rspack_import_23 = __webpack_require__("@/components/ui/editable-cell");
|
|
395
395
|
var __rspack_reexport = {};
|
|
396
396
|
for(const __rspack_import_key in _editable_cell__rspack_import_23)if ([
|
|
397
397
|
"TreeView",
|
|
@@ -419,14 +419,14 @@ var __webpack_exports__ = {};
|
|
|
419
419
|
"default"
|
|
420
420
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_file_upload__rspack_import_26[__rspack_import_key];
|
|
421
421
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
422
|
-
var _hover_card__rspack_import_27 = __webpack_require__("
|
|
422
|
+
var _hover_card__rspack_import_27 = __webpack_require__("@/components/ui/hover-card");
|
|
423
423
|
var __rspack_reexport = {};
|
|
424
424
|
for(const __rspack_import_key in _hover_card__rspack_import_27)if ([
|
|
425
425
|
"TreeView",
|
|
426
426
|
"default"
|
|
427
427
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_hover_card__rspack_import_27[__rspack_import_key];
|
|
428
428
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
429
|
-
var _input__rspack_import_28 = __webpack_require__("
|
|
429
|
+
var _input__rspack_import_28 = __webpack_require__("@/components/ui/input");
|
|
430
430
|
var __rspack_reexport = {};
|
|
431
431
|
for(const __rspack_import_key in _input__rspack_import_28)if ([
|
|
432
432
|
"TreeView",
|
|
@@ -440,7 +440,7 @@ var __webpack_exports__ = {};
|
|
|
440
440
|
"default"
|
|
441
441
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_input_group__rspack_import_29[__rspack_import_key];
|
|
442
442
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
443
|
-
var _label__rspack_import_30 = __webpack_require__("
|
|
443
|
+
var _label__rspack_import_30 = __webpack_require__("@/components/ui/label");
|
|
444
444
|
var __rspack_reexport = {};
|
|
445
445
|
for(const __rspack_import_key in _label__rspack_import_30)if ([
|
|
446
446
|
"TreeView",
|
|
@@ -615,7 +615,7 @@ var __webpack_exports__ = {};
|
|
|
615
615
|
"default"
|
|
616
616
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_tabs__rspack_import_54[__rspack_import_key];
|
|
617
617
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
618
|
-
var _textarea__rspack_import_55 = __webpack_require__("
|
|
618
|
+
var _textarea__rspack_import_55 = __webpack_require__("@/components/ui/textarea");
|
|
619
619
|
var __rspack_reexport = {};
|
|
620
620
|
for(const __rspack_import_key in _textarea__rspack_import_55)if ([
|
|
621
621
|
"TreeView",
|
|
@@ -53,7 +53,7 @@ const Label = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ classNa
|
|
|
53
53
|
...props
|
|
54
54
|
}));
|
|
55
55
|
Label.displayName = react_label_namespaceObject.Root.displayName;
|
|
56
|
-
const RequiredIndicator = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, srLabel
|
|
56
|
+
const RequiredIndicator = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, srLabel, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
|
|
57
57
|
ref: ref,
|
|
58
58
|
...props,
|
|
59
59
|
className: (0, index_cjs_namespaceObject.cn)('ml-0.5', className, 'text-foreground'),
|
|
@@ -62,7 +62,7 @@ const RequiredIndicator = /*#__PURE__*/ external_react_namespaceObject.forwardRe
|
|
|
62
62
|
"aria-hidden": "true",
|
|
63
63
|
children: "*"
|
|
64
64
|
}),
|
|
65
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
65
|
+
srLabel && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
66
66
|
className: "sr-only",
|
|
67
67
|
children: srLabel
|
|
68
68
|
})
|
|
@@ -34,10 +34,10 @@ export interface RequiredIndicatorProps extends Omit<React.HTMLAttributes<HTMLSp
|
|
|
34
34
|
* required field isn't in an error state, so coloring the asterisk red reads
|
|
35
35
|
* as a validation failure before the person has done anything. The asterisk
|
|
36
36
|
* glyph is `aria-hidden` since it's a visual affordance, not the thing that
|
|
37
|
-
* makes the field required to assistive tech;
|
|
38
|
-
*
|
|
39
|
-
* the field's own control
|
|
40
|
-
*
|
|
37
|
+
* makes the field required to assistive tech;
|
|
38
|
+
* Use `required` or `aria-required` on the field's control for that.
|
|
39
|
+
* Or pass `srLabel` to provide assistive announcements if the field's own control
|
|
40
|
+
* is missing `required`/`aria-required`.
|
|
41
41
|
*/
|
|
42
42
|
declare const RequiredIndicator: React.ForwardRefExoticComponent<RequiredIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
43
43
|
export { Label, RequiredIndicator };
|
|
@@ -24,7 +24,7 @@ const Label = /*#__PURE__*/ forwardRef(({ className, variant = 'default', ...pro
|
|
|
24
24
|
...props
|
|
25
25
|
}));
|
|
26
26
|
Label.displayName = Root.displayName;
|
|
27
|
-
const RequiredIndicator = /*#__PURE__*/ forwardRef(({ className, srLabel
|
|
27
|
+
const RequiredIndicator = /*#__PURE__*/ forwardRef(({ className, srLabel, ...props }, ref)=>/*#__PURE__*/ jsxs("span", {
|
|
28
28
|
ref: ref,
|
|
29
29
|
...props,
|
|
30
30
|
className: cn('ml-0.5', className, 'text-foreground'),
|
|
@@ -33,7 +33,7 @@ const RequiredIndicator = /*#__PURE__*/ forwardRef(({ className, srLabel = ' (re
|
|
|
33
33
|
"aria-hidden": "true",
|
|
34
34
|
children: "*"
|
|
35
35
|
}),
|
|
36
|
-
/*#__PURE__*/ jsx("span", {
|
|
36
|
+
srLabel && /*#__PURE__*/ jsx("span", {
|
|
37
37
|
className: "sr-only",
|
|
38
38
|
children: srLabel
|
|
39
39
|
})
|
|
@@ -75,13 +75,13 @@ const MultiSelect = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ i
|
|
|
75
75
|
"aria-describedby": ariaDescribedBy,
|
|
76
76
|
"aria-errormessage": ariaErrorMessage,
|
|
77
77
|
"aria-label": id ? void 0 : selected.length > 0 ? `${selected.length} ${1 === selected.length ? 'item' : 'items'} selected` : placeholder,
|
|
78
|
-
className: (0, index_cjs_namespaceObject.cn)('w-full justify-between future:rounded-xl future:border-0 future:bg-surface-overlay future:hover:bg-surface-hover future:font-normal future:text-muted-foreground', selected.length > 0 ? 'h-auto min-h-10' : 'h-10'),
|
|
78
|
+
className: (0, index_cjs_namespaceObject.cn)('w-full justify-between future:rounded-xl future:border-0 future:bg-surface-overlay future:px-4 future:gap-4 future:hover:bg-surface-hover future:font-normal future:text-muted-foreground future:focus-visible:ring-offset-2 future:focus-visible:ring-offset-background', selected.length > 0 ? 'h-auto min-h-10' : 'h-10'),
|
|
79
79
|
disabled: disabled,
|
|
80
80
|
children: [
|
|
81
81
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
82
82
|
className: "flex flex-wrap gap-1 flex-1",
|
|
83
83
|
children: 0 === selected.length ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
84
|
-
className: "text-muted-foreground",
|
|
84
|
+
className: "text-muted-foreground future:text-foreground-muted",
|
|
85
85
|
children: placeholder
|
|
86
86
|
}) : selected.map((value)=>{
|
|
87
87
|
const option = options.find((opt)=>opt.value === value);
|
|
@@ -47,13 +47,13 @@ const MultiSelect = /*#__PURE__*/ forwardRef(({ id, options, selected, onChange,
|
|
|
47
47
|
"aria-describedby": ariaDescribedBy,
|
|
48
48
|
"aria-errormessage": ariaErrorMessage,
|
|
49
49
|
"aria-label": id ? void 0 : selected.length > 0 ? `${selected.length} ${1 === selected.length ? 'item' : 'items'} selected` : placeholder,
|
|
50
|
-
className: cn('w-full justify-between future:rounded-xl future:border-0 future:bg-surface-overlay future:hover:bg-surface-hover future:font-normal future:text-muted-foreground', selected.length > 0 ? 'h-auto min-h-10' : 'h-10'),
|
|
50
|
+
className: cn('w-full justify-between future:rounded-xl future:border-0 future:bg-surface-overlay future:px-4 future:gap-4 future:hover:bg-surface-hover future:font-normal future:text-muted-foreground future:focus-visible:ring-offset-2 future:focus-visible:ring-offset-background', selected.length > 0 ? 'h-auto min-h-10' : 'h-10'),
|
|
51
51
|
disabled: disabled,
|
|
52
52
|
children: [
|
|
53
53
|
/*#__PURE__*/ jsx("div", {
|
|
54
54
|
className: "flex flex-wrap gap-1 flex-1",
|
|
55
55
|
children: 0 === selected.length ? /*#__PURE__*/ jsx("span", {
|
|
56
|
-
className: "text-muted-foreground",
|
|
56
|
+
className: "text-muted-foreground future:text-foreground-muted",
|
|
57
57
|
children: placeholder
|
|
58
58
|
}) : selected.map((value)=>{
|
|
59
59
|
const option = options.find((opt)=>opt.value === value);
|
|
@@ -28,8 +28,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
});
|
|
29
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
30
|
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
31
|
-
const index_cjs_namespaceObject = require("../../../../lib/index.cjs");
|
|
32
31
|
const external_tooltip_cjs_namespaceObject = require("../../tooltip.cjs");
|
|
32
|
+
const index_cjs_namespaceObject = require("../../../../lib/index.cjs");
|
|
33
33
|
const ToolbarButton = ({ icon: Icon, label, disabled, onClick })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_tooltip_cjs_namespaceObject.Tooltip, {
|
|
34
34
|
children: [
|
|
35
35
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipTrigger, {
|
|
@@ -58,7 +58,7 @@ const ToolbarSeparator = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
|
58
58
|
"aria-hidden": true,
|
|
59
59
|
className: "mx-1 h-4 w-px bg-border/60"
|
|
60
60
|
});
|
|
61
|
-
const EditorToolbar = ({ mode, onModeChange, disabled, actionsRef, onFullscreen })=>{
|
|
61
|
+
const EditorToolbar = ({ mode, onModeChange, disabled, error, actionsRef, onFullscreen })=>{
|
|
62
62
|
const isEditMode = 'edit' === mode;
|
|
63
63
|
const handleFormat = (actionName)=>()=>{
|
|
64
64
|
if (!disabled && isEditMode) {
|
|
@@ -67,7 +67,7 @@ const EditorToolbar = ({ mode, onModeChange, disabled, actionsRef, onFullscreen
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
70
|
-
className:
|
|
70
|
+
className: (0, index_cjs_namespaceObject.cn)('relative flex items-center justify-between gap-1 overflow-hidden rounded-t-md border border-b-0 bg-background px-2 py-1 future:rounded-t-xl future:border-0 future:bg-surface-overlay', error && 'border-error ring-1 ring-error/20 future:ring-error/40'),
|
|
71
71
|
"data-testid": "editor-toolbar",
|
|
72
72
|
children: [
|
|
73
73
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
@@ -3,7 +3,8 @@ export interface EditorToolbarProps {
|
|
|
3
3
|
mode: PromptEditorMode;
|
|
4
4
|
onModeChange: (mode: PromptEditorMode) => void;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
error?: boolean;
|
|
6
7
|
actionsRef?: React.RefObject<PromptEditorToolbarActionsRef | null>;
|
|
7
8
|
onFullscreen?: () => void;
|
|
8
9
|
}
|
|
9
|
-
export declare const EditorToolbar: ({ mode, onModeChange, disabled, actionsRef, onFullscreen, }: EditorToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const EditorToolbar: ({ mode, onModeChange, disabled, error, actionsRef, onFullscreen, }: EditorToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Bold, Italic, List, ListOrdered, Maximize2, Strikethrough } from "lucide-react";
|
|
3
|
-
import { cn } from "../../../../lib/index.js";
|
|
4
3
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../../tooltip.js";
|
|
4
|
+
import { cn } from "../../../../lib/index.js";
|
|
5
5
|
const ToolbarButton = ({ icon: Icon, label, disabled, onClick })=>/*#__PURE__*/ jsxs(Tooltip, {
|
|
6
6
|
children: [
|
|
7
7
|
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
@@ -30,7 +30,7 @@ const ToolbarSeparator = ()=>/*#__PURE__*/ jsx("span", {
|
|
|
30
30
|
"aria-hidden": true,
|
|
31
31
|
className: "mx-1 h-4 w-px bg-border/60"
|
|
32
32
|
});
|
|
33
|
-
const EditorToolbar = ({ mode, onModeChange, disabled, actionsRef, onFullscreen })=>{
|
|
33
|
+
const EditorToolbar = ({ mode, onModeChange, disabled, error, actionsRef, onFullscreen })=>{
|
|
34
34
|
const isEditMode = 'edit' === mode;
|
|
35
35
|
const handleFormat = (actionName)=>()=>{
|
|
36
36
|
if (!disabled && isEditMode) {
|
|
@@ -39,7 +39,7 @@ const EditorToolbar = ({ mode, onModeChange, disabled, actionsRef, onFullscreen
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
return /*#__PURE__*/ jsxs("div", {
|
|
42
|
-
className:
|
|
42
|
+
className: cn('relative flex items-center justify-between gap-1 overflow-hidden rounded-t-md border border-b-0 bg-background px-2 py-1 future:rounded-t-xl future:border-0 future:bg-surface-overlay', error && 'border-error ring-1 ring-error/20 future:ring-error/40'),
|
|
43
43
|
"data-testid": "editor-toolbar",
|
|
44
44
|
children: [
|
|
45
45
|
/*#__PURE__*/ jsx("span", {
|
|
@@ -35,6 +35,7 @@ const LexicalOnChangePlugin_namespaceObject = require("@lexical/react/LexicalOnC
|
|
|
35
35
|
const LexicalPlainTextPlugin_namespaceObject = require("@lexical/react/LexicalPlainTextPlugin");
|
|
36
36
|
const external_lexical_namespaceObject = require("lexical");
|
|
37
37
|
const external_react_namespaceObject = require("react");
|
|
38
|
+
const external_form_field_cjs_namespaceObject = require("../form-field.cjs");
|
|
38
39
|
const external_tooltip_cjs_namespaceObject = require("../tooltip.cjs");
|
|
39
40
|
const EditorToolbar_cjs_namespaceObject = require("./components/EditorToolbar.cjs");
|
|
40
41
|
const MarkdownPreview_cjs_namespaceObject = require("./components/MarkdownPreview.cjs");
|
|
@@ -56,7 +57,7 @@ const LINE_HEIGHT = 20;
|
|
|
56
57
|
const EMPTY_AUTOCOMPLETE_OPTIONS = [];
|
|
57
58
|
const EMPTY_TOKENS = [];
|
|
58
59
|
const toTokenArray = (v)=>void 0 === v ? void 0 : Array.isArray(v) ? v : EMPTY_TOKENS;
|
|
59
|
-
const EditorInner = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(({ initialValue, value, onChange, autoCompleteOptions = EMPTY_AUTOCOMPLETE_OPTIONS, multiline = true, minRows = DEFAULT_MIN_ROWS, maxRows = DEFAULT_MAX_ROWS, placeholder, disabled, ariaLabel, fillHeight, borderless, mapVarDropToToken, toolbarActionsRef, showToolbar }, ref)=>{
|
|
60
|
+
const EditorInner = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(({ initialValue, value, onChange, autoCompleteOptions = EMPTY_AUTOCOMPLETE_OPTIONS, multiline = true, minRows = DEFAULT_MIN_ROWS, maxRows = DEFAULT_MAX_ROWS, placeholder, disabled, ariaLabel, fillHeight, borderless, error, errorId, ariaDescribedBy, mapVarDropToToken, toolbarActionsRef, showToolbar }, ref)=>{
|
|
60
61
|
const editorRef = (0, external_react_namespaceObject.useRef)(null);
|
|
61
62
|
const [isEmpty, setIsEmpty] = (0, external_react_namespaceObject.useState)(()=>{
|
|
62
63
|
const seed = initialValue ?? value;
|
|
@@ -195,9 +196,10 @@ const EditorInner = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)
|
|
|
195
196
|
disabled
|
|
196
197
|
]);
|
|
197
198
|
const options = Array.isArray(autoCompleteOptions) ? autoCompleteOptions : EMPTY_AUTOCOMPLETE_OPTIONS;
|
|
198
|
-
const wrapperClassName = borderless ? 'flex flex-col w-full relative' : `prompt-editor-shell flex flex-col w-full relative border bg-background ${showToolbar ? 'border-t-0 rounded-b-md' : 'rounded-md'}`;
|
|
199
|
+
const wrapperClassName = borderless ? 'flex flex-col w-full relative' : `prompt-editor-shell flex flex-col w-full relative border bg-background future:border-0 future:bg-surface-overlay ${showToolbar ? 'border-t-0 rounded-b-md future:rounded-b-xl' : 'rounded-md future:rounded-xl'} ${error ? 'border-error ring-1 ring-error/20 future:ring-error/40' : ''}`;
|
|
199
200
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
200
201
|
className: wrapperClassName,
|
|
202
|
+
"data-invalid": error ? 'true' : void 0,
|
|
201
203
|
style: {
|
|
202
204
|
fontFamily: "'Noto Sans', sans-serif",
|
|
203
205
|
fontSize: '14px',
|
|
@@ -211,7 +213,7 @@ const EditorInner = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)
|
|
|
211
213
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("style", {
|
|
212
214
|
children: `
|
|
213
215
|
.prompt-editor-paragraph { padding: 0; margin: 0; }
|
|
214
|
-
${borderless ? '' : '.prompt-editor-shell:focus-within { border-color: var(--color-ring); box-shadow: 0 0 0 1px var(--color-ring); }'}
|
|
216
|
+
${borderless ? '' : '.prompt-editor-shell:not([data-invalid="true"]):focus-within { border-color: var(--color-ring); box-shadow: 0 0 0 1px var(--color-ring); } .future .prompt-editor-shell:not([data-invalid="true"]):focus-within { box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-ring) 35%, transparent); }'}
|
|
215
217
|
.prompt-editor-root *::selection { background-color: color-mix(in srgb, var(--color-primary) 30%, transparent); }
|
|
216
218
|
`
|
|
217
219
|
}),
|
|
@@ -230,7 +232,10 @@ const EditorInner = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)
|
|
|
230
232
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(LexicalPlainTextPlugin_namespaceObject.PlainTextPlugin, {
|
|
231
233
|
contentEditable: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(LexicalContentEditable_namespaceObject.ContentEditable, {
|
|
232
234
|
style: contentEditableStyle,
|
|
233
|
-
ariaLabel: ariaLabel
|
|
235
|
+
ariaLabel: ariaLabel,
|
|
236
|
+
"aria-invalid": error ? true : void 0,
|
|
237
|
+
"aria-describedby": ariaDescribedBy,
|
|
238
|
+
"aria-errormessage": error ? errorId : void 0
|
|
234
239
|
}),
|
|
235
240
|
placeholder: null,
|
|
236
241
|
ErrorBoundary: LexicalErrorBoundary_namespaceObject.LexicalErrorBoundary
|
|
@@ -252,7 +257,7 @@ const EditorInner = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)
|
|
|
252
257
|
textOverflow: 'ellipsis'
|
|
253
258
|
}
|
|
254
259
|
},
|
|
255
|
-
className: "text-muted-foreground
|
|
260
|
+
className: "text-muted-foreground future:text-foreground-muted future:font-normal",
|
|
256
261
|
children: placeholder
|
|
257
262
|
})
|
|
258
263
|
]
|
|
@@ -297,7 +302,7 @@ const EditorInner = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)
|
|
|
297
302
|
});
|
|
298
303
|
});
|
|
299
304
|
EditorInner.displayName = 'PromptEditorInner';
|
|
300
|
-
const PromptEditor = ({ value: rawValue, initialValue: rawInitialValue, onChange, multiline = true, minRows = DEFAULT_MIN_ROWS, maxRows = DEFAULT_MAX_ROWS, placeholder, disabled, ariaLabel, autoCompleteOptions, showToolbar = false, mode: controlledMode, onModeChange, onFullscreen, editorRef, fillHeight, borderless, mapVarDropToToken })=>{
|
|
305
|
+
const PromptEditor = ({ value: rawValue, initialValue: rawInitialValue, onChange, multiline = true, minRows = DEFAULT_MIN_ROWS, maxRows = DEFAULT_MAX_ROWS, placeholder, disabled, ariaLabel, autoCompleteOptions, showToolbar = false, mode: controlledMode, onModeChange, onFullscreen, editorRef, fillHeight, borderless, error, errorId: providedErrorId, 'aria-describedby': nativeAriaDescribedBy, ariaDescribedBy: legacyAriaDescribedBy, mapVarDropToToken })=>{
|
|
301
306
|
const value = toTokenArray(rawValue);
|
|
302
307
|
const initialValue = toTokenArray(rawInitialValue);
|
|
303
308
|
const [internalMode, setInternalMode] = (0, external_react_namespaceObject.useState)('edit');
|
|
@@ -325,6 +330,13 @@ const PromptEditor = ({ value: rawValue, initialValue: rawInitialValue, onChange
|
|
|
325
330
|
}), []);
|
|
326
331
|
const isControlled = void 0 !== value;
|
|
327
332
|
const previewTokens = isControlled ? value : uncontrolledPreviewTokens;
|
|
333
|
+
const generatedErrorId = (0, external_react_namespaceObject.useId)();
|
|
334
|
+
const errorId = providedErrorId ?? `prompt-editor-${generatedErrorId.replace(/:/g, '')}-error`;
|
|
335
|
+
const additionalDescribedBy = nativeAriaDescribedBy ?? legacyAriaDescribedBy;
|
|
336
|
+
const describedBy = [
|
|
337
|
+
additionalDescribedBy,
|
|
338
|
+
error ? errorId : void 0
|
|
339
|
+
].filter(Boolean).join(' ');
|
|
328
340
|
const handleEditorChange = (0, external_react_namespaceObject.useCallback)((tokens)=>{
|
|
329
341
|
if (!isControlled) setUncontrolledPreviewTokens(tokens);
|
|
330
342
|
onChange?.(tokens);
|
|
@@ -347,12 +359,14 @@ const PromptEditor = ({ value: rawValue, initialValue: rawInitialValue, onChange
|
|
|
347
359
|
showToolbar && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EditorToolbar_cjs_namespaceObject.EditorToolbar, {
|
|
348
360
|
mode: mode,
|
|
349
361
|
disabled: disabled,
|
|
362
|
+
error: Boolean(error),
|
|
350
363
|
actionsRef: toolbarActionsRef,
|
|
351
364
|
onModeChange: handleModeChange,
|
|
352
365
|
onFullscreen: onFullscreen
|
|
353
366
|
}),
|
|
354
367
|
'preview' === mode && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
355
|
-
|
|
368
|
+
"data-invalid": error ? 'true' : void 0,
|
|
369
|
+
className: borderless ? void 0 : `border bg-background future:border-0 future:bg-surface-overlay ${showToolbar ? 'border-t-0 rounded-b-md future:rounded-b-xl' : 'rounded-md future:rounded-xl'} ${error ? 'border-error ring-1 ring-error/20 future:ring-error/40' : ''}`,
|
|
356
370
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(MarkdownPreview_cjs_namespaceObject.MarkdownPreview, {
|
|
357
371
|
tokens: previewTokens,
|
|
358
372
|
minRows: minRows
|
|
@@ -374,6 +388,9 @@ const PromptEditor = ({ value: rawValue, initialValue: rawInitialValue, onChange
|
|
|
374
388
|
autoCompleteOptions: autoCompleteOptions,
|
|
375
389
|
disabled: disabled,
|
|
376
390
|
ariaLabel: ariaLabel,
|
|
391
|
+
error: error,
|
|
392
|
+
errorId: error ? errorId : void 0,
|
|
393
|
+
ariaDescribedBy: describedBy || void 0,
|
|
377
394
|
initialValue: initialValue,
|
|
378
395
|
maxRows: maxRows,
|
|
379
396
|
minRows: minRows,
|
|
@@ -388,6 +405,12 @@ const PromptEditor = ({ value: rawValue, initialValue: rawInitialValue, onChange
|
|
|
388
405
|
onChange: handleEditorChange
|
|
389
406
|
})
|
|
390
407
|
})
|
|
408
|
+
}),
|
|
409
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_form_field_cjs_namespaceObject.FormFieldError, {
|
|
410
|
+
id: errorId,
|
|
411
|
+
"data-slot": "prompt-editor-error",
|
|
412
|
+
className: "mt-1",
|
|
413
|
+
children: error
|
|
391
414
|
})
|
|
392
415
|
]
|
|
393
416
|
})
|
|
@@ -25,6 +25,14 @@ export interface PromptEditorProps {
|
|
|
25
25
|
fillHeight?: boolean;
|
|
26
26
|
/** Drop the editor's own border/background/rounding so a parent can provide the field chrome. */
|
|
27
27
|
borderless?: boolean;
|
|
28
|
+
/** Field-specific validation feedback rendered below the editor. */
|
|
29
|
+
error?: React.ReactNode;
|
|
30
|
+
/** Optional id for the inline validation message. */
|
|
31
|
+
errorId?: string;
|
|
32
|
+
/** Additional description id(s) associated with the editor. */
|
|
33
|
+
'aria-describedby'?: string;
|
|
34
|
+
/** @deprecated Use the native `aria-describedby` prop instead. */
|
|
35
|
+
ariaDescribedBy?: string;
|
|
28
36
|
/**
|
|
29
37
|
* Enable variable drag-drop: map a path dropped onto the editor (see `VARIABLE_DRAG_MIME`) to the
|
|
30
38
|
* token to insert at the drop point. The drag *source* is the consumer's (it sets the path on
|
|
@@ -32,4 +40,4 @@ export interface PromptEditorProps {
|
|
|
32
40
|
*/
|
|
33
41
|
mapVarDropToToken?: (insertPath: string) => PromptEditorAutoCompleteOption;
|
|
34
42
|
}
|
|
35
|
-
export declare const PromptEditor: ({ value: rawValue, initialValue: rawInitialValue, onChange, multiline, minRows, maxRows, placeholder, disabled, ariaLabel, autoCompleteOptions, showToolbar, mode: controlledMode, onModeChange, onFullscreen, editorRef, fillHeight, borderless, mapVarDropToToken, }: PromptEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export declare const PromptEditor: ({ value: rawValue, initialValue: rawInitialValue, onChange, multiline, minRows, maxRows, placeholder, disabled, ariaLabel, autoCompleteOptions, showToolbar, mode: controlledMode, onModeChange, onFullscreen, editorRef, fillHeight, borderless, error, errorId: providedErrorId, "aria-describedby": nativeAriaDescribedBy, ariaDescribedBy: legacyAriaDescribedBy, mapVarDropToToken, }: PromptEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,8 @@ import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
|
|
|
6
6
|
import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
|
|
7
7
|
import { PlainTextPlugin } from "@lexical/react/LexicalPlainTextPlugin";
|
|
8
8
|
import { $getSelection, $isRangeSelection } from "lexical";
|
|
9
|
-
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
9
|
+
import { forwardRef, useCallback, useEffect, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
10
|
+
import { FormFieldError } from "../form-field.js";
|
|
10
11
|
import { TooltipProvider } from "../tooltip.js";
|
|
11
12
|
import { EditorToolbar } from "./components/EditorToolbar.js";
|
|
12
13
|
import { MarkdownPreview } from "./components/MarkdownPreview.js";
|
|
@@ -28,7 +29,7 @@ const LINE_HEIGHT = 20;
|
|
|
28
29
|
const EMPTY_AUTOCOMPLETE_OPTIONS = [];
|
|
29
30
|
const EMPTY_TOKENS = [];
|
|
30
31
|
const toTokenArray = (v)=>void 0 === v ? void 0 : Array.isArray(v) ? v : EMPTY_TOKENS;
|
|
31
|
-
const EditorInner = /*#__PURE__*/ forwardRef(({ initialValue, value, onChange, autoCompleteOptions = EMPTY_AUTOCOMPLETE_OPTIONS, multiline = true, minRows = DEFAULT_MIN_ROWS, maxRows = DEFAULT_MAX_ROWS, placeholder, disabled, ariaLabel, fillHeight, borderless, mapVarDropToToken, toolbarActionsRef, showToolbar }, ref)=>{
|
|
32
|
+
const EditorInner = /*#__PURE__*/ forwardRef(({ initialValue, value, onChange, autoCompleteOptions = EMPTY_AUTOCOMPLETE_OPTIONS, multiline = true, minRows = DEFAULT_MIN_ROWS, maxRows = DEFAULT_MAX_ROWS, placeholder, disabled, ariaLabel, fillHeight, borderless, error, errorId, ariaDescribedBy, mapVarDropToToken, toolbarActionsRef, showToolbar }, ref)=>{
|
|
32
33
|
const editorRef = useRef(null);
|
|
33
34
|
const [isEmpty, setIsEmpty] = useState(()=>{
|
|
34
35
|
const seed = initialValue ?? value;
|
|
@@ -167,9 +168,10 @@ const EditorInner = /*#__PURE__*/ forwardRef(({ initialValue, value, onChange, a
|
|
|
167
168
|
disabled
|
|
168
169
|
]);
|
|
169
170
|
const options = Array.isArray(autoCompleteOptions) ? autoCompleteOptions : EMPTY_AUTOCOMPLETE_OPTIONS;
|
|
170
|
-
const wrapperClassName = borderless ? 'flex flex-col w-full relative' : `prompt-editor-shell flex flex-col w-full relative border bg-background ${showToolbar ? 'border-t-0 rounded-b-md' : 'rounded-md'}`;
|
|
171
|
+
const wrapperClassName = borderless ? 'flex flex-col w-full relative' : `prompt-editor-shell flex flex-col w-full relative border bg-background future:border-0 future:bg-surface-overlay ${showToolbar ? 'border-t-0 rounded-b-md future:rounded-b-xl' : 'rounded-md future:rounded-xl'} ${error ? 'border-error ring-1 ring-error/20 future:ring-error/40' : ''}`;
|
|
171
172
|
return /*#__PURE__*/ jsxs("div", {
|
|
172
173
|
className: wrapperClassName,
|
|
174
|
+
"data-invalid": error ? 'true' : void 0,
|
|
173
175
|
style: {
|
|
174
176
|
fontFamily: "'Noto Sans', sans-serif",
|
|
175
177
|
fontSize: '14px',
|
|
@@ -183,7 +185,7 @@ const EditorInner = /*#__PURE__*/ forwardRef(({ initialValue, value, onChange, a
|
|
|
183
185
|
/*#__PURE__*/ jsx("style", {
|
|
184
186
|
children: `
|
|
185
187
|
.prompt-editor-paragraph { padding: 0; margin: 0; }
|
|
186
|
-
${borderless ? '' : '.prompt-editor-shell:focus-within { border-color: var(--color-ring); box-shadow: 0 0 0 1px var(--color-ring); }'}
|
|
188
|
+
${borderless ? '' : '.prompt-editor-shell:not([data-invalid="true"]):focus-within { border-color: var(--color-ring); box-shadow: 0 0 0 1px var(--color-ring); } .future .prompt-editor-shell:not([data-invalid="true"]):focus-within { box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-ring) 35%, transparent); }'}
|
|
187
189
|
.prompt-editor-root *::selection { background-color: color-mix(in srgb, var(--color-primary) 30%, transparent); }
|
|
188
190
|
`
|
|
189
191
|
}),
|
|
@@ -202,7 +204,10 @@ const EditorInner = /*#__PURE__*/ forwardRef(({ initialValue, value, onChange, a
|
|
|
202
204
|
/*#__PURE__*/ jsx(PlainTextPlugin, {
|
|
203
205
|
contentEditable: /*#__PURE__*/ jsx(ContentEditable, {
|
|
204
206
|
style: contentEditableStyle,
|
|
205
|
-
ariaLabel: ariaLabel
|
|
207
|
+
ariaLabel: ariaLabel,
|
|
208
|
+
"aria-invalid": error ? true : void 0,
|
|
209
|
+
"aria-describedby": ariaDescribedBy,
|
|
210
|
+
"aria-errormessage": error ? errorId : void 0
|
|
206
211
|
}),
|
|
207
212
|
placeholder: null,
|
|
208
213
|
ErrorBoundary: LexicalErrorBoundary
|
|
@@ -224,7 +229,7 @@ const EditorInner = /*#__PURE__*/ forwardRef(({ initialValue, value, onChange, a
|
|
|
224
229
|
textOverflow: 'ellipsis'
|
|
225
230
|
}
|
|
226
231
|
},
|
|
227
|
-
className: "text-muted-foreground
|
|
232
|
+
className: "text-muted-foreground future:text-foreground-muted future:font-normal",
|
|
228
233
|
children: placeholder
|
|
229
234
|
})
|
|
230
235
|
]
|
|
@@ -269,7 +274,7 @@ const EditorInner = /*#__PURE__*/ forwardRef(({ initialValue, value, onChange, a
|
|
|
269
274
|
});
|
|
270
275
|
});
|
|
271
276
|
EditorInner.displayName = 'PromptEditorInner';
|
|
272
|
-
const PromptEditor = ({ value: rawValue, initialValue: rawInitialValue, onChange, multiline = true, minRows = DEFAULT_MIN_ROWS, maxRows = DEFAULT_MAX_ROWS, placeholder, disabled, ariaLabel, autoCompleteOptions, showToolbar = false, mode: controlledMode, onModeChange, onFullscreen, editorRef, fillHeight, borderless, mapVarDropToToken })=>{
|
|
277
|
+
const PromptEditor = ({ value: rawValue, initialValue: rawInitialValue, onChange, multiline = true, minRows = DEFAULT_MIN_ROWS, maxRows = DEFAULT_MAX_ROWS, placeholder, disabled, ariaLabel, autoCompleteOptions, showToolbar = false, mode: controlledMode, onModeChange, onFullscreen, editorRef, fillHeight, borderless, error, errorId: providedErrorId, 'aria-describedby': nativeAriaDescribedBy, ariaDescribedBy: legacyAriaDescribedBy, mapVarDropToToken })=>{
|
|
273
278
|
const value = toTokenArray(rawValue);
|
|
274
279
|
const initialValue = toTokenArray(rawInitialValue);
|
|
275
280
|
const [internalMode, setInternalMode] = useState('edit');
|
|
@@ -297,6 +302,13 @@ const PromptEditor = ({ value: rawValue, initialValue: rawInitialValue, onChange
|
|
|
297
302
|
}), []);
|
|
298
303
|
const isControlled = void 0 !== value;
|
|
299
304
|
const previewTokens = isControlled ? value : uncontrolledPreviewTokens;
|
|
305
|
+
const generatedErrorId = useId();
|
|
306
|
+
const errorId = providedErrorId ?? `prompt-editor-${generatedErrorId.replace(/:/g, '')}-error`;
|
|
307
|
+
const additionalDescribedBy = nativeAriaDescribedBy ?? legacyAriaDescribedBy;
|
|
308
|
+
const describedBy = [
|
|
309
|
+
additionalDescribedBy,
|
|
310
|
+
error ? errorId : void 0
|
|
311
|
+
].filter(Boolean).join(' ');
|
|
300
312
|
const handleEditorChange = useCallback((tokens)=>{
|
|
301
313
|
if (!isControlled) setUncontrolledPreviewTokens(tokens);
|
|
302
314
|
onChange?.(tokens);
|
|
@@ -319,12 +331,14 @@ const PromptEditor = ({ value: rawValue, initialValue: rawInitialValue, onChange
|
|
|
319
331
|
showToolbar && /*#__PURE__*/ jsx(EditorToolbar, {
|
|
320
332
|
mode: mode,
|
|
321
333
|
disabled: disabled,
|
|
334
|
+
error: Boolean(error),
|
|
322
335
|
actionsRef: toolbarActionsRef,
|
|
323
336
|
onModeChange: handleModeChange,
|
|
324
337
|
onFullscreen: onFullscreen
|
|
325
338
|
}),
|
|
326
339
|
'preview' === mode && /*#__PURE__*/ jsx("div", {
|
|
327
|
-
|
|
340
|
+
"data-invalid": error ? 'true' : void 0,
|
|
341
|
+
className: borderless ? void 0 : `border bg-background future:border-0 future:bg-surface-overlay ${showToolbar ? 'border-t-0 rounded-b-md future:rounded-b-xl' : 'rounded-md future:rounded-xl'} ${error ? 'border-error ring-1 ring-error/20 future:ring-error/40' : ''}`,
|
|
328
342
|
children: /*#__PURE__*/ jsx(MarkdownPreview, {
|
|
329
343
|
tokens: previewTokens,
|
|
330
344
|
minRows: minRows
|
|
@@ -346,6 +360,9 @@ const PromptEditor = ({ value: rawValue, initialValue: rawInitialValue, onChange
|
|
|
346
360
|
autoCompleteOptions: autoCompleteOptions,
|
|
347
361
|
disabled: disabled,
|
|
348
362
|
ariaLabel: ariaLabel,
|
|
363
|
+
error: error,
|
|
364
|
+
errorId: error ? errorId : void 0,
|
|
365
|
+
ariaDescribedBy: describedBy || void 0,
|
|
349
366
|
initialValue: initialValue,
|
|
350
367
|
maxRows: maxRows,
|
|
351
368
|
minRows: minRows,
|
|
@@ -360,6 +377,12 @@ const PromptEditor = ({ value: rawValue, initialValue: rawInitialValue, onChange
|
|
|
360
377
|
onChange: handleEditorChange
|
|
361
378
|
})
|
|
362
379
|
})
|
|
380
|
+
}),
|
|
381
|
+
/*#__PURE__*/ jsx(FormFieldError, {
|
|
382
|
+
id: errorId,
|
|
383
|
+
"data-slot": "prompt-editor-error",
|
|
384
|
+
className: "mt-1",
|
|
385
|
+
children: error
|
|
363
386
|
})
|
|
364
387
|
]
|
|
365
388
|
})
|
package/dist/styles.css
CHANGED
|
@@ -4070,12 +4070,6 @@
|
|
|
4070
4070
|
.text-muted-foreground {
|
|
4071
4071
|
color: var(--muted-foreground);
|
|
4072
4072
|
}
|
|
4073
|
-
.text-muted-foreground\/60 {
|
|
4074
|
-
color: var(--muted-foreground);
|
|
4075
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
4076
|
-
color: color-mix(in oklab, var(--muted-foreground) 60%, transparent);
|
|
4077
|
-
}
|
|
4078
|
-
}
|
|
4079
4073
|
.text-muted-foreground\/70 {
|
|
4080
4074
|
color: var(--muted-foreground);
|
|
4081
4075
|
@supports (color: color-mix(in lab, red, red)) {
|
|
@@ -6235,6 +6229,18 @@
|
|
|
6235
6229
|
border-radius: var(--radius-xl);
|
|
6236
6230
|
}
|
|
6237
6231
|
}
|
|
6232
|
+
.future\:rounded-t-xl {
|
|
6233
|
+
:is(.future-dark, .future-light) & {
|
|
6234
|
+
border-top-left-radius: var(--radius-xl);
|
|
6235
|
+
border-top-right-radius: var(--radius-xl);
|
|
6236
|
+
}
|
|
6237
|
+
}
|
|
6238
|
+
.future\:rounded-b-xl {
|
|
6239
|
+
:is(.future-dark, .future-light) & {
|
|
6240
|
+
border-bottom-right-radius: var(--radius-xl);
|
|
6241
|
+
border-bottom-left-radius: var(--radius-xl);
|
|
6242
|
+
}
|
|
6243
|
+
}
|
|
6238
6244
|
.future\:border-0 {
|
|
6239
6245
|
:is(.future-dark, .future-light) & {
|
|
6240
6246
|
border-style: var(--tw-border-style);
|
|
@@ -6323,6 +6329,11 @@
|
|
|
6323
6329
|
color: var(--foreground-inverse);
|
|
6324
6330
|
}
|
|
6325
6331
|
}
|
|
6332
|
+
.future\:text-foreground-muted {
|
|
6333
|
+
:is(.future-dark, .future-light) & {
|
|
6334
|
+
color: var(--foreground-muted);
|
|
6335
|
+
}
|
|
6336
|
+
}
|
|
6326
6337
|
.future\:text-muted-foreground {
|
|
6327
6338
|
:is(.future-dark, .future-light) & {
|
|
6328
6339
|
color: var(--muted-foreground);
|