Skip to content

Commit

Permalink
feat(textbox): change labelHelp type to ReactNode
Browse files Browse the repository at this point in the history
close FE-3387

fix #3434
  • Loading branch information
alzieba committed Apr 7, 2021
1 parent 8ecf658 commit fbd15e6
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 59 deletions.
2 changes: 1 addition & 1 deletion src/__experimental__/components/label/label.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Label.propTypes = {
/** Status of info */
info: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
/** A message that the Help component will display */
help: PropTypes.string,
help: PropTypes.node,
/** Icon type */
helpIcon: PropTypes.string,
/** Overrides the default 'as' attribute of the Help component */
Expand Down
6 changes: 3 additions & 3 deletions src/__experimental__/components/label/label.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import * as React from "react";

export interface LabelPropTypes {
children?: React.ReactNode;
labelId?: string;
help?: string;
help?: React.ReactNode;
helpIcon?: string;
helpId?: string;
helpTag?: string;
Expand All @@ -20,7 +20,7 @@ export interface LabelPropTypes {
/** When true label is inline */
inline?: boolean;
/** Text alignment of label */
align?: 'left' | 'right';
align?: "left" | "right";
styleOverride?: () => object | object;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ NumeralDate.propTypes = {
/** Label */
label: PropTypes.string,
/** Text applied to label help tooltip */
labelHelp: PropTypes.string,
labelHelp: PropTypes.node,
/** When true, label is placed in line with an input */
labelInline: PropTypes.bool,
/** Label alignment. Works only when labelInline is true */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export interface NumeralDateProps {
/** Label */
label?: string;
/** Text applied to label help tooltip */
labelHelp?: string;
labelHelp?: React.ReactNode;
/** When true, label is placed in line with an input */
labelInline?: boolean;
/** Label alignment. Works only when labelInline is true */
Expand Down
2 changes: 1 addition & 1 deletion src/__experimental__/components/switch/switch.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Switch.propTypes = {
/** Sets label alignment - accepted values: 'left' (default), 'right' */
labelAlign: PropTypes.string,
/** Help text */
labelHelp: PropTypes.string,
labelHelp: PropTypes.node,
/** Displays label inline with the Switch */
labelInline: PropTypes.bool,
/** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
Expand Down
2 changes: 1 addition & 1 deletion src/__experimental__/components/switch/switch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface SwitchProps {
id?: string;
inputWidth?: number | string;
label?: string;
labelHelp?: string;
labelHelp?: React.ReactNode;
labelAlign?: string;
labelInline?: boolean;
labelSpacing?: 1 | 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ Textarea.propTypes = {
expandable: PropTypes.bool,
/** The content of the label for the input */
label: PropTypes.string,
/** Text applied to label help tooltip */
labelHelp: PropTypes.node,
/** When true, label is placed in line with an input */
labelInline: PropTypes.bool,
/** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
Expand Down
2 changes: 2 additions & 0 deletions src/__experimental__/components/textarea/textarea.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface TextareaProps {
expandable?: boolean;
/** Label */
label?: string;
/** Text applied to label help tooltip */
labelHelp?: React.ReactNode;
/** When true, label is placed in line an input */
labelInline?: boolean;
/** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Textbox.propTypes = {
/** Label */
label: PropTypes.string,
/** Text applied to label help tooltip */
labelHelp: PropTypes.string,
labelHelp: PropTypes.node,
/** When true, label is placed in line an input */
labelInline: PropTypes.bool,
/** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
Expand Down
2 changes: 1 addition & 1 deletion src/__experimental__/components/textbox/textbox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface TextboxProps extends SpacingProps {
/** Label */
label?: string;
/** Text applied to label help tooltip */
labelHelp?: string;
labelHelp?: React.ReactNode;
/** When true, label is placed in line an input */
labelInline?: boolean;
/** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ BaseButtonToggleGroup.propTypes = {
/** Text for the label. */
label: PropTypes.string,
/** Text for the labels help tooltip. */
labelHelp: PropTypes.string,
labelHelp: PropTypes.node,
/** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
labelSpacing: PropTypes.oneOf([1, 2]),
/** The percentage width of the ButtonToggleGroup. */
Expand Down
60 changes: 30 additions & 30 deletions src/components/input-definition.d.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
import { ChangeEvent } from 'react';
import { AlignBinaryType } from '../utils/helpers/options-helper/options-helper';
import { Validator } from '../utils/validations/validation-interface';
import * as React from "react";
import { AlignBinaryType } from "../utils/helpers/options-helper/options-helper";
import { Validator } from "../utils/validations/validation-interface";

export interface InputProps {
value?: any;
value?: any;

/** Timeout length before onChangeDeferred is triggered. */
deferTimeout?: number;
/** Timeout length before onChangeDeferred is triggered. */
deferTimeout?: number;

/** Displays additional information below the input to provide help to the user. */
fieldHelp?: string;
/** Displays additional information below the input to provide help to the user. */
fieldHelp?: string;

/** Displays fieldHelp inline with the checkbox/radio button. */
fieldHelpInline?: boolean;
/** Displays fieldHelp inline with the checkbox/radio button. */
fieldHelpInline?: boolean;

/** An array of info messages to apply to the input. */
info?: Validator[];
/** An array of info messages to apply to the input. */
info?: Validator[];

/** A number representing the percentage/ratio of width with the label. Works best with inline labels. */
inputWidth?: number;
/** A number representing the percentage/ratio of width with the label. Works best with inline labels. */
inputWidth?: number;

/** Outputs a label for the input. */
label?: string;
/** Outputs a label for the input. */
label?: string;

/** Align the label either 'left' or 'right'. Only works with inline labels. */
labelAlign?: AlignBinaryType;
/** Align the label either 'left' or 'right'. Only works with inline labels. */
labelAlign?: AlignBinaryType;

/** Output an info icon next to the label to display additional help to the user. */
labelHelp?: string;
/** Output an info icon next to the label to display additional help to the user. */
labelHelp?: React.ReactNode;

/** Displays the label inline with the input. */
labelInline?: boolean;
/** Displays the label inline with the input. */
labelInline?: boolean;

/** A number representing the percentage/ratio of width with the input. Works best with inline labels. */
labelWidth?: number;
/** A number representing the percentage/ratio of width with the input. Works best with inline labels. */
labelWidth?: number;

/** A callback which will trigger after the user has stopped typing for the duration of deferTimeout. */
onChangeDeferred?: (ev: ChangeEvent<HTMLElement>) => void;
/** A callback which will trigger after the user has stopped typing for the duration of deferTimeout. */
onChangeDeferred?: (ev: React.ChangeEvent<HTMLElement>) => void;

/** An array of validations to apply to the input. */
validations?: Validator[];
/** An array of validations to apply to the input. */
validations?: Validator[];

/** An array of warnings to apply to the input. */
warnings?: Validator[];
/** An array of warnings to apply to the input. */
warnings?: Validator[];
}
16 changes: 9 additions & 7 deletions src/components/select/filterable-select/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import Button from '../../button';
import { OptionProps } from '../option';
import { OptionRowProps } from '../option-row';
import * as React from "react";
import Button from "../../button";
import { OptionProps } from "../option";
import { OptionRowProps } from "../option-row";

export interface FilterableSelectProps {
/** Boolean to toggle where SelectList is rendered in relation to the Select Input */
Expand All @@ -19,23 +19,25 @@ export interface FilterableSelectProps {
/** Label */
label?: string;
/** Text applied to label help tooltip */
labelHelp?: string;
labelHelp?: React.ReactNode;
/** When true, label is placed in line with an input */
labelInline?: boolean;
/** Width of a label in percentage. Works only when labelInline is true */
labelWidth?: number;
/** Width of an input in percentage. Works only when labelInline is true */
inputWidth?: number;
/** Size of an input */
size?: 'small' | 'medium' | 'large';
size?: "small" | "medium" | "large";
/** Placeholder string to be displayed in input */
placeholder?: string;
/** The selected value(s), when the component is operating in controlled mode */
value?: string | object;
/** The default selected value(s), when the component is operating in uncontrolled mode */
defaultValue?: string | object;
/** Child components (such as Option or OptionRow) for the SelectList */
children: Array<React.ReactElement<OptionProps | OptionRowProps>> | React.ReactElement<OptionProps | OptionRowProps>;
children:
| Array<React.ReactElement<OptionProps | OptionRowProps>>
| React.ReactElement<OptionProps | OptionRowProps>;
/** If true the Component opens on focus */
openOnFocus?: boolean;
/** SelectList table header, should consist of multiple th elements.
Expand Down
8 changes: 5 additions & 3 deletions src/components/select/multi-select/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";
import { OptionProps } from "../option";
import { OptionRowProps } from '../option-row';
import { OptionRowProps } from "../option-row";

export interface MultiSelectProps {
/** Boolean to toggle where SelectList is rendered in relation to the Select Input */
Expand All @@ -18,7 +18,7 @@ export interface MultiSelectProps {
/** Label */
label?: string;
/** Text applied to label help tooltip */
labelHelp?: string;
labelHelp?: React.ReactNode;
/** When true, label is placed in line with an input */
labelInline?: boolean;
/** Width of a label in percentage. Works only when labelInline is true */
Expand All @@ -34,7 +34,9 @@ export interface MultiSelectProps {
/** The default selected value(s), when the component is operating in uncontrolled mode */
defaultValue?: string[] | object[];
/** Child components (such as Option or OptionRow) for the SelectList */
children: Array<React.ReactElement<OptionProps | OptionRowProps>> | React.ReactElement<OptionProps | OptionRowProps>;
children:
| Array<React.ReactElement<OptionProps | OptionRowProps>>
| React.ReactElement<OptionProps | OptionRowProps>;
/** If true the Component opens on focus */
openOnFocus?: boolean;
/** SelectList table header, should consist of multiple th elements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const formInputPropTypes = {
/** Label */
label: PropTypes.string,
/** Text applied to label help tooltip */
labelHelp: PropTypes.string,
labelHelp: PropTypes.node,
/** When true, label is placed in line with an input */
labelInline: PropTypes.bool,
/** Width of a label in percentage. Works only when labelInline is true */
Expand Down
16 changes: 9 additions & 7 deletions src/components/select/simple-select/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { OptionProps } from '../option';
import { OptionRowProps } from '../option-row';
import { SpacingProps } from '../../../utils/helpers/options-helper';
import * as React from "react";
import { OptionProps } from "../option";
import { OptionRowProps } from "../option-row";
import { SpacingProps } from "../../../utils/helpers/options-helper";

export interface SimpleSelectProps extends SpacingProps {
/** Boolean to toggle where SelectList is rendered in relation to the Select Input */
Expand All @@ -19,23 +19,25 @@ export interface SimpleSelectProps extends SpacingProps {
/** Label */
label?: string;
/** Text applied to label help tooltip */
labelHelp?: string;
labelHelp?: React.ReactNode;
/** When true, label is placed in line with an input */
labelInline?: boolean;
/** Width of a label in percentage. Works only when labelInline is true */
labelWidth?: number;
/** Width of an input in percentage. Works only when labelInline is true */
inputWidth?: number;
/** Size of an input */
size?: 'small' | 'medium' | 'large';
size?: "small" | "medium" | "large";
/** Placeholder string to be displayed in input */
placeholder?: string;
/** The selected value(s), when the component is operating in controlled mode */
value?: string | object;
/** The default selected value(s), when the component is operating in uncontrolled mode */
defaultValue?: string | object;
/** Child components (such as Option or OptionRow) for the SelectList */
children: Array<React.ReactElement<OptionProps | OptionRowProps>> | React.ReactElement<OptionProps | OptionRowProps>;
children:
| Array<React.ReactElement<OptionProps | OptionRowProps>>
| React.ReactElement<OptionProps | OptionRowProps>;
/** If true the Component opens on focus */
openOnFocus?: boolean;
/** SelectList table header, should consist of multiple th elements.
Expand Down

0 comments on commit fbd15e6

Please sign in to comment.