-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add textUI textareaUI + mock form cleanup (#29658)
* add textUI and textareaUI * cleanup mock form
- Loading branch information
1 parent
fbb5d0e
commit 2a52c5c
Showing
20 changed files
with
352 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/applications/simple-forms/mock-simple-forms-patterns/pages/mockAddress.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { | ||
addressSchema, | ||
addressUI, | ||
titleUI, | ||
} from 'platform/forms-system/src/js/web-component-patterns'; | ||
|
||
/** @type {PageSchema} */ | ||
export default { | ||
uiSchema: { | ||
...titleUI('Web component v3 address'), | ||
wcv3Address: addressUI(), | ||
}, | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
wcv3Address: addressSchema(), | ||
}, | ||
required: [], | ||
}, | ||
}; |
21 changes: 21 additions & 0 deletions
21
src/applications/simple-forms/mock-simple-forms-patterns/pages/mockFullName.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// @ts-check | ||
import { | ||
titleUI, | ||
fullNameUI, | ||
fullNameSchema, | ||
} from 'platform/forms-system/src/js/web-component-patterns'; | ||
|
||
/** @type {PageSchema} */ | ||
export default { | ||
uiSchema: { | ||
...titleUI('Web component v3 full name'), | ||
wcv3SpouseFullNameNew: fullNameUI(), | ||
}, | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
wcv3SpouseFullNameNew: fullNameSchema, | ||
}, | ||
required: [], | ||
}, | ||
}; |
24 changes: 24 additions & 0 deletions
24
src/applications/simple-forms/mock-simple-forms-patterns/pages/mockSsn.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { | ||
titleUI, | ||
ssnOrVaFileNumberNoHintUI, | ||
ssnOrVaFileNumberNoHintSchema, | ||
} from 'platform/forms-system/src/js/web-component-patterns'; | ||
|
||
/** @type {PageSchema} */ | ||
export default { | ||
uiSchema: { | ||
...titleUI( | ||
'Identification information', | ||
'You must enter a Social Security number or VA file number', | ||
), | ||
wcv3SsnNew: ssnOrVaFileNumberNoHintUI(), | ||
}, | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
wcv3SsnNew: ssnOrVaFileNumberNoHintSchema, | ||
}, | ||
required: ['wcv3SsnNew'], | ||
}, | ||
initialData: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 32 additions & 98 deletions
130
src/applications/simple-forms/mock-simple-forms-patterns/pages/mockTextInput.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,135 +1,69 @@ | ||
/* eslint-disable no-unused-vars */ | ||
import React from 'react'; | ||
import VaTextInputField from 'platform/forms-system/src/js/web-component-fields/VaTextInputField'; | ||
import { | ||
inlineTitleSchema, | ||
inlineTitleUI, | ||
titleUI, | ||
} from 'platform/forms-system/src/js/web-component-patterns/titlePattern'; | ||
import VaTextareaField from 'platform/forms-system/src/js/web-component-fields/VaTextareaField'; | ||
textUI, | ||
textSchema, | ||
textareaUI, | ||
} from 'platform/forms-system/src/js/web-component-patterns'; | ||
|
||
/** @type {PageSchema} */ | ||
export default { | ||
uiSchema: { | ||
// Example of using a function: | ||
// Only use this if you need it because it will rerender every time (only on this page) | ||
...titleUI(({ formData, formContext }) => { | ||
return 'RJSF'; | ||
return 'Web component v3 text fields'; | ||
}), | ||
simpleOld: { | ||
'ui:title': 'TextWidget - with string description', | ||
'ui:description': 'Text description', | ||
}, | ||
requiredOld: { | ||
'ui:title': 'TextWidget - with JSX description', | ||
'ui:description': ( | ||
<va-additional-info trigger="JSX description"> | ||
We need the Veteran’s Social Security number or tax identification | ||
number to process the application when it’s submitted online, but it’s | ||
not a requirement to apply for the program. | ||
</va-additional-info> | ||
), | ||
'ui:errorMessages': { | ||
required: 'Please enter a value', | ||
}, | ||
}, | ||
disabledOld: { | ||
'ui:title': 'TextWidget - disabled', | ||
'ui:disabled': true, | ||
}, | ||
'view:wcv3Title': inlineTitleUI('Web component v3'), | ||
wcv3SimpleNew: { | ||
'ui:title': 'VaTextInputField - with string description', | ||
'ui:webComponentField': VaTextInputField, | ||
'ui:description': 'Text description', | ||
}, | ||
wcv3RequiredNew: { | ||
'ui:title': 'VaTextInputField - with JSX description', | ||
'ui:webComponentField': VaTextInputField, | ||
'ui:description': ( | ||
wcv3SimpleNew: textUI({ | ||
title: 'VaTextInputField - with string description', | ||
description: 'Text description', | ||
}), | ||
wcv3RequiredNew: textUI({ | ||
title: 'VaTextInputField - with JSX description', | ||
description: ( | ||
<va-additional-info trigger="JSX description"> | ||
We need the Veteran’s Social Security number or tax identification | ||
number to process the application when it’s submitted online, but it’s | ||
not a requirement to apply for the program. | ||
</va-additional-info> | ||
), | ||
'ui:errorMessages': { | ||
errorMessages: { | ||
required: 'Please enter a value', | ||
}, | ||
'ui:options': { | ||
hideIf: formData => formData.hide, | ||
hideOnReview: true, | ||
}, | ||
}, | ||
wcv3HintNew: { | ||
'ui:title': 'VaTextInputField - with string hint', | ||
'ui:webComponentField': VaTextInputField, | ||
'ui:options': { | ||
hint: 'This is a hint', | ||
}, | ||
}, | ||
wcv3InputmodeDecimalNew: { | ||
'ui:title': 'VaTextInputField - with decimal inputmode', | ||
'ui:webComponentField': VaTextInputField, | ||
'ui:options': { | ||
inputmode: 'decimal', | ||
}, | ||
}, | ||
wcv3TextAreaNew: { | ||
'ui:title': 'VaTextareaField (short hint)', | ||
'ui:description': 'Text description', | ||
'ui:webComponentField': VaTextareaField, | ||
'ui:options': { | ||
charcount: true, | ||
hint: 'Normal hint', | ||
}, | ||
}, | ||
wcv3DisabledNew: { | ||
'ui:title': 'VaTextInputField - disabled', | ||
'ui:description': ( | ||
<va-additional-info trigger="Disabled not supported for v3"> | ||
v3 does not support disabled fields. Solve with better pattern | ||
instead, for example one question per page. | ||
</va-additional-info> | ||
), | ||
'ui:webComponentField': VaTextInputField, | ||
'ui:disabled': true, // not supported for v3 | ||
}, | ||
hideIf: formData => formData.hide, | ||
hideOnReview: true, | ||
}), | ||
wcv3HintNew: textUI({ | ||
title: 'VaTextInputField with charcount', | ||
hint: 'This is a hint', | ||
width: 'md', | ||
charcount: true, | ||
}), | ||
wcv3TextAreaNew: textareaUI({ | ||
title: 'VaTextareaField', | ||
description: 'Text description', | ||
hint: 'Normal hint', | ||
charcount: true, | ||
}), | ||
}, | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
simpleOld: { | ||
type: 'string', | ||
}, | ||
requiredOld: { | ||
type: 'string', | ||
}, | ||
disabledOld: { | ||
type: 'string', | ||
}, | ||
'view:wcv3Title': inlineTitleSchema, | ||
wcv3SimpleNew: { | ||
type: 'string', | ||
}, | ||
wcv3RequiredNew: { | ||
type: 'string', | ||
}, | ||
wcv3SimpleNew: textSchema, | ||
wcv3RequiredNew: textSchema, | ||
wcv3HintNew: { | ||
type: 'string', | ||
}, | ||
wcv3InputmodeDecimalNew: { | ||
type: 'string', | ||
maxLength: 24, | ||
}, | ||
wcv3TextAreaNew: { | ||
type: 'string', | ||
maxLength: 30, | ||
minLength: 10, | ||
}, | ||
wcv3DisabledNew: { | ||
type: 'string', | ||
}, | ||
}, | ||
required: ['requiredOld', 'wcv3RequiredNew', 'wcv3TextAreaNew'], | ||
required: ['wcv3RequiredNew', 'wcv3TextAreaNew'], | ||
}, | ||
}; |
30 changes: 0 additions & 30 deletions
30
src/applications/simple-forms/mock-simple-forms-patterns/pages/mockTextInputAddress.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.