-
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 #148 from IQSS/feature/136-files-table-checkboxes-…
…selection-ui 136 - Files table UI [2/2] - Row selection
- Loading branch information
Showing
65 changed files
with
1,099 additions
and
181 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
127 changes: 127 additions & 0 deletions
127
...rc/lib/assets/styles/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.08 KB
...n-system/src/lib/assets/styles/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.ttf
Binary file not shown.
Binary file added
BIN
+2.99 KB
...-system/src/lib/assets/styles/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.woff
Binary file not shown.
Binary file added
BIN
+2.26 KB
...system/src/lib/assets/styles/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.woff2
Binary file not shown.
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
20 changes: 2 additions & 18 deletions
20
packages/design-system/src/lib/components/form/form-group/form-element/FormInput.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 |
---|---|---|
@@ -1,40 +1,24 @@ | ||
import { Form as FormBS, InputGroup } from 'react-bootstrap' | ||
import { Form as FormBS } from 'react-bootstrap' | ||
import { FormElementLayout } from './FormElementLayout' | ||
import { PropsWithChildren } from 'react' | ||
import * as React from 'react' | ||
|
||
export type FormInputElement = HTMLInputElement | HTMLTextAreaElement | ||
|
||
interface FormInputProps extends React.HTMLAttributes<FormInputElement> { | ||
type?: 'text' | 'email' | 'password' | ||
readOnly?: boolean | ||
prefix?: string | ||
withinMultipleFieldsGroup?: boolean | ||
} | ||
|
||
export function FormInput({ | ||
type = 'text', | ||
readOnly, | ||
prefix, | ||
withinMultipleFieldsGroup, | ||
...props | ||
}: FormInputProps) { | ||
const FormInputPrefix = ({ children }: PropsWithChildren) => { | ||
return prefix ? ( | ||
<InputGroup className="mb-3"> | ||
<InputGroup.Text>{prefix}</InputGroup.Text> | ||
{children} | ||
</InputGroup> | ||
) : ( | ||
<>{children}</> | ||
) | ||
} | ||
|
||
return ( | ||
<FormElementLayout withinMultipleFieldsGroup={withinMultipleFieldsGroup}> | ||
<FormInputPrefix> | ||
<FormBS.Control type={type} readOnly={readOnly} plaintext={readOnly} {...props} /> | ||
</FormInputPrefix> | ||
<FormBS.Control type={type} readOnly={readOnly} plaintext={readOnly} {...props} /> | ||
</FormElementLayout> | ||
) | ||
} |
28 changes: 28 additions & 0 deletions
28
...ages/design-system/src/lib/components/form/form-group/form-input-group/FormInputGroup.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,28 @@ | ||
import React, { PropsWithChildren } from 'react' | ||
import { InputGroup } from 'react-bootstrap' | ||
import { FormInputGroupText } from './FormInputGroupText' | ||
import { Col } from '../../../grid/Col' | ||
|
||
interface FormInputGroupProps { | ||
hasVisibleLabel?: boolean | ||
} | ||
|
||
function FormInputGroup({ hasVisibleLabel, children }: PropsWithChildren<FormInputGroupProps>) { | ||
const childrenInsideGroup = React.Children.map(children as JSX.Element, (child) => { | ||
return React.cloneElement(child, { | ||
withinMultipleFieldsGroup: true | ||
}) | ||
}) | ||
|
||
return hasVisibleLabel ? ( | ||
<Col sm={9}> | ||
<InputGroup className="mb-3">{childrenInsideGroup}</InputGroup> | ||
</Col> | ||
) : ( | ||
<InputGroup className="mb-3">{childrenInsideGroup}</InputGroup> | ||
) | ||
} | ||
|
||
FormInputGroup.Text = FormInputGroupText | ||
|
||
export { FormInputGroup } |
6 changes: 6 additions & 0 deletions
6
.../design-system/src/lib/components/form/form-group/form-input-group/FormInputGroupText.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,6 @@ | ||
import { PropsWithChildren } from 'react' | ||
import { InputGroup } from 'react-bootstrap' | ||
|
||
export function FormInputGroupText({ children }: PropsWithChildren) { | ||
return <InputGroup.Text>{children}</InputGroup.Text> | ||
} |
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
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
34 changes: 34 additions & 0 deletions
34
...es/design-system/tests/component/form/form-group/form-input-group/FormInputGroup.spec.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,34 @@ | ||
import { FormInputGroup } from '../../../../../src/lib/components/form/form-group/form-input-group/FormInputGroup' | ||
import { FormGroup } from '../../../../../src/lib/components/form/form-group/FormGroup' | ||
import { Search } from 'react-bootstrap-icons' | ||
import { Button } from '../../../../../src/lib/components/button/Button' | ||
|
||
describe('FormInputGroup', () => { | ||
it('should render with input and text', () => { | ||
cy.mount( | ||
<FormGroup controlId="username"> | ||
<FormInputGroup> | ||
<FormInputGroup.Text>https://dataverse.org/</FormInputGroup.Text> | ||
<FormGroup.Input type="text" placeholder="Identifier" aria-label="identifier" /> | ||
</FormInputGroup> | ||
</FormGroup> | ||
) | ||
|
||
cy.findByText('https://dataverse.org/').should('exist') | ||
cy.findByLabelText('identifier').should('exist') | ||
}) | ||
|
||
it('should render with input and button', () => { | ||
cy.mount( | ||
<FormGroup controlId="username"> | ||
<FormInputGroup> | ||
<FormGroup.Input type="text" placeholder="Search..." aria-label="Search" /> | ||
<Button variant="secondary" icon={<Search />} /> | ||
</FormInputGroup> | ||
</FormGroup> | ||
) | ||
|
||
cy.findByLabelText('Search').should('exist') | ||
cy.findByRole('button').should('exist') | ||
}) | ||
}) |
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
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.