@uipath/apollo-wind 2.87.0 → 2.88.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/folder-picker/folder-picker.cjs +4 -3
- package/dist/components/ui/folder-picker/folder-picker.js +4 -3
- package/dist/components/ui/index.cjs +270 -244
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/index.js +2 -0
- 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/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/index.cjs +24 -7
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -1
- package/dist/styles.css +75 -29
- package/package.json +1 -1
- package/dist/components/ui/folder-picker/components/folder-picker-empty-state.d.ts +0 -26
|
@@ -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 };
|
|
@@ -0,0 +1,115 @@
|
|
|
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
|
+
ResourceRow: ()=>ResourceRow
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
31
|
+
const external_command_cjs_namespaceObject = require("../../command.cjs");
|
|
32
|
+
const index_cjs_namespaceObject = require("../../../../lib/index.cjs");
|
|
33
|
+
const external_command_value_cjs_namespaceObject = require("../command-value.cjs");
|
|
34
|
+
function ResourceRow({ item, chosen, onSelect, actions }) {
|
|
35
|
+
const hasActions = Boolean(actions && actions.length > 0);
|
|
36
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_command_cjs_namespaceObject.CommandItem, {
|
|
37
|
+
value: (0, external_command_value_cjs_namespaceObject.toCommandValue)(item.id),
|
|
38
|
+
"aria-label": [
|
|
39
|
+
item.label,
|
|
40
|
+
item.description,
|
|
41
|
+
item.subtitleText
|
|
42
|
+
].filter(Boolean).join(', '),
|
|
43
|
+
"aria-current": chosen ? 'true' : void 0,
|
|
44
|
+
"aria-keyshortcuts": hasActions ? 'Shift+Enter' : void 0,
|
|
45
|
+
disabled: item.disabled,
|
|
46
|
+
onSelect: onSelect,
|
|
47
|
+
className: (0, index_cjs_namespaceObject.cn)('group/row flex cursor-pointer items-center gap-2 rounded-none py-1.5 pl-3 pr-3 text-sm', chosen ? 'bg-brand-subtle font-medium data-[selected=true]:bg-brand-subtle' : 'data-[selected=true]:bg-surface-overlay data-[selected=true]:text-foreground'),
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
50
|
+
className: "grid size-4 shrink-0 place-items-center",
|
|
51
|
+
children: chosen && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Check, {
|
|
52
|
+
className: "size-4 text-foreground-accent",
|
|
53
|
+
strokeWidth: 3
|
|
54
|
+
})
|
|
55
|
+
}),
|
|
56
|
+
item.icon && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
57
|
+
className: "grid size-4 shrink-0 place-items-center text-foreground-muted",
|
|
58
|
+
children: item.icon
|
|
59
|
+
}),
|
|
60
|
+
item.subtitle ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
|
|
61
|
+
className: "flex min-w-0 flex-1 flex-col gap-0.5",
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(RowLabel, {
|
|
64
|
+
label: item.label,
|
|
65
|
+
chosen: chosen
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
68
|
+
className: "min-w-0 truncate text-xs font-normal",
|
|
69
|
+
children: item.subtitle
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(RowLabel, {
|
|
73
|
+
label: item.label,
|
|
74
|
+
chosen: chosen
|
|
75
|
+
}),
|
|
76
|
+
item.description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
77
|
+
className: "min-w-0 max-w-[45%] truncate text-xs text-foreground-subtle",
|
|
78
|
+
children: item.description
|
|
79
|
+
}),
|
|
80
|
+
hasActions && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
81
|
+
"aria-hidden": true,
|
|
82
|
+
"data-slot": "resource-row-actions",
|
|
83
|
+
className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/row:opacity-100 group-data-[selected=true]/row:opacity-100",
|
|
84
|
+
children: actions?.map((action)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
85
|
+
"data-slot": "resource-row-action",
|
|
86
|
+
title: action.label,
|
|
87
|
+
className: (0, index_cjs_namespaceObject.cn)('cursor-pointer rounded transition-colors hover:bg-surface-hover', action.icon ? 'grid size-6 place-items-center text-foreground-muted hover:text-foreground' : 'px-1.5 py-0.5 text-xs font-medium', 'danger' === action.tone && 'text-error hover:text-error'),
|
|
88
|
+
onClick: (event)=>{
|
|
89
|
+
event.stopPropagation();
|
|
90
|
+
action.onSelect();
|
|
91
|
+
},
|
|
92
|
+
onPointerDown: (event)=>{
|
|
93
|
+
event.stopPropagation();
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
},
|
|
96
|
+
onMouseDown: (event)=>event.preventDefault(),
|
|
97
|
+
children: action.icon ?? action.text ?? action.label
|
|
98
|
+
}, action.id))
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function RowLabel({ label, chosen }) {
|
|
104
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
105
|
+
className: (0, index_cjs_namespaceObject.cn)('min-w-0 flex-1 truncate', chosen ? 'text-foreground-accent' : 'text-foreground'),
|
|
106
|
+
children: label
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
exports.ResourceRow = __webpack_exports__.ResourceRow;
|
|
110
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
111
|
+
"ResourceRow"
|
|
112
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
113
|
+
Object.defineProperty(exports, '__esModule', {
|
|
114
|
+
value: true
|
|
115
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ResourceItem, ResourceItemAction } from '../types';
|
|
2
|
+
export interface ResourceRowProps {
|
|
3
|
+
item: ResourceItem;
|
|
4
|
+
chosen: boolean;
|
|
5
|
+
onSelect: () => void;
|
|
6
|
+
/** Pointer shortcuts at the trailing edge, revealed on the row under the cursor. */
|
|
7
|
+
actions?: ResourceItemAction[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* One selectable resource.
|
|
11
|
+
*
|
|
12
|
+
* The tick has a reserved column of its own rather than trailing the label,
|
|
13
|
+
* so it stays in one place as the rows above and below it change, and the
|
|
14
|
+
* chosen row carries the rest of the emphasis in its background.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ResourceRow({ item, chosen, onSelect, actions }: ResourceRowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Check } 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 ResourceRow({ item, chosen, onSelect, actions }) {
|
|
7
|
+
const hasActions = Boolean(actions && actions.length > 0);
|
|
8
|
+
return /*#__PURE__*/ jsxs(CommandItem, {
|
|
9
|
+
value: toCommandValue(item.id),
|
|
10
|
+
"aria-label": [
|
|
11
|
+
item.label,
|
|
12
|
+
item.description,
|
|
13
|
+
item.subtitleText
|
|
14
|
+
].filter(Boolean).join(', '),
|
|
15
|
+
"aria-current": chosen ? 'true' : void 0,
|
|
16
|
+
"aria-keyshortcuts": hasActions ? 'Shift+Enter' : void 0,
|
|
17
|
+
disabled: item.disabled,
|
|
18
|
+
onSelect: onSelect,
|
|
19
|
+
className: cn('group/row flex cursor-pointer items-center gap-2 rounded-none py-1.5 pl-3 pr-3 text-sm', chosen ? 'bg-brand-subtle font-medium data-[selected=true]:bg-brand-subtle' : 'data-[selected=true]:bg-surface-overlay data-[selected=true]:text-foreground'),
|
|
20
|
+
children: [
|
|
21
|
+
/*#__PURE__*/ jsx("span", {
|
|
22
|
+
className: "grid size-4 shrink-0 place-items-center",
|
|
23
|
+
children: chosen && /*#__PURE__*/ jsx(Check, {
|
|
24
|
+
className: "size-4 text-foreground-accent",
|
|
25
|
+
strokeWidth: 3
|
|
26
|
+
})
|
|
27
|
+
}),
|
|
28
|
+
item.icon && /*#__PURE__*/ jsx("span", {
|
|
29
|
+
className: "grid size-4 shrink-0 place-items-center text-foreground-muted",
|
|
30
|
+
children: item.icon
|
|
31
|
+
}),
|
|
32
|
+
item.subtitle ? /*#__PURE__*/ jsxs("span", {
|
|
33
|
+
className: "flex min-w-0 flex-1 flex-col gap-0.5",
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ jsx(RowLabel, {
|
|
36
|
+
label: item.label,
|
|
37
|
+
chosen: chosen
|
|
38
|
+
}),
|
|
39
|
+
/*#__PURE__*/ jsx("span", {
|
|
40
|
+
className: "min-w-0 truncate text-xs font-normal",
|
|
41
|
+
children: item.subtitle
|
|
42
|
+
})
|
|
43
|
+
]
|
|
44
|
+
}) : /*#__PURE__*/ jsx(RowLabel, {
|
|
45
|
+
label: item.label,
|
|
46
|
+
chosen: chosen
|
|
47
|
+
}),
|
|
48
|
+
item.description && /*#__PURE__*/ jsx("span", {
|
|
49
|
+
className: "min-w-0 max-w-[45%] truncate text-xs text-foreground-subtle",
|
|
50
|
+
children: item.description
|
|
51
|
+
}),
|
|
52
|
+
hasActions && /*#__PURE__*/ jsx("span", {
|
|
53
|
+
"aria-hidden": true,
|
|
54
|
+
"data-slot": "resource-row-actions",
|
|
55
|
+
className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/row:opacity-100 group-data-[selected=true]/row:opacity-100",
|
|
56
|
+
children: actions?.map((action)=>/*#__PURE__*/ jsx("span", {
|
|
57
|
+
"data-slot": "resource-row-action",
|
|
58
|
+
title: action.label,
|
|
59
|
+
className: cn('cursor-pointer rounded transition-colors hover:bg-surface-hover', action.icon ? 'grid size-6 place-items-center text-foreground-muted hover:text-foreground' : 'px-1.5 py-0.5 text-xs font-medium', 'danger' === action.tone && 'text-error hover:text-error'),
|
|
60
|
+
onClick: (event)=>{
|
|
61
|
+
event.stopPropagation();
|
|
62
|
+
action.onSelect();
|
|
63
|
+
},
|
|
64
|
+
onPointerDown: (event)=>{
|
|
65
|
+
event.stopPropagation();
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
},
|
|
68
|
+
onMouseDown: (event)=>event.preventDefault(),
|
|
69
|
+
children: action.icon ?? action.text ?? action.label
|
|
70
|
+
}, action.id))
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function RowLabel({ label, chosen }) {
|
|
76
|
+
return /*#__PURE__*/ jsx("span", {
|
|
77
|
+
className: cn('min-w-0 flex-1 truncate', chosen ? 'text-foreground-accent' : 'text-foreground'),
|
|
78
|
+
children: label
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export { ResourceRow };
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
focusBeside: ()=>focusBeside
|
|
28
|
+
});
|
|
29
|
+
const TABBABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), details > summary:first-of-type, [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';
|
|
30
|
+
const isTabStop = (element)=>{
|
|
31
|
+
if (element.hasAttribute('tabindex')) return element.tabIndex >= 0;
|
|
32
|
+
if (element.isContentEditable) return !element.parentElement?.isContentEditable;
|
|
33
|
+
return element.tabIndex >= 0;
|
|
34
|
+
};
|
|
35
|
+
function isShown(element) {
|
|
36
|
+
if (element.closest('[hidden], [inert]')) return false;
|
|
37
|
+
if ('function' == typeof element.checkVisibility) return element.checkVisibility({
|
|
38
|
+
checkOpacity: false,
|
|
39
|
+
checkVisibilityCSS: true
|
|
40
|
+
});
|
|
41
|
+
for(let node = element; node; node = node.parentElement){
|
|
42
|
+
const style = node.ownerDocument.defaultView?.getComputedStyle(node);
|
|
43
|
+
if (style?.display === 'none') return false;
|
|
44
|
+
if (node === element && style?.visibility === 'hidden') return false;
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
function focusBeside(from, backwards, scope) {
|
|
49
|
+
const root = scope ?? from.getRootNode();
|
|
50
|
+
const candidates = Array.from(root.querySelectorAll(TABBABLE)).filter((element)=>isTabStop(element) && !element.hasAttribute('data-radix-focus-guard') && !from.contains(element) && isShown(element));
|
|
51
|
+
const isAfter = (element)=>Boolean(from.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
52
|
+
const ordered = backwards ? candidates.filter((element)=>!isAfter(element)).reverse() : candidates.filter(isAfter);
|
|
53
|
+
for (const target of ordered){
|
|
54
|
+
target.focus();
|
|
55
|
+
const active = target.getRootNode().activeElement;
|
|
56
|
+
if (active === target) return true;
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
exports.focusBeside = __webpack_exports__.focusBeside;
|
|
61
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
62
|
+
"focusBeside"
|
|
63
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
64
|
+
Object.defineProperty(exports, '__esModule', {
|
|
65
|
+
value: true
|
|
66
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function focusBeside(from: Element, backwards: boolean, scope?: ParentNode): boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const TABBABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), details > summary:first-of-type, [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';
|
|
2
|
+
const isTabStop = (element)=>{
|
|
3
|
+
if (element.hasAttribute('tabindex')) return element.tabIndex >= 0;
|
|
4
|
+
if (element.isContentEditable) return !element.parentElement?.isContentEditable;
|
|
5
|
+
return element.tabIndex >= 0;
|
|
6
|
+
};
|
|
7
|
+
function isShown(element) {
|
|
8
|
+
if (element.closest('[hidden], [inert]')) return false;
|
|
9
|
+
if ('function' == typeof element.checkVisibility) return element.checkVisibility({
|
|
10
|
+
checkOpacity: false,
|
|
11
|
+
checkVisibilityCSS: true
|
|
12
|
+
});
|
|
13
|
+
for(let node = element; node; node = node.parentElement){
|
|
14
|
+
const style = node.ownerDocument.defaultView?.getComputedStyle(node);
|
|
15
|
+
if (style?.display === 'none') return false;
|
|
16
|
+
if (node === element && style?.visibility === 'hidden') return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
function focusBeside(from, backwards, scope) {
|
|
21
|
+
const root = scope ?? from.getRootNode();
|
|
22
|
+
const candidates = Array.from(root.querySelectorAll(TABBABLE)).filter((element)=>isTabStop(element) && !element.hasAttribute('data-radix-focus-guard') && !from.contains(element) && isShown(element));
|
|
23
|
+
const isAfter = (element)=>Boolean(from.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
24
|
+
const ordered = backwards ? candidates.filter((element)=>!isAfter(element)).reverse() : candidates.filter(isAfter);
|
|
25
|
+
for (const target of ordered){
|
|
26
|
+
target.focus();
|
|
27
|
+
const active = target.getRootNode().activeElement;
|
|
28
|
+
if (active === target) return true;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
export { focusBeside };
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
keepResourceSearchOnEscape: ()=>external_resource_picker_cjs_namespaceObject.keepResourceSearchOnEscape,
|
|
28
|
+
ResourcePicker: ()=>external_resource_picker_cjs_namespaceObject.ResourcePicker,
|
|
29
|
+
ResourcePickerContent: ()=>external_resource_picker_cjs_namespaceObject.ResourcePickerContent
|
|
30
|
+
});
|
|
31
|
+
const external_resource_picker_cjs_namespaceObject = require("./resource-picker.cjs");
|
|
32
|
+
exports.ResourcePicker = __webpack_exports__.ResourcePicker;
|
|
33
|
+
exports.ResourcePickerContent = __webpack_exports__.ResourcePickerContent;
|
|
34
|
+
exports.keepResourceSearchOnEscape = __webpack_exports__.keepResourceSearchOnEscape;
|
|
35
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
36
|
+
"ResourcePicker",
|
|
37
|
+
"ResourcePickerContent",
|
|
38
|
+
"keepResourceSearchOnEscape"
|
|
39
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
40
|
+
Object.defineProperty(exports, '__esModule', {
|
|
41
|
+
value: true
|
|
42
|
+
});
|