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

Function PlacementControl

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

Source from the content-addressed store, hash-verified

1443}
1444
1445function PlacementControl({control, value, onChange}) {
1446 return (
1447 <Wrapper control={control} styles={style({gridColumnStart: 1, gridColumnEnd: -1})}>
1448 <ListBox
1449 aria-label={control.name}
1450 layout="grid"
1451 selectionMode="single"
1452 disallowEmptySelection
1453 selectedKeys={[value]}
1454 onSelectionChange={keys => onChange([...keys][0])}
1455 className={style({
1456 gridTemplateColumns: [25, 24, 24, 25, 24],
1457 gridTemplateRows: [25, 24, 24, 25, 24]
1458 })}
1459 style={{
1460 display: 'grid',
1461 gridTemplateAreas: `
1462 ". ts tc te . "
1463 "st . . . et"
1464 "sc . . . ec"
1465 "sb . . . eb"
1466 ". bs bc be . "
1467 `
1468 }}>
1469 <PlacementControlItem id="top start" style={{gridArea: 'ts'}} />
1470 <PlacementControlItem id="top" style={{gridArea: 'tc'}} />
1471 <PlacementControlItem id="top end" style={{gridArea: 'te'}} />
1472 <PlacementControlItem id="start top" style={{gridArea: 'st'}} />
1473 <PlacementControlItem id="end top" style={{gridArea: 'et'}} />
1474 <PlacementControlItem id="start" style={{gridArea: 'sc'}} />
1475 <PlacementControlItem id="end" style={{gridArea: 'ec'}} />
1476 <PlacementControlItem id="start bottom" style={{gridArea: 'sb'}} />
1477 <PlacementControlItem id="end bottom" style={{gridArea: 'eb'}} />
1478 <PlacementControlItem id="bottom start" style={{gridArea: 'bs'}} />
1479 <PlacementControlItem id="bottom" style={{gridArea: 'bc'}} />
1480 <PlacementControlItem id="bottom end" style={{gridArea: 'be'}} />
1481 </ListBox>
1482 </Wrapper>
1483 );
1484}
1485
1486function PlacementControlItem(props) {
1487 return (

Callers

nothing calls this directly

Calls 1

onChangeFunction · 0.70

Tested by

no test coverage detected