-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #334 from IQSS/feature/316-create-functional-creat…
…e-dataset-form 316 - Functional create dataset form
- Loading branch information
Showing
39 changed files
with
1,086 additions
and
200 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
7 changes: 7 additions & 0 deletions
7
...s/design-system/src/lib/components/form/form-checkbox-group/FormCheckboxGroup.module.scss
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,7 @@ | ||
@import "src/lib/assets/styles/design-tokens/typography.module"; | ||
|
||
.title { | ||
padding-top: calc(0.375rem + 1px); | ||
padding-bottom: calc(0.375rem + 1px); | ||
font-weight: $dv-font-weight-bold; | ||
} |
41 changes: 41 additions & 0 deletions
41
packages/design-system/src/lib/components/form/form-checkbox-group/FormCheckboxGroup.tsx
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,41 @@ | ||
import { Row } from '../../grid/Row' | ||
import { Col } from '../../grid/Col' | ||
import { PropsWithChildren } from 'react' | ||
import styles from './FormCheckboxGroup.module.scss' | ||
import { RequiredInputSymbol } from '../required-input-symbol/RequiredInputSymbol' | ||
import { QuestionMarkTooltip } from '../../tooltip/question-mark-tooltip/QuestionMarkTooltip' | ||
|
||
interface FormCheckboxGroupProps { | ||
title: string | ||
required?: boolean | ||
message?: string | ||
isValid?: boolean | ||
isInvalid?: boolean | ||
} | ||
|
||
export function FormCheckboxGroup({ | ||
title, | ||
required, | ||
message, | ||
isValid, | ||
isInvalid, | ||
children | ||
}: PropsWithChildren<FormCheckboxGroupProps>) { | ||
const validationClass = isInvalid ? 'is-invalid' : isValid ? 'is-valid' : '' | ||
return ( | ||
<Row> | ||
<Col sm={3}> | ||
<span className={styles.title}> | ||
{title} {required && <RequiredInputSymbol />}{' '} | ||
{message && ( | ||
<QuestionMarkTooltip placement="right" message={message}></QuestionMarkTooltip> | ||
)} | ||
</span> | ||
</Col> | ||
<Col sm={9}> | ||
{<div className={validationClass}></div>} | ||
{children} | ||
</Col> | ||
</Row> | ||
) | ||
} |
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
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
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
22 changes: 22 additions & 0 deletions
22
packages/design-system/src/lib/components/form/form-group/form-element/FormFeedback.tsx
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,22 @@ | ||
import { FormControl } from 'react-bootstrap' | ||
import { PropsWithChildren } from 'react' | ||
import { Col } from '../../../grid/Col' | ||
|
||
interface FormFeedbackProps { | ||
type?: 'valid' | 'invalid' | ||
withinMultipleFieldsGroup?: boolean | ||
} | ||
|
||
export function FormFeedback({ | ||
type = 'valid', | ||
withinMultipleFieldsGroup, | ||
children | ||
}: PropsWithChildren<FormFeedbackProps>) { | ||
return withinMultipleFieldsGroup ? ( | ||
<FormControl.Feedback type={type}>{children}</FormControl.Feedback> | ||
) : ( | ||
<FormControl.Feedback as={Col} sm={{ offset: 3, span: 9 }} type={type}> | ||
{children} | ||
</FormControl.Feedback> | ||
) | ||
} |
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
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
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 |
---|---|---|
|
@@ -113,6 +113,17 @@ export const ReadOnlyInput: Story = { | |
) | ||
} | ||
|
||
export const DisabledInput: Story = { | ||
render: () => ( | ||
<Form> | ||
<Form.Group controlId="basic-form-email"> | ||
<Form.Group.Label>Email</Form.Group.Label> | ||
<Form.Group.Input type="email" disabled defaultValue="[email protected]" /> | ||
</Form.Group> | ||
</Form> | ||
) | ||
} | ||
|
||
export const InputWithPrefix: Story = { | ||
render: () => ( | ||
<Form> | ||
|
@@ -169,7 +180,7 @@ export const TextArea: Story = { | |
export const Checkbox: Story = { | ||
render: () => ( | ||
<Form> | ||
<Form.GroupWithMultipleFields title="Metadata Fields"> | ||
<Form.CheckboxGroup title="Metadata Fields"> | ||
<Form.Group.Checkbox | ||
defaultChecked | ||
name="metadata-field" | ||
|
@@ -187,7 +198,7 @@ export const Checkbox: Story = { | |
label="Social Science and Humanities Metadata" | ||
id="basic-form-social-science-metadata" | ||
/> | ||
</Form.GroupWithMultipleFields> | ||
</Form.CheckboxGroup> | ||
</Form> | ||
) | ||
} | ||
|
@@ -254,11 +265,12 @@ export const FormValidation: Story = { | |
</Form.Group.Label> | ||
<Form.Group.Input type="text" placeholder="Name" /> | ||
</Form.Group> | ||
<Form.Group as={Col} controlId="basic-form-affiliation"> | ||
<Form.Group as={Col} controlId="basic-form-affiliation" required> | ||
<Form.Group.Label message="The name of the entity affiliated with the author, e.g. an organization's name"> | ||
Affiliation | ||
</Form.Group.Label> | ||
<Form.Group.Input type="text" placeholder="Affiliation" /> | ||
<Form.Group.Feedback type="invalid">Please provide an affiliation</Form.Group.Feedback> | ||
</Form.Group> | ||
</Row> | ||
<Row> | ||
|
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
Oops, something went wrong.