@stapel/forms-react 0.1.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.
Files changed (203) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/MODULE.md +172 -0
  3. package/README.md +207 -0
  4. package/dist/api/export.d.ts +66 -0
  5. package/dist/api/export.d.ts.map +1 -0
  6. package/dist/api/export.js +138 -0
  7. package/dist/api/export.js.map +1 -0
  8. package/dist/api/extensions.d.ts +8 -0
  9. package/dist/api/extensions.d.ts.map +1 -0
  10. package/dist/api/extensions.js +8 -0
  11. package/dist/api/extensions.js.map +1 -0
  12. package/dist/api/formsApi.d.ts +113 -0
  13. package/dist/api/formsApi.d.ts.map +1 -0
  14. package/dist/api/formsApi.js +81 -0
  15. package/dist/api/formsApi.js.map +1 -0
  16. package/dist/api/generated/schema.d.ts +987 -0
  17. package/dist/api/generated/schema.d.ts.map +1 -0
  18. package/dist/api/generated/schema.js +2 -0
  19. package/dist/api/generated/schema.js.map +1 -0
  20. package/dist/api/types.d.ts +222 -0
  21. package/dist/api/types.d.ts.map +1 -0
  22. package/dist/api/types.js +14 -0
  23. package/dist/api/types.js.map +1 -0
  24. package/dist/default/ConfigField.d.ts +32 -0
  25. package/dist/default/ConfigField.d.ts.map +1 -0
  26. package/dist/default/ConfigField.js +101 -0
  27. package/dist/default/ConfigField.js.map +1 -0
  28. package/dist/default/ErrorAlert.d.ts +9 -0
  29. package/dist/default/ErrorAlert.d.ts.map +1 -0
  30. package/dist/default/ErrorAlert.js +27 -0
  31. package/dist/default/ErrorAlert.js.map +1 -0
  32. package/dist/default/FormBuilderPane.d.ts +36 -0
  33. package/dist/default/FormBuilderPane.d.ts.map +1 -0
  34. package/dist/default/FormBuilderPane.js +70 -0
  35. package/dist/default/FormBuilderPane.js.map +1 -0
  36. package/dist/default/FormsListPane.d.ts +18 -0
  37. package/dist/default/FormsListPane.d.ts.map +1 -0
  38. package/dist/default/FormsListPane.js +28 -0
  39. package/dist/default/FormsListPane.js.map +1 -0
  40. package/dist/default/ResponsesPane.d.ts +21 -0
  41. package/dist/default/ResponsesPane.d.ts.map +1 -0
  42. package/dist/default/ResponsesPane.js +118 -0
  43. package/dist/default/ResponsesPane.js.map +1 -0
  44. package/dist/default/StapelForm.d.ts +76 -0
  45. package/dist/default/StapelForm.d.ts.map +1 -0
  46. package/dist/default/StapelForm.js +118 -0
  47. package/dist/default/StapelForm.js.map +1 -0
  48. package/dist/default/fields.d.ts +11 -0
  49. package/dist/default/fields.d.ts.map +1 -0
  50. package/dist/default/fields.js +273 -0
  51. package/dist/default/fields.js.map +1 -0
  52. package/dist/default/index.d.ts +42 -0
  53. package/dist/default/index.d.ts.map +1 -0
  54. package/dist/default/index.js +37 -0
  55. package/dist/default/index.js.map +1 -0
  56. package/dist/default/slots.d.ts +59 -0
  57. package/dist/default/slots.d.ts.map +1 -0
  58. package/dist/default/slots.js +25 -0
  59. package/dist/default/slots.js.map +1 -0
  60. package/dist/default/theme.d.ts +23 -0
  61. package/dist/default/theme.d.ts.map +1 -0
  62. package/dist/default/theme.js +38 -0
  63. package/dist/default/theme.js.map +1 -0
  64. package/dist/default/types.d.ts +12 -0
  65. package/dist/default/types.d.ts.map +1 -0
  66. package/dist/default/types.js +2 -0
  67. package/dist/default/types.js.map +1 -0
  68. package/dist/flows/errors.d.ts +12 -0
  69. package/dist/flows/errors.d.ts.map +1 -0
  70. package/dist/flows/errors.js +13 -0
  71. package/dist/flows/errors.js.map +1 -0
  72. package/dist/flows/registry.d.ts +22 -0
  73. package/dist/flows/registry.d.ts.map +1 -0
  74. package/dist/flows/registry.js +20 -0
  75. package/dist/flows/registry.js.map +1 -0
  76. package/dist/headless/FormBuilder.d.ts +100 -0
  77. package/dist/headless/FormBuilder.d.ts.map +1 -0
  78. package/dist/headless/FormBuilder.js +278 -0
  79. package/dist/headless/FormBuilder.js.map +1 -0
  80. package/dist/headless/FormFill.d.ts +88 -0
  81. package/dist/headless/FormFill.d.ts.map +1 -0
  82. package/dist/headless/FormFill.js +279 -0
  83. package/dist/headless/FormFill.js.map +1 -0
  84. package/dist/headless/FormList.d.ts +34 -0
  85. package/dist/headless/FormList.d.ts.map +1 -0
  86. package/dist/headless/FormList.js +37 -0
  87. package/dist/headless/FormList.js.map +1 -0
  88. package/dist/headless/FormsProvider.d.ts +19 -0
  89. package/dist/headless/FormsProvider.d.ts.map +1 -0
  90. package/dist/headless/FormsProvider.js +15 -0
  91. package/dist/headless/FormsProvider.js.map +1 -0
  92. package/dist/headless/ResponsesTable.d.ts +82 -0
  93. package/dist/headless/ResponsesTable.d.ts.map +1 -0
  94. package/dist/headless/ResponsesTable.js +195 -0
  95. package/dist/headless/ResponsesTable.js.map +1 -0
  96. package/dist/i18n/errorsMap.d.ts +10 -0
  97. package/dist/i18n/errorsMap.d.ts.map +1 -0
  98. package/dist/i18n/errorsMap.js +20 -0
  99. package/dist/i18n/errorsMap.js.map +1 -0
  100. package/dist/i18n/es.d.ts +7 -0
  101. package/dist/i18n/es.d.ts.map +1 -0
  102. package/dist/i18n/es.js +118 -0
  103. package/dist/i18n/es.js.map +1 -0
  104. package/dist/i18n/generated/errors.es.gen.d.ts +16 -0
  105. package/dist/i18n/generated/errors.es.gen.d.ts.map +1 -0
  106. package/dist/i18n/generated/errors.es.gen.js +79 -0
  107. package/dist/i18n/generated/errors.es.gen.js.map +1 -0
  108. package/dist/i18n/generated/errors.gen.d.ts +485 -0
  109. package/dist/i18n/generated/errors.gen.d.ts.map +1 -0
  110. package/dist/i18n/generated/errors.gen.js +246 -0
  111. package/dist/i18n/generated/errors.gen.js.map +1 -0
  112. package/dist/i18n/generated/errors.ru.gen.d.ts +16 -0
  113. package/dist/i18n/generated/errors.ru.gen.d.ts.map +1 -0
  114. package/dist/i18n/generated/errors.ru.gen.js +79 -0
  115. package/dist/i18n/generated/errors.ru.gen.js.map +1 -0
  116. package/dist/i18n/keys.d.ts +141 -0
  117. package/dist/i18n/keys.d.ts.map +1 -0
  118. package/dist/i18n/keys.js +233 -0
  119. package/dist/i18n/keys.js.map +1 -0
  120. package/dist/i18n/ru.d.ts +7 -0
  121. package/dist/i18n/ru.d.ts.map +1 -0
  122. package/dist/i18n/ru.js +127 -0
  123. package/dist/i18n/ru.js.map +1 -0
  124. package/dist/index.d.ts +61 -0
  125. package/dist/index.d.ts.map +1 -0
  126. package/dist/index.js +55 -0
  127. package/dist/index.js.map +1 -0
  128. package/dist/model/context.d.ts +11 -0
  129. package/dist/model/context.d.ts.map +1 -0
  130. package/dist/model/context.js +16 -0
  131. package/dist/model/context.js.map +1 -0
  132. package/dist/model/mutations.d.ts +135 -0
  133. package/dist/model/mutations.d.ts.map +1 -0
  134. package/dist/model/mutations.js +223 -0
  135. package/dist/model/mutations.js.map +1 -0
  136. package/dist/model/queries.d.ts +59 -0
  137. package/dist/model/queries.d.ts.map +1 -0
  138. package/dist/model/queries.js +117 -0
  139. package/dist/model/queries.js.map +1 -0
  140. package/dist/model/queryKeys.d.ts +28 -0
  141. package/dist/model/queryKeys.d.ts.map +1 -0
  142. package/dist/model/queryKeys.js +23 -0
  143. package/dist/model/queryKeys.js.map +1 -0
  144. package/dist/model/runtime.d.ts +28 -0
  145. package/dist/model/runtime.d.ts.map +1 -0
  146. package/dist/model/runtime.js +14 -0
  147. package/dist/model/runtime.js.map +1 -0
  148. package/dist/widgets/configForms.d.ts +112 -0
  149. package/dist/widgets/configForms.d.ts.map +1 -0
  150. package/dist/widgets/configForms.js +211 -0
  151. package/dist/widgets/configForms.js.map +1 -0
  152. package/dist/widgets/registry.d.ts +83 -0
  153. package/dist/widgets/registry.d.ts.map +1 -0
  154. package/dist/widgets/registry.js +27 -0
  155. package/dist/widgets/registry.js.map +1 -0
  156. package/dist/widgets/validate.d.ts +57 -0
  157. package/dist/widgets/validate.d.ts.map +1 -0
  158. package/dist/widgets/validate.js +173 -0
  159. package/dist/widgets/validate.js.map +1 -0
  160. package/llms.txt +124 -0
  161. package/manifest.json +1038 -0
  162. package/package.json +108 -0
  163. package/src/analytics/generated/events.json +7 -0
  164. package/src/api/export.ts +195 -0
  165. package/src/api/extensions.ts +7 -0
  166. package/src/api/formsApi.ts +329 -0
  167. package/src/api/generated/schema.ts +989 -0
  168. package/src/api/types.ts +276 -0
  169. package/src/default/ConfigField.tsx +227 -0
  170. package/src/default/ErrorAlert.tsx +46 -0
  171. package/src/default/FormBuilderPane.tsx +414 -0
  172. package/src/default/FormsListPane.tsx +144 -0
  173. package/src/default/ResponsesPane.tsx +332 -0
  174. package/src/default/StapelForm.tsx +377 -0
  175. package/src/default/fields.tsx +454 -0
  176. package/src/default/index.ts +71 -0
  177. package/src/default/slots.ts +78 -0
  178. package/src/default/theme.tsx +65 -0
  179. package/src/default/types.ts +12 -0
  180. package/src/flows/errors.ts +16 -0
  181. package/src/flows/registry.ts +32 -0
  182. package/src/headless/FormBuilder.tsx +453 -0
  183. package/src/headless/FormFill.tsx +396 -0
  184. package/src/headless/FormList.tsx +74 -0
  185. package/src/headless/FormsProvider.tsx +20 -0
  186. package/src/headless/ResponsesTable.tsx +341 -0
  187. package/src/i18n/errorsMap.ts +31 -0
  188. package/src/i18n/es.ts +140 -0
  189. package/src/i18n/generated/errors.es.gen.ts +85 -0
  190. package/src/i18n/generated/errors.gen.ts +277 -0
  191. package/src/i18n/generated/errors.json +583 -0
  192. package/src/i18n/generated/errors.ru.gen.ts +85 -0
  193. package/src/i18n/keys.ts +264 -0
  194. package/src/i18n/ru.ts +150 -0
  195. package/src/index.ts +184 -0
  196. package/src/model/context.tsx +28 -0
  197. package/src/model/mutations.ts +387 -0
  198. package/src/model/queries.ts +154 -0
  199. package/src/model/queryKeys.ts +61 -0
  200. package/src/model/runtime.ts +48 -0
  201. package/src/widgets/registry.ts +101 -0
  202. package/src/widgets/validate.ts +224 -0
  203. package/tsconfig.json +26 -0
