@welshare/questionnaire 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 (109) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +173 -0
  3. package/dist/esm/components/debug-section.d.ts +44 -0
  4. package/dist/esm/components/debug-section.d.ts.map +1 -0
  5. package/dist/esm/components/debug-section.js +28 -0
  6. package/dist/esm/components/question-renderer.d.ts +80 -0
  7. package/dist/esm/components/question-renderer.d.ts.map +1 -0
  8. package/dist/esm/components/question-renderer.js +159 -0
  9. package/dist/esm/components/questions/boolean-question.d.ts +15 -0
  10. package/dist/esm/components/questions/boolean-question.d.ts.map +1 -0
  11. package/dist/esm/components/questions/boolean-question.js +19 -0
  12. package/dist/esm/components/questions/choice-question.d.ts +19 -0
  13. package/dist/esm/components/questions/choice-question.d.ts.map +1 -0
  14. package/dist/esm/components/questions/choice-question.js +23 -0
  15. package/dist/esm/components/questions/decimal-question.d.ts +12 -0
  16. package/dist/esm/components/questions/decimal-question.d.ts.map +1 -0
  17. package/dist/esm/components/questions/decimal-question.js +7 -0
  18. package/dist/esm/components/questions/integer-question.d.ts +18 -0
  19. package/dist/esm/components/questions/integer-question.d.ts.map +1 -0
  20. package/dist/esm/components/questions/integer-question.js +24 -0
  21. package/dist/esm/components/questions/multiple-choice-question.d.ts +20 -0
  22. package/dist/esm/components/questions/multiple-choice-question.d.ts.map +1 -0
  23. package/dist/esm/components/questions/multiple-choice-question.js +39 -0
  24. package/dist/esm/components/questions/string-question.d.ts +12 -0
  25. package/dist/esm/components/questions/string-question.d.ts.map +1 -0
  26. package/dist/esm/components/questions/string-question.js +7 -0
  27. package/dist/esm/contexts/questionnaire-context.d.ts +41 -0
  28. package/dist/esm/contexts/questionnaire-context.d.ts.map +1 -0
  29. package/dist/esm/contexts/questionnaire-context.js +350 -0
  30. package/dist/esm/index.d.ts +7 -0
  31. package/dist/esm/index.d.ts.map +1 -0
  32. package/dist/esm/index.js +6 -0
  33. package/dist/esm/lib/questionnaire-utils.d.ts +29 -0
  34. package/dist/esm/lib/questionnaire-utils.d.ts.map +1 -0
  35. package/dist/esm/lib/questionnaire-utils.js +80 -0
  36. package/dist/esm/package.json +3 -0
  37. package/dist/esm/types/fhir.d.ts +117 -0
  38. package/dist/esm/types/fhir.d.ts.map +1 -0
  39. package/dist/esm/types/fhir.js +3 -0
  40. package/dist/esm/types/index.d.ts +51 -0
  41. package/dist/esm/types/index.d.ts.map +1 -0
  42. package/dist/esm/types/index.js +1 -0
  43. package/dist/node_modules/@welshare/questionnaire/.tshy/build.json +8 -0
  44. package/dist/node_modules/@welshare/questionnaire/.tshy/esm.json +16 -0
  45. package/dist/node_modules/@welshare/questionnaire/LICENSE +7 -0
  46. package/dist/node_modules/@welshare/questionnaire/README.md +173 -0
  47. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/debug-section.d.ts +44 -0
  48. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/debug-section.d.ts.map +1 -0
  49. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/debug-section.js +28 -0
  50. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/question-renderer.d.ts +80 -0
  51. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/question-renderer.d.ts.map +1 -0
  52. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/question-renderer.js +159 -0
  53. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/boolean-question.d.ts +15 -0
  54. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/boolean-question.d.ts.map +1 -0
  55. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/boolean-question.js +19 -0
  56. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/choice-question.d.ts +19 -0
  57. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/choice-question.d.ts.map +1 -0
  58. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/choice-question.js +23 -0
  59. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/decimal-question.d.ts +12 -0
  60. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/decimal-question.d.ts.map +1 -0
  61. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/decimal-question.js +7 -0
  62. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/integer-question.d.ts +18 -0
  63. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/integer-question.d.ts.map +1 -0
  64. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/integer-question.js +24 -0
  65. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/multiple-choice-question.d.ts +20 -0
  66. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/multiple-choice-question.d.ts.map +1 -0
  67. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/multiple-choice-question.js +39 -0
  68. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/string-question.d.ts +12 -0
  69. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/string-question.d.ts.map +1 -0
  70. package/dist/node_modules/@welshare/questionnaire/dist/esm/components/questions/string-question.js +7 -0
  71. package/dist/node_modules/@welshare/questionnaire/dist/esm/contexts/questionnaire-context.d.ts +41 -0
  72. package/dist/node_modules/@welshare/questionnaire/dist/esm/contexts/questionnaire-context.d.ts.map +1 -0
  73. package/dist/node_modules/@welshare/questionnaire/dist/esm/contexts/questionnaire-context.js +350 -0
  74. package/dist/node_modules/@welshare/questionnaire/dist/esm/index.d.ts +7 -0
  75. package/dist/node_modules/@welshare/questionnaire/dist/esm/index.d.ts.map +1 -0
  76. package/dist/node_modules/@welshare/questionnaire/dist/esm/index.js +6 -0
  77. package/dist/node_modules/@welshare/questionnaire/dist/esm/lib/questionnaire-utils.d.ts +29 -0
  78. package/dist/node_modules/@welshare/questionnaire/dist/esm/lib/questionnaire-utils.d.ts.map +1 -0
  79. package/dist/node_modules/@welshare/questionnaire/dist/esm/lib/questionnaire-utils.js +80 -0
  80. package/dist/node_modules/@welshare/questionnaire/dist/esm/package.json +3 -0
  81. package/dist/node_modules/@welshare/questionnaire/dist/esm/types/fhir.d.ts +117 -0
  82. package/dist/node_modules/@welshare/questionnaire/dist/esm/types/fhir.d.ts.map +1 -0
  83. package/dist/node_modules/@welshare/questionnaire/dist/esm/types/fhir.js +3 -0
  84. package/dist/node_modules/@welshare/questionnaire/dist/esm/types/index.d.ts +51 -0
  85. package/dist/node_modules/@welshare/questionnaire/dist/esm/types/index.d.ts.map +1 -0
  86. package/dist/node_modules/@welshare/questionnaire/dist/esm/types/index.js +1 -0
  87. package/dist/node_modules/@welshare/questionnaire/dist/styles.css +467 -0
  88. package/dist/node_modules/@welshare/questionnaire/dist/tokens.css +130 -0
  89. package/dist/node_modules/@welshare/questionnaire/package.json +85 -0
  90. package/dist/node_modules/@welshare/questionnaire/src/components/debug-section.tsx +116 -0
  91. package/dist/node_modules/@welshare/questionnaire/src/components/question-renderer.tsx +368 -0
  92. package/dist/node_modules/@welshare/questionnaire/src/components/questionnaire-styles.css +467 -0
  93. package/dist/node_modules/@welshare/questionnaire/src/components/questionnaire-tokens.css +130 -0
  94. package/dist/node_modules/@welshare/questionnaire/src/components/questions/boolean-question.tsx +72 -0
  95. package/dist/node_modules/@welshare/questionnaire/src/components/questions/choice-question.tsx +68 -0
  96. package/dist/node_modules/@welshare/questionnaire/src/components/questions/decimal-question.tsx +32 -0
  97. package/dist/node_modules/@welshare/questionnaire/src/components/questions/integer-question.tsx +87 -0
  98. package/dist/node_modules/@welshare/questionnaire/src/components/questions/multiple-choice-question.tsx +119 -0
  99. package/dist/node_modules/@welshare/questionnaire/src/components/questions/string-question.tsx +31 -0
  100. package/dist/node_modules/@welshare/questionnaire/src/contexts/questionnaire-context.tsx +499 -0
  101. package/dist/node_modules/@welshare/questionnaire/src/index.ts +40 -0
  102. package/dist/node_modules/@welshare/questionnaire/src/lib/__tests__/questionnaire-utils.test.ts +578 -0
  103. package/dist/node_modules/@welshare/questionnaire/src/lib/questionnaire-utils.ts +99 -0
  104. package/dist/node_modules/@welshare/questionnaire/src/types/fhir.ts +126 -0
  105. package/dist/node_modules/@welshare/questionnaire/src/types/index.ts +44 -0
  106. package/dist/node_modules/@welshare/questionnaire/tsconfig.json +16 -0
  107. package/dist/styles.css +467 -0
  108. package/dist/tokens.css +130 -0
  109. package/package.json +84 -0
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Welshare Questionnaire Design Tokens
3
+ *
4
+ * These CSS custom properties can be overridden to customize the questionnaire appearance.
5
+ * Compatible with design token frameworks and theme systems.
6
+ */
7
+
8
+ :root {
9
+ /* === Spacing === */
10
+ --wq-space-xs: 0.25rem;
11
+ --wq-space-sm: 0.5rem;
12
+ --wq-space-md: 0.75rem;
13
+ --wq-space-lg: 1rem;
14
+ --wq-space-xl: 1.5rem;
15
+ --wq-space-2xl: 2rem;
16
+
17
+ /* === Font Sizes === */
18
+ --wq-font-size-sm: 0.875rem;
19
+ --wq-font-size-base: 1rem;
20
+ --wq-font-size-lg: 1.125rem;
21
+ --wq-font-size-xl: 1.5rem;
22
+
23
+ /* === Font Weights === */
24
+ --wq-font-weight-normal: 400;
25
+ --wq-font-weight-medium: 500;
26
+ --wq-font-weight-semibold: 600;
27
+ --wq-font-weight-bold: 700;
28
+
29
+ /* === Border Radius === */
30
+ --wq-radius-sm: 0.25rem;
31
+ --wq-radius-md: 0.5rem;
32
+ --wq-radius-lg: 0.75rem;
33
+ --wq-radius-full: 9999px;
34
+
35
+ /* === Border Widths === */
36
+ --wq-border-width: 2px;
37
+
38
+ /* === Transitions === */
39
+ --wq-transition-fast: 150ms ease;
40
+ --wq-transition-base: 200ms ease;
41
+ --wq-transition-slow: 300ms ease;
42
+
43
+ /* === Colors - Neutral === */
44
+ --wq-color-gray-50: #f9fafb;
45
+ --wq-color-gray-100: #f3f4f6;
46
+ --wq-color-gray-200: #e5e7eb;
47
+ --wq-color-gray-300: #d1d5db;
48
+ --wq-color-gray-400: #9ca3af;
49
+ --wq-color-gray-500: #6b7280;
50
+ --wq-color-gray-600: #4b5563;
51
+ --wq-color-gray-700: #374151;
52
+ --wq-color-gray-800: #1f2937;
53
+ --wq-color-gray-900: #111827;
54
+
55
+ /* === Colors - Primary === */
56
+ --wq-color-primary-50: #eff6ff;
57
+ --wq-color-primary-100: #dbeafe;
58
+ --wq-color-primary-200: #bfdbfe;
59
+ --wq-color-primary-500: #3b82f6;
60
+ --wq-color-primary-600: #2563eb;
61
+ --wq-color-primary-700: #1d4ed8;
62
+
63
+ /* === Colors - Error === */
64
+ --wq-color-error-50: #fef2f2;
65
+ --wq-color-error-500: #ef4444;
66
+ --wq-color-error-600: #dc2626;
67
+
68
+ /* === Colors - Warning === */
69
+ --wq-color-warning-50: #fef3c7;
70
+ --wq-color-warning-500: #f59e0b;
71
+ --wq-color-warning-800: #92400e;
72
+
73
+ /* === Semantic Colors === */
74
+ --wq-color-background: var(--wq-color-gray-50);
75
+ --wq-color-surface: #ffffff;
76
+ --wq-color-border: var(--wq-color-gray-200);
77
+ --wq-color-border-hover: var(--wq-color-gray-400);
78
+ --wq-color-border-focus: var(--wq-color-primary-500);
79
+
80
+ --wq-color-text-primary: var(--wq-color-gray-900);
81
+ --wq-color-text-secondary: var(--wq-color-gray-700);
82
+ --wq-color-text-tertiary: var(--wq-color-gray-500);
83
+ --wq-color-text-disabled: var(--wq-color-gray-400);
84
+ --wq-color-text-placeholder: var(--wq-color-gray-400);
85
+
86
+ --wq-color-primary: var(--wq-color-primary-500);
87
+ --wq-color-primary-hover: var(--wq-color-primary-600);
88
+ --wq-color-primary-focus: var(--wq-color-primary-50);
89
+
90
+ --wq-color-error: var(--wq-color-error-500);
91
+ --wq-color-error-bg: var(--wq-color-error-50);
92
+ --wq-color-error-border: var(--wq-color-error-500);
93
+
94
+ --wq-color-selected: var(--wq-color-primary-50);
95
+ --wq-color-selected-border: var(--wq-color-primary-500);
96
+
97
+ /* === Shadows === */
98
+ --wq-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
99
+ --wq-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
100
+ --wq-shadow-focus: 0 0 0 3px var(--wq-color-primary-focus);
101
+
102
+ /* === Component Specific === */
103
+ --wq-input-height: 2.5rem;
104
+ --wq-input-padding-x: var(--wq-space-lg);
105
+ --wq-input-padding-y: var(--wq-space-md);
106
+
107
+ --wq-choice-padding-x: var(--wq-space-lg);
108
+ --wq-choice-padding-y: var(--wq-space-md);
109
+
110
+ --wq-question-gap: var(--wq-space-xl);
111
+
112
+ --wq-slider-height: 0.5rem;
113
+ --wq-slider-thumb-size: 1.5rem;
114
+
115
+ --wq-progress-height: 0.5rem;
116
+ }
117
+
118
+ /* Dark mode support (optional) */
119
+ @media (prefers-color-scheme: dark) {
120
+ :root {
121
+ --wq-color-background: var(--wq-color-gray-900);
122
+ --wq-color-surface: var(--wq-color-gray-800);
123
+ --wq-color-border: var(--wq-color-gray-700);
124
+ --wq-color-border-hover: var(--wq-color-gray-600);
125
+
126
+ --wq-color-text-primary: var(--wq-color-gray-100);
127
+ --wq-color-text-secondary: var(--wq-color-gray-300);
128
+ --wq-color-text-tertiary: var(--wq-color-gray-400);
129
+ }
130
+ }
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "@welshare/questionnaire",
3
+ "version": "0.1.0",
4
+ "description": "FHIR Questionnaire components for React with state management and validation",
5
+ "keywords": [
6
+ "react",
7
+ "fhir",
8
+ "questionnaire",
9
+ "survey",
10
+ "forms",
11
+ "healthcare"
12
+ ],
13
+ "author": "Welshare UG (haftungsbeschränkt)",
14
+ "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/welshare/surveys-monorepo.git",
18
+ "directory": "packages/welshare-questionnaire"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/welshare/surveys-monorepo/issues"
22
+ },
23
+ "homepage": "https://welshare.health",
24
+ "type": "module",
25
+ "peerDependencies": {
26
+ "react": "^19",
27
+ "react-dom": "^19"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^22",
31
+ "@types/react": "^19",
32
+ "tshy": "^3.0.2",
33
+ "typescript": "^5.7.3",
34
+ "vitest": "^3.2.4",
35
+ "@vitest/ui": "^3.2.4",
36
+ "@vitest/coverage-v8": "^3.2.4",
37
+ "jsdom": "^26.1.0",
38
+ "@workspace/typescript-config": "0.0.0",
39
+ "@workspace/eslint-config": "0.0.0"
40
+ },
41
+ "tshy": {
42
+ "dialects": [
43
+ "esm"
44
+ ],
45
+ "exclude": [
46
+ "src/**/__tests__/**"
47
+ ],
48
+ "exports": {
49
+ "./package.json": "./package.json",
50
+ "./tokens.css": "./dist/tokens.css",
51
+ "./styles.css": "./dist/styles.css",
52
+ ".": "./src/index.ts"
53
+ }
54
+ },
55
+ "module": "./dist/esm/index.js",
56
+ "exports": {
57
+ "./package.json": "./package.json",
58
+ "./tokens.css": "./dist/tokens.css",
59
+ "./styles.css": "./dist/styles.css",
60
+ ".": {
61
+ "import": {
62
+ "types": "./dist/esm/index.d.ts",
63
+ "default": "./dist/esm/index.js"
64
+ }
65
+ }
66
+ },
67
+ "files": [
68
+ "dist/**/*",
69
+ "README.md",
70
+ "LICENSE"
71
+ ],
72
+ "engines": {
73
+ "node": "^22.0.0"
74
+ },
75
+ "scripts": {
76
+ "lint": "eslint . --max-warnings 25",
77
+ "build": "tshy && npm run build:css",
78
+ "build:css": "cp src/components/questionnaire-tokens.css dist/tokens.css && cp src/components/questionnaire-styles.css dist/styles.css",
79
+ "build:clean": "rm -rf ./dist",
80
+ "test": "vitest",
81
+ "test:run": "vitest run",
82
+ "test:coverage": "vitest run --coverage"
83
+ }
84
+ }