@invana/forms 0.0.25 → 0.0.27
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/index.cjs +82 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -1
- package/dist/index.d.ts +58 -1
- package/dist/index.js +81 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -371,6 +371,63 @@ declare function FieldError({ className, children, errors, ...props }: React.Com
|
|
|
371
371
|
} | undefined>;
|
|
372
372
|
}): React$1.JSX.Element | null;
|
|
373
373
|
|
|
374
|
+
/**
|
|
375
|
+
* Where a parameter's value comes from.
|
|
376
|
+
*
|
|
377
|
+
* The three are not styles of the same thing — they decide *when* the value is
|
|
378
|
+
* known. A literal is known now; an argument is known when a run is started; a
|
|
379
|
+
* binding is known only once an earlier task has produced it.
|
|
380
|
+
*/
|
|
381
|
+
type ParamSource = "literal" | "argument" | "binding";
|
|
382
|
+
declare const PARAM_SOURCES: ParamSource[];
|
|
383
|
+
interface ParamRowProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
384
|
+
/** The parameter's name, as the contract spells it — `batch_size`, `map_over`. */
|
|
385
|
+
name: string;
|
|
386
|
+
/** Its type and obligation, from the contract — `str · required`, `int · optional`. */
|
|
387
|
+
type?: React$1.ReactNode;
|
|
388
|
+
/** Which of the three the current value is. */
|
|
389
|
+
source: ParamSource;
|
|
390
|
+
onSourceChange?: (source: ParamSource) => void;
|
|
391
|
+
/** The value itself — a literal, `${args.model}`, `${steps.x.rows}`. */
|
|
392
|
+
value: string;
|
|
393
|
+
onValueChange?: (value: string) => void;
|
|
394
|
+
/**
|
|
395
|
+
* What the reader needs to know that the value does not say — what a binding
|
|
396
|
+
* will resolve to, which alternatives an enum allows, why a default was left
|
|
397
|
+
* alone. Rendered as the error when `invalid` is set.
|
|
398
|
+
*/
|
|
399
|
+
note?: React$1.ReactNode;
|
|
400
|
+
/** The value does not resolve, or the contract refuses it. Reddens the control and the note. */
|
|
401
|
+
invalid?: boolean;
|
|
402
|
+
/**
|
|
403
|
+
* The parameter is not in play — a `when` on a task that always runs. Shown
|
|
404
|
+
* rather than hidden, because a contract's full surface is the point of the
|
|
405
|
+
* form.
|
|
406
|
+
*/
|
|
407
|
+
disabled?: boolean;
|
|
408
|
+
/** Replaces the value control entirely, for a parameter that needs its own editor. */
|
|
409
|
+
children?: React$1.ReactNode;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* One parameter of a task, as a row: what it is called, where its value comes
|
|
413
|
+
* from, what the value is, and what that means.
|
|
414
|
+
*
|
|
415
|
+
* The form these rows make **is** the catalogue contract — the fields, their
|
|
416
|
+
* types and their obligations are read off the entry, never authored here. So a
|
|
417
|
+
* row takes a descriptor rather than children, and a parameter the contract
|
|
418
|
+
* does not declare has no way to appear.
|
|
419
|
+
*
|
|
420
|
+
* `source` and `value` are one control, joined, because they are one decision.
|
|
421
|
+
* Split into two fields they read as two questions, and a reader can end up
|
|
422
|
+
* with `literal` selected beside a value that is plainly a binding.
|
|
423
|
+
*
|
|
424
|
+
* Not a `Field`. That one lays out a label, a control and a description for a
|
|
425
|
+
* form a person fills in from nothing; this lays out a *contract* — the label
|
|
426
|
+
* column carries a type, and the description usually explains a value the
|
|
427
|
+
* person did not type.
|
|
428
|
+
*/
|
|
429
|
+
declare const ParamRow: React$1.ForwardRefExoticComponent<ParamRowProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
430
|
+
|
|
374
431
|
declare function InputGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
375
432
|
declare const inputGroupAddonVariants: (props?: ({
|
|
376
433
|
align?: "inline-end" | "inline-start" | "block-end" | "block-start" | null | undefined;
|
|
@@ -384,4 +441,4 @@ declare function InputGroupText({ className, ...props }: React$1.ComponentProps<
|
|
|
384
441
|
declare function InputGroupInput({ className, ...props }: React$1.ComponentProps<"input">): React$1.JSX.Element;
|
|
385
442
|
declare function InputGroupTextarea({ className, ...props }: React$1.ComponentProps<"textarea">): React$1.JSX.Element;
|
|
386
443
|
|
|
387
|
-
export { type BooleanControl, BooleanField, Checkbox, CheckboxGroupField, ColorField, type ColorPreset, ColorSwatches, Field, type FieldBadge, type FieldConfig, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldOrientation, FieldSeparator, FieldSet, type FieldSize, FieldTitle, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GroupConfig, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputSize, Label, type LabelPosition, NumberField, ObjectField, type ObjectFieldProps, PasswordField, PasswordInput, type PasswordInputProps, RadioField, RadioGroup, RadioGroupItem, type RowConfig, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, type SettingsPanelProps, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
|
|
444
|
+
export { type BooleanControl, BooleanField, Checkbox, CheckboxGroupField, ColorField, type ColorPreset, ColorSwatches, Field, type FieldBadge, type FieldConfig, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldOrientation, FieldSeparator, FieldSet, type FieldSize, FieldTitle, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GroupConfig, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputSize, Label, type LabelPosition, NumberField, ObjectField, type ObjectFieldProps, PARAM_SOURCES, ParamRow, type ParamRowProps, type ParamSource, PasswordField, PasswordInput, type PasswordInputProps, RadioField, RadioGroup, RadioGroupItem, type RowConfig, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, type SettingsPanelProps, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
|
package/dist/index.d.ts
CHANGED
|
@@ -371,6 +371,63 @@ declare function FieldError({ className, children, errors, ...props }: React.Com
|
|
|
371
371
|
} | undefined>;
|
|
372
372
|
}): React$1.JSX.Element | null;
|
|
373
373
|
|
|
374
|
+
/**
|
|
375
|
+
* Where a parameter's value comes from.
|
|
376
|
+
*
|
|
377
|
+
* The three are not styles of the same thing — they decide *when* the value is
|
|
378
|
+
* known. A literal is known now; an argument is known when a run is started; a
|
|
379
|
+
* binding is known only once an earlier task has produced it.
|
|
380
|
+
*/
|
|
381
|
+
type ParamSource = "literal" | "argument" | "binding";
|
|
382
|
+
declare const PARAM_SOURCES: ParamSource[];
|
|
383
|
+
interface ParamRowProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
384
|
+
/** The parameter's name, as the contract spells it — `batch_size`, `map_over`. */
|
|
385
|
+
name: string;
|
|
386
|
+
/** Its type and obligation, from the contract — `str · required`, `int · optional`. */
|
|
387
|
+
type?: React$1.ReactNode;
|
|
388
|
+
/** Which of the three the current value is. */
|
|
389
|
+
source: ParamSource;
|
|
390
|
+
onSourceChange?: (source: ParamSource) => void;
|
|
391
|
+
/** The value itself — a literal, `${args.model}`, `${steps.x.rows}`. */
|
|
392
|
+
value: string;
|
|
393
|
+
onValueChange?: (value: string) => void;
|
|
394
|
+
/**
|
|
395
|
+
* What the reader needs to know that the value does not say — what a binding
|
|
396
|
+
* will resolve to, which alternatives an enum allows, why a default was left
|
|
397
|
+
* alone. Rendered as the error when `invalid` is set.
|
|
398
|
+
*/
|
|
399
|
+
note?: React$1.ReactNode;
|
|
400
|
+
/** The value does not resolve, or the contract refuses it. Reddens the control and the note. */
|
|
401
|
+
invalid?: boolean;
|
|
402
|
+
/**
|
|
403
|
+
* The parameter is not in play — a `when` on a task that always runs. Shown
|
|
404
|
+
* rather than hidden, because a contract's full surface is the point of the
|
|
405
|
+
* form.
|
|
406
|
+
*/
|
|
407
|
+
disabled?: boolean;
|
|
408
|
+
/** Replaces the value control entirely, for a parameter that needs its own editor. */
|
|
409
|
+
children?: React$1.ReactNode;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* One parameter of a task, as a row: what it is called, where its value comes
|
|
413
|
+
* from, what the value is, and what that means.
|
|
414
|
+
*
|
|
415
|
+
* The form these rows make **is** the catalogue contract — the fields, their
|
|
416
|
+
* types and their obligations are read off the entry, never authored here. So a
|
|
417
|
+
* row takes a descriptor rather than children, and a parameter the contract
|
|
418
|
+
* does not declare has no way to appear.
|
|
419
|
+
*
|
|
420
|
+
* `source` and `value` are one control, joined, because they are one decision.
|
|
421
|
+
* Split into two fields they read as two questions, and a reader can end up
|
|
422
|
+
* with `literal` selected beside a value that is plainly a binding.
|
|
423
|
+
*
|
|
424
|
+
* Not a `Field`. That one lays out a label, a control and a description for a
|
|
425
|
+
* form a person fills in from nothing; this lays out a *contract* — the label
|
|
426
|
+
* column carries a type, and the description usually explains a value the
|
|
427
|
+
* person did not type.
|
|
428
|
+
*/
|
|
429
|
+
declare const ParamRow: React$1.ForwardRefExoticComponent<ParamRowProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
430
|
+
|
|
374
431
|
declare function InputGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
375
432
|
declare const inputGroupAddonVariants: (props?: ({
|
|
376
433
|
align?: "inline-end" | "inline-start" | "block-end" | "block-start" | null | undefined;
|
|
@@ -384,4 +441,4 @@ declare function InputGroupText({ className, ...props }: React$1.ComponentProps<
|
|
|
384
441
|
declare function InputGroupInput({ className, ...props }: React$1.ComponentProps<"input">): React$1.JSX.Element;
|
|
385
442
|
declare function InputGroupTextarea({ className, ...props }: React$1.ComponentProps<"textarea">): React$1.JSX.Element;
|
|
386
443
|
|
|
387
|
-
export { type BooleanControl, BooleanField, Checkbox, CheckboxGroupField, ColorField, type ColorPreset, ColorSwatches, Field, type FieldBadge, type FieldConfig, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldOrientation, FieldSeparator, FieldSet, type FieldSize, FieldTitle, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GroupConfig, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputSize, Label, type LabelPosition, NumberField, ObjectField, type ObjectFieldProps, PasswordField, PasswordInput, type PasswordInputProps, RadioField, RadioGroup, RadioGroupItem, type RowConfig, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, type SettingsPanelProps, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
|
|
444
|
+
export { type BooleanControl, BooleanField, Checkbox, CheckboxGroupField, ColorField, type ColorPreset, ColorSwatches, Field, type FieldBadge, type FieldConfig, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, type FieldOrientation, FieldSeparator, FieldSet, type FieldSize, FieldTitle, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, type GroupConfig, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, type InputSize, Label, type LabelPosition, NumberField, ObjectField, type ObjectFieldProps, PARAM_SOURCES, ParamRow, type ParamRowProps, type ParamSource, PasswordField, PasswordInput, type PasswordInputProps, RadioField, RadioGroup, RadioGroupItem, type RowConfig, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, type SettingsPanelProps, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
|
package/dist/index.js
CHANGED
|
@@ -1386,6 +1386,86 @@ function FieldError({
|
|
|
1386
1386
|
}
|
|
1387
1387
|
);
|
|
1388
1388
|
}
|
|
1389
|
+
var PARAM_SOURCES = ["literal", "argument", "binding"];
|
|
1390
|
+
var ParamRow = React2.forwardRef(
|
|
1391
|
+
({
|
|
1392
|
+
name,
|
|
1393
|
+
type,
|
|
1394
|
+
source,
|
|
1395
|
+
onSourceChange,
|
|
1396
|
+
value,
|
|
1397
|
+
onValueChange,
|
|
1398
|
+
note,
|
|
1399
|
+
invalid,
|
|
1400
|
+
disabled,
|
|
1401
|
+
className,
|
|
1402
|
+
children,
|
|
1403
|
+
...props
|
|
1404
|
+
}, ref) => /* @__PURE__ */ jsxs(
|
|
1405
|
+
"div",
|
|
1406
|
+
{
|
|
1407
|
+
ref,
|
|
1408
|
+
"data-invalid": invalid || void 0,
|
|
1409
|
+
"data-disabled": disabled || void 0,
|
|
1410
|
+
className: cn("flex items-start gap-3 py-1.5", className),
|
|
1411
|
+
...props,
|
|
1412
|
+
children: [
|
|
1413
|
+
/* @__PURE__ */ jsxs("div", { className: "w-[118px] shrink-0 pt-1", children: [
|
|
1414
|
+
/* @__PURE__ */ jsx("div", { className: "truncate font-mono text-meta", children: name }),
|
|
1415
|
+
type != null ? /* @__PURE__ */ jsx("div", { className: "truncate text-meta text-muted-foreground", children: type }) : null
|
|
1416
|
+
] }),
|
|
1417
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
1418
|
+
children ?? /* @__PURE__ */ jsxs("div", { className: "flex min-w-0", children: [
|
|
1419
|
+
/* @__PURE__ */ jsxs(
|
|
1420
|
+
Select,
|
|
1421
|
+
{
|
|
1422
|
+
value: source,
|
|
1423
|
+
onValueChange: (v) => onSourceChange?.(v),
|
|
1424
|
+
disabled,
|
|
1425
|
+
children: [
|
|
1426
|
+
/* @__PURE__ */ jsx(
|
|
1427
|
+
SelectTrigger,
|
|
1428
|
+
{
|
|
1429
|
+
triggerSize: "sm",
|
|
1430
|
+
"aria-label": `${name} source`,
|
|
1431
|
+
className: "w-auto shrink-0 rounded-r-none border-r-0 text-meta text-muted-foreground",
|
|
1432
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
1433
|
+
}
|
|
1434
|
+
),
|
|
1435
|
+
/* @__PURE__ */ jsx(SelectContent, { children: PARAM_SOURCES.map((s) => /* @__PURE__ */ jsx(SelectItem, { value: s, children: s }, s)) })
|
|
1436
|
+
]
|
|
1437
|
+
}
|
|
1438
|
+
),
|
|
1439
|
+
/* @__PURE__ */ jsx(
|
|
1440
|
+
Input,
|
|
1441
|
+
{
|
|
1442
|
+
inputSize: "sm",
|
|
1443
|
+
value,
|
|
1444
|
+
onChange: (e) => onValueChange?.(e.target.value),
|
|
1445
|
+
disabled,
|
|
1446
|
+
"aria-invalid": invalid || void 0,
|
|
1447
|
+
"aria-label": name,
|
|
1448
|
+
style: invalid ? { borderColor: "var(--color-destructive)" } : void 0,
|
|
1449
|
+
className: "min-w-0 flex-1 rounded-l-none font-mono"
|
|
1450
|
+
}
|
|
1451
|
+
)
|
|
1452
|
+
] }),
|
|
1453
|
+
note != null ? /* @__PURE__ */ jsx(
|
|
1454
|
+
"div",
|
|
1455
|
+
{
|
|
1456
|
+
className: cn(
|
|
1457
|
+
"text-meta",
|
|
1458
|
+
invalid ? "text-destructive" : "text-muted-foreground"
|
|
1459
|
+
),
|
|
1460
|
+
children: note
|
|
1461
|
+
}
|
|
1462
|
+
) : null
|
|
1463
|
+
] })
|
|
1464
|
+
]
|
|
1465
|
+
}
|
|
1466
|
+
)
|
|
1467
|
+
);
|
|
1468
|
+
ParamRow.displayName = "ParamRow";
|
|
1389
1469
|
function InputGroup({ className, ...props }) {
|
|
1390
1470
|
return /* @__PURE__ */ jsx(
|
|
1391
1471
|
"div",
|
|
@@ -1527,6 +1607,6 @@ function InputGroupTextarea({
|
|
|
1527
1607
|
);
|
|
1528
1608
|
}
|
|
1529
1609
|
|
|
1530
|
-
export { BooleanField, Checkbox, CheckboxGroupField, ColorField, ColorSwatches, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel2 as FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Form, FormControl, FormDescription, FormField2 as FormField, FormItem, FormLabel, FormMessage, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, NumberField, ObjectField, PasswordField, PasswordInput, RadioField, RadioGroup, RadioGroupItem, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
|
|
1610
|
+
export { BooleanField, Checkbox, CheckboxGroupField, ColorField, ColorSwatches, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel2 as FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Form, FormControl, FormDescription, FormField2 as FormField, FormItem, FormLabel, FormMessage, IconField, IconInput, Input, InputField, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, NumberField, ObjectField, PARAM_SOURCES, ParamRow, PasswordField, PasswordInput, RadioField, RadioGroup, RadioGroupItem, Select, SelectContent, SelectField, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SettingsPanel, Slider, SliderNumber, Switch, Textarea, TextareaField, useFormField };
|
|
1531
1611
|
//# sourceMappingURL=index.js.map
|
|
1532
1612
|
//# sourceMappingURL=index.js.map
|