({control, value, onChange}: ControlProps)
| 1109 | } |
| 1110 | |
| 1111 | function ChildrenControl({control, value, onChange}: ControlProps) { |
| 1112 | if (control.slots) { |
| 1113 | let objectValue = typeof value === 'string' ? {text: value} : value; |
| 1114 | return ( |
| 1115 | <Wrapper control={control} styles={style({gridColumnStart: 1, gridColumnEnd: -1})}> |
| 1116 | <div className={style({display: 'flex', flexDirection: 'column', rowGap: 4})}> |
| 1117 | {control.slots.icon && ( |
| 1118 | <div className={style({display: 'flex', columnGap: 4})}> |
| 1119 | <TextField |
| 1120 | aria-label={control.name} |
| 1121 | placeholder="–" |
| 1122 | value={objectValue?.text || ''} |
| 1123 | onChange={text => onChange({...objectValue, text})} |
| 1124 | styles={style({width: 80, flexGrow: 1})} |
| 1125 | /> |
| 1126 | <Suspense fallback={<ActionButton isPending>No icon</ActionButton>}> |
| 1127 | <IconPicker value={value} onChange={onChange} /> |
| 1128 | </Suspense> |
| 1129 | </div> |
| 1130 | )} |
| 1131 | {(control.slots.avatar || control.slots.badge) && ( |
| 1132 | <ToggleButtonGroup density="compact" isJustified> |
| 1133 | {control.slots.avatar && ( |
| 1134 | <ToggleButton |
| 1135 | isSelected={objectValue?.avatar ?? false} |
| 1136 | onChange={avatar => onChange({...objectValue, avatar})}> |
| 1137 | Avatar |
| 1138 | </ToggleButton> |
| 1139 | )} |
| 1140 | {control.slots.badge && ( |
| 1141 | <ToggleButton |
| 1142 | isSelected={objectValue?.badge ?? false} |
| 1143 | onChange={badge => onChange({...objectValue, badge})}> |
| 1144 | Badge |
| 1145 | </ToggleButton> |
| 1146 | )} |
| 1147 | </ToggleButtonGroup> |
| 1148 | )} |
| 1149 | </div> |
| 1150 | </Wrapper> |
| 1151 | ); |
| 1152 | } |
| 1153 | |
| 1154 | return <StringControl control={control} value={value} onChange={onChange} />; |
| 1155 | } |
| 1156 | |
| 1157 | // https://github.com/unicode-org/cldr/blob/22af90ae3bb04263f651323ce3d9a71747a75ffb/common/supplemental/supplementalData.xml#L4649-L4664 |
| 1158 | const preferences = [ |
nothing calls this directly
no test coverage detected