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

Function PlacementControl

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

onChangeFunction · 0.70

Tested by

no test coverage detected