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

Function PlacementControl

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

Source from the content-addressed store, hash-verified

1426}
1427
1428function PlacementControl({control, value, onChange}) {
1429 return (
1430 <Wrapper control={control} styles={style({gridColumnStart: 1, gridColumnEnd: -1})}>
1431 <ListBox
1432 aria-label={control.name}
1433 layout="grid"
1434 selectionMode="single"
1435 disallowEmptySelection
1436 selectedKeys={[value]}
1437 onSelectionChange={keys => onChange([...keys][0])}
1438 className={style({
1439 gridTemplateColumns: [25, 24, 24, 25, 24],
1440 gridTemplateRows: [25, 24, 24, 25, 24]
1441 })}
1442 style={{
1443 display: 'grid',
1444 gridTemplateAreas: `
1445 ". ts tc te . "
1446 "st . . . et"
1447 "sc . . . ec"
1448 "sb . . . eb"
1449 ". bs bc be . "
1450 `
1451 }}>
1452 <PlacementControlItem id="top start" style={{gridArea: 'ts'}} />
1453 <PlacementControlItem id="top" style={{gridArea: 'tc'}} />
1454 <PlacementControlItem id="top end" style={{gridArea: 'te'}} />
1455 <PlacementControlItem id="start top" style={{gridArea: 'st'}} />
1456 <PlacementControlItem id="end top" style={{gridArea: 'et'}} />
1457 <PlacementControlItem id="start" style={{gridArea: 'sc'}} />
1458 <PlacementControlItem id="end" style={{gridArea: 'ec'}} />
1459 <PlacementControlItem id="start bottom" style={{gridArea: 'sb'}} />
1460 <PlacementControlItem id="end bottom" style={{gridArea: 'eb'}} />
1461 <PlacementControlItem id="bottom start" style={{gridArea: 'bs'}} />
1462 <PlacementControlItem id="bottom" style={{gridArea: 'bc'}} />
1463 <PlacementControlItem id="bottom end" style={{gridArea: 'be'}} />
1464 </ListBox>
1465 </Wrapper>
1466 );
1467}
1468
1469function PlacementControlItem(props) {
1470 return (

Callers

nothing calls this directly

Calls 1

onChangeFunction · 0.70

Tested by

no test coverage detected