@uipath/apollo-wind 2.70.0 → 2.71.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/forms/field-control.cjs +3 -2
- package/dist/components/forms/field-control.js +3 -2
- package/dist/components/forms/validation-converter.cjs +14 -5
- package/dist/components/forms/validation-converter.js +14 -5
- package/dist/components/ui/chat-hero.cjs +244 -0
- package/dist/components/ui/chat-hero.d.ts +51 -0
- package/dist/components/ui/chat-hero.js +189 -0
- package/dist/components/ui/date-picker.cjs +6 -5
- package/dist/components/ui/date-picker.js +7 -6
- package/dist/components/ui/datetime-picker.cjs +7 -10
- package/dist/components/ui/datetime-picker.js +8 -11
- package/dist/components/ui/index.cjs +252 -230
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/index.js +2 -0
- package/dist/components/ui/prompt-suggestions.cjs +133 -0
- package/dist/components/ui/prompt-suggestions.d.ts +52 -0
- package/dist/components/ui/prompt-suggestions.js +90 -0
- package/dist/components/ui/quick-form-field/components/field-header.cjs +9 -4
- package/dist/components/ui/quick-form-field/components/field-header.d.ts +4 -1
- package/dist/components/ui/quick-form-field/components/field-header.js +9 -4
- package/dist/components/ui/quick-form-field/components/lock-toggle-button.cjs +2 -2
- package/dist/components/ui/quick-form-field/components/lock-toggle-button.d.ts +5 -4
- package/dist/components/ui/quick-form-field/components/lock-toggle-button.js +2 -2
- package/dist/components/ui/quick-form-field/index.d.ts +1 -1
- package/dist/components/ui/quick-form-field/quick-form-field.cjs +158 -222
- package/dist/components/ui/quick-form-field/quick-form-field.d.ts +6 -4
- package/dist/components/ui/quick-form-field/quick-form-field.js +159 -223
- package/dist/components/ui/quick-form-field/types.cjs +2 -2
- package/dist/components/ui/quick-form-field/types.d.ts +39 -32
- package/dist/components/ui/quick-form-field/types.js +2 -2
- package/dist/components/ui/quick-form-field/utils.cjs +5 -59
- package/dist/components/ui/quick-form-field/utils.d.ts +2 -24
- package/dist/components/ui/quick-form-field/utils.js +3 -48
- package/dist/index.cjs +40 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.js +3 -1
- package/dist/lib/date-value.cjs +46 -0
- package/dist/lib/date-value.d.ts +8 -0
- package/dist/lib/date-value.js +12 -0
- package/dist/styles.css +82 -43
- package/dist/tailwind.utilities.css +15 -0
- package/package.json +1 -1
- package/dist/components/custom/chat-first-experience.cjs +0 -87
- package/dist/components/custom/chat-first-experience.d.ts +0 -24
- package/dist/components/custom/chat-first-experience.js +0 -53
- package/dist/components/custom/chat-prompt-suggestions.cjs +0 -49
- package/dist/components/custom/chat-prompt-suggestions.d.ts +0 -18
- package/dist/components/custom/chat-prompt-suggestions.js +0 -15
|
@@ -14,6 +14,7 @@ export * from './calendar';
|
|
|
14
14
|
export * from './card';
|
|
15
15
|
export * from './chart';
|
|
16
16
|
export * from './chat-composer';
|
|
17
|
+
export * from './chat-hero';
|
|
17
18
|
export * from './checkbox';
|
|
18
19
|
export * from './citation';
|
|
19
20
|
export * from './code-block';
|
|
@@ -57,6 +58,7 @@ export * from './popover';
|
|
|
57
58
|
export * from './portal-container';
|
|
58
59
|
export * from './progress';
|
|
59
60
|
export * from './prompt-editor';
|
|
61
|
+
export * from './prompt-suggestions';
|
|
60
62
|
export * from './prompt-value-control';
|
|
61
63
|
export * from './quick-form-field';
|
|
62
64
|
export * from './radio-group';
|
|
@@ -15,6 +15,7 @@ export * from "./calendar.js";
|
|
|
15
15
|
export * from "./card.js";
|
|
16
16
|
export * from "./chart.js";
|
|
17
17
|
export * from "./chat-composer.js";
|
|
18
|
+
export * from "./chat-hero.js";
|
|
18
19
|
export * from "./checkbox.js";
|
|
19
20
|
export * from "./citation.js";
|
|
20
21
|
export * from "./code-block.js";
|
|
@@ -58,6 +59,7 @@ export * from "./popover.js";
|
|
|
58
59
|
export * from "./portal-container.js";
|
|
59
60
|
export * from "./progress.js";
|
|
60
61
|
export * from "./prompt-editor/index.js";
|
|
62
|
+
export * from "./prompt-suggestions.js";
|
|
61
63
|
export * from "./prompt-value-control.js";
|
|
62
64
|
export * from "./quick-form-field/index.js";
|
|
63
65
|
export * from "./radio-group.js";
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.r = (exports1)=>{
|
|
17
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
DEFAULT_PROMPT_SUGGESTIONS_STRINGS: ()=>DEFAULT_PROMPT_SUGGESTIONS_STRINGS,
|
|
29
|
+
PromptSuggestions: ()=>PromptSuggestions,
|
|
30
|
+
promptSuggestionsListVariants: ()=>promptSuggestionsListVariants,
|
|
31
|
+
promptSuggestionVariants: ()=>promptSuggestionVariants
|
|
32
|
+
});
|
|
33
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
34
|
+
const external_class_variance_authority_namespaceObject = require("class-variance-authority");
|
|
35
|
+
const external_react_namespaceObject = require("react");
|
|
36
|
+
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
37
|
+
const DEFAULT_PROMPT_SUGGESTIONS_STRINGS = {
|
|
38
|
+
label: 'Suggestions'
|
|
39
|
+
};
|
|
40
|
+
const promptSuggestionsListVariants = (0, external_class_variance_authority_namespaceObject.cva)('flex min-w-0 gap-2', {
|
|
41
|
+
variants: {
|
|
42
|
+
orientation: {
|
|
43
|
+
vertical: 'flex-col items-start',
|
|
44
|
+
horizontal: '-mx-1 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none overflow-x-auto overscroll-x-contain px-1 py-1'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
orientation: 'vertical'
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const promptSuggestionVariants = (0, external_class_variance_authority_namespaceObject.cva)('inline-flex max-w-full cursor-pointer items-center border border-border-subtle bg-surface-raised text-left font-normal text-foreground transition-colors hover:border-border hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0', {
|
|
52
|
+
variants: {
|
|
53
|
+
density: {
|
|
54
|
+
comfortable: 'gap-2 px-4 py-2 text-sm leading-5 [&_svg]:size-4 rounded-xl',
|
|
55
|
+
compact: 'gap-1.5 px-2 py-1 text-xs leading-4 [&_svg]:size-3.5 rounded-lg'
|
|
56
|
+
},
|
|
57
|
+
orientation: {
|
|
58
|
+
vertical: 'whitespace-normal',
|
|
59
|
+
horizontal: 'flex-none snap-start whitespace-nowrap'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
defaultVariants: {
|
|
63
|
+
density: 'comfortable',
|
|
64
|
+
orientation: 'vertical'
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const PromptSuggestions = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, suggestions, onSelect, orientation, density, showLabel = false, animated = false, disabled = false, strings, ...props }, ref)=>{
|
|
68
|
+
const labelId = external_react_namespaceObject.useId();
|
|
69
|
+
const resolvedOrientation = orientation ?? 'vertical';
|
|
70
|
+
const resolvedDensity = density ?? 'comfortable';
|
|
71
|
+
const text = {
|
|
72
|
+
...DEFAULT_PROMPT_SUGGESTIONS_STRINGS,
|
|
73
|
+
...strings
|
|
74
|
+
};
|
|
75
|
+
if (0 === suggestions.length) return null;
|
|
76
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
77
|
+
ref: ref,
|
|
78
|
+
role: "group",
|
|
79
|
+
"aria-label": showLabel ? void 0 : text.label,
|
|
80
|
+
"aria-labelledby": showLabel ? labelId : void 0,
|
|
81
|
+
"data-slot": "prompt-suggestions",
|
|
82
|
+
"data-orientation": resolvedOrientation,
|
|
83
|
+
"data-density": resolvedDensity,
|
|
84
|
+
className: (0, index_cjs_namespaceObject.cn)('flex w-full min-w-0 flex-col gap-1', animated && 'animate-slide-in-from-bottom', className),
|
|
85
|
+
...props,
|
|
86
|
+
children: [
|
|
87
|
+
showLabel && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
88
|
+
id: labelId,
|
|
89
|
+
"data-slot": "prompt-suggestions-label",
|
|
90
|
+
className: (0, index_cjs_namespaceObject.cn)('text-start font-semibold text-foreground', 'compact' === resolvedDensity ? 'text-xs leading-4' : 'text-sm leading-5'),
|
|
91
|
+
children: text.label
|
|
92
|
+
}),
|
|
93
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
94
|
+
"data-slot": "prompt-suggestions-list",
|
|
95
|
+
className: promptSuggestionsListVariants({
|
|
96
|
+
orientation: resolvedOrientation
|
|
97
|
+
}),
|
|
98
|
+
children: suggestions.map((suggestion, index)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
|
|
99
|
+
type: "button",
|
|
100
|
+
"data-slot": "prompt-suggestion",
|
|
101
|
+
"data-index": index,
|
|
102
|
+
disabled: disabled,
|
|
103
|
+
className: promptSuggestionVariants({
|
|
104
|
+
density: resolvedDensity,
|
|
105
|
+
orientation: resolvedOrientation
|
|
106
|
+
}),
|
|
107
|
+
onClick: ()=>onSelect?.(suggestion),
|
|
108
|
+
children: [
|
|
109
|
+
suggestion.icon,
|
|
110
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
111
|
+
className: "min-w-0",
|
|
112
|
+
children: suggestion.label
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}, suggestion.id ?? suggestion.label))
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
PromptSuggestions.displayName = 'PromptSuggestions';
|
|
121
|
+
exports.DEFAULT_PROMPT_SUGGESTIONS_STRINGS = __webpack_exports__.DEFAULT_PROMPT_SUGGESTIONS_STRINGS;
|
|
122
|
+
exports.PromptSuggestions = __webpack_exports__.PromptSuggestions;
|
|
123
|
+
exports.promptSuggestionVariants = __webpack_exports__.promptSuggestionVariants;
|
|
124
|
+
exports.promptSuggestionsListVariants = __webpack_exports__.promptSuggestionsListVariants;
|
|
125
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
126
|
+
"DEFAULT_PROMPT_SUGGESTIONS_STRINGS",
|
|
127
|
+
"PromptSuggestions",
|
|
128
|
+
"promptSuggestionVariants",
|
|
129
|
+
"promptSuggestionsListVariants"
|
|
130
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
131
|
+
Object.defineProperty(exports, '__esModule', {
|
|
132
|
+
value: true
|
|
133
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Prompts the user can pick instead of typing, as a group of chips. `onSelect` receives the
|
|
4
|
+
* suggestion; whether that sends it or puts it in the composer is the caller's call:
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* <PromptSuggestions
|
|
8
|
+
* suggestions={[{ label: 'Summarize', prompt: 'Summarize this conversation' }]}
|
|
9
|
+
* onSelect={({ label, prompt }) => send(prompt ?? label)}
|
|
10
|
+
* />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export interface PromptSuggestionsStrings {
|
|
14
|
+
/** Accessible name of the group, and its visible title with `showLabel`. */
|
|
15
|
+
label: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const DEFAULT_PROMPT_SUGGESTIONS_STRINGS: PromptSuggestionsStrings;
|
|
18
|
+
/** One chip. Shaped so a chat service's `{ label, prompt }` suggestions pass straight in. */
|
|
19
|
+
export interface PromptSuggestionItem {
|
|
20
|
+
label: string;
|
|
21
|
+
/** The text to send or prefill, when it differs from the label. */
|
|
22
|
+
prompt?: string;
|
|
23
|
+
/** Keys the chip. Defaults to `label`. */
|
|
24
|
+
id?: string;
|
|
25
|
+
/** Leading icon. */
|
|
26
|
+
icon?: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export type PromptSuggestionsDensity = 'comfortable' | 'compact';
|
|
29
|
+
declare const promptSuggestionsListVariants: (props?: ({
|
|
30
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
31
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
32
|
+
declare const promptSuggestionVariants: (props?: ({
|
|
33
|
+
density?: "compact" | "comfortable" | null | undefined;
|
|
34
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
35
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
36
|
+
export type PromptSuggestionsOrientation = 'vertical' | 'horizontal';
|
|
37
|
+
export interface PromptSuggestionsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect' | 'children'> {
|
|
38
|
+
suggestions: PromptSuggestionItem[];
|
|
39
|
+
onSelect?: (suggestion: PromptSuggestionItem) => void;
|
|
40
|
+
orientation?: PromptSuggestionsOrientation;
|
|
41
|
+
density?: PromptSuggestionsDensity;
|
|
42
|
+
/** Shows `strings.label` as a title above the chips, as a chat does after a reply. */
|
|
43
|
+
showLabel?: boolean;
|
|
44
|
+
/** Slides the group in from below when it mounts. Only fades under reduced motion. */
|
|
45
|
+
animated?: boolean;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/** Overrides for any subset of the English strings. */
|
|
48
|
+
strings?: Partial<PromptSuggestionsStrings>;
|
|
49
|
+
}
|
|
50
|
+
/** Stacks vertically by default; `horizontal` keeps one row that scrolls when it overflows. */
|
|
51
|
+
declare const PromptSuggestions: React.ForwardRefExoticComponent<PromptSuggestionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
52
|
+
export { PromptSuggestions, promptSuggestionsListVariants, promptSuggestionVariants };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { forwardRef, useId } from "react";
|
|
5
|
+
import { cn } from "../../lib/index.js";
|
|
6
|
+
const DEFAULT_PROMPT_SUGGESTIONS_STRINGS = {
|
|
7
|
+
label: 'Suggestions'
|
|
8
|
+
};
|
|
9
|
+
const promptSuggestionsListVariants = cva('flex min-w-0 gap-2', {
|
|
10
|
+
variants: {
|
|
11
|
+
orientation: {
|
|
12
|
+
vertical: 'flex-col items-start',
|
|
13
|
+
horizontal: '-mx-1 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none overflow-x-auto overscroll-x-contain px-1 py-1'
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
orientation: 'vertical'
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const promptSuggestionVariants = cva('inline-flex max-w-full cursor-pointer items-center border border-border-subtle bg-surface-raised text-left font-normal text-foreground transition-colors hover:border-border hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0', {
|
|
21
|
+
variants: {
|
|
22
|
+
density: {
|
|
23
|
+
comfortable: 'gap-2 px-4 py-2 text-sm leading-5 [&_svg]:size-4 rounded-xl',
|
|
24
|
+
compact: 'gap-1.5 px-2 py-1 text-xs leading-4 [&_svg]:size-3.5 rounded-lg'
|
|
25
|
+
},
|
|
26
|
+
orientation: {
|
|
27
|
+
vertical: 'whitespace-normal',
|
|
28
|
+
horizontal: 'flex-none snap-start whitespace-nowrap'
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
density: 'comfortable',
|
|
33
|
+
orientation: 'vertical'
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const PromptSuggestions = /*#__PURE__*/ forwardRef(({ className, suggestions, onSelect, orientation, density, showLabel = false, animated = false, disabled = false, strings, ...props }, ref)=>{
|
|
37
|
+
const labelId = useId();
|
|
38
|
+
const resolvedOrientation = orientation ?? 'vertical';
|
|
39
|
+
const resolvedDensity = density ?? 'comfortable';
|
|
40
|
+
const text = {
|
|
41
|
+
...DEFAULT_PROMPT_SUGGESTIONS_STRINGS,
|
|
42
|
+
...strings
|
|
43
|
+
};
|
|
44
|
+
if (0 === suggestions.length) return null;
|
|
45
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
46
|
+
ref: ref,
|
|
47
|
+
role: "group",
|
|
48
|
+
"aria-label": showLabel ? void 0 : text.label,
|
|
49
|
+
"aria-labelledby": showLabel ? labelId : void 0,
|
|
50
|
+
"data-slot": "prompt-suggestions",
|
|
51
|
+
"data-orientation": resolvedOrientation,
|
|
52
|
+
"data-density": resolvedDensity,
|
|
53
|
+
className: cn('flex w-full min-w-0 flex-col gap-1', animated && 'animate-slide-in-from-bottom', className),
|
|
54
|
+
...props,
|
|
55
|
+
children: [
|
|
56
|
+
showLabel && /*#__PURE__*/ jsx("div", {
|
|
57
|
+
id: labelId,
|
|
58
|
+
"data-slot": "prompt-suggestions-label",
|
|
59
|
+
className: cn('text-start font-semibold text-foreground', 'compact' === resolvedDensity ? 'text-xs leading-4' : 'text-sm leading-5'),
|
|
60
|
+
children: text.label
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ jsx("div", {
|
|
63
|
+
"data-slot": "prompt-suggestions-list",
|
|
64
|
+
className: promptSuggestionsListVariants({
|
|
65
|
+
orientation: resolvedOrientation
|
|
66
|
+
}),
|
|
67
|
+
children: suggestions.map((suggestion, index)=>/*#__PURE__*/ jsxs("button", {
|
|
68
|
+
type: "button",
|
|
69
|
+
"data-slot": "prompt-suggestion",
|
|
70
|
+
"data-index": index,
|
|
71
|
+
disabled: disabled,
|
|
72
|
+
className: promptSuggestionVariants({
|
|
73
|
+
density: resolvedDensity,
|
|
74
|
+
orientation: resolvedOrientation
|
|
75
|
+
}),
|
|
76
|
+
onClick: ()=>onSelect?.(suggestion),
|
|
77
|
+
children: [
|
|
78
|
+
suggestion.icon,
|
|
79
|
+
/*#__PURE__*/ jsx("span", {
|
|
80
|
+
className: "min-w-0",
|
|
81
|
+
children: suggestion.label
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
}, suggestion.id ?? suggestion.label))
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
PromptSuggestions.displayName = 'PromptSuggestions';
|
|
90
|
+
export { DEFAULT_PROMPT_SUGGESTIONS_STRINGS, PromptSuggestions, promptSuggestionVariants, promptSuggestionsListVariants };
|
|
@@ -39,7 +39,7 @@ const ai_assist_action_cjs_namespaceObject = require("../../field-actions/ai-ass
|
|
|
39
39
|
const collapse_cjs_namespaceObject = require("../../field-actions/collapse.cjs");
|
|
40
40
|
const insert_variable_action_cjs_namespaceObject = require("../../field-actions/insert-variable-action.cjs");
|
|
41
41
|
const external_types_cjs_namespaceObject = require("../types.cjs");
|
|
42
|
-
function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTypes = external_types_cjs_namespaceObject.FIELD_TYPE_ORDER, onFieldTypeChange, onRequiredChange, compact, showFieldActions, onValueChange, variables, onGenerateWithAi, onInsertVariable, strings, headerActions }) {
|
|
42
|
+
function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTypes = external_types_cjs_namespaceObject.FIELD_TYPE_ORDER, onFieldTypeChange, onRequiredChange, compact, disabled, isExpression, showFieldActions, onValueChange, variables, onGenerateWithAi, onInsertVariable, strings, headerActions }) {
|
|
43
43
|
const [pickerItems, optionsBySelectionId] = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
44
44
|
const byId = new Map();
|
|
45
45
|
const toItem = (v, id)=>{
|
|
@@ -97,7 +97,8 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
|
|
|
97
97
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
|
|
98
98
|
type: "button",
|
|
99
99
|
"aria-label": strings.fieldTypeAriaLabel,
|
|
100
|
-
|
|
100
|
+
disabled: disabled,
|
|
101
|
+
className: (0, index_cjs_namespaceObject.cn)('flex h-7 items-center gap-1 rounded-lg px-2 text-[11px] text-foreground-subtle transition hover:bg-surface-overlay hover:text-foreground disabled:pointer-events-none disabled:opacity-50', collapsedPaddingClass),
|
|
101
102
|
children: [
|
|
102
103
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(typeMeta.icon, {
|
|
103
104
|
size: 12
|
|
@@ -155,6 +156,7 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
|
|
|
155
156
|
size: "sm",
|
|
156
157
|
checked: !!required,
|
|
157
158
|
onCheckedChange: onRequiredChange,
|
|
159
|
+
disabled: disabled,
|
|
158
160
|
className: "data-[state=checked]:bg-brand data-[state=unchecked]:bg-foreground-subtle",
|
|
159
161
|
"aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel
|
|
160
162
|
})
|
|
@@ -179,7 +181,8 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
|
|
|
179
181
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
180
182
|
type: "button",
|
|
181
183
|
"aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel,
|
|
182
|
-
|
|
184
|
+
disabled: disabled,
|
|
185
|
+
className: "grid size-7 place-items-center rounded-lg text-foreground-subtle transition hover:bg-surface-overlay hover:text-foreground disabled:pointer-events-none disabled:opacity-50",
|
|
183
186
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Asterisk, {
|
|
184
187
|
size: 12
|
|
185
188
|
})
|
|
@@ -205,6 +208,7 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
|
|
|
205
208
|
size: "sm",
|
|
206
209
|
checked: !!required,
|
|
207
210
|
onCheckedChange: onRequiredChange,
|
|
211
|
+
disabled: disabled,
|
|
208
212
|
className: "data-[state=checked]:bg-brand data-[state=unchecked]:bg-foreground-subtle",
|
|
209
213
|
"aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel
|
|
210
214
|
})
|
|
@@ -220,7 +224,8 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
|
|
|
220
224
|
children: [
|
|
221
225
|
onGenerateWithAi && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ai_assist_action_cjs_namespaceObject.AiAssistAction, {
|
|
222
226
|
onGenerate: onGenerateWithAi,
|
|
223
|
-
|
|
227
|
+
disabled: disabled,
|
|
228
|
+
hint: strings.aiOutputHint(strings.aiOutputLabel(typeLabel, isExpression)),
|
|
224
229
|
strings: {
|
|
225
230
|
trigger: strings.aiAssistAriaLabel,
|
|
226
231
|
tooltip: strings.aiAssistTooltip,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { QuickFieldType, QuickFormFieldOption, QuickFormFieldStrings } from '../types';
|
|
3
|
-
export declare function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTypes, onFieldTypeChange, onRequiredChange, compact, showFieldActions, onValueChange, variables, onGenerateWithAi, onInsertVariable, strings, headerActions, }: {
|
|
3
|
+
export declare function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTypes, onFieldTypeChange, onRequiredChange, compact, disabled, isExpression, showFieldActions, onValueChange, variables, onGenerateWithAi, onInsertVariable, strings, headerActions, }: {
|
|
4
4
|
label?: ReactNode;
|
|
5
5
|
fieldId: string;
|
|
6
6
|
fieldLabel: string;
|
|
@@ -11,6 +11,9 @@ export declare function FieldHeader({ label, fieldId, fieldLabel, required, fiel
|
|
|
11
11
|
onFieldTypeChange?: (fieldType: QuickFieldType) => void;
|
|
12
12
|
onRequiredChange?: (required: boolean) => void;
|
|
13
13
|
compact?: boolean;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
/** Whether the AI output is described as an expression rather than a value. */
|
|
16
|
+
isExpression: boolean;
|
|
14
17
|
showFieldActions: boolean;
|
|
15
18
|
onValueChange?: (value: string) => void;
|
|
16
19
|
variables: QuickFormFieldOption[];
|
|
@@ -11,7 +11,7 @@ import { AiAssistAction } from "../../field-actions/ai-assist-action.js";
|
|
|
11
11
|
import { COLLAPSED_HIDDEN, COLLAPSED_ICON_PADDING, COLLAPSED_ONLY } from "../../field-actions/collapse.js";
|
|
12
12
|
import { InsertVariableAction } from "../../field-actions/insert-variable-action.js";
|
|
13
13
|
import { FIELD_TYPE_META, FIELD_TYPE_ORDER } from "../types.js";
|
|
14
|
-
function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTypes = FIELD_TYPE_ORDER, onFieldTypeChange, onRequiredChange, compact, showFieldActions, onValueChange, variables, onGenerateWithAi, onInsertVariable, strings, headerActions }) {
|
|
14
|
+
function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTypes = FIELD_TYPE_ORDER, onFieldTypeChange, onRequiredChange, compact, disabled, isExpression, showFieldActions, onValueChange, variables, onGenerateWithAi, onInsertVariable, strings, headerActions }) {
|
|
15
15
|
const [pickerItems, optionsBySelectionId] = useMemo(()=>{
|
|
16
16
|
const byId = new Map();
|
|
17
17
|
const toItem = (v, id)=>{
|
|
@@ -69,7 +69,8 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
|
|
|
69
69
|
children: /*#__PURE__*/ jsxs("button", {
|
|
70
70
|
type: "button",
|
|
71
71
|
"aria-label": strings.fieldTypeAriaLabel,
|
|
72
|
-
|
|
72
|
+
disabled: disabled,
|
|
73
|
+
className: cn('flex h-7 items-center gap-1 rounded-lg px-2 text-[11px] text-foreground-subtle transition hover:bg-surface-overlay hover:text-foreground disabled:pointer-events-none disabled:opacity-50', collapsedPaddingClass),
|
|
73
74
|
children: [
|
|
74
75
|
/*#__PURE__*/ jsx(typeMeta.icon, {
|
|
75
76
|
size: 12
|
|
@@ -127,6 +128,7 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
|
|
|
127
128
|
size: "sm",
|
|
128
129
|
checked: !!required,
|
|
129
130
|
onCheckedChange: onRequiredChange,
|
|
131
|
+
disabled: disabled,
|
|
130
132
|
className: "data-[state=checked]:bg-brand data-[state=unchecked]:bg-foreground-subtle",
|
|
131
133
|
"aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel
|
|
132
134
|
})
|
|
@@ -151,7 +153,8 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
|
|
|
151
153
|
children: /*#__PURE__*/ jsx("button", {
|
|
152
154
|
type: "button",
|
|
153
155
|
"aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel,
|
|
154
|
-
|
|
156
|
+
disabled: disabled,
|
|
157
|
+
className: "grid size-7 place-items-center rounded-lg text-foreground-subtle transition hover:bg-surface-overlay hover:text-foreground disabled:pointer-events-none disabled:opacity-50",
|
|
155
158
|
children: /*#__PURE__*/ jsx(Asterisk, {
|
|
156
159
|
size: 12
|
|
157
160
|
})
|
|
@@ -177,6 +180,7 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
|
|
|
177
180
|
size: "sm",
|
|
178
181
|
checked: !!required,
|
|
179
182
|
onCheckedChange: onRequiredChange,
|
|
183
|
+
disabled: disabled,
|
|
180
184
|
className: "data-[state=checked]:bg-brand data-[state=unchecked]:bg-foreground-subtle",
|
|
181
185
|
"aria-label": required ? strings.requiredAriaLabel : strings.optionalAriaLabel
|
|
182
186
|
})
|
|
@@ -192,7 +196,8 @@ function FieldHeader({ label, fieldId, fieldLabel, required, fieldType, fieldTyp
|
|
|
192
196
|
children: [
|
|
193
197
|
onGenerateWithAi && /*#__PURE__*/ jsx(AiAssistAction, {
|
|
194
198
|
onGenerate: onGenerateWithAi,
|
|
195
|
-
|
|
199
|
+
disabled: disabled,
|
|
200
|
+
hint: strings.aiOutputHint(strings.aiOutputLabel(typeLabel, isExpression)),
|
|
196
201
|
strings: {
|
|
197
202
|
trigger: strings.aiAssistAriaLabel,
|
|
198
203
|
tooltip: strings.aiAssistTooltip,
|
|
@@ -30,8 +30,8 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
|
30
30
|
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
31
31
|
const external_input_group_cjs_namespaceObject = require("../../input-group.cjs");
|
|
32
32
|
const external_tooltip_cjs_namespaceObject = require("../../tooltip.cjs");
|
|
33
|
-
function LockToggleButton({ locked, onLockedChange, strings }) {
|
|
34
|
-
const interactive = !!onLockedChange;
|
|
33
|
+
function LockToggleButton({ locked, onLockedChange, disabled, strings }) {
|
|
34
|
+
const interactive = !!onLockedChange && !disabled;
|
|
35
35
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipProvider, {
|
|
36
36
|
delayDuration: 300,
|
|
37
37
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_tooltip_cjs_namespaceObject.Tooltip, {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { QuickFormFieldStrings } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* The lock/unlock toggle
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* The lock/unlock toggle in the field's leading addon. Disabled (and its label
|
|
4
|
+
* adjusted) with the field, or when onLockedChange isn't provided, since
|
|
5
|
+
* clicking it wouldn't do anything otherwise.
|
|
6
6
|
*/
|
|
7
|
-
export declare function LockToggleButton({ locked, onLockedChange, strings, }: {
|
|
7
|
+
export declare function LockToggleButton({ locked, onLockedChange, disabled, strings, }: {
|
|
8
8
|
locked: boolean;
|
|
9
9
|
onLockedChange?: (locked: boolean) => void;
|
|
10
|
+
disabled?: boolean;
|
|
10
11
|
/** See QuickFormFieldStrings. */
|
|
11
12
|
strings: QuickFormFieldStrings;
|
|
12
13
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,8 +2,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { LockKeyhole, LockKeyholeOpen } from "lucide-react";
|
|
3
3
|
import { InputGroupButton } from "../../input-group.js";
|
|
4
4
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../tooltip.js";
|
|
5
|
-
function LockToggleButton({ locked, onLockedChange, strings }) {
|
|
6
|
-
const interactive = !!onLockedChange;
|
|
5
|
+
function LockToggleButton({ locked, onLockedChange, disabled, strings }) {
|
|
6
|
+
const interactive = !!onLockedChange && !disabled;
|
|
7
7
|
return /*#__PURE__*/ jsx(TooltipProvider, {
|
|
8
8
|
delayDuration: 300,
|
|
9
9
|
children: /*#__PURE__*/ jsxs(Tooltip, {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { QuickFormField } from './quick-form-field';
|
|
2
|
-
export type { QuickFieldType, QuickFormFieldMode, QuickFormFieldMoreActions, QuickFormFieldOption, QuickFormFieldProps, QuickFormFieldStrings, VariableInsertContext, } from './types';
|
|
2
|
+
export type { QuickFieldType, QuickFormFieldControlProps, QuickFormFieldMode, QuickFormFieldMoreActions, QuickFormFieldOption, QuickFormFieldProps, QuickFormFieldStrings, VariableInsertContext, } from './types';
|
|
3
3
|
export { DEFAULT_QUICK_FORM_FIELD_STRINGS, FIELD_TYPE_META, FIELD_TYPE_ORDER } from './types';
|