diff --git a/resources/css/components.css b/resources/css/components.css index b0c6f689..ea00ad5f 100644 --- a/resources/css/components.css +++ b/resources/css/components.css @@ -20,6 +20,7 @@ @import './components/button-group.css'; @import './components/split-button.css'; @import './components/fab.css'; +@import './components/menu-separator.css'; /* Inputs, selection and data */ @import './components/form.css'; diff --git a/resources/css/components/menu-separator.css b/resources/css/components/menu-separator.css new file mode 100644 index 00000000..be08f926 --- /dev/null +++ b/resources/css/components/menu-separator.css @@ -0,0 +1,18 @@ +/* + * : a line between groups of items in a menu — 1px in `outline-variant`, with + * M3's 8px above and below it, inset to the 16px the items keep either side (M3's menu page: + * "dividers are more subtle and are the right choice for scrollable menus"; SegmentedMenuTokens' + * divider spacing). + */ + +@layer material.reset, material.tokens, material.base, material.layout, material.components, material.text, material.visibility; + +@layer material.components { + [data-md-menu-separator] { + block-size: 1px; + margin-block: var(--md-sys-measurement-space100); + margin-inline: var(--md-sys-measurement-space200); + border-width: 0; + background-color: var(--md-sys-color-outline-variant); + } +} diff --git a/resources/views/components/menu-separator.blade.php b/resources/views/components/menu-separator.blade.php index a0b6332c..790e30d2 100644 --- a/resources/views/components/menu-separator.blade.php +++ b/resources/views/components/menu-separator.blade.php @@ -1,4 +1,4 @@ {{-- A line between groups of items in an ``: 1px, with M3's 8px above and below it, inset - to the 16px the items keep either side. --}} + to the 16px the items keep either side. Drawn by resources/css/components/menu-separator.css. --}} -
class('mx-4 my-2 h-px border-0 bg-outline-variant') }} /> +
diff --git a/tests/Feature/Components/ActionStylesheetsTest.php b/tests/Feature/Components/ActionStylesheetsTest.php index 484d727d..540bc0a3 100644 --- a/tests/Feature/Components/ActionStylesheetsTest.php +++ b/tests/Feature/Components/ActionStylesheetsTest.php @@ -19,6 +19,7 @@ dataset('action components', [ 'button-group', 'split-button', 'fab', + 'menu-separator', ]); it('draws the component from a stylesheet shaped like every package stylesheet', function (string $name) { diff --git a/tests/Feature/Components/MenuTest.php b/tests/Feature/Components/MenuTest.php index e6da1bb7..da4a7cf7 100644 --- a/tests/Feature/Components/MenuTest.php +++ b/tests/Feature/Components/MenuTest.php @@ -1,5 +1,7 @@ blade(<<<'BLADE' @@ -68,7 +70,8 @@ it('makes a selectable item a menuitemcheckbox, ticked at its end', function () it('gives an item M3\'s 48px row and 16px sides, and the separator its 8px', function () { expect((string) $this->blade(''))->toContain('min-h-12')->toContain('px-4') - ->and((string) $this->blade(''))->toContain('mx-4 my-2') + ->and(trim((string) $this->blade('')))->toBe('
') + ->and(ComponentStylesheet::read('menu-separator')->declarations('[data-md-menu-separator]'))->toBe(['block-size' => '1px', 'margin-block' => 'var(--md-sys-measurement-space100)', 'margin-inline' => 'var(--md-sys-measurement-space200)', 'border-width' => '0', 'background-color' => 'var(--md-sys-color-outline-variant)']) ->and((string) $this->blade(''))->toContain('px-4 pt-2 pb-1'); });