Skip to content

Commit

Permalink
feat(styles): introduce BTP Search field component [ci visual] (#4729)
Browse files Browse the repository at this point in the history
* feat(styles): introduce BTP Search field component [ci visual]

* feat(styles): address PR review comments [ci visual]
  • Loading branch information
InnaAtanasova authored Aug 2, 2023
1 parent c13730f commit 579d1de
Show file tree
Hide file tree
Showing 30 changed files with 449 additions and 7 deletions.
12 changes: 7 additions & 5 deletions packages/styles/src/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,15 @@ $fd-button-badge-spacing: 0.25rem;
}

@include fd-active() {
--fdButton_ToolHeader_Background: var(--sapActiveColor);
--fdButton_ToolHeader_Background: var(--fdButton_ToolHeader_Background_Active);
--fdButton_ToolHeader_Border_Color: var(--fdButton_ToolHeader_Border_Color_Active);
--fdButton_ToolHeader_Color: var(--fdButton_ToolHeader_Color_Active);

outline: none;

@include fd-focus() {
--fdButton_ToolHeader_Border_Radius: 0.375rem;
--fdButton_ToolHeader_Background: var(--sapActiveColor);
--fdButton_ToolHeader_Background: var(--fdButton_ToolHeader_Background_Active);
--fdButton_ToolHeader_Border_Color: var(--fdButton_ToolHeader_Border_Color_Active);

outline: none;
Expand Down Expand Up @@ -300,14 +301,15 @@ $fd-button-badge-spacing: 0.25rem;
}

@include fd-active() {
--fdButton_Nested_Background: var(--sapActiveColor);
--fdButton_Nested_Background: var(--fdButton_Nested_Background_Active);
--fdButton_Nested_Border_Color: var(--fdButton_Nested_Border_Color_Active);
--fdButton_Nested_Color: var(--fdButton_Nested_Color_Active);

outline: none;

@include fd-focus() {
--fdButton_Nested_Border_Radius: 0.75rem;
--fdButton_Nested_Background: var(--sapActiveColor);
--fdButton_Nested_Background: var(--fdButton_Nested_Background_Active);
--fdButton_Nested_Border_Color: var(--fdButton_Nested_Border_Color_Active);

outline: none;
Expand All @@ -319,7 +321,7 @@ $fd-button-badge-spacing: 0.25rem;
}

@include fd-focus() {
--fdButton_Nested_Background: var(--sapButton_Background);
--fdButton_Nested_Background: var(--fdButton_Nested_Background_Focus);
--fdButton_Nested_Border_Color: var(--fdButton_Nested_Border_Color_Focus);
--fdButton_Nested_Border_Radius: var(--fdButton_Nested_Border_Radius_Focus);

Expand Down
1 change: 1 addition & 0 deletions packages/styles/src/fundamental-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
@import "rating-indicator";
@import "resizable-card-layout";
@import "scrollbar";
@import "search-field";
@import "section";
@import "segmented-button";
@import "select";
Expand Down
199 changes: 199 additions & 0 deletions packages/styles/src/search-field.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
@import "./new-settings";
@import "./mixins";

$block: #{$fd-namespace}-search-field;
$blockUnderline: #{$fd-namespace}-search-field__underline;
$blockActions: #{$fd-namespace}-search-field__actions;

.#{$block} {
// Search Field
--fdSearchField_Height: 2.5rem;
--fdSearchField_Height_Compact: 2rem;
--fdSearchField_Height_Border: calc(var(--fdSearchField_Height) - 0.125rem);
--fdSearchField_Border_Radius: 2rem;
--fdSearchField_Padding: 0.625rem;
--fdSearchField_Padding_Compact: 0.5rem;
--fdSearchField_Box_Shadow: var(--sapField_Shadow);
--fdSearchField_Background: var(--sapShell_InteractiveBackground);
--fdSearchField_Color: var(--sapShell_TextColor);

// Search Field Icon
--fdSearchField_Icon_Size: 1rem;
--fdSearchField_Icon_Size_Offset: 0.375rem;

// Actions
--fdSearchField_Actions_Offset: 0.25rem;
--fdSearchField_Actions_Offset_Compact: 0.1875rem;

// Actions Button
--fdSearchField_Action_Container_Size: 2rem;
--fdSearchField_Action_Container_Size_Compact: 1.625rem;
--fdSearchField_Clear_Button_Display: none;

// Search Field Input Padding Left Calculations
--fdSearchField_Padding_Left: calc(var(--fdSearchField_Padding) + var(--fdSearchField_Icon_Size) + var(--fdSearchField_Icon_Size_Offset));
--fdSearchField_Padding_Left_Compact: calc(var(--fdSearchField_Padding_Compact) + var(--fdSearchField_Icon_Size) + var(--fdSearchField_Icon_Size_Offset));

// Search Field Input Padding Right Calculations
--fdSearchField_Padding_Right: calc(var(--fdSearchField_Action_Container_Size) + var(--fdSearchField_Actions_Offset));
--fdSearchField_Padding_Right_Compact: calc(var(--fdSearchField_Action_Container_Size_Compact) + var(--fdSearchField_Actions_Offset_Compact));
--fdSearchField_Padding_Right_Typed: calc(2 * var(--fdSearchField_Padding_Right));
--fdSearchField_Padding_Right_Typed_Compact: calc(2 * var(--fdSearchField_Padding_Right_Compact));

@include fd-reset();
@include fd-flex-vertical-center();
@include fd-set-height(var(--fdSearchField_Height));

position: relative;
width: 16rem;
border-radius: var(--fdSearchField_Border_Radius);
border: 0.0625rem solid var(--fdSearchField_Border_Color);

&__icon {
@include fd-set-square(1rem);
@include fd-set-position-left(var(--fdSearchField_Padding));

@include fd-icon-selector() {
@include fd-flex-center();

font-size: 1rem;
}

z-index: 10;
position: absolute;
color: var(--sapContent_NonInteractiveIconColor);
}

&__input {
@include fd-reset();
@include fd-set-height(var(--fdSearchField_Height_Border));
@include fd-set-paddings-x(var(--fdSearchField_Padding_Left), var(--fdSearchField_Padding_Right));
@include fd-set-paddings-y-equal(var(--fdSearchField_Padding));

z-index: 1;
width: 16rem;
border-radius: var(--fdSearchField_Border_Radius);
background: var(--fdSearchField_Background);
box-shadow: var(--fdSearchField_Box_Shadow);
color: var(--fdSearchField_Color);

&::placeholder {
font-family: var(--sapFontFamily);
font-size: var(--sapFontSize);
font-style: italic;
font-weight: normal;
line-height: 1rem;
}

&::-webkit-search-decoration,
&::-webkit-search-cancel-button,
&::-webkit-search-results-button,
&::-webkit-search-results-decoration {
-webkit-appearance: none;
}

&:not(:placeholder-shown) {
--fdSearchField_Padding_Right: calc(2 * (var(--fdSearchField_Action_Container_Size) + var(--fdSearchField_Actions_Offset)));
--fdSearchField_Background: var(--fdSearchField_Background_Focus);
--fdSearchField_Box_Shadow: var(--sapSearchHover_Shadow);

@include fd-compact-and-condensed() {
--fdSearchField_Padding_Right: var(--fdSearchField_Padding_Right_Typed_Compact);
}

& + .#{$blockUnderline} {
display: none;
}

& ~ .#{$blockActions} {
--fdSearchField_Clear_Button_Display: inline-flex;
}

@include fd-focus() {
--fdSearchField_Box_Shadow: var(--sapSearchHover_Shadow);

outline: none;
}
}

@include fd-hover() {
--fdSearchField_Background: var(--fdSearchField_Background_Hover);
--fdSearchField_Box_Shadow: var(--sapSearchHover_Shadow);

& + .#{$blockUnderline} {
display: none;
}
}

@include fd-focus() {
--fdSearchField_Background: var(--fdSearchField_Background_Focus);
--fdSearchField_Border_Color: transparent;
--fdSearchField_Box_Shadow: none;

outline: var(--fdSearchField_Outline);

& + .#{$blockUnderline} {
display: none;
}
}
}

