MCPcopy Create free account
hub / github.com/dailydotdev/apps / TextFieldComponent

Function TextFieldComponent

packages/shared/src/components/fields/TextField.tsx:52–267  ·  view source on GitHub ↗
(
  {
    className = {},
    inputId,
    name,
    label,
    maxLength,
    showMaxLength = true,
    value,
    saveHintSpace = false,
    progress,
    hint,
    hintIcon,
    valid,
    validityChanged,
    valueChanged,
    placeholder,
    style,
    fieldType = 'primary',
    fieldSize,
    variant = FieldVariant.Filled,
    isLocked,
    readOnly = isLocked,
    leftIcon,
    actionButton,
    disabled,
    rightIcon,
    required,
    pressed,
    onBlur: onExternalBlur,
    focused: focusedProp,
    inputRef: inputRefProp,
    ...props
  }: TextFieldProps,
  ref: ForwardedRef<HTMLDivElement>,
)

Source from the content-addressed store, hash-verified

50}
51
52function TextFieldComponent(
53 {
54 className = {},
55 inputId,
56 name,
57 label,
58 maxLength,
59 showMaxLength = true,
60 value,
61 saveHintSpace = false,
62 progress,
63 hint,
64 hintIcon,
65 valid,
66 validityChanged,
67 valueChanged,
68 placeholder,
69 style,
70 fieldType = 'primary',
71 fieldSize,
72 variant = FieldVariant.Filled,
73 isLocked,
74 readOnly = isLocked,
75 leftIcon,
76 actionButton,
77 disabled,
78 rightIcon,
79 required,
80 pressed,
81 onBlur: onExternalBlur,
82 focused: focusedProp,
83 inputRef: inputRefProp,
84 ...props
85 }: TextFieldProps,
86 ref: ForwardedRef<HTMLDivElement>,
87): ReactElement {
88 const {
89 validInput,
90 focused: focusedHook,
91 hasInput,
92 focusInput,
93 inputRef,
94 onFocus,
95 onBlur,
96 onInput,
97 inputLength,
98 } = useInputFieldFunctions({
99 value,
100 valueChanged,
101 valid,
102 validityChanged,
103 });
104 const focused = focusedProp || focusedHook;
105 const isPrimaryField = fieldType === 'primary';
106 const isSecondaryField = fieldType === 'secondary';
107 const isTertiaryField = fieldType === 'tertiary';
108 const invalid = validInput === false || (required && inputLength === 0);
109 const hasValue = hasInput || !!inputRef?.current?.value?.length;

Callers

nothing calls this directly

Calls 7

getFieldFontColorFunction · 0.90
getFieldLabelColorFunction · 0.90
getFieldPlaceholderFunction · 0.90
useInputFieldFunctionsFunction · 0.85
withIconSizeFunction · 0.85
onBlurFunction · 0.50
onInputFunction · 0.50

Tested by

no test coverage detected