Skip to content

Commit b29c8ea

Browse files
committed
chore: update version to 1.9.5-beta-5 in package.json and package-lock.json; add hideFormFieldInfo prop to CustomInput, FormFieldWrapper, and other components
1 parent 10d64d3 commit b29c8ea

File tree

10 files changed

+21
-11
lines changed

10 files changed

+21
-11
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.9.5-beta-4",
3+
"version": "1.9.5-beta-5",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/CustomInput/CustomInput.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const CustomInput = ({
4848
labelTippyCustomizedConfig,
4949
labelTooltipConfig,
5050
inputRef: inputRefProp,
51+
hideFormFieldInfo,
5152
...props
5253
}: CustomInputProps) => {
5354
const localInputRef = useRef<HTMLInputElement>(null)
@@ -98,6 +99,7 @@ const CustomInput = ({
9899
borderRadiusConfig={borderRadiusConfig}
99100
labelTippyCustomizedConfig={labelTippyCustomizedConfig}
100101
labelTooltipConfig={labelTooltipConfig}
102+
hideFormFieldInfo={hideFormFieldInfo}
101103
>
102104
<>
103105
<input

src/Shared/Components/FormFieldWrapper/FormFieldInfo.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ const FormInfoItem = ({ id, text, icon, textClass }: FormInfoItemProps) => (
2727

2828
const FormFieldInfo = ({ error, helperText, warningText, inputId }: FormFieldInfoProps) => (
2929
<div className="flex left column dc__gap-4">
30-
{(typeof error === 'string' ? !!error.trim() : !!error) && (
31-
<FormInfoItem text={error} icon="ic-error" textClass="cr-5" id={getFormErrorElementId(inputId)} />
32-
)}
30+
{!!error && <FormInfoItem text={error} icon="ic-error" textClass="cr-5" id={getFormErrorElementId(inputId)} />}
3331
{!!helperText && (
3432
<FormInfoItem text={helperText} icon="ic-info-filled" textClass="cn-7" id={`${inputId}-helper-text`} />
3533
)}

src/Shared/Components/FormFieldWrapper/FormFieldWrapper.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ const FormFieldWrapper = ({
3030
children,
3131
labelTippyCustomizedConfig,
3232
labelTooltipConfig,
33-
}: Required<FormFieldWrapperProps>) => {
33+
hideFormFieldInfo = false,
34+
}: Omit<Required<FormFieldWrapperProps>, 'hideFormFieldInfo'> & Pick<FormFieldWrapperProps, 'hideFormFieldInfo'>) => {
3435
const isRowLayout = layout === 'row'
3536
const itemContainerClassName = isRowLayout ? 'dc__mxw-250 w-100 mxh-36 dc__align-self-stretch' : ''
3637
const formError = Array.isArray(error) ? error[0] : error
@@ -57,7 +58,7 @@ const FormFieldWrapper = ({
5758
)}
5859
<div className="w-100 dc__position-rel">{children}</div>
5960
</div>
60-
{(!!formError || !!helperText || !!warningText) && (
61+
{!hideFormFieldInfo && (!!formError || !!helperText || !!warningText) && (
6162
<div className="flex left dc__gap-6 w-100">
6263
{/* Added a hidden div for layout sync */}
6364
{isRowLayout && <div className={`${itemContainerClassName} dc__visibility-hidden`} />}

src/Shared/Components/FormFieldWrapper/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
export { default as FormFieldWrapper } from './FormFieldWrapper'
1818
export type { FormFieldWrapperProps } from './types'
1919
export { getFormFieldAriaAttributes } from './utils'
20+
export { default as FormFieldInfo } from './FormFieldInfo'

src/Shared/Components/FormFieldWrapper/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,8 @@ export interface FormFieldWrapperProps
9595
children: ReactElement
9696
borderRadiusConfig?: BorderConfigType
9797
borderConfig?: BorderConfigType
98+
/**
99+
* @default false
100+
*/
101+
hideFormFieldInfo?: boolean
98102
}

src/Shared/Components/PhoneInput/PhoneInput.component.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useRef } from 'react'
44
import { PhoneInputProps } from './types'
55
import { CountrySelect } from '../CountrySelect'
66
import { CustomInput } from '../CustomInput'
7-
import FormFieldInfo from '../FormFieldWrapper/FormFieldInfo'
7+
import { FormFieldInfo } from '../FormFieldWrapper'
88

99
const PhoneInput = ({
1010
error,
@@ -59,8 +59,8 @@ const PhoneInput = ({
5959
value={inputValue}
6060
onChange={handlePhoneValueChange}
6161
inputRef={inputRef}
62-
// Since we are showing error below but want css of errors here
63-
error={error ? ' ' : null}
62+
error={error}
63+
hideFormFieldInfo
6464
fullWidth
6565
/>
6666
</div>

src/Shared/Components/SelectPicker/SelectPicker.component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
222222
borderRadiusConfig,
223223
labelTippyCustomizedConfig,
224224
labelTooltipConfig,
225+
hideFormFieldInfo,
225226
...props
226227
}: SelectPickerProps<OptionValue, IsMulti>) => {
227228
const [isFocussed, setIsFocussed] = useState(false)
@@ -387,6 +388,7 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
387388
borderRadiusConfig={borderRadiusConfig}
388389
labelTippyCustomizedConfig={labelTippyCustomizedConfig}
389390
labelTooltipConfig={labelTooltipConfig}
391+
hideFormFieldInfo={hideFormFieldInfo}
390392
>
391393
<ConditionalWrap condition={isDisabled && !!disabledTippyContent} wrap={renderDisabledTippy}>
392394
<div className="w-100">

src/Shared/Components/Textarea/Textarea.component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const Textarea = ({
4545
borderRadiusConfig,
4646
labelTooltipConfig,
4747
labelTippyCustomizedConfig,
48+
hideFormFieldInfo,
4849
value,
4950
borderConfig,
5051
...props
@@ -132,6 +133,7 @@ const Textarea = ({
132133
borderRadiusConfig={borderRadiusConfig}
133134
labelTooltipConfig={labelTooltipConfig}
134135
labelTippyCustomizedConfig={labelTippyCustomizedConfig}
136+
hideFormFieldInfo={hideFormFieldInfo}
135137
>
136138
<textarea
137139
{...props}

0 commit comments

Comments
 (0)