Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const CheckBox = (props: PROPS) => {
id={`${id}-widget`}
type='checkbox'
className={'cmp-adaptiveform-checkbox__widget'}
title={props.tooltip || ''}
title={props.tooltipText || ''}
onChange={handleChange}
value={value}
checked={selectedValue === value ? true : false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const CheckBoxGroup = (props: PROPS) => {
className={`cmp-adaptiveform-checkboxgroup__widget ${orientation}`}
id={`${id}-widget`}
aria-describedby={syncAriaDescribedBy(id, props.tooltip, props.description, props.errorMessage)}
title={props.tooltip || ''}
title={props.tooltipText || ''}
>
{options?.map((item, index: number) => (
<div className={`cmp-adaptiveform-checkboxgroup-item ${name}`} key={enums![index]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const DateInput = (props: PROPS) => {
required={required}
onChange={changeHandler}
className={'cmp-adaptiveform-datepicker__widget'}
title={props.tooltip || ''}
title={props.tooltipText || ''}
aria-label={label?.value}
readOnly={readOnly}
placeholder={placeholder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const DropDown = (props: PROPS) => {
id={`${id}-widget`}
data-testid='select'
name={name}
title={props.tooltip || ''}
title={props.tooltipText || ''}
className={'cmp-adaptiveform-dropdown__widget'}
onChange={changeHandler}
value={selectedValue}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-vanilla-components/src/components/Email.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const Email = (props: PROPS) => {
type="email"
id={`${id}-widget`}
className={'cmp-adaptiveform-emailinput__widget'}
title={props.tooltip || ''}
title={props.tooltipText || ''}
value={value}
onChange={handleChange}
onBlur={handleBlur}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const FileUpload = (props: PROPS) => {
<input
ref={fileInputField}
className="cmp-adaptiveform-fileinput__widget"
title={props.tooltip || ''}
title={props.tooltipText || ''}
id={id}
type="file"
name={name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const NumberField = (props: PROPS) => {
id={`${id}-widget`}
type='number'
className={'cmp-adaptiveform-numberinput__widget'}
title={props.tooltip || ''}
title={props.tooltipText || ''}
value={value}
onChange={changeHandler}
required={required}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const RadioButtonGroup = (props: PROPS) => {
id={`${id}-widget`}
role="radiogroup"
aria-describedby={syncAriaDescribedBy(id, props.tooltip, props.description, props.errorMessage)}
title={props.tooltip || ''}
title={props.tooltipText || ''}
>
{options?.map((item, index: number) => (
<div className="cmp-adaptiveform-radiobutton__option" key={enums![index]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const Switch = (props: PROPS) => {
<input
className="cmp-adaptiveform-switch__widget"
type="checkbox"
title={props.tooltip || ''}
title={props.tooltipText || ''}
name={name}
role="switch"
disabled={!enabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const TelephoneInput = (props: PROPS) => {
type="tel"
id={`${id}-widget`}
className={'cmp-adaptiveform-telephoneinput__widget'}
title={props.tooltip || ''}
title={props.tooltipText || ''}
value={value || ''}
onChange={handleChange}
onBlur={handleBlur}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const TextField = (props: PROPS) => {
type="text"
id={`${id}-widget`}
className={'cmp-adaptiveform-textinput__widget'}
title={props.tooltip || ''}
title={props.tooltipText || ''}
value={value || ''}
onChange={handleChange}
onBlur={handleBlur}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const TextFieldArea = (props: PROPS) => {
<textarea
id={`${id}-widget`}
className={'cmp-adaptiveform-textinput__widget'}
title={props.tooltip || ''}
title={props.tooltipText || ''}
name={name}
onChange={handleChange}
value={value}
Expand Down
3 changes: 2 additions & 1 deletion packages/react-vanilla-components/src/utils/type.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export type PROPS = State<FieldJson & Handlers & {
layout?: {
[key: string]: any;
},
richText?: boolean
richText?: boolean,
tooltipText?: string
}>;

export type PROPS_PANEL = State<FieldsetJson> & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export const richTextString = (stringMsg = '') => {
const htmlProp = { __html: sanitizeHTML(stringMsg) };
return (<span dangerouslySetInnerHTML={htmlProp} />);
};
const getPlainTextFromHtml = (html: string = ''): string => {
const strippedText = sanitizeHTML(html, { allowedTags: [], allowedAttributes: {} });
return strippedText.trim();
};
const formateErrorMessage = (state: FieldViewState) => {
const errorMessage = state.errorMessage === '' && state.valid === false ? DEFAULT_ERROR_MESSAGE : state.errorMessage;
return errorMessage;
Expand Down Expand Up @@ -73,6 +77,7 @@ export function withRuleEngine(Component: JSXElementConstructor<any>) {
description: getLocalizeDescription(i18n, state),
placeholder: getLocalizePlaceholder(i18n, state),
tooltip: getToolTip(state),
tooltipText: getPlainTextFromHtml(state.tooltip || ''),
label: {
...state?.label,
value: getLocalizeLabel(i18n, state, state?.label?.richText),
Expand Down Expand Up @@ -104,7 +109,8 @@ export function withRuleEnginePanel(Component: JSXElementConstructor<any>) {
visible: state.label?.visible !== false
},
description: getLocalizeDescription(i18n, state),
tooltip: getToolTip(state)
tooltip: getToolTip(state),
tooltipText: getPlainTextFromHtml(state.tooltip || '')
};
const visible = typeof state.visible === 'undefined' || state.visible;
// @ts-ignore
Expand Down
Loading