&__underline {
@include fd-reset();

width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
border-radius: var(--fdSearchField_Border_Radius);

&::after {
bottom: 0;
content: "";
z-index: 30;
width: 100%;
height: 0.0625rem;
position: absolute;
background: var(--fdSearchField_Underline_Color);
}
}

&__actions {
@include fd-reset();
@include fd-flex-vertical-center();
@include fd-set-position-right(var(--fdSearchField_Actions_Offset));

z-index: 10;
height: 100%;
position: absolute;

button {
@include fd-disabled () {
opacity: 1;
}
}
}

&__action-container {
@include fd-reset();
@include fd-flex-center();
@include fd-set-square(var(--fdSearchField_Action_Container_Size));

&:first-child {
display: var(--fdSearchField_Clear_Button_Display);
}

button {
--fdButton_Nested_Color: var(--sapShell_TextColor);
}
}

@include fd-compact-and-condensed() {
--fdSearchField_Height: var(--fdSearchField_Height_Compact);
--fdSearchField_Padding: var(--fdSearchField_Padding_Compact);
--fdSearchField_Actions_Offset: var(--fdSearchField_Actions_Offset_Compact);
--fdSearchField_Action_Container_Size: var(--fdSearchField_Action_Container_Size_Compact);
--fdSearchField_Padding_Left: var(--fdSearchField_Padding_Left_Compact);
--fdSearchField_Padding_Right: var(--fdSearchField_Padding_Right_Compact);
}
}
10 changes: 8 additions & 2 deletions packages/styles/src/theming/common/button/_sap_fiori.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,23 @@
--fdButton_Menu_Transparent_Separator_Display: block;

