@uipath/apollo-react 6.49.0 → 6.50.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.
Files changed (45) hide show
  1. package/dist/canvas/components/Guardrails/__fixtures__/dnd-geometry.d.ts +3 -0
  2. package/dist/canvas/components/Guardrails/__fixtures__/dnd-geometry.d.ts.map +1 -0
  3. package/dist/canvas/components/Guardrails/__fixtures__/guardrail-list.fixtures.d.ts +9 -0
  4. package/dist/canvas/components/Guardrails/__fixtures__/guardrail-list.fixtures.d.ts.map +1 -0
  5. package/dist/canvas/components/Guardrails/components/guardrail-list-row.cjs +218 -0
  6. package/dist/canvas/components/Guardrails/components/guardrail-list-row.d.ts +26 -0
  7. package/dist/canvas/components/Guardrails/components/guardrail-list-row.d.ts.map +1 -0
  8. package/dist/canvas/components/Guardrails/components/guardrail-list-row.js +184 -0
  9. package/dist/canvas/components/Guardrails/components/guardrail-status-banner.cjs +2 -0
  10. package/dist/canvas/components/Guardrails/components/guardrail-status-banner.d.ts.map +1 -1
  11. package/dist/canvas/components/Guardrails/components/guardrail-status-banner.js +2 -0
  12. package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.cjs +1 -0
  13. package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.d.ts.map +1 -1
  14. package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.js +1 -0
  15. package/dist/canvas/components/Guardrails/guardrail-list-utils.cjs +103 -0
  16. package/dist/canvas/components/Guardrails/guardrail-list-utils.d.ts +10 -0
  17. package/dist/canvas/components/Guardrails/guardrail-list-utils.d.ts.map +1 -0
  18. package/dist/canvas/components/Guardrails/guardrail-list-utils.js +60 -0
  19. package/dist/canvas/components/Guardrails/guardrail-list.cjs +214 -0
  20. package/dist/canvas/components/Guardrails/guardrail-list.d.ts +33 -0
  21. package/dist/canvas/components/Guardrails/guardrail-list.d.ts.map +1 -0
  22. package/dist/canvas/components/Guardrails/guardrail-list.js +180 -0
  23. package/dist/canvas/components/Guardrails/i18n.cjs +124 -16
  24. package/dist/canvas/components/Guardrails/i18n.d.ts +25 -0
  25. package/dist/canvas/components/Guardrails/i18n.d.ts.map +1 -1
  26. package/dist/canvas/components/Guardrails/i18n.js +110 -14
  27. package/dist/canvas/components/Guardrails/index.cjs +40 -3
  28. package/dist/canvas/components/Guardrails/index.d.ts +10 -2
  29. package/dist/canvas/components/Guardrails/index.d.ts.map +1 -1
  30. package/dist/canvas/components/Guardrails/index.js +6 -2
  31. package/dist/canvas/components/Guardrails/list-types.cjs +18 -0
  32. package/dist/canvas/components/Guardrails/list-types.d.ts +51 -0
  33. package/dist/canvas/components/Guardrails/list-types.d.ts.map +1 -0
  34. package/dist/canvas/components/Guardrails/list-types.js +0 -0
  35. package/dist/canvas/locales/en.cjs +1 -1
  36. package/dist/canvas/locales/en.d.ts.map +1 -1
  37. package/dist/canvas/locales/en.js +1 -1
  38. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  39. package/package.json +3 -2
  40. package/dist/canvas/components/Guardrails/__fixtures__/catalog-coverage.cjs +0 -83
  41. package/dist/canvas/components/Guardrails/__fixtures__/catalog-coverage.js +0 -37
  42. package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.cjs +0 -344
  43. package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.js +0 -280
  44. package/dist/canvas/components/Guardrails/__fixtures__/host-copy-baselines.cjs +0 -221
  45. package/dist/canvas/components/Guardrails/__fixtures__/host-copy-baselines.js +0 -184
