sodas-validation-ui 0.2.0 → 0.3.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.
package/README.md CHANGED
@@ -1,4 +1,86 @@
1
- # React + Vite
1
+ # sodas-validation-ui
2
+
3
+ React components for SODAS validation rules editing.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install sodas-validation-ui bootstrap react-bootstrap
9
+ ```
10
+
11
+ **Peer dependencies:** This library requires Bootstrap 5 and react-bootstrap. Ensure your app imports Bootstrap CSS:
12
+
13
+ ```jsx
14
+ // main.jsx or App.jsx
15
+ import 'bootstrap/dist/css/bootstrap.min.css';
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```jsx
21
+ import { ValidationRulesEditor } from 'sodas-validation-ui';
22
+ import 'sodas-validation-ui/style.css';
23
+
24
+ function App() {
25
+ const [rules, setRules] = useState([]);
26
+ return <ValidationRulesEditor validationRules={rules} />;
27
+ }
28
+ ```
29
+
30
+ ## Customization with CSS Variables
31
+
32
+ You can customize the appearance by setting CSS custom properties. Define these on `:root` for global theming, or on a wrapper element for scoped styling.
33
+
34
+ ```css
35
+ :root {
36
+ /* Typography */
37
+ --sodas-validation-ui-font-family: system-ui, -apple-system, sans-serif;
38
+ --sodas-validation-ui-font-size: 14px;
39
+ --sodas-validation-ui-font-size-sm: 12px;
40
+ --sodas-validation-ui-font-size-xs: 13px;
41
+
42
+ /* Colors */
43
+ --sodas-validation-ui-text-color: #333;
44
+ --sodas-validation-ui-text-muted: #666;
45
+ --sodas-validation-ui-text-emphasis: #444;
46
+ --sodas-validation-ui-error-color: #c00;
47
+ --sodas-validation-ui-border-color: #ccc;
48
+ --sodas-validation-ui-border-color-light: #e0e0e0;
49
+ --sodas-validation-ui-bg-color: #fff;
50
+ --sodas-validation-ui-bg-secondary: #f9f9f9;
51
+ --sodas-validation-ui-bg-hover: #f0f0f0;
52
+
53
+ /* Borders */
54
+ --sodas-validation-ui-border-radius: 4px;
55
+ --sodas-validation-ui-border-radius-lg: 8px;
56
+ }
57
+ ```
58
+
59
+ ### Dark mode example
60
+
61
+ ```css
62
+ .my-theme-dark {
63
+ --sodas-validation-ui-text-color: #e0e0e0;
64
+ --sodas-validation-ui-text-muted: #a0a0a0;
65
+ --sodas-validation-ui-text-emphasis: #f0f0f0;
66
+ --sodas-validation-ui-error-color: #ff6b6b;
67
+ --sodas-validation-ui-border-color: #444;
68
+ --sodas-validation-ui-border-color-light: #333;
69
+ --sodas-validation-ui-bg-color: #2a2a2a;
70
+ --sodas-validation-ui-bg-secondary: #222;
71
+ --sodas-validation-ui-bg-hover: #333;
72
+ }
73
+
74
+ <div className="my-theme-dark">
75
+ <ValidationRulesEditor ... />
76
+ </div>
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Development
82
+
83
+ ### React + Vite
2
84
 
3
85
  This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
86
 
@@ -7,10 +89,10 @@ Currently, two official plugins are available:
7
89
  - [@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
90
  - [@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
9
91
 
10
- ## React Compiler
92
+ ### React Compiler
11
93
 
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).
94
+ The React Compiler is not enabled in this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13
95
 
14
- ## Expanding the ESLint configuration
96
+ ### Expanding the ESLint configuration
15
97
 
16
- If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
98
+ For production applications, we recommend TypeScript with type-aware lint rules. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) and [`typescript-eslint`](https://typescript-eslint.io).
@@ -1 +1 @@
1
- .validation-rules-editor{font-family:system-ui,-apple-system,sans-serif;font-size:14px;color:#333}.validation-rules-editor--empty{padding:1rem;color:#c00}.validation-rules-editor__toolbar{display:flex;align-items:center;gap:.5rem;margin-bottom:1rem}.validation-rules-editor__add-label{font-weight:600}.validation-rules-editor__add-select{padding:.35rem .5rem;border:1px solid #ccc;border-radius:4px;min-width:180px}.validation-rules-editor__append-btn{padding:.35rem .75rem;font-size:14px;border:1px solid #ccc;border-radius:4px;background:#fff;cursor:pointer}.validation-rules-editor__append-btn:hover:not(:disabled){background:#f0f0f0}.validation-rules-editor__append-btn:disabled{opacity:.6;cursor:not-allowed}.validation-rules-editor__sections{display:flex;flex-direction:column;gap:1.5rem}.validation-rules-editor__section{border:1px solid #e5e5e5;border-radius:8px;padding:1rem;background:#f9f9f9}.validation-rules-editor__section-title{margin:0 0 .75rem;font-size:1rem;font-weight:600;color:#444;padding-bottom:.5rem;border-bottom:1px solid #e0e0e0}.validation-rules-editor__section--column .validation-rules-editor__section-title{margin:0;padding-bottom:0;border-bottom:none;cursor:pointer;border-radius:4px;padding:.25rem .5rem}.validation-rules-editor__section--column .validation-rules-editor__section-title:hover{background:#eee}.validation-rules-editor__section-header{display:flex;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem;flex-wrap:wrap}.validation-rules-editor__section-title-input{flex:1;min-width:120px;padding:.35rem .5rem;border:1px solid #ccc;border-radius:4px;font-size:1rem;font-weight:600}.validation-rules-editor__section-remove{padding:.25rem .5rem;font-size:12px;border:1px solid #ccc;border-radius:4px;background:#fff;cursor:pointer}.validation-rules-editor__section-remove:hover{background:#f0f0f0}.validation-rules-editor__toolbar--inline{margin-bottom:.75rem}.validation-rules-editor__list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:1rem}.validation-rules-editor__rule{margin:0}.validation-rules-editor__rule-card{border:1px solid #ddd;border-radius:8px;padding:1rem;background:#fafafa}.validation-rules-editor__rule-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:.75rem}.validation-rules-editor__rule-type{font-weight:600;color:#555}.validation-rules-editor__rule-remove{padding:.25rem .5rem;font-size:12px;border:1px solid #ccc;border-radius:4px;background:#fff;cursor:pointer}.validation-rules-editor__rule-remove:hover{background:#f0f0f0}.validation-rules-editor__fields,.validation-rules-editor__type-fields{display:flex;flex-wrap:wrap;gap:.75rem 1.5rem}.validation-rules-editor__field{display:flex;flex-direction:column;gap:.2rem;min-width:120px}.validation-rules-editor__field--checkbox{flex-direction:row;align-items:center;min-width:auto}.validation-rules-editor__field-label{font-size:12px;color:#666}.validation-rules-editor__field-input{padding:.35rem .5rem;border:1px solid #ccc;border-radius:4px;font-size:14px}.validation-rules-editor__field--checkbox .validation-rules-editor__field-input{width:auto;margin-right:.35rem}.validation-rules-editor__empty{margin:.5rem 0 0;color:#666;font-size:13px}.template-editor{font-family:system-ui,-apple-system,sans-serif;font-size:14px;color:#333}.template-editor--empty{padding:1rem;color:#c00}.template-editor__meta{display:flex;flex-direction:column;gap:1rem;margin-bottom:1.5rem}.template-editor__field{display:flex;flex-direction:column;gap:.35rem}.template-editor__field-label{font-size:12px;font-weight:600;color:#555}.template-editor__field-input{padding:.5rem .6rem;border:1px solid #ccc;border-radius:4px;font-size:14px}.template-editor__field-input--textarea{min-height:4rem;resize:vertical}.template-editor__rules{border-top:1px solid #e0e0e0;padding-top:1.5rem}.template-editor__rules-title{margin:0 0 1rem;font-size:1rem;font-weight:600;color:#333}.quality-requirement-editor{font-family:system-ui,-apple-system,sans-serif;font-size:14px;color:#333}.quality-requirement-editor--empty{padding:1rem;color:#c00}.quality-requirement-editor__meta{margin-bottom:1.5rem}.quality-requirement-editor__field{display:flex;flex-direction:column;gap:.35rem}.quality-requirement-editor__field-label{font-size:12px;font-weight:600;color:#555}.quality-requirement-editor__field-input{padding:.5rem .6rem;border:1px solid #ccc;border-radius:4px;font-size:14px}.quality-requirement-editor__nodes{border-top:1px solid #e0e0e0;padding-top:1.5rem}.quality-requirement-editor__nodes-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}.quality-requirement-editor__nodes-title{margin:0;font-size:1rem;font-weight:600;color:#333}.quality-requirement-editor__add-node-btn{padding:.35rem .75rem;font-size:14px;border:1px solid #ccc;border-radius:4px;background:#fff;cursor:pointer}.quality-requirement-editor__add-node-btn:hover{background:#f0f0f0}.quality-requirement-editor__empty-nodes{margin:0 0 1rem;color:#666;font-size:13px}.quality-requirement-editor__list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:1.25rem}.quality-requirement-editor__node{margin:0}.quality-requirement-editor__node-card{border:1px solid #ddd;border-radius:8px;padding:1rem;background:#fafafa}.quality-requirement-editor__node-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:.75rem}.quality-requirement-editor__node-index{font-weight:600;color:#555}.quality-requirement-editor__node-remove{padding:.25rem .5rem;font-size:12px;border:1px solid #ccc;border-radius:4px;background:#fff;cursor:pointer}.quality-requirement-editor__node-remove:hover{background:#f0f0f0}.quality-requirement-editor__node-fields{display:flex;flex-wrap:wrap;gap:1rem 1.5rem;margin-bottom:1rem}.quality-requirement-editor__node-fields .quality-requirement-editor__field{min-width:160px}.quality-requirement-editor__node-rules{border-top:1px solid #e8e8e8;padding-top:1rem}.quality-requirement-editor__node-rules-title{margin:0 0 .75rem;font-size:13px;font-weight:600;color:#555}
1
+ .sodas-validation-ui__panel{min-height:0}.sodas-validation-ui__panel[hidden]{display:none}.sodas-validation-ui__toolbar{display:flex;align-items:center;gap:.5rem}.sodas-validation-ui__add-select{min-width:180px}.sodas-validation-ui__sections,.sodas-validation-ui__list{display:flex;flex-direction:column;gap:1rem}.sodas-validation-ui__rule-card{--sodas-validation-ui-font-family: var(--sodas-validation-ui-font-family, inherit);--sodas-validation-ui-font-size: var(--sodas-validation-ui-font-size, inherit)}.sodas-validation-ui__rule-fields-row{overflow-x:auto;padding-bottom:.25rem}.sodas-validation-ui__field{min-width:100px;flex-shrink:0}.sodas-validation-ui__field--checkbox{min-width:auto}.sodas-validation-ui__section-title-editable:hover{background:var(--sodas-validation-ui-bg-hover, rgba(0, 0, 0, .04))}.template-editor__rules,.quality-requirement-editor__nodes,.quality-requirement-editor__node-rules{border-top-color:var(--sodas-validation-ui-border-color-light, #dee2e6)}