-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
215 additions
and
236 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.field { | ||
box-sizing: border-box; | ||
|
||
& .field { | ||
height: 32px; | ||
padding: 0; | ||
} | ||
} |
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,25 @@ | ||
import { observer } from 'mobx-react-lite'; | ||
import type { HTMLAttributes, PropsWithChildren } from 'react'; | ||
|
||
import { getLayoutProps } from '../Containers/filterLayoutFakeProps'; | ||
import type { ILayoutSizeProps } from '../Containers/ILayoutSizeProps'; | ||
import elementsSizeStyles from '../Containers/shared/ElementsSize.m.css'; | ||
import { s } from '../s'; | ||
import { useS } from '../useS'; | ||
import fieldStyles from './Field.m.css'; | ||
|
||
type Props = ILayoutSizeProps & | ||
HTMLAttributes<HTMLDivElement> & { | ||
className?: string; | ||
}; | ||
export const Field: React.FC<PropsWithChildren<Props>> = observer(function Field({ children, className, ...rest }) { | ||
const styles = useS(fieldStyles, elementsSizeStyles); | ||
|
||
const layoutProps = getLayoutProps(rest); | ||
|
||
return ( | ||
<div {...rest} className={s(styles, { ...layoutProps, field: true }, className)}> | ||
{children} | ||
</div> | ||
); | ||
}); |
11 changes: 11 additions & 0 deletions
11
webapp/packages/core-blocks/src/FormControls/FieldDescription.m.css
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,11 @@ | ||
.fieldDescription { | ||
composes: theme-typography--caption from global; | ||
color: var(--theme-text-hint-on-background); | ||
box-sizing: border-box; | ||
padding-top: 4px; | ||
min-height: 24px; | ||
|
||
&.invalid { | ||
color: var(--theme-negative); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
webapp/packages/core-blocks/src/FormControls/FieldDescription.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,16 @@ | ||
import { observer } from 'mobx-react-lite'; | ||
import type { PropsWithChildren } from 'react'; | ||
|
||
import { s } from '../s'; | ||
import { useS } from '../useS'; | ||
import fieldDescriptionStyles from './FieldDescription.m.css'; | ||
|
||
interface Props { | ||
className?: string; | ||
invalid?: boolean; | ||
} | ||
export const FieldDescription: React.FC<PropsWithChildren<Props>> = observer(function FieldDescription({ children, className, invalid }) { | ||
const styles = useS(fieldDescriptionStyles); | ||
|
||
return <div className={s(styles, { fieldDescription: true, invalid }, className)}>{children}</div>; | ||
}); |
16 changes: 16 additions & 0 deletions
16
webapp/packages/core-blocks/src/FormControls/FieldLabel.m.css
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,16 @@ | ||
.fieldLabel { | ||
composes: theme-typography--body1 from global; | ||
display: block; | ||
box-sizing: border-box; | ||
overflow: hidden; | ||
white-space: initial; | ||
text-overflow: ellipsis; | ||
display: -webkit-box; | ||
-webkit-line-clamp: 2; | ||
-webkit-box-orient: vertical; | ||
font-weight: 500; | ||
} | ||
|
||
.fieldLabel:not(:empty) { | ||
padding-bottom: 10px; | ||
} |
29 changes: 29 additions & 0 deletions
29
webapp/packages/core-blocks/src/FormControls/FieldLabel.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,29 @@ | ||
import { observer } from 'mobx-react-lite'; | ||
import type { LabelHTMLAttributes, PropsWithChildren } from 'react'; | ||
|
||
import { s } from '../s'; | ||
import { useS } from '../useS'; | ||
import fieldLabelStyles from './FieldLabel.m.css'; | ||
|
||
type Props = LabelHTMLAttributes<HTMLLabelElement> & { | ||
className?: string; | ||
title?: string; | ||
required?: boolean; | ||
}; | ||
export const FieldLabel: React.FC<PropsWithChildren<Props>> = observer(function FieldLabel({ | ||
children, | ||
className, | ||
htmlFor, | ||
title, | ||
required, | ||
...rest | ||
}) { | ||
const styles = useS(fieldLabelStyles); | ||
|
||
return ( | ||
<label {...rest} className={s(styles, { fieldLabel: true }, className)}> | ||
{children} | ||
{required && ' *'} | ||
</label> | ||
); | ||
}); |
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.