@uipath/apollo-wind 2.56.0 → 2.57.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/combobox.cjs +33 -15
- package/dist/components/ui/combobox.js +33 -15
- package/dist/components/ui/date-picker.cjs +62 -26
- package/dist/components/ui/date-picker.js +62 -26
- package/dist/components/ui/datetime-picker.cjs +29 -12
- package/dist/components/ui/datetime-picker.js +29 -12
- package/dist/components/ui/dropdown-menu.cjs +12 -8
- package/dist/components/ui/dropdown-menu.js +12 -8
- package/dist/components/ui/field-actions/ai-assist-action.cjs +121 -0
- package/dist/components/ui/field-actions/ai-assist-action.d.ts +21 -0
- package/dist/components/ui/field-actions/ai-assist-action.js +84 -0
- package/dist/components/ui/field-actions/collapse.cjs +44 -0
- package/dist/components/ui/field-actions/collapse.d.ts +6 -0
- package/dist/components/ui/field-actions/collapse.js +4 -0
- package/dist/components/ui/field-actions/index.cjs +46 -0
- package/dist/components/ui/field-actions/index.d.ts +2 -0
- package/dist/components/ui/field-actions/index.js +3 -0
- package/dist/components/ui/field-actions/insert-variable-action.cjs +94 -0
- package/dist/components/ui/field-actions/insert-variable-action.d.ts +22 -0
- package/dist/components/ui/field-actions/insert-variable-action.js +57 -0
- package/dist/components/ui/field-addons/index.cjs +50 -0
- package/dist/components/ui/field-addons/index.d.ts +3 -0
- package/dist/components/ui/field-addons/index.js +4 -0
- package/dist/components/ui/field-addons/value-mode-indicator.cjs +57 -0
- package/dist/components/ui/field-addons/value-mode-indicator.d.ts +13 -0
- package/dist/components/ui/field-addons/value-mode-indicator.js +23 -0
- package/dist/components/ui/field-addons/value-mode-menu.cjs +149 -0
- package/dist/components/ui/field-addons/value-mode-menu.d.ts +69 -0
- package/dist/components/ui/field-addons/value-mode-menu.js +112 -0
- package/dist/components/ui/field-addons/value-mode-strings.cjs +69 -0
- package/dist/components/ui/field-addons/value-mode-strings.d.ts +32 -0
- package/dist/components/ui/field-addons/value-mode-strings.js +29 -0
- package/dist/components/ui/form-field.cjs +42 -5
- package/dist/components/ui/form-field.d.ts +21 -1
- package/dist/components/ui/form-field.js +36 -2
- package/dist/components/ui/index.cjs +148 -128
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/index.js +2 -0
- package/dist/components/ui/input-group-context.cjs +91 -0
- package/dist/components/ui/input-group-context.d.ts +69 -0
- package/dist/components/ui/input-group-context.js +42 -0
- package/dist/components/ui/input-group.cjs +303 -56
- package/dist/components/ui/input-group.d.ts +70 -3
- package/dist/components/ui/input-group.js +285 -56
- package/dist/components/ui/input.cjs +28 -17
- package/dist/components/ui/input.js +28 -17
- package/dist/components/ui/lockable-value-field/components/field-header.cjs +16 -114
- package/dist/components/ui/lockable-value-field/components/field-header.js +14 -112
- package/dist/components/ui/lockable-value-field/lockable-value-field.cjs +4 -12
- package/dist/components/ui/lockable-value-field/lockable-value-field.js +4 -12
- package/dist/components/ui/multi-select.cjs +82 -58
- package/dist/components/ui/multi-select.js +84 -60
- package/dist/components/ui/popover.cjs +13 -9
- package/dist/components/ui/popover.js +13 -9
- package/dist/components/ui/select.cjs +89 -27
- package/dist/components/ui/select.d.ts +4 -0
- package/dist/components/ui/select.js +90 -28
- package/dist/components/ui/textarea.cjs +16 -11
- package/dist/components/ui/textarea.js +16 -11
- package/dist/index.cjs +61 -11
- package/dist/index.d.ts +8 -4
- package/dist/index.js +5 -3
- package/dist/styles.css +242 -5
- package/package.json +1 -1
- package/dist/components/ui/lockable-value-field/components/mode-menu-item.cjs +0 -63
- package/dist/components/ui/lockable-value-field/components/mode-menu-item.d.ts +0 -9
- package/dist/components/ui/lockable-value-field/components/mode-menu-item.js +0 -29
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
ValueModeIndicator: ()=>ValueModeIndicator
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_react_namespaceObject = require("react");
|
|
31
|
+
const index_cjs_namespaceObject = require("../../../lib/index.cjs");
|
|
32
|
+
const external_value_mode_strings_cjs_namespaceObject = require("./value-mode-strings.cjs");
|
|
33
|
+
const ValueModeIndicator = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ mode, disabled, className, ...props }, ref)=>{
|
|
34
|
+
const strings = (0, external_value_mode_strings_cjs_namespaceObject.useValueModeStrings)();
|
|
35
|
+
if ('expression' !== mode) return null;
|
|
36
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
37
|
+
ref: ref,
|
|
38
|
+
"data-slot": "value-mode-indicator",
|
|
39
|
+
role: "img",
|
|
40
|
+
"aria-label": strings.expressionIndicator,
|
|
41
|
+
title: strings.expressionIndicator,
|
|
42
|
+
className: (0, index_cjs_namespaceObject.cn)('flex items-center justify-center px-2 font-mono text-sm font-medium text-muted-foreground', disabled && 'opacity-50', className),
|
|
43
|
+
...props,
|
|
44
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
children: "="
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
ValueModeIndicator.displayName = 'ValueModeIndicator';
|
|
51
|
+
exports.ValueModeIndicator = __webpack_exports__.ValueModeIndicator;
|
|
52
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
53
|
+
"ValueModeIndicator"
|
|
54
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
55
|
+
Object.defineProperty(exports, '__esModule', {
|
|
56
|
+
value: true
|
|
57
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ValueMode } from './value-mode-strings';
|
|
3
|
+
export interface ValueModeIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
mode: ValueMode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The `=` ahead of an expression value. Renders nothing in literal mode: its absence is the signal
|
|
9
|
+
* that the value is plain text. `className` takes alignment overrides, such as nudging the glyph
|
|
10
|
+
* onto the first line of a growable editor.
|
|
11
|
+
*/
|
|
12
|
+
declare const ValueModeIndicator: React.ForwardRefExoticComponent<ValueModeIndicatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export { ValueModeIndicator };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "../../../lib/index.js";
|
|
4
|
+
import { useValueModeStrings } from "./value-mode-strings.js";
|
|
5
|
+
const ValueModeIndicator = /*#__PURE__*/ forwardRef(({ mode, disabled, className, ...props }, ref)=>{
|
|
6
|
+
const strings = useValueModeStrings();
|
|
7
|
+
if ('expression' !== mode) return null;
|
|
8
|
+
return /*#__PURE__*/ jsx("div", {
|
|
9
|
+
ref: ref,
|
|
10
|
+
"data-slot": "value-mode-indicator",
|
|
11
|
+
role: "img",
|
|
12
|
+
"aria-label": strings.expressionIndicator,
|
|
13
|
+
title: strings.expressionIndicator,
|
|
14
|
+
className: cn('flex items-center justify-center px-2 font-mono text-sm font-medium text-muted-foreground', disabled && 'opacity-50', className),
|
|
15
|
+
...props,
|
|
16
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
17
|
+
"aria-hidden": "true",
|
|
18
|
+
children: "="
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
ValueModeIndicator.displayName = 'ValueModeIndicator';
|
|
23
|
+
export { ValueModeIndicator };
|
|
@@ -0,0 +1,149 @@
|
|
|
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
|
+
ValueModeMenu: ()=>ValueModeMenu,
|
|
28
|
+
ValueModeMenuItem: ()=>ValueModeMenuItem
|
|
29
|
+
});
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
32
|
+
const external_button_cjs_namespaceObject = require("../button.cjs");
|
|
33
|
+
const external_dropdown_menu_cjs_namespaceObject = require("../dropdown-menu.cjs");
|
|
34
|
+
const index_cjs_namespaceObject = require("../../../lib/index.cjs");
|
|
35
|
+
const external_value_mode_strings_cjs_namespaceObject = require("./value-mode-strings.cjs");
|
|
36
|
+
function literalDescriptionFor(expectedType, strings) {
|
|
37
|
+
if ('number' === expectedType) return strings.literalNumberDescription;
|
|
38
|
+
if ('boolean' === expectedType) return strings.literalBooleanDescription;
|
|
39
|
+
return strings.literalDescription;
|
|
40
|
+
}
|
|
41
|
+
function ValueModeMenuItem({ icon: Icon, label, description, active, disabled, onClick }) {
|
|
42
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuItem, {
|
|
43
|
+
role: "menuitemradio",
|
|
44
|
+
"aria-checked": active,
|
|
45
|
+
className: "flex-col items-start gap-0.5 py-2",
|
|
46
|
+
"data-active": active || void 0,
|
|
47
|
+
disabled: disabled,
|
|
48
|
+
onClick: onClick,
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
51
|
+
className: "flex items-center gap-2",
|
|
52
|
+
children: [
|
|
53
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Icon, {
|
|
54
|
+
size: 13,
|
|
55
|
+
className: active ? 'text-brand' : 'text-foreground-muted'
|
|
56
|
+
}),
|
|
57
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
58
|
+
className: (0, index_cjs_namespaceObject.cn)('text-xs font-medium', active ? 'text-brand' : 'text-foreground'),
|
|
59
|
+
children: label
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
}),
|
|
63
|
+
description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
64
|
+
className: "pl-6 text-[11px] leading-4 text-foreground-subtle",
|
|
65
|
+
children: description
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function ValueModeMenu({ mode, onSelect, modes, extraModes, actions, checked, modesDisabled, disabled, expectedType, literalDescription }) {
|
|
71
|
+
const strings = (0, external_value_mode_strings_cjs_namespaceObject.useValueModeStrings)();
|
|
72
|
+
const checkedMode = checked ?? mode;
|
|
73
|
+
const baseModes = modes ?? [
|
|
74
|
+
{
|
|
75
|
+
id: 'literal',
|
|
76
|
+
title: strings.literalTitle,
|
|
77
|
+
description: literalDescription ?? literalDescriptionFor(expectedType, strings),
|
|
78
|
+
icon: external_lucide_react_namespaceObject.Type
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'expression',
|
|
82
|
+
title: strings.expressionTitle,
|
|
83
|
+
description: strings.expressionDescription,
|
|
84
|
+
icon: external_lucide_react_namespaceObject.SquareFunction
|
|
85
|
+
}
|
|
86
|
+
];
|
|
87
|
+
const resolvedModes = extraModes ? [
|
|
88
|
+
...extraModes,
|
|
89
|
+
...baseModes
|
|
90
|
+
] : baseModes;
|
|
91
|
+
const activeMode = resolvedModes.find((item)=>item.id === mode);
|
|
92
|
+
const TriggerIcon = modesDisabled ? external_lucide_react_namespaceObject.MoreHorizontal : activeMode?.icon ?? external_lucide_react_namespaceObject.Type;
|
|
93
|
+
const triggerLabel = modesDisabled ? strings.fieldActions : activeMode?.title ?? strings.literalTitle;
|
|
94
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenu, {
|
|
95
|
+
children: [
|
|
96
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuTrigger, {
|
|
97
|
+
asChild: true,
|
|
98
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
|
|
99
|
+
type: "button",
|
|
100
|
+
variant: "ghost",
|
|
101
|
+
size: "3xs",
|
|
102
|
+
disabled: disabled,
|
|
103
|
+
"aria-label": triggerLabel,
|
|
104
|
+
className: "size-6 shrink-0 rounded-md p-0 text-muted-foreground hover:bg-accent hover:text-foreground [&_svg]:size-3.5",
|
|
105
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TriggerIcon, {})
|
|
106
|
+
})
|
|
107
|
+
}),
|
|
108
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuContent, {
|
|
109
|
+
align: "end",
|
|
110
|
+
className: "w-56",
|
|
111
|
+
children: [
|
|
112
|
+
!modesDisabled && resolvedModes.map((item)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ValueModeMenuItem, {
|
|
113
|
+
icon: item.icon,
|
|
114
|
+
label: item.title,
|
|
115
|
+
description: item.description,
|
|
116
|
+
active: checkedMode === item.id,
|
|
117
|
+
disabled: item.disabled,
|
|
118
|
+
onClick: ()=>onSelect(item.id)
|
|
119
|
+
}, item.id)),
|
|
120
|
+
!modesDisabled && !!actions?.length && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuSeparator, {}),
|
|
121
|
+
actions?.map((action)=>{
|
|
122
|
+
const ActionIcon = action.icon;
|
|
123
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenuItem, {
|
|
124
|
+
disabled: action.disabled,
|
|
125
|
+
onClick: action.onSelect,
|
|
126
|
+
children: [
|
|
127
|
+
ActionIcon ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ActionIcon, {}) : action.iconDataUri && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
|
|
128
|
+
src: action.iconDataUri,
|
|
129
|
+
alt: "",
|
|
130
|
+
className: "size-4 shrink-0"
|
|
131
|
+
}),
|
|
132
|
+
action.label
|
|
133
|
+
]
|
|
134
|
+
}, action.id);
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
})
|
|
138
|
+
]
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
exports.ValueModeMenu = __webpack_exports__.ValueModeMenu;
|
|
142
|
+
exports.ValueModeMenuItem = __webpack_exports__.ValueModeMenuItem;
|
|
143
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
144
|
+
"ValueModeMenu",
|
|
145
|
+
"ValueModeMenuItem"
|
|
146
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
147
|
+
Object.defineProperty(exports, '__esModule', {
|
|
148
|
+
value: true
|
|
149
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type LucideIcon } from 'lucide-react';
|
|
2
|
+
import { type ValueMode } from './value-mode-strings';
|
|
3
|
+
/** One selectable mode. `id` is the consumer's own vocabulary. */
|
|
4
|
+
export interface ValueModeOption<Id extends string = string> {
|
|
5
|
+
id: Id;
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
icon: LucideIcon;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** A field-supplied action listed under the modes, such as Clear value. */
|
|
12
|
+
export interface ValueModeMenuAction {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
icon?: LucideIcon;
|
|
16
|
+
/** Icon as a data URI, used when `icon` is absent. */
|
|
17
|
+
iconDataUri?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
onSelect: () => void;
|
|
20
|
+
}
|
|
21
|
+
interface ValueModeMenuBaseProps<Id extends string> {
|
|
22
|
+
mode: Id;
|
|
23
|
+
onSelect: (mode: Id) => void;
|
|
24
|
+
/** Listed before `modes` (or the built-in pair). */
|
|
25
|
+
extraModes?: ValueModeOption<Id>[];
|
|
26
|
+
/** Listed below the modes, behind a separator. */
|
|
27
|
+
actions?: ValueModeMenuAction[];
|
|
28
|
+
/** The item to mark active when it differs from `mode`; `'none'` marks neither. */
|
|
29
|
+
checked?: Id | 'none';
|
|
30
|
+
/** Hides the modes and shows only `actions`, under an overflow trigger rather than a mode glyph. */
|
|
31
|
+
modesDisabled?: boolean;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
/** Picks the built-in Fixed value description (`number`, `boolean`, anything else). */
|
|
34
|
+
expectedType?: string;
|
|
35
|
+
/** Overrides the built-in Fixed value description. */
|
|
36
|
+
literalDescription?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* `modes` may be omitted when `Id` is the built-in modes, or one of them as `mode="literal"` infers,
|
|
40
|
+
* or includes both. The menu then falls back to them and calls `onSelect` with either. Other ids,
|
|
41
|
+
* such as `'fixed' | 'expr'`, must bring their own `modes`.
|
|
42
|
+
*/
|
|
43
|
+
export type ValueModeMenuProps<Id extends string = ValueMode> = ValueModeMenuBaseProps<Id> & ([Id] extends [ValueMode] ? BuiltInModes<Id> : [ValueMode] extends [Id] ? BuiltInModes<Id> : OwnModes<Id>);
|
|
44
|
+
type BuiltInModes<Id extends string> = {
|
|
45
|
+
/** The mode list. Omitted, it is the built-in Fixed value / Expression pair. */
|
|
46
|
+
modes?: ValueModeOption<Id>[];
|
|
47
|
+
};
|
|
48
|
+
type OwnModes<Id extends string> = {
|
|
49
|
+
/** The mode list. */
|
|
50
|
+
modes: ValueModeOption<Id>[];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* One selectable mode in a value-mode dropdown: icon and label, with an optional description.
|
|
54
|
+
* Shared with LockableValueField's mode dropdown, and not exported from the package.
|
|
55
|
+
*/
|
|
56
|
+
export declare function ValueModeMenuItem({ icon: Icon, label, description, active, disabled, onClick, }: {
|
|
57
|
+
icon: LucideIcon;
|
|
58
|
+
label: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
active: boolean;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
onClick: () => void;
|
|
63
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
/**
|
|
65
|
+
* Switches a field between value modes. The trigger shows the current mode's icon and is named by
|
|
66
|
+
* its title; the menu lists each mode with its description, then any field actions.
|
|
67
|
+
*/
|
|
68
|
+
export declare function ValueModeMenu<Id extends string = ValueMode>({ mode, onSelect, modes, extraModes, actions, checked, modesDisabled, disabled, expectedType, literalDescription, }: ValueModeMenuProps<Id>): import("react/jsx-runtime").JSX.Element;
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { MoreHorizontal, SquareFunction, Type } from "lucide-react";
|
|
3
|
+
import { Button } from "../button.js";
|
|
4
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../dropdown-menu.js";
|
|
5
|
+
import { cn } from "../../../lib/index.js";
|
|
6
|
+
import { useValueModeStrings } from "./value-mode-strings.js";
|
|
7
|
+
function literalDescriptionFor(expectedType, strings) {
|
|
8
|
+
if ('number' === expectedType) return strings.literalNumberDescription;
|
|
9
|
+
if ('boolean' === expectedType) return strings.literalBooleanDescription;
|
|
10
|
+
return strings.literalDescription;
|
|
11
|
+
}
|
|
12
|
+
function ValueModeMenuItem({ icon: Icon, label, description, active, disabled, onClick }) {
|
|
13
|
+
return /*#__PURE__*/ jsxs(DropdownMenuItem, {
|
|
14
|
+
role: "menuitemradio",
|
|
15
|
+
"aria-checked": active,
|
|
16
|
+
className: "flex-col items-start gap-0.5 py-2",
|
|
17
|
+
"data-active": active || void 0,
|
|
18
|
+
disabled: disabled,
|
|
19
|
+
onClick: onClick,
|
|
20
|
+
children: [
|
|
21
|
+
/*#__PURE__*/ jsxs("div", {
|
|
22
|
+
className: "flex items-center gap-2",
|
|
23
|
+
children: [
|
|
24
|
+
/*#__PURE__*/ jsx(Icon, {
|
|
25
|
+
size: 13,
|
|
26
|
+
className: active ? 'text-brand' : 'text-foreground-muted'
|
|
27
|
+
}),
|
|
28
|
+
/*#__PURE__*/ jsx("span", {
|
|
29
|
+
className: cn('text-xs font-medium', active ? 'text-brand' : 'text-foreground'),
|
|
30
|
+
children: label
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
}),
|
|
34
|
+
description && /*#__PURE__*/ jsx("span", {
|
|
35
|
+
className: "pl-6 text-[11px] leading-4 text-foreground-subtle",
|
|
36
|
+
children: description
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function ValueModeMenu({ mode, onSelect, modes, extraModes, actions, checked, modesDisabled, disabled, expectedType, literalDescription }) {
|
|
42
|
+
const strings = useValueModeStrings();
|
|
43
|
+
const checkedMode = checked ?? mode;
|
|
44
|
+
const baseModes = modes ?? [
|
|
45
|
+
{
|
|
46
|
+
id: 'literal',
|
|
47
|
+
title: strings.literalTitle,
|
|
48
|
+
description: literalDescription ?? literalDescriptionFor(expectedType, strings),
|
|
49
|
+
icon: Type
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'expression',
|
|
53
|
+
title: strings.expressionTitle,
|
|
54
|
+
description: strings.expressionDescription,
|
|
55
|
+
icon: SquareFunction
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
const resolvedModes = extraModes ? [
|
|
59
|
+
...extraModes,
|
|
60
|
+
...baseModes
|
|
61
|
+
] : baseModes;
|
|
62
|
+
const activeMode = resolvedModes.find((item)=>item.id === mode);
|
|
63
|
+
const TriggerIcon = modesDisabled ? MoreHorizontal : activeMode?.icon ?? Type;
|
|
64
|
+
const triggerLabel = modesDisabled ? strings.fieldActions : activeMode?.title ?? strings.literalTitle;
|
|
65
|
+
return /*#__PURE__*/ jsxs(DropdownMenu, {
|
|
66
|
+
children: [
|
|
67
|
+
/*#__PURE__*/ jsx(DropdownMenuTrigger, {
|
|
68
|
+
asChild: true,
|
|
69
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
70
|
+
type: "button",
|
|
71
|
+
variant: "ghost",
|
|
72
|
+
size: "3xs",
|
|
73
|
+
disabled: disabled,
|
|
74
|
+
"aria-label": triggerLabel,
|
|
75
|
+
className: "size-6 shrink-0 rounded-md p-0 text-muted-foreground hover:bg-accent hover:text-foreground [&_svg]:size-3.5",
|
|
76
|
+
children: /*#__PURE__*/ jsx(TriggerIcon, {})
|
|
77
|
+
})
|
|
78
|
+
}),
|
|
79
|
+
/*#__PURE__*/ jsxs(DropdownMenuContent, {
|
|
80
|
+
align: "end",
|
|
81
|
+
className: "w-56",
|
|
82
|
+
children: [
|
|
83
|
+
!modesDisabled && resolvedModes.map((item)=>/*#__PURE__*/ jsx(ValueModeMenuItem, {
|
|
84
|
+
icon: item.icon,
|
|
85
|
+
label: item.title,
|
|
86
|
+
description: item.description,
|
|
87
|
+
active: checkedMode === item.id,
|
|
88
|
+
disabled: item.disabled,
|
|
89
|
+
onClick: ()=>onSelect(item.id)
|
|
90
|
+
}, item.id)),
|
|
91
|
+
!modesDisabled && !!actions?.length && /*#__PURE__*/ jsx(DropdownMenuSeparator, {}),
|
|
92
|
+
actions?.map((action)=>{
|
|
93
|
+
const ActionIcon = action.icon;
|
|
94
|
+
return /*#__PURE__*/ jsxs(DropdownMenuItem, {
|
|
95
|
+
disabled: action.disabled,
|
|
96
|
+
onClick: action.onSelect,
|
|
97
|
+
children: [
|
|
98
|
+
ActionIcon ? /*#__PURE__*/ jsx(ActionIcon, {}) : action.iconDataUri && /*#__PURE__*/ jsx("img", {
|
|
99
|
+
src: action.iconDataUri,
|
|
100
|
+
alt: "",
|
|
101
|
+
className: "size-4 shrink-0"
|
|
102
|
+
}),
|
|
103
|
+
action.label
|
|
104
|
+
]
|
|
105
|
+
}, action.id);
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
export { ValueModeMenu, ValueModeMenuItem };
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
DEFAULT_VALUE_MODE_STRINGS: ()=>DEFAULT_VALUE_MODE_STRINGS,
|
|
28
|
+
ValueModeStringsProvider: ()=>ValueModeStringsProvider,
|
|
29
|
+
useValueModeStrings: ()=>useValueModeStrings
|
|
30
|
+
});
|
|
31
|
+
const external_react_namespaceObject = require("react");
|
|
32
|
+
const DEFAULT_VALUE_MODE_STRINGS = {
|
|
33
|
+
literalTitle: 'Fixed value',
|
|
34
|
+
literalDescription: 'Enter a value directly',
|
|
35
|
+
literalNumberDescription: 'Enter a numeric value',
|
|
36
|
+
literalBooleanDescription: 'Select true or false',
|
|
37
|
+
expressionTitle: 'Expression',
|
|
38
|
+
expressionDescription: 'JavaScript expression with IntelliSense',
|
|
39
|
+
fieldActions: 'Field actions',
|
|
40
|
+
expressionIndicator: 'JavaScript expression'
|
|
41
|
+
};
|
|
42
|
+
const ValueModeStringsContext = (0, external_react_namespaceObject.createContext)(DEFAULT_VALUE_MODE_STRINGS);
|
|
43
|
+
function ValueModeStringsProvider({ strings, children }) {
|
|
44
|
+
const parent = (0, external_react_namespaceObject.useContext)(ValueModeStringsContext);
|
|
45
|
+
const value = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
46
|
+
...parent,
|
|
47
|
+
...strings
|
|
48
|
+
}), [
|
|
49
|
+
parent,
|
|
50
|
+
strings
|
|
51
|
+
]);
|
|
52
|
+
return (0, external_react_namespaceObject.createElement)(ValueModeStringsContext.Provider, {
|
|
53
|
+
value
|
|
54
|
+
}, children);
|
|
55
|
+
}
|
|
56
|
+
function useValueModeStrings() {
|
|
57
|
+
return (0, external_react_namespaceObject.useContext)(ValueModeStringsContext);
|
|
58
|
+
}
|
|
59
|
+
exports.DEFAULT_VALUE_MODE_STRINGS = __webpack_exports__.DEFAULT_VALUE_MODE_STRINGS;
|
|
60
|
+
exports.ValueModeStringsProvider = __webpack_exports__.ValueModeStringsProvider;
|
|
61
|
+
exports.useValueModeStrings = __webpack_exports__.useValueModeStrings;
|
|
62
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
63
|
+
"DEFAULT_VALUE_MODE_STRINGS",
|
|
64
|
+
"ValueModeStringsProvider",
|
|
65
|
+
"useValueModeStrings"
|
|
66
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
67
|
+
Object.defineProperty(exports, '__esModule', {
|
|
68
|
+
value: true
|
|
69
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/** The built-in value modes: a value typed as-is, or an expression evaluated at run time. */
|
|
3
|
+
export type ValueMode = 'literal' | 'expression';
|
|
4
|
+
/** Every string the value-mode primitives render. apollo-wind has no i18n runtime, so a localized
|
|
5
|
+
* host passes its own translations through {@link ValueModeStringsProvider}. */
|
|
6
|
+
export interface ValueModeStrings {
|
|
7
|
+
/** The literal mode's name, the same for every value type. */
|
|
8
|
+
literalTitle: string;
|
|
9
|
+
/** The literal mode's description when the value type is not number or boolean. */
|
|
10
|
+
literalDescription: string;
|
|
11
|
+
literalNumberDescription: string;
|
|
12
|
+
literalBooleanDescription: string;
|
|
13
|
+
expressionTitle: string;
|
|
14
|
+
expressionDescription: string;
|
|
15
|
+
/** Names the menu trigger when it offers only actions and no modes. */
|
|
16
|
+
fieldActions: string;
|
|
17
|
+
/** Hover text on the `=` indicator. */
|
|
18
|
+
expressionIndicator: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const DEFAULT_VALUE_MODE_STRINGS: ValueModeStrings;
|
|
21
|
+
export interface ValueModeStringsProviderProps {
|
|
22
|
+
/**
|
|
23
|
+
* Overrides for any subset of the English defaults. Keep the object stable, such as a module
|
|
24
|
+
* constant or a memoized value: a new object each render re-renders every value-mode primitive.
|
|
25
|
+
*/
|
|
26
|
+
strings: Partial<ValueModeStrings>;
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/** Supplies translated strings to every value-mode primitive below it. */
|
|
30
|
+
export declare function ValueModeStringsProvider({ strings, children }: ValueModeStringsProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<ValueModeStrings>>;
|
|
31
|
+
/** The strings in effect: the nearest provider's, merged over the English defaults. */
|
|
32
|
+
export declare function useValueModeStrings(): ValueModeStrings;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createContext, createElement, useContext, useMemo } from "react";
|
|
2
|
+
const DEFAULT_VALUE_MODE_STRINGS = {
|
|
3
|
+
literalTitle: 'Fixed value',
|
|
4
|
+
literalDescription: 'Enter a value directly',
|
|
5
|
+
literalNumberDescription: 'Enter a numeric value',
|
|
6
|
+
literalBooleanDescription: 'Select true or false',
|
|
7
|
+
expressionTitle: 'Expression',
|
|
8
|
+
expressionDescription: 'JavaScript expression with IntelliSense',
|
|
9
|
+
fieldActions: 'Field actions',
|
|
10
|
+
expressionIndicator: 'JavaScript expression'
|
|
11
|
+
};
|
|
12
|
+
const ValueModeStringsContext = createContext(DEFAULT_VALUE_MODE_STRINGS);
|
|
13
|
+
function ValueModeStringsProvider({ strings, children }) {
|
|
14
|
+
const parent = useContext(ValueModeStringsContext);
|
|
15
|
+
const value = useMemo(()=>({
|
|
16
|
+
...parent,
|
|
17
|
+
...strings
|
|
18
|
+
}), [
|
|
19
|
+
parent,
|
|
20
|
+
strings
|
|
21
|
+
]);
|
|
22
|
+
return createElement(ValueModeStringsContext.Provider, {
|
|
23
|
+
value
|
|
24
|
+
}, children);
|
|
25
|
+
}
|
|
26
|
+
function useValueModeStrings() {
|
|
27
|
+
return useContext(ValueModeStringsContext);
|
|
28
|
+
}
|
|
29
|
+
export { DEFAULT_VALUE_MODE_STRINGS, ValueModeStringsProvider, useValueModeStrings };
|
|
@@ -24,6 +24,7 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
FormFieldHeader: ()=>FormFieldHeader,
|
|
27
28
|
FormFieldLabel: ()=>FormFieldLabel,
|
|
28
29
|
FormFieldError: ()=>FormFieldError,
|
|
29
30
|
FormFieldDescription: ()=>FormFieldDescription,
|
|
@@ -33,11 +34,12 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
|
33
34
|
const external_react_namespaceObject = require("react");
|
|
34
35
|
const external_info_tooltip_cjs_namespaceObject = require("./info-tooltip.cjs");
|
|
35
36
|
const external_label_cjs_namespaceObject = require("./label.cjs");
|
|
36
|
-
const index_cjs_namespaceObject = require("
|
|
37
|
+
const index_cjs_namespaceObject = require("./layout/index.cjs");
|
|
38
|
+
const external_lib_index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
37
39
|
const FormField = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ children, className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
38
40
|
ref: ref,
|
|
39
41
|
"data-slot": "form-field",
|
|
40
|
-
className: (0,
|
|
42
|
+
className: (0, external_lib_index_cjs_namespaceObject.cn)('grid grid-cols-[minmax(0,1fr)] gap-1.5 [&>[data-slot=form-field-error]]:mt-0', className),
|
|
41
43
|
...props,
|
|
42
44
|
children: children
|
|
43
45
|
}));
|
|
@@ -53,7 +55,8 @@ const FormFieldLabel = /*#__PURE__*/ external_react_namespaceObject.forwardRef((
|
|
|
53
55
|
required && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_label_cjs_namespaceObject.RequiredIndicator, {})
|
|
54
56
|
]
|
|
55
57
|
});
|
|
56
|
-
|
|
58
|
+
const blank = 'string' == typeof tooltip && !tooltip.trim();
|
|
59
|
+
if (null == tooltip || false === tooltip || blank) return label;
|
|
57
60
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
|
|
58
61
|
className: "inline-flex items-center",
|
|
59
62
|
children: [
|
|
@@ -71,7 +74,7 @@ const FormFieldDescription = /*#__PURE__*/ external_react_namespaceObject.forwar
|
|
|
71
74
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
72
75
|
ref: ref,
|
|
73
76
|
"data-slot": "form-field-description",
|
|
74
|
-
className: (0,
|
|
77
|
+
className: (0, external_lib_index_cjs_namespaceObject.cn)('text-xs leading-4 text-foreground-muted', className),
|
|
75
78
|
...props,
|
|
76
79
|
children: children
|
|
77
80
|
});
|
|
@@ -83,21 +86,55 @@ const FormFieldError = /*#__PURE__*/ external_react_namespaceObject.forwardRef((
|
|
|
83
86
|
ref: ref,
|
|
84
87
|
"aria-live": "polite",
|
|
85
88
|
"aria-atomic": "true",
|
|
86
|
-
className: (0,
|
|
89
|
+
className: (0, external_lib_index_cjs_namespaceObject.cn)('text-xs leading-4 text-error mt-1.5', className),
|
|
87
90
|
...props,
|
|
88
91
|
"data-slot": "form-field-error",
|
|
89
92
|
children: children
|
|
90
93
|
});
|
|
91
94
|
});
|
|
92
95
|
FormFieldError.displayName = 'FormFieldError';
|
|
96
|
+
const FormFieldHeader = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ label, htmlFor, required, tooltip, tooltipAriaLabel, leading, badge, actions, variant = 'default', className, ...props }, ref)=>{
|
|
97
|
+
if (!label && !actions) return null;
|
|
98
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
99
|
+
ref: ref,
|
|
100
|
+
"data-slot": "form-field-header",
|
|
101
|
+
className: (0, external_lib_index_cjs_namespaceObject.cn)('@container flex min-h-6 items-center justify-between gap-2', className),
|
|
102
|
+
...props,
|
|
103
|
+
children: [
|
|
104
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
105
|
+
className: "flex min-w-0 items-center gap-2",
|
|
106
|
+
children: [
|
|
107
|
+
leading,
|
|
108
|
+
label && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FormFieldLabel, {
|
|
109
|
+
htmlFor: htmlFor,
|
|
110
|
+
required: required,
|
|
111
|
+
tooltip: tooltip,
|
|
112
|
+
tooltipAriaLabel: tooltipAriaLabel,
|
|
113
|
+
variant: variant,
|
|
114
|
+
children: label
|
|
115
|
+
}),
|
|
116
|
+
badge
|
|
117
|
+
]
|
|
118
|
+
}),
|
|
119
|
+
actions && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.Row, {
|
|
120
|
+
align: "center",
|
|
121
|
+
gap: 1,
|
|
122
|
+
children: actions
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
FormFieldHeader.displayName = 'FormFieldHeader';
|
|
93
128
|
exports.FormField = __webpack_exports__.FormField;
|
|
94
129
|
exports.FormFieldDescription = __webpack_exports__.FormFieldDescription;
|
|
95
130
|
exports.FormFieldError = __webpack_exports__.FormFieldError;
|
|
131
|
+
exports.FormFieldHeader = __webpack_exports__.FormFieldHeader;
|
|
96
132
|
exports.FormFieldLabel = __webpack_exports__.FormFieldLabel;
|
|
97
133
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
98
134
|
"FormField",
|
|
99
135
|
"FormFieldDescription",
|
|
100
136
|
"FormFieldError",
|
|
137
|
+
"FormFieldHeader",
|
|
101
138
|
"FormFieldLabel"
|
|
102
139
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
103
140
|
Object.defineProperty(exports, '__esModule', {
|