@@ -0,0 +1,273 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * The antd BUILTIN field widgets — one per attribute kind stapel-forms allows
4
+ * (`STAPEL_FORMS["FIELD_KINDS"]`, ten of them).
5
+ *
6
+ * ── Where these sit in the resolution ladder ───────────────────────────────
7
+ *
8
+ * explicit `registerFormFieldWidget(kind, …)` ← a host's, always wins
9
+ * → this table ← the skin's default
10
+ * → the unsupported-field notice ← loud, never silent
11
+ *
12
+ * The host's registration outranks the skin's builtin, mirroring docs-react's
13
+ * `DocSurface`, so "override without fork" is real and not a slogan: a host
14
+ * that dislikes this `select` replaces it in one line and keeps every other
15
+ * widget.
16
+ *
17
+ * ── Two deliberate departures from the spec's widget sketch ────────────────
18
+ *
19
+ * 1. **`date` uses a native `<input type=…>`, not antd's `DatePicker`.**
20
+ * `DatePicker` speaks Dayjs objects, which would make `dayjs` a runtime
21
+ * dependency of this pair for exactly one widget — and would put a
22
+ * format-guessing step between the person and the wire, where today the
23
+ * native control hands over the ISO string
24
+ * (`YYYY-MM-DD` / `YYYY-MM` / `YYYY-MM-DDTHH:mm`) that the attributes date
25
+ * type already parses. The `precision` config selects the input type, so
26
+ * "year only" is a number and "datetime" is a datetime-local. A host that
27
+ * wants the antd picker registers it — that is what the seam is for.
28
+ *
29
+ * 2. **`select` renders `Segmented` at ≤4 single-choice options, else
30
+ * `Select`** — the profiles-react `FieldRow` threshold, kept identical so
31
+ * the fleet's forms and its settings screens read the same way.
32
+ *
33
+ * Values are BARE SCALARS. The server normalizes a single `select` answer to
34
+ * a list, so no widget wraps its own value; the one exception is
35
+ * `convertible_unit`, whose wire DTO genuinely is an object
36
+ * (`{type, value, unit}` — `stapel_attributes.types.convertible_unit.dto`).
37
+ */
38
+ import { useMemo } from "react";
39
+ import { Cascader, ColorPicker, Flex, Input, InputNumber, Segmented, Select, Switch, Typography, } from "antd";
40
+ import { useT } from "@stapel/core";
41
+ import { optionValues } from "../widgets/validate.js";
42
+ import { FORMS_I18N_KEYS } from "../i18n/keys.js";
43
+ /** At or below this many choices a single-select renders as a `Segmented`
44
+ * (the profiles-react threshold — kept identical on purpose). */
45
+ const SEGMENTED_MAX_OPTIONS = 4;
46
+ /**
47
+ * antd's `status` prop under `exactOptionalPropertyTypes` does not accept
48
+ * `undefined` — it wants the key ABSENT. Spread this instead of passing
49
+ * `status={error ? "error" : undefined}`, which every control in this file
50
+ * would otherwise have to spell out.
51
+ */
52
+ function errorStatus(error) {
53
+ return error ? { status: "error" } : {};
54
+ }
55
+ function config(field) {
56
+ return field.config ?? {};
57
+ }
58
+ function numberish(value) {
59
+ if (typeof value === "number" && Number.isFinite(value))
60
+ return value;
61
+ if (typeof value === "string" && value.trim().length > 0) {
62
+ const parsed = Number(value);
63
+ if (Number.isFinite(parsed))
64
+ return parsed;
65
+ }
66
+ return undefined;
67
+ }
68
+ function str(value) {
69
+ return typeof value === "string" ? value : value == null ? "" : String(value);
70
+ }
71
+ /** `{value, label}` choices for antd, from either option shape the attributes
72
+ * types allow (bare scalars, or `{value, label}` objects). */
73
+ function choiceList(field) {
74
+ const raw = config(field)["options"];
75
+ if (!Array.isArray(raw))
76
+ return [];
77
+ return raw.map((option) => {
78
+ if (option !== null && typeof option === "object") {
79
+ const entry = option;
80
+ const value = str(entry.value);
81
+ return { value, label: entry.label == null ? value : str(entry.label) };
82
+ }
83
+ return { value: str(option), label: str(option) };
84
+ });
85
+ }
86
+ // ── string ───────────────────────────────────────────────────────────────────
87
+ /**
88
+ * `string` → `Input`, or `Input.TextArea` when `config.multiline` is set
89
+ * (stapel-attributes 0.4.6). Absent means single-line, which is what every
90
+ * schema published before that release carries — so nothing stored needs a
91
+ * migration and the widget needs no fallback heuristic.
92
+ */
93
+ const StringWidget = (props) => {
94
+ const cfg = config(props.field);
95
+ const maxLength = numberish(cfg["maxLength"]);
96
+ const placeholder = str(cfg["placeholder"]);
97
+ const common = {
98
+ id: props.id,
99
+ value: str(props.value),
100
+ disabled: props.disabled,
101
+ ...errorStatus(props.error),
102
+ ...(maxLength !== undefined ? { maxLength } : {}),
103
+ ...(placeholder.length > 0 ? { placeholder } : {}),
104
+ };
105
+ return cfg["multiline"] === true ? (_jsx(Input.TextArea, { ...common, autoSize: { minRows: 3, maxRows: 8 }, onChange: (event) => props.onChange(event.target.value) })) : (_jsx(Input, { ...common, onChange: (event) => props.onChange(event.target.value) }));
106
+ };
107
+ // ── int / float ──────────────────────────────────────────────────────────────
108
+ function makeNumberWidget(isInt) {
109
+ const Widget = (props) => {
110
+ const cfg = config(props.field);
111
+ const min = numberish(cfg["min"]);
112
+ const max = numberish(cfg["max"]);
113
+ const precision = isInt ? 0 : numberish(cfg["precision"]);
114
+ const placeholder = str(cfg["placeholder"]);
115
+ return (_jsx(InputNumber, { id: props.id, style: { width: "100%" }, value: numberish(props.value) ?? null, disabled: props.disabled, ...errorStatus(props.error), ...(min !== undefined ? { min } : {}), ...(max !== undefined ? { max } : {}), ...(precision !== undefined ? { precision } : {}), ...(isInt ? { step: 1 } : {}), ...(placeholder.length > 0 ? { placeholder } : {}), ...(str(cfg["prefix"]).length > 0 ? { prefix: str(cfg["prefix"]) } : {}), ...(str(cfg["postfix"]).length > 0 ? { suffix: str(cfg["postfix"]) } : {}), onChange: (next) => props.onChange(next ?? undefined) }));
116
+ };
117
+ Widget.displayName = isInt ? "IntWidget" : "FloatWidget";
118
+ return Widget;
119
+ }
120
+ // ── bool ─────────────────────────────────────────────────────────────────────
121
+ /** `bool` → `Switch`, labelled with the config's own `trueLabel`/`falseLabel`
122
+ * when the admin supplied them. */
123
+ const BoolWidget = (props) => {
124
+ const t = useT();
125
+ const cfg = config(props.field);
126
+ const on = props.value === true;
127
+ const trueLabel = str(cfg["trueLabel"]) || t(FORMS_I18N_KEYS.fillBoolYes);
128
+ const falseLabel = str(cfg["falseLabel"]) || t(FORMS_I18N_KEYS.fillBoolNo);
129
+ return (_jsxs(Flex, { align: "center", gap: 8, children: [_jsx(Switch, { id: props.id, checked: on, disabled: props.disabled, onChange: (checked) => props.onChange(checked) }), _jsx(Typography.Text, { type: "secondary", children: on ? trueLabel : falseLabel })] }));
130
+ };
131
+ // ── select ───────────────────────────────────────────────────────────────────
132
+ /**
133
+ * `select` → `Segmented` for a small single choice, `Select` otherwise
134
+ * (multiple when the config allows more than one).
135
+ *
136
+ * `maxSelected` absent means UNLIMITED — that is the engine's own
137
+ * `SelectConfig` default, and reading an absent key as 1 would silently turn
138
+ * every unconfigured select into a single-choice control.
139
+ */
140
+ const SelectWidget = (props) => {
141
+ const t = useT();
142
+ const cfg = config(props.field);
143
+ const choices = choiceList(props.field);
144
+ const maxSelected = numberish(cfg["maxSelected"]);
145
+ const multiple = maxSelected === undefined || maxSelected > 1;
146
+ if (!multiple && choices.length > 0 && choices.length <= SEGMENTED_MAX_OPTIONS) {
147
+ const current = str(Array.isArray(props.value) ? props.value[0] : props.value);
148
+ return (_jsx(Segmented, { id: props.id, options: [...choices], value: current, disabled: props.disabled, ...errorStatus(props.error), onChange: (next) => props.onChange(next) }));
149
+ }
150
+ const value = multiple
151
+ ? (Array.isArray(props.value) ? props.value : props.value == null ? [] : [props.value]).map(str)
152
+ : str(Array.isArray(props.value) ? props.value[0] : props.value) || undefined;
153
+ return (_jsx(Select, { id: props.id, style: { width: "100%" }, options: [...choices], disabled: props.disabled, ...errorStatus(props.error), placeholder: t(FORMS_I18N_KEYS.fillSelectPlaceholder), ...(multiple ? { mode: "multiple" } : {}), ...(multiple && maxSelected !== undefined ? { maxCount: maxSelected } : {}), ...(cfg["allowCustom"] === true && multiple
154
+ ? { mode: "tags" }
155
+ : {}), value: value, onChange: (next) => props.onChange(next) }));
156
+ };
157
+ // ── date ─────────────────────────────────────────────────────────────────────
158
+ /** `precision` → the native input type that produces exactly the ISO string
159
+ * the attributes date type parses. */
160
+ const DATE_INPUT_TYPE = {
161
+ month: "month",
162
+ date: "date",
163
+ datetime: "datetime-local",
164
+ };
165
+ const DateWidget = (props) => {
166
+ const cfg = config(props.field);
167
+ const precision = str(cfg["precision"]) || "date";
168
+ // "Year only" is a number, not a date: a date input would force a month and
169
+ // a day the admin explicitly said they do not want.
170
+ if (precision === "year") {
171
+ return (_jsx(InputNumber, { style: { width: "100%" }, value: numberish(props.value) ?? null, disabled: props.disabled, ...errorStatus(props.error), step: 1, precision: 0, onChange: (next) => props.onChange(next ?? undefined) }));
172
+ }
173
+ return (_jsx(Input, { id: props.id, type: DATE_INPUT_TYPE[precision] ?? "date", value: str(props.value), disabled: props.disabled, ...errorStatus(props.error), ...(str(cfg["minDate"]).length > 0 ? { min: str(cfg["minDate"]) } : {}), ...(str(cfg["maxDate"]).length > 0 ? { max: str(cfg["maxDate"]) } : {}), onChange: (event) => props.onChange(event.target.value || undefined) }));
174
+ };
175
+ // ── header ───────────────────────────────────────────────────────────────────
176
+ /**
177
+ * `header` → a caption, and NOT a control.
178
+ *
179
+ * It never calls `onChange`: the engine regenerates a header's DAO from its
180
+ * config and stapel-forms rejects an answer to one outright (backend delta
181
+ * note 1), so a header that could hold a value would only ever produce a
182
+ * refused submit. `config.style` is `l` (H1) or `m` (H2) — with the upstream
183
+ * default `"h2"` matching NEITHER (LN-B01, preserved), which is why anything
184
+ * that is not `l` reads as H2 rather than being looked up.
185
+ */
186
+ const HeaderWidget = (props) => {
187
+ const level = str(config(props.field)["style"]) === "l" ? 3 : 4;
188
+ return (_jsx(Typography.Title, { level: level, style: { marginBottom: 0 }, children: props.field.name ?? "" }));
189
+ };
190
+ // ── hex_color ────────────────────────────────────────────────────────────────
191
+ const HexColorWidget = (props) => {
192
+ const presets = useMemo(() => {
193
+ const values = optionValues(props.field) ?? [];
194
+ return values.length > 0
195
+ ? [{ label: props.field.name ?? "", colors: values.map(str) }]
196
+ : undefined;
197
+ }, [props.field]);
198
+ const current = str(props.value);
199
+ return (
200
+ // antd's ColorPicker renders no labelable form control and accepts no
201
+ // `id`, so the field row's `<label for>` cannot reach it. The accessible
202
+ // name therefore comes from the trigger's own text (`showText`), and the
203
+ // wrapper carries the id so the label at least resolves to this region.
204
+ _jsx("span", { id: props.id, children: _jsx(ColorPicker, { disabled: props.disabled, format: "hex", ...(presets ? { presets } : {}), ...(current.length > 0 ? { value: current } : {}), onChange: (color) => props.onChange(color.toHexString()), showText: true }) }));
205
+ };
206
+ // ── hierarchical_select ──────────────────────────────────────────────────────
207
+ /** `hierarchical_select` → `Cascader`. The config's nested
208
+ * `{value, label, children}` options are already the shape antd wants, and
209
+ * the answer is the path array the engine stores. */
210
+ const HierarchicalSelectWidget = (props) => {
211
+ const t = useT();
212
+ const raw = config(props.field)["options"];
213
+ const options = Array.isArray(raw) ? raw : [];
214
+ const value = Array.isArray(props.value) ? props.value.map(str) : undefined;
215
+ return (_jsx(Cascader, { id: props.id, style: { width: "100%" }, options: options, disabled: props.disabled, ...errorStatus(props.error), placeholder: t(FORMS_I18N_KEYS.fillSelectPlaceholder), ...(value ? { value } : {}), onChange: (next) => props.onChange(next ?? undefined) }));
216
+ };
217
+ // ── convertible_unit ─────────────────────────────────────────────────────────
218
+ /**
219
+ * `convertible_unit` → a number beside the unit it is expressed in.
220
+ *
221
+ * The one widget whose value is an OBJECT, because its wire DTO is:
222
+ * `{type: "convertible_unit", value, unit}` — the number as typed, tagged
223
+ * with which of the config's `unit_m` (metric) / `unit_i` (imperial) codes it
224
+ * is in. The server converts to the family's base unit before validating, so
225
+ * the widget must send the unit and must NOT convert anything itself.
226
+ *
227
+ * This kind has no upstream `config_form()` declaration, so it ships
228
+ * BUILDER-LESS (spec §12 risk 5) — it renders and submits correctly, it just
229
+ * cannot be configured in `<FormBuilderPane>`.
230
+ */
231
+ const ConvertibleUnitWidget = (props) => {
232
+ const cfg = config(props.field);
233
+ const units = [str(cfg["unit_m"]), str(cfg["unit_i"])].filter((code) => code.length > 0);
234
+ const current = props.value !== null && typeof props.value === "object"
235
+ ? props.value
236
+ : {};
237
+ const unit = str(current.unit) || units[0] || "";
238
+ const amount = numberish(current.value);
239
+ const precision = numberish(cfg["precision"]);
240
+ const emit = (nextAmount, nextUnit) => {
241
+ if (nextAmount === undefined) {
242
+ props.onChange(undefined);
243
+ return;
244
+ }
245
+ props.onChange({
246
+ type: "convertible_unit",
247
+ value: nextAmount,
248
+ ...(nextUnit.length > 0 ? { unit: nextUnit } : {}),
249
+ });
250
+ };
251
+ return (_jsxs(Flex, { gap: 8, children: [_jsx(InputNumber, { id: props.id, style: { flex: 1 }, value: amount ?? null, disabled: props.disabled, ...errorStatus(props.error), ...(precision !== undefined ? { precision } : {}), onChange: (next) => emit(next ?? undefined, unit) }), units.length > 0 && (_jsx(Select, { style: { width: 96 }, disabled: props.disabled, ...errorStatus(props.error), value: unit, options: units.map((code) => ({ value: code, label: code })), onChange: (next) => emit(amount, next) }))] }));
252
+ };
253
+ /**
254
+ * The skin's builtin widget per kind — the second rung of the ladder. A kind
255
+ * absent from this table has no default drawing and reaches the
256
+ * unsupported-field notice.
257
+ */
258
+ export const BUILTIN_FIELD_WIDGETS = {
259
+ string: StringWidget,
260
+ int: makeNumberWidget(true),
261
+ float: makeNumberWidget(false),
262
+ bool: BoolWidget,
263
+ select: SelectWidget,
264
+ date: DateWidget,
265
+ header: HeaderWidget,
266
+ hex_color: HexColorWidget,
267
+ hierarchical_select: HierarchicalSelectWidget,
268
+ convertible_unit: ConvertibleUnitWidget,
269
+ };
270
+ /** The kinds this skin can draw — handed to `<FormFill>` so the headless
271
+ * layer can judge `unsupportedKinds` without importing the skin. */
272
+ export const BUILTIN_FIELD_KINDS = Object.keys(BUILTIN_FIELD_WIDGETS).sort();
273
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../src/default/fields.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EACL,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,KAAK,EACL,WAAW,EACX,SAAS,EACT,MAAM,EACN,MAAM,EACN,UAAU,GACX,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,IAAI,EAAE,MAAM,cAA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AAwB;IAC7C,gBAAgB,EAAE,qBAAqB;CACxC,CAAC;AAEF;oEACoE;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAC9B,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,IAAI,EAAE,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * `@stapel/forms-react/default` — the antd default skin.
3
+ *
4
+ * A SEPARATE entry point on purpose: the main entry is headless and carries
5
+ * no antd, so a host that renders its own visuals over `<FormFill>` never
6
+ * pays for this bundle (enforced by size-limit and the bundle-purity test).
7
+ *
8
+ * Three override levers, in increasing order of reach — none of which
9
+ * requires forking anything:
10
+ *
11
+ * 1. **props** (`mode`, `showTitle`, `submitLabel`);
12
+ * 2. **`registerFormFieldWidget(kind, …)`** — replace how one field kind
13
+ * draws; a host registration outranks every builtin here;
14
+ * 3. **`registerFormsSkinComponent(slot, …)`** — replace a piece of the
15
+ * skin itself (a field row, the submit bar, a response cell).
16
+ *
17
+ * And beneath all three: retheming through the §68 token JSON, which reaches
18
+ * this skin with zero code because every surface wraps itself in
19
+ * `<FormsSkinTheme>`.
20
+ */
21
+ export { StapelForm } from "./StapelForm.js";
22
+ export type { StapelFormProps, FieldRowSlotProps, SubmitBarSlotProps, ConfirmationSlotProps, UnsupportedFieldSlotProps, } from "./StapelForm.js";
23
+ export { FormBuilderPane } from "./FormBuilderPane.js";
24
+ export type { FormBuilderPaneProps, BuilderToolbarSlotProps, BuilderFieldRowSlotProps, } from "./FormBuilderPane.js";
25
+ export { ResponsesPane } from "./ResponsesPane.js";
26
+ export type { ResponsesPaneProps, ResponseCellSlotProps, ResponsesToolbarSlotProps, } from "./ResponsesPane.js";
27
+ export { FormsListPane } from "./FormsListPane.js";
28
+ export type { FormsListPaneProps } from "./FormsListPane.js";
29
+ export { FormsSkinTheme } from "./theme.js";
30
+ export type { FormsSkinThemeProps } from "./theme.js";
31
+ export { ErrorAlert } from "./ErrorAlert.js";
32
+ export type { ThemeModeProp } from "./types.js";
33
+ export { registerFormsSkinComponent, unregisterFormsSkinComponent, resolveFormsSkinComponent, registeredFormsSkinSlots, } from "./slots.js";
34
+ export type { FormsSkinSlot } from "./slots.js";
35
+ /** The skin's builtin widgets, exported so a host can WRAP one instead of
36
+ * replacing it outright (decorate the default rather than reimplement it). */
37
+ export { BUILTIN_FIELD_WIDGETS, BUILTIN_FIELD_KINDS } from "./fields.js";
38
+ /** The data-driven config-form row — exported for a host building its own
39
+ * builder over the same declarations. */
40
+ export { ConfigField } from "./ConfigField.js";
41
+ export type { ConfigFieldProps } from "./ConfigField.js";
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/default/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EACV,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;8EAC8E;AAC9E,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEzE;yCACyC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * `@stapel/forms-react/default` — the antd default skin.
3
+ *
4
+ * A SEPARATE entry point on purpose: the main entry is headless and carries
5
+ * no antd, so a host that renders its own visuals over `<FormFill>` never
6
+ * pays for this bundle (enforced by size-limit and the bundle-purity test).
7
+ *
8
+ * Three override levers, in increasing order of reach — none of which
9
+ * requires forking anything:
10
+ *
11
+ * 1. **props** (`mode`, `showTitle`, `submitLabel`);
12
+ * 2. **`registerFormFieldWidget(kind, …)`** — replace how one field kind
13
+ * draws; a host registration outranks every builtin here;
14
+ * 3. **`registerFormsSkinComponent(slot, …)`** — replace a piece of the
15
+ * skin itself (a field row, the submit bar, a response cell).
16
+ *
17
+ * And beneath all three: retheming through the §68 token JSON, which reaches
18
+ * this skin with zero code because every surface wraps itself in
19
+ * `<FormsSkinTheme>`.
20
+ */
21
+ // ── surfaces ────────────────────────────────────────────────────────────────
22
+ export { StapelForm } from "./StapelForm.js";
23
+ export { FormBuilderPane } from "./FormBuilderPane.js";
24
+ export { ResponsesPane } from "./ResponsesPane.js";
25
+ export { FormsListPane } from "./FormsListPane.js";
26
+ // ── theming ─────────────────────────────────────────────────────────────────
27
+ export { FormsSkinTheme } from "./theme.js";
28
+ export { ErrorAlert } from "./ErrorAlert.js";
29
+ // ── the two override registries ─────────────────────────────────────────────
30
+ export { registerFormsSkinComponent, unregisterFormsSkinComponent, resolveFormsSkinComponent, registeredFormsSkinSlots, } from "./slots.js";
31
+ /** The skin's builtin widgets, exported so a host can WRAP one instead of
32
+ * replacing it outright (decorate the default rather than reimplement it). */
33
+ export { BUILTIN_FIELD_WIDGETS, BUILTIN_FIELD_KINDS } from "./fields.js";
34
+ /** The data-driven config-form row — exported for a host building its own
35
+ * builder over the same declarations. */
36
+ export { ConfigField } from "./ConfigField.js";
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/default/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,+EAA+E;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAS7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAOvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAOnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,+EAA+E;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,+EAA+E;AAC/E,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAGpB;8EAC8E;AAC9E,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEzE;yCACyC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The skin-slot registry — the SECOND override lever of `/default`, beside
3
+ * the field-widget registry (`widgets/registry.ts`) and plain props.
4
+ *
5
+ * "A default the customer cannot swap is a decision, not a default"
6
+ * (spec §7.3). The widget registry lets a host replace how one FIELD KIND
7
+ * draws; this lets a host replace a piece of the SKIN — the row that wraps a
8
+ * field, the submit bar, the confirmation panel, a response cell — without
9
+ * forking the skin to get at it.
10
+ *
11
+ * ```tsx
12
+ * registerFormsSkinComponent("fill.submitBar", MySubmitBar);
13
+ * ```
14
+ *
15
+ * Slot names are a closed union on purpose: a typo in a string key would
16
+ * register a component that silently never renders, and "my override did
17
+ * nothing and nothing said so" is the exact failure this fleet keeps closing.
18
+ */
19
+ import type { ComponentType } from "react";
20
+ /**
21
+ * The slots `/default` renders through. Each name is `<surface>.<part>`.
22
+ *
23
+ * Adding a slot is additive; REMOVING one is a breaking change for any host
24
+ * that registered it, so a slot is only added where the default is genuinely
25
+ * a judgement call somebody might reasonably disagree with.
26
+ */
27
+ export type FormsSkinSlot =
28
+ /** Wraps one field: label, control, error, required marker. */
29
+ "fill.fieldRow"
30
+ /** The submit button and everything beside it (captcha, blocked reason). */
31
+ | "fill.submitBar"
32
+ /** What replaces the form once the server accepts it. */
33
+ | "fill.confirmation"
34
+ /** The notice shown in place of a field whose kind nothing can draw. */
35
+ | "fill.unsupportedField"
36
+ /** One cell of the responses grid. */
37
+ | "responses.cell"
38
+ /** The responses toolbar: version filter, export, paging. */
39
+ | "responses.toolbar"
40
+ /** One row of the builder's field list. */
41
+ | "builder.fieldRow"
42
+ /** The builder's save/publish/state controls. */
43
+ | "builder.toolbar";
44
+ /**
45
+ * Replace a slot's component. Call at startup, before the first render.
46
+ *
47
+ * The props a slot receives are the ones the skin passes it — each slot's
48
+ * prop type is exported beside the component that renders it, so an override
49
+ * is written against a real type rather than by reading the skin's source.
50
+ */
51
+ export declare function registerFormsSkinComponent<P>(slot: FormsSkinSlot, component: ComponentType<P>): void;
52
+ /** Remove an override, restoring the skin's own component. */
53
+ export declare function unregisterFormsSkinComponent(slot: FormsSkinSlot): void;
54
+ /** The host's override for a slot, or `null` — the skin falls back to its
55
+ * own component. */
56
+ export declare function resolveFormsSkinComponent<P>(slot: FormsSkinSlot): ComponentType<P> | null;
57
+ /** Every slot with an override, sorted. */
58
+ export declare function registeredFormsSkinSlots(): readonly FormsSkinSlot[];
59
+ //# sourceMappingURL=slots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/default/slots.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,MAAM,aAAa;AACvB,+DAA+D;AAC7D,eAAe;AACjB,4EAA4E;GAC1E,gBAAgB;AAClB,yDAAyD;GACvD,mBAAmB;AACrB,wEAAwE;GACtE,uBAAuB;AACzB,sCAAsC;GACpC,gBAAgB;AAClB,6DAA6D;GAC3D,mBAAmB;AACrB,2CAA2C;GACzC,kBAAkB;AACpB,iDAAiD;GAC/C,iBAAiB,CAAC;AAItB;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAC1C,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,GAC1B,IAAI,CAEN;AAED,8DAA8D;AAC9D,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAEtE;AAED;oBACoB;AACpB,wBAAgB,yBAAyB,CAAC,CAAC,EACzC,IAAI,EAAE,aAAa,GAClB,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAEzB;AAED,2CAA2C;AAC3C,wBAAgB,wBAAwB,IAAI,SAAS,aAAa,EAAE,CAEnE"}
@@ -0,0 +1,25 @@
1
+ const slots = new Map();
2
+ /**
3
+ * Replace a slot's component. Call at startup, before the first render.
4
+ *
5
+ * The props a slot receives are the ones the skin passes it — each slot's
6
+ * prop type is exported beside the component that renders it, so an override
7
+ * is written against a real type rather than by reading the skin's source.
8
+ */
9
+ export function registerFormsSkinComponent(slot, component) {
10
+ slots.set(slot, component);
11
+ }
12
+ /** Remove an override, restoring the skin's own component. */
13
+ export function unregisterFormsSkinComponent(slot) {
14
+ slots.delete(slot);
15
+ }
16
+ /** The host's override for a slot, or `null` — the skin falls back to its
17
+ * own component. */
18
+ export function resolveFormsSkinComponent(slot) {
19
+ return slots.get(slot) ?? null;
20
+ }
21
+ /** Every slot with an override, sorted. */
22
+ export function registeredFormsSkinSlots() {
23
+ return [...slots.keys()].sort();
24
+ }
25
+ //# sourceMappingURL=slots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slots.js","sourceRoot":"","sources":["../../src/default/slots.ts"],"names":[],"mappings":"AA6CA,MAAM,KAAK,GAAG,IAAI,GAAG,EAAuC,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACxC,IAAmB,EACnB,SAA2B;IAE3B,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,SAAiC,CAAC,CAAC;AACrD,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,4BAA4B,CAAC,IAAmB;IAC9D,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;AAED;oBACoB;AACpB,MAAM,UAAU,yBAAyB,CACvC,IAAmB;IAEnB,OAAQ,KAAK,CAAC,GAAG,CAAC,IAAI,CAAkC,IAAI,IAAI,CAAC;AACnE,CAAC;AAED,2CAA2C;AAC3C,MAAM,UAAU,wBAAwB;IACtC,OAAO,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAClC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { CSSProperties, ReactElement, ReactNode } from "react";
2
+ import type { ThemeMode } from "@stapel/tokens-antd";
3
+ export interface FormsSkinThemeProps {
4
+ /**
5
+ * Light or dark. Defaults to the mode the host's document declares
6
+ * (`resolveThemeMode()`). Pass explicitly to pin a side.
7
+ */
8
+ readonly mode?: ThemeMode;
9
+ /** Extra styles merged onto the themed root element (layout only — colors
10
+ * come from the mode). */
11
+ readonly style?: CSSProperties;
12
+ readonly children: ReactNode;
13
+ }
14
+ /**
15
+ * `<FormsSkinTheme/>` — the self-theming wrapper of
16
+ * `@stapel/forms-react/default`. Standalone use is supported (wrap any
17
+ * composition of the skin's parts once); the shipped surfaces
18
+ * (`StapelForm`, `FormBuilderPane`, `ResponsesPane`, `FormsListPane`) each
19
+ * already wrap themselves, and nested antd `ConfigProvider`s merge, so
20
+ * composing them under one `FormsSkinTheme` stays correct.
21
+ */
22
+ export declare function FormsSkinTheme(props: FormsSkinThemeProps): ReactElement;
23
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/default/theme.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAC1B;8BAC0B;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CAmBvE"}
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * The default skin's INTERNAL theme provider — every `/default` surface wraps
4
+ * itself in this, so the skin is readable no matter what the host supplies
5
+ * (tracker #26: a skin set with no internal provider once inherited a theme
6
+ * bridge serving light-mode values inside a dark document — text on
7
+ * background at 1.00:1). The theme derives from `@stapel/tokens` via
8
+ * `@stapel/tokens-antd`'s `toAntdThemeConfig(mode)`; `mode` defaults to what
9
+ * the HOST's document declares (`resolveThemeMode()` — the `data-theme`
10
+ * attribute `tokens.css` keys its dark block on), never to a hardcoded side.
11
+ *
12
+ * This is also what "override styles" means for this pair (spec §7.3): a host
13
+ * retheming through the §68 token JSON regenerates its `--stapel-*` custom
14
+ * properties, and the form follows with zero code — which is a far better
15
+ * deal than a prop-per-colour API, and the reason the skin has none.
16
+ */
17
+ import { useMemo } from "react";
18
+ import { ConfigProvider } from "antd";
19
+ import { resolveThemeMode, toAntdTheme, toAntdThemeConfig, } from "@stapel/tokens-antd";
20
+ /**
21
+ * `<FormsSkinTheme/>` — the self-theming wrapper of
22
+ * `@stapel/forms-react/default`. Standalone use is supported (wrap any
23
+ * composition of the skin's parts once); the shipped surfaces
24
+ * (`StapelForm`, `FormBuilderPane`, `ResponsesPane`, `FormsListPane`) each
25
+ * already wrap themselves, and nested antd `ConfigProvider`s merge, so
26
+ * composing them under one `FormsSkinTheme` stays correct.
27
+ */
28
+ export function FormsSkinTheme(props) {
29
+ const mode = props.mode ?? resolveThemeMode();
30
+ const theme = useMemo(() => toAntdThemeConfig(mode), [mode]);
31
+ const token = useMemo(() => toAntdTheme(mode), [mode]);
32
+ return (_jsx(ConfigProvider, { theme: theme, children: _jsx("div", { "data-forms-skin-root": true, "data-forms-skin-mode": mode, style: {
33
+ color: token.colorText,
34
+ backgroundColor: token.colorBgContainer,
35
+ ...props.style,
36
+ }, children: props.children }) }));
37
+ }
38
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/default/theme.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAe7B;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,gBAAgB,EAAE,CAAC;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD,OAAO,CACL,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,YAC1B,oEAEwB,IAAI,EAC1B,KAAK,EAAE;gBACL,KAAK,EAAE,KAAK,CAAC,SAAS;gBACtB,eAAe,EAAE,KAAK,CAAC,gBAAgB;gBACvC,GAAG,KAAK,CAAC,KAAK;aACf,YAEA,KAAK,CAAC,QAAQ,GACX,GACS,CAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Small shared types for the `/default` skin — kept in one place so every
3
+ * surface takes the same `mode` prop and re-exports the same error dialect.
4
+ */
5
+ export type { FlowError } from "@stapel/core";
6
+ import type { ThemeMode } from "@stapel/tokens-antd";
7
+ /** Every `/default` surface accepts a theme mode; absent means "whatever the
8
+ * host document declares" (`resolveThemeMode()`), never a hardcoded side. */
9
+ export interface ThemeModeProp {
10
+ readonly mode?: ThemeMode;
11
+ }
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/default/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD;6EAC6E;AAC7E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/default/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import type { FlowError } from "@stapel/core";
2
+ export type { FlowError } from "@stapel/core";
3
+ export { isErrorCode } from "@stapel/core";
4
+ /**
5
+ * Fold any thrown value into a {@link FlowError} using this pair's own
6
+ * module-scoped fallback key (`forms.error.unknown`, an en string in
7
+ * {@link formsI18nBundleEn}) so a non-`StapelApiError` fault still renders
8
+ * real copy rather than a raw key. The primitive lives in `@stapel/core`
9
+ * (frontend-core-architecture §4b); this wrapper only pins the fallback.
10
+ */
11
+ export declare function toFlowError(error: unknown): FlowError;
12
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/flows/errors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAErD"}
@@ -0,0 +1,13 @@
1
+ import { toFlowError as coreToFlowError } from "@stapel/core";
2
+ export { isErrorCode } from "@stapel/core";
3
+ /**
4
+ * Fold any thrown value into a {@link FlowError} using this pair's own
5
+ * module-scoped fallback key (`forms.error.unknown`, an en string in
6
+ * {@link formsI18nBundleEn}) so a non-`StapelApiError` fault still renders
7
+ * real copy rather than a raw key. The primitive lives in `@stapel/core`
8
+ * (frontend-core-architecture §4b); this wrapper only pins the fallback.
9
+ */
10
+ export function toFlowError(error) {
11
+ return coreToFlowError(error, "forms.error.unknown");
12
+ }
13
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/flows/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAI9D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,eAAe,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAAC;AACvD,CAAC"}