Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): adds useAriaTextField.ts #11

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vitest.config.ts
setup.react.ts
coverage
dist
26 changes: 26 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,20 @@ module.exports = {
amd: true,
node: true,
},
parserOptions: {
ecmaVersion: 2020,
project: true,
sourceType: 'module',
tsconfigRootDir: __dirname,
},
rules: {
'import/no-cycle': 'off',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
alias: {
map: [['~', './src']],
extensions: ['.ts', '.tsx'],
Expand All @@ -19,4 +31,18 @@ module.exports = {
},
},
},
overrides: [
{
files: [
'**/*.test.ts',
'**/*.test.tsx',
'**/__tests__/**/*.ts',
'**/__tests__/**/*.tsx',
],
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
'import/order': 'off',
},
},
],
};
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package-lock.json
package.json
pnpm-lock.yaml
coverage
dist
3 changes: 3 additions & 0 deletions Writerside/dcs.tree
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@
<toc-element topic="Overview.md"/>
<toc-element topic="A11y-testing-strategy.md"/>
<toc-element topic="NPM-Registry.md"/>
<toc-element topic="API.md">
<toc-element topic="useInputField.md"/>
</toc-element>
</instance-profile>
3 changes: 3 additions & 0 deletions Writerside/topics/API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# API

Start typing here...
28 changes: 1 addition & 27 deletions Writerside/topics/useInputField.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
# useInputField

| [User Story on Github](https://github.com/orgs/Kurocado-Studio/projects/3/views/1?pane=issue&itemId=81815500) |
| ------------------------------------------------------------------------------------------------------------- |

The useInputFieldAdapter hook simplifies form input handling by combining React Aria’s accessibility
features with field state management from Conform.

## Key Functionality

- Field State Management: Utilizes useField from Conform to handle state, errors, and events.
- Accessibility: Leverages useTextField from React Aria to ensure ARIA attributes and accessibility
standards.
- Merging Props: Combines additional input props using mergeProps for flexibility.

## Component Interaction Diagram

This diagram demonstrates the interaction between the different React Aria hooks (useTextField) and
Conform's useField in the useInputFieldAdapter.

```mermaid
graph LR
A[useInputFieldAdapter Hook] --> B[useField from conform-to/react]
B --> C[Generates Field State, Error, Events]
A --> D[useTextField from react-aria/textfield]
D --> E[Generates Aria Props for Accessibility]
A --> F[Returns Combined Props for Input, Label, Error Message]
F --> G[React Form Component]
```
Start typing here...
Loading