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

Function DurationControl

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

StringFunction · 0.85
onChangeFunction · 0.70

Tested by

no test coverage detected