Plan step 35: <x-surface level padding corner outlined>, a tonal region in surface or a surface-container step, padded with a spacing token, rounded with a corner token and optionally edged in outline-variant. A pane on a surface keeps its margin again, since the surface is a new edge. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
49 lines
2.4 KiB
PHP
49 lines
2.4 KiB
PHP
{{-- A tonal region: M3's surface, or a step of its surface containers.
|
|
|
|
<x-surface level="surface-container-low" padding="space300" corner="lg" outlined>…</x-surface>
|
|
|
|
`level` is the colour role it is filled with: `surface`, `surface-dim`, `surface-bright`,
|
|
`surface-container-lowest`, `surface-container-low`, `surface-container` (the default),
|
|
`surface-container-high` or `surface-container-highest`; the text on it is `on-surface`
|
|
(docs/reference/m3/styles.md § Color). Higher steps read as nearer, which is how M3 sets
|
|
regions apart without a shadow. An unknown level is the default.
|
|
|
|
`padding` is a spacing token's name, `space25` … `space900`
|
|
(docs/reference/m3/styles-supplement.md § Spacing); anything else is no padding. `corner` is a
|
|
corner token, `none`, `xs`, `sm`, `md`, `lg`, `lg-increased`, `xl`, `xl-increased`, `xxl` or
|
|
`full` (resources/css/tokens/shape.css); anything else leaves it square. `outlined` draws
|
|
the 1dp outline-variant edge.
|
|
|
|
Like every layout component it takes `as` (the element, `div` by default: `section`,
|
|
`article`, `aside` …) and `hide-below` / `hide-from` (`medium`, `expanded`, `large` or
|
|
`extra-large`), and the caller's `class` and `style` land on it untouched. Drawn by
|
|
resources/css/layout/surface.css; the props are read in src/Support/Layout.php. --}}
|
|
|
|
@props([
|
|
'as' => null,
|
|
'level' => null,
|
|
'padding' => null,
|
|
'corner' => null,
|
|
'outlined' => false,
|
|
'hideBelow' => null,
|
|
'hideFrom' => null,
|
|
])
|
|
|
|
@php
|
|
$layout = \NoNameWeb\LivewireMaterial\Support\Layout::class;
|
|
$element = $layout::element($as);
|
|
|
|
$attributes = $attributes->merge(array_filter([
|
|
'data-md-surface' => true,
|
|
'data-md-level' => $layout::choice($level, [
|
|
'surface', 'surface-dim', 'surface-bright', 'surface-container-lowest', 'surface-container-low',
|
|
'surface-container', 'surface-container-high', 'surface-container-highest',
|
|
], 'surface-container'),
|
|
'data-md-padding' => $layout::spacing($padding),
|
|
'data-md-corner' => $layout::choice($corner, ['none', 'xs', 'sm', 'md', 'lg', 'lg-increased', 'xl', 'xl-increased', 'xxl', 'full']),
|
|
'data-md-outlined' => $outlined ? true : null,
|
|
] + $layout::visibility($hideBelow, $hideFrom), fn ($value): bool => $value !== null));
|
|
@endphp
|
|
|
|
<{{ $element }} {{ $attributes }}>{{ $slot }}</{{ $element }}>
|