Skip to content
Snippets Groups Projects
Commit a171c877 authored by Loïc Correnson's avatar Loïc Correnson
Browse files

Merge branch 'fix/ivette/form/rlaz' into 'master'

Ivette : Field, label html en Label JSX

See merge request frama-c/frama-c!4479
parents ae8c09f6 bfcf8382
No related branches found
No related tags found
No related merge requests found
...@@ -61,6 +61,8 @@ export interface LabelProps { ...@@ -61,6 +61,8 @@ export interface LabelProps {
display?: boolean; display?: boolean;
/** Additional content of the `<label/>` element. */ /** Additional content of the `<label/>` element. */
children?: React.ReactNode; children?: React.ReactNode;
/** Html tag `<input />` element. */
htmlFor?: string;
/** Click event callback. */ /** Click event callback. */
onClick?: (evt: React.MouseEvent) => void; onClick?: (evt: React.MouseEvent) => void;
/** Click event callback. */ /** Click event callback. */
...@@ -93,6 +95,7 @@ const makeLabel = (className: string) => ...@@ -93,6 +95,7 @@ const makeLabel = (className: string) =>
onClick={props.onClick} onClick={props.onClick}
onDoubleClick={props.onDoubleClick} onDoubleClick={props.onDoubleClick}
onContextMenu={props.onContextMenu} onContextMenu={props.onContextMenu}
htmlFor={props.htmlFor}
> >
{props.icon && {props.icon &&
<Icon title={props.title} id={props.icon} className={iconClass} />} <Icon title={props.title} id={props.icon} className={iconClass} />}
......
...@@ -44,6 +44,7 @@ import * as Dome from 'dome'; ...@@ -44,6 +44,7 @@ import * as Dome from 'dome';
import * as Utils from 'dome/misc/utils'; import * as Utils from 'dome/misc/utils';
import { SVG } from 'dome/controls/icons'; import { SVG } from 'dome/controls/icons';
import { Checkbox, Radio, Select as SelectMenu } from 'dome/controls/buttons'; import { Checkbox, Radio, Select as SelectMenu } from 'dome/controls/buttons';
import { Label } from 'dome/controls/labels';
export type FieldError = export type FieldError =
| undefined | boolean | string | undefined | boolean | string
...@@ -596,14 +597,13 @@ export function Field(props: GenericFieldProps): JSX.Element | null { ...@@ -596,14 +597,13 @@ export function Field(props: GenericFieldProps): JSX.Element | null {
return ( return (
<> <>
<label <Label
className={cssLabel} className={cssLabel}
style={{ top: offset }} style={{ top: offset }}
htmlFor={htmlFor} htmlFor={htmlFor}
title={title} title={title}
> label={label}
{label} />
</label>
<div className={cssField} title={title}> <div className={cssField} title={title}>
{children} {children}
{WARNING} {WARNING}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment