MCPcopy Create free account
hub / github.com/adobe/react-spectrum / DurationControl

Function DurationControl

packages/dev/s2-docs/src/VisualExampleClient.tsx:1367–1392  ·  view source on GitHub ↗
({control, value, onChange}: ControlProps)

Source from the content-addressed store, hash-verified

1365}
1366
1367function DurationControl({control, value, onChange}: ControlProps) {
1368 let key = Object.keys(value)[0];
1369 return (
1370 <Wrapper control={control} styles={style({gridColumnStart: 1, gridColumnEnd: -1})}>
1371 <div
1372 className={style({display: 'flex', flexDirection: 'column', gap: 4, width: controlWidth})}>
1373 <NumberField
1374 aria-label={control.name}
1375 placeholder="–"
1376 contextualHelp={<PropContextualHelp control={control} />}
1377 value={value[key]}
1378 minValue={1}
1379 onChange={value => onChange({[key]: value})}
1380 />
1381 <Picker
1382 aria-label={`${control.name} unit`}
1383 value={key}
1384 onChange={k => onChange({[String(k)]: value[key]})}>
1385 <PickerItem id="days">Days</PickerItem>
1386 <PickerItem id="weeks">Weeks</PickerItem>
1387 <PickerItem id="months">Months</PickerItem>
1388 </Picker>
1389 </div>
1390 </Wrapper>
1391 );
1392}
1393
1394function ChannelControl({control, value, onChange}) {
1395 let {props} = useContext(Context);

Callers

nothing calls this directly

Calls 2

StringFunction · 0.85
onChangeFunction · 0.70

Tested by

no test coverage detected