@uipath/apollo-react 6.45.3 → 6.46.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/dist/canvas/components/Guardrails/builder-types.cjs +47 -0
- package/dist/canvas/components/Guardrails/builder-types.d.ts +129 -0
- package/dist/canvas/components/Guardrails/builder-types.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/builder-types.js +10 -0
- package/dist/canvas/components/Guardrails/builder-utils.cjs +144 -0
- package/dist/canvas/components/Guardrails/builder-utils.d.ts +18 -0
- package/dist/canvas/components/Guardrails/builder-utils.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/builder-utils.js +98 -0
- package/dist/canvas/components/Guardrails/components/enum-list-chips-field.cjs +85 -0
- package/dist/canvas/components/Guardrails/components/enum-list-chips-field.d.ts +3 -0
- package/dist/canvas/components/Guardrails/components/enum-list-chips-field.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/enum-list-chips-field.js +51 -0
- package/dist/canvas/components/Guardrails/components/escalate-action-fields.cjs +268 -0
- package/dist/canvas/components/Guardrails/components/escalate-action-fields.d.ts +23 -0
- package/dist/canvas/components/Guardrails/components/escalate-action-fields.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/escalate-action-fields.js +234 -0
- package/dist/canvas/components/Guardrails/components/field-shell.cjs +46 -0
- package/dist/canvas/components/Guardrails/components/field-shell.d.ts +7 -0
- package/dist/canvas/components/Guardrails/components/field-shell.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/field-shell.js +12 -0
- package/dist/canvas/components/Guardrails/components/guardrail-action-section.cjs +173 -0
- package/dist/canvas/components/Guardrails/components/guardrail-action-section.d.ts +22 -0
- package/dist/canvas/components/Guardrails/components/guardrail-action-section.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-action-section.js +139 -0
- package/dist/canvas/components/Guardrails/components/guardrail-chip.cjs +63 -0
- package/dist/canvas/components/Guardrails/components/guardrail-chip.d.ts +11 -0
- package/dist/canvas/components/Guardrails/components/guardrail-chip.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-chip.js +26 -0
- package/dist/canvas/components/Guardrails/components/guardrail-scope-selector.cjs +217 -0
- package/dist/canvas/components/Guardrails/components/guardrail-scope-selector.d.ts +15 -0
- package/dist/canvas/components/Guardrails/components/guardrail-scope-selector.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-scope-selector.js +183 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.cjs +61 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.d.ts +6 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.js +27 -0
- package/dist/canvas/components/Guardrails/components/map-enum-field.cjs +116 -0
- package/dist/canvas/components/Guardrails/components/map-enum-field.d.ts +3 -0
- package/dist/canvas/components/Guardrails/components/map-enum-field.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/map-enum-field.js +82 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.cjs +69 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.d.ts +10 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.js +35 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.cjs +60 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.d.ts +11 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.js +26 -0
- package/dist/canvas/components/Guardrails/form-schema-builder.cjs +246 -0
- package/dist/canvas/components/Guardrails/form-schema-builder.d.ts +15 -0
- package/dist/canvas/components/Guardrails/form-schema-builder.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/form-schema-builder.js +197 -0
- package/dist/canvas/components/Guardrails/guardrail-builder.cjs +369 -0
- package/dist/canvas/components/Guardrails/guardrail-builder.d.ts +41 -0
- package/dist/canvas/components/Guardrails/guardrail-builder.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/guardrail-builder.js +335 -0
- package/dist/canvas/components/Guardrails/guardrail-form-layout.cjs +138 -0
- package/dist/canvas/components/Guardrails/guardrail-form-layout.d.ts +24 -0
- package/dist/canvas/components/Guardrails/guardrail-form-layout.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/guardrail-form-layout.js +104 -0
- package/dist/canvas/components/Guardrails/guardrail-validator-form.cjs +199 -0
- package/dist/canvas/components/Guardrails/guardrail-validator-form.d.ts +3 -0
- package/dist/canvas/components/Guardrails/guardrail-validator-form.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/guardrail-validator-form.js +165 -0
- package/dist/canvas/components/Guardrails/i18n.cjs +436 -0
- package/dist/canvas/components/Guardrails/i18n.d.ts +76 -0
- package/dist/canvas/components/Guardrails/i18n.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/i18n.js +384 -0
- package/dist/canvas/components/Guardrails/index.cjs +112 -0
- package/dist/canvas/components/Guardrails/index.d.ts +16 -0
- package/dist/canvas/components/Guardrails/index.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/index.js +9 -0
- package/dist/canvas/components/Guardrails/render-parameter-bridge.cjs +60 -0
- package/dist/canvas/components/Guardrails/render-parameter-bridge.d.ts +13 -0
- package/dist/canvas/components/Guardrails/render-parameter-bridge.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/render-parameter-bridge.js +23 -0
- package/dist/canvas/components/Guardrails/types.cjs +18 -0
- package/dist/canvas/components/Guardrails/types.d.ts +69 -0
- package/dist/canvas/components/Guardrails/types.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/types.js +0 -0
- package/dist/canvas/components/Guardrails/use-metadata-form-bridge.cjs +144 -0
- package/dist/canvas/components/Guardrails/use-metadata-form-bridge.d.ts +13 -0
- package/dist/canvas/components/Guardrails/use-metadata-form-bridge.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/use-metadata-form-bridge.js +110 -0
- package/dist/canvas/components/Guardrails/utils.cjs +174 -0
- package/dist/canvas/components/Guardrails/utils.d.ts +9 -0
- package/dist/canvas/components/Guardrails/utils.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/utils.js +122 -0
- package/dist/canvas/components/index.cjs +41 -34
- package/dist/canvas/components/index.d.ts +1 -0
- package/dist/canvas/components/index.d.ts.map +1 -1
- package/dist/canvas/components/index.js +1 -0
- package/dist/canvas/locales/de.cjs +1 -1
- package/dist/canvas/locales/de.d.ts.map +1 -1
- package/dist/canvas/locales/de.js +1 -1
- package/dist/canvas/locales/en.cjs +1 -1
- package/dist/canvas/locales/en.d.ts.map +1 -1
- package/dist/canvas/locales/en.js +1 -1
- package/dist/canvas/locales/es-MX.cjs +1 -1
- package/dist/canvas/locales/es-MX.d.ts.map +1 -1
- package/dist/canvas/locales/es-MX.js +1 -1
- package/dist/canvas/locales/es.cjs +1 -1
- package/dist/canvas/locales/es.d.ts.map +1 -1
- package/dist/canvas/locales/es.js +1 -1
- package/dist/canvas/locales/fr.cjs +1 -1
- package/dist/canvas/locales/fr.d.ts.map +1 -1
- package/dist/canvas/locales/fr.js +1 -1
- package/dist/canvas/locales/ja.cjs +1 -1
- package/dist/canvas/locales/ja.d.ts.map +1 -1
- package/dist/canvas/locales/ja.js +1 -1
- package/dist/canvas/locales/ko.cjs +1 -1
- package/dist/canvas/locales/ko.d.ts.map +1 -1
- package/dist/canvas/locales/ko.js +1 -1
- package/dist/canvas/locales/pt-BR.cjs +1 -1
- package/dist/canvas/locales/pt-BR.d.ts.map +1 -1
- package/dist/canvas/locales/pt-BR.js +1 -1
- package/dist/canvas/locales/pt.cjs +1 -1
- package/dist/canvas/locales/pt.d.ts.map +1 -1
- package/dist/canvas/locales/pt.js +1 -1
- package/dist/canvas/locales/ro.cjs +1 -1
- package/dist/canvas/locales/ro.d.ts.map +1 -1
- package/dist/canvas/locales/ro.js +1 -1
- package/dist/canvas/locales/ru.cjs +1 -1
- package/dist/canvas/locales/ru.d.ts.map +1 -1
- package/dist/canvas/locales/ru.js +1 -1
- package/dist/canvas/locales/tr.cjs +1 -1
- package/dist/canvas/locales/tr.d.ts.map +1 -1
- package/dist/canvas/locales/tr.js +1 -1
- package/dist/canvas/locales/zh-CN.cjs +1 -1
- package/dist/canvas/locales/zh-CN.d.ts.map +1 -1
- package/dist/canvas/locales/zh-CN.js +1 -1
- package/dist/canvas/locales/zh-TW.cjs +1 -1
- package/dist/canvas/locales/zh-TW.d.ts.map +1 -1
- package/dist/canvas/locales/zh-TW.js +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/i18n/index.cjs +5 -1
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +2 -1
- package/dist/test/setup.d.ts.map +1 -1
- package/package.json +11 -3
|
@@ -0,0 +1,173 @@
|
|
|
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
|
+
GuardrailActionSection: ()=>GuardrailActionSection
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
31
|
+
const external_react_namespaceObject = require("react");
|
|
32
|
+
const external_builder_utils_cjs_namespaceObject = require("../builder-utils.cjs");
|
|
33
|
+
const external_escalate_action_fields_cjs_namespaceObject = require("./escalate-action-fields.cjs");
|
|
34
|
+
function GuardrailActionSection({ action, onActionChange, showFilter = false, filterContent, errors, labels, renderRecipientSearch, renderStaticRecipient, renderAppPicker, escalateHelp }) {
|
|
35
|
+
const uid = (0, external_react_namespaceObject.useId)();
|
|
36
|
+
const actionTypeSelect = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.FormField, {
|
|
37
|
+
children: [
|
|
38
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Label, {
|
|
39
|
+
htmlFor: `${uid}-action-type`,
|
|
40
|
+
children: [
|
|
41
|
+
labels.actionTypeLabel,
|
|
42
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.RequiredIndicator, {})
|
|
43
|
+
]
|
|
44
|
+
}),
|
|
45
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Select, {
|
|
46
|
+
value: action.$actionType,
|
|
47
|
+
onValueChange: (type)=>onActionChange((0, external_builder_utils_cjs_namespaceObject.createDefaultGuardrailAction)(type)),
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectTrigger, {
|
|
50
|
+
id: `${uid}-action-type`,
|
|
51
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectValue, {})
|
|
52
|
+
}),
|
|
53
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.SelectContent, {
|
|
54
|
+
children: [
|
|
55
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectItem, {
|
|
56
|
+
value: "log",
|
|
57
|
+
children: labels.actionLogLabel
|
|
58
|
+
}),
|
|
59
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectItem, {
|
|
60
|
+
value: "block",
|
|
61
|
+
children: labels.actionBlockLabel
|
|
62
|
+
}),
|
|
63
|
+
showFilter && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectItem, {
|
|
64
|
+
value: "filter",
|
|
65
|
+
children: labels.actionFilterLabel
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectItem, {
|
|
68
|
+
value: "escalate",
|
|
69
|
+
children: labels.actionEscalateLabel
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
if ('escalate' === action.$actionType) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_escalate_action_fields_cjs_namespaceObject.EscalateActionFields, {
|
|
78
|
+
action: action,
|
|
79
|
+
onChange: onActionChange,
|
|
80
|
+
actionTypeSelect: actionTypeSelect,
|
|
81
|
+
errors: errors,
|
|
82
|
+
labels: labels,
|
|
83
|
+
renderRecipientSearch: renderRecipientSearch,
|
|
84
|
+
renderStaticRecipient: renderStaticRecipient,
|
|
85
|
+
renderAppPicker: renderAppPicker,
|
|
86
|
+
escalateHelp: escalateHelp
|
|
87
|
+
});
|
|
88
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
89
|
+
className: "@container",
|
|
90
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
91
|
+
className: "grid grid-cols-1 @sm:grid-cols-2 gap-3",
|
|
92
|
+
children: [
|
|
93
|
+
actionTypeSelect,
|
|
94
|
+
'log' === action.$actionType && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.FormField, {
|
|
95
|
+
children: [
|
|
96
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Label, {
|
|
97
|
+
htmlFor: `${uid}-severity-level`,
|
|
98
|
+
children: [
|
|
99
|
+
labels.severityLabel,
|
|
100
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.RequiredIndicator, {})
|
|
101
|
+
]
|
|
102
|
+
}),
|
|
103
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Select, {
|
|
104
|
+
value: action.severityLevel,
|
|
105
|
+
onValueChange: (v)=>onActionChange({
|
|
106
|
+
...action,
|
|
107
|
+
severityLevel: v
|
|
108
|
+
}),
|
|
109
|
+
children: [
|
|
110
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectTrigger, {
|
|
111
|
+
id: `${uid}-severity-level`,
|
|
112
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectValue, {})
|
|
113
|
+
}),
|
|
114
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.SelectContent, {
|
|
115
|
+
children: [
|
|
116
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectItem, {
|
|
117
|
+
value: "Info",
|
|
118
|
+
children: labels.severityInfoLabel
|
|
119
|
+
}),
|
|
120
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectItem, {
|
|
121
|
+
value: "Warning",
|
|
122
|
+
children: labels.severityWarningLabel
|
|
123
|
+
}),
|
|
124
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.SelectItem, {
|
|
125
|
+
value: "Error",
|
|
126
|
+
children: labels.severityErrorLabel
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
})
|
|
130
|
+
]
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
}),
|
|
134
|
+
'block' === action.$actionType && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.FormField, {
|
|
135
|
+
children: [
|
|
136
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Label, {
|
|
137
|
+
htmlFor: `${uid}-block-reason`,
|
|
138
|
+
children: [
|
|
139
|
+
labels.blockReasonLabel,
|
|
140
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.RequiredIndicator, {})
|
|
141
|
+
]
|
|
142
|
+
}),
|
|
143
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Input, {
|
|
144
|
+
id: `${uid}-block-reason`,
|
|
145
|
+
value: action.reason,
|
|
146
|
+
onChange: (e)=>onActionChange({
|
|
147
|
+
...action,
|
|
148
|
+
reason: e.target.value
|
|
149
|
+
}),
|
|
150
|
+
placeholder: labels.blockReasonPlaceholder,
|
|
151
|
+
error: errors?.blockReason
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
}),
|
|
155
|
+
'filter' === action.$actionType && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.FormField, {
|
|
156
|
+
children: [
|
|
157
|
+
filterContent,
|
|
158
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.FormFieldError, {
|
|
159
|
+
children: errors?.filterFields
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
})
|
|
163
|
+
]
|
|
164
|
+
})
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
exports.GuardrailActionSection = __webpack_exports__.GuardrailActionSection;
|
|
168
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
169
|
+
"GuardrailActionSection"
|
|
170
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
171
|
+
Object.defineProperty(exports, '__esModule', {
|
|
172
|
+
value: true
|
|
173
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { GuardrailAction, GuardrailAppPickerContext, GuardrailRecipientSearchContext, GuardrailStaticRecipientContext } from '../builder-types';
|
|
3
|
+
import type { GuardrailBuilderLabels } from '../i18n';
|
|
4
|
+
export interface GuardrailActionSectionProps {
|
|
5
|
+
action: GuardrailAction;
|
|
6
|
+
onActionChange: (action: GuardrailAction) => void;
|
|
7
|
+
showFilter?: boolean;
|
|
8
|
+
filterContent?: ReactNode;
|
|
9
|
+
errors?: {
|
|
10
|
+
blockReason?: string;
|
|
11
|
+
filterFields?: string;
|
|
12
|
+
recipient?: string;
|
|
13
|
+
actionApp?: string;
|
|
14
|
+
};
|
|
15
|
+
labels: GuardrailBuilderLabels;
|
|
16
|
+
renderRecipientSearch?: (ctx: GuardrailRecipientSearchContext) => ReactNode;
|
|
17
|
+
renderStaticRecipient?: (ctx: GuardrailStaticRecipientContext) => ReactNode | undefined;
|
|
18
|
+
renderAppPicker?: (ctx: GuardrailAppPickerContext) => ReactNode;
|
|
19
|
+
escalateHelp?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export declare function GuardrailActionSection({ action, onActionChange, showFilter, filterContent, errors, labels, renderRecipientSearch, renderStaticRecipient, renderAppPicker, escalateHelp, }: GuardrailActionSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=guardrail-action-section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guardrail-action-section.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/guardrail-action-section.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EACV,eAAe,EACf,yBAAyB,EACzB,+BAA+B,EAC/B,+BAA+B,EAChC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtD,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,eAAe,CAAC;IACxB,cAAc,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAElD,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjG,MAAM,EAAE,sBAAsB,CAAC;IAC/B,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,+BAA+B,KAAK,SAAS,CAAC;IAC5E,qBAAqB,CAAC,EAAE,CAAC,GAAG,EAAE,+BAA+B,KAAK,SAAS,GAAG,SAAS,CAAC;IACxF,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,yBAAyB,KAAK,SAAS,CAAC;IAChE,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B;AAOD,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,cAAc,EACd,UAAkB,EAClB,aAAa,EACb,MAAM,EACN,MAAM,EACN,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,YAAY,GACb,EAAE,2BAA2B,2CAqG7B"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FormField, FormFieldError, Input, Label, RequiredIndicator, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@uipath/apollo-wind";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { createDefaultGuardrailAction } from "../builder-utils.js";
|
|
5
|
+
import { EscalateActionFields } from "./escalate-action-fields.js";
|
|
6
|
+
function GuardrailActionSection({ action, onActionChange, showFilter = false, filterContent, errors, labels, renderRecipientSearch, renderStaticRecipient, renderAppPicker, escalateHelp }) {
|
|
7
|
+
const uid = useId();
|
|
8
|
+
const actionTypeSelect = /*#__PURE__*/ jsxs(FormField, {
|
|
9
|
+
children: [
|
|
10
|
+
/*#__PURE__*/ jsxs(Label, {
|
|
11
|
+
htmlFor: `${uid}-action-type`,
|
|
12
|
+
children: [
|
|
13
|
+
labels.actionTypeLabel,
|
|
14
|
+
/*#__PURE__*/ jsx(RequiredIndicator, {})
|
|
15
|
+
]
|
|
16
|
+
}),
|
|
17
|
+
/*#__PURE__*/ jsxs(Select, {
|
|
18
|
+
value: action.$actionType,
|
|
19
|
+
onValueChange: (type)=>onActionChange(createDefaultGuardrailAction(type)),
|
|
20
|
+
children: [
|
|
21
|
+
/*#__PURE__*/ jsx(SelectTrigger, {
|
|
22
|
+
id: `${uid}-action-type`,
|
|
23
|
+
children: /*#__PURE__*/ jsx(SelectValue, {})
|
|
24
|
+
}),
|
|
25
|
+
/*#__PURE__*/ jsxs(SelectContent, {
|
|
26
|
+
children: [
|
|
27
|
+
/*#__PURE__*/ jsx(SelectItem, {
|
|
28
|
+
value: "log",
|
|
29
|
+
children: labels.actionLogLabel
|
|
30
|
+
}),
|
|
31
|
+
/*#__PURE__*/ jsx(SelectItem, {
|
|
32
|
+
value: "block",
|
|
33
|
+
children: labels.actionBlockLabel
|
|
34
|
+
}),
|
|
35
|
+
showFilter && /*#__PURE__*/ jsx(SelectItem, {
|
|
36
|
+
value: "filter",
|
|
37
|
+
children: labels.actionFilterLabel
|
|
38
|
+
}),
|
|
39
|
+
/*#__PURE__*/ jsx(SelectItem, {
|
|
40
|
+
value: "escalate",
|
|
41
|
+
children: labels.actionEscalateLabel
|
|
42
|
+
})
|
|
43
|
+
]
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
if ('escalate' === action.$actionType) return /*#__PURE__*/ jsx(EscalateActionFields, {
|
|
50
|
+
action: action,
|
|
51
|
+
onChange: onActionChange,
|
|
52
|
+
actionTypeSelect: actionTypeSelect,
|
|
53
|
+
errors: errors,
|
|
54
|
+
labels: labels,
|
|
55
|
+
renderRecipientSearch: renderRecipientSearch,
|
|
56
|
+
renderStaticRecipient: renderStaticRecipient,
|
|
57
|
+
renderAppPicker: renderAppPicker,
|
|
58
|
+
escalateHelp: escalateHelp
|
|
59
|
+
});
|
|
60
|
+
return /*#__PURE__*/ jsx("div", {
|
|
61
|
+
className: "@container",
|
|
62
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
63
|
+
className: "grid grid-cols-1 @sm:grid-cols-2 gap-3",
|
|
64
|
+
children: [
|
|
65
|
+
actionTypeSelect,
|
|
66
|
+
'log' === action.$actionType && /*#__PURE__*/ jsxs(FormField, {
|
|
67
|
+
children: [
|
|
68
|
+
/*#__PURE__*/ jsxs(Label, {
|
|
69
|
+
htmlFor: `${uid}-severity-level`,
|
|
70
|
+
children: [
|
|
71
|
+
labels.severityLabel,
|
|
72
|
+
/*#__PURE__*/ jsx(RequiredIndicator, {})
|
|
73
|
+
]
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ jsxs(Select, {
|
|
76
|
+
value: action.severityLevel,
|
|
77
|
+
onValueChange: (v)=>onActionChange({
|
|
78
|
+
...action,
|
|
79
|
+
severityLevel: v
|
|
80
|
+
}),
|
|
81
|
+
children: [
|
|
82
|
+
/*#__PURE__*/ jsx(SelectTrigger, {
|
|
83
|
+
id: `${uid}-severity-level`,
|
|
84
|
+
children: /*#__PURE__*/ jsx(SelectValue, {})
|
|
85
|
+
}),
|
|
86
|
+
/*#__PURE__*/ jsxs(SelectContent, {
|
|
87
|
+
children: [
|
|
88
|
+
/*#__PURE__*/ jsx(SelectItem, {
|
|
89
|
+
value: "Info",
|
|
90
|
+
children: labels.severityInfoLabel
|
|
91
|
+
}),
|
|
92
|
+
/*#__PURE__*/ jsx(SelectItem, {
|
|
93
|
+
value: "Warning",
|
|
94
|
+
children: labels.severityWarningLabel
|
|
95
|
+
}),
|
|
96
|
+
/*#__PURE__*/ jsx(SelectItem, {
|
|
97
|
+
value: "Error",
|
|
98
|
+
children: labels.severityErrorLabel
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
}),
|
|
106
|
+
'block' === action.$actionType && /*#__PURE__*/ jsxs(FormField, {
|
|
107
|
+
children: [
|
|
108
|
+
/*#__PURE__*/ jsxs(Label, {
|
|
109
|
+
htmlFor: `${uid}-block-reason`,
|
|
110
|
+
children: [
|
|
111
|
+
labels.blockReasonLabel,
|
|
112
|
+
/*#__PURE__*/ jsx(RequiredIndicator, {})
|
|
113
|
+
]
|
|
114
|
+
}),
|
|
115
|
+
/*#__PURE__*/ jsx(Input, {
|
|
116
|
+
id: `${uid}-block-reason`,
|
|
117
|
+
value: action.reason,
|
|
118
|
+
onChange: (e)=>onActionChange({
|
|
119
|
+
...action,
|
|
120
|
+
reason: e.target.value
|
|
121
|
+
}),
|
|
122
|
+
placeholder: labels.blockReasonPlaceholder,
|
|
123
|
+
error: errors?.blockReason
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
}),
|
|
127
|
+
'filter' === action.$actionType && /*#__PURE__*/ jsxs(FormField, {
|
|
128
|
+
children: [
|
|
129
|
+
filterContent,
|
|
130
|
+
/*#__PURE__*/ jsx(FormFieldError, {
|
|
131
|
+
children: errors?.filterFields
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
export { GuardrailActionSection };
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
guardrailChipVariants: ()=>guardrailChipVariants,
|
|
28
|
+
GuardrailChip: ()=>GuardrailChip
|
|
29
|
+
});
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
32
|
+
const external_class_variance_authority_namespaceObject = require("class-variance-authority");
|
|
33
|
+
const external_react_namespaceObject = require("react");
|
|
34
|
+
const guardrailChipVariants = (0, external_class_variance_authority_namespaceObject.cva)('h-6 min-w-0 gap-1 rounded-full border px-2.5 text-xs font-medium [&_svg]:size-3', {
|
|
35
|
+
variants: {
|
|
36
|
+
appearance: {
|
|
37
|
+
default: 'bg-background text-foreground border-border hover:bg-muted hover:text-foreground data-[state=on]:bg-brand-subtle data-[state=on]:text-foreground-accent data-[state=on]:border-brand-lighter future:text-foreground future:hover:text-foreground future:data-[state=on]:text-foreground-accent',
|
|
38
|
+
addable: 'border-dashed bg-background text-foreground-muted border-border hover:bg-muted hover:text-foreground future:text-foreground-muted future:hover:text-foreground'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
defaultVariants: {
|
|
42
|
+
appearance: 'default'
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const GuardrailChip = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ appearance, className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Toggle, {
|
|
46
|
+
ref: ref,
|
|
47
|
+
"data-slot": "guardrail-chip",
|
|
48
|
+
className: (0, apollo_wind_namespaceObject.cn)(guardrailChipVariants({
|
|
49
|
+
appearance,
|
|
50
|
+
className
|
|
51
|
+
})),
|
|
52
|
+
...props
|
|
53
|
+
}));
|
|
54
|
+
GuardrailChip.displayName = 'GuardrailChip';
|
|
55
|
+
exports.GuardrailChip = __webpack_exports__.GuardrailChip;
|
|
56
|
+
exports.guardrailChipVariants = __webpack_exports__.guardrailChipVariants;
|
|
57
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
58
|
+
"GuardrailChip",
|
|
59
|
+
"guardrailChipVariants"
|
|
60
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
61
|
+
Object.defineProperty(exports, '__esModule', {
|
|
62
|
+
value: true
|
|
63
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Toggle } from '@uipath/apollo-wind';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
declare const guardrailChipVariants: (props?: ({
|
|
5
|
+
appearance?: "default" | "addable" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export interface GuardrailChipProps extends React.ComponentPropsWithoutRef<typeof Toggle>, VariantProps<typeof guardrailChipVariants> {
|
|
8
|
+
}
|
|
9
|
+
declare const GuardrailChip: React.ForwardRefExoticComponent<GuardrailChipProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
export { GuardrailChip, guardrailChipVariants };
|
|
11
|
+
//# sourceMappingURL=guardrail-chip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guardrail-chip.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/guardrail-chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAM,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,QAAA,MAAM,qBAAqB;;8EAgB1B,CAAC;AAEF,MAAM,WAAW,kBACf,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,MAAM,CAAC,EACnD,YAAY,CAAC,OAAO,qBAAqB,CAAC;CAAG;AAGjD,QAAA,MAAM,aAAa,8FASlB,CAAC;AAGF,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Toggle, cn } from "@uipath/apollo-wind";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
const guardrailChipVariants = cva('h-6 min-w-0 gap-1 rounded-full border px-2.5 text-xs font-medium [&_svg]:size-3', {
|
|
6
|
+
variants: {
|
|
7
|
+
appearance: {
|
|
8
|
+
default: 'bg-background text-foreground border-border hover:bg-muted hover:text-foreground data-[state=on]:bg-brand-subtle data-[state=on]:text-foreground-accent data-[state=on]:border-brand-lighter future:text-foreground future:hover:text-foreground future:data-[state=on]:text-foreground-accent',
|
|
9
|
+
addable: 'border-dashed bg-background text-foreground-muted border-border hover:bg-muted hover:text-foreground future:text-foreground-muted future:hover:text-foreground'
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
appearance: 'default'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const GuardrailChip = /*#__PURE__*/ forwardRef(({ appearance, className, ...props }, ref)=>/*#__PURE__*/ jsx(Toggle, {
|
|
17
|
+
ref: ref,
|
|
18
|
+
"data-slot": "guardrail-chip",
|
|
19
|
+
className: cn(guardrailChipVariants({
|
|
20
|
+
appearance,
|
|
21
|
+
className
|
|
22
|
+
})),
|
|
23
|
+
...props
|
|
24
|
+
}));
|
|
25
|
+
GuardrailChip.displayName = 'GuardrailChip';
|
|
26
|
+
export { GuardrailChip, guardrailChipVariants };
|
|
@@ -0,0 +1,217 @@
|
|
|
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
|
+
GuardrailScopeSelector: ()=>GuardrailScopeSelector
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
31
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
32
|
+
const external_react_namespaceObject = require("react");
|
|
33
|
+
const external_field_shell_cjs_namespaceObject = require("./field-shell.cjs");
|
|
34
|
+
const external_guardrail_chip_cjs_namespaceObject = require("./guardrail-chip.cjs");
|
|
35
|
+
const ALL_SCOPES = [
|
|
36
|
+
'Agent',
|
|
37
|
+
'Llm',
|
|
38
|
+
'Tool'
|
|
39
|
+
];
|
|
40
|
+
function GuardrailScopeSelector({ selector, onChange, availableToolNames = [], allowedScopes, errors, labels }) {
|
|
41
|
+
const uid = (0, external_react_namespaceObject.useId)();
|
|
42
|
+
const scopeLabels = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
43
|
+
Agent: labels.scopeAgentLabel,
|
|
44
|
+
Llm: labels.scopeLlmLabel,
|
|
45
|
+
Tool: labels.scopeToolLabel
|
|
46
|
+
}), [
|
|
47
|
+
labels
|
|
48
|
+
]);
|
|
49
|
+
const selectedScopes = (0, external_react_namespaceObject.useMemo)(()=>selector.scopes ?? [], [
|
|
50
|
+
selector.scopes
|
|
51
|
+
]);
|
|
52
|
+
const hasTools = availableToolNames.length > 0;
|
|
53
|
+
const visibleScopes = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
54
|
+
const scopes = allowedScopes ?? ALL_SCOPES;
|
|
55
|
+
return hasTools ? scopes : scopes.filter((s)=>'Tool' !== s);
|
|
56
|
+
}, [
|
|
57
|
+
allowedScopes,
|
|
58
|
+
hasTools
|
|
59
|
+
]);
|
|
60
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
61
|
+
if (!hasTools && selectedScopes.includes('Tool')) {
|
|
62
|
+
const cleaned = selectedScopes.filter((s)=>'Tool' !== s);
|
|
63
|
+
onChange({
|
|
64
|
+
scopes: cleaned
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}, [
|
|
68
|
+
hasTools,
|
|
69
|
+
selectedScopes,
|
|
70
|
+
onChange
|
|
71
|
+
]);
|
|
72
|
+
const handleToggleScope = (0, external_react_namespaceObject.useCallback)((scope)=>{
|
|
73
|
+
const isSelected = selectedScopes.includes(scope);
|
|
74
|
+
const newScopes = isSelected ? selectedScopes.filter((s)=>s !== scope) : [
|
|
75
|
+
...selectedScopes,
|
|
76
|
+
scope
|
|
77
|
+
];
|
|
78
|
+
const hasToolScope = newScopes.includes('Tool');
|
|
79
|
+
if (hasToolScope) isSelected || 'Tool' !== scope ? onChange({
|
|
80
|
+
scopes: newScopes,
|
|
81
|
+
matchNames: selector.matchNames ?? [
|
|
82
|
+
...availableToolNames
|
|
83
|
+
]
|
|
84
|
+
}) : onChange({
|
|
85
|
+
scopes: newScopes,
|
|
86
|
+
matchNames: [
|
|
87
|
+
...availableToolNames
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
else onChange({
|
|
91
|
+
scopes: newScopes
|
|
92
|
+
});
|
|
93
|
+
}, [
|
|
94
|
+
selectedScopes,
|
|
95
|
+
selector.matchNames,
|
|
96
|
+
availableToolNames,
|
|
97
|
+
onChange
|
|
98
|
+
]);
|
|
99
|
+
const handleToggleTool = (0, external_react_namespaceObject.useCallback)((toolName)=>{
|
|
100
|
+
const current = selector.matchNames ?? [];
|
|
101
|
+
const isSelected = current.includes(toolName);
|
|
102
|
+
const newMatchNames = isSelected ? current.filter((n)=>n !== toolName) : [
|
|
103
|
+
...current,
|
|
104
|
+
toolName
|
|
105
|
+
];
|
|
106
|
+
onChange({
|
|
107
|
+
...selector,
|
|
108
|
+
matchNames: newMatchNames
|
|
109
|
+
});
|
|
110
|
+
}, [
|
|
111
|
+
selector,
|
|
112
|
+
onChange
|
|
113
|
+
]);
|
|
114
|
+
const selectedTools = (0, external_react_namespaceObject.useMemo)(()=>selector.matchNames ?? [], [
|
|
115
|
+
selector.matchNames
|
|
116
|
+
]);
|
|
117
|
+
const hasToolScope = selectedScopes.includes('Tool');
|
|
118
|
+
const targetedTools = (0, external_react_namespaceObject.useMemo)(()=>selectedTools.filter((name)=>availableToolNames.includes(name)), [
|
|
119
|
+
selectedTools,
|
|
120
|
+
availableToolNames
|
|
121
|
+
]);
|
|
122
|
+
const addableTools = (0, external_react_namespaceObject.useMemo)(()=>availableToolNames.filter((name)=>!selectedTools.includes(name)), [
|
|
123
|
+
availableToolNames,
|
|
124
|
+
selectedTools
|
|
125
|
+
]);
|
|
126
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
127
|
+
"data-slot": "guardrail-scope-selector",
|
|
128
|
+
className: "space-y-3",
|
|
129
|
+
children: [
|
|
130
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.FormField, {
|
|
131
|
+
children: [
|
|
132
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Label, {
|
|
133
|
+
id: `${uid}-scopes-label`,
|
|
134
|
+
children: [
|
|
135
|
+
labels.scopesLabel,
|
|
136
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.RequiredIndicator, {})
|
|
137
|
+
]
|
|
138
|
+
}),
|
|
139
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_field_shell_cjs_namespaceObject.FieldShell, {
|
|
140
|
+
invalid: Boolean(errors?.scopes),
|
|
141
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
142
|
+
role: "group",
|
|
143
|
+
"aria-labelledby": `${uid}-scopes-label`,
|
|
144
|
+
"aria-invalid": errors?.scopes ? true : void 0,
|
|
145
|
+
"aria-describedby": errors?.scopes ? `${uid}-scopes-error` : void 0,
|
|
146
|
+
className: "flex flex-wrap gap-1.5",
|
|
147
|
+
children: visibleScopes.map((scope)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_guardrail_chip_cjs_namespaceObject.GuardrailChip, {
|
|
148
|
+
pressed: selectedScopes.includes(scope),
|
|
149
|
+
onPressedChange: ()=>handleToggleScope(scope),
|
|
150
|
+
children: scopeLabels[scope]
|
|
151
|
+
}, scope))
|
|
152
|
+
})
|
|
153
|
+
}),
|
|
154
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.FormFieldError, {
|
|
155
|
+
id: `${uid}-scopes-error`,
|
|
156
|
+
children: errors?.scopes
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
}),
|
|
160
|
+
hasToolScope && availableToolNames.length > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.FormField, {
|
|
161
|
+
children: [
|
|
162
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Label, {
|
|
163
|
+
id: `${uid}-tools-label`,
|
|
164
|
+
children: [
|
|
165
|
+
labels.toolsLabel,
|
|
166
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.RequiredIndicator, {})
|
|
167
|
+
]
|
|
168
|
+
}),
|
|
169
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_field_shell_cjs_namespaceObject.FieldShell, {
|
|
170
|
+
invalid: Boolean(errors?.toolNames),
|
|
171
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
172
|
+
role: "group",
|
|
173
|
+
"aria-labelledby": `${uid}-tools-label`,
|
|
174
|
+
"aria-invalid": errors?.toolNames ? true : void 0,
|
|
175
|
+
"aria-describedby": errors?.toolNames ? `${uid}-tools-error` : void 0,
|
|
176
|
+
className: "flex flex-wrap gap-1.5",
|
|
177
|
+
children: [
|
|
178
|
+
targetedTools.map((name)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_guardrail_chip_cjs_namespaceObject.GuardrailChip, {
|
|
179
|
+
pressed: true,
|
|
180
|
+
onPressedChange: ()=>handleToggleTool(name),
|
|
181
|
+
children: [
|
|
182
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Check, {
|
|
183
|
+
"aria-hidden": "true"
|
|
184
|
+
}),
|
|
185
|
+
name
|
|
186
|
+
]
|
|
187
|
+
}, `targeted-${name}`)),
|
|
188
|
+
addableTools.map((name)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_guardrail_chip_cjs_namespaceObject.GuardrailChip, {
|
|
189
|
+
appearance: "addable",
|
|
190
|
+
pressed: false,
|
|
191
|
+
onPressedChange: ()=>handleToggleTool(name),
|
|
192
|
+
children: [
|
|
193
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
|
|
194
|
+
"aria-hidden": "true"
|
|
195
|
+
}),
|
|
196
|
+
name
|
|
197
|
+
]
|
|
198
|
+
}, `addable-${name}`))
|
|
199
|
+
]
|
|
200
|
+
})
|
|
201
|
+
}),
|
|
202
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.FormFieldError, {
|
|
203
|
+
id: `${uid}-tools-error`,
|
|
204
|
+
children: errors?.toolNames
|
|
205
|
+
})
|
|
206
|
+
]
|
|
207
|
+
})
|
|
208
|
+
]
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
exports.GuardrailScopeSelector = __webpack_exports__.GuardrailScopeSelector;
|
|
212
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
213
|
+
"GuardrailScopeSelector"
|
|
214
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
215
|
+
Object.defineProperty(exports, '__esModule', {
|
|
216
|
+
value: true
|
|
217
|
+
});
|