@@ -0,0 +1,3 @@
1
+ export declare function layoutRowsVertically(container: HTMLElement, selector?: string): void;
2
+ export declare function flushDndFrame(): Promise<void>;
3
+ //# sourceMappingURL=dnd-geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dnd-geometry.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/__fixtures__/dnd-geometry.ts"],"names":[],"mappings":"AAsCA,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,WAAW,EACtB,QAAQ,SAAqC,GAC5C,IAAI,CAUN;AAUD,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAInD"}
@@ -0,0 +1,9 @@
1
+ import type { GuardrailListDefinition, GuardrailListItem } from '../list-types';
2
+ export declare const PII_GUARDRAIL: GuardrailListItem;
3
+ export declare const BYO_GUARDRAIL: GuardrailListItem;
4
+ export declare const CUSTOM_GUARDRAIL: GuardrailListItem;
5
+ export declare const GUARDRAILS: GuardrailListItem[];
6
+ export declare const PII_DEFINITION: GuardrailListDefinition;
7
+ export declare const BYO_DEFINITION: GuardrailListDefinition;
8
+ export declare const DEFINITIONS: GuardrailListDefinition[];
9
+ //# sourceMappingURL=guardrail-list.fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guardrail-list.fixtures.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/__fixtures__/guardrail-list.fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAQhF,eAAO,MAAM,aAAa,EAAE,iBAQ3B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,iBAQ3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,iBAM9B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,iBAAiB,EAAqD,CAAC;AAEhG,eAAO,MAAM,cAAc,EAAE,uBAG5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,uBAK5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,uBAAuB,EAAqC,CAAC"}
@@ -0,0 +1,218 @@
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
+ GuardrailListRow: ()=>GuardrailListRow
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_guardrail_list_utils_cjs_namespaceObject = require("../guardrail-list-utils.cjs");
34
+ const external_i18n_cjs_namespaceObject = require("../i18n.cjs");
35
+ const external_guardrail_status_chip_cjs_namespaceObject = require("./guardrail-status-chip.cjs");
36
+ const GuardrailListRow = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ item, id, index, state, labels, disabled = false, handle, administration, statusChips = false, previewChip = false, byoChip = false, rowActivatesEdit = false, onEdit, onRemove, renderItemActions, renderRowTooltip, formatScopes, formatAction, className, ...props }, ref)=>{
37
+ const handleEdit = onEdit && !disabled ? ()=>onEdit(item) : void 0;
38
+ const handleRemove = onRemove && !disabled ? ()=>onRemove(item) : void 0;
39
+ const chips = statusChips ? (0, external_guardrail_list_utils_cjs_namespaceObject.getGuardrailListChips)({
40
+ status: state.status,
41
+ administration
42
+ }, labels) : [];
43
+ const isBuiltInValidator = 'builtInValidator' === item.$guardrailType;
44
+ const rowName = item.name.trim();
45
+ const nameRow = (template, generic)=>rowName ? (0, external_i18n_cjs_namespaceObject.formatGuardrailFormMessage)(template, {
46
+ name: rowName
47
+ }) : generic;
48
+ const scopes = item.selector?.scopes ?? [];
49
+ const scopesContent = formatScopes ? formatScopes(item) : scopes.join(', ') || null;
50
+ const actionContent = formatAction ? formatAction(item) : item.action?.$actionType ?? labels.actionUnknown;
51
+ const defaultActions = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
52
+ children: [
53
+ onEdit && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
54
+ type: "button",
55
+ variant: "ghost",
56
+ size: "3xs",
57
+ icon: true,
58
+ disabled: disabled,
59
+ "aria-label": nameRow(labels.editRow, labels.editItem),
60
+ onClick: handleEdit,
61
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Pencil, {})
62
+ }),
63
+ onRemove && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
64
+ type: "button",
65
+ variant: "ghost",
66
+ size: "3xs",
67
+ icon: true,
68
+ disabled: disabled,
69
+ "aria-label": nameRow(labels.removeRow, labels.removeItem),
70
+ className: "text-destructive future:text-destructive hover:text-destructive future:hover:text-destructive",
71
+ onClick: handleRemove,
72
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Trash2, {})
73
+ })
74
+ ]
75
+ });
76
+ const actions = renderItemActions ? renderItemActions({
77
+ item,
78
+ id,
79
+ index,
80
+ disabled,
81
+ onEdit: handleEdit,
82
+ onRemove: handleRemove,
83
+ defaultActions
84
+ }) : defaultActions;
85
+ const tooltip = renderRowTooltip?.(item);
86
+ const activatable = rowActivatesEdit && void 0 !== handleEdit;
87
+ const bodyId = external_react_namespaceObject.useId();
88
+ const chipId = (chip)=>`${bodyId}-chip-${chip}`;
89
+ const byoDisabledId = `${bodyId}-byo-disabled`;
90
+ const byoUnavailableId = `${bodyId}-byo-unavailable`;
91
+ const descriptionId = `${bodyId}-description`;
92
+ const describedBy = activatable ? [
93
+ ...chips.map((chip)=>chipId(chip.id)),
94
+ state.byoDisabled ? byoDisabledId : void 0,
95
+ state.byoUnavailable ? byoUnavailableId : void 0,
96
+ item.description ? descriptionId : void 0
97
+ ].filter(Boolean).join(' ') : '';
98
+ const bodyProps = activatable ? {
99
+ role: 'button',
100
+ tabIndex: 0,
101
+ 'aria-label': nameRow(labels.editRow, labels.editItem),
102
+ ...describedBy ? {
103
+ 'aria-describedby': describedBy
104
+ } : {},
105
+ onClick: handleEdit,
106
+ onKeyDown: (event)=>{
107
+ if ('Enter' === event.key || ' ' === event.key) {
108
+ event.preventDefault();
109
+ handleEdit?.();
110
+ }
111
+ }
112
+ } : tooltip ? {
113
+ tabIndex: 0
114
+ } : {};
115
+ const body = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
116
+ className: (0, apollo_wind_namespaceObject.cn)('min-w-0 flex-1', activatable && 'cursor-pointer rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'),
117
+ ...bodyProps,
118
+ children: [
119
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
120
+ className: "flex items-center gap-2",
121
+ children: [
122
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
123
+ className: "truncate text-sm font-medium",
124
+ children: item.name
125
+ }),
126
+ byoChip && state.isByo && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_guardrail_status_chip_cjs_namespaceObject.GuardrailStatusChip, {
127
+ tone: "success",
128
+ children: labels.byo
129
+ }),
130
+ previewChip && isBuiltInValidator && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_guardrail_status_chip_cjs_namespaceObject.GuardrailStatusChip, {
131
+ tone: "info",
132
+ children: labels.preview
133
+ }),
134
+ chips.map((chip)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_guardrail_status_chip_cjs_namespaceObject.GuardrailStatusChip, {
135
+ id: chipId(chip.id),
136
+ tone: chip.tone,
137
+ children: chip.label
138
+ }, chip.id))
139
+ ]
140
+ }),
141
+ state.byoDisabled && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
142
+ id: byoDisabledId,
143
+ className: "whitespace-normal break-words text-xs text-error",
144
+ role: "alert",
145
+ children: labels.byoDisabledNotice
146
+ }),
147
+ state.byoUnavailable && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
148
+ id: byoUnavailableId,
149
+ className: "whitespace-normal break-words text-xs text-error",
150
+ role: "alert",
151
+ children: labels.byoUnavailableNotice
152
+ }),
153
+ item.description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
154
+ id: descriptionId,
155
+ className: "truncate text-xs text-muted-foreground",
156
+ children: item.description
157
+ }),
158
+ void 0 !== state.provider && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
159
+ className: "truncate text-xs text-muted-foreground",
160
+ children: [
161
+ labels.provider,
162
+ ": ",
163
+ state.provider
164
+ ]
165
+ }),
166
+ (actionContent || scopesContent) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
167
+ className: "mt-1 flex flex-wrap items-center gap-1.5",
168
+ children: [
169
+ actionContent && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Badge, {
170
+ variant: "secondary",
171
+ className: (0, apollo_wind_namespaceObject.cn)('border-border bg-muted/60 text-xs text-muted-foreground', !formatAction && 'capitalize'),
172
+ children: actionContent
173
+ }),
174
+ scopesContent && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
175
+ className: "text-xs text-muted-foreground",
176
+ children: scopesContent
177
+ })
178
+ ]
179
+ })
180
+ ]
181
+ });
182
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
183
+ ref: ref,
184
+ "data-slot": "guardrail-list-row",
185
+ "data-guardrail-id": id,
186
+ className: (0, apollo_wind_namespaceObject.cn)('flex items-center gap-2', '-mx-1 rounded-md p-1 transition-colors hover:bg-accent', className),
187
+ ...props,
188
+ children: [
189
+ handle,
190
+ tooltip ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.TooltipProvider, {
191
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Tooltip, {
192
+ children: [
193
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.TooltipTrigger, {
194
+ asChild: true,
195
+ children: body
196
+ }),
197
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.TooltipContent, {
198
+ children: tooltip
199
+ })
200
+ ]
201
+ })
202
+ }) : body,
203
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
204
+ "data-slot": "guardrail-list-row-actions",
205
+ className: "flex shrink-0 items-center gap-0",
206
+ children: actions
207
+ })
208
+ ]
209
+ });
210
+ });
211
+ GuardrailListRow.displayName = 'GuardrailListRow';
212
+ exports.GuardrailListRow = __webpack_exports__.GuardrailListRow;
213
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
214
+ "GuardrailListRow"
215
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
216
+ Object.defineProperty(exports, '__esModule', {
217
+ value: true
218
+ });
@@ -0,0 +1,26 @@
1
+ import * as React from 'react';
2
+ import { type GuardrailListLabels } from '../i18n';
3
+ import type { GuardrailListAdministration, GuardrailListItem, GuardrailListItemActionsContext, GuardrailListItemState, GuardrailRowTooltipRenderer } from '../list-types';
4
+ export interface GuardrailListRowProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
5
+ item: GuardrailListItem;
6
+ id: string;
7
+ index: number;
8
+ state: GuardrailListItemState;
9
+ labels: GuardrailListLabels;
10
+ disabled?: boolean;
11
+ handle?: React.ReactNode;
12
+ administration?: GuardrailListAdministration;
13
+ statusChips?: boolean;
14
+ previewChip?: boolean;
15
+ byoChip?: boolean;
16
+ rowActivatesEdit?: boolean;
17
+ onEdit?: (item: GuardrailListItem) => void;
18
+ onRemove?: (item: GuardrailListItem) => void;
19
+ renderItemActions?: (ctx: GuardrailListItemActionsContext) => React.ReactNode;
20
+ renderRowTooltip?: GuardrailRowTooltipRenderer;
21
+ formatScopes?: (item: GuardrailListItem) => React.ReactNode;
22
+ formatAction?: (item: GuardrailListItem) => React.ReactNode;
23
+ }
24
+ declare const GuardrailListRow: React.ForwardRefExoticComponent<GuardrailListRowProps & React.RefAttributes<HTMLDivElement>>;
25
+ export { GuardrailListRow };
26
+ //# sourceMappingURL=guardrail-list-row.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guardrail-list-row.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/guardrail-list-row.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAA8B,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,KAAK,EACV,2BAA2B,EAC3B,iBAAiB,EACjB,+BAA+B,EAC/B,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC/D,IAAI,EAAE,iBAAiB,CAAC;IAExB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IAEd,KAAK,EAAE,sBAAsB,CAAC;IAC9B,MAAM,EAAE,mBAAmB,CAAC;IAE5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,cAAc,CAAC,EAAE,2BAA2B,CAAC;IAC7C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7C,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,+BAA+B,KAAK,KAAK,CAAC,SAAS,CAAC;IAE9E,gBAAgB,CAAC,EAAE,2BAA2B,CAAC;IAC/C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,KAAK,CAAC,SAAS,CAAC;IAC5D,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,KAAK,CAAC,SAAS,CAAC;CAC7D;AASD,QAAA,MAAM,gBAAgB,8FAqQrB,CAAC;AAGF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,184 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Badge, Button, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, cn } from "@uipath/apollo-wind";
3
+ import { Pencil, Trash2 } from "lucide-react";
4
+ import { forwardRef, useId } from "react";
5
+ import { getGuardrailListChips } from "../guardrail-list-utils.js";
6
+ import { formatGuardrailFormMessage } from "../i18n.js";
7
+ import { GuardrailStatusChip } from "./guardrail-status-chip.js";
8
+ const GuardrailListRow = /*#__PURE__*/ forwardRef(({ item, id, index, state, labels, disabled = false, handle, administration, statusChips = false, previewChip = false, byoChip = false, rowActivatesEdit = false, onEdit, onRemove, renderItemActions, renderRowTooltip, formatScopes, formatAction, className, ...props }, ref)=>{
9
+ const handleEdit = onEdit && !disabled ? ()=>onEdit(item) : void 0;
10
+ const handleRemove = onRemove && !disabled ? ()=>onRemove(item) : void 0;
11
+ const chips = statusChips ? getGuardrailListChips({
12
+ status: state.status,
13
+ administration
14
+ }, labels) : [];
15
+ const isBuiltInValidator = 'builtInValidator' === item.$guardrailType;
16
+ const rowName = item.name.trim();
17
+ const nameRow = (template, generic)=>rowName ? formatGuardrailFormMessage(template, {
18
+ name: rowName
19
+ }) : generic;
20
+ const scopes = item.selector?.scopes ?? [];
21
+ const scopesContent = formatScopes ? formatScopes(item) : scopes.join(', ') || null;
22
+ const actionContent = formatAction ? formatAction(item) : item.action?.$actionType ?? labels.actionUnknown;
23
+ const defaultActions = /*#__PURE__*/ jsxs(Fragment, {
24
+ children: [
25
+ onEdit && /*#__PURE__*/ jsx(Button, {
26
+ type: "button",
27
+ variant: "ghost",
28
+ size: "3xs",
29
+ icon: true,
30
+ disabled: disabled,
31
+ "aria-label": nameRow(labels.editRow, labels.editItem),
32
+ onClick: handleEdit,
33
+ children: /*#__PURE__*/ jsx(Pencil, {})
34
+ }),
35
+ onRemove && /*#__PURE__*/ jsx(Button, {
36
+ type: "button",
37
+ variant: "ghost",
38
+ size: "3xs",
39
+ icon: true,
40
+ disabled: disabled,
41
+ "aria-label": nameRow(labels.removeRow, labels.removeItem),
42
+ className: "text-destructive future:text-destructive hover:text-destructive future:hover:text-destructive",
43
+ onClick: handleRemove,
44
+ children: /*#__PURE__*/ jsx(Trash2, {})
45
+ })
46
+ ]
47
+ });
48
+ const actions = renderItemActions ? renderItemActions({
49
+ item,
50
+ id,
51
+ index,
52
+ disabled,
53
+ onEdit: handleEdit,
54
+ onRemove: handleRemove,
55
+ defaultActions
56
+ }) : defaultActions;
57
+ const tooltip = renderRowTooltip?.(item);
58
+ const activatable = rowActivatesEdit && void 0 !== handleEdit;
59
+ const bodyId = useId();
60
+ const chipId = (chip)=>`${bodyId}-chip-${chip}`;
61
+ const byoDisabledId = `${bodyId}-byo-disabled`;
62
+ const byoUnavailableId = `${bodyId}-byo-unavailable`;
63
+ const descriptionId = `${bodyId}-description`;
64
+ const describedBy = activatable ? [
65
+ ...chips.map((chip)=>chipId(chip.id)),
66
+ state.byoDisabled ? byoDisabledId : void 0,
67
+ state.byoUnavailable ? byoUnavailableId : void 0,
68
+ item.description ? descriptionId : void 0
69
+ ].filter(Boolean).join(' ') : '';
70
+ const bodyProps = activatable ? {
71
+ role: 'button',
72
+ tabIndex: 0,
73
+ 'aria-label': nameRow(labels.editRow, labels.editItem),
74
+ ...describedBy ? {
75
+ 'aria-describedby': describedBy
76
+ } : {},
77
+ onClick: handleEdit,
78
+ onKeyDown: (event)=>{
79
+ if ('Enter' === event.key || ' ' === event.key) {
80
+ event.preventDefault();
81
+ handleEdit?.();
82
+ }
83
+ }
84
+ } : tooltip ? {
85
+ tabIndex: 0
86
+ } : {};
87
+ const body = /*#__PURE__*/ jsxs("div", {
88
+ className: cn('min-w-0 flex-1', activatable && 'cursor-pointer rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'),
89
+ ...bodyProps,
90
+ children: [
91
+ /*#__PURE__*/ jsxs("div", {
92
+ className: "flex items-center gap-2",
93
+ children: [
94
+ /*#__PURE__*/ jsx("span", {
95
+ className: "truncate text-sm font-medium",
96
+ children: item.name
97
+ }),
98
+ byoChip && state.isByo && /*#__PURE__*/ jsx(GuardrailStatusChip, {
99
+ tone: "success",
100
+ children: labels.byo
101
+ }),
102
+ previewChip && isBuiltInValidator && /*#__PURE__*/ jsx(GuardrailStatusChip, {
103
+ tone: "info",
104
+ children: labels.preview
105
+ }),
106
+ chips.map((chip)=>/*#__PURE__*/ jsx(GuardrailStatusChip, {
107
+ id: chipId(chip.id),
108
+ tone: chip.tone,
109
+ children: chip.label
110
+ }, chip.id))
111
+ ]
112
+ }),
113
+ state.byoDisabled && /*#__PURE__*/ jsx("div", {
114
+ id: byoDisabledId,
115
+ className: "whitespace-normal break-words text-xs text-error",
116
+ role: "alert",
117
+ children: labels.byoDisabledNotice
118
+ }),
119
+ state.byoUnavailable && /*#__PURE__*/ jsx("div", {
120
+ id: byoUnavailableId,
121
+ className: "whitespace-normal break-words text-xs text-error",
122
+ role: "alert",
123
+ children: labels.byoUnavailableNotice
124
+ }),
125
+ item.description && /*#__PURE__*/ jsx("div", {
126
+ id: descriptionId,
127
+ className: "truncate text-xs text-muted-foreground",
128
+ children: item.description
129
+ }),
130
+ void 0 !== state.provider && /*#__PURE__*/ jsxs("div", {
131
+ className: "truncate text-xs text-muted-foreground",
132
+ children: [
133
+ labels.provider,
134
+ ": ",
135
+ state.provider
136
+ ]
137
+ }),
138
+ (actionContent || scopesContent) && /*#__PURE__*/ jsxs("div", {
139
+ className: "mt-1 flex flex-wrap items-center gap-1.5",
140
+ children: [
141
+ actionContent && /*#__PURE__*/ jsx(Badge, {
142
+ variant: "secondary",
143
+ className: cn('border-border bg-muted/60 text-xs text-muted-foreground', !formatAction && 'capitalize'),
144
+ children: actionContent
145
+ }),
146
+ scopesContent && /*#__PURE__*/ jsx("span", {
147
+ className: "text-xs text-muted-foreground",
148
+ children: scopesContent
149
+ })
150
+ ]
151
+ })
152
+ ]
153
+ });
154
+ return /*#__PURE__*/ jsxs("div", {
155
+ ref: ref,
156
+ "data-slot": "guardrail-list-row",
157
+ "data-guardrail-id": id,
158
+ className: cn('flex items-center gap-2', '-mx-1 rounded-md p-1 transition-colors hover:bg-accent', className),
159
+ ...props,
160
+ children: [
161
+ handle,
162
+ tooltip ? /*#__PURE__*/ jsx(TooltipProvider, {
163
+ children: /*#__PURE__*/ jsxs(Tooltip, {
164
+ children: [
165
+ /*#__PURE__*/ jsx(TooltipTrigger, {
166
+ asChild: true,
167
+ children: body
168
+ }),
169
+ /*#__PURE__*/ jsx(TooltipContent, {
170
+ children: tooltip
171
+ })
172
+ ]
173
+ })
174
+ }) : body,
175
+ /*#__PURE__*/ jsx("div", {
176
+ "data-slot": "guardrail-list-row-actions",
177
+ className: "flex shrink-0 items-center gap-0",
178
+ children: actions
179
+ })
180
+ ]
181
+ });
182
+ });
183
+ GuardrailListRow.displayName = 'GuardrailListRow';
184
+ export { GuardrailListRow };
@@ -36,6 +36,7 @@ function GuardrailStatusBanner({ tone, message }) {
36
36
  children: [
37
37
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.AlertCircle, {}),
38
38
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.AlertDescription, {
39
+ className: "mt-0",
39
40
  children: message
40
41
  })
