@factorialco/rjsf-f0 1.1.0 → 1.1.2

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.
@@ -47,8 +47,10 @@ export declare function generateTheme(): ThemeProps;
47
47
  * The f0 theme for react-jsonschema-form.
48
48
  *
49
49
  * Anything not listed in `Templates`/`Widgets` falls through to `@rjsf/core`'s
50
- * own implementation. That is deliberate for the file widget, which keeps RJSF's
51
- * native `<input type="file">` because the surrounding SDK exchanges uploads as
52
- * `data:` URLs, and f0's file field is built around an upload hook instead.
50
+ * own implementation. The file widget is core's, but core renders it through
51
+ * this theme's `BaseInputTemplate`, which keeps a native `<input type="file">`
52
+ * for it (see `FileInput` in `widgets/input-widgets.tsx`): the surrounding SDK
53
+ * exchanges uploads as `data:` URLs, and f0's file field is built around an
54
+ * upload hook instead.
53
55
  */
54
56
  export declare const Theme: ThemeProps;
@@ -2,8 +2,8 @@ import { default as React } from '../../node_modules/@types/react';
2
2
  import { BaseInputTemplateProps, WidgetProps } from '@rjsf/utils';
3
3
  /**
4
4
  * Renders every `<input>`-based widget: text, email, url, password, number,
5
- * date, datetime and time all route through here, as they do in RJSF's own
6
- * themes.
5
+ * date, datetime, time and file all route through here, as they do in RJSF's
6
+ * own themes.
7
7
  */
8
8
  export declare function BaseInputTemplate(props: BaseInputTemplateProps): React.JSX.Element;
9
9
  /** Multi-line text. */
package/dist/styles.css CHANGED
@@ -185,6 +185,75 @@
185
185
  gap: 1rem;
186
186
  }
187
187
 
