mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 17:18:32 +02:00
API support for added template functions (eg. cookies)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@yaakapp/api",
|
"name": "@yaakapp/api",
|
||||||
"version": "0.5.3",
|
"version": "0.6.0",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"typings": "./lib/index.d.ts",
|
"typings": "./lib/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@@ -104,7 +104,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type FormInputCheckbox = {
|
export type FormInputCheckbox = {
|
||||||
/**
|
/**
|
||||||
@@ -131,7 +135,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type FormInputEditor = {
|
export type FormInputEditor = {
|
||||||
/**
|
/**
|
||||||
@@ -170,7 +178,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type FormInputFile = {
|
export type FormInputFile = {
|
||||||
/**
|
/**
|
||||||
@@ -205,7 +217,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type FormInputHttpRequest = {
|
export type FormInputHttpRequest = {
|
||||||
/**
|
/**
|
||||||
@@ -232,7 +248,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type FormInputMarkdown = { content: string, hidden?: boolean, };
|
export type FormInputMarkdown = { content: string, hidden?: boolean, };
|
||||||
|
|
||||||
@@ -265,7 +285,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type FormInputSelectOption = { label: string, value: string, };
|
export type FormInputSelectOption = { label: string, value: string, };
|
||||||
|
|
||||||
@@ -306,7 +330,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type GenericCompletionOption = { label: string, detail?: string, info?: string, type?: CompletionOptionType, boost?: number, };
|
export type GenericCompletionOption = { label: string, detail?: string, info?: string, type?: CompletionOptionType, boost?: number, };
|
||||||
|
|
||||||
|
|||||||
@@ -36,9 +36,6 @@ var plugin = {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
async onRender(ctx, args) {
|
async onRender(ctx, args) {
|
||||||
console.log("COOKIE", args.values.cookie_name);
|
|
||||||
const cookies = await ctx.cookies.listNames({});
|
|
||||||
console.log("COOKIES", cookies);
|
|
||||||
return ctx.cookies.getValue({ name: String(args.values.cookie_name) });
|
return ctx.cookies.getValue({ name: String(args.values.cookie_name) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
49
src-tauri/vendored/plugins/template-function-encode/build/index.js
generated
Normal file
49
src-tauri/vendored/plugins/template-function-encode/build/index.js
generated
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
"use strict";
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __export = (target, all) => {
|
||||||
|
for (var name in all)
|
||||||
|
__defProp(target, name, { get: all[name], enumerable: true });
|
||||||
|
};
|
||||||
|
var __copyProps = (to, from, except, desc) => {
|
||||||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||||||
|
for (let key of __getOwnPropNames(from))
|
||||||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||||
|
|
||||||
|
// src/index.ts
|
||||||
|
var src_exports = {};
|
||||||
|
__export(src_exports, {
|
||||||
|
plugin: () => plugin
|
||||||
|
});
|
||||||
|
module.exports = __toCommonJS(src_exports);
|
||||||
|
var plugin = {
|
||||||
|
templateFunctions: [
|
||||||
|
{
|
||||||
|
name: "base64.encode",
|
||||||
|
description: "Encode a value to base64",
|
||||||
|
args: [{ label: "Plain Text", type: "text", name: "value", multiLine: true }],
|
||||||
|
async onRender(_ctx, args) {
|
||||||
|
return Buffer.from(args.values.value ?? "").toString("base64");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "base64.decode",
|
||||||
|
description: "Decode a value from base64",
|
||||||
|
args: [{ label: "Encoded Value", type: "text", name: "value", multiLine: true }],
|
||||||
|
async onRender(_ctx, args) {
|
||||||
|
return Buffer.from(args.values.value ?? "", "base64").toString("utf-8");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
// Annotate the CommonJS export names for ESM import in node:
|
||||||
|
0 && (module.exports = {
|
||||||
|
plugin
|
||||||
|
});
|
||||||
9
src-tauri/vendored/plugins/template-function-encode/package.json
generated
Normal file
9
src-tauri/vendored/plugins/template-function-encode/package.json
generated
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "@yaakapp/template-function-encode",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.1",
|
||||||
|
"scripts": {
|
||||||
|
"build": "yaakcli build ./src/index.ts",
|
||||||
|
"dev": "yaakcli dev ./src/index.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,24 +25,76 @@ __export(src_exports, {
|
|||||||
module.exports = __toCommonJS(src_exports);
|
module.exports = __toCommonJS(src_exports);
|
||||||
var import_node_crypto = require("node:crypto");
|
var import_node_crypto = require("node:crypto");
|
||||||
var algorithms = ["md5", "sha1", "sha256", "sha512"];
|
var algorithms = ["md5", "sha1", "sha256", "sha512"];
|
||||||
var plugin = {
|
var encodings = ["base64", "hex"];
|
||||||
templateFunctions: algorithms.map((algorithm) => ({
|
var hashFunctions = algorithms.map((algorithm) => ({
|
||||||
name: `hash.${algorithm}`,
|
name: `hash.${algorithm}`,
|
||||||
description: "Hash a value to its hexidecimal representation",
|
description: "Hash a value to its hexidecimal representation",
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
name: "input",
|
type: "text",
|
||||||
label: "Input",
|
name: "input",
|
||||||
placeholder: "input text",
|
label: "Input",
|
||||||
type: "text"
|
placeholder: "input text",
|
||||||
}
|
multiLine: true
|
||||||
],
|
},
|
||||||
async onRender(_ctx, args) {
|
{
|
||||||
if (!args.values.input) return "";
|
type: "select",
|
||||||
return (0, import_node_crypto.createHash)(algorithm).update(args.values.input, "utf-8").digest("hex");
|
name: "encoding",
|
||||||
|
label: "Encoding",
|
||||||
|
defaultValue: "base64",
|
||||||
|
options: encodings.map((encoding) => ({
|
||||||
|
label: capitalize(encoding),
|
||||||
|
value: encoding
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
}))
|
],
|
||||||
|
async onRender(_ctx, args) {
|
||||||
|
const input = String(args.values.input);
|
||||||
|
const encoding = String(args.values.encoding);
|
||||||
|
return (0, import_node_crypto.createHash)(algorithm).update(input, "utf-8").digest(encoding);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
var hmacFunctions = algorithms.map((algorithm) => ({
|
||||||
|
name: `hmac.${algorithm}`,
|
||||||
|
description: "Compute the HMAC of a value",
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
name: "input",
|
||||||
|
label: "Input",
|
||||||
|
placeholder: "input text",
|
||||||
|
multiLine: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
name: "key",
|
||||||
|
label: "Key",
|
||||||
|
password: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "select",
|
||||||
|
name: "encoding",
|
||||||
|
label: "Encoding",
|
||||||
|
defaultValue: "base64",
|
||||||
|
options: encodings.map((encoding) => ({
|
||||||
|
value: encoding,
|
||||||
|
label: capitalize(encoding)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
],
|
||||||
|
async onRender(_ctx, args) {
|
||||||
|
const input = String(args.values.input);
|
||||||
|
const key = String(args.values.key);
|
||||||
|
const encoding = String(args.values.encoding);
|
||||||
|
return (0, import_node_crypto.createHmac)(algorithm, key, {}).update(input).digest(encoding);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
var plugin = {
|
||||||
|
templateFunctions: [...hashFunctions, ...hmacFunctions]
|
||||||
};
|
};
|
||||||
|
function capitalize(str) {
|
||||||
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||||
|
}
|
||||||
// Annotate the CommonJS export names for ESM import in node:
|
// Annotate the CommonJS export names for ESM import in node:
|
||||||
0 && (module.exports = {
|
0 && (module.exports = {
|
||||||
plugin
|
plugin
|
||||||
|
|||||||
52
src-tauri/vendored/plugins/template-function-regex/build/index.js
generated
Normal file
52
src-tauri/vendored/plugins/template-function-regex/build/index.js
generated
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
"use strict";
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __export = (target, all) => {
|
||||||
|
for (var name in all)
|
||||||
|
__defProp(target, name, { get: all[name], enumerable: true });
|
||||||
|
};
|
||||||
|
var __copyProps = (to, from, except, desc) => {
|
||||||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||||||
|
for (let key of __getOwnPropNames(from))
|
||||||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||||
|
|
||||||
|
// src/index.ts
|
||||||
|
var src_exports = {};
|
||||||
|
__export(src_exports, {
|
||||||
|
plugin: () => plugin
|
||||||
|
});
|
||||||
|
module.exports = __toCommonJS(src_exports);
|
||||||
|
var plugin = {
|
||||||
|
templateFunctions: [{
|
||||||
|
name: "regex.match",
|
||||||
|
description: "Extract",
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
name: "regex",
|
||||||
|
label: "Regular Expression",
|
||||||
|
placeholder: "^w+=(?<value>w*)$",
|
||||||
|
defaultValue: "^(.*)$",
|
||||||
|
description: "A JavaScript regular expression, evaluated using the Node.js RegExp engine. Capture groups or named groups can be used to extract values."
|
||||||
|
},
|
||||||
|
{ type: "text", name: "input", label: "Input Text", multiLine: true }
|
||||||
|
],
|
||||||
|
async onRender(_ctx, args) {
|
||||||
|
if (!args.values.regex) return "";
|
||||||
|
const regex = new RegExp(String(args.values.regex));
|
||||||
|
const match = args.values.input?.match(regex);
|
||||||
|
return match?.groups ? Object.values(match.groups)[0] ?? "" : match?.[1] ?? match?.[0] ?? "";
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
// Annotate the CommonJS export names for ESM import in node:
|
||||||
|
0 && (module.exports = {
|
||||||
|
plugin
|
||||||
|
});
|
||||||
9
src-tauri/vendored/plugins/template-function-regex/package.json
generated
Normal file
9
src-tauri/vendored/plugins/template-function-regex/package.json
generated
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "@yaakapp/template-function-regex",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.1",
|
||||||
|
"scripts": {
|
||||||
|
"build": "yaakcli build ./src/index.ts",
|
||||||
|
"dev": "yaakcli dev ./src/index.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -401,7 +401,7 @@ impl UpsertModelInfo for WorkspaceMeta {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
||||||
#[ts(export, export_to = "gen_models.ts")]
|
#[ts(export, export_to = "gen_models.ts")]
|
||||||
enum CookieDomain {
|
pub enum CookieDomain {
|
||||||
HostOnly(String),
|
HostOnly(String),
|
||||||
Suffix(String),
|
Suffix(String),
|
||||||
NotPresent,
|
NotPresent,
|
||||||
@@ -410,7 +410,7 @@ enum CookieDomain {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
||||||
#[ts(export, export_to = "gen_models.ts")]
|
#[ts(export, export_to = "gen_models.ts")]
|
||||||
enum CookieExpires {
|
pub enum CookieExpires {
|
||||||
AtUtc(String),
|
AtUtc(String),
|
||||||
SessionEnd,
|
SessionEnd,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type FormInputCheckbox = {
|
export type FormInputCheckbox = {
|
||||||
/**
|
/**
|
||||||
@@ -131,7 +135,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type FormInputEditor = {
|
export type FormInputEditor = {
|
||||||
/**
|
/**
|
||||||
@@ -170,7 +178,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type FormInputFile = {
|
export type FormInputFile = {
|
||||||
/**
|
/**
|
||||||
@@ -205,7 +217,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type FormInputHttpRequest = {
|
export type FormInputHttpRequest = {
|
||||||
/**
|
/**
|
||||||
@@ -232,7 +248,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type FormInputMarkdown = { content: string, hidden?: boolean, };
|
export type FormInputMarkdown = { content: string, hidden?: boolean, };
|
||||||
|
|
||||||
@@ -265,7 +285,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type FormInputSelectOption = { label: string, value: string, };
|
export type FormInputSelectOption = { label: string, value: string, };
|
||||||
|
|
||||||
@@ -306,7 +330,11 @@ hideLabel?: boolean,
|
|||||||
/**
|
/**
|
||||||
* The default value
|
* The default value
|
||||||
*/
|
*/
|
||||||
defaultValue?: string, disabled?: boolean, };
|
defaultValue?: string, disabled?: boolean,
|
||||||
|
/**
|
||||||
|
* Longer description of the input, likely shown in a tooltip
|
||||||
|
*/
|
||||||
|
description?: string, };
|
||||||
|
|
||||||
export type GenericCompletionOption = { label: string, detail?: string, info?: string, type?: CompletionOptionType, boost?: number, };
|
export type GenericCompletionOption = { label: string, detail?: string, info?: string, type?: CompletionOptionType, boost?: number, };
|
||||||
|
|
||||||
|
|||||||
@@ -594,6 +594,10 @@ pub struct FormInputBase {
|
|||||||
|
|
||||||
#[ts(optional)]
|
#[ts(optional)]
|
||||||
pub disabled: Option<bool>,
|
pub disabled: Option<bool>,
|
||||||
|
|
||||||
|
/// Longer description of the input, likely shown in a tooltip
|
||||||
|
#[ts(optional)]
|
||||||
|
pub description: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, Serialize, Deserialize, TS)]
|
#[derive(Debug, Clone, Default, Serialize, Deserialize, TS)]
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ function TextArg({
|
|||||||
defaultValue={value === DYNAMIC_FORM_NULL_ARG ? arg.defaultValue : value}
|
defaultValue={value === DYNAMIC_FORM_NULL_ARG ? arg.defaultValue : value}
|
||||||
required={!arg.optional}
|
required={!arg.optional}
|
||||||
disabled={arg.disabled}
|
disabled={arg.disabled}
|
||||||
|
help={arg.description}
|
||||||
type={arg.password ? 'password' : 'text'}
|
type={arg.password ? 'password' : 'text'}
|
||||||
label={arg.label ?? arg.name}
|
label={arg.label ?? arg.name}
|
||||||
size={INPUT_SIZE}
|
size={INPUT_SIZE}
|
||||||
@@ -278,6 +279,7 @@ function EditorArg({
|
|||||||
htmlFor={id}
|
htmlFor={id}
|
||||||
required={!arg.optional}
|
required={!arg.optional}
|
||||||
visuallyHidden={arg.hideLabel}
|
visuallyHidden={arg.hideLabel}
|
||||||
|
help={arg.description}
|
||||||
tags={arg.language ? [capitalize(arg.language)] : undefined}
|
tags={arg.language ? [capitalize(arg.language)] : undefined}
|
||||||
>
|
>
|
||||||
{arg.label}
|
{arg.label}
|
||||||
@@ -319,6 +321,7 @@ function SelectArg({
|
|||||||
<Select
|
<Select
|
||||||
label={arg.label ?? arg.name}
|
label={arg.label ?? arg.name}
|
||||||
name={arg.name}
|
name={arg.name}
|
||||||
|
help={arg.description}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
hideLabel={arg.hideLabel}
|
hideLabel={arg.hideLabel}
|
||||||
value={value}
|
value={value}
|
||||||
@@ -341,6 +344,7 @@ function FileArg({
|
|||||||
return (
|
return (
|
||||||
<SelectFile
|
<SelectFile
|
||||||
disabled={arg.disabled}
|
disabled={arg.disabled}
|
||||||
|
help={arg.description}
|
||||||
onChange={({ filePath }) => onChange(filePath)}
|
onChange={({ filePath }) => onChange(filePath)}
|
||||||
filePath={filePath === '__NULL__' ? null : filePath}
|
filePath={filePath === '__NULL__' ? null : filePath}
|
||||||
directory={!!arg.directory}
|
directory={!!arg.directory}
|
||||||
@@ -365,6 +369,7 @@ function HttpRequestArg({
|
|||||||
label={arg.label ?? arg.name}
|
label={arg.label ?? arg.name}
|
||||||
name={arg.name}
|
name={arg.name}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
help={arg.description}
|
||||||
value={value}
|
value={value}
|
||||||
disabled={arg.disabled}
|
disabled={arg.disabled}
|
||||||
options={[
|
options={[
|
||||||
@@ -412,6 +417,7 @@ function CheckboxArg({
|
|||||||
<Checkbox
|
<Checkbox
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
checked={value}
|
checked={value}
|
||||||
|
help={arg.description}
|
||||||
disabled={arg.disabled}
|
disabled={arg.disabled}
|
||||||
title={arg.label ?? arg.name}
|
title={arg.label ?? arg.name}
|
||||||
hideLabel={arg.label == null}
|
hideLabel={arg.label == null}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export type InputProps = Pick<
|
|||||||
fullHeight?: boolean;
|
fullHeight?: boolean;
|
||||||
hideLabel?: boolean;
|
hideLabel?: boolean;
|
||||||
inputWrapperClassName?: string;
|
inputWrapperClassName?: string;
|
||||||
|
help?: ReactNode;
|
||||||
label: ReactNode;
|
label: ReactNode;
|
||||||
labelClassName?: string;
|
labelClassName?: string;
|
||||||
labelPosition?: 'top' | 'left';
|
labelPosition?: 'top' | 'left';
|
||||||
@@ -94,33 +95,34 @@ const BaseInput = forwardRef<EditorView, InputProps>(function InputBase(
|
|||||||
{
|
{
|
||||||
className,
|
className,
|
||||||
containerClassName,
|
containerClassName,
|
||||||
inputWrapperClassName,
|
|
||||||
defaultValue,
|
defaultValue,
|
||||||
|
disableObscureToggle,
|
||||||
|
disabled,
|
||||||
forceUpdateKey,
|
forceUpdateKey,
|
||||||
fullHeight,
|
fullHeight,
|
||||||
|
help,
|
||||||
hideLabel,
|
hideLabel,
|
||||||
|
inputWrapperClassName,
|
||||||
label,
|
label,
|
||||||
labelClassName,
|
labelClassName,
|
||||||
labelPosition = 'top',
|
labelPosition = 'top',
|
||||||
leftSlot,
|
leftSlot,
|
||||||
|
multiLine,
|
||||||
onBlur,
|
onBlur,
|
||||||
onChange,
|
onChange,
|
||||||
onFocus,
|
onFocus,
|
||||||
onPaste,
|
onPaste,
|
||||||
onPasteOverwrite,
|
onPasteOverwrite,
|
||||||
placeholder,
|
placeholder,
|
||||||
|
readOnly,
|
||||||
required,
|
required,
|
||||||
rightSlot,
|
rightSlot,
|
||||||
wrapLines,
|
|
||||||
size = 'md',
|
size = 'md',
|
||||||
type = 'text',
|
|
||||||
disableObscureToggle,
|
|
||||||
tint,
|
|
||||||
validate,
|
|
||||||
readOnly,
|
|
||||||
stateKey,
|
stateKey,
|
||||||
multiLine,
|
tint,
|
||||||
disabled,
|
type = 'text',
|
||||||
|
validate,
|
||||||
|
wrapLines,
|
||||||
...props
|
...props
|
||||||
}: InputProps,
|
}: InputProps,
|
||||||
ref,
|
ref,
|
||||||
@@ -216,6 +218,7 @@ const BaseInput = forwardRef<EditorView, InputProps>(function InputBase(
|
|||||||
>
|
>
|
||||||
<Label
|
<Label
|
||||||
htmlFor={id.current}
|
htmlFor={id.current}
|
||||||
|
help={help}
|
||||||
required={required}
|
required={required}
|
||||||
visuallyHidden={hideLabel}
|
visuallyHidden={hideLabel}
|
||||||
className={classNames(labelClassName)}
|
className={classNames(labelClassName)}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export interface SelectProps<T extends string> {
|
|||||||
labelClassName?: string;
|
labelClassName?: string;
|
||||||
hideLabel?: boolean;
|
hideLabel?: boolean;
|
||||||
value: T;
|
value: T;
|
||||||
|
help?: ReactNode;
|
||||||
leftSlot?: ReactNode;
|
leftSlot?: ReactNode;
|
||||||
options: RadioDropdownItem<T>[];
|
options: RadioDropdownItem<T>[];
|
||||||
onChange: (value: T) => void;
|
onChange: (value: T) => void;
|
||||||
@@ -28,6 +29,7 @@ export interface SelectProps<T extends string> {
|
|||||||
export function Select<T extends string>({
|
export function Select<T extends string>({
|
||||||
labelPosition = 'top',
|
labelPosition = 'top',
|
||||||
name,
|
name,
|
||||||
|
help,
|
||||||
labelClassName,
|
labelClassName,
|
||||||
disabled,
|
disabled,
|
||||||
hideLabel,
|
hideLabel,
|
||||||
@@ -59,7 +61,7 @@ export function Select<T extends string>({
|
|||||||
labelPosition === 'top' && 'flex-row gap-0.5',
|
labelPosition === 'top' && 'flex-row gap-0.5',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Label htmlFor={id} visuallyHidden={hideLabel} className={labelClassName}>
|
<Label htmlFor={id} visuallyHidden={hideLabel} className={labelClassName} help={help}>
|
||||||
{label}
|
{label}
|
||||||
</Label>
|
</Label>
|
||||||
{type() === 'macos' ? (
|
{type() === 'macos' ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user