@pipelex/mthds-form 0.27.0 → 0.29.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/chunk-GHVVULHY.js +42 -0
- package/dist/chunk-GHVVULHY.js.map +1 -0
- package/dist/{chunk-4DPYGNJ3.js → chunk-IBBAJXIO.js} +3 -3
- package/dist/{chunk-4DPYGNJ3.js.map → chunk-IBBAJXIO.js.map} +1 -1
- package/dist/{chunk-NSHGLM6A.js → chunk-L23R3JNQ.js} +2 -2
- package/dist/chunk-L23R3JNQ.js.map +1 -0
- package/dist/{chunk-AZIUFSIQ.js → chunk-RHX7LQRL.js} +72 -46
- package/dist/chunk-RHX7LQRL.js.map +1 -0
- package/dist/core/gate.js +2 -2
- package/dist/core/humanize.d.ts +77 -0
- package/dist/core/humanize.js +3 -0
- package/dist/core/humanize.js.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +4 -3
- package/dist/core/sources.d.ts +32 -7
- package/dist/core/sources.js +1 -1
- package/dist/{field-renderer-CH-biG8C.d.ts → field-renderer-Dz03dpig.d.ts} +3 -2
- package/dist/generative/index.d.ts +1 -1
- package/dist/generative/index.js +9 -5
- package/dist/generative/index.js.map +1 -1
- package/dist/react/index.d.ts +79 -54
- package/dist/react/index.js +3 -2
- package/package.json +1 -1
- package/dist/chunk-AZIUFSIQ.js.map +0 -1
- package/dist/chunk-NSHGLM6A.js.map +0 -1
package/dist/core/gate.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { apiInputsFromSchemaData, buildRunInputsSchema, gateRunInputs, prepareRunInputs, validateRunInputs } from '../chunk-
|
|
1
|
+
export { apiInputsFromSchemaData, buildRunInputsSchema, gateRunInputs, prepareRunInputs, validateRunInputs } from '../chunk-IBBAJXIO.js';
|
|
2
2
|
import '../chunk-E6BIXJ6C.js';
|
|
3
|
+
import '../chunk-XO5OENNF.js';
|
|
3
4
|
import '../chunk-Y2ND6W4W.js';
|
|
4
5
|
import '../chunk-LBFZXYCY.js';
|
|
5
|
-
import '../chunk-XO5OENNF.js';
|
|
6
6
|
import '../chunk-OD3VYXUY.js';
|
|
7
7
|
import '../chunk-WYH56SOZ.js';
|
|
8
8
|
import '../chunk-V3OV2XQT.js';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a person reads in place of an identifier: a field's name, and the value
|
|
3
|
+
* of a choice. Headless, so a host that draws its own choice control, a server
|
|
4
|
+
* that writes a summary and the package's own controls all word a value the
|
|
5
|
+
* same way.
|
|
6
|
+
*
|
|
7
|
+
* The descriptor carries an enum's values and nothing else: the standard has no
|
|
8
|
+
* display label for an option, and none is wanted. Its label is derived from
|
|
9
|
+
* the value here, by rule, and only what a person reads changes: the value a
|
|
10
|
+
* form stores, the JSON view, the copy control and the download all keep the
|
|
11
|
+
* code.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* `full_name` → `Full name`. Only the first word is capitalised: these are
|
|
15
|
+
* labels, not titles, and Title Case on every word reads as a form from 2009.
|
|
16
|
+
* Takes IDENTIFIERS only - snake_case or kebab-case names, where a separator
|
|
17
|
+
* is structure. An authored `title` never goes through here: it is already
|
|
18
|
+
* human-facing, and its hyphens are spelling (`E-mail address`), not structure.
|
|
19
|
+
*/
|
|
20
|
+
declare function humanizeFieldName(name: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* An enum CODE as words: `keynote` → `Keynote`, `unit_price_differs_from_po`
|
|
23
|
+
* → `Unit price differs from po`, `HIGH_RISK` → `High risk`.
|
|
24
|
+
*
|
|
25
|
+
* It is `humanizeFieldName`, applied after an all-caps code of several words is
|
|
26
|
+
* lowercased. The capitals of `HIGH_RISK` are a convention of the code, not an
|
|
27
|
+
* emphasis its author meant, and "HIGH RISK" on a sentence-case page reads as
|
|
28
|
+
* an alarm.
|
|
29
|
+
*
|
|
30
|
+
* A single all-caps token is left exactly as written: `USD`, `EUR`, `OK` and
|
|
31
|
+
* `HIGH` hold no separator, and a lone capitalised word is far more often an
|
|
32
|
+
* acronym, a unit or a currency than a shouted word, so lowercasing it would
|
|
33
|
+
* misspell it ("Usd"). Only a code that is several words joined by `_` or `-`
|
|
34
|
+
* is taken to be capitalised by convention.
|
|
35
|
+
*
|
|
36
|
+
* Acronyms inside a longer code are not guessed: `po` stays `po` where a reader
|
|
37
|
+
* expects `PO`, just as a field name does. That is the price of deriving the
|
|
38
|
+
* label from the value rather than carrying one on the wire, and it is paid
|
|
39
|
+
* knowingly: a method's author who wants `PO` read writes the code so that it
|
|
40
|
+
* reads.
|
|
41
|
+
*
|
|
42
|
+
* Only a code is humanised. A value that is not an identifier is authored
|
|
43
|
+
* words already, and its separators are spelling rather than structure, so it
|
|
44
|
+
* is shown verbatim: `18-24`, `N/A` and `Very satisfied` do not start with a
|
|
45
|
+
* letter or hold something other than letters, digits, `_` and `-`. That is
|
|
46
|
+
* the line `humanizeFieldName` draws between an identifier and an authored
|
|
47
|
+
* title.
|
|
48
|
+
*
|
|
49
|
+
* This words ONE code, with no knowledge of the enum it belongs to. A choice
|
|
50
|
+
* control goes one step further: when two options of one enum would read the
|
|
51
|
+
* same, it shows that enum's codes instead (see `enumValueLabeler`).
|
|
52
|
+
*/
|
|
53
|
+
declare function humanizeEnumValue(code: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* How ONE enum's values read, as words: the labeler every choice control and
|
|
56
|
+
* every enum result goes through, so the options a form offers, the value a
|
|
57
|
+
* result shows and a host's own chips read alike. Built from the enum's
|
|
58
|
+
* options, it maps a value to what a person reads.
|
|
59
|
+
*
|
|
60
|
+
* A declared option reads as words (`humanizeEnumValue`), except in two cases,
|
|
61
|
+
* where the code is shown as written:
|
|
62
|
+
*
|
|
63
|
+
* - **Every option, when two of them would read the same.** `high_risk` and
|
|
64
|
+
* `HIGH_RISK`, or `foo-bar` and `foo_bar`, are distinct codes that humanise
|
|
65
|
+
* to one label, and a person offered two identical choices is choosing
|
|
66
|
+
* blind. Wording the others while showing those two as codes would make one
|
|
67
|
+
* enum read in two registers, so the whole enum falls back.
|
|
68
|
+
* - **A value the enum does not declare.** It is the payload disagreeing with
|
|
69
|
+
* its descriptor, and worded it could pass for an option it is not.
|
|
70
|
+
*
|
|
71
|
+
* This is the wording, not the decision to word: a builder-facing surface that
|
|
72
|
+
* must show the code the bundle spells (the control set's `studio`
|
|
73
|
+
* presentation) does not call it.
|
|
74
|
+
*/
|
|
75
|
+
declare function enumValueLabeler(options: readonly string[]): (value: string) => string;
|
|
76
|
+
|
|
77
|
+
export { enumValueLabeler, humanizeEnumValue, humanizeFieldName };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"humanize.js"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { BooleanRunField, ConceptCategory, DateRunField, EnumRunField, FileRunField, ListRunField, NumberRunField, ObjectRunField, ProseRunField, RunField, RunFieldCommon, RunFieldKind, TextConstraints, TextRunField, UnknownRunField, conceptCategory } from './descriptor.js';
|
|
2
|
+
export { enumValueLabeler, humanizeEnumValue, humanizeFieldName } from './humanize.js';
|
|
2
3
|
export { IOMultiplicity, InputForm, InputFormTopLevelField, OutputForm, PipeIOContract, PipeIOContracts, PipeInputContract, PipeInputFormDescriptor, PipeOutputContract, PipeOutputFormDescriptor } from 'mthds/protocol';
|
|
3
4
|
export { buildResultField, buildRunFields, getPipeInputForm } from './derive.js';
|
|
4
5
|
export { getPipeOutputForm } from './output-form.js';
|
package/dist/core/index.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
export { planFileSave, planStuffSave } from '../chunk-4VAO6BDE.js';
|
|
2
2
|
export { closeOptionalStructures, openOptionalStructures, seedInputs, seedObjectValue } from '../chunk-VH5CDQDR.js';
|
|
3
|
-
export { addChosenFiles, chosenFilesAdded, roomForChosenFiles, sourceFileValue } from '../chunk-
|
|
3
|
+
export { addChosenFiles, chosenFilesAdded, roomForChosenFiles, sourceFileValue } from '../chunk-L23R3JNQ.js';
|
|
4
4
|
export { collectStuffFiles } from '../chunk-56WECFBD.js';
|
|
5
5
|
export { describeValidationError, displayValue, valueAtProperty } from '../chunk-RPA7DNSK.js';
|
|
6
6
|
export { apiInputsFromRunValues, fieldsForContract, inputDataFromWorkingMemory, outputsFromPipeOutput, rjsfDataFromRunValues, runValuesFromInputs, runValuesFromStore, sameRunValues, setValueAtPath, storeInputDataFromRunValues } from '../chunk-ZX52CQJ4.js';
|
|
7
|
+
export { enumValueLabeler, humanizeEnumValue, humanizeFieldName } from '../chunk-GHVVULHY.js';
|
|
7
8
|
export { narrowFileFormats } from '../chunk-CAKQ5VFT.js';
|
|
8
9
|
export { NATIVE_CHOICE_CONCEPT_REF, NATIVE_COMPOSITE_CONCEPT_REF, NATIVE_DATE_CONCEPT_REF, NATIVE_HTML_CONCEPT_REF, NATIVE_PAGE_CONCEPT_REF, NATIVE_RATING_CONCEPT_REF, NATIVE_SEARCH_RESULT_CONCEPT_REF, NATIVE_YES_NO_CONCEPT_REF, TYPED_SCALAR_MARKERS, citedSource, formatDateContent, hasTypedScalarMarkers, isNativeCompositeNode, isNativeDateNode, isNativeHtmlNode, isNativePageNode, isNativeSearchResultNode, isViewableUrl, nativeVerdictOf, readChoiceContent, readCompositeContent, readDataUrl, readDateContent, readDocumentContent, readHtmlContent, readImageContent, readPageContent, readRatingContent, readSearchResultContent, readYesNoContent, splitCitations, viewableUrl } from '../chunk-QQK6Y55E.js';
|
|
9
10
|
export { getPipeOutputForm } from '../chunk-JIGRWJTV.js';
|
|
10
11
|
export { buildResultField, buildRunFields, getPipeInputForm } from '../chunk-ZB4RYUKV.js';
|
|
11
12
|
export { conceptCategory } from '../chunk-FABY3DEY.js';
|
|
12
13
|
export { DOCUMENT_FORMATS, IMAGE_FORMATS, acceptLabel, acceptMap, formatsForKind, isAcceptedFile } from '../chunk-XCO6GTEC.js';
|
|
13
|
-
export { apiInputsFromSchemaData, buildRunInputsSchema, gateRunInputs, prepareRunInputs, validateRunInputs } from '../chunk-
|
|
14
|
+
export { apiInputsFromSchemaData, buildRunInputsSchema, gateRunInputs, prepareRunInputs, validateRunInputs } from '../chunk-IBBAJXIO.js';
|
|
14
15
|
export { deflateAllInputs, deflateInput, healStringWrappers, inflateAllInputs, inflateInput, pruneEmptyOptionals, resolveConceptCode } from '../chunk-E6BIXJ6C.js';
|
|
16
|
+
export { anyOptionalStructureOpen, computeReadiness, fieldFilled, foldsBehindOptionalDisclosure, isFilled, isFoldedOptional, isOptionalStructure, mustBeFilled, optionalStructureOpen, shownAsOptional } from '../chunk-XO5OENNF.js';
|
|
15
17
|
import '../chunk-Y2ND6W4W.js';
|
|
16
18
|
export { normalizeSchemaForRjsf, prepareSchemaForRjsf } from '../chunk-LBFZXYCY.js';
|
|
17
|
-
export { anyOptionalStructureOpen, computeReadiness, fieldFilled, foldsBehindOptionalDisclosure, isFilled, isFoldedOptional, isOptionalStructure, mustBeFilled, optionalStructureOpen, shownAsOptional } from '../chunk-XO5OENNF.js';
|
|
18
19
|
export { collapseNullable, collectSchemaDefs, derefSchema, flattenAnyOf, hoistDefsToRoot, resolveSchemaIndirection, schemaTypeOf } from '../chunk-OD3VYXUY.js';
|
|
19
20
|
export { buildPipeRef, getPipeIOContract, inputMustBeFilled, isFixedCountInput, isOptionalInput, isPluralInput } from '../chunk-WYH56SOZ.js';
|
|
20
21
|
import '../chunk-V3OV2XQT.js';
|
package/dist/core/sources.d.ts
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* answers with, and the rules that write an answer into a value are tested in
|
|
14
14
|
* node. No React, no fetch. What a row SAYS is data here (`SourceFile`'s
|
|
15
15
|
* `typeLabel` and `origin` are the host's words); how a row DRAWS is a
|
|
16
|
-
* rendering, so the glyph a host draws on a row
|
|
17
|
-
*
|
|
16
|
+
* rendering, so the glyph a host draws on a file's row and the line it draws
|
|
17
|
+
* under an example's name are `./react`'s (`FilePickerSource.renderGlyph`,
|
|
18
|
+
* `ExamplePickerSource.renderDetail`), never a field of these shapes.
|
|
18
19
|
*/
|
|
19
20
|
/** Whose files a file source lists: the person's own, or the whole team's. */
|
|
20
21
|
type FileSourceScope = 'mine' | 'everyone';
|
|
@@ -121,20 +122,44 @@ interface ExampleSourcePage {
|
|
|
121
122
|
}
|
|
122
123
|
/**
|
|
123
124
|
* Where a form can take a whole set of values. When a form has one, it offers
|
|
124
|
-
* "Fill with an example". `rename` and `delete` are capabilities: each
|
|
125
|
-
* offered on a row's menu only when given, so a host gives
|
|
126
|
-
* person
|
|
125
|
+
* "Fill with an example". `open`, `rename` and `delete` are capabilities: each
|
|
126
|
+
* is offered on a row's menu only when given, Open first, so a host gives each
|
|
127
|
+
* only to a person it is for, and `rename` and `delete` only to a person
|
|
128
|
+
* allowed to change examples. A source with any one of them has a row menu.
|
|
129
|
+
*
|
|
130
|
+
* The three are declared as methods, as `./react`'s `renderDetail` is,
|
|
131
|
+
* because TypeScript compares a method's parameter in both directions: a
|
|
132
|
+
* source whose handlers take the host's own example type, the type its `list`
|
|
133
|
+
* answers with, is accepted. Declared as function-typed properties they would
|
|
134
|
+
* refuse it under `strictFunctionTypes`, which is why they must stay methods.
|
|
135
|
+
* The control calls each on its source, so a class's methods keep `this`.
|
|
127
136
|
*/
|
|
128
137
|
interface ExampleSource {
|
|
129
138
|
/** Lists one page of the method's examples. Rejecting shows the failure with Try again. */
|
|
130
139
|
list: (query: ExampleSourceQuery) => Promise<ExampleSourcePage>;
|
|
140
|
+
/**
|
|
141
|
+
* Opens an example in the host's own surface, to show what it holds and
|
|
142
|
+
* what it produced. Choosing Open closes the list and gives focus back to
|
|
143
|
+
* "Fill with an example", then calls `open` once, so a surface the host
|
|
144
|
+
* opens over the form from there returns focus there as it closes.
|
|
145
|
+
*
|
|
146
|
+
* `fill` is the row's own choice of that example, made when it is called:
|
|
147
|
+
* the example's inputs read back against the form's fields as they are at
|
|
148
|
+
* that moment, "Replace what you entered?" asked first when the form holds
|
|
149
|
+
* the person's own values, and nothing at all while the form is held shut
|
|
150
|
+
* or once the control is gone, `hideWhenEmpty` having taken it away included.
|
|
151
|
+
* It fills through the same path a row's choice does, so a host's "Fill the
|
|
152
|
+
* form" calls it rather than setting the values itself. It may be called
|
|
153
|
+
* any number of times, or never.
|
|
154
|
+
*/
|
|
155
|
+
open?(example: FormExample, fill: () => void): void;
|
|
131
156
|
/**
|
|
132
157
|
* Renames an example. Resolving to the example as stored replaces the row;
|
|
133
158
|
* resolving to nothing keeps the row under the new name.
|
|
134
159
|
*/
|
|
135
|
-
rename
|
|
160
|
+
rename?(example: FormExample, name: string): Promise<FormExample | void>;
|
|
136
161
|
/** Deletes an example. Asked for only after the person confirmed it. */
|
|
137
|
-
delete
|
|
162
|
+
delete?(example: FormExample): Promise<void>;
|
|
138
163
|
/**
|
|
139
164
|
* Whether "Fill with an example" is left out while the method has no
|
|
140
165
|
* example. `false` by default, when the empty list says how to make one.
|
package/dist/core/sources.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { addChosenFiles, chosenFilesAdded, placeDroppedFiles, roomForChosenFiles, roomForDroppedFiles, sourceFileValue } from '../chunk-
|
|
1
|
+
export { addChosenFiles, chosenFilesAdded, placeDroppedFiles, roomForChosenFiles, roomForDroppedFiles, sourceFileValue } from '../chunk-L23R3JNQ.js';
|
|
2
2
|
//# sourceMappingURL=sources.js.map
|
|
3
3
|
//# sourceMappingURL=sources.js.map
|
|
@@ -28,8 +28,9 @@ interface FilePickerSource<F extends SourceFile = SourceFile> extends FileSource
|
|
|
28
28
|
* (the row is at least 64px tall and grows with a larger glyph), and is
|
|
29
29
|
* hidden from assistive technology, since the row's second line says the
|
|
30
30
|
* type. A row it returns what React renders nothing for keeps the kernel's
|
|
31
|
-
* glyph: `null`, `undefined`, `true`, `false` or `''`,
|
|
32
|
-
*
|
|
31
|
+
* glyph: `null`, `undefined`, `true`, `false` or `''`, or an array of
|
|
32
|
+
* nothing but those, an empty one included, so a `cond && <Tile />` whose
|
|
33
|
+
* condition is false, or a `.map()` over nothing, falls back as it reads. A
|
|
33
34
|
* number is drawn, `0` included, because React draws it as text, so a
|
|
34
35
|
* condition that is a count is the host's to turn into a boolean.
|
|
35
36
|
*/
|
|
@@ -9,7 +9,7 @@ import { Components, Renderer } from '@json-render/react';
|
|
|
9
9
|
import { B as BrandManifest } from '../manifest-DUeAWeqa.js';
|
|
10
10
|
export { b as brandManifestSchema } from '../manifest-DUeAWeqa.js';
|
|
11
11
|
import * as zod_v4_core from 'zod/v4/core';
|
|
12
|
-
import { F as FieldEnv } from '../field-renderer-
|
|
12
|
+
import { F as FieldEnv } from '../field-renderer-Dz03dpig.js';
|
|
13
13
|
export { seedInputs } from '../core/seed.js';
|
|
14
14
|
import '../core/contracts.js';
|
|
15
15
|
import 'mthds/protocol';
|
package/dist/generative/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn, checkedAccentClass, focusOutlineClass, linkTextClass, selectedBorderClass, selectedFillClass, fieldControlClass, ResultRoot, ResultField, FieldRenderer, ToggleGroup, ToggleGroupItem, selectedFillStrongClass, Switch, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../chunk-
|
|
2
|
+
import { cn, checkedAccentClass, focusOutlineClass, linkTextClass, selectedBorderClass, selectedFillClass, fieldControlClass, ResultRoot, ResultField, FieldRenderer, enumLabeler, useFieldPresentation, ToggleGroup, ToggleGroupItem, selectedFillStrongClass, Switch, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../chunk-RHX7LQRL.js';
|
|
3
3
|
import '../chunk-4VAO6BDE.js';
|
|
4
4
|
export { seedInputs } from '../chunk-VH5CDQDR.js';
|
|
5
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-L23R3JNQ.js';
|
|
6
6
|
import '../chunk-56WECFBD.js';
|
|
7
7
|
import '../chunk-ZX52CQJ4.js';
|
|
8
|
+
import '../chunk-GHVVULHY.js';
|
|
8
9
|
import { isNativeValueNode, readDateContent, formatDateContent, isNativeHtmlNode, isNativeDateNode, isNativeCompositeNode } from '../chunk-QQK6Y55E.js';
|
|
9
10
|
export { brandManifestSchema } from '../chunk-QFX332LE.js';
|
|
10
11
|
import '../chunk-ZB4RYUKV.js';
|
|
@@ -2123,6 +2124,7 @@ function Radio({
|
|
|
2123
2124
|
}) {
|
|
2124
2125
|
const id = useControlId(props.name);
|
|
2125
2126
|
const field = useBoundField(props.value, bindings?.value, "", props);
|
|
2127
|
+
const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());
|
|
2126
2128
|
return /* @__PURE__ */ jsxs("fieldset", { className: "space-y-2", "aria-invalid": field.error ? true : void 0, children: [
|
|
2127
2129
|
/* @__PURE__ */ jsx("legend", { className: LABEL, children: props.label }),
|
|
2128
2130
|
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: (props.options ?? []).map((option, index) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
@@ -2141,7 +2143,7 @@ function Radio({
|
|
|
2141
2143
|
}
|
|
2142
2144
|
}
|
|
2143
2145
|
),
|
|
2144
|
-
/* @__PURE__ */ jsx("span", { children: option })
|
|
2146
|
+
/* @__PURE__ */ jsx("span", { children: labelOf(option) })
|
|
2145
2147
|
] }, `${index}-${option}`)) }),
|
|
2146
2148
|
/* @__PURE__ */ jsx(FieldError, { message: field.error })
|
|
2147
2149
|
] });
|
|
@@ -2322,6 +2324,7 @@ function AccessibleSelect({ props, bindings, emit }) {
|
|
|
2322
2324
|
hasValidation ? { checks: props.checks ?? [], validateOn } : void 0
|
|
2323
2325
|
);
|
|
2324
2326
|
const id = useControlId(props.name);
|
|
2327
|
+
const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());
|
|
2325
2328
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2326
2329
|
/* @__PURE__ */ jsx("label", { htmlFor: id, className: "block text-sm leading-none font-medium", children: props.label }),
|
|
2327
2330
|
/* @__PURE__ */ jsxs(
|
|
@@ -2335,7 +2338,7 @@ function AccessibleSelect({ props, bindings, emit }) {
|
|
|
2335
2338
|
},
|
|
2336
2339
|
children: [
|
|
2337
2340
|
/* @__PURE__ */ jsx(SelectTrigger, { id, className: "w-full", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: props.placeholder ?? "Select..." }) }),
|
|
2338
|
-
/* @__PURE__ */ jsx(SelectContent, { children: (props.options ?? []).map((option, index) => /* @__PURE__ */ jsx(SelectItem, { value: option, children: option }, `${index}-${option}`)) })
|
|
2341
|
+
/* @__PURE__ */ jsx(SelectContent, { children: (props.options ?? []).map((option, index) => /* @__PURE__ */ jsx(SelectItem, { value: option, children: labelOf(option) }, `${index}-${option}`)) })
|
|
2339
2342
|
]
|
|
2340
2343
|
}
|
|
2341
2344
|
),
|
|
@@ -2591,6 +2594,7 @@ function Segmented({ props, bindings, emit }) {
|
|
|
2591
2594
|
const value = isBound ? boundValue ?? "" : localValue;
|
|
2592
2595
|
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
2593
2596
|
const labelId = useControlId(props.name);
|
|
2597
|
+
const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());
|
|
2594
2598
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2595
2599
|
/* @__PURE__ */ jsx("span", { id: labelId, className: "block text-sm leading-none font-medium", children: props.label }),
|
|
2596
2600
|
/* @__PURE__ */ jsx(
|
|
@@ -2612,7 +2616,7 @@ function Segmented({ props, bindings, emit }) {
|
|
|
2612
2616
|
variant: "outline",
|
|
2613
2617
|
size: "sm",
|
|
2614
2618
|
className: "rounded-full px-3.5 data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",
|
|
2615
|
-
children: option
|
|
2619
|
+
children: labelOf(option)
|
|
2616
2620
|
},
|
|
2617
2621
|
option
|
|
2618
2622
|
))
|