@case-framework/survey-ui 0.2.3 → 0.2.4

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/README.md CHANGED
@@ -1,73 +1,51 @@
1
- # React + TypeScript + Vite
1
+ # @case-framework/survey-ui
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ React UI components for CASE surveys, including the `SurveyEditor`.
4
4
 
5
- Currently, two official plugins are available:
5
+ ## SurveyEditor styling in a host project
6
6
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
7
+ Import the package stylesheet once in your app entry point:
9
8
 
10
- ## React Compiler
11
-
12
- The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
9
+ ```tsx
10
+ import "@case-framework/survey-ui/css";
11
+ ```
13
12
 
14
- ## Expanding the ESLint configuration
13
+ If you only want the editor's default variable values as a tiny standalone asset, import:
15
14
 
16
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
15
+ ```tsx
16
+ import "@case-framework/survey-ui/editor-defaults.css";
17
+ ```
17
18
 
18
- ```js
19
- export default defineConfig([
20
- globalIgnores(['dist']),
21
- {
22
- files: ['**/*.{ts,tsx}'],
23
- extends: [
24
- // Other configs...
19
+ `@case-framework/survey-ui/css` already includes these defaults, so the standalone file is only needed when the host wants a separate variables-only layer.
25
20
 
26
- // Remove tseslint.configs.recommended and replace with this
27
- tseslint.configs.recommendedTypeChecked,
28
- // Alternatively, use this for stricter rules
29
- tseslint.configs.strictTypeChecked,
30
- // Optionally, add this for stylistic rules
31
- tseslint.configs.stylisticTypeChecked,
21
+ If the host app uses Tailwind CSS v4, add the package as a source in the host global CSS file so Tailwind also scans the editor package:
32
22
 
33
- // Other configs...
34
- ],
35
- languageOptions: {
36
- parserOptions: {
37
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
- tsconfigRootDir: import.meta.dirname,
39
- },
40
- // other options...
41
- },
42
- },
43
- ])
23
+ ```css
24
+ @import "tailwindcss";
25
+ @source "../node_modules/@case-framework/survey-ui/dist";
44
26
  ```
45
27
 
46
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
28
+ Override the editor-specific CSS variables on the `.survey-editor` scope in the host stylesheet:
47
29
 
48
- ```js
49
- // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
30
+ ```css
31
+ .survey-editor {
32
+ --main-bg-color: oklch(98.5% 0 0);
33
+ --main-bg-dot-color: oklch(85% 0 0);
34
+ --main-bg-dot-grid-size: calc(var(--spacing, 0.25rem) * 5);
52
35
 
53
- export default defineConfig([
54
- globalIgnores(['dist']),
55
- {
56
- files: ['**/*.{ts,tsx}'],
57
- extends: [
58
- // Other configs...
59
- // Enable lint rules for React
60
- reactX.configs['recommended-typescript'],
61
- // Enable lint rules for React DOM
62
- reactDom.configs.recommended,
63
- ],
64
- languageOptions: {
65
- parserOptions: {
66
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
- tsconfigRootDir: import.meta.dirname,
68
- },
69
- // other options...
70
- },
71
- },
72
- ])
36
+ --footer-bg-color: oklch(37.3% 0.034 259.733);
37
+ --footer-text-color: oklch(98.5% 0 0);
38
+ --footer-height: calc(var(--spacing, 0.25rem) * 6);
39
+ }
73
40
  ```
41
+
42
+ Available editor-scoped variables:
43
+
44
+ - `--main-bg-color`
45
+ - `--main-bg-dot-color`
46
+ - `--main-bg-dot-grid-size`
47
+ - `--footer-bg-color`
48
+ - `--footer-text-color`
49
+ - `--footer-height`
50
+
51
+ The editor also uses the shared UI theme tokens from the package stylesheet, so you can override variables such as `--background`, `--foreground`, `--card`, `--primary`, `--muted`, `--accent`, `--border`, `--input`, and `--ring` if you want the rest of the editor chrome to match your host theme.
@@ -0,0 +1,9 @@
1
+ .survey-editor {
2
+ --main-bg-color: oklch(98.5% 0 0);
3
+ --main-bg-dot-color: oklch(85% 0 0);
4
+ --main-bg-dot-grid-size: calc(var(--spacing, 0.25rem) * 5);
5
+
6
+ --footer-bg-color: oklch(37.3% 0.034 259.733);
7
+ --footer-text-color: oklch(98.5% 0 0);
8
+ --footer-height: calc(var(--spacing, 0.25rem) * 6);
9
+ }