188
+ /*
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.
196
+ */
197
+ .rjsf-f0-file {
198
+ font-size: 0.875rem;
199
+ color: var(--f1-foreground-secondary, inherit);
200
+ }
201
+
202
+ .rjsf-f0-file:focus-visible {
203
+ outline: 2px solid hsl(var(--ring, 184 92% 35%));
204
+ outline-offset: 2px;
205
+ border-radius: 0.625rem;
206
+ }
207
+
208
+ .rjsf-f0-file::file-selector-button {
209
+ height: 2rem;
210
+ margin-right: 0.75rem;
211
+ padding: 0 1rem;
212
+ border: none;
213
+ border-radius: 0.625rem;
214
+ background-color: hsl(var(--neutral-10, 216 89% 18% / 0.06));
215
+ color: hsl(var(--neutral-100, 218 48% 10%));
216
+ font-family: inherit;
217
+ font-size: 0.875rem;
218
+ font-weight: 500;
219
+ cursor: pointer;
220
+ transition: background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
221
+ }
222
+
223
+ .rjsf-f0-file:not(:disabled)::file-selector-button:hover {
224
+ background-color: hsl(var(--neutral-20, 214 70% 20% / 0.1));
225
+ }
226
+
227
+ .rjsf-f0-file:disabled::file-selector-button {
228
+ background-color: hsl(var(--neutral-3, 219 88% 17% / 0.02));
229
+ color: hsl(var(--neutral-30, 213 87% 15% / 0.2));
230
+ cursor: default;
231
+ }
232
+
233
+ /*
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).
236
+ */
237
+ .rjsf-f0-field .file-info {
238
+ display: flex;
239
+ flex-direction: column;
240
+ gap: 0.25rem;
241
+ margin: 0;
242
+ padding: 0;
243
+ list-style: none;
244
+ font-size: 0.875rem;
245
+ }
246
+
247
+ .rjsf-f0-field .file-info li {
248
+ display: flex;
249
+ align-items: center;
250
+ gap: 0.5rem;
251
+ }
252
+
253
+ .rjsf-f0-field .file-info p {
254
+ margin: 0;
255
+ }
256
+
188
257
  /*
189
258
  * Every selector here must stay namespaced. This sheet is imported app-wide, so
190
259
  * a bare utility class would collide with the host app's: an unscoped
@@ -195,6 +264,130 @@
195
264
  display: none;
196
265
  }
197
266
 
267
+ /*
268
+ * The SDK's submit/loading overlay.
269
+ *
270
+ * Like the `json` field below, it is rendered by the SDK (`LoadingOverlay`),
271
+ * not by this theme, and its positioning lives in the SDK's standalone
272
+ * stylesheet — which f0 consumers deliberately do not load. Without these
273
+ * rules the overlay falls into the normal flow: the form grows to fit
274
+ * "Sending information..." at the bottom and shrinks back after the submit.
275
+ * The mechanism is the SDK's (root anchors, overlay covers it); the scrim and
276
+ * text use f0's neutral scale so both flip in dark mode, and the spinner uses
277
+ * f0's selected hue, its usual loading colour.
278
+ */
279
+ .fcode-loading-overlay-root {
280
+ position: relative;
281
+ }
282
+
283
+ .fcode-loading-overlay {
284
+ position: absolute;
285
+ inset: 0;
286
+ box-sizing: border-box;
287
+ display: flex;
288
+ flex-direction: column;
289
+ align-items: center;
290
+ justify-content: center;
291
+ padding: 2rem;
292
+ background-color: hsl(var(--neutral-0, 0 0% 100%) / 0.75);
293
+ }
294
+
295
+ .fcode-loading-overlay-enter {
296
+ opacity: 0;
297
+ }
298
+
299
+ .fcode-loading-overlay-enter-active {
300
+ opacity: 1;
301
+ transition: opacity 200ms;
302
+ }
303
+
304
+ .fcode-loading-overlay-exit {
305
+ opacity: 1;
306
+ }
307
+
308
+ .fcode-loading-overlay-exit-active {
309
+ opacity: 0;
310
+ transition: opacity 200ms;
311
+ }
312
+
313
+ .fcode-loading-overlay-content-wrapper {
314
+ display: flex;
315
+ flex-direction: column;
316
+ gap: 1rem;
317
+ align-items: center;
318
+ justify-content: center;
319
+ /* Keeps the spinner in view when the overlay covers a form taller than the viewport. */
320
+ position: sticky;
321
+ top: 1rem;
322
+ }
323
+
324
+ .fcode-loading-overlay-spinner {
325
+ position: relative;
326
+ width: 3rem;
327
+ height: 3rem;
328
+ }
329
+
330
+ .fcode-loading-overlay-spinner svg {
331
+ position: absolute;
332
+ inset: 0;
333
+ width: 100%;
334
+ height: 100%;
335
+ margin: auto;
336
+ transform-origin: center center;
337
+ animation: rjsf-f0-rotate360 2s linear infinite;
338
+ }
339
+
340
+ .fcode-loading-overlay-spinner circle {
341
+ animation: rjsf-f0-spinner-dash 1.5s ease-in-out infinite;
342
+ stroke-dasharray: 1, 200;
343
+ stroke-dashoffset: 0;
344
+ stroke-linecap: round;
345
+ stroke: hsl(var(--selected-50, 184 92% 35%));
346
+ }
347
+
348
+ .fcode-loading-overlay-content {
349
+ margin: 0;
350
+ color: hsl(var(--neutral-100, 218 48% 10%));
351
+ font-size: 0.875rem;
352
+ text-align: center;
353
+ }
354
+
355
+ /*
356
+ * While the schema loads there is nothing to dim — the skeleton is the
357
+ * content — and the overlay takes its height from what it covers, so the
358
+ * floor keeps the spinner inside the box when the skeleton is shorter.
359
+ */
360
+ .fcode-form-loading > .fcode-loading-overlay-root {
361
+ box-sizing: border-box;
362
+ min-height: 11rem;
363
+ }
364
+
365
+ .fcode-form-loading .fcode-loading-overlay {
366
+ background-color: transparent;
367
+ }
368
+
369
+ /* Keyframes are global names, so they carry the namespace themselves. */
370
+ @keyframes rjsf-f0-rotate360 {
371
+ to {
372
+ transform: rotate(360deg);
373
+ }
374
+ }
375
+
376
+ @keyframes rjsf-f0-spinner-dash {
377
+ 0% {
378
+ stroke-dasharray: 1, 200;
379
+ stroke-dashoffset: 0;
380
+ }
381
+ 50% {
382
+ stroke-dasharray: 89, 200;
383
+ stroke-dashoffset: -35px;
384
+ }
385
+ 100% {
386
+ stroke-dasharray: 89, 200;
387
+ stroke-dashoffset: -124px;
388
+ }
389
+ }
390
+
198
391
  /*
199
392
  * The SDK's `json` field.
200
393
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorialco/rjsf-f0",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
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/",