@factorialco/rjsf-f0 2.1.0 → 2.2.1

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.
@@ -0,0 +1,18 @@
1
+ import { default as React } from '../../node_modules/@types/react';
2
+ export interface AlertBlockquoteProps {
3
+ children?: React.ReactNode;
4
+ /** f0's own blockquote renderer, used when this is an ordinary quote. */
5
+ fallback?: React.ComponentType<any>;
6
+ [key: string]: unknown;
7
+ }
8
+ /**
9
+ * Renders a GitHub-style alert as an f0-toned callout, and anything else as
10
+ * f0's ordinary blockquote.
11
+ *
12
+ * Deliberately *not* `F0Alert`: its `title` and `description` are plain
13
+ * `string`s, so routing a blockquote through it would flatten the body and
14
+ * silently drop the bold, links, lists and code an author is free to put in a
15
+ * markdown block. The callout below keeps the real markdown children and
16
+ * borrows f0's semantic colour scale instead, so it still flips in dark mode.
17
+ */
18
+ export declare function AlertBlockquote({ children, fallback: Fallback, node: _node, ...rest }: AlertBlockquoteProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -5,11 +5,13 @@ export declare function TitleFieldTemplate({ id, title, uiSchema, optionalDataCo
5
5
  /** Section (object/array level) description. */
6
6
  export declare function DescriptionFieldTemplate({ id, description, }: DescriptionFieldProps): React.JSX.Element | null;
7
7
  /**
8
- * Per-field errors.
8
+ * Every error message RJSF has for a field, and the only place they render.
9
9
  *
10
- * f0 controls render their own error message, so this only covers the cases f0
11
- * cannot show inline (multiple messages, and controls rendered as raw
12
- * primitives).
10
+ * f0 form fields are told they are in an error state but not what to say
11
+ * (`f0-field.tsx`), because half of what this theme renders is not an f0 form
12
+ * field at all — checkboxes, file inputs, the SDK's own fields, and the object
13
+ * and array levels a global form error lands on — and each of those swallowed
14
+ * its message when the control was trusted to show it.
13
15
  */
14
16
  export declare function FieldErrorTemplate({ errors, fieldPathId, }: FieldErrorProps): React.JSX.Element | null;
15
17
  /** Renders a `ui:help` directive under the control. */
@@ -3,6 +3,7 @@ import { FieldTemplate } from './templates/field-template';
3
3
  import { DescriptionFieldTemplate, ErrorListTemplate, FieldErrorTemplate, FieldHelpTemplate, TitleFieldTemplate, WrapIfAdditionalTemplate } from './templates/misc-templates';
4
4
  import { ArrayFieldItemButtonsTemplate, ArrayFieldItemTemplate, ArrayFieldTemplate, GridTemplate, MultiSchemaFieldTemplate, ObjectFieldTemplate } from './templates/layout-templates';
5
5
  import { BaseInputTemplate, TextareaWidget } from './widgets/input-widgets';
6
+ import { FileWidget } from './widgets/file-widget';
6
7
  import { CheckboxWidget, CheckboxesWidget, RadioWidget, SelectWidget } from './widgets/choice-widgets';
7
8
  import { Multistep } from './multistep';
8
9
  export declare const Templates: {
@@ -33,6 +34,7 @@ export declare const Templates: {
33
34
  export declare const Widgets: {
34
35
  CheckboxWidget: typeof CheckboxWidget;
35
36
  CheckboxesWidget: typeof CheckboxesWidget;
37
+ FileWidget: typeof FileWidget;
36
38
  RadioWidget: typeof RadioWidget;
37
39
  SelectWidget: typeof SelectWidget;
38
40
  TextareaWidget: typeof TextareaWidget;
@@ -55,10 +57,6 @@ export declare function generateTheme(): F0RjsfTheme;
55
57
  * The f0 theme for react-jsonschema-form.
56
58
  *
57
59
  * Anything not listed in `Templates`/`Widgets` falls through to `@rjsf/core`'s
58
- * own implementation. The file widget is core's, but core renders it through
59
- * this theme's `BaseInputTemplate`, which keeps a native `<input type="file">`
60
- * for it (see `FileInput` in `widgets/input-widgets.tsx`): the surrounding SDK
61
- * exchanges uploads as `data:` URLs, and f0's file field is built around an
62
- * upload hook instead.
60
+ * own implementation.
63
61
  */
64
62
  export declare const Theme: F0RjsfTheme;
@@ -3,11 +3,13 @@ import { WidgetProps } from '@rjsf/utils';
3
3
  /**
4
4
  * Shared bridge from an RJSF widget to `F0FormField`.
5
5
  *
6
- * RJSF keeps ownership of validation: the messages it produces are passed down
7
- * as `error`/`errorMessage` rather than letting f0 (which validates with zod)
8
- * derive its own. The label is hidden because `FieldTemplate` renders it above
9
- * the control to support markdown; the plain-text label is still handed to f0 so
10
- * the control keeps an accessible name.
6
+ * RJSF keeps ownership of validation: the control is told it is in an error
7
+ * state rather than letting f0 (which validates with zod) derive its own, and
8
+ * the messages themselves are rendered by `FieldErrorTemplate`, the one place
9
+ * that also covers the controls f0 does not render. The label is hidden because
10
+ * `FieldTemplate` renders it above the control to support markdown; the
11
+ * plain-text label is still handed to f0 so the control keeps an accessible
12
+ * name.
11
13
  */
12
14
  export interface F0FieldBridgeProps extends WidgetProps {
13
15
  /** The f0 field descriptor minus the parts derived from the RJSF props. */
@@ -0,0 +1,38 @@
1
+ import { default as React } from '../../node_modules/@types/react';
2
+ import { WidgetProps } from '@rjsf/utils';
3
+ /**
4
+ * Bytes as a short human-readable size.
5
+ *
6
+ * Deliberately not `toLocaleString`: that formats against the *browser's*
7
+ * locale, which is exactly the mismatch this widget exists to remove (a form
8
+ * rendered in Spanish must not pick up separators from an English browser).
9
+ * Sizes are rendered with a plain decimal point until a form-level locale is
10
+ * available to this package.
11
+ */
12
+ export declare function formatFileSize(bytes: number): string;
13
+ /**
14
+ * The f0 file control.
15
+ *
16
+ * Replaces core's `FileWidget`, which renders a bare `<input type="file">`
17
+ * through `BaseInputTemplate`. That input is unfixable by CSS in two ways that
18
+ * both give away a non-native dialog: its "No file chosen" text cannot be
19
+ * removed, and its button label is drawn by the *browser* in the browser's
20
+ * locale — English chrome inside a Spanish form, which no amount of locale
21
+ * propagation on our side can reach.
22
+ *
23
+ * The file/`data:` URL exchange is untouched: `useFileWidgetProps` (core's own
24
+ * hook) still owns reading the `File`, encoding it and accumulating the list,
25
+ * so the value RJSF sees is byte-identical to before.
26
+ *
27
+ * The native input is kept — transparent, stretched over the whole dropzone —
28
+ * rather than hidden behind a JS click handler. It stays the labelled control
29
+ * (`FieldTemplate` renders `<label htmlFor>`), it keeps `accept` as the raw
30
+ * HTML string the schema authored, and click and keyboard stay the platform's.
31
+ *
32
+ * Drag-and-drop is NOT the platform's, and assuming it was is what broke it
33
+ * once: a file input accepts a dropped file by itself only while no handler
34
+ * claims the drag, and the `dragover` handler that highlights the box does
35
+ * exactly that. Highlighting and handling the drop are therefore one decision —
36
+ * see `handleDrop`.
37
+ */
38
+ export declare function FileWidget(props: WidgetProps): React.JSX.Element;
package/dist/styles.css CHANGED
@@ -8,6 +8,53 @@
8
8
  *
9
9
  * There is deliberately no `all: revert` reset here: unlike the SDK's standalone
10
10
  * stylesheet, this theme renders inside an app that already owns its styles.
11
+ *
12
+ * ── Colour variables ─────────────────────────────────────────────────────────
13
+ * Read f0's NUMBERED scales — `--neutral-50`, `--critical-70`, `--warning-50` —
14
+ * never an `--f1-*` name. f0 names its semantic tokens `f1-foreground-secondary`
15
+ * and so on, but exposes them as Tailwind classes built ON TOP of the numbered
16
+ * scales; there is no `--f1-foreground-secondary` CSS variable to read. Rules
17
+ * here once did, and because every one carried a fallback they failed silently:
18
+ * `var(--f1-foreground-secondary, inherit)` simply resolved to `inherit`, so
19
+ * "secondary" text was never dimmed and the error colour never applied.
20
+ *
21
+ * The mapping, from f0's `packages/core/src/tokens/colors.ts`:
22
+ *
23
+ * f1-foreground -> --neutral-100
24
+ * f1-foreground-secondary -> --neutral-50
25
+ * f1-foreground-critical -> --critical-70
26
+ * f1-border-secondary -> --neutral-20
27
+ * f1-background-secondary -> --neutral-10
28
+ *
29
+ * Every `var()` below still carries f0's light-mode value as its fallback, for
30
+ * the (unsupported) case of rendering without f0's stylesheet. Keep them: they
31
+ * are the reason a missing variable degrades instead of rendering transparent
32
+ * text — but pick the fallback so the rule still LOOKS right, since a wrong
33
+ * variable name can no longer be spotted by the page looking broken.
34
+ *
35
+ * ── Type scale ───────────────────────────────────────────────────────────────
36
+ * f0 REDEFINES Tailwind's scale, shifted one step down. `text-base` is 14px
37
+ * here, where stock Tailwind makes it 16px. Writing `1rem` for "base" is
38
+ * therefore a step too large, and it is the mistake this file already made
39
+ * once: `.rjsf-f0-label` shipped at `text-lg`, rendering a field label larger
40
+ * than the `###` section heading above it.
41
+ *
42
+ * text-xs 0.625rem / 0.75rem
43
+ * text-sm 0.75rem / 1rem
44
+ * text-base 0.875rem / 1.25rem letter-spacing -0.005em <- body, labels, help
45
+ * text-lg 1rem / 1.5rem letter-spacing -0.01em <- headings
46
+ * text-xl 1.125rem / 1.75rem letter-spacing -0.01em
47
+ * text-2xl 1.375rem / 1.75rem letter-spacing -0.01em
48
+ *
49
+ * Take the line-height with the size — f0 pairs a rem value with each step, not
50
+ * a ratio, so `line-height: 1.5` beside a 14px font is 1px off its step.
51
+ * `letter-spacing` needs no declaring: it inherits, f0's container sets the
52
+ * `text-base` value, and it is only ever wrong on a rule whose size is wrong.
53
+ *
54
+ * The values must stay hardcoded — this package cannot use the classes, because
55
+ * the host's Tailwind `content` globs do not include it and the utilities would
56
+ * arrive inert. They just have to be f0's values. `styles.test.ts` fails on a
57
+ * `font-size` that is not one of the steps above.
11
58
  */
12
59
 
13
60
  /*
@@ -28,11 +75,23 @@
28
75
  gap: 0.5rem;
29
76
  }
30
77
 
78
+ /*
79
+ * f0's `label-input`: `text-base font-medium text-f1-foreground-secondary`.
80
+ *
81
+ * This declared `1rem`/`1.5`, which is f0's `text-lg` — a step up, and the
82
+ * whole recipe, so it was written against stock Tailwind where `text-base` is
83
+ * 1rem. It made a field label render LARGER than a `###` section heading above
84
+ * it, which is what flattened the hierarchy on a form.
85
+ *
86
+ * No `letter-spacing` here on purpose: it inherits, f0's container sets
87
+ * `-0.005em`, and at 14px that is already the right value. It was only wrong
88
+ * before because the size was — a 16px label inherited 14px's tracking.
89
+ */
31
90
  .rjsf-f0-label {
32
- font-size: 1rem;
91
+ font-size: 0.875rem;
33
92
  font-weight: 500;
34
- line-height: 1.5;
35
- color: var(--f1-foreground-secondary, inherit);
93
+ line-height: 1.25rem;
94
+ color: hsl(var(--neutral-50, 217 96% 11% / 0.61));
36
95
  }
37
96
 
38
97
  .rjsf-f0-label p,
@@ -44,7 +103,7 @@
44
103
  .rjsf-f0-help,
45
104
  .rjsf-f0-section-description {
46
105
  font-size: 0.875rem;
47
- color: var(--f1-foreground-secondary, inherit);
106
+ color: hsl(var(--neutral-50, 217 96% 11% / 0.61));
48
107
  }
49
108
 
50
109
  /*
@@ -76,11 +135,24 @@
76
135
  margin-top: 0.125rem;
77
136
  }
78
137
 
138
+ /*
139
+ * Matches what f0 draws under a field in error (`text-base font-medium
140
+ * text-f1-foreground-critical`), minus its icon: this list carries the single
141
+ * message of an ordinary invalid field, not just the rare pile-up, so a marker
142
+ * and its indent would set it apart from every f0 field error on the page.
143
+ */
79
144
  .rjsf-f0-errors {
80
145
  margin: 0;
81
- padding-left: 1.1rem;
146
+ padding-left: 0;
147
+ list-style: none;
82
148
  font-size: 0.875rem;
83
- color: var(--f1-foreground-critical, #b3261e);
149
+ font-weight: 500;
150
+ color: hsl(var(--critical-70, 3 71% 41%));
151
+ }
152
+
153
+ .rjsf-f0-errors li + li {
154
+ /* f0 `0.5`. */
155
+ margin-top: 0.125rem;
84
156
  }
85
157
 
86
158
  .rjsf-f0-object,
@@ -186,26 +258,166 @@
186
258
  }
187
259
 
188
260
  /*
189
- * The file widget stays a native `<input type="file">` (f0's file field wants
190
- * an upload hook, the SDK wants `data:` URLs), so unlike every other control it
191
- * gets its box from here rather than from f0. The browse button is drawn as an
192
- * f0 neutral button (md: h-8, 10px radius, 14px/500 text) via
193
- * `::file-selector-button`, using the `--neutral-*` variables f0's stylesheet
194
- * defines — they flip in dark mode. The fallbacks are the light-mode values,
195
- * for the (unsupported) case of rendering without f0's stylesheet.
261
+ * The file control.
262
+ *
263
+ * Unlike every other control this one gets its box from here rather than from
264
+ * f0: f0's file field is driven by an upload hook returning an opaque id, while
265
+ * the SDK exchanges uploads as `data:` URLs and its `accept` is a raw HTML
266
+ * accept string (`.msj`), which f0's `MimeType` allowlist cannot express. So the
267
+ * box is drawn against f0's variables instead — they flip in dark mode, and the
268
+ * fallbacks are the light-mode values for the (unsupported) case of rendering
269
+ * without f0's stylesheet.
196
270
  */
197
271
  .rjsf-f0-file {
272
+ display: flex;
273
+ flex-direction: column;
274
+ gap: 0.5rem;
275
+ font-size: 0.875rem;
276
+ }
277
+
278
+ /*
279
+ * The dropzone stacks the native input on top of the decorative body, so the
280
+ * platform keeps ownership of click, keyboard and drag-and-drop. `isolation`
281
+ * keeps that stacking out of the host app's z-index space.
282
+ */
283
+ .rjsf-f0-dropzone {
284
+ position: relative;
285
+ isolation: isolate;
286
+ display: flex;
287
+ align-items: center;
288
+ justify-content: center;
289
+ min-height: 6rem;
290
+ padding: 1.25rem 1rem;
291
+ border: 1px dashed hsl(var(--neutral-30, 213 87% 15% / 0.2));
292
+ border-radius: 0.625rem;
293
+ background-color: hsl(var(--neutral-3, 219 88% 17% / 0.02));
294
+ transition:
295
+ border-color 0.15s cubic-bezier(0.4, 0, 0.2, 1),
296
+ background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
297
+ }
298
+
299
+ .rjsf-f0-dropzone:not([data-disabled]):hover,
300
+ .rjsf-f0-dropzone[data-dragging] {
301
+ border-color: hsl(var(--ring, 184 92% 35%));
302
+ background-color: hsl(var(--neutral-10, 216 89% 18% / 0.06));
303
+ }
304
+
305
+ /*
306
+ * Focus is shown by turning the box's own dashed border into a solid accent
307
+ * one, not by drawing a ring outside it.
308
+ *
309
+ * An `outline` with an offset paints beyond the element — the previous rule
310
+ * bled 4px, twice what f0's own fields do (`ring-1`/`ring-2` at
311
+ * `ring-offset-0`/`1`) — and anything painted outside can be clipped by an
312
+ * ancestor that scrolls or hides its overflow, which is what a dialog body is.
313
+ * Recolouring the border cannot be clipped, because it is inside the box.
314
+ *
315
+ * `focus-within`, not `focus-visible`: the input is the first focusable element
316
+ * in a dialog, so it receives focus programmatically when one opens.
317
+ */
318
+ .rjsf-f0-dropzone:focus-within {
319
+ border-style: solid;
320
+ border-color: hsl(var(--ring, 184 92% 35%));
321
+ }
322
+
323
+ /*
324
+ * Stretched over the whole box and transparent — not `display: none`, which
325
+ * would take the control out of the accessibility tree and off the tab order.
326
+ *
327
+ * `-1px`, not `0`: an absolutely positioned box resolves `inset` against its
328
+ * container's *padding* box, so `inset: 0` stopped inside the 1px border and
329
+ * left a dead ring around the perimeter where a click landed on nothing.
330
+ */
331
+ .rjsf-f0-dropzone-input {
332
+ position: absolute;
333
+ inset: -1px;
334
+ z-index: 1;
335
+ opacity: 0;
336
+ cursor: pointer;
337
+ }
338
+
339
+ .rjsf-f0-dropzone-input:disabled {
340
+ cursor: default;
341
+ }
342
+
343
+ .rjsf-f0-dropzone-body {
344
+ display: flex;
345
+ flex-direction: column;
346
+ align-items: center;
347
+ gap: 0.25rem;
348
+ text-align: center;
349
+ color: hsl(var(--neutral-50, 217 96% 11% / 0.61));
350
+ }
351
+
352
+ .rjsf-f0-dropzone-text {
353
+ font-weight: 500;
354
+ }
355
+
356
+ .rjsf-f0-dropzone-hint {
357
+ font-size: 0.75rem;
358
+ opacity: 0.7;
359
+ }
360
+
361
+ .rjsf-f0-dropzone[data-disabled] .rjsf-f0-dropzone-body {
362
+ opacity: 0.5;
363
+ }
364
+
365
+ /* The picked files, one f0-styled chip per file. */
366
+ .rjsf-f0-files {
367
+ display: flex;
368
+ flex-direction: column;
369
+ gap: 0.25rem;
370
+ margin: 0;
371
+ padding: 0;
372
+ list-style: none;
373
+ }
374
+
375
+ .rjsf-f0-file-chip {
376
+ display: flex;
377
+ align-items: center;
378
+ gap: 0.5rem;
379
+ padding: 0.375rem 0.5rem;
380
+ border: 1px solid hsl(var(--neutral-10, 216 89% 18% / 0.06));
381
+ border-radius: 0.625rem;
382
+ background-color: hsl(var(--neutral-3, 219 88% 17% / 0.02));
383
+ }
384
+
385
+ /* Long names truncate rather than pushing the remove button out of the row. */
386
+ .rjsf-f0-file-name {
387
+ flex: 1;
388
+ min-width: 0;
389
+ overflow: hidden;
390
+ font-weight: 500;
391
+ text-overflow: ellipsis;
392
+ white-space: nowrap;
393
+ }
394
+
395
+ .rjsf-f0-file-size {
396
+ flex-shrink: 0;
397
+ color: hsl(var(--neutral-50, 217 96% 11% / 0.61));
398
+ font-variant-numeric: tabular-nums;
399
+ opacity: 0.7;
400
+ }
401
+
402
+ /*
403
+ * The fallback native input kept by `BaseInputTemplate` for anything still
404
+ * rendering core's `FileWidget`. Its browse button is drawn as an f0 neutral
405
+ * button (md: h-8, 10px radius, 14px/500 text); the "No file chosen" text
406
+ * beside it is browser chrome and cannot be reached from here — which is why
407
+ * the theme's own `FileWidget` above replaces the control outright.
408
+ */
409
+ .rjsf-f0-native-file {
198
410
  font-size: 0.875rem;
199
- color: var(--f1-foreground-secondary, inherit);
411
+ color: hsl(var(--neutral-50, 217 96% 11% / 0.61));
200
412
  }
201
413
 
202
- .rjsf-f0-file:focus-visible {
414
+ .rjsf-f0-native-file:focus-visible {
203
415
  outline: 2px solid hsl(var(--ring, 184 92% 35%));
204
416
  outline-offset: 2px;
205
417
  border-radius: 0.625rem;
206
418
  }
207
419
 
208
- .rjsf-f0-file::file-selector-button {
420
+ .rjsf-f0-native-file::file-selector-button {
209
421
  height: 2rem;
210
422
  margin-right: 0.75rem;
211
423
  padding: 0 1rem;
@@ -220,19 +432,19 @@
220
432
  transition: background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
221
433
  }
222
434
 
223
- .rjsf-f0-file:not(:disabled)::file-selector-button:hover {
435
+ .rjsf-f0-native-file:not(:disabled)::file-selector-button:hover {
224
436
  background-color: hsl(var(--neutral-20, 214 70% 20% / 0.1));
225
437
  }
226
438
 
227
- .rjsf-f0-file:disabled::file-selector-button {
439
+ .rjsf-f0-native-file:disabled::file-selector-button {
228
440
  background-color: hsl(var(--neutral-3, 219 88% 17% / 0.02));
229
441
  color: hsl(var(--neutral-30, 213 87% 15% / 0.2));
230
442
  cursor: default;
231
443
  }
232
444
 
233
445
  /*
234
- * The list of picked files, rendered by core's `FileWidget` (its class name is
235
- * core's, so it can only be scoped by nesting under the theme's field row).
446
+ * The list core's `FileWidget` renders under that fallback input (its class
447
+ * name is core's, so it can only be scoped by nesting under the theme's row).
236
448
  */
237
449
  .rjsf-f0-field .file-info {
238
450
  display: flex;
@@ -401,24 +613,154 @@
401
613
  display: flex;
402
614
  flex-direction: column;
403
615
  gap: 0.75rem;
404
- color: var(--f1-foreground, inherit);
616
+ color: hsl(var(--neutral-100, 218 48% 10%));
617
+ }
618
+
619
+ /*
620
+ * A `markdown.before` / `markdown.after` block and the field it belongs to are
621
+ * siblings inside one `.rjsf-f0-row` — `FieldTemplate` returns them as a
622
+ * fragment and `ObjectFieldTemplate` wraps the lot. That row is a plain block
623
+ * box with no gap of its own, so the two rendered flush against each other: a
624
+ * section heading sat directly on top of the control below it, with the 16px
625
+ * field-to-field gap above it and nothing at all beneath.
626
+ *
627
+ * 8px is f0's label-to-control gap (`gap-2`), used here for the same reason: a
628
+ * `before` block introduces the field under it the way a label introduces its
629
+ * control. What communicates the grouping is the ratio, not the number — 16
630
+ * above against 8 below reads as "this belongs to what follows", where 16/0
631
+ * read as one glued lump.
632
+ *
633
+ * Scoped to `.rjsf-f0-row >` rather than set on the class: the submit result
634
+ * message carries `.fcode-form-markdown` too (`fcode-form.tsx`), and it is not
635
+ * a field row — a margin there would be arbitrary.
636
+ *
637
+ * Margins rather than making the row a flex container with a gap: the row is a
638
+ * flex *item* of `.rjsf-f0-object`, so it establishes a block formatting
639
+ * context and these cannot collapse out of it. Changing the row's layout model
640
+ * would touch every field in every form to fix a rule that applies to few.
641
+ */
642
+ .rjsf-f0-row > .fcode-form-markdown:first-child {
643
+ margin-bottom: 0.5rem;
644
+ }
645
+
646
+ .rjsf-f0-row > .fcode-form-markdown:last-child {
647
+ margin-top: 0.5rem;
405
648
  }
406
649
 
407
650
  .fcode-form-markdown p {
408
651
  margin: 0;
409
652
  }
410
653
 
654
+ /*
655
+ * f0 renders `h1`–`h3` itself; `h4`–`h6` arrive as plain tags (see
656
+ * `markdown/markdown-components.ts` for why they are not given renderers) and
657
+ * get the f0 scale here, continuing below f0's `h3` (`text-base`/600) at
658
+ * `text-sm`. The three used to be identical, which flattened every level past
659
+ * `###` into one — the weight and colour steps below are what separates them,
660
+ * since f0 does not shrink headings past the body size.
661
+ */
411
662
  .fcode-form-markdown h4,
412
663
  .fcode-form-markdown h5,
413
664
  .fcode-form-markdown h6 {
414
665
  margin: 0;
415
666
  font-size: 0.875rem;
667
+ /* f0 pairs `text-base` with a 1.25rem line-height, not a 1.5 ratio. */
668
+ line-height: 1.25rem;
669
+ }
670
+
671
+ .fcode-form-markdown h4 {
416
672
  font-weight: 600;
417
- line-height: 1.5;
673
+ }
674
+
675
+ .fcode-form-markdown h5 {
676
+ font-weight: 500;
677
+ }
678
+
679
+ .fcode-form-markdown h6 {
680
+ font-weight: 500;
681
+ color: hsl(var(--neutral-50, 217 96% 11% / 0.61));
418
682
  }
419
683
 
420
684
  .fcode-form-markdown del {
421
- color: var(--f1-foreground-secondary, inherit);
685
+ color: hsl(var(--neutral-50, 217 96% 11% / 0.61));
686
+ }
687
+
688
+ /*
689
+ * The callout a GitHub alert blockquote (`> [!NOTE]`) renders as.
690
+ *
691
+ * Not `F0Alert`: its `title`/`description` are plain strings, so routing a
692
+ * markdown blockquote through it would flatten the body and drop the bold,
693
+ * links and lists an author may put there. This keeps the real markdown
694
+ * children and borrows f0's semantic colour scale instead — `--<variant>-50`
695
+ * tinted for the surface, `--<variant>-70` for the icon, both of which f0's
696
+ * stylesheet flips in dark mode. The fallbacks are f0's light-mode values, for
697
+ * the (unsupported) case of rendering without that stylesheet.
698
+ */
699
+ .rjsf-f0-callout {
700
+ display: flex;
701
+ align-items: flex-start;
702
+ gap: 0.625rem;
703
+ padding: 0.75rem;
704
+ border-radius: 0.625rem;
705
+ font-size: 0.875rem;
706
+ /* f0 pairs `text-base` with a 1.25rem line-height, not a 1.5 ratio. */
707
+ line-height: 1.25rem;
708
+ color: hsl(var(--neutral-100, 218 48% 10%));
709
+ }
710
+
711
+ .rjsf-f0-callout-body {
712
+ display: flex;
713
+ min-width: 0;
714
+ flex: 1;
715
+ flex-direction: column;
716
+ gap: 0.5rem;
717
+ }
718
+
719
+ .rjsf-f0-callout-body > :first-child {
720
+ margin-top: 0;
721
+ }
722
+
723
+ .rjsf-f0-callout-body > :last-child {
724
+ margin-bottom: 0;
725
+ }
726
+
727
+ /* Authored content can carry lists; hosts on Tailwind reset their padding. */
728
+ .rjsf-f0-callout-body ul,
729
+ .rjsf-f0-callout-body ol {
730
+ margin: 0;
731
+ padding-left: 1.25rem;
732
+ }
733
+
734
+ .rjsf-f0-callout[data-variant='info'] {
735
+ background-color: hsl(var(--info-50, 216 90% 65%) / 0.1);
736
+ }
737
+
738
+ .rjsf-f0-callout[data-variant='info'] svg {
739
+ color: hsl(var(--info-70, 216 48% 44%));
740
+ }
741
+
742
+ .rjsf-f0-callout[data-variant='warning'] {
743
+ background-color: hsl(var(--warning-50, 25 95% 53%) / 0.1);
744
+ }
745
+
746
+ .rjsf-f0-callout[data-variant='warning'] svg {
747
+ color: hsl(var(--warning-70, 24 69% 40%));
748
+ }
749
+
750
+ .rjsf-f0-callout[data-variant='critical'] {
751
+ background-color: hsl(var(--critical-50, 5 100% 65%) / 0.1);
752
+ }
753
+
754
+ .rjsf-f0-callout[data-variant='critical'] svg {
755
+ color: hsl(var(--critical-70, 3 71% 41%));
756
+ }
757
+
758
+ .rjsf-f0-callout[data-variant='positive'] {
759
+ background-color: hsl(var(--positive-50, 160 84% 39%) / 0.1);
760
+ }
761
+
762
+ .rjsf-f0-callout[data-variant='positive'] svg {
763
+ color: hsl(var(--positive-70, 161 84% 27%));
422
764
  }
423
765
 
424
766
  .fcode-form-markdown img {
@@ -461,7 +803,8 @@
461
803
  padding: 0.5rem 0.75rem;
462
804
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
463
805
  font-size: 0.875rem;
464
- line-height: 1.5;
806
+ /* f0 pairs `text-base` with a 1.25rem line-height, not a 1.5 ratio. */
807
+ line-height: 1.25rem;
465
808
  white-space: pre;
466
809
  }
467
810
 
@@ -501,7 +844,7 @@
501
844
  gap: 0.25rem;
502
845
  margin-bottom: 1.5rem;
503
846
  padding-bottom: 0.5rem;
504
- border-bottom: 1px solid var(--f1-border-secondary, rgb(0 0 0 / 0.1));
847
+ border-bottom: 1px solid hsl(var(--neutral-20, 214 70% 20% / 0.1));
505
848
  }
506
849
 
507
850
  /* Wraps to a stacked layout on narrow widths via the main column's min-width. */
@@ -535,7 +878,7 @@
535
878
  .rjsf-f0-steps-description {
536
879
  margin: 0;
537
880
  font-size: 0.875rem;
538
- color: var(--f1-foreground-secondary, inherit);
881
+ color: hsl(var(--neutral-50, 217 96% 11% / 0.61));
539
882
  }
540
883
 
541
884
  /*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorialco/rjsf-f0",
3
- "version": "2.1.0",
3
+ "version": "2.2.1",
4
4
  "description": "Factorial f0 theme for react-jsonschema-form: renders RJSF forms with f0 components.",
5
5
  "type": "module",
6
6
  "homepage": "https://code.factorialhr.com/docs/forms/",