@uipath/apollo-wind 2.70.0 → 2.72.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/README.md +25 -0
- package/dist/components/forms/field-control.cjs +3 -2
- package/dist/components/forms/field-control.js +3 -2
- package/dist/components/forms/validation-converter.cjs +14 -5
- package/dist/components/forms/validation-converter.js +14 -5
- package/dist/components/ui/chat-hero.cjs +244 -0
- package/dist/components/ui/chat-hero.d.ts +51 -0
- package/dist/components/ui/chat-hero.js +189 -0
- package/dist/components/ui/date-picker.cjs +6 -5
- package/dist/components/ui/date-picker.js +7 -6
- package/dist/components/ui/datetime-picker.cjs +7 -10
- package/dist/components/ui/datetime-picker.js +8 -11
- package/dist/components/ui/index.cjs +629 -413
- package/dist/components/ui/index.d.ts +6 -2
- package/dist/components/ui/index.js +7 -3
- package/dist/components/ui/prompt-editor/components/MarkdownPreview.cjs +4 -2
- package/dist/components/ui/prompt-editor/components/MarkdownPreview.js +4 -2
- package/dist/components/ui/prompt-editor/components/TokenPill.cjs +13 -68
- package/dist/components/ui/prompt-editor/components/TokenPill.js +14 -69
- package/dist/components/ui/prompt-editor/types.cjs +2 -14
- package/dist/components/ui/prompt-editor/types.d.ts +14 -1
- package/dist/components/ui/prompt-editor/types.js +2 -14
- package/dist/components/ui/prompt-suggestions.cjs +133 -0
- package/dist/components/ui/prompt-suggestions.d.ts +52 -0
- package/dist/components/ui/prompt-suggestions.js +90 -0
- package/dist/components/ui/quick-form-field/components/field-header.cjs +9 -4
- package/dist/components/ui/quick-form-field/components/field-header.d.ts +4 -1
- package/dist/components/ui/quick-form-field/components/field-header.js +9 -4
- package/dist/components/ui/quick-form-field/components/lock-toggle-button.cjs +2 -2
- package/dist/components/ui/quick-form-field/components/lock-toggle-button.d.ts +5 -4
- package/dist/components/ui/quick-form-field/components/lock-toggle-button.js +2 -2
- package/dist/components/ui/quick-form-field/index.d.ts +1 -1
- package/dist/components/ui/quick-form-field/quick-form-field.cjs +158 -222
- package/dist/components/ui/quick-form-field/quick-form-field.d.ts +6 -4
- package/dist/components/ui/quick-form-field/quick-form-field.js +159 -223
- package/dist/components/ui/quick-form-field/types.cjs +2 -2
- package/dist/components/ui/quick-form-field/types.d.ts +39 -32
- package/dist/components/ui/quick-form-field/types.js +2 -2
- package/dist/components/ui/quick-form-field/utils.cjs +5 -59
- package/dist/components/ui/quick-form-field/utils.d.ts +2 -24
- package/dist/components/ui/quick-form-field/utils.js +3 -48
- package/dist/components/ui/reference-chip-colors.cjs +49 -0
- package/dist/components/ui/reference-chip-colors.d.ts +15 -0
- package/dist/components/ui/reference-chip-colors.js +15 -0
- package/dist/components/ui/reference-chip.cjs +104 -0
- package/dist/components/ui/reference-chip.d.ts +17 -0
- package/dist/components/ui/reference-chip.js +70 -0
- package/dist/components/ui/variable-value-control.cjs +5 -3
- package/dist/components/ui/variable-value-control.js +5 -3
- package/dist/index.cjs +50 -4
- package/dist/index.d.ts +12 -6
- package/dist/index.js +7 -3
- package/dist/lib/date-value.cjs +46 -0
- package/dist/lib/date-value.d.ts +8 -0
- package/dist/lib/date-value.js +12 -0
- package/dist/styles.css +110 -43
- package/dist/tailwind.utilities.css +15 -0
- package/package.json +1 -1
- package/dist/components/custom/chat-first-experience.cjs +0 -87
- package/dist/components/custom/chat-first-experience.d.ts +0 -24
- package/dist/components/custom/chat-first-experience.js +0 -53
- package/dist/components/custom/chat-prompt-suggestions.cjs +0 -49
- package/dist/components/custom/chat-prompt-suggestions.d.ts +0 -18
- package/dist/components/custom/chat-prompt-suggestions.js +0 -15
|
@@ -24,14 +24,12 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
28
|
-
formatDateTimeValue: ()=>formatDateTimeValue,
|
|
29
|
-
formatDateValue: ()=>formatDateValue,
|
|
30
|
-
getLockedDisplayValue: ()=>getLockedDisplayValue,
|
|
31
|
-
parseDateValue: ()=>parseDateValue,
|
|
27
|
+
toDateOnlyString: ()=>toDateOnlyString,
|
|
32
28
|
parseListValue: ()=>parseListValue,
|
|
33
|
-
|
|
29
|
+
DEFAULT_SELECT_OPTIONS: ()=>DEFAULT_SELECT_OPTIONS,
|
|
30
|
+
formatDateValue: ()=>formatDateValue
|
|
34
31
|
});
|
|
32
|
+
const date_value_cjs_namespaceObject = require("../../../lib/date-value.cjs");
|
|
35
33
|
const DEFAULT_SELECT_OPTIONS = [
|
|
36
34
|
{
|
|
37
35
|
label: 'Option 1',
|
|
@@ -54,17 +52,6 @@ function parseListValue(value) {
|
|
|
54
52
|
return [];
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
|
-
const DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
58
|
-
function parseDateValue(value) {
|
|
59
|
-
if (DATE_ONLY_PATTERN.test(value)) {
|
|
60
|
-
const [year, month, day] = value.split('-').map(Number);
|
|
61
|
-
const date = new Date(year, month - 1, day);
|
|
62
|
-
const isValid = !Number.isNaN(date.getTime()) && date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day;
|
|
63
|
-
return isValid ? date : void 0;
|
|
64
|
-
}
|
|
65
|
-
const date = new Date(value);
|
|
66
|
-
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
67
|
-
}
|
|
68
55
|
function toDateOnlyString(date) {
|
|
69
56
|
const year = date.getFullYear();
|
|
70
57
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
@@ -72,61 +59,20 @@ function toDateOnlyString(date) {
|
|
|
72
59
|
return `${year}-${month}-${day}`;
|
|
73
60
|
}
|
|
74
61
|
function formatDateValue(value) {
|
|
75
|
-
const date =
|
|
62
|
+
const date = (0, date_value_cjs_namespaceObject.toDateValue)(value);
|
|
76
63
|
return date ? date.toLocaleDateString(void 0, {
|
|
77
64
|
year: 'numeric',
|
|
78
65
|
month: 'long',
|
|
79
66
|
day: 'numeric'
|
|
80
67
|
}) : value;
|
|
81
68
|
}
|
|
82
|
-
function formatDateTimeValue(value) {
|
|
83
|
-
const date = parseDateValue(value);
|
|
84
|
-
return date ? date.toLocaleString(void 0, {
|
|
85
|
-
year: 'numeric',
|
|
86
|
-
month: 'long',
|
|
87
|
-
day: 'numeric',
|
|
88
|
-
hour: 'numeric',
|
|
89
|
-
minute: '2-digit'
|
|
90
|
-
}) : value;
|
|
91
|
-
}
|
|
92
|
-
function getLockedDisplayValue(fieldType, value, options, booleanLabels = {
|
|
93
|
-
trueLabel: 'True',
|
|
94
|
-
falseLabel: 'False'
|
|
95
|
-
}) {
|
|
96
|
-
switch(fieldType){
|
|
97
|
-
case 'boolean':
|
|
98
|
-
if ('true' === value) return booleanLabels.trueLabel;
|
|
99
|
-
if ('false' === value) return booleanLabels.falseLabel;
|
|
100
|
-
return '';
|
|
101
|
-
case 'date':
|
|
102
|
-
return value ? formatDateValue(value) : '';
|
|
103
|
-
case 'datetime':
|
|
104
|
-
return value ? formatDateTimeValue(value) : '';
|
|
105
|
-
case 'single-select':
|
|
106
|
-
return options.find((option)=>option.value === value)?.label ?? value;
|
|
107
|
-
case 'multi-select':
|
|
108
|
-
{
|
|
109
|
-
const parsed = parseListValue(value);
|
|
110
|
-
if (0 === parsed.length && value && '[]' !== value) return value;
|
|
111
|
-
return parsed.map((v)=>options.find((option)=>option.value === v)?.label ?? v).join(', ');
|
|
112
|
-
}
|
|
113
|
-
default:
|
|
114
|
-
return value;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
69
|
exports.DEFAULT_SELECT_OPTIONS = __webpack_exports__.DEFAULT_SELECT_OPTIONS;
|
|
118
|
-
exports.formatDateTimeValue = __webpack_exports__.formatDateTimeValue;
|
|
119
70
|
exports.formatDateValue = __webpack_exports__.formatDateValue;
|
|
120
|
-
exports.getLockedDisplayValue = __webpack_exports__.getLockedDisplayValue;
|
|
121
|
-
exports.parseDateValue = __webpack_exports__.parseDateValue;
|
|
122
71
|
exports.parseListValue = __webpack_exports__.parseListValue;
|
|
123
72
|
exports.toDateOnlyString = __webpack_exports__.toDateOnlyString;
|
|
124
73
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
125
74
|
"DEFAULT_SELECT_OPTIONS",
|
|
126
|
-
"formatDateTimeValue",
|
|
127
75
|
"formatDateValue",
|
|
128
|
-
"getLockedDisplayValue",
|
|
129
|
-
"parseDateValue",
|
|
130
76
|
"parseListValue",
|
|
131
77
|
"toDateOnlyString"
|
|
132
78
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { QuickFormFieldOption } from './types';
|
|
2
2
|
export declare const DEFAULT_SELECT_OPTIONS: QuickFormFieldOption[];
|
|
3
3
|
export declare function parseListValue(value: string): string[];
|
|
4
|
-
/**
|
|
5
|
-
* Parses a date field's stored value, returning undefined for empty or invalid input.
|
|
6
|
-
*
|
|
7
|
-
* Date-only strings (`YYYY-MM-DD`) are parsed as a local date instead of going through
|
|
8
|
-
* `new Date(string)` directly -- the latter treats date-only strings as UTC midnight,
|
|
9
|
-
* which rolls over to the previous day once formatted in a negative-UTC-offset
|
|
10
|
-
* timezone. Full ISO timestamps (which already carry explicit time/zone info) go
|
|
11
|
-
* through `new Date` as-is.
|
|
12
|
-
*/
|
|
13
|
-
export declare function parseDateValue(value: string): Date | undefined;
|
|
14
|
-
/** Formats a Date as a local `YYYY-MM-DD` string, the inverse of parseDateValue's date-only path. */
|
|
4
|
+
/** Formats a Date as a local `YYYY-MM-DD` string, which `toDateValue` reads back as a local date. */
|
|
15
5
|
export declare function toDateOnlyString(date: Date): string;
|
|
16
6
|
/** Formats a date field's value for display, falling back to the raw value if it isn't a valid date. */
|
|
17
7
|
export declare function formatDateValue(value: string): string;
|
|
18
|
-
/** Formats a datetime field's value, falling back to the raw value when unparseable. */
|
|
19
|
-
export declare function formatDateTimeValue(value: string): string;
|
|
20
|
-
/**
|
|
21
|
-
* Computes the plain-text shown in place of the real control once a field is locked.
|
|
22
|
-
* Boolean/single-select/multi-select resolve their stored value to a display label;
|
|
23
|
-
* everything else (including an invalid date, so the component never throws on
|
|
24
|
-
* external input) falls back to the raw value.
|
|
25
|
-
*/
|
|
26
|
-
export declare function getLockedDisplayValue(fieldType: QuickFieldType, value: string, options: QuickFormFieldOption[], booleanLabels?: {
|
|
27
|
-
trueLabel: string;
|
|
28
|
-
falseLabel: string;
|
|
29
|
-
}): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { toDateValue } from "../../../lib/date-value.js";
|
|
1
2
|
const DEFAULT_SELECT_OPTIONS = [
|
|
2
3
|
{
|
|
3
4
|
label: 'Option 1',
|
|
@@ -20,17 +21,6 @@ function parseListValue(value) {
|
|
|
20
21
|
return [];
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
|
-
const DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
24
|
-
function parseDateValue(value) {
|
|
25
|
-
if (DATE_ONLY_PATTERN.test(value)) {
|
|
26
|
-
const [year, month, day] = value.split('-').map(Number);
|
|
27
|
-
const date = new Date(year, month - 1, day);
|
|
28
|
-
const isValid = !Number.isNaN(date.getTime()) && date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day;
|
|
29
|
-
return isValid ? date : void 0;
|
|
30
|
-
}
|
|
31
|
-
const date = new Date(value);
|
|
32
|
-
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
33
|
-
}
|
|
34
24
|
function toDateOnlyString(date) {
|
|
35
25
|
const year = date.getFullYear();
|
|
36
26
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
@@ -38,46 +28,11 @@ function toDateOnlyString(date) {
|
|
|
38
28
|
return `${year}-${month}-${day}`;
|
|
39
29
|
}
|
|
40
30
|
function formatDateValue(value) {
|
|
41
|
-
const date =
|
|
31
|
+
const date = toDateValue(value);
|
|
42
32
|
return date ? date.toLocaleDateString(void 0, {
|
|
43
33
|
year: 'numeric',
|
|
44
34
|
month: 'long',
|
|
45
35
|
day: 'numeric'
|
|
46
36
|
}) : value;
|
|
47
37
|
}
|
|
48
|
-
|
|
49
|
-
const date = parseDateValue(value);
|
|
50
|
-
return date ? date.toLocaleString(void 0, {
|
|
51
|
-
year: 'numeric',
|
|
52
|
-
month: 'long',
|
|
53
|
-
day: 'numeric',
|
|
54
|
-
hour: 'numeric',
|
|
55
|
-
minute: '2-digit'
|
|
56
|
-
}) : value;
|
|
57
|
-
}
|
|
58
|
-
function getLockedDisplayValue(fieldType, value, options, booleanLabels = {
|
|
59
|
-
trueLabel: 'True',
|
|
60
|
-
falseLabel: 'False'
|
|
61
|
-
}) {
|
|
62
|
-
switch(fieldType){
|
|
63
|
-
case 'boolean':
|
|
64
|
-
if ('true' === value) return booleanLabels.trueLabel;
|
|
65
|
-
if ('false' === value) return booleanLabels.falseLabel;
|
|
66
|
-
return '';
|
|
67
|
-
case 'date':
|
|
68
|
-
return value ? formatDateValue(value) : '';
|
|
69
|
-
case 'datetime':
|
|
70
|
-
return value ? formatDateTimeValue(value) : '';
|
|
71
|
-
case 'single-select':
|
|
72
|
-
return options.find((option)=>option.value === value)?.label ?? value;
|
|
73
|
-
case 'multi-select':
|
|
74
|
-
{
|
|
75
|
-
const parsed = parseListValue(value);
|
|
76
|
-
if (0 === parsed.length && value && '[]' !== value) return value;
|
|
77
|
-
return parsed.map((v)=>options.find((option)=>option.value === v)?.label ?? v).join(', ');
|
|
78
|
-
}
|
|
79
|
-
default:
|
|
80
|
-
return value;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
export { DEFAULT_SELECT_OPTIONS, formatDateTimeValue, formatDateValue, getLockedDisplayValue, parseDateValue, parseListValue, toDateOnlyString };
|
|
38
|
+
export { DEFAULT_SELECT_OPTIONS, formatDateValue, parseListValue, toDateOnlyString };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
getReferenceChipColors: ()=>getReferenceChipColors
|
|
28
|
+
});
|
|
29
|
+
const getReferenceChipColors = ()=>({
|
|
30
|
+
valid: {
|
|
31
|
+
background: 'var(--color-info-background)',
|
|
32
|
+
border: 'var(--color-info-icon)',
|
|
33
|
+
text: 'var(--color-info-text)',
|
|
34
|
+
icon: 'var(--color-info-icon)'
|
|
35
|
+
},
|
|
36
|
+
invalid: {
|
|
37
|
+
background: 'var(--color-error-background)',
|
|
38
|
+
border: 'var(--color-error-icon)',
|
|
39
|
+
text: 'var(--color-error-text)',
|
|
40
|
+
icon: 'var(--color-error-icon)'
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
exports.getReferenceChipColors = __webpack_exports__.getReferenceChipColors;
|
|
44
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
45
|
+
"getReferenceChipColors"
|
|
46
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
47
|
+
Object.defineProperty(exports, '__esModule', {
|
|
48
|
+
value: true
|
|
49
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Paired reference colors. Keep labels, icons and backgrounds on the same semantic palette. */
|
|
2
|
+
export declare const getReferenceChipColors: () => {
|
|
3
|
+
valid: {
|
|
4
|
+
background: string;
|
|
5
|
+
border: string;
|
|
6
|
+
text: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
};
|
|
9
|
+
invalid: {
|
|
10
|
+
background: string;
|
|
11
|
+
border: string;
|
|
12
|
+
text: string;
|
|
13
|
+
icon: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const getReferenceChipColors = ()=>({
|
|
2
|
+
valid: {
|
|
3
|
+
background: 'var(--color-info-background)',
|
|
4
|
+
border: 'var(--color-info-icon)',
|
|
5
|
+
text: 'var(--color-info-text)',
|
|
6
|
+
icon: 'var(--color-info-icon)'
|
|
7
|
+
},
|
|
8
|
+
invalid: {
|
|
9
|
+
background: 'var(--color-error-background)',
|
|
10
|
+
border: 'var(--color-error-icon)',
|
|
11
|
+
text: 'var(--color-error-text)',
|
|
12
|
+
icon: 'var(--color-error-icon)'
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
export { getReferenceChipColors };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ReferenceChip: ()=>ReferenceChip
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_react_namespaceObject = require("react");
|
|
31
|
+
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
32
|
+
const external_reference_chip_colors_cjs_namespaceObject = require("./reference-chip-colors.cjs");
|
|
33
|
+
const ReferenceChip = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(({ label, icon, onRemove, removeLabel, readOnly = false, disabled = false, invalid = false, selected = false, className, style, ...props }, ref)=>{
|
|
34
|
+
const colors = (0, external_reference_chip_colors_cjs_namespaceObject.getReferenceChipColors)()[invalid ? 'invalid' : 'valid'];
|
|
35
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
|
|
36
|
+
...props,
|
|
37
|
+
ref: ref,
|
|
38
|
+
"data-slot": "reference-chip",
|
|
39
|
+
"data-invalid": invalid || void 0,
|
|
40
|
+
"data-selected": selected || void 0,
|
|
41
|
+
"aria-disabled": disabled || void 0,
|
|
42
|
+
className: (0, index_cjs_namespaceObject.cn)('relative inline-flex max-w-full min-w-0 items-center align-middle gap-[3px] h-5 rounded px-1 text-[13px] leading-5 outline-offset-1', selected && 'z-10', disabled && 'opacity-50', className),
|
|
43
|
+
style: {
|
|
44
|
+
backgroundColor: colors.background,
|
|
45
|
+
color: colors.text,
|
|
46
|
+
outline: selected ? `2px solid ${colors.border}` : void 0,
|
|
47
|
+
...style
|
|
48
|
+
},
|
|
49
|
+
children: [
|
|
50
|
+
icon && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
51
|
+
"aria-hidden": "true",
|
|
52
|
+
className: "inline-flex shrink-0 [&_svg]:size-3.5 [&_img]:size-3.5",
|
|
53
|
+
style: {
|
|
54
|
+
color: colors.icon
|
|
55
|
+
},
|
|
56
|
+
children: icon
|
|
57
|
+
}),
|
|
58
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
59
|
+
className: "min-w-0 truncate font-normal",
|
|
60
|
+
style: {
|
|
61
|
+
fontFamily: "'Noto Sans', sans-serif"
|
|
62
|
+
},
|
|
63
|
+
children: label
|
|
64
|
+
}),
|
|
65
|
+
onRemove && !readOnly && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
66
|
+
type: "button",
|
|
67
|
+
disabled: disabled,
|
|
68
|
+
"aria-label": removeLabel ?? `Remove ${label}`,
|
|
69
|
+
className: "inline-flex shrink-0 items-center justify-center p-px border-0 bg-transparent cursor-pointer rounded-[2px] w-4 h-4 text-inherit focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-current disabled:cursor-default",
|
|
70
|
+
onMouseDown: (event)=>{
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
event.stopPropagation();
|
|
73
|
+
},
|
|
74
|
+
onClick: (event)=>{
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
event.stopPropagation();
|
|
77
|
+
onRemove();
|
|
78
|
+
},
|
|
79
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("svg", {
|
|
80
|
+
"aria-hidden": "true",
|
|
81
|
+
width: "12",
|
|
82
|
+
height: "12",
|
|
83
|
+
viewBox: "0 0 24 24",
|
|
84
|
+
fill: "none",
|
|
85
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
86
|
+
d: "M18 6L6 18M6 6L18 18",
|
|
87
|
+
stroke: "currentColor",
|
|
88
|
+
strokeWidth: "2",
|
|
89
|
+
strokeLinecap: "round",
|
|
90
|
+
strokeLinejoin: "round"
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
ReferenceChip.displayName = 'ReferenceChip';
|
|
98
|
+
exports.ReferenceChip = __webpack_exports__.ReferenceChip;
|
|
99
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
100
|
+
"ReferenceChip"
|
|
101
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
102
|
+
Object.defineProperty(exports, '__esModule', {
|
|
103
|
+
value: true
|
|
104
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export interface ReferenceChipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
3
|
+
/** Display name of the referenced variable, resource or connection. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Decorative icon. Branded icons may preserve their original colors. */
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
onRemove?: () => void;
|
|
8
|
+
/** Localized accessible name for the remove button. */
|
|
9
|
+
removeLabel?: string;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
invalid?: boolean;
|
|
13
|
+
/** Visual selection only. The containing editor or picker owns selection semantics. */
|
|
14
|
+
selected?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Shared visual primitive. Picker behavior and editor selection remain with the host. */
|
|
17
|
+
export declare const ReferenceChip: import("react").ForwardRefExoticComponent<ReferenceChipProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "../../lib/index.js";
|
|
4
|
+
import { getReferenceChipColors } from "./reference-chip-colors.js";
|
|
5
|
+
const ReferenceChip = /*#__PURE__*/ forwardRef(({ label, icon, onRemove, removeLabel, readOnly = false, disabled = false, invalid = false, selected = false, className, style, ...props }, ref)=>{
|
|
6
|
+
const colors = getReferenceChipColors()[invalid ? 'invalid' : 'valid'];
|
|
7
|
+
return /*#__PURE__*/ jsxs("span", {
|
|
8
|
+
...props,
|
|
9
|
+
ref: ref,
|
|
10
|
+
"data-slot": "reference-chip",
|
|
11
|
+
"data-invalid": invalid || void 0,
|
|
12
|
+
"data-selected": selected || void 0,
|
|
13
|
+
"aria-disabled": disabled || void 0,
|
|
14
|
+
className: cn('relative inline-flex max-w-full min-w-0 items-center align-middle gap-[3px] h-5 rounded px-1 text-[13px] leading-5 outline-offset-1', selected && 'z-10', disabled && 'opacity-50', className),
|
|
15
|
+
style: {
|
|
16
|
+
backgroundColor: colors.background,
|
|
17
|
+
color: colors.text,
|
|
18
|
+
outline: selected ? `2px solid ${colors.border}` : void 0,
|
|
19
|
+
...style
|
|
20
|
+
},
|
|
21
|
+
children: [
|
|
22
|
+
icon && /*#__PURE__*/ jsx("span", {
|
|
23
|
+
"aria-hidden": "true",
|
|
24
|
+
className: "inline-flex shrink-0 [&_svg]:size-3.5 [&_img]:size-3.5",
|
|
25
|
+
style: {
|
|
26
|
+
color: colors.icon
|
|
27
|
+
},
|
|
28
|
+
children: icon
|
|
29
|
+
}),
|
|
30
|
+
/*#__PURE__*/ jsx("span", {
|
|
31
|
+
className: "min-w-0 truncate font-normal",
|
|
32
|
+
style: {
|
|
33
|
+
fontFamily: "'Noto Sans', sans-serif"
|
|
34
|
+
},
|
|
35
|
+
children: label
|
|
36
|
+
}),
|
|
37
|
+
onRemove && !readOnly && /*#__PURE__*/ jsx("button", {
|
|
38
|
+
type: "button",
|
|
39
|
+
disabled: disabled,
|
|
40
|
+
"aria-label": removeLabel ?? `Remove ${label}`,
|
|
41
|
+
className: "inline-flex shrink-0 items-center justify-center p-px border-0 bg-transparent cursor-pointer rounded-[2px] w-4 h-4 text-inherit focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-current disabled:cursor-default",
|
|
42
|
+
onMouseDown: (event)=>{
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
event.stopPropagation();
|
|
45
|
+
},
|
|
46
|
+
onClick: (event)=>{
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
event.stopPropagation();
|
|
49
|
+
onRemove();
|
|
50
|
+
},
|
|
51
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
52
|
+
"aria-hidden": "true",
|
|
53
|
+
width: "12",
|
|
54
|
+
height: "12",
|
|
55
|
+
viewBox: "0 0 24 24",
|
|
56
|
+
fill: "none",
|
|
57
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
58
|
+
d: "M18 6L6 18M6 6L18 18",
|
|
59
|
+
stroke: "currentColor",
|
|
60
|
+
strokeWidth: "2",
|
|
61
|
+
strokeLinecap: "round",
|
|
62
|
+
strokeLinejoin: "round"
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
ReferenceChip.displayName = 'ReferenceChip';
|
|
70
|
+
export { ReferenceChip };
|
|
@@ -27,11 +27,13 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
VariableValueControl: ()=>VariableValueControl
|
|
28
28
|
});
|
|
29
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
30
31
|
const external_react_namespaceObject = require("react");
|
|
31
32
|
const aria_ids_cjs_namespaceObject = require("../forms/aria-ids.cjs");
|
|
32
33
|
const value_mode_strings_cjs_namespaceObject = require("./field-addons/value-mode-strings.cjs");
|
|
33
34
|
const external_input_group_cjs_namespaceObject = require("./input-group.cjs");
|
|
34
35
|
const external_popover_cjs_namespaceObject = require("./popover.cjs");
|
|
36
|
+
const external_reference_chip_cjs_namespaceObject = require("./reference-chip.cjs");
|
|
35
37
|
const index_cjs_namespaceObject = require("./variable-picker/index.cjs");
|
|
36
38
|
const external_lib_index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
37
39
|
const VariableValueControl = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ id, value, onChange, onBlur, inputRef, variables, disabled, placeholder, strings, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, controlProps }, ref)=>{
|
|
@@ -72,9 +74,9 @@ const VariableValueControl = /*#__PURE__*/ external_react_namespaceObject.forwar
|
|
|
72
74
|
"aria-label": ariaLabel,
|
|
73
75
|
"aria-labelledby": ariaLabelledBy,
|
|
74
76
|
"aria-describedby": (0, aria_ids_cjs_namespaceObject.joinIds)(ariaDescribedBy, controlProps?.['aria-describedby']),
|
|
75
|
-
children: reference && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
children: reference && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_reference_chip_cjs_namespaceObject.ReferenceChip, {
|
|
78
|
+
label: reference,
|
|
79
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Variable, {})
|
|
78
80
|
})
|
|
79
81
|
}),
|
|
80
82
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverContent, {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Variable } from "lucide-react";
|
|
2
3
|
import { forwardRef, useCallback, useMemo, useState } from "react";
|
|
3
4
|
import { joinIds } from "../forms/aria-ids.js";
|
|
4
5
|
import { DEFAULT_VALUE_MODE_STRINGS } from "./field-addons/value-mode-strings.js";
|
|
5
6
|
import { InputGroupPopoverTrigger } from "./input-group.js";
|
|
6
7
|
import { Popover, PopoverContent } from "./popover.js";
|
|
8
|
+
import { ReferenceChip } from "./reference-chip.js";
|
|
7
9
|
import { VariablePickerContent } from "./variable-picker/index.js";
|
|
8
10
|
import { composeRefs } from "../../lib/index.js";
|
|
9
11
|
const VariableValueControl = /*#__PURE__*/ forwardRef(({ id, value, onChange, onBlur, inputRef, variables, disabled, placeholder, strings, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, controlProps }, ref)=>{
|
|
@@ -44,9 +46,9 @@ const VariableValueControl = /*#__PURE__*/ forwardRef(({ id, value, onChange, on
|
|
|
44
46
|
"aria-label": ariaLabel,
|
|
45
47
|
"aria-labelledby": ariaLabelledBy,
|
|
46
48
|
"aria-describedby": joinIds(ariaDescribedBy, controlProps?.['aria-describedby']),
|
|
47
|
-
children: reference && /*#__PURE__*/ jsx(
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
children: reference && /*#__PURE__*/ jsx(ReferenceChip, {
|
|
50
|
+
label: reference,
|
|
51
|
+
icon: /*#__PURE__*/ jsx(Variable, {})
|
|
50
52
|
})
|
|
51
53
|
}),
|
|
52
54
|
/*#__PURE__*/ jsx(PopoverContent, {
|