/** Tool Header */
--fdButton_ToolHeader_Color_Active: var(--sapButton_Active_TextColor);
--fdButton_ToolHeader_Background_Active: var(--sapButton_Lite_Active_Background);
--fdButton_ToolHeader_Background_Focus: var(--sapButton_Lite_Background);
--fdButton_ToolHeader_Border_Color_Normal: transparent;
--fdButton_ToolHeader_Border_Color_Hover: transparent;
--fdButton_ToolHeader_Border_Color_Hover: var(--sapButton_Lite_Hover_BorderColor);
--fdButton_ToolHeader_Border_Color_Active: transparent;
--fdButton_ToolHeader_Border_Color_Focus: transparent;
--fdButton_ToolHeader_Border_Color_Disabled: transparent;
--fdButton_ToolHeader_Border_Radius_Focus: 0.375rem;
--fdButton_ToolHeader_Badge_Border_Color: var(--sapShellColor);

/** Nested Button */
--fdButton_Nested_Color_Active: var(--sapButton_Active_TextColor);
--fdButton_Nested_Background_Active: var(--sapButton_Lite_Active_Background);
--fdButton_Nested_Background_Focus: var(--sapButton_Lite_Background);
--fdButton_Nested_Border_Color_Normal: transparent;
--fdButton_Nested_Border_Color_Hover: transparent;
--fdButton_Nested_Border_Color_Hover: var(--sapButton_Lite_Hover_BorderColor);
--fdButton_Nested_Border_Color_Active: transparent;
--fdButton_Nested_Border_Color_Focus: transparent;
--fdButton_Nested_Border_Color_Disabled: transparent;
Expand Down
6 changes: 6 additions & 0 deletions packages/styles/src/theming/common/button/_sap_horizon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
--fdButton_Menu_Transparent_Separator_Display: block;

/** Tool Header */
--fdButton_ToolHeader_Color_Active: var(--sapContent_IconColor);
--fdButton_ToolHeader_Background_Active: var(--sapActiveColor);
--fdButton_ToolHeader_Background_Focus: var(--sapButton_Background);
--fdButton_ToolHeader_Border_Color_Normal: transparent;
--fdButton_ToolHeader_Border_Color_Hover: transparent;
--fdButton_ToolHeader_Border_Color_Active: transparent;
Expand All @@ -50,6 +53,9 @@
--fdButton_ToolHeader_Badge_Border_Color: var(--sapShellColor);

