({control, value, onChange}: ControlProps)
| 1092 | } |
| 1093 | |
| 1094 | function ChildrenControl({control, value, onChange}: ControlProps) { |
| 1095 | if (control.slots) { |
| 1096 | let objectValue = typeof value === 'string' ? {text: value} : value; |
| 1097 | return ( |
| 1098 | <Wrapper control={control} styles={style({gridColumnStart: 1, gridColumnEnd: -1})}> |
| 1099 | <div className={style({display: 'flex', flexDirection: 'column', rowGap: 4})}> |
| 1100 | {control.slots.icon && ( |
| 1101 | <div className={style({display: 'flex', columnGap: 4})}> |
| 1102 | <TextField |
| 1103 | aria-label={control.name} |
| 1104 | placeholder="–" |
| 1105 | value={objectValue?.text || ''} |
| 1106 | onChange={text => onChange({...objectValue, text})} |
| 1107 | styles={style({width: 80, flexGrow: 1})} |
| 1108 | /> |
| 1109 | <Suspense fallback={<ActionButton isPending>No icon</ActionButton>}> |
| 1110 | <IconPicker value={value} onChange={onChange} /> |
| 1111 | </Suspense> |
| 1112 | </div> |
| 1113 | )} |
| 1114 | {(control.slots.avatar || control.slots.badge) && ( |
| 1115 | <ToggleButtonGroup density="compact" isJustified> |
| 1116 | {control.slots.avatar && ( |
| 1117 | <ToggleButton |
| 1118 | isSelected={objectValue?.avatar ?? false} |
| 1119 | onChange={avatar => onChange({...objectValue, avatar})}> |
| 1120 | Avatar |
| 1121 | </ToggleButton> |
| 1122 | )} |
| 1123 | {control.slots.badge && ( |
| 1124 | <ToggleButton |
| 1125 | isSelected={objectValue?.badge ?? false} |
| 1126 | onChange={badge => onChange({...objectValue, badge})}> |
| 1127 | Badge |
| 1128 | </ToggleButton> |
| 1129 | )} |
| 1130 | </ToggleButtonGroup> |
| 1131 | )} |
| 1132 | </div> |
| 1133 | </Wrapper> |
| 1134 | ); |
| 1135 | } |
| 1136 | |
| 1137 | return <StringControl control={control} value={value} onChange={onChange} />; |
| 1138 | } |
| 1139 | |
| 1140 | // https://github.com/unicode-org/cldr/blob/22af90ae3bb04263f651323ce3d9a71747a75ffb/common/supplemental/supplementalData.xml#L4649-L4664 |
| 1141 | const preferences = [ |
nothing calls this directly
no test coverage detected