@adapttable/naive-ui 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +14 -0
  2. package/dist/assistant-Cv8df2ti.js +355 -0
  3. package/dist/assistant-Cv8df2ti.js.map +1 -0
  4. package/dist/assistant-D6mc-LJl.cjs +378 -0
  5. package/dist/assistant-D6mc-LJl.cjs.map +1 -0
  6. package/dist/assistant.cjs +5 -358
  7. package/dist/assistant.js +1 -354
  8. package/dist/column-menu-DdWVP1hz.d.cts +23 -0
  9. package/dist/column-menu-DdWVP1hz.d.cts.map +1 -0
  10. package/dist/column-menu-DdWVP1hz.d.ts +23 -0
  11. package/dist/column-menu-DdWVP1hz.d.ts.map +1 -0
  12. package/dist/column-menu.d.cts +2 -23
  13. package/dist/column-menu.d.ts +2 -23
  14. package/dist/command-palette-vIegnqVo.js +112 -0
  15. package/dist/command-palette-vIegnqVo.js.map +1 -0
  16. package/dist/command-palette-ztI3qI2V.cjs +117 -0
  17. package/dist/command-palette-ztI3qI2V.cjs.map +1 -0
  18. package/dist/command-palette.cjs +2 -112
  19. package/dist/command-palette.js +1 -111
  20. package/dist/context-menu-BbhrjTZr.cjs +145 -0
  21. package/dist/context-menu-BbhrjTZr.cjs.map +1 -0
  22. package/dist/context-menu-DjYIQXhY.js +140 -0
  23. package/dist/context-menu-DjYIQXhY.js.map +1 -0
  24. package/dist/context-menu.cjs +2 -140
  25. package/dist/context-menu.js +1 -139
  26. package/dist/features.cjs +217 -0
  27. package/dist/features.d.cts +40 -0
  28. package/dist/features.d.ts +40 -0
  29. package/dist/features.js +36 -0
  30. package/dist/filters-BJ48GzqJ.d.ts +66 -0
  31. package/dist/filters-BJ48GzqJ.d.ts.map +1 -0
  32. package/dist/filters-C6DvAZ_T.d.cts +66 -0
  33. package/dist/filters-C6DvAZ_T.d.cts.map +1 -0
  34. package/dist/filters.d.cts +2 -66
  35. package/dist/filters.d.ts +2 -66
  36. package/dist/grouping-panel-BPaPG49S.cjs +151 -0
  37. package/dist/grouping-panel-BPaPG49S.cjs.map +1 -0
  38. package/dist/grouping-panel-CYUPSa0u.js +146 -0
  39. package/dist/grouping-panel-CYUPSa0u.js.map +1 -0
  40. package/dist/grouping-panel.cjs +3 -146
  41. package/dist/grouping-panel.js +2 -145
  42. package/dist/header-filters-CQg6clum.d.cts +52 -0
  43. package/dist/header-filters-CQg6clum.d.cts.map +1 -0
  44. package/dist/header-filters-CQg6clum.d.ts +52 -0
  45. package/dist/header-filters-CQg6clum.d.ts.map +1 -0
  46. package/dist/header-filters.d.cts +2 -52
  47. package/dist/header-filters.d.ts +2 -52
  48. package/dist/index.cjs +1 -1
  49. package/dist/index.js +1 -1
  50. package/dist/{mobile-Bc3-31-b.cjs → mobile-C2JUs6b_.cjs} +3 -2
  51. package/dist/mobile-C2JUs6b_.cjs.map +1 -0
  52. package/dist/{mobile-Dlwq8dB7.js → mobile-CC3NeIRK.js} +4 -3
  53. package/dist/mobile-CC3NeIRK.js.map +1 -0
  54. package/dist/preset.cjs +5 -5
  55. package/dist/preset.js +5 -5
  56. package/dist/renderers.cjs +1 -1
  57. package/dist/renderers.d.cts.map +1 -1
  58. package/dist/renderers.d.ts.map +1 -1
  59. package/dist/renderers.js +1 -1
  60. package/dist/row-reorder-BNYYEL8w.js +186 -0
  61. package/dist/row-reorder-BNYYEL8w.js.map +1 -0
  62. package/dist/row-reorder-BRySq2FF.cjs +191 -0
  63. package/dist/row-reorder-BRySq2FF.cjs.map +1 -0
  64. package/dist/row-reorder.cjs +2 -185
  65. package/dist/row-reorder.js +1 -185
  66. package/dist/side-panel-Bf4zBlYZ.cjs +64 -0
  67. package/dist/side-panel-Bf4zBlYZ.cjs.map +1 -0
  68. package/dist/side-panel-CLTgXUnb.js +59 -0
  69. package/dist/side-panel-CLTgXUnb.js.map +1 -0
  70. package/dist/side-panel.cjs +2 -59
  71. package/dist/side-panel.js +1 -58
  72. package/dist/styles.css +39 -39
  73. package/package.json +14 -3
  74. package/dist/assistant.cjs.map +0 -1
  75. package/dist/assistant.js.map +0 -1
  76. package/dist/column-menu.d.cts.map +0 -1
  77. package/dist/column-menu.d.ts.map +0 -1
  78. package/dist/command-palette.cjs.map +0 -1
  79. package/dist/command-palette.js.map +0 -1
  80. package/dist/context-menu.cjs.map +0 -1
  81. package/dist/context-menu.js.map +0 -1
  82. package/dist/filters.d.cts.map +0 -1
  83. package/dist/filters.d.ts.map +0 -1
  84. package/dist/grouping-panel.cjs.map +0 -1
  85. package/dist/grouping-panel.js.map +0 -1
  86. package/dist/header-filters.d.cts.map +0 -1
  87. package/dist/header-filters.d.ts.map +0 -1
  88. package/dist/mobile-Bc3-31-b.cjs.map +0 -1
  89. package/dist/mobile-Dlwq8dB7.js.map +0 -1
  90. package/dist/row-reorder.cjs.map +0 -1
  91. package/dist/row-reorder.js.map +0 -1
  92. package/dist/side-panel.cjs.map +0 -1
  93. package/dist/side-panel.js.map +0 -1