/** Nested Button */
--fdButton_Nested_Color_Active: var(--sapContent_IconColor);
--fdButton_Nested_Background_Active: var(--sapActiveColor);
--fdButton_Nested_Background_Focus: var(--sapButton_Background);
--fdButton_Nested_Border_Color_Normal: transparent;
--fdButton_Nested_Border_Color_Hover: transparent;
--fdButton_Nested_Border_Color_Active: transparent;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:root {
--fdSearchField_Border_Color: transparent;
--fdSearchField_Background_Hover: var(--sapShell_Hover_Background);
--fdSearchField_Background_Focus: var(--sapShell_Active_Background);
--fdSearchField_Outline: var(--sapContent_FocusStyle) var(--sapContent_FocusWidth) var(--sapContent_FocusColor);
--fdSearchField_Underline_Color: var(--sapField_BorderColor);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:root {
--fdSearchField_Border_Color: var(--sapShell_BorderColor);
--fdSearchField_Background_Hover: var(--sapShellColor);
--fdSearchField_Background_Focus: var(--sapShellColor);
--fdSearchField_Outline: solid var(--sapContent_FocusWidth) var(--sapContent_FocusColor);
--fdSearchField_Underline_Color: transparent;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:root {
--fdSearchField_Border_Color: transparent;
--fdSearchField_Background_Hover: var(--sapShell_Hover_Background);
--fdSearchField_Background_Focus: var(--sapShell_Active_Background);
--fdSearchField_Outline: var(--sapContent_FocusStyle) var(--sapContent_FocusWidth) var(--sapContent_FocusColor);
--fdSearchField_Underline_Color: var(--sapField_BorderColor);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:root {
--fdSearchField_Border_Color: var(--sapShell_BorderColor);
--fdSearchField_Background_Hover: var(--sapShellColor);
--fdSearchField_Background_Focus: var(--sapShellColor);
--fdSearchField_Outline: solid var(--sapContent_FocusWidth) var(--sapContent_FocusColor);
--fdSearchField_Underline_Color: transparent;
}
1 change: 1 addition & 0 deletions packages/styles/src/theming/sap_fiori_3.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
@import "./common/tokenizer/sap_fiori";
@import "./common/notification/sap_fiori";
@import "./common/pagination/sap_fiori";
@import "./common/search-field/sap_fiori";
@import "./sap_fiori_3/css_variables";

:root {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@
--sapMenu_Shadow1: 0 0 0.125rem 0 rgba(0, 0, 0, 0.16), 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.16);
--sapMenu_Shadow2: 0 0 0.125rem 0 rgba(0, 0, 0, 0.48), 0 1rem 2rem 0 rgba(0, 0, 0, 0.16);
--sapNotifications_Shadow2: 0 0 0.125rem 0 rgba(0, 0, 0, 0.48), 0 1rem 2rem 0 rgba(0, 0, 0, 0.16);
--sapSearchHover_Shadow: 0 0 0.125rem 0 rgba(0, 0, 0, 0.16), 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.16);
}

.background-image--sapCompanyLogo {
Expand Down
1 change: 1 addition & 0 deletions packages/styles/src/theming/sap_fiori_3_dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
@import "./common/tokenizer/sap_fiori";
@import "./common/notification/sap_fiori";
@import "./common/pagination/sap_fiori";
@import "./common/search-field/sap_fiori";
@import "./sap_fiori_3_dark/css_variables";

:root {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@
--sapMenu_Shadow1: 0 0 0.125rem 0 rgba(0, 0, 0, 0.16), 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.32);
--sapMenu_Shadow2: 0 0 0.125rem 0 rgba(0, 0, 0, 0.48), 0 1rem 2rem 0 rgba(0, 0, 0, 0.64);
--sapNotifications_Shadow2: 0 0 0.125rem 0 rgba(0, 0, 0, 0.48), 0 1rem 2rem 0 rgba(0, 0, 0, 0.64);
--sapSearchHover_Shadow: 0 0 0.125rem 0 rgba(0, 0, 0, 0.16), 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.32), 0 0 0 0.0625rem rgba(134, 150, 169, 0.16);
}

.background-image--sapCompanyLogo {
Expand Down
1 change: 1 addition & 0 deletions packages/styles/src/theming/sap_fiori_3_hcb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
@import "./common/tokenizer/sap_fiori";
@import "./common/notification/sap_fiori_hc";
@import "./common/pagination/sap_fiori";
@import "./common/search-field/sap_fiori_hc";
@import "./sap_fiori_3_hcb/css_variables";

:root {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@
--sapMenu_Shadow1: 0 0 0 0.0625rem #fff, 0 0.5rem 1rem 0 rgba(255, 255, 255, 0.16);
--sapMenu_Shadow2: 0 0 0 0.0625rem #fff, 0 1rem 2rem 0 rgba(255, 255, 255, 0.16);
--sapNotifications_Shadow2: 0 0 0 0.0625rem #fff, 0 1rem 2rem 0 rgba(255, 255, 255, 0.16);
--sapSearchHover_Shadow: 0 0 0 0.0625rem #fff, 0 0.5rem 1rem 0 rgba(255, 255, 255, 0.16);
}

.background-image--sapCompanyLogo {
Expand Down
1 change: 1 addition & 0 deletions packages/styles/src/theming/sap_fiori_3_hcw.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
@import "./common/tokenizer/sap_fiori";
@import "./common/notification/sap_fiori_hc";
@import "./common/pagination/sap_fiori";
@import "./common/search-field/sap_fiori_hc";
@import "./common/step-input/sap_fiori";

:root {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@
--sapMenu_Shadow1: 0 0 0 0.0625rem #000, 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.16);
--sapMenu_Shadow2: 0 0 0 0.0625rem #000, 0 1rem 2rem 0 rgba(0, 0, 0, 0.16);
--sapNotifications_Shadow2: 0 0 0 0.0625rem #000, 0 1rem 2rem 0 rgba(0, 0, 0, 0.16);
--sapSearchHover_Shadow: 0 0 0 0.0625rem #000, 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.16);
}

.background-image--sapCompanyLogo {
Expand Down
Loading

0 comments on commit 579d1de

Please sign in to comment.