41
42
  ]
@@ -47,6 +48,7 @@ function GuardrailStatusBanner({ tone, message }) {
47
48
  children: [
48
49
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.AlertTriangle, {}),
49
50
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.AlertDescription, {
51
+ className: "mt-0",
50
52
  children: message
51
53
  })
52
54
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"guardrail-status-banner.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/guardrail-status-banner.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD,wBAAgB,qBAAqB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,0BAA0B,2CAiBlF"}
1
+ {"version":3,"file":"guardrail-status-banner.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/guardrail-status-banner.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AASD,wBAAgB,qBAAqB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,0BAA0B,2CAiBlF"}
@@ -8,6 +8,7 @@ function GuardrailStatusBanner({ tone, message }) {
8
8
  children: [
9
9
  /*#__PURE__*/ jsx(AlertCircle, {}),
10
10
  /*#__PURE__*/ jsx(AlertDescription, {
11
+ className: "mt-0",
11
12
  children: message
12
13
  })
13
14
  ]
@@ -19,6 +20,7 @@ function GuardrailStatusBanner({ tone, message }) {
19
20
  children: [
20
21
  /*#__PURE__*/ jsx(AlertTriangle, {}),
21
22
  /*#__PURE__*/ jsx(AlertDescription, {
23
+ className: "mt-0",
22
24
  children: message
23
25
  })
24
26
  ]
@@ -37,6 +37,7 @@ function MixedScopesBanner({ otherAppliedScopes, labels }) {
37
37
  children: [
38
38
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.AlertCircle, {}),
39
39
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.AlertDescription, {
40
+ className: "mt-0",
40
41
  children: [
41
42
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
42
43
  children: labels.mixedScopesAlsoApplied
@@ -1 +1 @@
1
- {"version":3,"file":"mixed-scopes-banner.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/mixed-scopes-banner.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IAErC,kBAAkB,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IACjE,MAAM,EAAE,IAAI,CAAC,sBAAsB,EAAE,wBAAwB,GAAG,0BAA0B,CAAC,CAAC;CAC7F;AAMD,wBAAgB,iBAAiB,CAAC,EAAE,kBAAkB,EAAE,MAAM,EAAE,EAAE,sBAAsB,kDAuBvF"}
1
+ {"version":3,"file":"mixed-scopes-banner.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/mixed-scopes-banner.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IAErC,kBAAkB,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IACjE,MAAM,EAAE,IAAI,CAAC,sBAAsB,EAAE,wBAAwB,GAAG,0BAA0B,CAAC,CAAC;CAC7F;AAMD,wBAAgB,iBAAiB,CAAC,EAAE,kBAAkB,EAAE,MAAM,EAAE,EAAE,sBAAsB,kDAwBvF"}
@@ -9,6 +9,7 @@ function MixedScopesBanner({ otherAppliedScopes, labels }) {
9
9
  children: [
10
10
  /*#__PURE__*/ jsx(AlertCircle, {}),
11
11
  /*#__PURE__*/ jsxs(AlertDescription, {
12
+ className: "mt-0",
12
13
  children: [
13
14
  /*#__PURE__*/ jsx("p", {
14
15
  children: labels.mixedScopesAlsoApplied
@@ -0,0 +1,103 @@
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
+ getGuardrailListChips: ()=>getGuardrailListChips,
28
+ getGuardrailListItemId: ()=>getGuardrailListItemId,
29
+ matchesGuardrailListDefinition: ()=>matchesGuardrailListDefinition,
30
+ resolveGuardrailListItemState: ()=>resolveGuardrailListItemState
31
+ });
32
+ function getGuardrailListItemId(item) {
33
+ return item.id ?? item.name;
34
+ }
35
+ function matchesGuardrailListDefinition(definition, item) {
36
+ return void 0 === item.byoValidatorName ? void 0 === definition.byoValidatorName && definition.validator === item.validatorType : definition.byoValidatorName === item.byoValidatorName;
37
+ }
38
+ function resolveGuardrailListItemState(item, definitions = []) {
39
+ const isByo = void 0 !== item.byoValidatorName;
40
+ const definition = definitions.find((candidate)=>matchesGuardrailListDefinition(candidate, item));
41
+ const byoUnavailable = isByo && definitions.length > 0 && void 0 === definition;
42
+ const byoDisabled = isByo && definition?.status === 'Disabled';
43
+ return {
44
+ definition,
45
+ status: byoUnavailable ? 'Unavailable' : definition?.status,
46
+ isByo,
47
+ provider: definition?.byoConnectorName,
48
+ byoDisabled,
49
+ byoUnavailable
50
+ };
51
+ }
52
+ function getGuardrailListChips(input, labels) {
53
+ const chips = [];
54
+ const statusChip = (()=>{
55
+ switch(input.status){
56
+ case 'FeatureDisabled':
57
+ return {
58
+ tone: 'warning',
59
+ label: labels.statusFeatureDisabled
60
+ };
61
+ case 'Unauthorised':
62
+ return {
63
+ tone: 'warning',
64
+ label: labels.statusUnauthorized
65
+ };
66
+ case 'Disabled':
67
+ return {
68
+ tone: 'error',
69
+ label: labels.statusDisabled
70
+ };
71
+ case 'Unavailable':
72
+ return {
73
+ tone: 'error',
74
+ label: labels.statusUnavailable
75
+ };
76
+ default:
77
+ return;
78
+ }
79
+ })();
80
+ if (statusChip) chips.push({
81
+ id: 'status',
82
+ ...statusChip
83
+ });
84
+ if ('governance' === input.administration) chips.push({
85
+ id: 'administration',
86
+ tone: 'neutral',
87
+ label: labels.administrationGovernance
88
+ });
89
+ return chips;
90
+ }
91
+ exports.getGuardrailListChips = __webpack_exports__.getGuardrailListChips;
92
+ exports.getGuardrailListItemId = __webpack_exports__.getGuardrailListItemId;
93
+ exports.matchesGuardrailListDefinition = __webpack_exports__.matchesGuardrailListDefinition;
94
+ exports.resolveGuardrailListItemState = __webpack_exports__.resolveGuardrailListItemState;
95
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
96
+ "getGuardrailListChips",
97
+ "getGuardrailListItemId",
98
+ "matchesGuardrailListDefinition",
99
+ "resolveGuardrailListItemState"
100
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
101
+ Object.defineProperty(exports, '__esModule', {
102
+ value: true
103
+ });
@@ -0,0 +1,10 @@
1
+ import type { GuardrailListLabels } from './i18n';
2
+ import type { GuardrailListAdministration, GuardrailListChip, GuardrailListDefinition, GuardrailListItem, GuardrailListItemState } from './list-types';
3
+ export declare function getGuardrailListItemId(item: GuardrailListItem): string;
4
+ export declare function matchesGuardrailListDefinition(definition: GuardrailListDefinition, item: GuardrailListItem): boolean;
5
+ export declare function resolveGuardrailListItemState(item: GuardrailListItem, definitions?: readonly GuardrailListDefinition[]): GuardrailListItemState;
6
+ export declare function getGuardrailListChips(input: {
7
+ status?: GuardrailListItemState['status'];
8
+ administration?: GuardrailListAdministration;
9
+ }, labels: GuardrailListLabels): GuardrailListChip[];
10
+ //# sourceMappingURL=guardrail-list-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guardrail-list-utils.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/guardrail-list-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,KAAK,EACV,2BAA2B,EAC3B,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,cAAc,CAAC;AAMtB,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAEtE;AAMD,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,uBAAuB,EACnC,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAIT;AAOD,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,iBAAiB,EACvB,WAAW,GAAE,SAAS,uBAAuB,EAAO,GACnD,sBAAsB,CAiBxB;AAMD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE;IACL,MAAM,CAAC,EAAE,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,2BAA2B,CAAC;CAC9C,EACD,MAAM,EAAE,mBAAmB,GAC1B,iBAAiB,EAAE,CAwBrB"}