Hook for provider components (e.g. Box, Card) to resolve and provide bg context.
Resolution rules:
bg is undefined -- transparent, no context change, returns { bg: undefined }.
This is the default for Box, Flex, and Grid (they do not auto-increment).
bg is a ContainerBg value -- uses that value directly (e.g. 'neutral-1').
bg is 'neutral-auto' -- increments the neutral level from the parent context,
capping at neutral-3. Only components that explicitly pass 'neutral-auto'
(e.g. Card) will auto-increment; it is never implicit.
Capping:
Provider components cap at neutral-3. The neutral-4 level is not a valid
prop value -- it exists only in consumer component CSS (e.g. a Button on a
neutral-3 surface renders with neutral-4 tokens via data-on-bg).
The caller is responsible for wrapping children with BgProvider when the
resolved bg is defined.
Hook for provider components (e.g. Box, Card) to resolve and provide bg context.
Resolution rules:
bgisundefined-- transparent, no context change, returns{ bg: undefined }. This is the default for Box, Flex, and Grid (they do not auto-increment).bgis aContainerBgvalue -- uses that value directly (e.g.'neutral-1').bgis'neutral-auto'-- increments the neutral level from the parent context, capping atneutral-3. Only components that explicitly pass'neutral-auto'(e.g. Card) will auto-increment; it is never implicit.Capping:
Provider components cap at
neutral-3. Theneutral-4level is not a valid prop value -- it exists only in consumer component CSS (e.g. a Button on aneutral-3surface renders withneutral-4tokens viadata-on-bg).The caller is responsible for wrapping children with
BgProviderwhen the resolved bg is defined.