@nucleux/questionnaire 0.0.0-stage → 0.7.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/LICENSE +21 -0
- package/README.md +68 -2
- package/dist/index.cjs +863 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +203 -0
- package/dist/index.d.ts +203 -0
- package/dist/index.js +827 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nucleux
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,69 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nucleux/questionnaire
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Multi-step questionnaire with single, multiple, freeform and skippable answers — Nucleux agentic UI for React.
|
|
4
|
+
|
|
5
|
+
Part of **[Nucleux](https://github.com/intelligaia-open-labs/nucleux)** — agentic UI components for React. Install a single component, or the full kit via [`@nucleux/react`](https://www.npmjs.com/package/@nucleux/react).
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Exports
|
|
9
|
+
|
|
10
|
+
- **`Questionnaire`** — the `<form>` root; `item` / `defaultItem` / `onItemChange`, `items`, `shortcuts` (`"letters"` | `"numbers"`), `onSubmit` (runs once every enabled item validates)
|
|
11
|
+
- **`QuestionnaireProgress`** — "Question 1 of 3" progressbar (`render` for a custom format)
|
|
12
|
+
- **`QuestionnaireItem`** — one step (`<fieldset>`); `name`, `required`, `multiple`, `disabled`, `invalid`, `onStatusChange`
|
|
13
|
+
- **`QuestionnaireTitle`** (legend), **`QuestionnaireDescription`**, **`QuestionnaireError`**
|
|
14
|
+
- **`QuestionnaireChoices`**, **`QuestionnaireChoice`** (`value`, `defaultChecked`, `disabled`), **`QuestionnaireChoiceDescription`**, **`QuestionnaireInput`** (freeform answer)
|
|
15
|
+
- **`QuestionnaireActions`** — layout row for **`QuestionnairePrevious`**, **`QuestionnaireSkip`**, **`QuestionnaireNext`**, **`QuestionnaireSubmit`**
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm add @nucleux/questionnaire @nucleux/tokens
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`react` / `react-dom` are peer dependencies.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { Questionnaire, QuestionnaireProgress, QuestionnaireItem, QuestionnaireTitle, QuestionnaireChoices, QuestionnaireChoice, QuestionnaireInput, QuestionnaireError, QuestionnaireActions, QuestionnairePrevious, QuestionnaireSkip, QuestionnaireNext, QuestionnaireSubmit } from "@nucleux/questionnaire";
|
|
29
|
+
|
|
30
|
+
<Questionnaire
|
|
31
|
+
shortcuts="letters"
|
|
32
|
+
onSubmit={(event) => {
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
const answers = new FormData(event.currentTarget); // answers.get("direction"), answers.getAll("signals")
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<QuestionnaireProgress />
|
|
38
|
+
<QuestionnaireItem name="direction" required>
|
|
39
|
+
<QuestionnaireTitle>What should we prototype next?</QuestionnaireTitle>
|
|
40
|
+
<QuestionnaireChoices>
|
|
41
|
+
<QuestionnaireChoice value="delegation">Sub-agent delegation</QuestionnaireChoice>
|
|
42
|
+
<QuestionnaireChoice value="questions">Question prompts</QuestionnaireChoice>
|
|
43
|
+
<QuestionnaireInput aria-label="Another direction" placeholder="Type another direction…" />
|
|
44
|
+
</QuestionnaireChoices>
|
|
45
|
+
<QuestionnaireError />
|
|
46
|
+
</QuestionnaireItem>
|
|
47
|
+
<QuestionnaireItem name="signals" multiple>
|
|
48
|
+
<QuestionnaireTitle>What should every update include?</QuestionnaireTitle>
|
|
49
|
+
<QuestionnaireChoices>
|
|
50
|
+
<QuestionnaireChoice value="progress">Progress</QuestionnaireChoice>
|
|
51
|
+
<QuestionnaireChoice value="risks">Risks</QuestionnaireChoice>
|
|
52
|
+
</QuestionnaireChoices>
|
|
53
|
+
<QuestionnaireError />
|
|
54
|
+
</QuestionnaireItem>
|
|
55
|
+
<QuestionnaireActions>
|
|
56
|
+
<QuestionnairePrevious />
|
|
57
|
+
<QuestionnaireSkip />
|
|
58
|
+
<QuestionnaireNext />
|
|
59
|
+
<QuestionnaireSubmit>Save answers</QuestionnaireSubmit>
|
|
60
|
+
</QuestionnaireActions>
|
|
61
|
+
</Questionnaire>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Requires the theme once in your app: `import "@nucleux/tokens/styles.css";`
|
|
65
|
+
and the Tailwind preset from `@nucleux/tokens/preset`.
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT © Nucleux
|