@uipath/apollo-react 6.45.3 → 6.47.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/icons/MaestroAutomate.cjs +71 -0
- package/dist/icons/MaestroAutomate.d.ts +7 -0
- package/dist/icons/MaestroAutomate.d.ts.map +1 -0
- package/dist/icons/MaestroAutomate.js +24 -0
- package/dist/icons/MaestroAutomateFlat.cjs +71 -0
- package/dist/icons/MaestroAutomateFlat.d.ts +7 -0
- package/dist/icons/MaestroAutomateFlat.d.ts.map +1 -0
- package/dist/icons/MaestroAutomateFlat.js +24 -0
- package/dist/icons/MaestroBpmn.cjs +71 -0
- package/dist/icons/MaestroBpmn.d.ts +7 -0
- package/dist/icons/MaestroBpmn.d.ts.map +1 -0
- package/dist/icons/MaestroBpmn.js +24 -0
- package/dist/icons/MaestroBpmnFlat.cjs +71 -0
- package/dist/icons/MaestroBpmnFlat.d.ts +7 -0
- package/dist/icons/MaestroBpmnFlat.d.ts.map +1 -0
- package/dist/icons/MaestroBpmnFlat.js +24 -0
- package/dist/icons/MaestroCase.cjs +71 -0
- package/dist/icons/MaestroCase.d.ts +7 -0
- package/dist/icons/MaestroCase.d.ts.map +1 -0
- package/dist/icons/MaestroCase.js +24 -0
- package/dist/icons/MaestroCaseFlat.cjs +71 -0
- package/dist/icons/MaestroCaseFlat.d.ts +7 -0
- package/dist/icons/MaestroCaseFlat.d.ts.map +1 -0
- package/dist/icons/MaestroCaseFlat.js +24 -0
- package/dist/icons/MaestroFlow.cjs +71 -0
- package/dist/icons/MaestroFlow.d.ts +7 -0
- package/dist/icons/MaestroFlow.d.ts.map +1 -0
- package/dist/icons/MaestroFlow.js +24 -0
- package/dist/icons/MaestroFlowFlat.cjs +71 -0
- package/dist/icons/MaestroFlowFlat.d.ts +7 -0
- package/dist/icons/MaestroFlowFlat.d.ts.map +1 -0
- package/dist/icons/MaestroFlowFlat.js +24 -0
- package/dist/icons/index.cjs +68 -4
- package/dist/icons/index.d.ts +8 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/index.js +9 -1
- package/dist/test/setup.d.ts.map +1 -1
- package/package.json +12 -4
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Alert, AlertDescription, FormField, FormFieldLabel, InfoTooltip, Input, Label, Separator, Switch, Textarea, cn } from "@uipath/apollo-wind";
|
|
3
|
+
import { Info } from "lucide-react";
|
|
4
|
+
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { GUARDRAIL_BYO_VALIDATOR_TYPE } from "./builder-types.js";
|
|
6
|
+
import { getGuardrailActionErrorFields, getGuardrailSelectorErrorFields, initGuardrailBuilderFormData } from "./builder-utils.js";
|
|
7
|
+
import { GuardrailActionSection } from "./components/guardrail-action-section.js";
|
|
8
|
+
import { GuardrailScopeSelector } from "./components/guardrail-scope-selector.js";
|
|
9
|
+
import { GuardrailStatusBanner } from "./components/guardrail-status-banner.js";
|
|
10
|
+
import { MixedScopesBanner } from "./components/mixed-scopes-banner.js";
|
|
11
|
+
import { GuardrailFormLayout } from "./guardrail-form-layout.js";
|
|
12
|
+
import { GuardrailValidatorForm } from "./guardrail-validator-form.js";
|
|
13
|
+
import { formatGuardrailFormMessage, useGuardrailBuilderLabels } from "./i18n.js";
|
|
14
|
+
import { dropEmptyOptionalParameters, getOutOfRangeParameterIds, getRequiredEmptyParameterIds, syncMapEnumParameters } from "./utils.js";
|
|
15
|
+
const EMPTY_PARAM_IDS = new Set();
|
|
16
|
+
function GuardrailBuilder({ open, definition, scope, guardrail, defaultName, existingNames, toolName, availableToolNames, onSave, onCancel, onSaveAsNew, otherAppliedScopes = null, inline = false, hideHeader = false, dialogMaxWidth, title, evalsTogglePlacement = 'form', renderRecipientSearch, renderStaticRecipient, renderAppPicker, escalateHelp, errors: hostErrors, renderParameter, overrideParameterIds, saveDisabled: hostSaveDisabled = false, labels: labelOverrides, className }) {
|
|
17
|
+
const labels = useGuardrailBuilderLabels(labelOverrides);
|
|
18
|
+
const uid = useId();
|
|
19
|
+
const [formData, setFormData] = useState(()=>{
|
|
20
|
+
const data = initGuardrailBuilderFormData(definition, scope, guardrail, toolName);
|
|
21
|
+
if (!guardrail && defaultName) data.name = defaultName;
|
|
22
|
+
return data;
|
|
23
|
+
});
|
|
24
|
+
const [showErrors, setShowErrors] = useState(false);
|
|
25
|
+
const [editedParamIds, setEditedParamIds] = useState(EMPTY_PARAM_IDS);
|
|
26
|
+
useEffect(()=>{
|
|
27
|
+
setEditedParamIds(EMPTY_PARAM_IDS);
|
|
28
|
+
}, [
|
|
29
|
+
hostErrors
|
|
30
|
+
]);
|
|
31
|
+
const rootRef = useRef(null);
|
|
32
|
+
useEffect(()=>{
|
|
33
|
+
const node = rootRef.current;
|
|
34
|
+
if (!node) return;
|
|
35
|
+
const swallowEnter = (event)=>{
|
|
36
|
+
if ('Enter' !== event.key || event.defaultPrevented) return;
|
|
37
|
+
const target = event.target;
|
|
38
|
+
if (target instanceof HTMLInputElement && 'button' !== target.type) event.preventDefault();
|
|
39
|
+
};
|
|
40
|
+
node.addEventListener('keydown', swallowEnter);
|
|
41
|
+
return ()=>node.removeEventListener('keydown', swallowEnter);
|
|
42
|
+
}, []);
|
|
43
|
+
const showScopeSelector = 'Agent' === scope;
|
|
44
|
+
const updateField = useCallback((field, value)=>{
|
|
45
|
+
setFormData((prev)=>({
|
|
46
|
+
...prev,
|
|
47
|
+
[field]: value
|
|
48
|
+
}));
|
|
49
|
+
}, []);
|
|
50
|
+
const handleSelectorChange = useCallback((selector)=>updateField('selector', selector), [
|
|
51
|
+
updateField
|
|
52
|
+
]);
|
|
53
|
+
const guardrailResult = useMemo(()=>{
|
|
54
|
+
const textListIds = new Set(definition.parameters.filter((p)=>'text-list' === p.type).map((p)=>p.id));
|
|
55
|
+
const trimmed = syncMapEnumParameters(formData.validatorParameters, definition.parameters).map((param)=>'text-list' === param.$parameterType && textListIds.has(param.id) && Array.isArray(param.value) ? {
|
|
56
|
+
...param,
|
|
57
|
+
value: param.value.filter((entry)=>'string' == typeof entry && entry.trim().length > 0)
|
|
58
|
+
} : param);
|
|
59
|
+
const validatorParameters = dropEmptyOptionalParameters(trimmed, definition.parameters);
|
|
60
|
+
const isByo = void 0 !== definition.byoValidatorName;
|
|
61
|
+
return {
|
|
62
|
+
id: formData.id,
|
|
63
|
+
$guardrailType: 'builtInValidator',
|
|
64
|
+
name: formData.name,
|
|
65
|
+
description: formData.description || void 0,
|
|
66
|
+
selector: formData.selector,
|
|
67
|
+
action: formData.action,
|
|
68
|
+
enabledForEvals: formData.enabledForEvals,
|
|
69
|
+
validatorType: isByo ? GUARDRAIL_BYO_VALIDATOR_TYPE : definition.validator,
|
|
70
|
+
validatorParameters,
|
|
71
|
+
...isByo ? {
|
|
72
|
+
byoValidatorName: definition.byoValidatorName
|
|
73
|
+
} : {}
|
|
74
|
+
};
|
|
75
|
+
}, [
|
|
76
|
+
formData,
|
|
77
|
+
definition
|
|
78
|
+
]);
|
|
79
|
+
const internalErrors = useMemo(()=>{
|
|
80
|
+
const e = {};
|
|
81
|
+
if (formData.name.trim()) {
|
|
82
|
+
if (existingNames?.some((n)=>n.toLowerCase() === formData.name.trim().toLowerCase())) e.name = labels.nameDuplicateError;
|
|
83
|
+
} else e.name = labels.nameRequiredError;
|
|
84
|
+
if (showScopeSelector) for (const field of getGuardrailSelectorErrorFields(formData.selector))e[field] = 'scopes' === field ? labels.scopesRequiredError : labels.toolsRequiredError;
|
|
85
|
+
const reconciledParameters = syncMapEnumParameters(formData.validatorParameters, definition.parameters);
|
|
86
|
+
const parameterErrors = {};
|
|
87
|
+
for (const id of getRequiredEmptyParameterIds(definition.parameters, reconciledParameters))parameterErrors[id] = labels.parameterRequiredError;
|
|
88
|
+
for (const id of getOutOfRangeParameterIds(definition.parameters, reconciledParameters))parameterErrors[id] ??= labels.parameterOutOfRangeError;
|
|
89
|
+
if (Object.keys(parameterErrors).length > 0) e.parameters = parameterErrors;
|
|
90
|
+
for (const field of getGuardrailActionErrorFields(formData.action))e[field] = ({
|
|
91
|
+
blockReason: labels.blockReasonRequiredError,
|
|
92
|
+
filterFields: labels.filterFieldsRequiredError,
|
|
93
|
+
recipient: labels.recipientRequiredError,
|
|
94
|
+
actionApp: labels.actionAppRequiredError
|
|
95
|
+
})[field];
|
|
96
|
+
return e;
|
|
97
|
+
}, [
|
|
98
|
+
formData,
|
|
99
|
+
showScopeSelector,
|
|
100
|
+
definition.parameters,
|
|
101
|
+
existingNames,
|
|
102
|
+
labels
|
|
103
|
+
]);
|
|
104
|
+
const liveHostParameterErrors = useMemo(()=>{
|
|
105
|
+
const fromHost = hostErrors?.parameters;
|
|
106
|
+
if (!fromHost) return {};
|
|
107
|
+
return Object.fromEntries(Object.entries(fromHost).filter(([id])=>!editedParamIds.has(id)));
|
|
108
|
+
}, [
|
|
109
|
+
hostErrors,
|
|
110
|
+
editedParamIds
|
|
111
|
+
]);
|
|
112
|
+
const displayErrors = useMemo(()=>{
|
|
113
|
+
const base = showErrors ? {
|
|
114
|
+
...internalErrors
|
|
115
|
+
} : {};
|
|
116
|
+
if (hostErrors) {
|
|
117
|
+
for (const [key, value] of Object.entries(hostErrors))if (void 0 !== value) base[key] = 'parameters' === key ? {
|
|
118
|
+
...base.parameters,
|
|
119
|
+
...liveHostParameterErrors
|
|
120
|
+
} : value;
|
|
121
|
+
}
|
|
122
|
+
return base;
|
|
123
|
+
}, [
|
|
124
|
+
showErrors,
|
|
125
|
+
internalErrors,
|
|
126
|
+
hostErrors,
|
|
127
|
+
liveHostParameterErrors
|
|
128
|
+
]);
|
|
129
|
+
const hasHostErrors = Boolean(hostErrors && Object.entries(hostErrors).some(([key, v])=>{
|
|
130
|
+
if (void 0 === v) return false;
|
|
131
|
+
if ('parameters' === key) return Object.keys(liveHostParameterErrors).length > 0;
|
|
132
|
+
return 'object' != typeof v || Object.keys(v).length > 0;
|
|
133
|
+
}));
|
|
134
|
+
const isValid = 0 === Object.keys(internalErrors).length && !hasHostErrors;
|
|
135
|
+
const isDefinitionAvailable = 'Available' === definition.status;
|
|
136
|
+
const handleSave = useCallback(()=>{
|
|
137
|
+
if (!isDefinitionAvailable) return;
|
|
138
|
+
if (!isValid) return void setShowErrors(true);
|
|
139
|
+
onSave(guardrailResult);
|
|
140
|
+
}, [
|
|
141
|
+
guardrailResult,
|
|
142
|
+
onSave,
|
|
143
|
+
isValid,
|
|
144
|
+
isDefinitionAvailable
|
|
145
|
+
]);
|
|
146
|
+
const handleSaveAsNew = useCallback(()=>{
|
|
147
|
+
if (!onSaveAsNew) return;
|
|
148
|
+
if (!isDefinitionAvailable) return;
|
|
149
|
+
if (!isValid) return void setShowErrors(true);
|
|
150
|
+
onSaveAsNew(guardrailResult);
|
|
151
|
+
}, [
|
|
152
|
+
guardrailResult,
|
|
153
|
+
onSaveAsNew,
|
|
154
|
+
isValid,
|
|
155
|
+
isDefinitionAvailable
|
|
156
|
+
]);
|
|
157
|
+
const isByoConfigurationDisabled = void 0 !== definition.byoValidatorName && 'Disabled' === definition.status;
|
|
158
|
+
const computedTitle = guardrail ? formatGuardrailFormMessage(labels.editTitle, {
|
|
159
|
+
name: definition.displayName
|
|
160
|
+
}) : formatGuardrailFormMessage(labels.addTitle, {
|
|
161
|
+
name: definition.displayName
|
|
162
|
+
});
|
|
163
|
+
const statusBanner = isByoConfigurationDisabled ? /*#__PURE__*/ jsx(GuardrailStatusBanner, {
|
|
164
|
+
tone: "error",
|
|
165
|
+
message: labels.byoDisabledMessage
|
|
166
|
+
}) : 'Unauthorised' === definition.status ? /*#__PURE__*/ jsx(GuardrailStatusBanner, {
|
|
167
|
+
tone: "warning",
|
|
168
|
+
message: labels.unauthorizedMessage
|
|
169
|
+
}) : 'FeatureDisabled' === definition.status ? /*#__PURE__*/ jsx(GuardrailStatusBanner, {
|
|
170
|
+
tone: "warning",
|
|
171
|
+
message: labels.featureDisabledMessage
|
|
172
|
+
}) : null;
|
|
173
|
+
const usageNote = definition.usageNote ? /*#__PURE__*/ jsxs(Alert, {
|
|
174
|
+
variant: "info",
|
|
175
|
+
"data-slot": "guardrail-usage-note",
|
|
176
|
+
children: [
|
|
177
|
+
/*#__PURE__*/ jsx(Info, {}),
|
|
178
|
+
/*#__PURE__*/ jsx(AlertDescription, {
|
|
179
|
+
children: definition.usageNote
|
|
180
|
+
})
|
|
181
|
+
]
|
|
182
|
+
}) : null;
|
|
183
|
+
const evalsToggle = /*#__PURE__*/ jsxs("div", {
|
|
184
|
+
className: "flex items-center gap-2",
|
|
185
|
+
children: [
|
|
186
|
+
/*#__PURE__*/ jsx(Switch, {
|
|
187
|
+
id: `${uid}-ootb-enable-evals`,
|
|
188
|
+
checked: formData.enabledForEvals,
|
|
189
|
+
onCheckedChange: (checked)=>updateField('enabledForEvals', checked)
|
|
190
|
+
}),
|
|
191
|
+
/*#__PURE__*/ jsx(Label, {
|
|
192
|
+
variant: "muted",
|
|
193
|
+
htmlFor: `${uid}-ootb-enable-evals`,
|
|
194
|
+
className: "cursor-pointer",
|
|
195
|
+
children: labels.evalsLabel
|
|
196
|
+
}),
|
|
197
|
+
/*#__PURE__*/ jsx(InfoTooltip, {
|
|
198
|
+
content: labels.evalsTooltip,
|
|
199
|
+
"aria-label": labels.evalsInfoAriaLabel
|
|
200
|
+
})
|
|
201
|
+
]
|
|
202
|
+
});
|
|
203
|
+
const validatorFormErrors = displayErrors.parameters;
|
|
204
|
+
const formBody = /*#__PURE__*/ jsxs("div", {
|
|
205
|
+
ref: rootRef,
|
|
206
|
+
"data-slot": "guardrail-builder",
|
|
207
|
+
className: cn('space-y-4 py-4', className),
|
|
208
|
+
children: [
|
|
209
|
+
statusBanner,
|
|
210
|
+
usageNote,
|
|
211
|
+
guardrail && /*#__PURE__*/ jsxs(FormField, {
|
|
212
|
+
children: [
|
|
213
|
+
/*#__PURE__*/ jsx(Label, {
|
|
214
|
+
htmlFor: `${uid}-ootb-type`,
|
|
215
|
+
children: labels.typeLabel
|
|
216
|
+
}),
|
|
217
|
+
/*#__PURE__*/ jsx(Input, {
|
|
218
|
+
id: `${uid}-ootb-type`,
|
|
219
|
+
value: definition.displayName,
|
|
220
|
+
disabled: true,
|
|
221
|
+
readOnly: true
|
|
222
|
+
})
|
|
223
|
+
]
|
|
224
|
+
}),
|
|
225
|
+
/*#__PURE__*/ jsxs(FormField, {
|
|
226
|
+
children: [
|
|
227
|
+
/*#__PURE__*/ jsx(FormFieldLabel, {
|
|
228
|
+
htmlFor: `${uid}-ootb-name`,
|
|
229
|
+
required: true,
|
|
230
|
+
children: labels.nameLabel
|
|
231
|
+
}),
|
|
232
|
+
/*#__PURE__*/ jsx(Input, {
|
|
233
|
+
id: `${uid}-ootb-name`,
|
|
234
|
+
value: formData.name,
|
|
235
|
+
onChange: (e)=>updateField('name', e.target.value),
|
|
236
|
+
placeholder: labels.namePlaceholder,
|
|
237
|
+
error: displayErrors.name
|
|
238
|
+
})
|
|
239
|
+
]
|
|
240
|
+
}),
|
|
241
|
+
/*#__PURE__*/ jsxs(FormField, {
|
|
242
|
+
children: [
|
|
243
|
+
/*#__PURE__*/ jsx(Label, {
|
|
244
|
+
htmlFor: `${uid}-ootb-description`,
|
|
245
|
+
children: labels.descriptionLabel
|
|
246
|
+
}),
|
|
247
|
+
/*#__PURE__*/ jsx(Textarea, {
|
|
248
|
+
id: `${uid}-ootb-description`,
|
|
249
|
+
minRows: 1,
|
|
250
|
+
value: formData.description,
|
|
251
|
+
onChange: (e)=>updateField("description", e.target.value),
|
|
252
|
+
placeholder: labels.descriptionPlaceholder
|
|
253
|
+
})
|
|
254
|
+
]
|
|
255
|
+
}),
|
|
256
|
+
definition.parameters.length > 0 && /*#__PURE__*/ jsx("div", {
|
|
257
|
+
className: "space-y-3",
|
|
258
|
+
children: /*#__PURE__*/ jsx(GuardrailValidatorForm, {
|
|
259
|
+
parameterDefinitions: definition.parameters,
|
|
260
|
+
parameters: formData.validatorParameters,
|
|
261
|
+
onChange: (params)=>updateField('validatorParameters', params),
|
|
262
|
+
errors: validatorFormErrors,
|
|
263
|
+
validateLive: showErrors,
|
|
264
|
+
onClearError: (paramId)=>setEditedParamIds((prev)=>{
|
|
265
|
+
if (prev.has(paramId)) return prev;
|
|
266
|
+
const next = new Set(prev);
|
|
267
|
+
next.add(paramId);
|
|
268
|
+
return next;
|
|
269
|
+
}),
|
|
270
|
+
renderParameter: renderParameter,
|
|
271
|
+
overrideParameterIds: overrideParameterIds
|
|
272
|
+
})
|
|
273
|
+
}),
|
|
274
|
+
showScopeSelector && /*#__PURE__*/ jsx(GuardrailScopeSelector, {
|
|
275
|
+
selector: formData.selector,
|
|
276
|
+
onChange: handleSelectorChange,
|
|
277
|
+
availableToolNames: availableToolNames,
|
|
278
|
+
allowedScopes: definition.allowedScopes,
|
|
279
|
+
errors: {
|
|
280
|
+
scopes: displayErrors.scopes,
|
|
281
|
+
toolNames: displayErrors.toolNames
|
|
282
|
+
},
|
|
283
|
+
labels: labels
|
|
284
|
+
}),
|
|
285
|
+
/*#__PURE__*/ jsx(Separator, {}),
|
|
286
|
+
/*#__PURE__*/ jsx("div", {
|
|
287
|
+
className: "space-y-3",
|
|
288
|
+
children: /*#__PURE__*/ jsx(GuardrailActionSection, {
|
|
289
|
+
action: formData.action,
|
|
290
|
+
onActionChange: (action)=>updateField('action', action),
|
|
291
|
+
errors: {
|
|
292
|
+
blockReason: displayErrors.blockReason,
|
|
293
|
+
filterFields: displayErrors.filterFields,
|
|
294
|
+
recipient: displayErrors.recipient,
|
|
295
|
+
actionApp: displayErrors.actionApp
|
|
296
|
+
},
|
|
297
|
+
labels: labels,
|
|
298
|
+
renderRecipientSearch: renderRecipientSearch,
|
|
299
|
+
renderStaticRecipient: renderStaticRecipient,
|
|
300
|
+
renderAppPicker: renderAppPicker,
|
|
301
|
+
escalateHelp: escalateHelp
|
|
302
|
+
})
|
|
303
|
+
}),
|
|
304
|
+
'form' === evalsTogglePlacement && evalsToggle,
|
|
305
|
+
/*#__PURE__*/ jsx(MixedScopesBanner, {
|
|
306
|
+
otherAppliedScopes: otherAppliedScopes,
|
|
307
|
+
labels: labels
|
|
308
|
+
})
|
|
309
|
+
]
|
|
310
|
+
});
|
|
311
|
+
const secondaryAction = onSaveAsNew ? {
|
|
312
|
+
label: labels.saveAsNew,
|
|
313
|
+
onClick: handleSaveAsNew,
|
|
314
|
+
disabled: !isDefinitionAvailable || hostSaveDisabled
|
|
315
|
+
} : void 0;
|
|
316
|
+
return /*#__PURE__*/ jsx(GuardrailFormLayout, {
|
|
317
|
+
open: open,
|
|
318
|
+
title: title ?? computedTitle,
|
|
319
|
+
onSave: handleSave,
|
|
320
|
+
onCancel: onCancel,
|
|
321
|
+
inline: inline,
|
|
322
|
+
hideHeader: hideHeader,
|
|
323
|
+
dialogMaxWidth: dialogMaxWidth,
|
|
324
|
+
secondaryAction: secondaryAction,
|
|
325
|
+
saveDisabled: !isDefinitionAvailable || hostSaveDisabled,
|
|
326
|
+
footerStart: 'footer' === evalsTogglePlacement ? evalsToggle : void 0,
|
|
327
|
+
labels: {
|
|
328
|
+
cancel: labels.cancel,
|
|
329
|
+
save: labels.save
|
|
330
|
+
},
|
|
331
|
+
children: formBody
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
GuardrailBuilder.displayName = 'GuardrailBuilder';
|
|
335
|
+
export { GuardrailBuilder };
|
|
@@ -0,0 +1,138 @@
|
|
|
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
|
+
GuardrailFormLayout: ()=>GuardrailFormLayout
|
|
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_i18n_cjs_namespaceObject = require("./i18n.cjs");
|
|
33
|
+
function GuardrailFormLayout({ open, title, children, onSave, onCancel, inline = false, hideHeader = false, dialogMaxWidth = 700, secondaryAction, saveDisabled = false, footerStart, labels }) {
|
|
34
|
+
const builderLabels = (0, external_i18n_cjs_namespaceObject.useGuardrailBuilderLabels)();
|
|
35
|
+
const cancelLabel = labels?.cancel ?? builderLabels.cancel;
|
|
36
|
+
const saveLabel = labels?.save ?? builderLabels.save;
|
|
37
|
+
const footerButtons = (size)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
38
|
+
children: [
|
|
39
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
40
|
+
variant: "outline",
|
|
41
|
+
size: size,
|
|
42
|
+
onClick: onCancel,
|
|
43
|
+
children: cancelLabel
|
|
44
|
+
}),
|
|
45
|
+
secondaryAction && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
46
|
+
variant: "outline",
|
|
47
|
+
size: size,
|
|
48
|
+
onClick: secondaryAction.onClick,
|
|
49
|
+
disabled: secondaryAction.disabled,
|
|
50
|
+
children: secondaryAction.label
|
|
51
|
+
}),
|
|
52
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
53
|
+
size: size,
|
|
54
|
+
onClick: onSave,
|
|
55
|
+
disabled: saveDisabled,
|
|
56
|
+
children: saveLabel
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
if (inline) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
61
|
+
"data-slot": "guardrail-form-layout",
|
|
62
|
+
className: "flex flex-col h-full",
|
|
63
|
+
children: [
|
|
64
|
+
!hideHeader && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
65
|
+
"data-slot": "guardrail-form-layout-header",
|
|
66
|
+
className: "flex items-center gap-2 px-3 py-2 border-b shrink-0",
|
|
67
|
+
children: [
|
|
68
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
69
|
+
variant: "ghost",
|
|
70
|
+
size: "2xs",
|
|
71
|
+
icon: true,
|
|
72
|
+
"aria-label": cancelLabel,
|
|
73
|
+
onClick: onCancel,
|
|
74
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ArrowLeft, {})
|
|
75
|
+
}),
|
|
76
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
77
|
+
className: "text-sm font-medium",
|
|
78
|
+
children: title
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
83
|
+
"data-slot": "guardrail-form-layout-body",
|
|
84
|
+
className: "flex-1 min-h-0 overflow-y-auto px-4",
|
|
85
|
+
children: children
|
|
86
|
+
}),
|
|
87
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
88
|
+
"data-slot": "guardrail-form-layout-footer",
|
|
89
|
+
className: "flex items-center gap-2 px-4 py-3 border-t shrink-0",
|
|
90
|
+
children: [
|
|
91
|
+
footerStart && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
92
|
+
className: "flex items-center gap-2 mr-auto",
|
|
93
|
+
children: footerStart
|
|
94
|
+
}),
|
|
95
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
96
|
+
className: "flex justify-end gap-2 ml-auto",
|
|
97
|
+
children: footerButtons('sm')
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Dialog, {
|
|
104
|
+
open: open,
|
|
105
|
+
onOpenChange: (isOpen)=>!isOpen && onCancel(),
|
|
106
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.DialogContent, {
|
|
107
|
+
className: "max-h-[90vh] overflow-y-auto",
|
|
108
|
+
style: {
|
|
109
|
+
maxWidth: `${dialogMaxWidth}px`
|
|
110
|
+
},
|
|
111
|
+
"aria-describedby": void 0,
|
|
112
|
+
children: [
|
|
113
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.DialogHeader, {
|
|
114
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.DialogTitle, {
|
|
115
|
+
children: title
|
|
116
|
+
})
|
|
117
|
+
}),
|
|
118
|
+
children,
|
|
119
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.DialogFooter, {
|
|
120
|
+
children: [
|
|
121
|
+
footerStart && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
122
|
+
className: "flex items-center gap-2 mr-auto",
|
|
123
|
+
children: footerStart
|
|
124
|
+
}),
|
|
125
|
+
footerButtons()
|
|
126
|
+
]
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
exports.GuardrailFormLayout = __webpack_exports__.GuardrailFormLayout;
|
|
133
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
134
|
+
"GuardrailFormLayout"
|
|
135
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
136
|
+
Object.defineProperty(exports, '__esModule', {
|
|
137
|
+
value: true
|
|
138
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface GuardrailFormLayoutProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
onSave: () => void;
|
|
7
|
+
onCancel: () => void;
|
|
8
|
+
inline?: boolean;
|
|
9
|
+
hideHeader?: boolean;
|
|
10
|
+
dialogMaxWidth?: number;
|
|
11
|
+
secondaryAction?: {
|
|
12
|
+
label: ReactNode;
|
|
13
|
+
onClick: () => void;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
saveDisabled?: boolean;
|
|
17
|
+
footerStart?: ReactNode;
|
|
18
|
+
labels?: {
|
|
19
|
+
cancel?: string;
|
|
20
|
+
save?: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare function GuardrailFormLayout({ open, title, children, onSave, onCancel, inline, hideHeader, dialogMaxWidth, secondaryAction, saveDisabled, footerStart, labels, }: GuardrailFormLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=guardrail-form-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guardrail-form-layout.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/guardrail-form-layout.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,WAAW,wBAAwB;IAEvC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,eAAe,CAAC,EAAE;QAAE,KAAK,EAAE,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAEhF,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB,MAAM,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C;AAQD,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAc,EACd,UAAkB,EAClB,cAAoB,EACpB,eAAe,EACf,YAAoB,EACpB,WAAW,EACX,MAAM,GACP,EAAE,wBAAwB,2CA0E1B"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@uipath/apollo-wind";
|
|
3
|
+
import { ArrowLeft } from "lucide-react";
|
|
4
|
+
import { useGuardrailBuilderLabels } from "./i18n.js";
|
|
5
|
+
function GuardrailFormLayout({ open, title, children, onSave, onCancel, inline = false, hideHeader = false, dialogMaxWidth = 700, secondaryAction, saveDisabled = false, footerStart, labels }) {
|
|
6
|
+
const builderLabels = useGuardrailBuilderLabels();
|
|
7
|
+
const cancelLabel = labels?.cancel ?? builderLabels.cancel;
|
|
8
|
+
const saveLabel = labels?.save ?? builderLabels.save;
|
|
9
|
+
const footerButtons = (size)=>/*#__PURE__*/ jsxs(Fragment, {
|
|
10
|
+
children: [
|
|
11
|
+
/*#__PURE__*/ jsx(Button, {
|
|
12
|
+
variant: "outline",
|
|
13
|
+
size: size,
|
|
14
|
+
onClick: onCancel,
|
|
15
|
+
children: cancelLabel
|
|
16
|
+
}),
|
|
17
|
+
secondaryAction && /*#__PURE__*/ jsx(Button, {
|
|
18
|
+
variant: "outline",
|
|
19
|
+
size: size,
|
|
20
|
+
onClick: secondaryAction.onClick,
|
|
21
|
+
disabled: secondaryAction.disabled,
|
|
22
|
+
children: secondaryAction.label
|
|
23
|
+
}),
|
|
24
|
+
/*#__PURE__*/ jsx(Button, {
|
|
25
|
+
size: size,
|
|
26
|
+
onClick: onSave,
|
|
27
|
+
disabled: saveDisabled,
|
|
28
|
+
children: saveLabel
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
if (inline) return /*#__PURE__*/ jsxs("div", {
|
|
33
|
+
"data-slot": "guardrail-form-layout",
|
|
34
|
+
className: "flex flex-col h-full",
|
|
35
|
+
children: [
|
|
36
|
+
!hideHeader && /*#__PURE__*/ jsxs("div", {
|
|
37
|
+
"data-slot": "guardrail-form-layout-header",
|
|
38
|
+
className: "flex items-center gap-2 px-3 py-2 border-b shrink-0",
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ jsx(Button, {
|
|
41
|
+
variant: "ghost",
|
|
42
|
+
size: "2xs",
|
|
43
|
+
icon: true,
|
|
44
|
+
"aria-label": cancelLabel,
|
|
45
|
+
onClick: onCancel,
|
|
46
|
+
children: /*#__PURE__*/ jsx(ArrowLeft, {})
|
|
47
|
+
}),
|
|
48
|
+
/*#__PURE__*/ jsx("span", {
|
|
49
|
+
className: "text-sm font-medium",
|
|
50
|
+
children: title
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ jsx("div", {
|
|
55
|
+
"data-slot": "guardrail-form-layout-body",
|
|
56
|
+
className: "flex-1 min-h-0 overflow-y-auto px-4",
|
|
57
|
+
children: children
|
|
58
|
+
}),
|
|
59
|
+
/*#__PURE__*/ jsxs("div", {
|
|
60
|
+
"data-slot": "guardrail-form-layout-footer",
|
|
61
|
+
className: "flex items-center gap-2 px-4 py-3 border-t shrink-0",
|
|
62
|
+
children: [
|
|
63
|
+
footerStart && /*#__PURE__*/ jsx("div", {
|
|
64
|
+
className: "flex items-center gap-2 mr-auto",
|
|
65
|
+
children: footerStart
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ jsx("div", {
|
|
68
|
+
className: "flex justify-end gap-2 ml-auto",
|
|
69
|
+
children: footerButtons('sm')
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
});
|
|
75
|
+
return /*#__PURE__*/ jsx(Dialog, {
|
|
76
|
+
open: open,
|
|
77
|
+
onOpenChange: (isOpen)=>!isOpen && onCancel(),
|
|
78
|
+
children: /*#__PURE__*/ jsxs(DialogContent, {
|
|
79
|
+
className: "max-h-[90vh] overflow-y-auto",
|
|
80
|
+
style: {
|
|
81
|
+
maxWidth: `${dialogMaxWidth}px`
|
|
82
|
+
},
|
|
83
|
+
"aria-describedby": void 0,
|
|
84
|
+
children: [
|
|
85
|
+
/*#__PURE__*/ jsx(DialogHeader, {
|
|
86
|
+
children: /*#__PURE__*/ jsx(DialogTitle, {
|
|
87
|
+
children: title
|
|
88
|
+
})
|
|
89
|
+
}),
|
|
90
|
+
children,
|
|
91
|
+
/*#__PURE__*/ jsxs(DialogFooter, {
|
|
92
|
+
children: [
|
|
93
|
+
footerStart && /*#__PURE__*/ jsx("div", {
|
|
94
|
+
className: "flex items-center gap-2 mr-auto",
|
|
95
|
+
children: footerStart
|
|
96
|
+
}),
|
|
97
|
+
footerButtons()
|
|
98
|
+
]
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
export { GuardrailFormLayout };
|