@@ -1,359 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_button = require("./button-CaakTzYM.cjs");
3
- const require_input = require("./input-DPQy4L2b.cjs");
4
- const require_select = require("./select-C8UKnsWO.cjs");
5
- let _adapttable_vue_adapter = require("@adapttable/vue/adapter");
6
- let vue = require("vue");
7
- let naive_ui = require("naive-ui");
8
- //#region src/assistant/ExamplesMenu.ts
9
- /** One shortcut as a menu item: its icon, title and optional description. */
10
- function shortcut(item, choose) {
11
- return require_button.naiveButton({
12
- key: item.id,
13
- role: "menuitem",
14
- tabindex: -1,
15
- "data-adapttable-part": item.part,
16
- class: "adapttable-naive-assistant-shortcut",
17
- onClick: () => choose(item.id)
18
- }, [item.icon, (0, vue.h)("span", [(0, vue.h)("strong", item.title), item.description ? (0, vue.h)("small", item.description) : null])], { text: true });
19
- }
20
- /** The open menu: a Naive UI card holding one menu item per shortcut. */
21
- function menuCard(props, card, keydown, choose) {
22
- const items = props.items.map((item) => shortcut(item, choose));
23
- return (0, vue.h)(naive_ui.NCard, {
24
- ref: card,
25
- size: "small",
26
- role: "menu",
27
- "aria-label": props.label,
28
- class: "adapttable-naive-assistant-menu",
29
- contentStyle: {
30
- display: "flex",
31
- flexDirection: "column",
32
- gap: "4px"
33
- },
34
- style: {
35
- maxHeight: props.maxHeight,
36
- overflowY: "auto"
37
- },
38
- onKeydown: keydown
39
- }, { default: () => items });
40
- }
41
- /**
42
- * The assistant's shortcuts in a Naive UI popover menu under its trigger.
43
- * The shared menu navigation moves focus; Escape and Tab close the menu and
44
- * Escape returns focus to the trigger.
45
- */
46
- const NaiveExamplesMenu = (0, vue.defineComponent)((props) => {
47
- const active = (0, _adapttable_vue_adapter.useScopeActivity)();
48
- const open = (0, vue.shallowRef)(false);
49
- const trigger = (0, vue.shallowRef)(null);
50
- const card = (0, vue.shallowRef)(null);
51
- const navigation = (0, _adapttable_vue_adapter.createMenuNavigation)();
52
- let generation = 0;
53
- (0, vue.watch)([
54
- active,
55
- () => props.disabled,
56
- () => props.items,
57
- () => props.onSelect
58
- ], () => {
59
- generation++;
60
- open.value = false;
61
- }, { flush: "sync" });
62
- (0, vue.watch)(open, (expanded) => {
63
- navigation.reset();
64
- if (!expanded) return;
65
- (0, vue.nextTick)(() => {
66
- (card.value ? require_button.htmlRoot(card.value) : null)?.querySelector("[role=\"menuitem\"]")?.focus({ preventScroll: true });
67
- });
68
- });
69
- const close = (restore) => {
70
- open.value = false;
71
- if (restore) trigger.value?.focus({ preventScroll: true });
72
- };
73
- const keydown = (event) => {
74
- const panel = event.currentTarget;
75
- if (!(panel instanceof HTMLElement)) return;
76
- const items = [...panel.querySelectorAll("[role=\"menuitem\"]")];
77
- const focusTargets = items;
78
- const action = navigation.key(event, items.map((item) => ({
79
- label: item.textContent ?? "",
80
- disabled: item.disabled
81
- })), focusTargets.indexOf(panel.ownerDocument.activeElement));
82
- if (!action) return;
83
- if (action.kind !== "close" || action.key !== "Tab") event.preventDefault();
84
- event.stopPropagation();
85
- if (action.kind === "close") close(action.key === "Escape");
86
- else items[action.index]?.focus({ preventScroll: true });
87
- };
88
- return () => {
89
- if (!active.value) return null;
90
- const ticket = generation;
91
- const choose = (id) => {
92
- if (!active.value || props.disabled || ticket !== generation || !props.items.some((item) => item.id === id)) return;
93
- close(false);
94
- props.onSelect(id);
95
- };
96
- return (0, vue.h)(naive_ui.NPopover, {
97
- trigger: "manual",
98
- show: open.value,
99
- placement: "bottom-start",
100
- showArrow: false,
101
- raw: true,
102
- onClickoutside: (event) => {
103
- if (event.target instanceof Node && trigger.value?.contains(event.target)) return;
104
- close(false);
105
- }
106
- }, {
107
- trigger: () => require_button.naiveButton({
108
- ref: (element) => {
109
- trigger.value = element;
110
- },
111
- disabled: props.disabled,
112
- "aria-label": props.label,
113
- "aria-haspopup": "menu",
114
- "aria-expanded": open.value,
115
- title: props.label,
116
- class: props.className,
117
- "data-adapttable-part": props.part,
118
- onClick: () => {
119
- if (active.value && !props.disabled) open.value = !open.value;
120
- }
121
- }, [props.icon ?? props.label]),
122
- default: () => menuCard(props, card, keydown, choose)
123
- });
124
- };
125
- }, {
126
- name: "NaiveExamplesMenu",
127
- props: {
128
- label: { type: String },
129
- part: { type: String },
130
- className: { type: String },
131
- icon: {
132
- type: [
133
- String,
134
- Number,
135
- Boolean,
136
- Array,
137
- Object
138
- ],
139
- default: void 0
140
- },
141
- disabled: {
142
- type: Boolean,
143
- default: void 0
144
- },
145
- items: { type: Array },
146
- onSelect: { type: Function },
147
- maxHeight: { type: String }
148
- }
149
- });
150
- //#endregion
151
- //#region src/assistant/Sheet.ts
152
- /**
153
- * Chrome chooses initial and return focus; NDrawer contains focus and owns
154
- * the portal. Escape and mask dismissal become one close request to the
155
- * host, and the drawer stays open until the host closes it.
156
- */
157
- const NaiveAssistantSheet = (0, vue.defineComponent)((props) => {
158
- const active = (0, _adapttable_vue_adapter.useScopeActivity)();
159
- const requestClose = () => {
160
- if (active.value && props.open) props.onClose();
161
- };
162
- const keydown = (event) => {
163
- if (event.key !== "Escape" || event.defaultPrevented || event.isComposing) return;
164
- event.preventDefault();
165
- event.stopPropagation();
166
- requestClose();
167
- };
168
- return () => {
169
- if (!active.value) return null;
170
- return (0, vue.h)(naive_ui.NDrawer, {
171
- show: props.open,
172
- placement: props.dir === "rtl" ? "left" : "right",
173
- width: "min(28rem, 100vw)",
174
- autoFocus: false,
175
- closeOnEsc: false,
176
- maskClosable: false,
177
- role: "dialog",
178
- "aria-modal": "true",
179
- "aria-label": props.label,
180
- dir: props.dir,
181
- class: ["adapttable-naive-assistant-sheet", props.className],
182
- "data-adapttable-part": props.part,
183
- onKeydown: keydown,
184
- onMaskClick: requestClose
185
- }, { default: () => (0, vue.h)(naive_ui.NDrawerContent, {}, { default: () => props.children }) });
186
- };
187
- }, {
188
- name: "NaiveAssistantSheet",
189
- props: {
190
- label: { type: String },
191
- part: { type: String },
192
- className: { type: String },
193
- dir: { type: String },
194
- open: {
195
- type: Boolean,
196
- default: void 0
197
- },
198
- onClose: { type: Function },
199
- children: {
200
- type: [
201
- String,
202
- Number,
203
- Boolean,
204
- Array,
205
- Object
206
- ],
207
- default: void 0
208
- }
209
- }
210
- });
211
- //#endregion
212
- //#region src/assistant/controls.ts
213
- /** Naive UI tag types for the assistant's status tones. */
214
- const TAG_TYPE = {
215
- neutral: "default",
216
- busy: "info",
217
- warning: "warning",
218
- danger: "error"
219
- };
220
- const surface = (props, classes) => (0, vue.h)(naive_ui.NCard, {
221
- size: "small",
222
- role: "region",
223
- "data-adapttable-part": props.part,
224
- "aria-label": props.label,
225
- class: classes,
226
- style: props.style,
227
- contentStyle: {
228
- display: "flex",
229
- flexDirection: "column",
230
- minHeight: 0
231
- }
232
- }, { default: () => props.children });
233
- const naiveAssistantControls = {
234
- Button: (props) => require_button.naiveButton({
235
- "data-adapttable-part": props.part,
236
- "aria-label": props.label,
237
- "aria-expanded": props.expanded,
238
- title: props.tooltip,
239
- class: props.className,
240
- disabled: props.disabled,
241
- onClick: props.onClick
242
- }, [props.icon, props.iconOnly && props.icon ? null : props.children ?? props.label], { size: props.part === "assistant-launcher" ? "medium" : "small" }),
243
- Composer: (props) => require_input.naiveInput({
244
- type: "textarea",
245
- value: props.value,
246
- attrs: {
247
- "data-adapttable-part": props.part,
248
- "aria-label": props.label,
249
- placeholder: props.placeholder,
250
- class: props.className,
251
- disabled: props.disabled,
252
- rows: 1,
253
- onKeydown: props.onKeyDown
254
- },
255
- onChange: props.onChange
256
- }),
257
- Badge: (props) => (0, vue.h)(naive_ui.NTag, {
258
- "data-adapttable-part": props.part,
259
- "data-tone": props.tone,
260
- type: TAG_TYPE[props.tone],
261
- size: "small",
262
- bordered: false,
263
- class: props.className
264
- }, { default: () => props.label }),
265
- Panel: (props) => surface(props, ["adapttable-naive-assistant-panel", props.className]),
266
- Window: (props) => surface(props, ["adapttable-naive-assistant-window", props.className]),
267
- Sheet: (props) => (0, vue.h)(NaiveAssistantSheet, {
268
- ...props,
269
- key: props.part
270
- }),
271
- Menu: (props) => (0, vue.h)(NaiveExamplesMenu, props),
272
- LanguageChip: (props) => require_select.naiveSelect({
273
- attrs: {
274
- "data-adapttable-part": props.part,
275
- "aria-label": props.label,
276
- class: props.className,
277
- disabled: props.disabled
278
- },
279
- value: props.value,
280
- options: props.options,
281
- onChange: props.onChange
282
- })
283
- };
284
- const naiveApprovalControls = {
285
- Approve: naiveAssistantControls.Button,
286
- Reject: naiveAssistantControls.Button,
287
- Action: naiveAssistantControls.Button,
288
- List: (props) => (0, vue.h)("ul", {
289
- "data-adapttable-part": props.part,
290
- "aria-label": props.label,
291
- class: ["adapttable-naive-approval-list", props.className]
292
- }, [props.children])
293
- };
294
- //#endregion
295
- //#region src/assistant.ts
296
- const TableAssistant = (0, vue.defineComponent)((props) => {
297
- const theme = (0, naive_ui.useThemeVars)();
298
- return () => (0, vue.h)(_adapttable_vue_adapter.TableAssistantChrome, {
299
- ...props,
300
- accent: props.accent ?? theme.value.primaryColor,
301
- slots: naiveAssistantControls
302
- });
303
- }, {
304
- name: "NaiveTableAssistant",
305
- props: {
306
- assistant: { type: Object },
307
- speech: { type: Object },
308
- open: {
309
- type: Boolean,
310
- default: void 0
311
- },
312
- onOpenChange: { type: Function },
313
- presentation: { type: String },
314
- labels: { type: Object },
315
- accent: { type: String },
316
- receipts: {
317
- type: Boolean,
318
- default: void 0
319
- },
320
- className: { type: String },
321
- launcher: {
322
- type: Boolean,
323
- default: void 0
324
- },
325
- onSettings: { type: Function },
326
- boundary: { type: [String, Object] },
327
- note: { type: String },
328
- greeting: { type: String },
329
- avatars: { type: Object },
330
- messageAction: { type: Function },
331
- approval: { type: Object },
332
- dir: { type: String }
333
- }
334
- });
335
- const AgentApproval = (0, vue.defineComponent)((props) => () => (0, vue.h)(_adapttable_vue_adapter.AgentApprovalChrome, {
336
- ...props,
337
- slots: naiveApprovalControls
338
- }), {
339
- name: "NaiveAgentApproval",
340
- props: {
341
- pending: { type: Object },
342
- labels: { type: Object },
343
- className: { type: String },
344
- buttonClassName: { type: String }
345
- }
346
- });
347
- function tableAssistant() {
348
- return (0, _adapttable_vue_adapter.createAdapterTableAssistantFeature)((props) => (0, vue.h)(TableAssistant, props));
349
- }
350
- function agentApproval() {
351
- return (0, _adapttable_vue_adapter.createAdapterAgentApprovalFeature)((props) => (0, vue.h)(AgentApproval, props));
352
- }
353
- //#endregion
354
- exports.AgentApproval = AgentApproval;
355
- exports.TableAssistant = TableAssistant;
356
- exports.agentApproval = agentApproval;
357
- exports.tableAssistant = tableAssistant;
358
-
359
- //# sourceMappingURL=assistant.cjs.map
2
+ const require_assistant = require("./assistant-D6mc-LJl.cjs");
3
+ exports.AgentApproval = require_assistant.AgentApproval;
4
+ exports.TableAssistant = require_assistant.TableAssistant;
5
+ exports.agentApproval = require_assistant.agentApproval;
6
+ exports.tableAssistant = require_assistant.tableAssistant;
package/dist/assistant.js CHANGED
@@ -1,355 +1,2 @@
1
- import { r as htmlRoot, t as naiveButton } from "./button-BxXdDW7A.js";
2
- import { t as naiveInput } from "./input-DZI_oY9v.js";
3
- import { t as naiveSelect } from "./select-Bgc5ttop.js";
4
- import { AgentApprovalChrome, TableAssistantChrome, createAdapterAgentApprovalFeature, createAdapterTableAssistantFeature, createMenuNavigation, useScopeActivity } from "@adapttable/vue/adapter";
5
- import { defineComponent, h, nextTick, shallowRef, watch } from "vue";
6
- import { NCard, NDrawer, NDrawerContent, NPopover, NTag, useThemeVars } from "naive-ui";
7
- //#region src/assistant/ExamplesMenu.ts
8
- /** One shortcut as a menu item: its icon, title and optional description. */
9
- function shortcut(item, choose) {
10
- return naiveButton({
11
- key: item.id,
12
- role: "menuitem",
13
- tabindex: -1,
14
- "data-adapttable-part": item.part,
15
- class: "adapttable-naive-assistant-shortcut",
16
- onClick: () => choose(item.id)
17
- }, [item.icon, h("span", [h("strong", item.title), item.description ? h("small", item.description) : null])], { text: true });
18
- }
19
- /** The open menu: a Naive UI card holding one menu item per shortcut. */
20
- function menuCard(props, card, keydown, choose) {
21
- const items = props.items.map((item) => shortcut(item, choose));
22
- return h(NCard, {
23
- ref: card,
24
- size: "small",
25
- role: "menu",
26
- "aria-label": props.label,
27
- class: "adapttable-naive-assistant-menu",
28
- contentStyle: {
29
- display: "flex",
30
- flexDirection: "column",
31
- gap: "4px"
32
- },
33
- style: {
34
- maxHeight: props.maxHeight,
35
- overflowY: "auto"
36
- },
37
- onKeydown: keydown
38
- }, { default: () => items });
39
- }
40
- /**
41
- * The assistant's shortcuts in a Naive UI popover menu under its trigger.
42
- * The shared menu navigation moves focus; Escape and Tab close the menu and
43
- * Escape returns focus to the trigger.
44
- */
45
- const NaiveExamplesMenu = defineComponent((props) => {
46
- const active = useScopeActivity();
47
- const open = shallowRef(false);
48
- const trigger = shallowRef(null);
49
- const card = shallowRef(null);
50
- const navigation = createMenuNavigation();
51
- let generation = 0;
52
- watch([
53
- active,
54
- () => props.disabled,
55
- () => props.items,
56
- () => props.onSelect
57
- ], () => {
58
- generation++;
59
- open.value = false;
60
- }, { flush: "sync" });
61
- watch(open, (expanded) => {
62
- navigation.reset();
63
- if (!expanded) return;
64
- nextTick(() => {
65
- (card.value ? htmlRoot(card.value) : null)?.querySelector("[role=\"menuitem\"]")?.focus({ preventScroll: true });
66
- });
67
- });
68
- const close = (restore) => {
69
- open.value = false;
70
- if (restore) trigger.value?.focus({ preventScroll: true });
71
- };
72
- const keydown = (event) => {
73
- const panel = event.currentTarget;
74
- if (!(panel instanceof HTMLElement)) return;
75
- const items = [...panel.querySelectorAll("[role=\"menuitem\"]")];
76
- const focusTargets = items;
77
- const action = navigation.key(event, items.map((item) => ({
78
- label: item.textContent ?? "",
79
- disabled: item.disabled
80
- })), focusTargets.indexOf(panel.ownerDocument.activeElement));
81
- if (!action) return;
82
- if (action.kind !== "close" || action.key !== "Tab") event.preventDefault();
83
- event.stopPropagation();
84
- if (action.kind === "close") close(action.key === "Escape");
85
- else items[action.index]?.focus({ preventScroll: true });
86
- };
87
- return () => {
88
- if (!active.value) return null;
89
- const ticket = generation;
90
- const choose = (id) => {
91
- if (!active.value || props.disabled || ticket !== generation || !props.items.some((item) => item.id === id)) return;
92
- close(false);
93
- props.onSelect(id);
94
- };
95
- return h(NPopover, {
96
- trigger: "manual",
97
- show: open.value,
98
- placement: "bottom-start",
99
- showArrow: false,
100
- raw: true,
101
- onClickoutside: (event) => {
102
- if (event.target instanceof Node && trigger.value?.contains(event.target)) return;
103
- close(false);
104
- }
105
- }, {
106
- trigger: () => naiveButton({
107
- ref: (element) => {
108
- trigger.value = element;
109
- },
110
- disabled: props.disabled,
111
- "aria-label": props.label,
112
- "aria-haspopup": "menu",
113
- "aria-expanded": open.value,
114
- title: props.label,
115
- class: props.className,
116
- "data-adapttable-part": props.part,
117
- onClick: () => {
118
- if (active.value && !props.disabled) open.value = !open.value;
119
- }
120
- }, [props.icon ?? props.label]),
121
- default: () => menuCard(props, card, keydown, choose)
122
- });
123
- };
124
- }, {
125
- name: "NaiveExamplesMenu",
126
- props: {
127
- label: { type: String },
128
- part: { type: String },
129
- className: { type: String },
130
- icon: {
131
- type: [
132
- String,
133
- Number,
134
- Boolean,
135
- Array,
136
- Object
137
- ],
138
- default: void 0
139
- },
140
- disabled: {
141
- type: Boolean,
142
- default: void 0
143
- },
144
- items: { type: Array },
145
- onSelect: { type: Function },
146
- maxHeight: { type: String }
147
- }
148
- });
149
- //#endregion
150
- //#region src/assistant/Sheet.ts
151
- /**
152
- * Chrome chooses initial and return focus; NDrawer contains focus and owns
153
- * the portal. Escape and mask dismissal become one close request to the
154
- * host, and the drawer stays open until the host closes it.
155
- */
156
- const NaiveAssistantSheet = defineComponent((props) => {
157
- const active = useScopeActivity();
158
- const requestClose = () => {
159
- if (active.value && props.open) props.onClose();
160
- };
161
- const keydown = (event) => {
162
- if (event.key !== "Escape" || event.defaultPrevented || event.isComposing) return;
163
- event.preventDefault();
164
- event.stopPropagation();
165
- requestClose();
166
- };
167
- return () => {
168
- if (!active.value) return null;
169
- return h(NDrawer, {
170
- show: props.open,
171
- placement: props.dir === "rtl" ? "left" : "right",
172
- width: "min(28rem, 100vw)",
173
- autoFocus: false,
174
- closeOnEsc: false,
175
- maskClosable: false,
176
- role: "dialog",
177
- "aria-modal": "true",
178
- "aria-label": props.label,
179
- dir: props.dir,
180
- class: ["adapttable-naive-assistant-sheet", props.className],
181
- "data-adapttable-part": props.part,
182
- onKeydown: keydown,
183
- onMaskClick: requestClose
184
- }, { default: () => h(NDrawerContent, {}, { default: () => props.children }) });
185
- };
186
- }, {
187
- name: "NaiveAssistantSheet",
188
- props: {
189
- label: { type: String },
190
- part: { type: String },
191
- className: { type: String },
192
- dir: { type: String },
193
- open: {
194
- type: Boolean,
195
- default: void 0
196
- },
197
- onClose: { type: Function },
198
- children: {
199
- type: [
200
- String,
201
- Number,
202
- Boolean,
203
- Array,
204
- Object
205
- ],
206
- default: void 0
207
- }
208
- }
209
- });
210
- //#endregion
211
- //#region src/assistant/controls.ts
212
- /** Naive UI tag types for the assistant's status tones. */
213
- const TAG_TYPE = {
214
- neutral: "default",
215
- busy: "info",
216
- warning: "warning",
217
- danger: "error"
218
- };
219
- const surface = (props, classes) => h(NCard, {
220
- size: "small",
221
- role: "region",
222
- "data-adapttable-part": props.part,
223
- "aria-label": props.label,
224
- class: classes,
225
- style: props.style,
226
- contentStyle: {
227
- display: "flex",
228
- flexDirection: "column",
229
- minHeight: 0
230
- }
231
- }, { default: () => props.children });
232
- const naiveAssistantControls = {
233
- Button: (props) => naiveButton({
234
- "data-adapttable-part": props.part,
235
- "aria-label": props.label,
236
- "aria-expanded": props.expanded,
237
- title: props.tooltip,
238
- class: props.className,
239
- disabled: props.disabled,
240
- onClick: props.onClick
241
- }, [props.icon, props.iconOnly && props.icon ? null : props.children ?? props.label], { size: props.part === "assistant-launcher" ? "medium" : "small" }),
242
- Composer: (props) => naiveInput({
243
- type: "textarea",
244
- value: props.value,
245
- attrs: {
246
- "data-adapttable-part": props.part,
247
- "aria-label": props.label,
248
- placeholder: props.placeholder,
249
- class: props.className,
250
- disabled: props.disabled,
251
- rows: 1,
252
- onKeydown: props.onKeyDown
253
- },
254
- onChange: props.onChange
255
- }),
256
- Badge: (props) => h(NTag, {
257
- "data-adapttable-part": props.part,
258
- "data-tone": props.tone,
259
- type: TAG_TYPE[props.tone],
260
- size: "small",
261
- bordered: false,
262
- class: props.className
263
- }, { default: () => props.label }),
264
- Panel: (props) => surface(props, ["adapttable-naive-assistant-panel", props.className]),
265
- Window: (props) => surface(props, ["adapttable-naive-assistant-window", props.className]),
266
- Sheet: (props) => h(NaiveAssistantSheet, {
267
- ...props,
268
- key: props.part
269
- }),
270
- Menu: (props) => h(NaiveExamplesMenu, props),
271
- LanguageChip: (props) => naiveSelect({
272
- attrs: {
273
- "data-adapttable-part": props.part,
274
- "aria-label": props.label,
275
- class: props.className,
276
- disabled: props.disabled
277
- },
278
- value: props.value,
279
- options: props.options,
280
- onChange: props.onChange
281
- })
282
- };
283
- const naiveApprovalControls = {
284
- Approve: naiveAssistantControls.Button,
285
- Reject: naiveAssistantControls.Button,
286
- Action: naiveAssistantControls.Button,
287
- List: (props) => h("ul", {
288
- "data-adapttable-part": props.part,
289
- "aria-label": props.label,
290
- class: ["adapttable-naive-approval-list", props.className]
291
- }, [props.children])
292
- };
293
- //#endregion
294
- //#region src/assistant.ts
295
- const TableAssistant = defineComponent((props) => {
296
- const theme = useThemeVars();
297
- return () => h(TableAssistantChrome, {
298
- ...props,
299
- accent: props.accent ?? theme.value.primaryColor,
300
- slots: naiveAssistantControls
301
- });
302
- }, {
303
- name: "NaiveTableAssistant",
304
- props: {
305
- assistant: { type: Object },
306
- speech: { type: Object },
307
- open: {
308
- type: Boolean,
309
- default: void 0
310
- },
311
- onOpenChange: { type: Function },
312
- presentation: { type: String },
313
- labels: { type: Object },
314
- accent: { type: String },
315
- receipts: {
316
- type: Boolean,
317
- default: void 0
318
- },
319
- className: { type: String },
320
- launcher: {
321
- type: Boolean,
322
- default: void 0
323
- },
324
- onSettings: { type: Function },
325
- boundary: { type: [String, Object] },
326
- note: { type: String },
327
- greeting: { type: String },
328
- avatars: { type: Object },
329
- messageAction: { type: Function },
330
- approval: { type: Object },
331
- dir: { type: String }
332
- }
333
- });
334
- const AgentApproval = defineComponent((props) => () => h(AgentApprovalChrome, {
335
- ...props,
336
- slots: naiveApprovalControls
337
- }), {
338
- name: "NaiveAgentApproval",
339
- props: {
340
- pending: { type: Object },
341
- labels: { type: Object },
342
- className: { type: String },
343
- buttonClassName: { type: String }
344
- }
345
- });
346
- function tableAssistant() {
347
- return createAdapterTableAssistantFeature((props) => h(TableAssistant, props));
348
- }
349
- function agentApproval() {
350
- return createAdapterAgentApprovalFeature((props) => h(AgentApproval, props));
351
- }
352
- //#endregion
1
+ import { i as tableAssistant, n as TableAssistant, r as agentApproval, t as AgentApproval } from "./assistant-Cv8df2ti.js";
353
2
  export { AgentApproval, TableAssistant, agentApproval, tableAssistant };
354
-
355
- //# sourceMappingURL=assistant.js.map