From 1ca6d494acf545a233fc3442839a0fa572319ce0 Mon Sep 17 00:00:00 2001 From: Adam Kudrna Date: Fri, 29 Sep 2023 18:09:33 +0200 Subject: [PATCH] fixup! Feat(web): WIP placement --- .../scss/components/Dropdown/_Dropdown.scss | 55 +----- .../src/scss/components/Dropdown/_theme.scss | 2 + .../src/scss/components/Dropdown/index.html | 8 +- .../src/scss/components/Tooltip/_Tooltip.scss | 42 ++--- .../src/scss/components/Tooltip/_theme.scss | 3 + .../web/src/scss/settings/_dictionaries.scss | 10 +- .../web/src/scss/tools/_dictionaries.scss | 6 +- packages/web/src/scss/tools/_placement.scss | 158 +++++++++++------- packages/web/src/scss/tools/_string.scss | 9 +- 9 files changed, 142 insertions(+), 151 deletions(-) diff --git a/packages/web/src/scss/components/Dropdown/_Dropdown.scss b/packages/web/src/scss/components/Dropdown/_Dropdown.scss index 38614e4672..b66ec33536 100644 --- a/packages/web/src/scss/components/Dropdown/_Dropdown.scss +++ b/packages/web/src/scss/components/Dropdown/_Dropdown.scss @@ -1,5 +1,6 @@ @use 'sass:map'; @use '../../tools/breakpoint'; +@use '../../tools/dictionaries'; @use '../../tools/placement'; @use 'theme' as theme; @@ -28,62 +29,22 @@ display: block; } -// Placement: top -.Dropdown--top { - @include placement.top-center($offset: theme.$offset); -} +@include dictionaries.generate-placements('Dropdown', theme.$placement-dictionary, $offset: theme.$offset); -.Dropdown--topLeft, +// @deprecated The class combination will be removed in the next major version. +// Migration: delete all class combinations below. .Dropdown--top.Dropdown--left { - // @deprecated The class combination will be removed in the next major version. - @include placement.top-left($offset: theme.$offset); + @include placement.variant('top-left', $offset: theme.$offset); } -.Dropdown--topRight, .Dropdown--top.Dropdown--right { - // @deprecated The class combination will be removed in the next major version. - @include placement.top-right($offset: theme.$offset); -} - -// Placement: bottom -.Dropdown--bottom { - @include placement.bottom-center($offset: theme.$offset); + @include placement.variant('top-right', $offset: theme.$offset); } -.Dropdown--bottomLeft, .Dropdown--bottom.Dropdown--left { - // @deprecated The class combination will be removed in the next major version. - @include placement.bottom-left($offset: theme.$offset); + @include placement.variant('bottom-left', $offset: theme.$offset); } -.Dropdown--bottomRight, .Dropdown--bottom.Dropdown--right { - // @deprecated The class combination will be removed in the next major version. - @include placement.bottom-right($offset: theme.$offset); -} - -// Placement: left -.Dropdown--left { - @include placement.left-center($offset: theme.$offset); -} - -.Dropdown--leftTop { - @include placement.left-top($offset: theme.$offset); -} - -.Dropdown--leftBottom { - @include placement.left-bottom($offset: theme.$offset); -} - -// Placement: right -.Dropdown--right { - @include placement.right-center($offset: theme.$offset); -} - -.Dropdown--rightTop { - @include placement.right-top($offset: theme.$offset); -} - -.Dropdown--rightBottom { - @include placement.right-bottom($offset: theme.$offset); + @include placement.variant('bottom-right', $offset: theme.$offset); } diff --git a/packages/web/src/scss/components/Dropdown/_theme.scss b/packages/web/src/scss/components/Dropdown/_theme.scss index 451c44c51f..e623ec67c2 100644 --- a/packages/web/src/scss/components/Dropdown/_theme.scss +++ b/packages/web/src/scss/components/Dropdown/_theme.scss @@ -1,4 +1,5 @@ @use '@tokens' as tokens; +@use '../../settings/dictionaries'; $breakpoints: tokens.$breakpoints; $offset: tokens.$space-400; @@ -6,3 +7,4 @@ $padding: tokens.$space-600; $border-radius: tokens.$radius-200; $background: tokens.$background-basic; $shadow: tokens.$shadow-100; +$placement-dictionary: dictionaries.$placement; diff --git a/packages/web/src/scss/components/Dropdown/index.html b/packages/web/src/scss/components/Dropdown/index.html index 86f7b13a09..53786e22b8 100644 --- a/packages/web/src/scss/components/Dropdown/index.html +++ b/packages/web/src/scss/components/Dropdown/index.html @@ -13,7 +13,7 @@

Basic usage with default align

> Button as anchor -