@pipelex/mthds-form 0.4.0 → 0.5.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/README.md +15 -6
- package/dist/{chunk-6XD6UZSU.js → chunk-25I6JDIK.js} +2 -2
- package/dist/chunk-25I6JDIK.js.map +1 -0
- package/dist/{chunk-WXBSM2CE.js → chunk-5Q2W6HBA.js} +8 -8
- package/dist/chunk-5Q2W6HBA.js.map +1 -0
- package/dist/{chunk-7BMOPXDY.js → chunk-GCXV76WU.js} +17 -9
- package/dist/chunk-GCXV76WU.js.map +1 -0
- package/dist/chunk-IIJRJGZQ.js +128 -0
- package/dist/chunk-IIJRJGZQ.js.map +1 -0
- package/dist/{chunk-XEPD5VJQ.js → chunk-IM2AHWBR.js} +8 -8
- package/dist/chunk-IM2AHWBR.js.map +1 -0
- package/dist/{chunk-KFZ5MZOM.js → chunk-LBFZXYCY.js} +3 -3
- package/dist/{chunk-KFZ5MZOM.js.map → chunk-LBFZXYCY.js.map} +1 -1
- package/dist/{chunk-O4O3QNVC.js → chunk-OD3VYXUY.js} +13 -3
- package/dist/chunk-OD3VYXUY.js.map +1 -0
- package/dist/{chunk-HARYEWNG.js → chunk-XYQ7NXQZ.js} +2 -2
- package/dist/chunk-XYQ7NXQZ.js.map +1 -0
- package/dist/chunk-YEVVR6FE.js +66 -0
- package/dist/chunk-YEVVR6FE.js.map +1 -0
- package/dist/core/contracts.d.ts +27 -56
- package/dist/core/contracts.js +1 -1
- package/dist/core/derive.d.ts +46 -11
- package/dist/core/derive.js +3 -4
- package/dist/core/descriptor.d.ts +70 -26
- package/dist/core/descriptor.js +1 -1
- package/dist/core/gate.d.ts +1 -1
- package/dist/core/gate.js +7 -8
- package/dist/core/gating-fields.d.ts +38 -0
- package/dist/core/gating-fields.js +6 -0
- package/dist/core/gating-fields.js.map +1 -0
- package/dist/core/index.d.ts +4 -3
- package/dist/core/index.js +10 -10
- package/dist/core/normalize-schema.js +2 -2
- package/dist/core/readiness.d.ts +2 -0
- package/dist/core/schema-utils.d.ts +13 -1
- package/dist/core/schema-utils.js +1 -1
- package/dist/core/values.d.ts +10 -3
- package/dist/core/values.js +6 -7
- package/dist/core/wire-format.js +3 -4
- package/dist/react/index.d.ts +21 -1
- package/dist/react/index.js +41 -19
- package/dist/react/index.js.map +1 -1
- package/package.json +3 -1
- package/dist/chunk-6XD6UZSU.js.map +0 -1
- package/dist/chunk-7BMOPXDY.js.map +0 -1
- package/dist/chunk-HARYEWNG.js.map +0 -1
- package/dist/chunk-NMT7BRLO.js +0 -40
- package/dist/chunk-NMT7BRLO.js.map +0 -1
- package/dist/chunk-O4O3QNVC.js.map +0 -1
- package/dist/chunk-VMLXO5JS.js +0 -132
- package/dist/chunk-VMLXO5JS.js.map +0 -1
- package/dist/chunk-WXBSM2CE.js.map +0 -1
- package/dist/chunk-XEPD5VJQ.js.map +0 -1
- package/dist/core/native-concepts.d.ts +0 -78
- package/dist/core/native-concepts.js +0 -3
- package/dist/core/native-concepts.js.map +0 -1
package/dist/core/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { BooleanRunField, ConceptCategory, DateRunField, EnumRunField, FileRunField, ListRunField, NumberRunField, ObjectRunField, ProseRunField, RunField, RunFieldCommon, RunFieldKind, TextRunField, UnknownRunField, conceptCategory } from './descriptor.js';
|
|
2
|
-
export {
|
|
1
|
+
export { BooleanRunField, ConceptCategory, DateRunField, EnumRunField, FileRunField, ListRunField, NumberRunField, ObjectRunField, ProseRunField, RunField, RunFieldCommon, RunFieldKind, TextConstraints, TextRunField, UnknownRunField, conceptCategory } from './descriptor.js';
|
|
2
|
+
export { IOMultiplicity, InputForm, PipeIOContract, PipeIOContracts, PipeInputContract, PipeInputFormDescriptor, PipeOutputContract } from 'mthds/protocol';
|
|
3
|
+
export { buildRunFields, getPipeInputForm } from './derive.js';
|
|
3
4
|
export { Readiness, computeReadiness, fieldFilled, isFilled, mustBeFilled } from './readiness.js';
|
|
4
|
-
export {
|
|
5
|
+
export { InputPresence, buildPipeRef, getPipeIOContract, inputMustBeFilled, isFixedCountInput, isOptionalInput, isPluralInput } from './contracts.js';
|
|
5
6
|
export { RunInputsGateResult, RunInputsVerdict, apiInputsFromSchemaData, buildRunInputsSchema, gateRunInputs, prepareRunInputs, validateRunInputs } from './gate.js';
|
|
6
7
|
export { RunInputError, validateRunInputsSchema } from './gate-validator.js';
|
|
7
8
|
export { OutputEntry, apiInputsFromRunValues, fieldsForContract, inputDataFromWorkingMemory, outputsFromPipeOutput, rjsfDataFromRunValues, runValuesFromStore, setValueAtPath, storeInputDataFromRunValues } from './values.js';
|
package/dist/core/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export { describeValidationError, displayValue, valueAtProperty } from '../chunk-RPA7DNSK.js';
|
|
2
|
-
export { apiInputsFromRunValues, fieldsForContract, inputDataFromWorkingMemory, outputsFromPipeOutput, rjsfDataFromRunValues, runValuesFromStore, setValueAtPath, storeInputDataFromRunValues } from '../chunk-
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
2
|
+
export { apiInputsFromRunValues, fieldsForContract, inputDataFromWorkingMemory, outputsFromPipeOutput, rjsfDataFromRunValues, runValuesFromStore, setValueAtPath, storeInputDataFromRunValues } from '../chunk-5Q2W6HBA.js';
|
|
3
|
+
export { buildRunFields, getPipeInputForm } from '../chunk-IIJRJGZQ.js';
|
|
4
|
+
export { conceptCategory } from '../chunk-25I6JDIK.js';
|
|
5
|
+
export { apiInputsFromSchemaData, buildRunInputsSchema, gateRunInputs, prepareRunInputs, validateRunInputs } from '../chunk-IM2AHWBR.js';
|
|
6
|
+
export { normalizeSchemaForRjsf, prepareSchemaForRjsf } from '../chunk-LBFZXYCY.js';
|
|
7
|
+
export { deflateAllInputs, deflateInput, healStringWrappers, inflateAllInputs, inflateInput, pruneEmptyOptionals, resolveConceptCode } from '../chunk-GCXV76WU.js';
|
|
7
8
|
export { computeReadiness, fieldFilled, isFilled, mustBeFilled } from '../chunk-PM55AHRO.js';
|
|
8
|
-
export { buildRunFields } from '../chunk-VMLXO5JS.js';
|
|
9
|
-
export { collapseNullable, collectSchemaDefs, derefSchema, flattenAnyOf, hoistDefsToRoot, resolveSchemaIndirection, schemaTypeOf } from '../chunk-O4O3QNVC.js';
|
|
10
|
-
export { buildPipeRef, getPipeIOContract, inputMustBeFilled, isFixedCountInput, isOptionalInput, isPluralInput } from '../chunk-HARYEWNG.js';
|
|
11
|
-
import '../chunk-V3OV2XQT.js';
|
|
12
9
|
export { validateRunInputsSchema } from '../chunk-VTPUDBSJ.js';
|
|
13
10
|
export { asCalendarDate, dayWithinDateTime, isAcceptableDate, isAcceptableDateTime, toDateInputValue, toStoredDateValue } from '../chunk-GKV77RAS.js';
|
|
14
|
-
import '../chunk-
|
|
11
|
+
import '../chunk-YEVVR6FE.js';
|
|
12
|
+
export { collapseNullable, collectSchemaDefs, derefSchema, flattenAnyOf, hoistDefsToRoot, resolveSchemaIndirection, schemaTypeOf } from '../chunk-OD3VYXUY.js';
|
|
13
|
+
export { buildPipeRef, getPipeIOContract, inputMustBeFilled, isFixedCountInput, isOptionalInput, isPluralInput } from '../chunk-XYQ7NXQZ.js';
|
|
14
|
+
import '../chunk-V3OV2XQT.js';
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { normalizeSchemaForRjsf, prepareSchemaForRjsf } from '../chunk-
|
|
2
|
-
export { hoistDefsToRoot } from '../chunk-
|
|
1
|
+
export { normalizeSchemaForRjsf, prepareSchemaForRjsf } from '../chunk-LBFZXYCY.js';
|
|
2
|
+
export { hoistDefsToRoot } from '../chunk-OD3VYXUY.js';
|
|
3
3
|
//# sourceMappingURL=normalize-schema.js.map
|
|
4
4
|
//# sourceMappingURL=normalize-schema.js.map
|
package/dist/core/readiness.d.ts
CHANGED
|
@@ -47,6 +47,18 @@ declare function derefSchema(schema: JsonSchema, defs: Record<string, JsonSchema
|
|
|
47
47
|
* the callers did inline.
|
|
48
48
|
*/
|
|
49
49
|
declare function resolveSchemaIndirection(schema: JsonSchema, defs: Record<string, JsonSchema>): JsonSchema;
|
|
50
|
+
/**
|
|
51
|
+
* Resolve one schema node to its fixpoint under `derefSchema` +
|
|
52
|
+
* `collapseNullable`, so a nullable REFERENCE - pydantic's `anyOf: [{$ref},
|
|
53
|
+
* {type:'null'}]` for an Optional concept-typed field - resolves the same way
|
|
54
|
+
* a bare `$ref` or an inline nullable does. One pass of either helper cannot:
|
|
55
|
+
* collapsing the nullable surfaces a `$ref` that was inside a branch, and
|
|
56
|
+
* dereferencing can surface a nullable the definition holds. Sibling keys
|
|
57
|
+
* still merge over the definition (`derefSchema`'s semantics - unlike
|
|
58
|
+
* `resolveSchemaIndirection`, which replaces). Identity is the fixpoint test:
|
|
59
|
+
* both helpers return the schema unchanged when they have nothing to do.
|
|
60
|
+
*/
|
|
61
|
+
declare function resolveSchemaNode(schema: JsonSchema, defs: Record<string, JsonSchema>): JsonSchema;
|
|
50
62
|
interface CollectDefsOptions {
|
|
51
63
|
/**
|
|
52
64
|
* Whether the walk descends into JSON arrays (`anyOf`/`allOf` branches,
|
|
@@ -71,4 +83,4 @@ declare function collectSchemaDefs(schema: JsonSchema, into: Record<string, Json
|
|
|
71
83
|
*/
|
|
72
84
|
declare function hoistDefsToRoot(schema: JsonSchema): JsonSchema;
|
|
73
85
|
|
|
74
|
-
export { type CollectDefsOptions, type JsonSchema, collapseNullable, collectSchemaDefs, derefSchema, flattenAnyOf, hoistDefsToRoot, resolveSchemaIndirection, schemaTypeOf };
|
|
86
|
+
export { type CollectDefsOptions, type JsonSchema, collapseNullable, collectSchemaDefs, derefSchema, flattenAnyOf, hoistDefsToRoot, resolveSchemaIndirection, resolveSchemaNode, schemaTypeOf };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { collapseNullable, collectSchemaDefs, derefSchema, flattenAnyOf, hoistDefsToRoot, resolveSchemaIndirection, schemaTypeOf } from '../chunk-
|
|
1
|
+
export { collapseNullable, collectSchemaDefs, derefSchema, flattenAnyOf, hoistDefsToRoot, resolveSchemaIndirection, resolveSchemaNode, schemaTypeOf } from '../chunk-OD3VYXUY.js';
|
|
2
2
|
//# sourceMappingURL=schema-utils.js.map
|
|
3
3
|
//# sourceMappingURL=schema-utils.js.map
|
package/dist/core/values.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { PipeInputContract, PipeIOContract, PipeInputFormDescriptor } from 'mthds/protocol';
|
|
1
2
|
import { RunField } from './descriptor.js';
|
|
2
|
-
import
|
|
3
|
+
import './contracts.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Bridges the `MethodRunner`'s field values to the rest of the host.
|
|
@@ -80,8 +81,14 @@ declare function outputsFromPipeOutput(pipeOutput: unknown, inputKeys: string[])
|
|
|
80
81
|
* inputs that produced the result. Returns `null` when no inputs are present.
|
|
81
82
|
*/
|
|
82
83
|
declare function inputDataFromWorkingMemory(workingMemory: unknown, inputSchemas: InputSchemas): Dict | null;
|
|
83
|
-
/**
|
|
84
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Field descriptors for a method's main pipe - the wire descriptor mapped over
|
|
86
|
+
* the contract, or `[]` while either artifact has not arrived yet. The
|
|
87
|
+
* descriptor comes back from `validate` beside `pipe_io_contracts` when the
|
|
88
|
+
* request opts in with `views: ["input_form"]`; `getPipeInputForm` is the
|
|
89
|
+
* lookup that matches `getPipeIOContract`.
|
|
90
|
+
*/
|
|
91
|
+
declare function fieldsForContract(contract: PipeIOContract | undefined, descriptor: PipeInputFormDescriptor | undefined): RunField[];
|
|
85
92
|
/**
|
|
86
93
|
* Immutably set a value at a dotted/indexed path (`a.0.b`). Used to write an
|
|
87
94
|
* uploaded file's URL back to a field anywhere in the (possibly nested) tree.
|
package/dist/core/values.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export { apiInputsFromRunValues, fieldsForContract, inputDataFromWorkingMemory, outputsFromPipeOutput, rjsfDataFromRunValues, runValuesFromStore, setValueAtPath, storeInputDataFromRunValues } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { apiInputsFromRunValues, fieldsForContract, inputDataFromWorkingMemory, outputsFromPipeOutput, rjsfDataFromRunValues, runValuesFromStore, setValueAtPath, storeInputDataFromRunValues } from '../chunk-5Q2W6HBA.js';
|
|
2
|
+
import '../chunk-IIJRJGZQ.js';
|
|
3
|
+
import '../chunk-GCXV76WU.js';
|
|
3
4
|
import '../chunk-PM55AHRO.js';
|
|
4
|
-
import '../chunk-VMLXO5JS.js';
|
|
5
|
-
import '../chunk-O4O3QNVC.js';
|
|
6
|
-
import '../chunk-HARYEWNG.js';
|
|
7
|
-
import '../chunk-V3OV2XQT.js';
|
|
8
5
|
import '../chunk-GKV77RAS.js';
|
|
9
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-OD3VYXUY.js';
|
|
7
|
+
import '../chunk-XYQ7NXQZ.js';
|
|
8
|
+
import '../chunk-V3OV2XQT.js';
|
|
10
9
|
//# sourceMappingURL=values.js.map
|
|
11
10
|
//# sourceMappingURL=values.js.map
|
package/dist/core/wire-format.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { deflateAllInputs, deflateInput, healStringWrappers, inflateAllInputs, inflateInput, pruneEmptyOptionals, resolveConceptCode } from '../chunk-
|
|
2
|
-
import '../chunk-O4O3QNVC.js';
|
|
3
|
-
import '../chunk-V3OV2XQT.js';
|
|
1
|
+
export { deflateAllInputs, deflateInput, healStringWrappers, inflateAllInputs, inflateInput, pruneEmptyOptionals, resolveConceptCode } from '../chunk-GCXV76WU.js';
|
|
4
2
|
import '../chunk-GKV77RAS.js';
|
|
5
|
-
import '../chunk-
|
|
3
|
+
import '../chunk-OD3VYXUY.js';
|
|
4
|
+
import '../chunk-V3OV2XQT.js';
|
|
6
5
|
//# sourceMappingURL=wire-format.js.map
|
|
7
6
|
//# sourceMappingURL=wire-format.js.map
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { RunField, BooleanRunField, DateRunField, EnumRunField, FileRunField, ListRunField, NumberRunField, ObjectRunField, ProseRunField, TextRunField, UnknownRunField, ConceptCategory } from '../core/descriptor.js';
|
|
4
|
+
import '../core/contracts.js';
|
|
5
|
+
import 'mthds/protocol';
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Ambient state that any field in the tree may need, threaded unchanged through
|
|
@@ -294,6 +296,24 @@ declare function FieldStringsProvider({ strings, children, }: {
|
|
|
294
296
|
/** The strings the nearest provider supplies (English defaults when none does). */
|
|
295
297
|
declare function useFieldStrings(): FieldStrings;
|
|
296
298
|
|
|
299
|
+
declare function FieldDomIdProvider({ prefix, children, }: {
|
|
300
|
+
/**
|
|
301
|
+
* Omit to mint one from `useId`; `''` writes the path unprefixed. An explicit
|
|
302
|
+
* prefix must be unique in the document - one provider, one form.
|
|
303
|
+
*/
|
|
304
|
+
prefix?: string;
|
|
305
|
+
children: ReactNode;
|
|
306
|
+
}): react.JSX.Element;
|
|
307
|
+
/**
|
|
308
|
+
* The DOM id for a field path - the ONE place a path becomes an attribute.
|
|
309
|
+
*
|
|
310
|
+
* Called once per control so the `<label for>` and the control's `id` are the
|
|
311
|
+
* same string by construction: the pairing cannot drift, because there is only
|
|
312
|
+
* one call. `useId` runs unconditionally (hooks must) and is simply unused when
|
|
313
|
+
* a provider supplies the prefix.
|
|
314
|
+
*/
|
|
315
|
+
declare function useFieldDomId(path: string): string;
|
|
316
|
+
|
|
297
317
|
/**
|
|
298
318
|
* How a field's LABEL chrome should read. The control itself never changes.
|
|
299
319
|
*
|
|
@@ -324,4 +344,4 @@ declare function useFieldPresentation(): FieldPresentation;
|
|
|
324
344
|
*/
|
|
325
345
|
declare function humanizeFieldName(name: string): string;
|
|
326
346
|
|
|
327
|
-
export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, EnumField, type FieldEnv, type FieldPresentation, FieldPresentationProvider, FieldRenderer, type FieldRendererProps, FieldShell, type FieldStrings, FieldStringsProvider, type FileValue, ImageField, ListField, NumberField, ObjectField, OptionalToggle, ProseField, TextField, UnknownField, fieldControlClass, humanizeFieldName, useFieldPresentation, useFieldStrings };
|
|
347
|
+
export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, EnumField, FieldDomIdProvider, type FieldEnv, type FieldPresentation, FieldPresentationProvider, FieldRenderer, type FieldRendererProps, FieldShell, type FieldStrings, FieldStringsProvider, type FileValue, ImageField, ListField, NumberField, ObjectField, OptionalToggle, ProseField, TextField, UnknownField, fieldControlClass, humanizeFieldName, useFieldDomId, useFieldPresentation, useFieldStrings };
|
package/dist/react/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { isFilled } from '../chunk-PM55AHRO.js';
|
|
3
|
-
import { ownProp } from '../chunk-V3OV2XQT.js';
|
|
4
3
|
import { toStoredDateValue, toDateInputValue } from '../chunk-GKV77RAS.js';
|
|
4
|
+
import { ownProp } from '../chunk-V3OV2XQT.js';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { ChevronDown, ChevronUp, Check, List, Braces, ListChecks, ToggleLeft, Hash, Image, FileText, CalendarDays, Type, Loader2, Upload, Link2, ImageOff, EyeOff, Eye, X, Minus, Plus, Trash2 } from 'lucide-react';
|
|
8
8
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
import * as React2 from 'react';
|
|
10
|
-
import { createContext, use, useMemo, useContext, useState, useRef, useCallback, useEffect } from 'react';
|
|
10
|
+
import { createContext, use, useId, useMemo, useContext, useState, useRef, useCallback, useEffect } from 'react';
|
|
11
11
|
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
12
12
|
import { useDropzone } from 'react-dropzone';
|
|
13
13
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
@@ -85,9 +85,24 @@ var Switch = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
85
85
|
}
|
|
86
86
|
));
|
|
87
87
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
88
|
+
var FieldDomIdContext = createContext(null);
|
|
89
|
+
function FieldDomIdProvider({
|
|
90
|
+
prefix,
|
|
91
|
+
children
|
|
92
|
+
}) {
|
|
93
|
+
const generated = useId();
|
|
94
|
+
return /* @__PURE__ */ jsx(FieldDomIdContext, { value: prefix ?? generated, children });
|
|
95
|
+
}
|
|
96
|
+
function useFieldDomId(path) {
|
|
97
|
+
const scoped = use(FieldDomIdContext);
|
|
98
|
+
const local = useId();
|
|
99
|
+
const prefix = scoped ?? local;
|
|
100
|
+
return prefix === "" ? path : `${prefix}-${path}`;
|
|
101
|
+
}
|
|
88
102
|
function BooleanField({ field, value, onChange, id, disabled }) {
|
|
89
103
|
const presentation = useFieldPresentation();
|
|
90
104
|
const isApp = presentation === "app";
|
|
105
|
+
const domId = useFieldDomId(id);
|
|
91
106
|
return /* @__PURE__ */ jsxs(
|
|
92
107
|
"div",
|
|
93
108
|
{
|
|
@@ -101,7 +116,7 @@ function BooleanField({ field, value, onChange, id, disabled }) {
|
|
|
101
116
|
/* @__PURE__ */ jsx(
|
|
102
117
|
"label",
|
|
103
118
|
{
|
|
104
|
-
htmlFor:
|
|
119
|
+
htmlFor: domId,
|
|
105
120
|
className: cn(
|
|
106
121
|
"text-[13px] font-medium leading-none text-foreground",
|
|
107
122
|
isApp ? "text-[13.5px]" : "font-mono"
|
|
@@ -116,7 +131,7 @@ function BooleanField({ field, value, onChange, id, disabled }) {
|
|
|
116
131
|
/* @__PURE__ */ jsx(
|
|
117
132
|
Switch,
|
|
118
133
|
{
|
|
119
|
-
id,
|
|
134
|
+
id: domId,
|
|
120
135
|
checked: value ?? false,
|
|
121
136
|
onCheckedChange: onChange,
|
|
122
137
|
disabled,
|
|
@@ -214,6 +229,7 @@ var fieldControlClass = cn(
|
|
|
214
229
|
"aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/30"
|
|
215
230
|
);
|
|
216
231
|
function DateField({ field, value, onChange, id, error, disabled }) {
|
|
232
|
+
const domId = useFieldDomId(id);
|
|
217
233
|
return /* @__PURE__ */ jsx(
|
|
218
234
|
FieldShell,
|
|
219
235
|
{
|
|
@@ -224,11 +240,11 @@ function DateField({ field, value, onChange, id, error, disabled }) {
|
|
|
224
240
|
description: field.description,
|
|
225
241
|
required: field.required,
|
|
226
242
|
error,
|
|
227
|
-
htmlFor:
|
|
243
|
+
htmlFor: domId,
|
|
228
244
|
children: /* @__PURE__ */ jsx(
|
|
229
245
|
"input",
|
|
230
246
|
{
|
|
231
|
-
id,
|
|
247
|
+
id: domId,
|
|
232
248
|
type: "date",
|
|
233
249
|
value: toDateInputValue(value),
|
|
234
250
|
disabled,
|
|
@@ -268,6 +284,7 @@ function FileField({
|
|
|
268
284
|
category
|
|
269
285
|
}) {
|
|
270
286
|
const s = useFieldStrings();
|
|
287
|
+
const domId = useFieldDomId(id);
|
|
271
288
|
const [showUrl, setShowUrl] = useState(false);
|
|
272
289
|
const [previewOpen, setPreviewOpen] = useState(false);
|
|
273
290
|
const [localPreview, setLocalPreview] = useState(null);
|
|
@@ -350,7 +367,7 @@ function FileField({
|
|
|
350
367
|
description: field.description,
|
|
351
368
|
required: field.required,
|
|
352
369
|
error,
|
|
353
|
-
htmlFor:
|
|
370
|
+
htmlFor: domId,
|
|
354
371
|
children: [
|
|
355
372
|
hasFile && !uploading ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
356
373
|
/* @__PURE__ */ jsx(
|
|
@@ -388,7 +405,7 @@ function FileField({
|
|
|
388
405
|
"input",
|
|
389
406
|
{
|
|
390
407
|
...getInputProps({ tabIndex: 0 }),
|
|
391
|
-
id,
|
|
408
|
+
id: domId,
|
|
392
409
|
disabled: busy,
|
|
393
410
|
"aria-invalid": !!error
|
|
394
411
|
}
|
|
@@ -682,6 +699,7 @@ var CLEAR_VALUE = "__none__";
|
|
|
682
699
|
function EnumField({ field, value, onChange, id, error, disabled }) {
|
|
683
700
|
const s = useFieldStrings();
|
|
684
701
|
const isSegmented = field.options.length <= 4 && field.options.every((o) => o.length <= 16);
|
|
702
|
+
const domId = useFieldDomId(id);
|
|
685
703
|
return /* @__PURE__ */ jsx(
|
|
686
704
|
FieldShell,
|
|
687
705
|
{
|
|
@@ -692,7 +710,7 @@ function EnumField({ field, value, onChange, id, error, disabled }) {
|
|
|
692
710
|
description: field.description,
|
|
693
711
|
required: field.required,
|
|
694
712
|
error,
|
|
695
|
-
htmlFor: isSegmented ? void 0 :
|
|
713
|
+
htmlFor: isSegmented ? void 0 : domId,
|
|
696
714
|
children: isSegmented ? (
|
|
697
715
|
// `type="single"` gives the roving tabindex and arrow-key navigation a
|
|
698
716
|
// radiogroup owes its user, and emits `''` when the active item is
|
|
@@ -728,7 +746,7 @@ function EnumField({ field, value, onChange, id, error, disabled }) {
|
|
|
728
746
|
disabled,
|
|
729
747
|
onValueChange: (next) => onChange(next === CLEAR_VALUE ? void 0 : next),
|
|
730
748
|
children: [
|
|
731
|
-
/* @__PURE__ */ jsx(SelectTrigger, { id, "aria-invalid": !!error, className: "h-11", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: s.selectPlaceholder }) }),
|
|
749
|
+
/* @__PURE__ */ jsx(SelectTrigger, { id: domId, "aria-invalid": !!error, className: "h-11", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: s.selectPlaceholder }) }),
|
|
732
750
|
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
733
751
|
/* @__PURE__ */ jsx(SelectItem, { value: CLEAR_VALUE, children: s.selectPlaceholder }),
|
|
734
752
|
field.options.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option, children: option }, option))
|
|
@@ -741,6 +759,7 @@ function EnumField({ field, value, onChange, id, error, disabled }) {
|
|
|
741
759
|
}
|
|
742
760
|
function NumberField({ field, value, onChange, id, error, disabled }) {
|
|
743
761
|
const s = useFieldStrings();
|
|
762
|
+
const domId = useFieldDomId(id);
|
|
744
763
|
const step = field.integer ? 1 : 0.1;
|
|
745
764
|
const clamp = (n) => {
|
|
746
765
|
let next = n;
|
|
@@ -760,12 +779,12 @@ function NumberField({ field, value, onChange, id, error, disabled }) {
|
|
|
760
779
|
description: field.description ?? rangeHint,
|
|
761
780
|
required: field.required,
|
|
762
781
|
error,
|
|
763
|
-
htmlFor:
|
|
782
|
+
htmlFor: domId,
|
|
764
783
|
children: /* @__PURE__ */ jsxs("div", { className: "flex items-stretch gap-1.5", children: [
|
|
765
784
|
/* @__PURE__ */ jsx(
|
|
766
785
|
"input",
|
|
767
786
|
{
|
|
768
|
-
id,
|
|
787
|
+
id: domId,
|
|
769
788
|
type: "number",
|
|
770
789
|
inputMode: field.integer ? "numeric" : "decimal",
|
|
771
790
|
value: value ?? "",
|
|
@@ -811,6 +830,7 @@ function StepButton({
|
|
|
811
830
|
}
|
|
812
831
|
function TextField({ field, value, onChange, id, error, disabled }) {
|
|
813
832
|
const s = useFieldStrings();
|
|
833
|
+
const domId = useFieldDomId(id);
|
|
814
834
|
return /* @__PURE__ */ jsx(
|
|
815
835
|
FieldShell,
|
|
816
836
|
{
|
|
@@ -821,11 +841,11 @@ function TextField({ field, value, onChange, id, error, disabled }) {
|
|
|
821
841
|
description: field.description,
|
|
822
842
|
required: field.required,
|
|
823
843
|
error,
|
|
824
|
-
htmlFor:
|
|
844
|
+
htmlFor: domId,
|
|
825
845
|
children: /* @__PURE__ */ jsx(
|
|
826
846
|
"input",
|
|
827
847
|
{
|
|
828
|
-
id,
|
|
848
|
+
id: domId,
|
|
829
849
|
type: "text",
|
|
830
850
|
value: value ?? "",
|
|
831
851
|
disabled,
|
|
@@ -840,6 +860,7 @@ function TextField({ field, value, onChange, id, error, disabled }) {
|
|
|
840
860
|
}
|
|
841
861
|
function ProseField({ field, value, onChange, id, error, disabled }) {
|
|
842
862
|
const s = useFieldStrings();
|
|
863
|
+
const domId = useFieldDomId(id);
|
|
843
864
|
return /* @__PURE__ */ jsx(
|
|
844
865
|
FieldShell,
|
|
845
866
|
{
|
|
@@ -850,11 +871,11 @@ function ProseField({ field, value, onChange, id, error, disabled }) {
|
|
|
850
871
|
description: field.description,
|
|
851
872
|
required: field.required,
|
|
852
873
|
error,
|
|
853
|
-
htmlFor:
|
|
874
|
+
htmlFor: domId,
|
|
854
875
|
children: /* @__PURE__ */ jsx(
|
|
855
876
|
"textarea",
|
|
856
877
|
{
|
|
857
|
-
id,
|
|
878
|
+
id: domId,
|
|
858
879
|
value: value ?? "",
|
|
859
880
|
disabled,
|
|
860
881
|
"aria-invalid": !!error,
|
|
@@ -1073,6 +1094,7 @@ function emptyValue(field) {
|
|
|
1073
1094
|
}
|
|
1074
1095
|
function UnknownField({ field, value, onChange, id, error, disabled }) {
|
|
1075
1096
|
const s = useFieldStrings();
|
|
1097
|
+
const domId = useFieldDomId(id);
|
|
1076
1098
|
return /* @__PURE__ */ jsx(
|
|
1077
1099
|
FieldShell,
|
|
1078
1100
|
{
|
|
@@ -1083,11 +1105,11 @@ function UnknownField({ field, value, onChange, id, error, disabled }) {
|
|
|
1083
1105
|
description: field.description ?? s.jsonHint,
|
|
1084
1106
|
required: field.required,
|
|
1085
1107
|
error,
|
|
1086
|
-
htmlFor:
|
|
1108
|
+
htmlFor: domId,
|
|
1087
1109
|
children: /* @__PURE__ */ jsx(
|
|
1088
1110
|
"textarea",
|
|
1089
1111
|
{
|
|
1090
|
-
id,
|
|
1112
|
+
id: domId,
|
|
1091
1113
|
value: value ?? "",
|
|
1092
1114
|
disabled,
|
|
1093
1115
|
"aria-invalid": !!error,
|
|
@@ -1244,6 +1266,6 @@ function FieldRenderer({ field, value, onChange, id, error, env }) {
|
|
|
1244
1266
|
}
|
|
1245
1267
|
}
|
|
1246
1268
|
|
|
1247
|
-
export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, EnumField, FieldPresentationProvider, FieldRenderer, FieldShell, FieldStringsProvider, ImageField, ListField, NumberField, ObjectField, OptionalToggle, ProseField, TextField, UnknownField, fieldControlClass, humanizeFieldName, useFieldPresentation, useFieldStrings };
|
|
1269
|
+
export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, EnumField, FieldDomIdProvider, FieldPresentationProvider, FieldRenderer, FieldShell, FieldStringsProvider, ImageField, ListField, NumberField, ObjectField, OptionalToggle, ProseField, TextField, UnknownField, fieldControlClass, humanizeFieldName, useFieldDomId, useFieldPresentation, useFieldStrings };
|
|
1248
1270
|
//# sourceMappingURL=index.js.map
|
|
1249
1271
|
//# sourceMappingURL=index.js.map
|