@wildo-ai/presets-components 1.1.5 → 1.1.6
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/esm/.native.tsbuildinfo +1 -0
- package/dist/esm/components/actions/action-bar.d.ts.map +1 -1
- package/dist/esm/components/actions/action-bar.js +5 -2
- package/dist/esm/components/actions/action-bar.js.map +1 -1
- package/dist/esm/components/ai-elements/chat/suggestion.d.ts.map +1 -1
- package/dist/esm/components/ai-elements/chat/suggestion.js +8 -1
- package/dist/esm/components/ai-elements/chat/suggestion.js.map +1 -1
- package/dist/esm/components/ai-elements/decision/approval.d.ts +108 -13
- package/dist/esm/components/ai-elements/decision/approval.d.ts.map +1 -1
- package/dist/esm/components/ai-elements/decision/approval.js +60 -10
- package/dist/esm/components/ai-elements/decision/approval.js.map +1 -1
- package/dist/esm/components/ai-elements/graph/graph-runtime.d.ts +3 -1
- package/dist/esm/components/ai-elements/graph/graph-runtime.d.ts.map +1 -1
- package/dist/esm/components/ai-elements/graph/graph-runtime.js +3 -1
- package/dist/esm/components/ai-elements/graph/graph-runtime.js.map +1 -1
- package/dist/esm/components/app/app-layout-main-container.d.ts +9 -0
- package/dist/esm/components/app/app-layout-main-container.d.ts.map +1 -1
- package/dist/esm/components/app/app-layout-main-container.js +17 -23
- package/dist/esm/components/app/app-layout-main-container.js.map +1 -1
- package/dist/esm/components/app/app-layout-main-container.labels.d.ts.map +1 -1
- package/dist/esm/components/app/app-layout-main-container.labels.js +27 -0
- package/dist/esm/components/app/app-layout-main-container.labels.js.map +1 -1
- package/dist/esm/components/billing/billing-plan-change-preview.d.ts.map +1 -1
- package/dist/esm/components/billing/billing-plan-change-preview.js +5 -2
- package/dist/esm/components/billing/billing-plan-change-preview.js.map +1 -1
- package/dist/esm/components/billing/billing-plan-change-preview.labels.d.ts.map +1 -1
- package/dist/esm/components/billing/billing-plan-change-preview.labels.js +3 -0
- package/dist/esm/components/billing/billing-plan-change-preview.labels.js.map +1 -1
- package/dist/esm/components/billing/billing-pricing-table.d.ts +1 -1
- package/dist/esm/components/billing/billing-pricing-table.d.ts.map +1 -1
- package/dist/esm/components/billing/billing-pricing-table.js +8 -4
- package/dist/esm/components/billing/billing-pricing-table.js.map +1 -1
- package/dist/esm/components/billing/billing-pricing-table.labels.d.ts.map +1 -1
- package/dist/esm/components/billing/billing-pricing-table.labels.js +7 -1
- package/dist/esm/components/billing/billing-pricing-table.labels.js.map +1 -1
- package/dist/esm/components/billing/billing-usage-dashboard.d.ts.map +1 -1
- package/dist/esm/components/billing/billing-usage-dashboard.js +6 -3
- package/dist/esm/components/billing/billing-usage-dashboard.js.map +1 -1
- package/dist/esm/components/billing/billing-usage-dashboard.labels.d.ts.map +1 -1
- package/dist/esm/components/billing/billing-usage-dashboard.labels.js +2 -1
- package/dist/esm/components/billing/billing-usage-dashboard.labels.js.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-enum.d.ts.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-enum.js +18 -4
- package/dist/esm/components/data-display/formatters/display-field-enum.js.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-file.d.ts.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-file.js +13 -14
- package/dist/esm/components/data-display/formatters/display-field-file.js.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-file.labels.d.ts.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-file.labels.js +1 -0
- package/dist/esm/components/data-display/formatters/display-field-file.labels.js.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-number.d.ts.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-number.js +6 -1
- package/dist/esm/components/data-display/formatters/display-field-number.js.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-number.labels.d.ts.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-number.labels.js +5 -2
- package/dist/esm/components/data-display/formatters/display-field-number.labels.js.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-string.d.ts +1 -1
- package/dist/esm/components/data-display/formatters/display-field-string.d.ts.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-string.js +51 -12
- package/dist/esm/components/data-display/formatters/display-field-string.js.map +1 -1
- package/dist/esm/components/data-display/untrusted-html-content.d.ts +55 -0
- package/dist/esm/components/data-display/untrusted-html-content.d.ts.map +1 -0
- package/dist/esm/components/data-display/untrusted-html-content.js +67 -0
- package/dist/esm/components/data-display/untrusted-html-content.js.map +1 -0
- package/dist/esm/components/form/chromes/form-primitive.labels.d.ts.map +1 -1
- package/dist/esm/components/form/chromes/form-primitive.labels.js +9 -0
- package/dist/esm/components/form/chromes/form-primitive.labels.js.map +1 -1
- package/dist/esm/components/form/combobox.d.ts.map +1 -1
- package/dist/esm/components/form/combobox.js +10 -10
- package/dist/esm/components/form/combobox.js.map +1 -1
- package/dist/esm/components/form/controls/address/providers/google-places-address-lookup.adapter.d.ts +42 -0
- package/dist/esm/components/form/controls/address/providers/google-places-address-lookup.adapter.d.ts.map +1 -0
- package/dist/esm/components/form/controls/address/providers/google-places-address-lookup.adapter.js +120 -0
- package/dist/esm/components/form/controls/address/providers/google-places-address-lookup.adapter.js.map +1 -0
- package/dist/esm/components/form/controls/address/providers/google-places-address-lookup.d.ts +16 -0
- package/dist/esm/components/form/controls/address/providers/google-places-address-lookup.d.ts.map +1 -0
- package/dist/esm/components/form/controls/address/providers/google-places-address-lookup.js +8 -0
- package/dist/esm/components/form/controls/address/providers/google-places-address-lookup.js.map +1 -0
- package/dist/esm/components/navigation/app-level/activity-bar.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/activity-bar.js +2 -2
- package/dist/esm/components/navigation/app-level/activity-bar.js.map +1 -1
- package/dist/esm/components/navigation/app-level/menu-user-org.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/menu-user-org.js +10 -4
- package/dist/esm/components/navigation/app-level/menu-user-org.js.map +1 -1
- package/dist/esm/components/navigation/app-level/menu-user-org.labels.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/menu-user-org.labels.js +7 -0
- package/dist/esm/components/navigation/app-level/menu-user-org.labels.js.map +1 -1
- package/dist/esm/components/navigation/app-level/menubar.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/menubar.js +6 -6
- package/dist/esm/components/navigation/app-level/menubar.js.map +1 -1
- package/dist/esm/components/navigation/app-level/navigation-back.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/navigation-back.js +27 -9
- package/dist/esm/components/navigation/app-level/navigation-back.js.map +1 -1
- package/dist/esm/components/navigation/app-level/sidebar.js +3 -3
- package/dist/esm/components/navigation/app-level/sidebar.js.map +1 -1
- package/dist/esm/components/navigation/app-level/status-bar.js +2 -2
- package/dist/esm/components/navigation/app-level/status-bar.js.map +1 -1
- package/dist/esm/components/navigation/app-level/toolbar.d.ts.map +1 -1
- package/dist/esm/components/navigation/app-level/toolbar.js +2 -2
- package/dist/esm/components/navigation/app-level/toolbar.js.map +1 -1
- package/dist/esm/components/navigation/app-level/utility-panel.js +2 -2
- package/dist/esm/components/navigation/app-level/utility-panel.js.map +1 -1
- package/dist/esm/components/navigation/breadcrumb.js +1 -1
- package/dist/esm/components/navigation/breadcrumb.js.map +1 -1
- package/dist/esm/components/sections/stepper.d.ts.map +1 -1
- package/dist/esm/components/sections/stepper.js +5 -3
- package/dist/esm/components/sections/stepper.js.map +1 -1
- package/dist/esm/config/preset-navigation.d.ts.map +1 -1
- package/dist/esm/config/preset-navigation.js +23 -2
- package/dist/esm/config/preset-navigation.js.map +1 -1
- package/dist/esm/config/resources/agent-work.resource-presets.d.ts +4 -0
- package/dist/esm/config/resources/agent-work.resource-presets.d.ts.map +1 -0
- package/dist/esm/config/resources/agent-work.resource-presets.js +115 -0
- package/dist/esm/config/resources/agent-work.resource-presets.js.map +1 -0
- package/dist/esm/config/resources/api-key-rotation-window.d.ts +22 -0
- package/dist/esm/config/resources/api-key-rotation-window.d.ts.map +1 -0
- package/dist/esm/config/resources/api-key-rotation-window.js +45 -0
- package/dist/esm/config/resources/api-key-rotation-window.js.map +1 -0
- package/dist/esm/config/resources/application.resource-presets.d.ts.map +1 -1
- package/dist/esm/config/resources/application.resource-presets.js +147 -61
- package/dist/esm/config/resources/application.resource-presets.js.map +1 -1
- package/dist/esm/config/resources/billing.resource-presets.d.ts +4 -3
- package/dist/esm/config/resources/billing.resource-presets.d.ts.map +1 -1
- package/dist/esm/config/resources/billing.resource-presets.js +240 -111
- package/dist/esm/config/resources/billing.resource-presets.js.map +1 -1
- package/dist/esm/config/resources/conversation-threads.resource-presets.d.ts +4 -0
- package/dist/esm/config/resources/conversation-threads.resource-presets.d.ts.map +1 -0
- package/dist/esm/config/resources/conversation-threads.resource-presets.js +105 -0
- package/dist/esm/config/resources/conversation-threads.resource-presets.js.map +1 -0
- package/dist/esm/config/resources/guidance.resource-presets.d.ts.map +1 -1
- package/dist/esm/config/resources/guidance.resource-presets.js +18 -11
- package/dist/esm/config/resources/guidance.resource-presets.js.map +1 -1
- package/dist/esm/config/resources/identity.resource-presets.d.ts +0 -13
- package/dist/esm/config/resources/identity.resource-presets.d.ts.map +1 -1
- package/dist/esm/config/resources/identity.resource-presets.js +48 -16
- package/dist/esm/config/resources/identity.resource-presets.js.map +1 -1
- package/dist/esm/config/resources/inbound-deliveries.resource-presets.d.ts +6 -0
- package/dist/esm/config/resources/inbound-deliveries.resource-presets.d.ts.map +1 -0
- package/dist/esm/config/resources/inbound-deliveries.resource-presets.js +112 -0
- package/dist/esm/config/resources/inbound-deliveries.resource-presets.js.map +1 -0
- package/dist/esm/config/resources/inbound-email.resource-presets.d.ts +4 -0
- package/dist/esm/config/resources/inbound-email.resource-presets.d.ts.map +1 -0
- package/dist/esm/config/resources/inbound-email.resource-presets.js +182 -0
- package/dist/esm/config/resources/inbound-email.resource-presets.js.map +1 -0
- package/dist/esm/config/resources/index.d.ts.map +1 -1
- package/dist/esm/config/resources/index.js +9 -2
- package/dist/esm/config/resources/index.js.map +1 -1
- package/dist/esm/config/resources/legal-holds.resource-presets.d.ts +4 -0
- package/dist/esm/config/resources/legal-holds.resource-presets.d.ts.map +1 -0
- package/dist/esm/config/resources/legal-holds.resource-presets.js +76 -0
- package/dist/esm/config/resources/legal-holds.resource-presets.js.map +1 -0
- package/dist/esm/config/resources/organizations.resource-presets.d.ts.map +1 -1
- package/dist/esm/config/resources/organizations.resource-presets.js +139 -36
- package/dist/esm/config/resources/organizations.resource-presets.js.map +1 -1
- package/dist/esm/config/resources/resource.config.utils.d.ts +20 -0
- package/dist/esm/config/resources/resource.config.utils.d.ts.map +1 -1
- package/dist/esm/config/resources/resource.config.utils.js +20 -0
- package/dist/esm/config/resources/resource.config.utils.js.map +1 -1
- package/dist/esm/config/resources/retention-enforcement.resource-presets.d.ts +5 -0
- package/dist/esm/config/resources/retention-enforcement.resource-presets.d.ts.map +1 -0
- package/dist/esm/config/resources/retention-enforcement.resource-presets.js +74 -0
- package/dist/esm/config/resources/retention-enforcement.resource-presets.js.map +1 -0
- package/dist/esm/config/resources/security.resource-presets.d.ts +3 -1
- package/dist/esm/config/resources/security.resource-presets.d.ts.map +1 -1
- package/dist/esm/config/resources/security.resource-presets.js +563 -133
- package/dist/esm/config/resources/security.resource-presets.js.map +1 -1
- package/dist/esm/config/resources/service-providers.resource-presets.d.ts +4 -0
- package/dist/esm/config/resources/service-providers.resource-presets.d.ts.map +1 -0
- package/dist/esm/config/resources/service-providers.resource-presets.js +321 -0
- package/dist/esm/config/resources/service-providers.resource-presets.js.map +1 -0
- package/dist/esm/config/resources/webhooks.resource-presets.d.ts +4 -3
- package/dist/esm/config/resources/webhooks.resource-presets.d.ts.map +1 -1
- package/dist/esm/config/resources/webhooks.resource-presets.js +76 -25
- package/dist/esm/config/resources/webhooks.resource-presets.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/registration/register-common-enums.d.ts.map +1 -1
- package/dist/esm/registration/register-common-enums.js +15 -0
- package/dist/esm/registration/register-common-enums.js.map +1 -1
- package/dist/esm/registration/register-provider-components.d.ts.map +1 -1
- package/dist/esm/registration/register-provider-components.js +6 -0
- package/dist/esm/registration/register-provider-components.js.map +1 -1
- package/dist/esm/themes/dense.theme.d.ts.map +1 -1
- package/dist/esm/themes/dense.theme.js +22 -2
- package/dist/esm/themes/dense.theme.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-bar.d.ts","sourceRoot":"","sources":["../../../../../src/components/actions/action-bar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAGV,cAAc,EAGf,MAAM,6BAA6B,CAAA;AAiCpC,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAyC,EACzC,SAAS,EACT,IAAyB,EACzB,YAAY,EAAE,SAAS,GACxB,EAAE,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAsIpC;kBA9IQ,SAAS;;;
|
|
1
|
+
{"version":3,"file":"action-bar.d.ts","sourceRoot":"","sources":["../../../../../src/components/actions/action-bar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAGV,cAAc,EAGf,MAAM,6BAA6B,CAAA;AAiCpC,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAyC,EACzC,SAAS,EACT,IAAyB,EACzB,YAAY,EAAE,SAAS,GACxB,EAAE,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAsIpC;kBA9IQ,SAAS;;;AAkZlB,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { ActionButton, Button, cn, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, IconSize, Popover, PopoverContent, PopoverTrigger, Separator, StandardIconReference, useI18n, useIconRegistry, useUI } from "@wildo-ai/saas-frontend-lib";
|
|
4
4
|
import { FrontendComponentType, ActionLabelDisplayMode } from "@wildo-ai/presets-components-models";
|
|
5
|
-
import { ButtonVariants_Variant } from "@wildo-ai/saas-frontend-lib";
|
|
5
|
+
import { ButtonVariants_Variant, ActionBarPopoverChrome } from "@wildo-ai/saas-frontend-lib";
|
|
6
6
|
import { ButtonSize } from "@wildo-ai/presets-components-models";
|
|
7
7
|
import { HorizontalAlign, DisplayDirection } from "@wildo-ai/zod-decorators";
|
|
8
8
|
/* ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -150,7 +150,10 @@ function ActionBarDirectItem({ item, size, labelDisplayMode, orientation = Displ
|
|
|
150
150
|
// below deliberately ignore `popover` and use `onClick`, because a panel anchored to a row of an
|
|
151
151
|
// already-open dropdown is a nested-overlay problem rather than a layout choice. See
|
|
152
152
|
// `ActionBarButtonPopover`.
|
|
153
|
-
return (_jsxs(Popover, { open: item.popover.open, onOpenChange: item.popover.onOpenChange, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(ActionBarPopoverTriggerButton, { button: buttonProps }) }), _jsx(PopoverContent, { align: HorizontalAlign.END, "aria-label": item.popover.title ?? item.label, className: "w-(--action-bar-popover-width,20rem) max-w-[min(24rem,calc(100vw-2rem))]",
|
|
153
|
+
return (_jsxs(Popover, { open: item.popover.open, onOpenChange: item.popover.onOpenChange, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(ActionBarPopoverTriggerButton, { button: buttonProps }) }), _jsx(PopoverContent, { align: HorizontalAlign.END, "aria-label": item.popover.title ?? item.label, className: cn("w-(--action-bar-popover-width,20rem) max-w-[min(24rem,calc(100vw-2rem))]",
|
|
154
|
+
// A LIST body (a DROPDOWN action's values) is a menu: its rows run edge to edge, so the
|
|
155
|
+
// panel drops its own padding rather than framing the list a second time.
|
|
156
|
+
item.popover.chrome === ActionBarPopoverChrome.LIST && "w-(--action-bar-popover-width,16rem) p-0"), children: item.popover.content })] }));
|
|
154
157
|
}
|
|
155
158
|
/**
|
|
156
159
|
* The trigger an anchored panel clones onto.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-bar.js","sourceRoot":"","sources":["../../../../../src/components/actions/action-bar.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAU9B,OAAO,EACL,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,mBAAmB,EAC3D,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,QAAQ,EAC9F,OAAO,EAAE,cAAc,EAAE,cAAc,EACvC,SAAS,EAAE,qBAAqB,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAClE,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AACnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE5E;;;;;;;;;;;;;gFAagF;AAEhF,iFAAiF;AAEjF,SAAS,SAAS,CAAC,EACjB,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,GAAG,gBAAgB,CAAC,UAAU,EACzC,SAAS,EACT,IAAI,GAAG,UAAU,CAAC,OAAO,EACzB,YAAY,EAAE,SAAS,GACR;IACf,MAAM,UAAU,GAAG,WAAW,KAAK,gBAAgB,CAAC,QAAQ,C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AC7B,yBAAO,IAAI,CAAC,KAAK,GAAQ,EACzB,eAAM,SAAS,EAAC,+BAA+B,YAAE,IAAI,CAAC,cAAc,CAAC,MAAM,GAAQ,IAC9E,CACR,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IACG,CACpB,CAAA;AACH,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAA","sourcesContent":["\nimport * as React from \"react\"\nimport type { ActionButtonProps } from \"@wildo-ai/saas-frontend-lib\"\nimport type {\n ActionBarButton,\n ActionBarItem,\n ActionBarProps,\n ActionBarSubGroup,\n ActionButtonSize\n} from '@wildo-ai/saas-frontend-lib'\n\nimport {\n ActionButton, Button, cn, DropdownMenu, DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, IconSize,\n Popover, PopoverContent, PopoverTrigger,\n Separator, StandardIconReference, useI18n, useIconRegistry, useUI\n} from \"@wildo-ai/saas-frontend-lib\"\n\nimport { FrontendComponentType, ActionLabelDisplayMode } from \"@wildo-ai/presets-components-models\"\nimport { ButtonVariants_Variant } from \"@wildo-ai/saas-frontend-lib\"\nimport { ButtonSize } from \"@wildo-ai/presets-components-models\"\nimport { HorizontalAlign, DisplayDirection } from \"@wildo-ai/zod-decorators\"\n\n/* ─────────────────────────────────────────────────────────────────────────────\n * ActionBar\n *\n * A toolbar-style group of ActionButtons with built-in overflow management.\n *\n * Features:\n * • maxDisplayed — shows N items directly; the rest collapse into a \"…\" menu.\n * • Separators — visual dividers between logical groups.\n * • Sub-groups — inline dropdown menus for related actions.\n * • Theme-aware — all buttons and menus use design-system recipes.\n *\n * This component replaces the external TinyButtonGroup pattern, adapted to\n * compose existing engine primitives (Button, DropdownMenu, Tooltip, etc.).\n * ────────────────────────────────────────────────────────────────────────── */\n\n/* ── Component ────────────────────────────────────────────────────────────── */\n\nfunction ActionBar({\n items,\n maxDisplayed,\n labelDisplayMode,\n orientation = DisplayDirection.HORIZONTAL,\n className,\n size = ButtonSize.ICON_SM,\n \"aria-label\": ariaLabel,\n}: ActionBarProps): React.JSX.Element {\n const isVertical = orientation === DisplayDirection.VERTICAL\n const { renderIcon } = useIconRegistry()\n const { actionLabelDisplayMode: appLabelDisplayMode } = useUI()\n const { tComponent, isReady } = useI18n({\n component: FrontendComponentType.LOW_LEVEL_ACTION_BAR,\n })\n\n // Resolve the effective label affordance: explicit prop (per-resource-view\n // override) → app-wide theme default (`ComponentStyleTheme.actionLabelDisplayMode`).\n const effectiveLabelMode = labelDisplayMode ?? appLabelDisplayMode\n\n // DROPDOWN forces the whole cluster into the overflow menu (no direct\n // buttons): clamp the displayed count to 0 so every item — separators\n // included — renders through the `…` menu path below.\n const effectiveMax = effectiveLabelMode === ActionLabelDisplayMode.DROPDOWN\n ? 0\n : (maxDisplayed ?? items.length)\n const displayedItems = items.slice(0, effectiveMax)\n const overflowItems = items.slice(effectiveMax)\n const hasOverflow = overflowItems.length > 0\n\n // WAI-ARIA toolbar pattern: roving tabindex (Arrow keys move focus, Tab exits toolbar)\n const [activeIndex, setActiveIndex] = React.useState(0)\n\n // Map each displayed item to its focusable position (separators excluded)\n const focusableMap = React.useMemo(() => {\n const displayed = items.slice(0, effectiveMax)\n const overflow = items.length > displayed.length\n const map: number[] = []\n let pos = 0\n for (const item of displayed) {\n if (item.type === \"separator\") {\n map.push(-1)\n } else {\n map.push(pos++)\n }\n }\n return { map, count: pos + (overflow ? 1 : 0) }\n }, [items, effectiveMax])\n\n // Reset activeIndex if it's out of bounds after items change\n React.useEffect(() => {\n if (focusableMap.count > 0 && activeIndex >= focusableMap.count) {\n setActiveIndex(focusableMap.count - 1)\n }\n }, [focusableMap.count, activeIndex])\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n const total = focusableMap.count\n if (total === 0) return\n\n let nextIndex: number | undefined\n switch (e.key) {\n // Both axes advance/retreat so the arrow keys match the bar's\n // orientation (vertical stacks navigate with Up/Down).\n case \"ArrowRight\":\n case \"ArrowDown\":\n nextIndex = (activeIndex + 1) % total\n break\n case \"ArrowLeft\":\n case \"ArrowUp\":\n nextIndex = (activeIndex - 1 + total) % total\n break\n case \"Home\":\n nextIndex = 0\n break\n case \"End\":\n nextIndex = total - 1\n break\n default:\n return\n }\n e.preventDefault()\n setActiveIndex(nextIndex)\n\n // Focus the target button via DOM query (dropdown content is portalled, so only toolbar buttons are found)\n const toolbar = e.currentTarget\n const buttons = toolbar.querySelectorAll<HTMLButtonElement>(\"button\")\n buttons[nextIndex]?.focus()\n },\n [activeIndex, focusableMap.count],\n )\n\n return (\n <div\n role=\"toolbar\"\n aria-label={ariaLabel}\n aria-orientation={isVertical ? \"vertical\" : \"horizontal\"}\n data-slot=\"action-bar\"\n // `gap-element` — the role's DEFAULT step, and the reason is rhythm rather than size. A\n // collection toolbar puts two of these bars side by side (whole-scope actions, then the\n // bulk/primary slot) inside a cluster that is itself `gap-element`, so a tightened `-sm`\n // here produced 4px inside each bar and 8px between them: one continuous run of buttons\n // reading as two groups that nothing in the design intends. `element` is the declared role\n // for \"between inline elements: icons, buttons, tags\"; the tightening was the deviation.\n className={cn(\"flex gap-element\", isVertical ? \"flex-col items-start\" : \"items-center\", className)}\n onKeyDown={handleKeyDown}\n >\n {/* ── Directly-displayed items ─────────────────────────────────── */}\n {displayedItems.map((item, index) => {\n const pos = focusableMap.map[index]\n if (pos === -1) {\n return <ActionBarDirectItem key={index} item={item} size={size} labelDisplayMode={effectiveLabelMode} orientation={orientation} />\n }\n return <ActionBarDirectItem key={index} item={item} size={size} labelDisplayMode={effectiveLabelMode} orientation={orientation} tabIndex={activeIndex === pos ? 0 : -1} />\n })}\n\n {/* ── Overflow menu ────────────────────────────────────────────── */}\n {hasOverflow && (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant={ButtonVariants_Variant.GHOST}\n size={size}\n onClick={(e) => e.stopPropagation()}\n aria-label={tComponent(FrontendComponentType.LOW_LEVEL_ACTION_BAR, 'moreActions')}\n tabIndex={activeIndex === focusableMap.count - 1 ? 0 : -1}\n >\n {renderIcon(StandardIconReference.MORE_HORIZONTAL, {\n size: IconSize.SM,\n })}\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align={HorizontalAlign.END}>\n {overflowItems.map((item, index) => (\n <ActionBarOverflowItem key={index} item={item} />\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )}\n </div>\n )\n}\n\nActionBar.displayName = \"ActionBar\"\n\n/* ── Direct item renderer ─────────────────────────────────────────────────── */\n\nfunction ActionBarDirectItem({\n item,\n size,\n labelDisplayMode,\n orientation = DisplayDirection.HORIZONTAL,\n tabIndex,\n}: {\n item: ActionBarItem\n size: ActionButtonSize\n labelDisplayMode: ActionLabelDisplayMode\n orientation?: DisplayDirection\n tabIndex?: number\n}): React.JSX.Element | null {\n if (item.type === \"separator\") {\n // The divider runs across the bar's cross-axis: a vertical rule between\n // buttons in a row, a horizontal rule between buttons in a vertical stack.\n return orientation === DisplayDirection.VERTICAL ? (\n <Separator\n orientation={DisplayDirection.HORIZONTAL}\n className=\"my-element-xs w-4 self-center\"\n />\n ) : (\n <Separator\n orientation={DisplayDirection.VERTICAL}\n className=\"mx-element-xs h-4 self-center\"\n />\n )\n }\n\n if (item.type === \"subgroup\") {\n return <ActionBarSubGroupTrigger item={item} size={size} tabIndex={tabIndex} />\n }\n\n // Regular button\n const buttonProps: ActionButtonProps = {\n icon: item.icon,\n label: item.label,\n // A popover-bearing item's click is owned by the trigger, which toggles `open`. Passing\n // `onClick` through as well would ALSO run the fallback path — opening the panel and\n // navigating to the overlay in the same click.\n onClick: item.popover ? undefined : item.onClick,\n variant: item.variant,\n size,\n labelDisplayMode,\n disabled: item.disabled,\n busy: item.busy,\n className: item.className,\n tabIndex,\n operationIdentifier: item.operationIdentifier,\n }\n\n if (item.unavailability) {\n return <ActionBarUnavailableItem button={buttonProps} label={item.label} unavailability={item.unavailability} />\n }\n\n if (!item.popover) {\n return <ActionButton {...buttonProps} />\n }\n\n // Anchored panel. Only DIRECTLY-rendered buttons get one: the overflow and subgroup renderers\n // below deliberately ignore `popover` and use `onClick`, because a panel anchored to a row of an\n // already-open dropdown is a nested-overlay problem rather than a layout choice. See\n // `ActionBarButtonPopover`.\n return (\n <Popover open={item.popover.open} onOpenChange={item.popover.onOpenChange}>\n <PopoverTrigger asChild>\n <ActionBarPopoverTriggerButton button={buttonProps} />\n </PopoverTrigger>\n <PopoverContent\n align={HorizontalAlign.END}\n aria-label={item.popover.title ?? item.label}\n className=\"w-(--action-bar-popover-width,20rem) max-w-[min(24rem,calc(100vw-2rem))]\"\n >\n {item.popover.content}\n </PopoverContent>\n </Popover>\n )\n}\n\n/**\n * The trigger an anchored panel clones onto.\n *\n * `PopoverTrigger asChild` merges the trigger's props — `onClick`, `aria-haspopup`, `aria-expanded`,\n * `aria-controls`, `data-state`, and the ref the panel positions against — onto its child ELEMENT.\n * `ActionButton` destructures only the props it knows, so cloned straight onto it the click arrived\n * (as `onClick`, which it does forward) and every attribute was dropped: a working panel was announced\n * to assistive technology as a plain button (#1041). `triggerProps` is the seam `ActionButton` offers\n * for exactly this; this adapter is the element the trigger clones onto, and it hands everything it\n * received to that seam, so what the trigger merged is what the button carries.\n */\n/**\n * An action that cannot run, rendered so it can still explain itself (`ActionBarUnavailability`).\n *\n * `aria-disabled` rather than `disabled`: the native attribute removes the button from the tab order\n * and swallows the click, so neither a keyboard user nor anyone else could ever learn WHY. Here the\n * click opens the same anchored panel an action with parameters uses, holding the reason and, when\n * there is one, the step that makes the action runnable. The panel never runs the action.\n */\nfunction ActionBarUnavailableItem({\n button,\n label,\n unavailability,\n}: {\n button: ActionButtonProps\n label: string\n unavailability: NonNullable<ActionBarButton[\"unavailability\"]>\n}): React.JSX.Element {\n const [open, setOpen] = React.useState(false)\n const reasonId = React.useId()\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <ActionBarPopoverTriggerButton\n button={{ ...button, onClick: undefined, disabled: false }}\n aria-disabled=\"true\"\n aria-describedby={reasonId}\n data-unavailable=\"true\"\n />\n </PopoverTrigger>\n <PopoverContent\n align={HorizontalAlign.END}\n aria-label={label}\n className=\"flex w-(--action-bar-popover-width,20rem) max-w-[min(24rem,calc(100vw-2rem))] flex-col gap-group\"\n >\n <p id={reasonId} className=\"text-sm\">{unavailability.reason}</p>\n {unavailability.resolve ? (\n <Button\n variant={ButtonVariants_Variant.OUTLINE}\n size={ButtonSize.SM}\n className=\"self-end\"\n onClick={() => {\n setOpen(false)\n unavailability.resolve?.onSelect()\n }}\n >\n {unavailability.resolve.label}\n </Button>\n ) : null}\n </PopoverContent>\n </Popover>\n )\n}\n\nconst ActionBarPopoverTriggerButton = React.forwardRef<\n HTMLButtonElement,\n { button: ActionButtonProps } & React.ButtonHTMLAttributes<HTMLButtonElement>\n>(function ActionBarPopoverTriggerButton({ button, ...injected }, ref) {\n return <ActionButton {...button} ref={ref} triggerProps={injected} />\n})\n\n/* ── Sub-group trigger (inline dropdown) ──────────────────────────────────── */\n\nfunction ActionBarSubGroupTrigger({\n item,\n size,\n tabIndex,\n}: {\n item: ActionBarSubGroup\n size: ActionButtonSize\n tabIndex?: number\n}): React.JSX.Element {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant={item.variant ?? ButtonVariants_Variant.GHOST}\n size={size}\n disabled={item.disabled}\n onClick={(e) => e.stopPropagation()}\n aria-label={item.label}\n tabIndex={tabIndex}\n className={item.className}\n // Same `data-operation-id` a plain action button carries (see `ActionButton`). A subgroup\n // is still ONE operation — several ways to invoke it — so anything that addresses actions\n // by operation rather than by their translated label must be able to find it. Without this,\n // an operation that renders as a subgroup is unreachable to every such consumer while its\n // single-variant sibling is not, which is a difference in the RENDERING and not in the\n // operation.\n data-operation-id={item.operationIdentifier}\n >\n {item.icon}\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent>\n {item.items.map((subItem, index) => (\n <ActionBarOverflowItem key={index} item={subItem} />\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n\n/* ── Overflow menu item renderer ──────────────────────────────────────────── */\n\nfunction ActionBarOverflowItem({\n item,\n}: {\n item: ActionBarItem\n}): React.JSX.Element | null {\n if (item.type === \"separator\") {\n return <DropdownMenuSeparator />\n }\n\n if (item.type === \"subgroup\") {\n return (\n <DropdownMenuSub>\n <DropdownMenuSubTrigger disabled={item.disabled}>\n <span className=\"me-element flex size-4 items-center justify-center shrink-0\">\n {item.icon}\n </span>\n {item.label}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n {item.items.map((subItem, index) => (\n <ActionBarOverflowItem key={index} item={subItem} />\n ))}\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n )\n }\n\n // Regular button → menu item. `data-operation-id` is the i18n-independent\n // automation hook (labels are runtime-translated) — attribute only.\n // An unavailable action inside an open menu cannot anchor a second panel (see\n // `ActionBarButtonPopover`), so its reason is written under its label instead: still disabled,\n // but no longer silent about why.\n return (\n <DropdownMenuItem\n variant={item.variant === \"destructive\" ? \"destructive\" : \"default\"}\n disabled={item.disabled || item.unavailability !== undefined}\n data-operation-id={item.operationIdentifier}\n onClick={(e) => {\n e.stopPropagation()\n item.onClick?.()\n }}\n >\n <span className=\"me-element flex size-4 items-center justify-center shrink-0\">\n {item.icon}\n </span>\n {item.unavailability ? (\n <span className=\"flex flex-col\">\n <span>{item.label}</span>\n <span className=\"text-xs text-muted-foreground\">{item.unavailability.reason}</span>\n </span>\n ) : item.label}\n </DropdownMenuItem>\n )\n}\n\nexport { ActionBar }\n"]}
|
|
1
|
+
{"version":3,"file":"action-bar.js","sourceRoot":"","sources":["../../../../../src/components/actions/action-bar.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAU9B,OAAO,EACL,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,mBAAmB,EAC3D,gBAAgB,EAChB,qBAAqB,EACrB,eA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6D,YAC1E,IAAI,CAAC,IAAI,GACL,EACN,IAAI,CAAC,KAAK,IACY,EACzB,KAAC,sBAAsB,cACpB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAClC,KAAC,qBAAqB,IAAa,IAAI,EAAE,OAAO,IAApB,KAAK,CAAmB,CACrD,CAAC,GACqB,IACT,CACnB,CAAA;IACH,CAAC;IAED,0EAA0E;IAC1E,oEAAoE;IACpE,8EAA8E;IAC9E,+FAA+F;IAC/F,kCAAkC;IAClC,OAAO,CACL,MAAC,gBAAgB,IACf,OAAO,EAAE,IAAI,CAAC,OAAO,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,EACnE,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,uBACzC,IAAI,CAAC,mBAAmB,EAC3C,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,eAAe,EAAE,CAAA;YACnB,IAAI,CAAC,OAAO,EAAE,EAAE,CAAA;QAClB,CAAC,aAED,eAAM,SAAS,EAAC,6DAA6D,YAC1E,IAAI,CAAC,IAAI,GACL,EACN,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CACrB,gBAAM,SAAS,EAAC,eAAe,aAC7B,yBAAO,IAAI,CAAC,KAAK,GAAQ,EACzB,eAAM,SAAS,EAAC,+BAA+B,YAAE,IAAI,CAAC,cAAc,CAAC,MAAM,GAAQ,IAC9E,CACR,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IACG,CACpB,CAAA;AACH,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAA","sourcesContent":["\nimport * as React from \"react\"\nimport type { ActionButtonProps } from \"@wildo-ai/saas-frontend-lib\"\nimport type {\n ActionBarButton,\n ActionBarItem,\n ActionBarProps,\n ActionBarSubGroup,\n ActionButtonSize\n} from '@wildo-ai/saas-frontend-lib'\n\nimport {\n ActionButton, Button, cn, DropdownMenu, DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, IconSize,\n Popover, PopoverContent, PopoverTrigger,\n Separator, StandardIconReference, useI18n, useIconRegistry, useUI\n} from \"@wildo-ai/saas-frontend-lib\"\n\nimport { FrontendComponentType, ActionLabelDisplayMode } from \"@wildo-ai/presets-components-models\"\nimport { ButtonVariants_Variant, ActionBarPopoverChrome } from \"@wildo-ai/saas-frontend-lib\"\nimport { ButtonSize } from \"@wildo-ai/presets-components-models\"\nimport { HorizontalAlign, DisplayDirection } from \"@wildo-ai/zod-decorators\"\n\n/* ─────────────────────────────────────────────────────────────────────────────\n * ActionBar\n *\n * A toolbar-style group of ActionButtons with built-in overflow management.\n *\n * Features:\n * • maxDisplayed — shows N items directly; the rest collapse into a \"…\" menu.\n * • Separators — visual dividers between logical groups.\n * • Sub-groups — inline dropdown menus for related actions.\n * • Theme-aware — all buttons and menus use design-system recipes.\n *\n * This component replaces the external TinyButtonGroup pattern, adapted to\n * compose existing engine primitives (Button, DropdownMenu, Tooltip, etc.).\n * ────────────────────────────────────────────────────────────────────────── */\n\n/* ── Component ────────────────────────────────────────────────────────────── */\n\nfunction ActionBar({\n items,\n maxDisplayed,\n labelDisplayMode,\n orientation = DisplayDirection.HORIZONTAL,\n className,\n size = ButtonSize.ICON_SM,\n \"aria-label\": ariaLabel,\n}: ActionBarProps): React.JSX.Element {\n const isVertical = orientation === DisplayDirection.VERTICAL\n const { renderIcon } = useIconRegistry()\n const { actionLabelDisplayMode: appLabelDisplayMode } = useUI()\n const { tComponent, isReady } = useI18n({\n component: FrontendComponentType.LOW_LEVEL_ACTION_BAR,\n })\n\n // Resolve the effective label affordance: explicit prop (per-resource-view\n // override) → app-wide theme default (`ComponentStyleTheme.actionLabelDisplayMode`).\n const effectiveLabelMode = labelDisplayMode ?? appLabelDisplayMode\n\n // DROPDOWN forces the whole cluster into the overflow menu (no direct\n // buttons): clamp the displayed count to 0 so every item — separators\n // included — renders through the `…` menu path below.\n const effectiveMax = effectiveLabelMode === ActionLabelDisplayMode.DROPDOWN\n ? 0\n : (maxDisplayed ?? items.length)\n const displayedItems = items.slice(0, effectiveMax)\n const overflowItems = items.slice(effectiveMax)\n const hasOverflow = overflowItems.length > 0\n\n // WAI-ARIA toolbar pattern: roving tabindex (Arrow keys move focus, Tab exits toolbar)\n const [activeIndex, setActiveIndex] = React.useState(0)\n\n // Map each displayed item to its focusable position (separators excluded)\n const focusableMap = React.useMemo(() => {\n const displayed = items.slice(0, effectiveMax)\n const overflow = items.length > displayed.length\n const map: number[] = []\n let pos = 0\n for (const item of displayed) {\n if (item.type === \"separator\") {\n map.push(-1)\n } else {\n map.push(pos++)\n }\n }\n return { map, count: pos + (overflow ? 1 : 0) }\n }, [items, effectiveMax])\n\n // Reset activeIndex if it's out of bounds after items change\n React.useEffect(() => {\n if (focusableMap.count > 0 && activeIndex >= focusableMap.count) {\n setActiveIndex(focusableMap.count - 1)\n }\n }, [focusableMap.count, activeIndex])\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n const total = focusableMap.count\n if (total === 0) return\n\n let nextIndex: number | undefined\n switch (e.key) {\n // Both axes advance/retreat so the arrow keys match the bar's\n // orientation (vertical stacks navigate with Up/Down).\n case \"ArrowRight\":\n case \"ArrowDown\":\n nextIndex = (activeIndex + 1) % total\n break\n case \"ArrowLeft\":\n case \"ArrowUp\":\n nextIndex = (activeIndex - 1 + total) % total\n break\n case \"Home\":\n nextIndex = 0\n break\n case \"End\":\n nextIndex = total - 1\n break\n default:\n return\n }\n e.preventDefault()\n setActiveIndex(nextIndex)\n\n // Focus the target button via DOM query (dropdown content is portalled, so only toolbar buttons are found)\n const toolbar = e.currentTarget\n const buttons = toolbar.querySelectorAll<HTMLButtonElement>(\"button\")\n buttons[nextIndex]?.focus()\n },\n [activeIndex, focusableMap.count],\n )\n\n return (\n <div\n role=\"toolbar\"\n aria-label={ariaLabel}\n aria-orientation={isVertical ? \"vertical\" : \"horizontal\"}\n data-slot=\"action-bar\"\n // `gap-element` — the role's DEFAULT step, and the reason is rhythm rather than size. A\n // collection toolbar puts two of these bars side by side (whole-scope actions, then the\n // bulk/primary slot) inside a cluster that is itself `gap-element`, so a tightened `-sm`\n // here produced 4px inside each bar and 8px between them: one continuous run of buttons\n // reading as two groups that nothing in the design intends. `element` is the declared role\n // for \"between inline elements: icons, buttons, tags\"; the tightening was the deviation.\n className={cn(\"flex gap-element\", isVertical ? \"flex-col items-start\" : \"items-center\", className)}\n onKeyDown={handleKeyDown}\n >\n {/* ── Directly-displayed items ─────────────────────────────────── */}\n {displayedItems.map((item, index) => {\n const pos = focusableMap.map[index]\n if (pos === -1) {\n return <ActionBarDirectItem key={index} item={item} size={size} labelDisplayMode={effectiveLabelMode} orientation={orientation} />\n }\n return <ActionBarDirectItem key={index} item={item} size={size} labelDisplayMode={effectiveLabelMode} orientation={orientation} tabIndex={activeIndex === pos ? 0 : -1} />\n })}\n\n {/* ── Overflow menu ────────────────────────────────────────────── */}\n {hasOverflow && (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant={ButtonVariants_Variant.GHOST}\n size={size}\n onClick={(e) => e.stopPropagation()}\n aria-label={tComponent(FrontendComponentType.LOW_LEVEL_ACTION_BAR, 'moreActions')}\n tabIndex={activeIndex === focusableMap.count - 1 ? 0 : -1}\n >\n {renderIcon(StandardIconReference.MORE_HORIZONTAL, {\n size: IconSize.SM,\n })}\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align={HorizontalAlign.END}>\n {overflowItems.map((item, index) => (\n <ActionBarOverflowItem key={index} item={item} />\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )}\n </div>\n )\n}\n\nActionBar.displayName = \"ActionBar\"\n\n/* ── Direct item renderer ─────────────────────────────────────────────────── */\n\nfunction ActionBarDirectItem({\n item,\n size,\n labelDisplayMode,\n orientation = DisplayDirection.HORIZONTAL,\n tabIndex,\n}: {\n item: ActionBarItem\n size: ActionButtonSize\n labelDisplayMode: ActionLabelDisplayMode\n orientation?: DisplayDirection\n tabIndex?: number\n}): React.JSX.Element | null {\n if (item.type === \"separator\") {\n // The divider runs across the bar's cross-axis: a vertical rule between\n // buttons in a row, a horizontal rule between buttons in a vertical stack.\n return orientation === DisplayDirection.VERTICAL ? (\n <Separator\n orientation={DisplayDirection.HORIZONTAL}\n className=\"my-element-xs w-4 self-center\"\n />\n ) : (\n <Separator\n orientation={DisplayDirection.VERTICAL}\n className=\"mx-element-xs h-4 self-center\"\n />\n )\n }\n\n if (item.type === \"subgroup\") {\n return <ActionBarSubGroupTrigger item={item} size={size} tabIndex={tabIndex} />\n }\n\n // Regular button\n const buttonProps: ActionButtonProps = {\n icon: item.icon,\n label: item.label,\n // A popover-bearing item's click is owned by the trigger, which toggles `open`. Passing\n // `onClick` through as well would ALSO run the fallback path — opening the panel and\n // navigating to the overlay in the same click.\n onClick: item.popover ? undefined : item.onClick,\n variant: item.variant,\n size,\n labelDisplayMode,\n disabled: item.disabled,\n busy: item.busy,\n className: item.className,\n tabIndex,\n operationIdentifier: item.operationIdentifier,\n }\n\n if (item.unavailability) {\n return <ActionBarUnavailableItem button={buttonProps} label={item.label} unavailability={item.unavailability} />\n }\n\n if (!item.popover) {\n return <ActionButton {...buttonProps} />\n }\n\n // Anchored panel. Only DIRECTLY-rendered buttons get one: the overflow and subgroup renderers\n // below deliberately ignore `popover` and use `onClick`, because a panel anchored to a row of an\n // already-open dropdown is a nested-overlay problem rather than a layout choice. See\n // `ActionBarButtonPopover`.\n return (\n <Popover open={item.popover.open} onOpenChange={item.popover.onOpenChange}>\n <PopoverTrigger asChild>\n <ActionBarPopoverTriggerButton button={buttonProps} />\n </PopoverTrigger>\n <PopoverContent\n align={HorizontalAlign.END}\n aria-label={item.popover.title ?? item.label}\n className={cn(\n \"w-(--action-bar-popover-width,20rem) max-w-[min(24rem,calc(100vw-2rem))]\",\n // A LIST body (a DROPDOWN action's values) is a menu: its rows run edge to edge, so the\n // panel drops its own padding rather than framing the list a second time.\n item.popover.chrome === ActionBarPopoverChrome.LIST && \"w-(--action-bar-popover-width,16rem) p-0\",\n )}\n >\n {item.popover.content}\n </PopoverContent>\n </Popover>\n )\n}\n\n/**\n * The trigger an anchored panel clones onto.\n *\n * `PopoverTrigger asChild` merges the trigger's props — `onClick`, `aria-haspopup`, `aria-expanded`,\n * `aria-controls`, `data-state`, and the ref the panel positions against — onto its child ELEMENT.\n * `ActionButton` destructures only the props it knows, so cloned straight onto it the click arrived\n * (as `onClick`, which it does forward) and every attribute was dropped: a working panel was announced\n * to assistive technology as a plain button (#1041). `triggerProps` is the seam `ActionButton` offers\n * for exactly this; this adapter is the element the trigger clones onto, and it hands everything it\n * received to that seam, so what the trigger merged is what the button carries.\n */\n/**\n * An action that cannot run, rendered so it can still explain itself (`ActionBarUnavailability`).\n *\n * `aria-disabled` rather than `disabled`: the native attribute removes the button from the tab order\n * and swallows the click, so neither a keyboard user nor anyone else could ever learn WHY. Here the\n * click opens the same anchored panel an action with parameters uses, holding the reason and, when\n * there is one, the step that makes the action runnable. The panel never runs the action.\n */\nfunction ActionBarUnavailableItem({\n button,\n label,\n unavailability,\n}: {\n button: ActionButtonProps\n label: string\n unavailability: NonNullable<ActionBarButton[\"unavailability\"]>\n}): React.JSX.Element {\n const [open, setOpen] = React.useState(false)\n const reasonId = React.useId()\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <ActionBarPopoverTriggerButton\n button={{ ...button, onClick: undefined, disabled: false }}\n aria-disabled=\"true\"\n aria-describedby={reasonId}\n data-unavailable=\"true\"\n />\n </PopoverTrigger>\n <PopoverContent\n align={HorizontalAlign.END}\n aria-label={label}\n className=\"flex w-(--action-bar-popover-width,20rem) max-w-[min(24rem,calc(100vw-2rem))] flex-col gap-group\"\n >\n <p id={reasonId} className=\"text-sm\">{unavailability.reason}</p>\n {unavailability.resolve ? (\n <Button\n variant={ButtonVariants_Variant.OUTLINE}\n size={ButtonSize.SM}\n className=\"self-end\"\n onClick={() => {\n setOpen(false)\n unavailability.resolve?.onSelect()\n }}\n >\n {unavailability.resolve.label}\n </Button>\n ) : null}\n </PopoverContent>\n </Popover>\n )\n}\n\nconst ActionBarPopoverTriggerButton = React.forwardRef<\n HTMLButtonElement,\n { button: ActionButtonProps } & React.ButtonHTMLAttributes<HTMLButtonElement>\n>(function ActionBarPopoverTriggerButton({ button, ...injected }, ref) {\n return <ActionButton {...button} ref={ref} triggerProps={injected} />\n})\n\n/* ── Sub-group trigger (inline dropdown) ──────────────────────────────────── */\n\nfunction ActionBarSubGroupTrigger({\n item,\n size,\n tabIndex,\n}: {\n item: ActionBarSubGroup\n size: ActionButtonSize\n tabIndex?: number\n}): React.JSX.Element {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant={item.variant ?? ButtonVariants_Variant.GHOST}\n size={size}\n disabled={item.disabled}\n onClick={(e) => e.stopPropagation()}\n aria-label={item.label}\n tabIndex={tabIndex}\n className={item.className}\n // Same `data-operation-id` a plain action button carries (see `ActionButton`). A subgroup\n // is still ONE operation — several ways to invoke it — so anything that addresses actions\n // by operation rather than by their translated label must be able to find it. Without this,\n // an operation that renders as a subgroup is unreachable to every such consumer while its\n // single-variant sibling is not, which is a difference in the RENDERING and not in the\n // operation.\n data-operation-id={item.operationIdentifier}\n >\n {item.icon}\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent>\n {item.items.map((subItem, index) => (\n <ActionBarOverflowItem key={index} item={subItem} />\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n\n/* ── Overflow menu item renderer ──────────────────────────────────────────── */\n\nfunction ActionBarOverflowItem({\n item,\n}: {\n item: ActionBarItem\n}): React.JSX.Element | null {\n if (item.type === \"separator\") {\n return <DropdownMenuSeparator />\n }\n\n if (item.type === \"subgroup\") {\n return (\n <DropdownMenuSub>\n <DropdownMenuSubTrigger disabled={item.disabled}>\n <span className=\"me-element flex size-4 items-center justify-center shrink-0\">\n {item.icon}\n </span>\n {item.label}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n {item.items.map((subItem, index) => (\n <ActionBarOverflowItem key={index} item={subItem} />\n ))}\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n )\n }\n\n // Regular button → menu item. `data-operation-id` is the i18n-independent\n // automation hook (labels are runtime-translated) — attribute only.\n // An unavailable action inside an open menu cannot anchor a second panel (see\n // `ActionBarButtonPopover`), so its reason is written under its label instead: still disabled,\n // but no longer silent about why.\n return (\n <DropdownMenuItem\n variant={item.variant === \"destructive\" ? \"destructive\" : \"default\"}\n disabled={item.disabled || item.unavailability !== undefined}\n data-operation-id={item.operationIdentifier}\n onClick={(e) => {\n e.stopPropagation()\n item.onClick?.()\n }}\n >\n <span className=\"me-element flex size-4 items-center justify-center shrink-0\">\n {item.icon}\n </span>\n {item.unavailability ? (\n <span className=\"flex flex-col\">\n <span>{item.label}</span>\n <span className=\"text-xs text-muted-foreground\">{item.unavailability.reason}</span>\n </span>\n ) : item.label}\n </DropdownMenuItem>\n )\n}\n\nexport { ActionBar }\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ai-elements/chat/suggestion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAG3F,eAAO,MAAM,cAAc,GAAI,mCAI5B,mBAAmB,KAAG,KAAK,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"suggestion.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ai-elements/chat/suggestion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAG3F,eAAO,MAAM,cAAc,GAAI,mCAI5B,mBAAmB,KAAG,KAAK,CAAC,GAAG,CAAC,OAalC,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,uEAQ3B,kBAAkB,KAAG,KAAK,CAAC,GAAG,CAAC,OAiBjC,CAAC"}
|
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Button, ScrollArea, ScrollBar, cn } from "@wildo-ai/saas-frontend-lib";
|
|
4
4
|
import { DisplayDirection } from "@wildo-ai/zod-decorators";
|
|
5
|
-
export const AI_Suggestions = ({ className, children, ...props }) => (
|
|
5
|
+
export const AI_Suggestions = ({ className, children, ...props }) => (
|
|
6
|
+
/*
|
|
7
|
+
* `min-w-0` is what keeps the strip a strip. Inside a flex container the scroll area is a flex item,
|
|
8
|
+
* whose automatic minimum width is its content's — and the content is a `w-max` row — so without it
|
|
9
|
+
* the strip widened its parent to every chip's total instead of scrolling (#1454: Home's "You could"
|
|
10
|
+
* pushed the page sideways).
|
|
11
|
+
*/
|
|
12
|
+
_jsxs(ScrollArea, { className: "w-full min-w-0 max-w-full overflow-x-auto whitespace-nowrap", viewportClassName: "snap-x snap-mandatory", ...props, children: [_jsx("div", { className: cn("flex w-max flex-nowrap items-center gap-element", className), children: children }), _jsx(ScrollBar, { className: "hidden", orientation: DisplayDirection.HORIZONTAL })] }));
|
|
6
13
|
export const AI_Suggestion = ({ suggestion, onClick, className, variant = "outline", size = "sm", children, ...props }) => {
|
|
7
14
|
const handleClick = () => {
|
|
8
15
|
onClick?.(suggestion);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestion.js","sourceRoot":"","sources":["../../../../../../src/components/ai-elements/chat/suggestion.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,M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CAAC,EAC1E,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,IAAmD,EACzD,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAyD,KAC9D,KAAK,YAER,QAAQ,IAAI,UAAU,GAChB,CACV,CAAC;AACJ,CAAC,CAAC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Button, ScrollArea, ScrollBar, cn } from \"@wildo-ai/saas-frontend-lib\";\nimport { DisplayDirection } from \"@wildo-ai/zod-decorators\";\nimport type { AI_SuggestionsProps, AI_SuggestionProps } from '@wildo-ai/saas-frontend-lib';\nimport { FrontendComponentType } from \"@wildo-ai/presets-components-models\"\n\nexport const AI_Suggestions = ({\n className,\n children,\n ...props\n}: AI_SuggestionsProps): React.JSX.Element => (\n /*\n * `min-w-0` is what keeps the strip a strip. Inside a flex container the scroll area is a flex item,\n * whose automatic minimum width is its content's — and the content is a `w-max` row — so without it\n * the strip widened its parent to every chip's total instead of scrolling (#1454: Home's \"You could\"\n * pushed the page sideways).\n */\n <ScrollArea className=\"w-full min-w-0 max-w-full overflow-x-auto whitespace-nowrap\" viewportClassName=\"snap-x snap-mandatory\" {...props}>\n <div className={cn(\"flex w-max flex-nowrap items-center gap-element\", className)}>\n {children}\n </div>\n <ScrollBar className=\"hidden\" orientation={DisplayDirection.HORIZONTAL} />\n </ScrollArea>\n);\n\nexport const AI_Suggestion = ({\n suggestion,\n onClick,\n className,\n variant = \"outline\",\n size = \"sm\",\n children,\n ...props\n}: AI_SuggestionProps): React.JSX.Element => {\n const handleClick = (): void => {\n onClick?.(suggestion);\n };\n\n return (\n <Button\n className={cn(\"cursor-pointer rounded-full px-card snap-start\", className)}\n onClick={handleClick}\n size={size as React.ComponentProps<typeof Button>[\"size\"]}\n type=\"button\"\n variant={variant as React.ComponentProps<typeof Button>[\"variant\"]}\n {...props}\n >\n {children || suggestion}\n </Button>\n );\n};\n"]}
|
|
@@ -2,7 +2,65 @@ import * as React from "react";
|
|
|
2
2
|
import { Alert } from '@wildo-ai/saas-frontend-lib';
|
|
3
3
|
import type { SerializableZodSchema } from '@wildo-ai/zod-decorators';
|
|
4
4
|
import type { ComponentProps } from "react";
|
|
5
|
-
|
|
5
|
+
/** One person a decision may be moved to, as the surface shows them. `value` is their id. */
|
|
6
|
+
export type AI_ApprovalReassignCandidate = {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
};
|
|
10
|
+
/** One reason a decision's clocks may be paused for (#1628). `value` is the gate's pause-state identifier. */
|
|
11
|
+
export type AI_ApprovalPauseStateOption = {
|
|
12
|
+
value: string;
|
|
13
|
+
label: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* One reason an approver may give for changing or rejecting an agent's proposal (#1921). `value` is a code of the
|
|
17
|
+
* application's declared vocabulary; `label` is its word, as LOCALIZED text the surface's owner resolved.
|
|
18
|
+
*/
|
|
19
|
+
export type AI_ApprovalReasonCodeOption = {
|
|
20
|
+
value: string;
|
|
21
|
+
label: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* What else a person may do with a decision besides answering it (#1594 D12). Each is offered only when its
|
|
25
|
+
* callback is supplied, so a surface shows exactly the acts its owner can carry out — never a button that
|
|
26
|
+
* submits into nothing.
|
|
27
|
+
*/
|
|
28
|
+
export type AI_ApprovalRoutingProps = {
|
|
29
|
+
/** Take a decision routed to a role you hold for yourself. */
|
|
30
|
+
onClaim?: (approvalId: string) => void;
|
|
31
|
+
/** Give a decision you claimed back to its role. */
|
|
32
|
+
onUnclaim?: (approvalId: string) => void;
|
|
33
|
+
/** The reassign picker opened: load who it may go to, and pass them back as `reassignCandidates`. */
|
|
34
|
+
onReassignOpen?: (approvalId: string) => void;
|
|
35
|
+
/** Only people who could answer it. Absent while loading; empty when nobody else can. */
|
|
36
|
+
reassignCandidates?: readonly AI_ApprovalReassignCandidate[];
|
|
37
|
+
onReassign?: (approvalId: string, targetUserId: string, comment?: string) => void;
|
|
38
|
+
/**
|
|
39
|
+
* What the last act came to, as LOCALIZED text the surface's owner resolved — "someone else settled this",
|
|
40
|
+
* "there is nobody to escalate this to". Absent when there is nothing to say.
|
|
41
|
+
*/
|
|
42
|
+
actionNotice?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Stop the decision's CLAIM and DECISION deadlines, naming one of `pauseStateOptions` (#1628). Offered only
|
|
45
|
+
* with at least one option. Pausing never stops the decision from expiring.
|
|
46
|
+
*/
|
|
47
|
+
onPauseClock?: (approvalId: string, pauseStateRef: string) => void;
|
|
48
|
+
/** Restart paused deadlines; the paused time is added to them. */
|
|
49
|
+
onResumeClock?: (approvalId: string) => void;
|
|
50
|
+
/** The reasons the gate allows its deadlines to be paused for. */
|
|
51
|
+
pauseStateOptions?: readonly AI_ApprovalPauseStateOption[];
|
|
52
|
+
/** The next deadline ahead of the decision, as LOCALIZED text the surface's owner resolved. */
|
|
53
|
+
deadlineNotice?: string;
|
|
54
|
+
/** Set while its deadlines are paused: why, as LOCALIZED text the surface's owner resolved. */
|
|
55
|
+
clockPausedNotice?: string;
|
|
56
|
+
};
|
|
57
|
+
export type AI_ApprovalRequestProps = ComponentProps<typeof Alert> & AI_ApprovalRoutingProps & {
|
|
58
|
+
/**
|
|
59
|
+
* Whether THIS viewer may answer it (#1594). `false` renders the request with no actions — the person
|
|
60
|
+
* whose conversation it is sees a question that a reviewer answers, and `actionNotice` says so. Default
|
|
61
|
+
* `true`, which is every surface that answers its own questions.
|
|
62
|
+
*/
|
|
63
|
+
answerable?: boolean;
|
|
6
64
|
approvalId: string;
|
|
7
65
|
actionDescription: string;
|
|
8
66
|
/**
|
|
@@ -50,29 +108,39 @@ export type AI_ApprovalRequestProps = ComponentProps<typeof Alert> & {
|
|
|
50
108
|
argumentModificationError?: string;
|
|
51
109
|
/** What the approver submitted when that edit was refused (#587) — the reopened editor starts from it. */
|
|
52
110
|
rejectedArguments?: Record<string, unknown>;
|
|
111
|
+
/**
|
|
112
|
+
* The reasons an approver may give when they CHANGE or REJECT the proposal (#1921) — the application's declared
|
|
113
|
+
* vocabulary, worded by the surface's owner. Offered only then: approving the call as proposed is not a correction.
|
|
114
|
+
* Never required — a reason is evidence for why experts disagree with the agent, not a gate on answering.
|
|
115
|
+
*/
|
|
116
|
+
reasonCodeOptions?: readonly AI_ApprovalReasonCodeOption[];
|
|
53
117
|
/**
|
|
54
118
|
* `modifiedToolArgs` is present only when the approver EDITED the arguments. Absent means "run the
|
|
55
|
-
* call as proposed", which is what every approval meant before this parameter existed.
|
|
119
|
+
* call as proposed", which is what every approval meant before this parameter existed. `reasonCode` is present only
|
|
120
|
+
* when the approver edited the call AND chose a reason for it (#1921).
|
|
56
121
|
*/
|
|
57
|
-
onApprove?: (approvalId: string, comment?: string, modifiedToolArgs?: Record<string, unknown
|
|
58
|
-
|
|
122
|
+
onApprove?: (approvalId: string, comment?: string, modifiedToolArgs?: Record<string, unknown>, reasonCode?: string) => void;
|
|
123
|
+
/** `reasonCode` is present only when the approver chose a reason for the rejection (#1921). */
|
|
124
|
+
onDeny?: (approvalId: string, comment?: string, reasonCode?: string) => void;
|
|
59
125
|
onEscalate?: (approvalId: string, comment?: string) => void;
|
|
60
126
|
isProcessing?: boolean;
|
|
61
127
|
createdAt?: Date;
|
|
62
128
|
};
|
|
63
|
-
export declare const AI_ApprovalRequest: ({ approvalId, actionDescription, riskLevel, executionId, systemRef, expiresAt, requiredRoles, toolName, executionContext, allowArgumentModification, argumentsSchema, argumentModificationError, rejectedArguments, onApprove, onDeny, onEscalate, isProcessing, createdAt, className, ...props }: AI_ApprovalRequestProps) => React.JSX.Element | null;
|
|
64
|
-
export type AI_ApprovalActionsProps = ComponentProps<"div"> & {
|
|
129
|
+
export declare const AI_ApprovalRequest: ({ approvalId, actionDescription, riskLevel, executionId, systemRef, expiresAt, requiredRoles, toolName, executionContext, allowArgumentModification, argumentsSchema, argumentModificationError, rejectedArguments, reasonCodeOptions, onApprove, onDeny, onEscalate, onClaim, onUnclaim, onReassignOpen, reassignCandidates, onReassign, actionNotice, onPauseClock, onResumeClock, pauseStateOptions, deadlineNotice, clockPausedNotice, answerable, isProcessing, createdAt, className, ...props }: AI_ApprovalRequestProps) => React.JSX.Element | null;
|
|
130
|
+
export type AI_ApprovalActionsProps = ComponentProps<"div"> & AI_ApprovalRoutingProps & {
|
|
65
131
|
approvalId: string;
|
|
66
132
|
riskLevel?: "low" | "medium" | "high" | "critical";
|
|
67
133
|
/** Present only while the approver has the argument editor open with a parseable draft (#566). */
|
|
68
134
|
modifiedToolArgs?: Record<string, unknown>;
|
|
69
|
-
|
|
70
|
-
|
|
135
|
+
/** See {@link AI_ApprovalRequestProps.reasonCodeOptions} (#1921). */
|
|
136
|
+
reasonCodeOptions?: readonly AI_ApprovalReasonCodeOption[];
|
|
137
|
+
onApprove?: (approvalId: string, comment?: string, modifiedToolArgs?: Record<string, unknown>, reasonCode?: string) => void;
|
|
138
|
+
onDeny?: (approvalId: string, comment?: string, reasonCode?: string) => void;
|
|
71
139
|
onEscalate?: (approvalId: string, comment?: string) => void;
|
|
72
140
|
isProcessing?: boolean;
|
|
73
141
|
disabled?: boolean;
|
|
74
142
|
};
|
|
75
|
-
export declare const AI_ApprovalActions: ({ approvalId, riskLevel, modifiedToolArgs, onApprove, onDeny, onEscalate, isProcessing, disabled, className, ...props }: AI_ApprovalActionsProps) => React.JSX.Element | null;
|
|
143
|
+
export declare const AI_ApprovalActions: ({ approvalId, riskLevel, modifiedToolArgs, reasonCodeOptions, onApprove, onDeny, onEscalate, onClaim, onUnclaim, onReassignOpen, reassignCandidates, onReassign, actionNotice, onPauseClock, onResumeClock, pauseStateOptions, isProcessing, disabled, className, ...props }: AI_ApprovalActionsProps) => React.JSX.Element | null;
|
|
76
144
|
export type AI_ApprovalQueueItem = {
|
|
77
145
|
approvalId: string;
|
|
78
146
|
executionId: string;
|
|
@@ -84,15 +152,42 @@ export type AI_ApprovalQueueItem = {
|
|
|
84
152
|
requiredRoles?: string[];
|
|
85
153
|
executionContext?: Record<string, unknown>;
|
|
86
154
|
createdAt?: Date;
|
|
155
|
+
/** The gated tool, rendered as authored (#455). */
|
|
156
|
+
toolName?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Which routing acts THIS item offers (#1594). Unset means none: the queue's callbacks are wired per item
|
|
159
|
+
* only where the person may perform the act, so no item shows a button the server would refuse.
|
|
160
|
+
*/
|
|
161
|
+
canEscalate?: boolean;
|
|
162
|
+
canClaim?: boolean;
|
|
163
|
+
canUnclaim?: boolean;
|
|
164
|
+
canReassign?: boolean;
|
|
165
|
+
/** See {@link AI_ApprovalRoutingProps.reassignCandidates}. */
|
|
166
|
+
reassignCandidates?: readonly AI_ApprovalReassignCandidate[];
|
|
167
|
+
/** See {@link AI_ApprovalRoutingProps.actionNotice}. */
|
|
168
|
+
actionNotice?: string;
|
|
169
|
+
/** #1628: whether this item offers Pause / Resume, the reasons it may be paused for, and its deadline lines. */
|
|
170
|
+
canPauseClock?: boolean;
|
|
171
|
+
canResumeClock?: boolean;
|
|
172
|
+
pauseStateOptions?: readonly AI_ApprovalPauseStateOption[];
|
|
173
|
+
deadlineNotice?: string;
|
|
174
|
+
clockPausedNotice?: string;
|
|
175
|
+
/** #1921: the reasons a reviewer may give when changing or rejecting this item's proposal. */
|
|
176
|
+
reasonCodeOptions?: readonly AI_ApprovalReasonCodeOption[];
|
|
177
|
+
/** #1921: offer the argument editor on this item, so a reviewer may CHANGE the proposed call. */
|
|
178
|
+
allowArgumentModification?: boolean;
|
|
179
|
+
/** The gated tool's input-schema descriptor, so the editor offers the tool's fields (#587). */
|
|
180
|
+
argumentsSchema?: SerializableZodSchema;
|
|
87
181
|
};
|
|
88
|
-
export type AI_ApprovalQueueProps = ComponentProps<"div"> & {
|
|
182
|
+
export type AI_ApprovalQueueProps = ComponentProps<"div"> & Omit<AI_ApprovalRoutingProps, 'reassignCandidates' | 'actionNotice' | 'pauseStateOptions' | 'deadlineNotice' | 'clockPausedNotice'> & {
|
|
89
183
|
items: AI_ApprovalQueueItem[];
|
|
90
|
-
|
|
91
|
-
|
|
184
|
+
/** `modifiedToolArgs` only when the reviewer edited the call; `reasonCode` only when they gave a reason (#1921). */
|
|
185
|
+
onApprove?: (approvalId: string, comment?: string, modifiedToolArgs?: Record<string, unknown>, reasonCode?: string) => void;
|
|
186
|
+
onDeny?: (approvalId: string, comment?: string, reasonCode?: string) => void;
|
|
92
187
|
onEscalate?: (approvalId: string, comment?: string) => void;
|
|
93
188
|
processingIds?: Set<string>;
|
|
94
189
|
filter?: string;
|
|
95
190
|
onFilterChange?: (filter: string) => void;
|
|
96
191
|
};
|
|
97
|
-
export declare const AI_ApprovalQueue: ({ items, onApprove, onDeny, onEscalate, processingIds, filter, onFilterChange, className, ...props }: AI_ApprovalQueueProps) => React.JSX.Element | null;
|
|
192
|
+
export declare const AI_ApprovalQueue: ({ items, onApprove, onDeny, onEscalate, onClaim, onUnclaim, onReassignOpen, onReassign, onPauseClock, onResumeClock, processingIds, filter, onFilterChange, className, ...props }: AI_ApprovalQueueProps) => React.JSX.Element | null;
|
|
98
193
|
//# sourceMappingURL=approval.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ai-elements/decision/approval.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ai-elements/decision/approval.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,KAAK,EAwBN,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAItE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAiD5C,6FAA6F;AAC7F,MAAM,MAAM,4BAA4B,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IA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GAAG,gBAAgB,GAAG,mBAAmB,CAAC,GAAG;IAChM,KAAK,EAAE,oBAAoB,EAAE,CAAC;IAC9B,oHAAoH;IACpH,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5H,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7E,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AAcF,eAAO,MAAM,gBAAgB,GAAI,mLAgB9B,qBAAqB,KAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAqG9C,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Badge, Button, ButtonVariants_Variant, ScrollArea, TextareaRoot, cn, useI18n, Surface, } from '@wildo-ai/saas-frontend-lib';
|
|
4
|
+
import { Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Badge, Button, ButtonVariants_Variant, ScrollArea, SelectContent, SelectItem, SelectRoot, SelectTrigger, SelectValue, TextareaRoot, cn, useI18n, Surface, } from '@wildo-ai/saas-frontend-lib';
|
|
5
5
|
import { FrontendComponentType, ButtonSize, SurfaceVariant } from "@wildo-ai/presets-components-models";
|
|
6
6
|
import { ApprovalArgumentEditorMode, ApprovalArgumentFields, fieldsEditableArgumentsSchema } from "./approval-argument-fields.js";
|
|
7
7
|
const CT = FrontendComponentType.LOW_LEVEL_AI_APPROVAL;
|
|
@@ -41,7 +41,7 @@ function useCountdown(expiresAt) {
|
|
|
41
41
|
: `${seconds}s`;
|
|
42
42
|
return { remaining, isExpired: false };
|
|
43
43
|
}
|
|
44
|
-
export const AI_ApprovalRequest = ({ approvalId, actionDescription, riskLevel, executionId, systemRef, expiresAt, requiredRoles, toolName, executionContext, allowArgumentModification, argumentsSchema, argumentModificationError, rejectedArguments, onApprove, onDeny, onEscalate, isProcessing, createdAt, className, ...props }) => {
|
|
44
|
+
export const AI_ApprovalRequest = ({ approvalId, actionDescription, riskLevel, executionId, systemRef, expiresAt, requiredRoles, toolName, executionContext, allowArgumentModification, argumentsSchema, argumentModificationError, rejectedArguments, reasonCodeOptions, onApprove, onDeny, onEscalate, onClaim, onUnclaim, onReassignOpen, reassignCandidates, onReassign, actionNotice, onPauseClock, onResumeClock, pauseStateOptions, deadlineNotice, clockPausedNotice, answerable = true, isProcessing, createdAt, className, ...props }) => {
|
|
45
45
|
const { tComponent, isReady } = useI18n({ component: CT });
|
|
46
46
|
const { remaining, isExpired } = useCountdown(expiresAt);
|
|
47
47
|
const variant = riskLevel === "critical" || riskLevel === "high" ? "destructive" : "default";
|
|
@@ -84,7 +84,7 @@ export const AI_ApprovalRequest = ({ approvalId, actionDescription, riskLevel, e
|
|
|
84
84
|
}, [draft]);
|
|
85
85
|
if (!isReady)
|
|
86
86
|
return null;
|
|
87
|
-
return (_jsxs(Alert, { variant: variant, className: cn("flex flex-col gap-card-sm", className), ...props, children: [_jsxs("div", { className: "flex items-center justify-between gap-element", children: [_jsxs("div", { className: "flex items-center gap-element", children: [riskLevel && (_jsx(Badge, { variant: riskLevel === "critical" || riskLevel === "high" ? "destructive" : "outline", className: "text-2xs", children: tComponent(CT, `risk${riskLevel.charAt(0).toUpperCase()}${riskLevel.slice(1)}`) })), systemRef && (_jsx("span", { className: "text-2xs text-muted-foreground", children: systemRef }))] }), remaining && (_jsx(Badge, { variant: "secondary", className: "text-2xs tabular-nums", children: tComponent(CT, "expiresCountdown", { time: remaining }) })), isExpired && (_jsx(Badge, { variant: "destructive", className: "text-2xs", children: tComponent(CT, "expired") }))] }), _jsx(AlertDescription, { className: "text-sm", children: actionDescription }), requiredRoles && requiredRoles.length > 0 && (_jsxs("div", { className: "flex items-center gap-element", children: [_jsxs("span", { className: "text-2xs text-muted-foreground", children: [tComponent(CT, "requiredRoles"), ":"] }), _jsx("div", { className: "flex gap-1", children: requiredRoles.map((role) => (_jsx(Badge, { variant: "outline", className: "text-2xs", children: role }, role))) })] })), toolName !== undefined && (_jsxs("div", { className: "flex items-center gap-element", children: [_jsxs("span", { className: "text-2xs text-muted-foreground", children: [tComponent(CT, "toolCall"), ":"] }), _jsx("code", { className: "rounded bg-muted px-1 py-0.5 text-2xs font-mono", children: toolName })] })), executionContext && Object.keys(executionContext).length > 0 && (_jsxs("div", { className: "flex flex-col gap-element", children: [_jsxs("div", { className: "flex items-center justify-between gap-element", children: [_jsxs("span", { className: "text-2xs text-muted-foreground", children: [tComponent(CT, "toolArguments"), ":"] }), allowArgumentModification && (_jsxs("div", { className: "flex items-center gap-1", children: [editorMode !== null && fieldsSchema && (_jsx(Button, { type: "button", variant: ButtonVariants_Variant.GHOST, size: ButtonSize.SM, disabled: isProcessing || isExpired || (editorMode === ApprovalArgumentEditorMode.JSON && parsedDraft.invalid), onClick: () => {
|
|
87
|
+
return (_jsxs(Alert, { variant: variant, className: cn("flex flex-col gap-card-sm", className), ...props, children: [_jsxs("div", { className: "flex items-center justify-between gap-element", children: [_jsxs("div", { className: "flex items-center gap-element", children: [riskLevel && (_jsx(Badge, { variant: riskLevel === "critical" || riskLevel === "high" ? "destructive" : "outline", className: "text-2xs", children: tComponent(CT, `risk${riskLevel.charAt(0).toUpperCase()}${riskLevel.slice(1)}`) })), systemRef && (_jsx("span", { className: "text-2xs text-muted-foreground", children: systemRef }))] }), remaining && (_jsx(Badge, { variant: "secondary", className: "text-2xs tabular-nums", children: tComponent(CT, "expiresCountdown", { time: remaining }) })), isExpired && (_jsx(Badge, { variant: "destructive", className: "text-2xs", children: tComponent(CT, "expired") }))] }), _jsx(AlertDescription, { className: "text-sm", children: actionDescription }), clockPausedNotice !== undefined ? (_jsx("span", { className: "text-2xs text-muted-foreground", children: clockPausedNotice })) : deadlineNotice !== undefined ? (_jsx("span", { className: "text-2xs text-muted-foreground", children: deadlineNotice })) : null, requiredRoles && requiredRoles.length > 0 && (_jsxs("div", { className: "flex items-center gap-element", children: [_jsxs("span", { className: "text-2xs text-muted-foreground", children: [tComponent(CT, "requiredRoles"), ":"] }), _jsx("div", { className: "flex gap-1", children: requiredRoles.map((role) => (_jsx(Badge, { variant: "outline", className: "text-2xs", children: role }, role))) })] })), toolName !== undefined && (_jsxs("div", { className: "flex items-center gap-element", children: [_jsxs("span", { className: "text-2xs text-muted-foreground", children: [tComponent(CT, "toolCall"), ":"] }), _jsx("code", { className: "rounded bg-muted px-1 py-0.5 text-2xs font-mono", children: toolName })] })), executionContext && Object.keys(executionContext).length > 0 && (_jsxs("div", { className: "flex flex-col gap-element", children: [_jsxs("div", { className: "flex items-center justify-between gap-element", children: [_jsxs("span", { className: "text-2xs text-muted-foreground", children: [tComponent(CT, "toolArguments"), ":"] }), allowArgumentModification && (_jsxs("div", { className: "flex items-center gap-1", children: [editorMode !== null && fieldsSchema && (_jsx(Button, { type: "button", variant: ButtonVariants_Variant.GHOST, size: ButtonSize.SM, disabled: isProcessing || isExpired || (editorMode === ApprovalArgumentEditorMode.JSON && parsedDraft.invalid), onClick: () => {
|
|
88
88
|
if (editorMode === ApprovalArgumentEditorMode.FIELDS) {
|
|
89
89
|
setDraft(JSON.stringify(fieldsEdit.value ?? fieldsSeed, null, 2));
|
|
90
90
|
setEditorMode(ApprovalArgumentEditorMode.JSON);
|
|
@@ -105,7 +105,7 @@ export const AI_ApprovalRequest = ({ approvalId, actionDescription, riskLevel, e
|
|
|
105
105
|
setEditorMode(fieldsSchema ? ApprovalArgumentEditorMode.FIELDS : ApprovalArgumentEditorMode.JSON);
|
|
106
106
|
}, children: tComponent(CT, editorMode === null ? "editArguments" : "discardArgumentEdits") })] }))] }), argumentModificationError !== undefined && editorMode !== null && (_jsxs("span", { className: "text-2xs text-destructive", children: [tComponent(CT, "argumentModificationRefused"), ": ", argumentModificationError] })), editorMode === null ? (_jsx(Surface, { asChild: true, emitPolicyVars: false, variant: SurfaceVariant.INSET, children: _jsx("dl", { className: "grid grid-cols-[auto_1fr] gap-x-element gap-y-0.5 rounded-md bg-muted p-2 text-2xs", children: Object.entries(executionContext).map(([key, value]) => (_jsxs(React.Fragment, { children: [_jsx("dt", { className: "font-mono text-muted-foreground", children: key }), _jsx("dd", { className: "min-w-0 break-words font-mono", children: typeof value === "string" || typeof value === "number" || typeof value === "boolean"
|
|
107
107
|
? String(value)
|
|
108
|
-
: JSON.stringify(value) })] }, key))) }) })) : editorMode === ApprovalArgumentEditorMode.FIELDS && fieldsSchema ? (_jsx(ApprovalArgumentFields, { schema: fieldsSchema, initialValue: fieldsSeed, disabled: isProcessing || isExpired, invalidJsonMessage: tComponent(CT, "argumentValueNotValidJson"), onChange: handleFieldsChange })) : (_jsxs(_Fragment, { children: [_jsx(TextareaRoot, { rows: Math.min(12, Object.keys(executionContext).length + 3), value: draft, onChange: (e) => setDraft(e.target.value), className: "font-mono text-2xs", disabled: isProcessing || isExpired, "aria-invalid": parsedDraft.invalid || undefined, "aria-label": tComponent(CT, "editArguments") }), parsedDraft.invalid && (_jsx("span", { className: "text-2xs text-destructive", children: tComponent(CT, "argumentsNotValidJson") }))] }))] })), _jsx(AI_ApprovalActions, { approvalId: approvalId, riskLevel: riskLevel, onApprove: onApprove, onDeny: onDeny, onEscalate: onEscalate, isProcessing: isProcessing,
|
|
108
|
+
: JSON.stringify(value) })] }, key))) }) })) : editorMode === ApprovalArgumentEditorMode.FIELDS && fieldsSchema ? (_jsx(ApprovalArgumentFields, { schema: fieldsSchema, initialValue: fieldsSeed, disabled: isProcessing || isExpired, invalidJsonMessage: tComponent(CT, "argumentValueNotValidJson"), onChange: handleFieldsChange })) : (_jsxs(_Fragment, { children: [_jsx(TextareaRoot, { rows: Math.min(12, Object.keys(executionContext).length + 3), value: draft, onChange: (e) => setDraft(e.target.value), className: "font-mono text-2xs", disabled: isProcessing || isExpired, "aria-invalid": parsedDraft.invalid || undefined, "aria-label": tComponent(CT, "editArguments") }), parsedDraft.invalid && (_jsx("span", { className: "text-2xs text-destructive", children: tComponent(CT, "argumentsNotValidJson") }))] }))] })), !answerable ? (actionNotice !== undefined && _jsx("span", { role: "status", className: "text-2xs text-muted-foreground", children: actionNotice })) : (_jsx(AI_ApprovalActions, { approvalId: approvalId, riskLevel: riskLevel, onApprove: onApprove, onDeny: onDeny, onEscalate: onEscalate, onClaim: onClaim, onUnclaim: onUnclaim, onReassignOpen: onReassignOpen, reassignCandidates: reassignCandidates, onReassign: onReassign, actionNotice: actionNotice, onPauseClock: onPauseClock, onResumeClock: onResumeClock, pauseStateOptions: pauseStateOptions, reasonCodeOptions: reasonCodeOptions, isProcessing: isProcessing,
|
|
109
109
|
// Approving with unparseable text would send nothing and silently run the model's own
|
|
110
110
|
// arguments — a change collected and dropped, which is the one outcome this feature exists
|
|
111
111
|
// to prevent. The button is unavailable until the draft is an object.
|
|
@@ -118,17 +118,65 @@ export const AI_ApprovalRequest = ({ approvalId, actionDescription, riskLevel, e
|
|
|
118
118
|
? fieldsEdit.value
|
|
119
119
|
: editorMode === ApprovalArgumentEditorMode.JSON
|
|
120
120
|
? parsedDraft.value
|
|
121
|
-
: undefined })] }));
|
|
121
|
+
: undefined }))] }));
|
|
122
122
|
};
|
|
123
|
-
export const AI_ApprovalActions = ({ approvalId, riskLevel, modifiedToolArgs, onApprove, onDeny, onEscalate, isProcessing, disabled, className, ...props }) => {
|
|
123
|
+
export const AI_ApprovalActions = ({ approvalId, riskLevel, modifiedToolArgs, reasonCodeOptions, onApprove, onDeny, onEscalate, onClaim, onUnclaim, onReassignOpen, reassignCandidates, onReassign, actionNotice, onPauseClock, onResumeClock, pauseStateOptions, isProcessing, disabled, className, ...props }) => {
|
|
124
124
|
const { tComponent, isReady } = useI18n({ component: CT });
|
|
125
125
|
const [comment, setComment] = React.useState("");
|
|
126
|
+
/*
|
|
127
|
+
* #1921 — the reason an approver gives for a CORRECTION. `undefined` until one is chosen, and optional throughout.
|
|
128
|
+
*
|
|
129
|
+
* Offered only on the two answers that correct the agent: an EDITED approval (the editor is open, so
|
|
130
|
+
* `modifiedToolArgs` is defined) and a rejection. Approving the call as proposed is agreement, so a reason there would
|
|
131
|
+
* enter the record as the reason for a correction that never happened — it is never sent then, even if one was
|
|
132
|
+
* picked while the editor was open. A rejection needs somewhere to choose BEFORE it is sent, so with reasons on offer
|
|
133
|
+
* Reject opens a picker and a confirm button, the pattern Reassign and Pause already use.
|
|
134
|
+
*/
|
|
135
|
+
const [reasonCode, setReasonCode] = React.useState(undefined);
|
|
136
|
+
const [rejecting, setRejecting] = React.useState(false);
|
|
137
|
+
const offersReasons = (reasonCodeOptions?.length ?? 0) > 0;
|
|
138
|
+
const isModifying = modifiedToolArgs !== undefined;
|
|
139
|
+
// The reason rides as a TRAILING argument only when there is one, so an answer with no reason is called exactly as it
|
|
140
|
+
// was before reasons existed — `(id, comment, args)` — and a consumer written against that shape sees no change.
|
|
141
|
+
const correctionReason = reasonCode !== undefined ? [reasonCode] : [];
|
|
142
|
+
const approvalReason = isModifying ? correctionReason : [];
|
|
143
|
+
// #1628 — `null` while the pause picker is closed; the chosen reason once one is picked.
|
|
144
|
+
const [pausing, setPausing] = React.useState(null);
|
|
145
|
+
const canPause = !!onPauseClock && (pauseStateOptions?.length ?? 0) > 0;
|
|
146
|
+
// `null` while the picker is closed; the chosen person's id once one is picked.
|
|
147
|
+
const [reassigning, setReassigning] = React.useState(null);
|
|
126
148
|
const isHighRisk = riskLevel === "high" || riskLevel === "critical";
|
|
127
149
|
const actionsDisabled = isProcessing || disabled;
|
|
128
150
|
if (!isReady)
|
|
129
151
|
return null;
|
|
130
|
-
const approveButton = (_jsx(Button, { type: "button", variant: ButtonVariants_Variant.DEFAULT, size: ButtonSize.SM, disabled: actionsDisabled, onClick: isHighRisk ? undefined : () => onApprove?.(approvalId, comment || undefined, modifiedToolArgs), children: isProcessing ? tComponent(CT, "processing") : tComponent(CT, "approve") }));
|
|
131
|
-
return (_jsxs("div", { className: cn("flex flex-col gap-2", className), ...props, children: [_jsx(TextareaRoot, { rows: 2, value: comment, onChange: (e) => setComment(e.target.value), placeholder: tComponent(CT, "commentPlaceholder"), className: "text-xs", disabled: actionsDisabled }), _jsxs("div", { className: "flex items-center gap-element", children: [isHighRisk ? (_jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { asChild: true, children: approveButton }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: tComponent(CT, "confirmTitle") }), _jsx(AlertDialogDescription, { children: tComponent(CT, "confirmDescription") })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: tComponent(CT, "confirmCancel") }), _jsx(AlertDialogAction, { onClick: () => onApprove?.(approvalId, comment || undefined, modifiedToolArgs), children: tComponent(CT, "confirmProceed") })] })] })] })) : (approveButton), _jsx(Button, { type: "button", variant: ButtonVariants_Variant.OUTLINE, size: ButtonSize.SM, disabled: actionsDisabled,
|
|
152
|
+
const approveButton = (_jsx(Button, { type: "button", variant: ButtonVariants_Variant.DEFAULT, size: ButtonSize.SM, disabled: actionsDisabled, onClick: isHighRisk ? undefined : () => onApprove?.(approvalId, comment || undefined, modifiedToolArgs, ...approvalReason), children: isProcessing ? tComponent(CT, "processing") : tComponent(CT, "approve") }));
|
|
153
|
+
return (_jsxs("div", { className: cn("flex flex-col gap-2", className), ...props, children: [_jsx(TextareaRoot, { rows: 2, value: comment, onChange: (e) => setComment(e.target.value), placeholder: tComponent(CT, "commentPlaceholder"), className: "text-xs", disabled: actionsDisabled }), _jsxs("div", { className: "flex items-center gap-element", children: [isHighRisk ? (_jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { asChild: true, children: approveButton }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: tComponent(CT, "confirmTitle") }), _jsx(AlertDialogDescription, { children: tComponent(CT, "confirmDescription") })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: tComponent(CT, "confirmCancel") }), _jsx(AlertDialogAction, { onClick: () => onApprove?.(approvalId, comment || undefined, modifiedToolArgs, ...approvalReason), children: tComponent(CT, "confirmProceed") })] })] })] })) : (approveButton), _jsx(Button, { type: "button", variant: ButtonVariants_Variant.OUTLINE, size: ButtonSize.SM, disabled: actionsDisabled, "aria-expanded": offersReasons ? rejecting : undefined, onClick: () => {
|
|
154
|
+
if (!offersReasons) {
|
|
155
|
+
onDeny?.(approvalId, comment || undefined);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
setRejecting(!rejecting);
|
|
159
|
+
}, children: tComponent(CT, "deny") }), onEscalate && (_jsx(Button, { type: "button", variant: ButtonVariants_Variant.SECONDARY, size: ButtonSize.SM, disabled: actionsDisabled, onClick: () => onEscalate?.(approvalId, comment || undefined), children: tComponent(CT, "escalate") })), onClaim && (_jsx(Button, { type: "button", variant: ButtonVariants_Variant.GHOST, size: ButtonSize.SM, disabled: isProcessing, onClick: () => onClaim(approvalId), children: tComponent(CT, "claim") })), onUnclaim && (_jsx(Button, { type: "button", variant: ButtonVariants_Variant.GHOST, size: ButtonSize.SM, disabled: isProcessing, onClick: () => onUnclaim(approvalId), children: tComponent(CT, "unclaim") })), canPause && (_jsx(Button, { type: "button", variant: ButtonVariants_Variant.GHOST, size: ButtonSize.SM, disabled: isProcessing, "aria-expanded": pausing !== null, onClick: () => setPausing(pausing !== null ? null : { state: undefined }), children: tComponent(CT, "pauseClock") })), onResumeClock && (_jsx(Button, { type: "button", variant: ButtonVariants_Variant.GHOST, size: ButtonSize.SM, disabled: isProcessing, onClick: () => onResumeClock(approvalId), children: tComponent(CT, "resumeClock") })), onReassign && (_jsx(Button, { type: "button", variant: ButtonVariants_Variant.GHOST, size: ButtonSize.SM, disabled: isProcessing, "aria-expanded": reassigning !== null, onClick: () => {
|
|
160
|
+
if (reassigning !== null) {
|
|
161
|
+
setReassigning(null);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
setReassigning({ target: undefined });
|
|
165
|
+
onReassignOpen?.(approvalId);
|
|
166
|
+
}, children: tComponent(CT, "reassign") }))] }), offersReasons && (isModifying || rejecting) && (_jsxs("div", { className: "flex items-center gap-element", children: [_jsxs(SelectRoot, { value: reasonCode ?? "", onValueChange: (value) => setReasonCode(value || undefined), disabled: actionsDisabled, children: [_jsx(SelectTrigger, { className: "text-2xs", "aria-label": tComponent(CT, "reasonCode"), children: _jsx(SelectValue, { placeholder: tComponent(CT, "reasonCode") }) }), _jsx(SelectContent, { children: (reasonCodeOptions ?? []).map((option) => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value))) })] }), reasonCode !== undefined && (_jsx(Button, { type: "button", variant: ButtonVariants_Variant.GHOST, size: ButtonSize.SM, disabled: actionsDisabled, onClick: () => setReasonCode(undefined), children: tComponent(CT, "reasonCodeClear") })), rejecting && (_jsx(Button, { type: "button", variant: ButtonVariants_Variant.DESTRUCTIVE, size: ButtonSize.SM, disabled: actionsDisabled, onClick: () => {
|
|
167
|
+
onDeny?.(approvalId, comment || undefined, ...correctionReason);
|
|
168
|
+
setRejecting(false);
|
|
169
|
+
}, children: tComponent(CT, "denyConfirm") }))] })), onReassign && reassigning !== null && (_jsx("div", { className: "flex items-center gap-element", children: reassignCandidates === undefined ? (_jsx("span", { className: "text-2xs text-muted-foreground", children: tComponent(CT, "processing") })) : reassignCandidates.length === 0 ? (_jsx("span", { className: "text-2xs text-muted-foreground", children: tComponent(CT, "reassignNoCandidates") })) : (_jsxs(_Fragment, { children: [_jsxs(SelectRoot, { value: reassigning.target, onValueChange: (target) => setReassigning({ target }), disabled: isProcessing, children: [_jsx(SelectTrigger, { className: "text-2xs", "aria-label": tComponent(CT, "reassignTarget"), children: _jsx(SelectValue, { placeholder: tComponent(CT, "reassignTarget") }) }), _jsx(SelectContent, { children: reassignCandidates.map((candidate) => (_jsx(SelectItem, { value: candidate.value, children: candidate.label }, candidate.value))) })] }), _jsx(Button, { type: "button", variant: ButtonVariants_Variant.SECONDARY, size: ButtonSize.SM, disabled: isProcessing || reassigning.target === undefined, onClick: () => {
|
|
170
|
+
if (reassigning.target === undefined)
|
|
171
|
+
return;
|
|
172
|
+
onReassign(approvalId, reassigning.target, comment || undefined);
|
|
173
|
+
setReassigning(null);
|
|
174
|
+
}, children: tComponent(CT, "reassignConfirm") })] })) })), canPause && pausing !== null && (_jsxs("div", { className: "flex items-center gap-element", children: [_jsxs(SelectRoot, { value: pausing.state, onValueChange: (state) => setPausing({ state }), disabled: isProcessing, children: [_jsx(SelectTrigger, { className: "text-2xs", "aria-label": tComponent(CT, "pauseClockState"), children: _jsx(SelectValue, { placeholder: tComponent(CT, "pauseClockState") }) }), _jsx(SelectContent, { children: (pauseStateOptions ?? []).map((option) => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value))) })] }), _jsx(Button, { type: "button", variant: ButtonVariants_Variant.SECONDARY, size: ButtonSize.SM, disabled: isProcessing || pausing.state === undefined, onClick: () => {
|
|
175
|
+
if (pausing.state === undefined || !onPauseClock)
|
|
176
|
+
return;
|
|
177
|
+
onPauseClock(approvalId, pausing.state);
|
|
178
|
+
setPausing(null);
|
|
179
|
+
}, children: tComponent(CT, "pauseClockConfirm") })] })), actionNotice !== undefined && (_jsx("span", { role: "status", className: "text-2xs text-muted-foreground", children: actionNotice }))] }));
|
|
132
180
|
};
|
|
133
181
|
//===============================================================
|
|
134
182
|
// AI_ApprovalQueue
|
|
@@ -147,7 +195,7 @@ function useRelativeTimeFormatter() {
|
|
|
147
195
|
return tComponent(CT, "timeAgoHours", { count: String(hours) });
|
|
148
196
|
}, [tComponent]);
|
|
149
197
|
}
|
|
150
|
-
export const AI_ApprovalQueue = ({ items, onApprove, onDeny, onEscalate, processingIds, filter, onFilterChange, className, ...props }) => {
|
|
198
|
+
export const AI_ApprovalQueue = ({ items, onApprove, onDeny, onEscalate, onClaim, onUnclaim, onReassignOpen, onReassign, onPauseClock, onResumeClock, processingIds, filter, onFilterChange, className, ...props }) => {
|
|
151
199
|
const { tComponent, isReady } = useI18n({ component: CT });
|
|
152
200
|
const formatRelativeTime = useRelativeTimeFormatter();
|
|
153
201
|
const [sortByRisk, setSortByRisk] = React.useState(true);
|
|
@@ -168,6 +216,8 @@ export const AI_ApprovalQueue = ({ items, onApprove, onDeny, onEscalate, process
|
|
|
168
216
|
}, [items, activeFilter, sortByRisk]);
|
|
169
217
|
if (!isReady)
|
|
170
218
|
return null;
|
|
171
|
-
return (_jsxs("div", { className: cn("flex flex-col gap-card", className), ...props, children: [_jsxs("div", { className: "flex items-center justify-between gap-element", children: [_jsxs("div", { className: "flex items-center gap-element", children: [_jsx("h3", { className: "text-sm font-semibold", children: tComponent(CT, "queueTitle") }), _jsx(Badge, { variant: "secondary", children: items.length })] }), _jsx(Button, { type: "button", variant: sortByRisk ? ButtonVariants_Variant.SECONDARY : ButtonVariants_Variant.GHOST, size: ButtonSize.SM, className: "h-6 text-2xs", onClick: () => setSortByRisk(!sortByRisk), children: tComponent(CT, "queueSortRisk") })] }), items.length === 0 ? (_jsx("p", { className: "py-card text-center text-sm text-muted-foreground", children: tComponent(CT, "queueEmpty") })) : (_jsx(ScrollArea, { className: "max-h-96", children: _jsx("div", { className: "flex flex-col gap-card-sm", children: filtered.map((item) => (_jsxs("div", { className: "relative", children: [item.createdAt && (_jsx("span", { className: "absolute end-2 top-2 text-2xs text-muted-foreground", children: formatRelativeTime(item.createdAt) })), _jsx(AI_ApprovalRequest, { approvalId: item.approvalId, executionId: item.executionId, systemRef: item.systemRef, actionDescription: item.actionDescription, riskLevel: item.riskLevel, expiresAt: item.expiresAt, requiredRoles: item.requiredRoles, executionContext: item.executionContext,
|
|
219
|
+
return (_jsxs("div", { className: cn("flex flex-col gap-card", className), ...props, children: [_jsxs("div", { className: "flex items-center justify-between gap-element", children: [_jsxs("div", { className: "flex items-center gap-element", children: [_jsx("h3", { className: "text-sm font-semibold", children: tComponent(CT, "queueTitle") }), _jsx(Badge, { variant: "secondary", children: items.length })] }), _jsx(Button, { type: "button", variant: sortByRisk ? ButtonVariants_Variant.SECONDARY : ButtonVariants_Variant.GHOST, size: ButtonSize.SM, className: "h-6 text-2xs", onClick: () => setSortByRisk(!sortByRisk), children: tComponent(CT, "queueSortRisk") })] }), items.length === 0 ? (_jsx("p", { className: "py-card text-center text-sm text-muted-foreground", children: tComponent(CT, "queueEmpty") })) : (_jsx(ScrollArea, { className: "max-h-96", children: _jsx("div", { className: "flex flex-col gap-card-sm", children: filtered.map((item) => (_jsxs("div", { className: "relative", children: [item.createdAt && (_jsx("span", { className: "absolute end-2 top-2 text-2xs text-muted-foreground", children: formatRelativeTime(item.createdAt) })), _jsx(AI_ApprovalRequest, { approvalId: item.approvalId, executionId: item.executionId, systemRef: item.systemRef, actionDescription: item.actionDescription, riskLevel: item.riskLevel, expiresAt: item.expiresAt, requiredRoles: item.requiredRoles, executionContext: item.executionContext, toolName: item.toolName, createdAt: item.createdAt, allowArgumentModification: item.allowArgumentModification, argumentsSchema: item.argumentsSchema, reasonCodeOptions: item.reasonCodeOptions, onApprove: onApprove, onDeny: onDeny,
|
|
220
|
+
// Per item, not per queue: an item offers only the acts its person may perform.
|
|
221
|
+
onEscalate: item.canEscalate ? onEscalate : undefined, onClaim: item.canClaim ? onClaim : undefined, onUnclaim: item.canUnclaim ? onUnclaim : undefined, onReassignOpen: item.canReassign ? onReassignOpen : undefined, onReassign: item.canReassign ? onReassign : undefined, reassignCandidates: item.reassignCandidates, actionNotice: item.actionNotice, onPauseClock: item.canPauseClock ? onPauseClock : undefined, onResumeClock: item.canResumeClock ? onResumeClock : undefined, pauseStateOptions: item.pauseStateOptions, deadlineNotice: item.deadlineNotice, clockPausedNotice: item.clockPausedNotice, isProcessing: processingIds?.has(item.approvalId) })] }, item.approvalId))) }) }))] }));
|
|
172
222
|
};
|
|
173
223
|
//# sourceMappingURL=approval.js.map
|