@uipath/apollo-wind 2.87.0 → 2.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/connection-picker/components/connection-actions-menu.cjs +129 -0
- package/dist/components/ui/connection-picker/components/connection-actions-menu.d.ts +21 -0
- package/dist/components/ui/connection-picker/components/connection-actions-menu.js +95 -0
- package/dist/components/ui/connection-picker/components/connection-status.cjs +81 -0
- package/dist/components/ui/connection-picker/components/connection-status.d.ts +22 -0
- package/dist/components/ui/connection-picker/components/connection-status.js +41 -0
- package/dist/components/ui/connection-picker/connection-picker.cjs +411 -0
- package/dist/components/ui/connection-picker/connection-picker.d.ts +12 -0
- package/dist/components/ui/connection-picker/connection-picker.js +374 -0
- package/dist/components/ui/connection-picker/index.cjs +39 -0
- package/dist/components/ui/connection-picker/index.d.ts +2 -0
- package/dist/components/ui/connection-picker/index.js +2 -0
- package/dist/components/ui/connection-picker/types.cjs +18 -0
- package/dist/components/ui/connection-picker/types.d.ts +124 -0
- package/dist/components/ui/connection-picker/types.js +0 -0
- package/dist/components/ui/field-actions/ai-assist-action.cjs +32 -8
- package/dist/components/ui/field-actions/ai-assist-action.d.ts +25 -2
- package/dist/components/ui/field-actions/ai-assist-action.js +33 -9
- package/dist/components/ui/field-actions/collapse.cjs +7 -3
- package/dist/components/ui/field-actions/collapse.d.ts +2 -0
- package/dist/components/ui/field-actions/collapse.js +3 -2
- package/dist/components/ui/field-actions/insert-variable-action.d.ts +4 -1
- package/dist/components/ui/folder-picker/folder-picker.cjs +4 -3
- package/dist/components/ui/folder-picker/folder-picker.js +4 -3
- package/dist/components/ui/index.cjs +254 -228
- package/dist/components/ui/index.d.ts +3 -1
- package/dist/components/ui/index.js +2 -0
- package/dist/components/ui/input-group.cjs +57 -5
- package/dist/components/ui/input-group.d.ts +2 -0
- package/dist/components/ui/input-group.js +58 -6
- package/dist/components/ui/{folder-picker/components/folder-picker-empty-state.cjs → picker-empty-state.cjs} +11 -11
- package/dist/components/ui/picker-empty-state.d.ts +33 -0
- package/dist/components/ui/{folder-picker/components/folder-picker-empty-state.js → picker-empty-state.js} +9 -9
- package/dist/components/ui/prompt-editor/components/TokenPill.cjs +1 -1
- package/dist/components/ui/prompt-editor/components/TokenPill.js +1 -1
- package/dist/components/ui/prompt-editor/types.d.ts +6 -0
- package/dist/components/ui/reference-chip-colors.cjs +6 -0
- package/dist/components/ui/reference-chip-colors.d.ts +14 -0
- package/dist/components/ui/reference-chip-colors.js +6 -0
- package/dist/components/ui/reference-chip.cjs +6 -7
- package/dist/components/ui/reference-chip.d.ts +3 -0
- package/dist/components/ui/reference-chip.js +6 -7
- package/dist/components/ui/resource-picker/command-value.cjs +48 -0
- package/dist/components/ui/resource-picker/command-value.d.ts +11 -0
- package/dist/components/ui/resource-picker/command-value.js +11 -0
- package/dist/components/ui/resource-picker/components/resource-group-header.cjs +102 -0
- package/dist/components/ui/resource-picker/components/resource-group-header.d.ts +44 -0
- package/dist/components/ui/resource-picker/components/resource-group-header.js +65 -0
- package/dist/components/ui/resource-picker/components/resource-picker-footer.cjs +55 -0
- package/dist/components/ui/resource-picker/components/resource-picker-footer.d.ts +14 -0
- package/dist/components/ui/resource-picker/components/resource-picker-footer.js +21 -0
- package/dist/components/ui/resource-picker/components/resource-row-actions-menu.cjs +136 -0
- package/dist/components/ui/resource-picker/components/resource-row-actions-menu.d.ts +30 -0
- package/dist/components/ui/resource-picker/components/resource-row-actions-menu.js +102 -0
- package/dist/components/ui/resource-picker/components/resource-row.cjs +115 -0
- package/dist/components/ui/resource-picker/components/resource-row.d.ts +16 -0
- package/dist/components/ui/resource-picker/components/resource-row.js +81 -0
- package/dist/components/ui/resource-picker/focus.cjs +66 -0
- package/dist/components/ui/resource-picker/focus.d.ts +1 -0
- package/dist/components/ui/resource-picker/focus.js +32 -0
- package/dist/components/ui/resource-picker/index.cjs +42 -0
- package/dist/components/ui/resource-picker/index.d.ts +2 -0
- package/dist/components/ui/resource-picker/index.js +2 -0
- package/dist/components/ui/resource-picker/resource-picker.cjs +606 -0
- package/dist/components/ui/resource-picker/resource-picker.d.ts +40 -0
- package/dist/components/ui/resource-picker/resource-picker.js +566 -0
- package/dist/components/ui/resource-picker/types.cjs +50 -0
- package/dist/components/ui/resource-picker/types.d.ts +209 -0
- package/dist/components/ui/resource-picker/types.js +16 -0
- package/dist/components/ui/variable-picker/variable-picker.cjs +1 -1
- package/dist/components/ui/variable-picker/variable-picker.d.ts +2 -1
- package/dist/components/ui/variable-picker/variable-picker.js +1 -1
- package/dist/components/ui/variable-value-control.d.ts +5 -2
- package/dist/index.cjs +24 -7
- package/dist/index.d.ts +5 -1
- package/dist/index.js +3 -1
- package/dist/styles.css +179 -39
- package/package.json +1 -1
- package/dist/components/ui/folder-picker/components/folder-picker-empty-state.d.ts +0 -26
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cmdk trims every item value, so two distinct consumer ids such as `a` and
|
|
3
|
+
* ` a ` would meet as one, and an id with outer whitespace would no longer
|
|
4
|
+
* match itself when read back from the DOM. Every value the picker hands
|
|
5
|
+
* cmdk is therefore encoded losslessly, as a JSON string literal, whose
|
|
6
|
+
* quotes keep any whitespace inside them, and decoded wherever a cmdk or DOM
|
|
7
|
+
* value is matched against an id.
|
|
8
|
+
*/
|
|
9
|
+
export declare const toCommandValue: (value: string) => string;
|
|
10
|
+
/** The id a cmdk value encodes. `''` for no value, or one the picker did not encode. */
|
|
11
|
+
export declare const fromCommandValue: (value: string | null | undefined) => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const toCommandValue = (value)=>JSON.stringify(value);
|
|
2
|
+
const fromCommandValue = (value)=>{
|
|
3
|
+
if (!value) return '';
|
|
4
|
+
try {
|
|
5
|
+
const decoded = JSON.parse(value);
|
|
6
|
+
return 'string' == typeof decoded ? decoded : '';
|
|
7
|
+
} catch {
|
|
8
|
+
return '';
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export { fromCommandValue, toCommandValue };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ResourceGroupHeader: ()=>ResourceGroupHeader,
|
|
28
|
+
ResourceGroupHeadingOption: ()=>ResourceGroupHeadingOption
|
|
29
|
+
});
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
32
|
+
const external_command_cjs_namespaceObject = require("../../command.cjs");
|
|
33
|
+
const index_cjs_namespaceObject = require("../../../../lib/index.cjs");
|
|
34
|
+
const external_command_value_cjs_namespaceObject = require("../command-value.cjs");
|
|
35
|
+
function GroupHeading({ label, labelId, count, collapsed, showCount, icon }) {
|
|
36
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
37
|
+
children: [
|
|
38
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
39
|
+
"aria-hidden": true,
|
|
40
|
+
className: "grid size-4 shrink-0 place-items-center",
|
|
41
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronRight, {
|
|
42
|
+
className: (0, index_cjs_namespaceObject.cn)('size-4 text-foreground-subtle transition-transform', !collapsed && 'rotate-90')
|
|
43
|
+
})
|
|
44
|
+
}),
|
|
45
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
46
|
+
"aria-hidden": true,
|
|
47
|
+
className: "grid size-4 shrink-0 place-items-center text-foreground-muted [&_svg]:size-4",
|
|
48
|
+
children: icon ?? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Folder, {
|
|
49
|
+
className: "size-4"
|
|
50
|
+
})
|
|
51
|
+
}),
|
|
52
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
53
|
+
id: labelId,
|
|
54
|
+
className: "min-w-0 flex-1 truncate",
|
|
55
|
+
children: label
|
|
56
|
+
}),
|
|
57
|
+
showCount && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
58
|
+
"aria-hidden": true,
|
|
59
|
+
className: "shrink-0 text-xs font-medium text-foreground-subtle",
|
|
60
|
+
children: count
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const keepSearchFocus = {
|
|
66
|
+
onPointerDown: (event)=>event.preventDefault(),
|
|
67
|
+
onMouseDown: (event)=>event.preventDefault()
|
|
68
|
+
};
|
|
69
|
+
const headingClassName = 'flex w-full items-center gap-2 py-1.5 pl-3 pr-3 text-left text-sm font-medium text-foreground-muted';
|
|
70
|
+
function ResourceGroupHeader({ disabled = false, onToggle, ...heading }) {
|
|
71
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
72
|
+
"data-slot": "resource-group-header",
|
|
73
|
+
className: (0, index_cjs_namespaceObject.cn)(headingClassName, disabled ? 'cursor-default' : 'cursor-pointer hover:bg-surface-overlay'),
|
|
74
|
+
onClick: disabled ? void 0 : onToggle,
|
|
75
|
+
...keepSearchFocus,
|
|
76
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(GroupHeading, {
|
|
77
|
+
...heading
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function ResourceGroupHeadingOption({ value, ariaLabel, onToggle, ...heading }) {
|
|
82
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_command_cjs_namespaceObject.CommandItem, {
|
|
83
|
+
value: (0, external_command_value_cjs_namespaceObject.toCommandValue)(value),
|
|
84
|
+
"aria-label": ariaLabel,
|
|
85
|
+
"data-slot": heading.collapsed ? 'resource-group-collapsed' : 'resource-group-heading-option',
|
|
86
|
+
onSelect: onToggle,
|
|
87
|
+
...keepSearchFocus,
|
|
88
|
+
className: (0, index_cjs_namespaceObject.cn)(headingClassName, 'cursor-pointer rounded-none data-[selected=true]:bg-surface-overlay'),
|
|
89
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(GroupHeading, {
|
|
90
|
+
...heading
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
exports.ResourceGroupHeader = __webpack_exports__.ResourceGroupHeader;
|
|
95
|
+
exports.ResourceGroupHeadingOption = __webpack_exports__.ResourceGroupHeadingOption;
|
|
96
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
97
|
+
"ResourceGroupHeader",
|
|
98
|
+
"ResourceGroupHeadingOption"
|
|
99
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
100
|
+
Object.defineProperty(exports, '__esModule', {
|
|
101
|
+
value: true
|
|
102
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
interface GroupHeadingProps {
|
|
3
|
+
label: string;
|
|
4
|
+
/** Id for the label, which names the group the heading heads. */
|
|
5
|
+
labelId: string;
|
|
6
|
+
/** The group's row count, already formatted for the picker's locale. */
|
|
7
|
+
count: string;
|
|
8
|
+
collapsed: boolean;
|
|
9
|
+
showCount: boolean;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export interface ResourceGroupHeaderProps extends GroupHeadingProps {
|
|
13
|
+
/** Set while a search force-expands every group, so the toggle is inert. */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
onToggle: () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The heading over an open group: the label that names its `role="group"`.
|
|
19
|
+
*
|
|
20
|
+
* Not a control. The listbox may hold only options and groups, so nothing
|
|
21
|
+
* interactive sits in it. A click anywhere on the heading collapses the group
|
|
22
|
+
* for the pointer; the keyboard does it with ArrowLeft from any of its rows,
|
|
23
|
+
* which the picker handles from the search.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ResourceGroupHeader({ disabled, onToggle, ...heading }: ResourceGroupHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export interface ResourceGroupHeadingOptionProps extends GroupHeadingProps {
|
|
27
|
+
/** The option's cmdk value, unique beside every row id. */
|
|
28
|
+
value: string;
|
|
29
|
+
/** Spoken name, which says whether the group is collapsed or open. */
|
|
30
|
+
ariaLabel: string;
|
|
31
|
+
onToggle: () => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A group's heading kept as an option, for when the group has no row the
|
|
35
|
+
* keyboard cursor can reach.
|
|
36
|
+
*
|
|
37
|
+
* Collapsed, its rows are unmounted; open with every row disabled, cmdk skips
|
|
38
|
+
* them all. Either way, without this the cursor could never reach the group
|
|
39
|
+
* to fold or unfold it. As an option it is a cursor stop that says the
|
|
40
|
+
* group's state, and Enter or a click toggles it, as ArrowRight opens and
|
|
41
|
+
* ArrowLeft folds it. It commits nothing.
|
|
42
|
+
*/
|
|
43
|
+
export declare function ResourceGroupHeadingOption({ value, ariaLabel, onToggle, ...heading }: ResourceGroupHeadingOptionProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronRight, Folder } from "lucide-react";
|
|
3
|
+
import { CommandItem } from "../../command.js";
|
|
4
|
+
import { cn } from "../../../../lib/index.js";
|
|
5
|
+
import { toCommandValue } from "../command-value.js";
|
|
6
|
+
function GroupHeading({ label, labelId, count, collapsed, showCount, icon }) {
|
|
7
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
8
|
+
children: [
|
|
9
|
+
/*#__PURE__*/ jsx("span", {
|
|
10
|
+
"aria-hidden": true,
|
|
11
|
+
className: "grid size-4 shrink-0 place-items-center",
|
|
12
|
+
children: /*#__PURE__*/ jsx(ChevronRight, {
|
|
13
|
+
className: cn('size-4 text-foreground-subtle transition-transform', !collapsed && 'rotate-90')
|
|
14
|
+
})
|
|
15
|
+
}),
|
|
16
|
+
/*#__PURE__*/ jsx("span", {
|
|
17
|
+
"aria-hidden": true,
|
|
18
|
+
className: "grid size-4 shrink-0 place-items-center text-foreground-muted [&_svg]:size-4",
|
|
19
|
+
children: icon ?? /*#__PURE__*/ jsx(Folder, {
|
|
20
|
+
className: "size-4"
|
|
21
|
+
})
|
|
22
|
+
}),
|
|
23
|
+
/*#__PURE__*/ jsx("span", {
|
|
24
|
+
id: labelId,
|
|
25
|
+
className: "min-w-0 flex-1 truncate",
|
|
26
|
+
children: label
|
|
27
|
+
}),
|
|
28
|
+
showCount && /*#__PURE__*/ jsx("span", {
|
|
29
|
+
"aria-hidden": true,
|
|
30
|
+
className: "shrink-0 text-xs font-medium text-foreground-subtle",
|
|
31
|
+
children: count
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const keepSearchFocus = {
|
|
37
|
+
onPointerDown: (event)=>event.preventDefault(),
|
|
38
|
+
onMouseDown: (event)=>event.preventDefault()
|
|
39
|
+
};
|
|
40
|
+
const headingClassName = 'flex w-full items-center gap-2 py-1.5 pl-3 pr-3 text-left text-sm font-medium text-foreground-muted';
|
|
41
|
+
function ResourceGroupHeader({ disabled = false, onToggle, ...heading }) {
|
|
42
|
+
return /*#__PURE__*/ jsx("div", {
|
|
43
|
+
"data-slot": "resource-group-header",
|
|
44
|
+
className: cn(headingClassName, disabled ? 'cursor-default' : 'cursor-pointer hover:bg-surface-overlay'),
|
|
45
|
+
onClick: disabled ? void 0 : onToggle,
|
|
46
|
+
...keepSearchFocus,
|
|
47
|
+
children: /*#__PURE__*/ jsx(GroupHeading, {
|
|
48
|
+
...heading
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function ResourceGroupHeadingOption({ value, ariaLabel, onToggle, ...heading }) {
|
|
53
|
+
return /*#__PURE__*/ jsx(CommandItem, {
|
|
54
|
+
value: toCommandValue(value),
|
|
55
|
+
"aria-label": ariaLabel,
|
|
56
|
+
"data-slot": heading.collapsed ? 'resource-group-collapsed' : 'resource-group-heading-option',
|
|
57
|
+
onSelect: onToggle,
|
|
58
|
+
...keepSearchFocus,
|
|
59
|
+
className: cn(headingClassName, 'cursor-pointer rounded-none data-[selected=true]:bg-surface-overlay'),
|
|
60
|
+
children: /*#__PURE__*/ jsx(GroupHeading, {
|
|
61
|
+
...heading
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export { ResourceGroupHeader, ResourceGroupHeadingOption };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ResourcePickerFooter: ()=>ResourcePickerFooter
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
function ResourcePickerFooter({ leading, trailing }) {
|
|
31
|
+
if (!leading && !trailing) return null;
|
|
32
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
33
|
+
className: "flex shrink-0 items-center justify-between gap-2 border-t border-border bg-popover px-3 py-2",
|
|
34
|
+
onKeyDown: (event)=>{
|
|
35
|
+
if ('Escape' !== event.key && 'Tab' !== event.key) event.stopPropagation();
|
|
36
|
+
},
|
|
37
|
+
children: [
|
|
38
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
39
|
+
className: "flex min-w-0 items-center gap-1",
|
|
40
|
+
children: leading
|
|
41
|
+
}),
|
|
42
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
43
|
+
className: "flex shrink-0 items-center gap-1",
|
|
44
|
+
children: trailing
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
exports.ResourcePickerFooter = __webpack_exports__.ResourcePickerFooter;
|
|
50
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
51
|
+
"ResourcePickerFooter"
|
|
52
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
53
|
+
Object.defineProperty(exports, '__esModule', {
|
|
54
|
+
value: true
|
|
55
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface ResourcePickerFooterProps {
|
|
3
|
+
leading?: ReactNode;
|
|
4
|
+
trailing?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The link row that ends the list.
|
|
8
|
+
*
|
|
9
|
+
* Two slots rather than a Cancel and Select pair: rows commit on click, so
|
|
10
|
+
* there is nothing left to confirm, and the space belongs instead to the ways
|
|
11
|
+
* out of the picker. Renders nothing when neither slot is filled, so a picker
|
|
12
|
+
* with no links does not end in an empty rule.
|
|
13
|
+
*/
|
|
14
|
+
export declare function ResourcePickerFooter({ leading, trailing }: ResourcePickerFooterProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
function ResourcePickerFooter({ leading, trailing }) {
|
|
3
|
+
if (!leading && !trailing) return null;
|
|
4
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
5
|
+
className: "flex shrink-0 items-center justify-between gap-2 border-t border-border bg-popover px-3 py-2",
|
|
6
|
+
onKeyDown: (event)=>{
|
|
7
|
+
if ('Escape' !== event.key && 'Tab' !== event.key) event.stopPropagation();
|
|
8
|
+
},
|
|
9
|
+
children: [
|
|
10
|
+
/*#__PURE__*/ jsx("div", {
|
|
11
|
+
className: "flex min-w-0 items-center gap-1",
|
|
12
|
+
children: leading
|
|
13
|
+
}),
|
|
14
|
+
/*#__PURE__*/ jsx("div", {
|
|
15
|
+
className: "flex shrink-0 items-center gap-1",
|
|
16
|
+
children: trailing
|
|
17
|
+
})
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export { ResourcePickerFooter };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ResourceRowActionsMenu: ()=>ResourceRowActionsMenu
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_react_namespaceObject = require("react");
|
|
31
|
+
const external_popover_cjs_namespaceObject = require("../../popover.cjs");
|
|
32
|
+
const index_cjs_namespaceObject = require("../../../../lib/index.cjs");
|
|
33
|
+
function ResourceRowActionsMenu({ anchor, label, actions, onClose, onTabOut }) {
|
|
34
|
+
const virtualRef = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
35
|
+
current: anchor
|
|
36
|
+
}), [
|
|
37
|
+
anchor
|
|
38
|
+
]);
|
|
39
|
+
const itemsRef = (0, external_react_namespaceObject.useRef)([]);
|
|
40
|
+
const escaped = (0, external_react_namespaceObject.useRef)(false);
|
|
41
|
+
const contentRef = (0, external_react_namespaceObject.useRef)(null);
|
|
42
|
+
const actionIds = actions.map((action)=>action.id).join('\n');
|
|
43
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
44
|
+
const content = contentRef.current;
|
|
45
|
+
if (!content) return;
|
|
46
|
+
const active = content.getRootNode().activeElement;
|
|
47
|
+
if (active && active !== content.ownerDocument.body) return;
|
|
48
|
+
itemsRef.current.find((item)=>null !== item)?.focus();
|
|
49
|
+
}, [
|
|
50
|
+
actionIds
|
|
51
|
+
]);
|
|
52
|
+
const focusItem = (index)=>{
|
|
53
|
+
const items = itemsRef.current.filter((item)=>null !== item);
|
|
54
|
+
if (0 === items.length) return;
|
|
55
|
+
items[(index + items.length) % items.length]?.focus();
|
|
56
|
+
};
|
|
57
|
+
const handleKeyDown = (event)=>{
|
|
58
|
+
event.stopPropagation();
|
|
59
|
+
const root = event.currentTarget.getRootNode();
|
|
60
|
+
const current = itemsRef.current.indexOf(root.activeElement);
|
|
61
|
+
if ('ArrowDown' === event.key) {
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
focusItem(current + 1);
|
|
64
|
+
} else if ('ArrowUp' === event.key) {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
focusItem(current - 1);
|
|
67
|
+
} else if ('Home' === event.key) {
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
focusItem(0);
|
|
70
|
+
} else if ('End' === event.key) {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
focusItem(-1);
|
|
73
|
+
} else if ('Tab' === event.key) {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
onTabOut(event.shiftKey);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_popover_cjs_namespaceObject.Popover, {
|
|
79
|
+
open: true,
|
|
80
|
+
onOpenChange: (open)=>{
|
|
81
|
+
if (!open) onClose(escaped.current);
|
|
82
|
+
},
|
|
83
|
+
children: [
|
|
84
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverAnchor, {
|
|
85
|
+
virtualRef: virtualRef
|
|
86
|
+
}),
|
|
87
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverContent, {
|
|
88
|
+
ref: contentRef,
|
|
89
|
+
role: "menu",
|
|
90
|
+
"aria-label": label,
|
|
91
|
+
"data-slot": "resource-row-actions-menu",
|
|
92
|
+
align: "end",
|
|
93
|
+
sideOffset: 2,
|
|
94
|
+
className: "w-auto min-w-36 p-1",
|
|
95
|
+
onOpenAutoFocus: (event)=>{
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
focusItem(0);
|
|
98
|
+
},
|
|
99
|
+
onCloseAutoFocus: (event)=>event.preventDefault(),
|
|
100
|
+
onEscapeKeyDown: ()=>{
|
|
101
|
+
escaped.current = true;
|
|
102
|
+
},
|
|
103
|
+
onKeyDown: handleKeyDown,
|
|
104
|
+
children: actions.map((action, index)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
|
|
105
|
+
ref: (node)=>{
|
|
106
|
+
itemsRef.current[index] = node;
|
|
107
|
+
},
|
|
108
|
+
type: "button",
|
|
109
|
+
role: "menuitem",
|
|
110
|
+
tabIndex: -1,
|
|
111
|
+
"aria-label": action.label,
|
|
112
|
+
className: (0, index_cjs_namespaceObject.cn)('flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none hover:bg-surface-hover focus-visible:bg-surface-hover', 'danger' === action.tone && 'text-error'),
|
|
113
|
+
onClick: ()=>{
|
|
114
|
+
onClose(true);
|
|
115
|
+
action.onSelect();
|
|
116
|
+
},
|
|
117
|
+
children: [
|
|
118
|
+
action.icon && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
119
|
+
"aria-hidden": true,
|
|
120
|
+
className: "grid size-4 shrink-0 place-items-center",
|
|
121
|
+
children: action.icon
|
|
122
|
+
}),
|
|
123
|
+
action.text ?? action.label
|
|
124
|
+
]
|
|
125
|
+
}, action.id))
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
exports.ResourceRowActionsMenu = __webpack_exports__.ResourceRowActionsMenu;
|
|
131
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
132
|
+
"ResourceRowActionsMenu"
|
|
133
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
134
|
+
Object.defineProperty(exports, '__esModule', {
|
|
135
|
+
value: true
|
|
136
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ResourceItemAction } from '../types';
|
|
2
|
+
export interface ResourceRowActionsMenuProps {
|
|
3
|
+
/** The row the menu opens beside. */
|
|
4
|
+
anchor: HTMLElement;
|
|
5
|
+
/** Accessible name of the menu, such as "Actions for Outlook Work". */
|
|
6
|
+
label: string;
|
|
7
|
+
actions: ResourceItemAction[];
|
|
8
|
+
/**
|
|
9
|
+
* Called once the menu closes. `restoreFocus` is true for Escape and for an
|
|
10
|
+
* action, and false when focus or a press went elsewhere, Tab included,
|
|
11
|
+
* which has already moved focus on.
|
|
12
|
+
*/
|
|
13
|
+
onClose: (restoreFocus: boolean) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Tab or Shift+Tab out of the menu. The picker moves focus on from the
|
|
16
|
+
* row: the menu is portalled to the end of the document, so the browser's
|
|
17
|
+
* own next stop would be nowhere near the row.
|
|
18
|
+
*/
|
|
19
|
+
onTabOut: (backwards: boolean) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The keyboard route to a row's actions, opened with Shift+Enter on the row
|
|
23
|
+
* under the cursor.
|
|
24
|
+
*
|
|
25
|
+
* A listbox option is atomic, so the actions a row shows are not controls of
|
|
26
|
+
* its own: nothing inside an option may take focus. This menu holds them as
|
|
27
|
+
* real menu items instead, outside the listbox, in a popover anchored to the
|
|
28
|
+
* row. Escape closes it and leaves the picker open.
|
|
29
|
+
*/
|
|
30
|
+
export declare function ResourceRowActionsMenu({ anchor, label, actions, onClose, onTabOut, }: ResourceRowActionsMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect, useMemo, useRef } from "react";
|
|
3
|
+
import { Popover, PopoverAnchor, PopoverContent } from "../../popover.js";
|
|
4
|
+
import { cn } from "../../../../lib/index.js";
|
|
5
|
+
function ResourceRowActionsMenu({ anchor, label, actions, onClose, onTabOut }) {
|
|
6
|
+
const virtualRef = useMemo(()=>({
|
|
7
|
+
current: anchor
|
|
8
|
+
}), [
|
|
9
|
+
anchor
|
|
10
|
+
]);
|
|
11
|
+
const itemsRef = useRef([]);
|
|
12
|
+
const escaped = useRef(false);
|
|
13
|
+
const contentRef = useRef(null);
|
|
14
|
+
const actionIds = actions.map((action)=>action.id).join('\n');
|
|
15
|
+
useLayoutEffect(()=>{
|
|
16
|
+
const content = contentRef.current;
|
|
17
|
+
if (!content) return;
|
|
18
|
+
const active = content.getRootNode().activeElement;
|
|
19
|
+
if (active && active !== content.ownerDocument.body) return;
|
|
20
|
+
itemsRef.current.find((item)=>null !== item)?.focus();
|
|
21
|
+
}, [
|
|
22
|
+
actionIds
|
|
23
|
+
]);
|
|
24
|
+
const focusItem = (index)=>{
|
|
25
|
+
const items = itemsRef.current.filter((item)=>null !== item);
|
|
26
|
+
if (0 === items.length) return;
|
|
27
|
+
items[(index + items.length) % items.length]?.focus();
|
|
28
|
+
};
|
|
29
|
+
const handleKeyDown = (event)=>{
|
|
30
|
+
event.stopPropagation();
|
|
31
|
+
const root = event.currentTarget.getRootNode();
|
|
32
|
+
const current = itemsRef.current.indexOf(root.activeElement);
|
|
33
|
+
if ('ArrowDown' === event.key) {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
focusItem(current + 1);
|
|
36
|
+
} else if ('ArrowUp' === event.key) {
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
focusItem(current - 1);
|
|
39
|
+
} else if ('Home' === event.key) {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
focusItem(0);
|
|
42
|
+
} else if ('End' === event.key) {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
focusItem(-1);
|
|
45
|
+
} else if ('Tab' === event.key) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
onTabOut(event.shiftKey);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
return /*#__PURE__*/ jsxs(Popover, {
|
|
51
|
+
open: true,
|
|
52
|
+
onOpenChange: (open)=>{
|
|
53
|
+
if (!open) onClose(escaped.current);
|
|
54
|
+
},
|
|
55
|
+
children: [
|
|
56
|
+
/*#__PURE__*/ jsx(PopoverAnchor, {
|
|
57
|
+
virtualRef: virtualRef
|
|
58
|
+
}),
|
|
59
|
+
/*#__PURE__*/ jsx(PopoverContent, {
|
|
60
|
+
ref: contentRef,
|
|
61
|
+
role: "menu",
|
|
62
|
+
"aria-label": label,
|
|
63
|
+
"data-slot": "resource-row-actions-menu",
|
|
64
|
+
align: "end",
|
|
65
|
+
sideOffset: 2,
|
|
66
|
+
className: "w-auto min-w-36 p-1",
|
|
67
|
+
onOpenAutoFocus: (event)=>{
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
focusItem(0);
|
|
70
|
+
},
|
|
71
|
+
onCloseAutoFocus: (event)=>event.preventDefault(),
|
|
72
|
+
onEscapeKeyDown: ()=>{
|
|
73
|
+
escaped.current = true;
|
|
74
|
+
},
|
|
75
|
+
onKeyDown: handleKeyDown,
|
|
76
|
+
children: actions.map((action, index)=>/*#__PURE__*/ jsxs("button", {
|
|
77
|
+
ref: (node)=>{
|
|
78
|
+
itemsRef.current[index] = node;
|
|
79
|
+
},
|
|
80
|
+
type: "button",
|
|
81
|
+
role: "menuitem",
|
|
82
|
+
tabIndex: -1,
|
|
83
|
+
"aria-label": action.label,
|
|
84
|
+
className: cn('flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none hover:bg-surface-hover focus-visible:bg-surface-hover', 'danger' === action.tone && 'text-error'),
|
|
85
|
+
onClick: ()=>{
|
|
86
|
+
onClose(true);
|
|
87
|
+
action.onSelect();
|
|
88
|
+
},
|
|
89
|
+
children: [
|
|
90
|
+
action.icon && /*#__PURE__*/ jsx("span", {
|
|
91
|
+
"aria-hidden": true,
|
|
92
|
+
className: "grid size-4 shrink-0 place-items-center",
|
|
93
|
+
children: action.icon
|
|
94
|
+
}),
|
|
95
|
+
action.text ?? action.label
|
|
96
|
+
]
|
|
97
|
+
}, action.id))
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
export { ResourceRowActionsMenu };
|