@squaredr/fieldcraft-pro 1.5.0 → 1.6.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.
- package/dist/{chunk-BK4SMEW4.mjs → chunk-5LKGCZAW.mjs} +1 -0
- package/dist/{chunk-6LRUDBC7.mjs → chunk-ANBMT5AW.mjs} +1 -53
- package/dist/{chunk-22T5PY6L.mjs → chunk-IKGS2ZXV.mjs} +382 -87
- package/dist/form-builder/index.d.mts +1 -1
- package/dist/form-builder/index.d.ts +1 -1
- package/dist/form-builder/index.js +0 -54
- package/dist/form-builder/index.mjs +1 -1
- package/dist/{index-BHJ4mqHP.d.ts → index-D19524df.d.mts} +1 -12
- package/dist/{index-BHJ4mqHP.d.mts → index-D19524df.d.ts} +1 -12
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +427 -101
- package/dist/index.mjs +4 -4
- package/dist/response-viewer/index.js +1 -0
- package/dist/response-viewer/index.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme-editor/index.d.mts +78 -13
- package/dist/theme-editor/index.d.ts +78 -13
- package/dist/theme-editor/index.js +381 -86
- package/dist/theme-editor/index.mjs +1 -1
- package/package.json +3 -3
- package/theme-editor/styles.css +20 -5
- package/dist/preview-schema-DFvV4y6J.d.mts +0 -66
- package/dist/preview-schema-DFvV4y6J.d.ts +0 -66
|
@@ -1745,6 +1745,7 @@ function ResponseViewerInner({
|
|
|
1745
1745
|
return /* @__PURE__ */ jsxs(
|
|
1746
1746
|
"div",
|
|
1747
1747
|
{
|
|
1748
|
+
"data-fcrv-root": "",
|
|
1748
1749
|
className: "flex flex-col border border-border rounded-lg overflow-hidden bg-background text-foreground",
|
|
1749
1750
|
style: { height: heightValue, width: widthValue },
|
|
1750
1751
|
children: [
|
|
@@ -4467,56 +4467,4 @@ function FormBuilderInner(props) {
|
|
|
4467
4467
|
// src/form-builder/components/FormBuilderGated.tsx
|
|
4468
4468
|
var FormBuilder = requireLicense(FormBuilderInner, "FormBuilder");
|
|
4469
4469
|
|
|
4470
|
-
|
|
4471
|
-
var squaredrDarkPreset = {
|
|
4472
|
-
background: "#0F1A1F",
|
|
4473
|
-
foreground: "#E8EFF1",
|
|
4474
|
-
card: "#16242A",
|
|
4475
|
-
primary: "#63BDB4",
|
|
4476
|
-
primaryForeground: "#0F1A1F",
|
|
4477
|
-
secondary: "#182F31",
|
|
4478
|
-
secondaryForeground: "#E8EFF1",
|
|
4479
|
-
muted: "#182F31",
|
|
4480
|
-
mutedForeground: "#8CA1A9",
|
|
4481
|
-
accent: "#182F31",
|
|
4482
|
-
accentForeground: "#E8EFF1",
|
|
4483
|
-
destructive: "#E08072",
|
|
4484
|
-
destructiveForeground: "#0F1A1F",
|
|
4485
|
-
border: "#2A3B42",
|
|
4486
|
-
input: "#2A3B42",
|
|
4487
|
-
ring: "#63BDB4",
|
|
4488
|
-
radius: "0px",
|
|
4489
|
-
surface: "#16242A",
|
|
4490
|
-
surfaceHover: "#182F31",
|
|
4491
|
-
canvas: "#0F1A1F",
|
|
4492
|
-
panel: "#16242A",
|
|
4493
|
-
borderStrong: "#2F4F4C",
|
|
4494
|
-
textDim: "#5E7680"
|
|
4495
|
-
};
|
|
4496
|
-
var cleanPreset = {
|
|
4497
|
-
background: "#F4F7F8",
|
|
4498
|
-
foreground: "#12222A",
|
|
4499
|
-
card: "#FFFFFF",
|
|
4500
|
-
primary: "#1F6B6E",
|
|
4501
|
-
primaryForeground: "#FFFFFF",
|
|
4502
|
-
secondary: "#EDF3F2",
|
|
4503
|
-
secondaryForeground: "#12222A",
|
|
4504
|
-
muted: "#EDF3F2",
|
|
4505
|
-
mutedForeground: "#6A7B85",
|
|
4506
|
-
accent: "#EDF3F2",
|
|
4507
|
-
accentForeground: "#12222A",
|
|
4508
|
-
destructive: "#B04A3C",
|
|
4509
|
-
destructiveForeground: "#FFFFFF",
|
|
4510
|
-
border: "#DCE4E8",
|
|
4511
|
-
input: "#DCE4E8",
|
|
4512
|
-
ring: "#1F6B6E",
|
|
4513
|
-
radius: "0px",
|
|
4514
|
-
surface: "#FAFCFC",
|
|
4515
|
-
surfaceHover: "#EDF3F2",
|
|
4516
|
-
canvas: "#F4F7F8",
|
|
4517
|
-
panel: "#FFFFFF",
|
|
4518
|
-
borderStrong: "#B9D1CF",
|
|
4519
|
-
textDim: "#6A7B85"
|
|
4520
|
-
};
|
|
4521
|
-
|
|
4522
|
-
export { DEFAULT_PALETTE, DEFAULT_SCHEMA, FormBuilder, FormBuilderThemeProvider, QUESTION_TYPE_INFO, addOption, addQuestion, addSection, cleanPreset, duplicateQuestion, duplicateSection, findQuestion, findSection, generateId, generateOptionId, generateQuestionId, generateSectionId, moveOption, moveQuestion, moveSection, removeOption, removeQuestion, removeSection, squaredrDarkPreset, updateOption, updateQuestion, updateSection, useBuilderState, useBuilderTheme, useDragDrop, useUndoRedo };
|
|
4470
|
+
export { DEFAULT_PALETTE, DEFAULT_SCHEMA, FormBuilder, FormBuilderThemeProvider, QUESTION_TYPE_INFO, addOption, addQuestion, addSection, duplicateQuestion, duplicateSection, findQuestion, findSection, generateId, generateOptionId, generateQuestionId, generateSectionId, moveOption, moveQuestion, moveSection, removeOption, removeQuestion, removeSection, updateOption, updateQuestion, updateSection, useBuilderState, useBuilderTheme, useDragDrop, useUndoRedo };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { requireLicense } from './chunk-VECQKSWS.mjs';
|
|
2
|
-
import { createContext, useState, useRef, useEffect, useCallback,
|
|
3
|
-
import {
|
|
2
|
+
import { createContext, useMemo, useState, useRef, useEffect, useCallback, useContext } from 'react';
|
|
3
|
+
import { FormEngineRenderer } from '@squaredr/fieldcraft-react';
|
|
4
4
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
// src/theme-editor/preview-schema.ts
|
|
@@ -407,7 +407,38 @@ function PaletteGenerator({ theme, onApply, onClose }) {
|
|
|
407
407
|
}
|
|
408
408
|
|
|
409
409
|
// src/theme-editor/presets.ts
|
|
410
|
-
var
|
|
410
|
+
var cleanPreset = {
|
|
411
|
+
colors: {
|
|
412
|
+
primary: "#1F6B6E",
|
|
413
|
+
primaryForeground: "#FFFFFF",
|
|
414
|
+
secondary: "#B9D1CF",
|
|
415
|
+
secondaryForeground: "#12222A",
|
|
416
|
+
error: "#B04A3C",
|
|
417
|
+
errorForeground: "#FFFFFF",
|
|
418
|
+
warning: "#C98A2E",
|
|
419
|
+
success: "#2E7D5B",
|
|
420
|
+
surface: "#FFFFFF",
|
|
421
|
+
background: "#F4F7F8",
|
|
422
|
+
text: "#12222A",
|
|
423
|
+
textMuted: "#6A7B85",
|
|
424
|
+
textDisabled: "#B9D1CF",
|
|
425
|
+
border: "#DCE4E8",
|
|
426
|
+
borderFocus: "#1F6B6E",
|
|
427
|
+
inputBackground: "#FFFFFF"
|
|
428
|
+
},
|
|
429
|
+
typography: {
|
|
430
|
+
fontFamily: "Inter, system-ui, sans-serif",
|
|
431
|
+
scale: "comfortable",
|
|
432
|
+
questionSize: "1.125rem",
|
|
433
|
+
labelSize: "0.875rem",
|
|
434
|
+
helpTextSize: "0.8125rem",
|
|
435
|
+
bodySize: "0.9375rem"
|
|
436
|
+
},
|
|
437
|
+
shape: { radius: "none", inputRadius: "0px", buttonRadius: "0px", cardRadius: "0px" },
|
|
438
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
439
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
440
|
+
};
|
|
441
|
+
var cleanDarkPreset = {
|
|
411
442
|
colors: {
|
|
412
443
|
primary: "#63BDB4",
|
|
413
444
|
primaryForeground: "#0F1A1F",
|
|
@@ -416,7 +447,7 @@ var draftingTealDarkPreset = {
|
|
|
416
447
|
error: "#E08072",
|
|
417
448
|
errorForeground: "#0F1A1F",
|
|
418
449
|
warning: "#E0A94F",
|
|
419
|
-
success: "#
|
|
450
|
+
success: "#5DB89A",
|
|
420
451
|
surface: "#16242A",
|
|
421
452
|
background: "#0F1A1F",
|
|
422
453
|
text: "#E8EFF1",
|
|
@@ -427,92 +458,281 @@ var draftingTealDarkPreset = {
|
|
|
427
458
|
inputBackground: "#16242A"
|
|
428
459
|
},
|
|
429
460
|
typography: {
|
|
430
|
-
fontFamily: "
|
|
461
|
+
fontFamily: "Inter, system-ui, sans-serif",
|
|
431
462
|
scale: "comfortable",
|
|
432
|
-
questionSize: "1.
|
|
433
|
-
labelSize: "0.
|
|
463
|
+
questionSize: "1.125rem",
|
|
464
|
+
labelSize: "0.875rem",
|
|
434
465
|
helpTextSize: "0.8125rem",
|
|
435
466
|
bodySize: "0.9375rem"
|
|
436
467
|
},
|
|
437
|
-
shape: {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
468
|
+
shape: { radius: "none", inputRadius: "0px", buttonRadius: "0px", cardRadius: "0px" },
|
|
469
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
470
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
471
|
+
};
|
|
472
|
+
var modernPreset = {
|
|
473
|
+
colors: {
|
|
474
|
+
primary: "#6366F1",
|
|
475
|
+
primaryForeground: "#ffffff",
|
|
476
|
+
secondary: "#8B5CF6",
|
|
477
|
+
secondaryForeground: "#ffffff",
|
|
478
|
+
error: "#F43F5E",
|
|
479
|
+
errorForeground: "#ffffff",
|
|
480
|
+
warning: "#F59E0B",
|
|
481
|
+
success: "#22C55E",
|
|
482
|
+
surface: "#ffffff",
|
|
483
|
+
background: "#FAFAFA",
|
|
484
|
+
text: "#18181B",
|
|
485
|
+
textMuted: "#71717A",
|
|
486
|
+
textDisabled: "#D4D4D8",
|
|
487
|
+
border: "#E4E4E7",
|
|
488
|
+
borderFocus: "#6366F1",
|
|
489
|
+
inputBackground: "#FAFAFA"
|
|
442
490
|
},
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
491
|
+
typography: {
|
|
492
|
+
fontFamily: "'Plus Jakarta Sans', Inter, system-ui, sans-serif",
|
|
493
|
+
scale: "comfortable",
|
|
494
|
+
questionSize: "1.25rem",
|
|
495
|
+
labelSize: "0.875rem",
|
|
496
|
+
helpTextSize: "0.8125rem",
|
|
497
|
+
bodySize: "1rem"
|
|
449
498
|
},
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
progressPosition: "top",
|
|
454
|
-
sectionLayout: "flat"
|
|
455
|
-
}
|
|
499
|
+
shape: { radius: "lg", inputRadius: "12px", buttonRadius: "12px", cardRadius: "16px" },
|
|
500
|
+
spacing: { base: 16, sectionGap: 40, fieldGap: 28, inputPaddingX: 16, inputPaddingY: 12 },
|
|
501
|
+
layout: { maxWidth: "680px", alignment: "center", progressPosition: "top", sectionLayout: "card" }
|
|
456
502
|
};
|
|
457
|
-
var
|
|
503
|
+
var modernDarkPreset = {
|
|
458
504
|
colors: {
|
|
459
|
-
primary: "#
|
|
460
|
-
primaryForeground: "#
|
|
461
|
-
secondary: "#
|
|
462
|
-
secondaryForeground: "#
|
|
463
|
-
error: "#
|
|
464
|
-
errorForeground: "#
|
|
465
|
-
warning: "#
|
|
466
|
-
success: "#
|
|
467
|
-
surface: "#
|
|
468
|
-
background: "#
|
|
469
|
-
text: "#
|
|
470
|
-
textMuted: "#
|
|
471
|
-
textDisabled: "#
|
|
472
|
-
border: "#
|
|
473
|
-
borderFocus: "#
|
|
474
|
-
inputBackground: "#
|
|
505
|
+
primary: "#818CF8",
|
|
506
|
+
primaryForeground: "#1E1B4B",
|
|
507
|
+
secondary: "#A78BFA",
|
|
508
|
+
secondaryForeground: "#1E1B4B",
|
|
509
|
+
error: "#FB7185",
|
|
510
|
+
errorForeground: "#1E1B4B",
|
|
511
|
+
warning: "#FBBF24",
|
|
512
|
+
success: "#4ADE80",
|
|
513
|
+
surface: "#1E1B4B",
|
|
514
|
+
background: "#13111C",
|
|
515
|
+
text: "#E8E6F0",
|
|
516
|
+
textMuted: "#A1A1AA",
|
|
517
|
+
textDisabled: "#3F3F46",
|
|
518
|
+
border: "#2E2B4A",
|
|
519
|
+
borderFocus: "#818CF8",
|
|
520
|
+
inputBackground: "#1E1B4B"
|
|
475
521
|
},
|
|
476
522
|
typography: {
|
|
477
|
-
fontFamily: "'
|
|
523
|
+
fontFamily: "'Plus Jakarta Sans', Inter, system-ui, sans-serif",
|
|
478
524
|
scale: "comfortable",
|
|
479
|
-
questionSize: "1.
|
|
480
|
-
labelSize: "0.
|
|
525
|
+
questionSize: "1.25rem",
|
|
526
|
+
labelSize: "0.875rem",
|
|
527
|
+
helpTextSize: "0.8125rem",
|
|
528
|
+
bodySize: "1rem"
|
|
529
|
+
},
|
|
530
|
+
shape: { radius: "lg", inputRadius: "12px", buttonRadius: "12px", cardRadius: "16px" },
|
|
531
|
+
spacing: { base: 16, sectionGap: 40, fieldGap: 28, inputPaddingX: 16, inputPaddingY: 12 },
|
|
532
|
+
layout: { maxWidth: "680px", alignment: "center", progressPosition: "top", sectionLayout: "card" }
|
|
533
|
+
};
|
|
534
|
+
var clinicalPreset = {
|
|
535
|
+
colors: {
|
|
536
|
+
primary: "#0284C7",
|
|
537
|
+
primaryForeground: "#ffffff",
|
|
538
|
+
secondary: "#0891B2",
|
|
539
|
+
secondaryForeground: "#ffffff",
|
|
540
|
+
error: "#DC2626",
|
|
541
|
+
errorForeground: "#ffffff",
|
|
542
|
+
warning: "#D97706",
|
|
543
|
+
success: "#16A34A",
|
|
544
|
+
surface: "#ffffff",
|
|
545
|
+
background: "#F0F9FF",
|
|
546
|
+
text: "#0C4A6E",
|
|
547
|
+
textMuted: "#64748B",
|
|
548
|
+
textDisabled: "#CBD5E1",
|
|
549
|
+
border: "#BAE6FD",
|
|
550
|
+
borderFocus: "#0284C7",
|
|
551
|
+
inputBackground: "#ffffff"
|
|
552
|
+
},
|
|
553
|
+
typography: {
|
|
554
|
+
fontFamily: "'Source Sans 3', 'Segoe UI', system-ui, sans-serif",
|
|
555
|
+
scale: "comfortable",
|
|
556
|
+
questionSize: "1.0625rem",
|
|
557
|
+
labelSize: "0.875rem",
|
|
481
558
|
helpTextSize: "0.8125rem",
|
|
482
559
|
bodySize: "0.9375rem"
|
|
483
560
|
},
|
|
484
|
-
shape: {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
561
|
+
shape: { radius: "sm", inputRadius: "6px", buttonRadius: "6px", cardRadius: "8px" },
|
|
562
|
+
spacing: { base: 16, sectionGap: 28, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
563
|
+
layout: { maxWidth: "680px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
564
|
+
};
|
|
565
|
+
var clinicalDarkPreset = {
|
|
566
|
+
colors: {
|
|
567
|
+
primary: "#38BDF8",
|
|
568
|
+
primaryForeground: "#0C1929",
|
|
569
|
+
secondary: "#22D3EE",
|
|
570
|
+
secondaryForeground: "#0C1929",
|
|
571
|
+
error: "#F87171",
|
|
572
|
+
errorForeground: "#0C1929",
|
|
573
|
+
warning: "#FBBF24",
|
|
574
|
+
success: "#34D399",
|
|
575
|
+
surface: "#0F2438",
|
|
576
|
+
background: "#0C1929",
|
|
577
|
+
text: "#E0F2FE",
|
|
578
|
+
textMuted: "#7DD3FC",
|
|
579
|
+
textDisabled: "#1E3A5F",
|
|
580
|
+
border: "#1E3A5F",
|
|
581
|
+
borderFocus: "#38BDF8",
|
|
582
|
+
inputBackground: "#0F2438"
|
|
489
583
|
},
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
584
|
+
typography: {
|
|
585
|
+
fontFamily: "'Source Sans 3', 'Segoe UI', system-ui, sans-serif",
|
|
586
|
+
scale: "comfortable",
|
|
587
|
+
questionSize: "1.0625rem",
|
|
588
|
+
labelSize: "0.875rem",
|
|
589
|
+
helpTextSize: "0.8125rem",
|
|
590
|
+
bodySize: "0.9375rem"
|
|
496
591
|
},
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
progressPosition: "top",
|
|
501
|
-
sectionLayout: "flat"
|
|
502
|
-
}
|
|
592
|
+
shape: { radius: "sm", inputRadius: "6px", buttonRadius: "6px", cardRadius: "8px" },
|
|
593
|
+
spacing: { base: 16, sectionGap: 28, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
594
|
+
layout: { maxWidth: "680px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
503
595
|
};
|
|
504
|
-
var
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
596
|
+
var playfulPreset = {
|
|
597
|
+
colors: {
|
|
598
|
+
primary: "#EC4899",
|
|
599
|
+
primaryForeground: "#ffffff",
|
|
600
|
+
secondary: "#8B5CF6",
|
|
601
|
+
secondaryForeground: "#ffffff",
|
|
602
|
+
error: "#EF4444",
|
|
603
|
+
errorForeground: "#ffffff",
|
|
604
|
+
warning: "#F59E0B",
|
|
605
|
+
success: "#10B981",
|
|
606
|
+
surface: "#ffffff",
|
|
607
|
+
background: "#FFF7ED",
|
|
608
|
+
text: "#1C1917",
|
|
609
|
+
textMuted: "#78716C",
|
|
610
|
+
textDisabled: "#D6D3D1",
|
|
611
|
+
border: "#FDE68A",
|
|
612
|
+
borderFocus: "#EC4899",
|
|
613
|
+
inputBackground: "#FFFBEB"
|
|
614
|
+
},
|
|
615
|
+
typography: {
|
|
616
|
+
fontFamily: "'Nunito', 'Comic Neue', system-ui, sans-serif",
|
|
617
|
+
scale: "spacious",
|
|
618
|
+
questionSize: "1.25rem",
|
|
619
|
+
labelSize: "0.9375rem",
|
|
620
|
+
helpTextSize: "0.875rem",
|
|
621
|
+
bodySize: "1rem"
|
|
622
|
+
},
|
|
623
|
+
shape: { radius: "full", inputRadius: "9999px", buttonRadius: "9999px", cardRadius: "20px" },
|
|
624
|
+
spacing: { base: 18, sectionGap: 36, fieldGap: 28, inputPaddingX: 18, inputPaddingY: 12 },
|
|
625
|
+
layout: { maxWidth: "600px", alignment: "center", progressPosition: "top", sectionLayout: "card" }
|
|
512
626
|
};
|
|
627
|
+
var playfulDarkPreset = {
|
|
628
|
+
colors: {
|
|
629
|
+
primary: "#F472B6",
|
|
630
|
+
primaryForeground: "#1A0A14",
|
|
631
|
+
secondary: "#A78BFA",
|
|
632
|
+
secondaryForeground: "#1A0A14",
|
|
633
|
+
error: "#FCA5A5",
|
|
634
|
+
errorForeground: "#1A0A14",
|
|
635
|
+
warning: "#FCD34D",
|
|
636
|
+
success: "#6EE7B7",
|
|
637
|
+
surface: "#2D1F2B",
|
|
638
|
+
background: "#1A0F19",
|
|
639
|
+
text: "#FDF2F8",
|
|
640
|
+
textMuted: "#D4A9C4",
|
|
641
|
+
textDisabled: "#4A3248",
|
|
642
|
+
border: "#5C3D56",
|
|
643
|
+
borderFocus: "#F472B6",
|
|
644
|
+
inputBackground: "#2D1F2B"
|
|
645
|
+
},
|
|
646
|
+
typography: {
|
|
647
|
+
fontFamily: "'Nunito', 'Comic Neue', system-ui, sans-serif",
|
|
648
|
+
scale: "spacious",
|
|
649
|
+
questionSize: "1.25rem",
|
|
650
|
+
labelSize: "0.9375rem",
|
|
651
|
+
helpTextSize: "0.875rem",
|
|
652
|
+
bodySize: "1rem"
|
|
653
|
+
},
|
|
654
|
+
shape: { radius: "full", inputRadius: "9999px", buttonRadius: "9999px", cardRadius: "20px" },
|
|
655
|
+
spacing: { base: 18, sectionGap: 36, fieldGap: 28, inputPaddingX: 18, inputPaddingY: 12 },
|
|
656
|
+
layout: { maxWidth: "600px", alignment: "center", progressPosition: "top", sectionLayout: "card" }
|
|
657
|
+
};
|
|
658
|
+
var highContrastPreset = {
|
|
659
|
+
colors: {
|
|
660
|
+
primary: "#0000EE",
|
|
661
|
+
primaryForeground: "#ffffff",
|
|
662
|
+
secondary: "#6B21A8",
|
|
663
|
+
secondaryForeground: "#ffffff",
|
|
664
|
+
error: "#B91C1C",
|
|
665
|
+
errorForeground: "#ffffff",
|
|
666
|
+
warning: "#92400E",
|
|
667
|
+
success: "#166534",
|
|
668
|
+
surface: "#ffffff",
|
|
669
|
+
background: "#ffffff",
|
|
670
|
+
text: "#000000",
|
|
671
|
+
textMuted: "#374151",
|
|
672
|
+
textDisabled: "#9CA3AF",
|
|
673
|
+
border: "#000000",
|
|
674
|
+
borderFocus: "#0000EE",
|
|
675
|
+
inputBackground: "#ffffff"
|
|
676
|
+
},
|
|
677
|
+
typography: {
|
|
678
|
+
fontFamily: "Arial, Helvetica, sans-serif",
|
|
679
|
+
scale: "spacious",
|
|
680
|
+
questionSize: "1.25rem",
|
|
681
|
+
labelSize: "1rem",
|
|
682
|
+
helpTextSize: "0.9375rem",
|
|
683
|
+
bodySize: "1rem"
|
|
684
|
+
},
|
|
685
|
+
shape: { radius: "sm", inputRadius: "4px", buttonRadius: "4px", cardRadius: "4px" },
|
|
686
|
+
spacing: { base: 20, sectionGap: 40, fieldGap: 32, inputPaddingX: 14, inputPaddingY: 12 },
|
|
687
|
+
layout: { maxWidth: "720px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
688
|
+
};
|
|
689
|
+
var highContrastDarkPreset = {
|
|
690
|
+
colors: {
|
|
691
|
+
primary: "#93C5FD",
|
|
692
|
+
primaryForeground: "#000000",
|
|
693
|
+
secondary: "#C084FC",
|
|
694
|
+
secondaryForeground: "#000000",
|
|
695
|
+
error: "#FCA5A5",
|
|
696
|
+
errorForeground: "#000000",
|
|
697
|
+
warning: "#FCD34D",
|
|
698
|
+
success: "#86EFAC",
|
|
699
|
+
surface: "#000000",
|
|
700
|
+
background: "#000000",
|
|
701
|
+
text: "#FFFFFF",
|
|
702
|
+
textMuted: "#D1D5DB",
|
|
703
|
+
textDisabled: "#6B7280",
|
|
704
|
+
border: "#FFFFFF",
|
|
705
|
+
borderFocus: "#93C5FD",
|
|
706
|
+
inputBackground: "#000000"
|
|
707
|
+
},
|
|
708
|
+
typography: {
|
|
709
|
+
fontFamily: "Arial, Helvetica, sans-serif",
|
|
710
|
+
scale: "spacious",
|
|
711
|
+
questionSize: "1.25rem",
|
|
712
|
+
labelSize: "1rem",
|
|
713
|
+
helpTextSize: "0.9375rem",
|
|
714
|
+
bodySize: "1rem"
|
|
715
|
+
},
|
|
716
|
+
shape: { radius: "sm", inputRadius: "4px", buttonRadius: "4px", cardRadius: "4px" },
|
|
717
|
+
spacing: { base: 20, sectionGap: 40, fieldGap: 32, inputPaddingX: 14, inputPaddingY: 12 },
|
|
718
|
+
layout: { maxWidth: "720px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
719
|
+
};
|
|
720
|
+
var PRESET_FAMILIES = {
|
|
721
|
+
clean: { light: cleanPreset, dark: cleanDarkPreset, label: "Clean" },
|
|
722
|
+
modern: { light: modernPreset, dark: modernDarkPreset, label: "Modern" },
|
|
723
|
+
clinical: { light: clinicalPreset, dark: clinicalDarkPreset, label: "Clinical" },
|
|
724
|
+
playful: { light: playfulPreset, dark: playfulDarkPreset, label: "Playful" },
|
|
725
|
+
"high-contrast": { light: highContrastPreset, dark: highContrastDarkPreset, label: "High contrast" }
|
|
726
|
+
};
|
|
727
|
+
var COMPARISON_PRESETS = Object.fromEntries(
|
|
728
|
+
Object.entries(PRESET_FAMILIES).map(([key, family]) => [
|
|
729
|
+
key,
|
|
730
|
+
{ label: family.label, theme: family.light }
|
|
731
|
+
])
|
|
732
|
+
);
|
|
513
733
|
function ThemeComparison({ currentTheme, onClose }) {
|
|
514
734
|
const [compareKey, setCompareKey] = useState("clean");
|
|
515
|
-
const compareTheme = COMPARISON_PRESETS[compareKey]?.theme ??
|
|
735
|
+
const compareTheme = COMPARISON_PRESETS[compareKey]?.theme ?? PRESET_FAMILIES.clean.light;
|
|
516
736
|
const diffs = getColorDiffs(currentTheme, compareTheme);
|
|
517
737
|
return /* @__PURE__ */ jsxs("div", { className: "fcte-compare", children: [
|
|
518
738
|
/* @__PURE__ */ jsxs("div", { className: "fcte-compare__header", children: [
|
|
@@ -610,6 +830,50 @@ function getColorDiffs(a, b) {
|
|
|
610
830
|
}
|
|
611
831
|
return diffs;
|
|
612
832
|
}
|
|
833
|
+
|
|
834
|
+
// src/utils/resolve-theme-from-dom.ts
|
|
835
|
+
function resolveThemeFromDOM() {
|
|
836
|
+
if (typeof window === "undefined") return {};
|
|
837
|
+
const styles = getComputedStyle(document.documentElement);
|
|
838
|
+
const get = (prop) => {
|
|
839
|
+
const val = styles.getPropertyValue(prop).trim();
|
|
840
|
+
return val || void 0;
|
|
841
|
+
};
|
|
842
|
+
return {
|
|
843
|
+
colors: {
|
|
844
|
+
primary: get("--primary"),
|
|
845
|
+
primaryForeground: get("--primary-foreground"),
|
|
846
|
+
secondary: get("--secondary"),
|
|
847
|
+
secondaryForeground: get("--secondary-foreground"),
|
|
848
|
+
error: get("--destructive"),
|
|
849
|
+
errorForeground: get("--destructive-foreground"),
|
|
850
|
+
warning: get("--fc-color-warning"),
|
|
851
|
+
success: get("--fc-color-success"),
|
|
852
|
+
surface: get("--card"),
|
|
853
|
+
background: get("--background"),
|
|
854
|
+
text: get("--foreground"),
|
|
855
|
+
textMuted: get("--muted-foreground"),
|
|
856
|
+
textDisabled: void 0,
|
|
857
|
+
border: get("--border"),
|
|
858
|
+
borderFocus: get("--ring"),
|
|
859
|
+
inputBackground: get("--input-background") ?? get("--card")
|
|
860
|
+
},
|
|
861
|
+
typography: {
|
|
862
|
+
fontFamily: get("--fc-font-family"),
|
|
863
|
+
// scale is an enum ("compact" | "comfortable" | "spacious") — not resolvable from CSS
|
|
864
|
+
questionSize: get("--fc-font-question"),
|
|
865
|
+
labelSize: get("--fc-font-label"),
|
|
866
|
+
helpTextSize: get("--fc-font-help"),
|
|
867
|
+
bodySize: get("--fc-font-body")
|
|
868
|
+
},
|
|
869
|
+
shape: {
|
|
870
|
+
// radius is an enum ("none" | "sm" | "md" | "lg" | "full") — not resolvable from CSS
|
|
871
|
+
inputRadius: get("--fc-radius-input"),
|
|
872
|
+
buttonRadius: get("--fc-radius-button"),
|
|
873
|
+
cardRadius: get("--fc-radius-card")
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
}
|
|
613
877
|
var ThemeCtx = createContext({});
|
|
614
878
|
function useEditorTheme() {
|
|
615
879
|
return useContext(ThemeCtx);
|
|
@@ -634,15 +898,15 @@ function ThemeEditorThemeProvider({ theme, children }) {
|
|
|
634
898
|
const cssVars = useMemo(() => themeToCssVars(resolved), [resolved]);
|
|
635
899
|
return /* @__PURE__ */ jsx(ThemeCtx.Provider, { value: resolved, children: /* @__PURE__ */ jsx("div", { "data-fcte-root": "", style: cssVars, className: "fcte-provider-root", children }) });
|
|
636
900
|
}
|
|
637
|
-
|
|
638
|
-
"
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
}
|
|
901
|
+
function isDarkTheme(theme) {
|
|
902
|
+
const bg = theme.colors?.background ?? "#FFFFFF";
|
|
903
|
+
const hex = bg.replace("#", "");
|
|
904
|
+
if (hex.length < 6) return false;
|
|
905
|
+
const r = parseInt(hex.slice(0, 2), 16);
|
|
906
|
+
const g = parseInt(hex.slice(2, 4), 16);
|
|
907
|
+
const b = parseInt(hex.slice(4, 6), 16);
|
|
908
|
+
return 0.299 * r + 0.587 * g + 0.114 * b < 128;
|
|
909
|
+
}
|
|
646
910
|
var SECTIONS = [
|
|
647
911
|
{
|
|
648
912
|
id: "colors",
|
|
@@ -772,9 +1036,17 @@ function ThemeEditorInner({
|
|
|
772
1036
|
toolbarExtra,
|
|
773
1037
|
showPreview = true
|
|
774
1038
|
}) {
|
|
775
|
-
const
|
|
1039
|
+
const resolvedInitial = useMemo(
|
|
1040
|
+
() => initialTheme ?? resolveThemeFromDOM(),
|
|
1041
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1042
|
+
[]
|
|
1043
|
+
);
|
|
1044
|
+
const [theme, setTheme] = useState(resolvedInitial);
|
|
776
1045
|
const [activeSection, setActiveSection] = useState("colors");
|
|
777
|
-
const [presetKey, setPresetKey] = useState(
|
|
1046
|
+
const [presetKey, setPresetKey] = useState("custom");
|
|
1047
|
+
const [mode, setMode] = useState(
|
|
1048
|
+
() => isDarkTheme(resolvedInitial) ? "dark" : "light"
|
|
1049
|
+
);
|
|
778
1050
|
const [showPalette, setShowPalette] = useState(false);
|
|
779
1051
|
const [showComparison, setShowComparison] = useState(false);
|
|
780
1052
|
const themeRef = useRef(theme);
|
|
@@ -804,16 +1076,30 @@ function ThemeEditorInner({
|
|
|
804
1076
|
[onChange]
|
|
805
1077
|
);
|
|
806
1078
|
const loadPreset = useCallback(
|
|
807
|
-
(key) => {
|
|
808
|
-
const
|
|
809
|
-
if (
|
|
1079
|
+
(key, forceMode) => {
|
|
1080
|
+
const family = PRESET_FAMILIES[key];
|
|
1081
|
+
if (family) {
|
|
1082
|
+
const m = forceMode ?? mode;
|
|
1083
|
+
const preset = family[m];
|
|
810
1084
|
setTheme(preset);
|
|
811
1085
|
setPresetKey(key);
|
|
812
1086
|
onChange?.(preset);
|
|
813
1087
|
}
|
|
814
1088
|
},
|
|
815
|
-
[onChange]
|
|
1089
|
+
[onChange, mode]
|
|
816
1090
|
);
|
|
1091
|
+
const toggleMode = useCallback(() => {
|
|
1092
|
+
setMode((prev) => {
|
|
1093
|
+
const next = prev === "light" ? "dark" : "light";
|
|
1094
|
+
const family = PRESET_FAMILIES[presetKey];
|
|
1095
|
+
if (family) {
|
|
1096
|
+
const preset = family[next];
|
|
1097
|
+
setTheme(preset);
|
|
1098
|
+
onChange?.(preset);
|
|
1099
|
+
}
|
|
1100
|
+
return next;
|
|
1101
|
+
});
|
|
1102
|
+
}, [presetKey, onChange]);
|
|
817
1103
|
const exportJson = useCallback(() => {
|
|
818
1104
|
const blob = new Blob([JSON.stringify(theme, null, 2)], { type: "application/json" });
|
|
819
1105
|
const url = URL.createObjectURL(blob);
|
|
@@ -879,9 +1165,18 @@ function ThemeEditorInner({
|
|
|
879
1165
|
className: "fcte-toolbar__preset",
|
|
880
1166
|
children: [
|
|
881
1167
|
/* @__PURE__ */ jsx("option", { value: "custom", disabled: true, children: "Custom" }),
|
|
882
|
-
Object.
|
|
1168
|
+
Object.entries(PRESET_FAMILIES).map(([k, fam]) => /* @__PURE__ */ jsx("option", { value: k, children: fam.label }, k))
|
|
883
1169
|
]
|
|
884
1170
|
}
|
|
1171
|
+
),
|
|
1172
|
+
/* @__PURE__ */ jsx(
|
|
1173
|
+
"button",
|
|
1174
|
+
{
|
|
1175
|
+
onClick: toggleMode,
|
|
1176
|
+
className: "fcte-btn fcte-btn--secondary fcte-toolbar__mode",
|
|
1177
|
+
title: mode === "light" ? "Switch to dark mode" : "Switch to light mode",
|
|
1178
|
+
children: mode === "light" ? "\u2600" : "\u263E"
|
|
1179
|
+
}
|
|
885
1180
|
)
|
|
886
1181
|
] }),
|
|
887
1182
|
/* @__PURE__ */ jsxs("div", { className: "fcte-toolbar__right", children: [
|
|
@@ -1078,4 +1373,4 @@ var themeEditorDarkPreset = {
|
|
|
1078
1373
|
accentForeground: "#0F1A1F"
|
|
1079
1374
|
};
|
|
1080
1375
|
|
|
1081
|
-
export { PREVIEW_SCHEMA, ThemeEditor, ThemeEditorInner, ThemeEditorThemeProvider,
|
|
1376
|
+
export { PRESET_FAMILIES, PREVIEW_SCHEMA, ThemeEditor, ThemeEditorInner, ThemeEditorThemeProvider, resolveThemeFromDOM, themeEditorDarkPreset, themeEditorLightPreset, useEditorTheme };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BuilderState, a as BuilderStateHook, D as DEFAULT_PALETTE, b as DEFAULT_SCHEMA, c as DragItem, d as DropTarget, F as FormBuilder, f as FormBuilderProps, h as FormBuilderTheme, i as FormBuilderThemeProvider, M as MutationAction, P as PaletteCategory, j as PropertyPanelTab, Q as QUESTION_TYPE_INFO, k as QuestionTypeCategory, l as QuestionTypeInfo, S as SelectedItem, U as UndoRedoState, m as addOption, n as addQuestion, o as addSection, p as
|
|
1
|
+
export { B as BuilderState, a as BuilderStateHook, D as DEFAULT_PALETTE, b as DEFAULT_SCHEMA, c as DragItem, d as DropTarget, F as FormBuilder, f as FormBuilderProps, h as FormBuilderTheme, i as FormBuilderThemeProvider, M as MutationAction, P as PaletteCategory, j as PropertyPanelTab, Q as QUESTION_TYPE_INFO, k as QuestionTypeCategory, l as QuestionTypeInfo, S as SelectedItem, U as UndoRedoState, m as addOption, n as addQuestion, o as addSection, p as cn, q as duplicateQuestion, r as duplicateSection, s as findQuestion, t as findSection, u as generateId, v as generateOptionId, w as generateQuestionId, x as generateSectionId, y as moveOption, z as moveQuestion, A as moveSection, C as removeOption, E as removeQuestion, G as removeSection, H as updateOption, I as updateQuestion, J as updateSection, K as useBuilderState, L as useBuilderTheme, N as useDragDrop, O as useUndoRedo } from '../index-D19524df.mjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '@squaredr/fieldcraft-core';
|
|
4
4
|
import '@squaredr/fieldcraft-react';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BuilderState, a as BuilderStateHook, D as DEFAULT_PALETTE, b as DEFAULT_SCHEMA, c as DragItem, d as DropTarget, F as FormBuilder, f as FormBuilderProps, h as FormBuilderTheme, i as FormBuilderThemeProvider, M as MutationAction, P as PaletteCategory, j as PropertyPanelTab, Q as QUESTION_TYPE_INFO, k as QuestionTypeCategory, l as QuestionTypeInfo, S as SelectedItem, U as UndoRedoState, m as addOption, n as addQuestion, o as addSection, p as
|
|
1
|
+
export { B as BuilderState, a as BuilderStateHook, D as DEFAULT_PALETTE, b as DEFAULT_SCHEMA, c as DragItem, d as DropTarget, F as FormBuilder, f as FormBuilderProps, h as FormBuilderTheme, i as FormBuilderThemeProvider, M as MutationAction, P as PaletteCategory, j as PropertyPanelTab, Q as QUESTION_TYPE_INFO, k as QuestionTypeCategory, l as QuestionTypeInfo, S as SelectedItem, U as UndoRedoState, m as addOption, n as addQuestion, o as addSection, p as cn, q as duplicateQuestion, r as duplicateSection, s as findQuestion, t as findSection, u as generateId, v as generateOptionId, w as generateQuestionId, x as generateSectionId, y as moveOption, z as moveQuestion, A as moveSection, C as removeOption, E as removeQuestion, G as removeSection, H as updateOption, I as updateQuestion, J as updateSection, K as useBuilderState, L as useBuilderTheme, N as useDragDrop, O as useUndoRedo } from '../index-D19524df.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '@squaredr/fieldcraft-core';
|
|
4
4
|
import '@squaredr/fieldcraft-react';
|