@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 +37 -59
- package/dist/survey-editor-defaults.css +9 -0
- package/dist/survey-ui.cjs.js +24 -24
- package/dist/survey-ui.cjs.js.map +1 -1
- package/dist/survey-ui.css +1 -1
- package/dist/survey-ui.es.js +1679 -1644
- package/dist/survey-ui.es.js.map +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -1,73 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @case-framework/survey-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React UI components for CASE surveys, including the `SurveyEditor`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## SurveyEditor styling in a host project
|
|
6
6
|
|
|
7
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
```tsx
|
|
10
|
+
import "@case-framework/survey-ui/css";
|
|
11
|
+
```
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
If you only want the editor's default variable values as a tiny standalone asset, import:
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
```tsx
|
|
16
|
+
import "@case-framework/survey-ui/editor-defaults.css";
|
|
17
|
+
```
|
|
17
18
|
|
|
18
|
-
|
|
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
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
28
|
+
Override the editor-specific CSS variables on the `.survey-editor` scope in the host stylesheet:
|
|
47
29
|
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
+
}
|