()
| 776 | const hasFieldsAbove = scrollWindow.start > 0; |
| 777 | const hasFieldsBelow = scrollWindow.end < schemaFields.length; |
| 778 | function renderFormFields(): React.ReactNode { |
| 779 | if (!schemaFields.length) return null; |
| 780 | return <Box flexDirection="column"> |
| 781 | {hasFieldsAbove && <Box marginLeft={2}> |
| 782 | <Text dimColor> |
| 783 | {figures.arrowUp} {scrollWindow.start} more above |
| 784 | </Text> |
| 785 | </Box>} |
| 786 | {schemaFields.slice(scrollWindow.start, scrollWindow.end).map((field_0, visibleIdx) => { |
| 787 | const index_0 = scrollWindow.start + visibleIdx; |
| 788 | const { |
| 789 | name: name_1, |
| 790 | schema: schema_6, |
| 791 | isRequired |
| 792 | } = field_0; |
| 793 | const isActive = index_0 === currentFieldIndex && !focusedButton; |
| 794 | const value_3 = formValues[name_1]; |
| 795 | const hasValue = value_3 !== undefined && (!Array.isArray(value_3) || value_3.length > 0); |
| 796 | const error_0 = validationErrors[name_1]; |
| 797 | |
| 798 | // Checkbox: spinner → ⚠ error → ✔ set → * required → space |
| 799 | const isResolving = resolvingFields.has(name_1); |
| 800 | const checkbox = isResolving ? <ResolvingSpinner /> : error_0 ? <Text color="error">{figures.warning}</Text> : hasValue ? <Text color="success" dimColor={!isActive}> |
| 801 | {figures.tick} |
| 802 | </Text> : isRequired ? <Text color="error">*</Text> : <Text> </Text>; |
| 803 | |
| 804 | // Selection color matches field status |
| 805 | const selectionColor = error_0 ? 'error' : hasValue ? 'success' : isRequired ? 'error' : 'suggestion'; |
| 806 | const activeColor = isActive ? selectionColor : undefined; |
| 807 | const label = <Text color={activeColor} bold={isActive}> |
| 808 | {schema_6.title || name_1} |
| 809 | </Text>; |
| 810 | |
| 811 | // Render the value portion based on field type |
| 812 | let valueContent: React.ReactNode; |
| 813 | let accordionContent: React.ReactNode = null; |
| 814 | if (isMultiSelectEnumSchema(schema_6)) { |
| 815 | const msValues_0 = getMultiSelectValues(schema_6); |
| 816 | const selected_1 = value_3 as string[] | undefined ?? []; |
| 817 | const isExpanded = expandedAccordion === name_1 && isActive; |
| 818 | if (isExpanded) { |
| 819 | valueContent = <Text dimColor>{figures.triangleDownSmall}</Text>; |
| 820 | accordionContent = <Box flexDirection="column" marginLeft={6}> |
| 821 | {msValues_0.map((optVal, optIdx) => { |
| 822 | const optLabel = getMultiSelectLabel(schema_6, optVal); |
| 823 | const isChecked = selected_1.includes(optVal); |
| 824 | const isFocused = optIdx === accordionOptionIndex; |
| 825 | return <Box key={optVal} gap={1}> |
| 826 | <Text color="suggestion"> |
| 827 | {isFocused ? figures.pointer : ' '} |
| 828 | </Text> |
| 829 | <Text color={isChecked ? 'success' : undefined}> |
| 830 | {isChecked ? figures.checkboxOn : figures.checkboxOff} |
| 831 | </Text> |
| 832 | <Text color={isFocused ? 'suggestion' : undefined} bold={isFocused}> |
| 833 | {optLabel} |
| 834 | </Text> |
| 835 | </Box>; |
no test coverage detected