@depict-ai/react-ui 2.1.7 → 2.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/ES10/index.cjs +1 -1
  2. package/ES10/index.d.ts +1 -1
  3. package/ES10/index.js +1 -1
  4. package/dist/main.js +527 -0
  5. package/dist/module.js +510 -0
  6. package/dist/styles/components/PLP/Buttons.scss +181 -0
  7. package/dist/styles/components/PLP/MorphingSign.scss +30 -0
  8. package/dist/styles/components/PLP/PLPResults.scss +26 -0
  9. package/dist/styles/components/PLP/ProductListingPage.scss +168 -0
  10. package/dist/styles/components/PLP/ScrollStatus.scss +31 -0
  11. package/dist/styles/components/PLP/SelectedFilters.scss +82 -0
  12. package/dist/styles/components/PLP/SlidableItems.scss +121 -0
  13. package/dist/styles/components/PLP/SortAndFilter/FloatingButtons.scss +84 -0
  14. package/dist/styles/components/PLP/SortAndFilter/SortAndFilter.scss +800 -0
  15. package/dist/styles/components/PLP/SortAndFilter/SortAndFilterModal.scss +158 -0
  16. package/dist/styles/components/PLP/SortAndFilter/WhiteSortAndFilter.scss +152 -0
  17. package/dist/styles/components/PLP/Toast.scss +59 -0
  18. package/dist/styles/components/PLP/index.scss +51 -0
  19. package/dist/styles/components/category/BreadCrumbs.scss +32 -0
  20. package/dist/styles/components/category/CategoryTitle.scss +40 -0
  21. package/dist/styles/components/category/QuickLinks.scss +80 -0
  22. package/dist/styles/components/category/index.scss +23 -0
  23. package/dist/styles/components/search/Autocomplete.scss +197 -0
  24. package/dist/styles/components/search/CategorySuggestions.scss +82 -0
  25. package/dist/styles/components/search/InstantCard.scss +122 -0
  26. package/dist/styles/components/search/InstantResults.scss +12 -0
  27. package/dist/styles/components/search/PreviousSearches.scss +90 -0
  28. package/dist/styles/components/search/QueryInput.scss +189 -0
  29. package/dist/styles/components/search/SearchModal.scss +101 -0
  30. package/dist/styles/components/search/SearchRecommendations.scss +28 -0
  31. package/dist/styles/components/search/ShowingResultsFor.scss +13 -0
  32. package/dist/styles/components/search/index.scss +40 -0
  33. package/dist/styles/default.css +1 -0
  34. package/dist/styles/helpers/custom_input.scss +194 -0
  35. package/dist/styles/helpers/supports-hover.scss +7 -0
  36. package/dist/styles/helpers/utils.scss +90 -0
  37. package/dist/styles/plain-css-fallback-styling.css +1 -1
  38. package/dist/styles/variables.scss +61 -0
  39. package/latest/index.cjs +1 -1
  40. package/latest/index.d.ts +1 -1
  41. package/latest/index.js +1 -1
  42. package/package.json +4 -4
  43. package/server/ES10/index.cjs +1 -1
  44. package/server/ES10/index.d.ts +1 -1
  45. package/server/ES10/index.js +1 -1
  46. package/server/latest/index.cjs +1 -1
  47. package/server/latest/index.d.ts +1 -1
  48. package/server/latest/index.js +1 -1
@@ -0,0 +1,197 @@
1
+ @use "../../variables";
2
+ @use "../../helpers/utils";
3
+ @use "PreviousSearches";
4
+ @use "../PLP/Buttons";
5
+ @use "sass:map";
6
+
7
+ /// Autocomplete is the component that displays suggested Categories and Products in the SearchModal, both under the "Suggestions" heading (i18n key `suggestions_`) when the customer hasn't typed anything, and once the customer has started typing.
8
+ /// It also includes previous searches inside of the suggestions provided from the API - when the user hasn't typed though, the PreviousSearches component is shown instead.
9
+ ///
10
+ /// ### Explanation of "entries without highlight" and "entries with highlight"
11
+ ///
12
+ /// When the user is typing in the input field, we show query and category suggestions from the API and suggestions from the previous searches of the user (which are saved in localStorage).
13
+ /// While the user is typing, we highlight the *new* parts of the query that we are suggesting (what the user hasn't typed). This only happens *if* the suggestion contains the query the user has typed.
14
+ ///
15
+ /// The most flexible yet simple way we could come up with to style this is by breaking it down as follows:
16
+ /// Note: "entry" refers to a suggestion from the API or a previous search.
17
+ /// <ol>
18
+ /// <li><b>Entries without highlight:</b><br />
19
+ /// This is the styling for the entries where nothing is highlighted. This is the case when the user hasn't typed anything yet, or when the suggestion doesn't contain the query the user has typed.</li>
20
+ /// <li><b>Entries with highlight:</b><br />
21
+ /// Something is highlighted in this suggestion. This is the case when the user has typed something and the suggestion contains the query the user has typed.
22
+ /// There are two things you can style here:
23
+ /// <ol><li><b>Highlighted part:</b><br />
24
+ /// The styling for the highlighted part of the suggestion.</li>
25
+ /// <li><b>Toned down part:</b><br />
26
+ /// The styling for the part of the suggestion that is not highlighted. This is the part of the suggestion that the user has already typed.</li></ol></li></ol>
27
+ ///
28
+ /// @param {Color} $background [white] background color on the individual suggestion items
29
+ /// @param {Color} $selected-background [#ffffff80] background color on the individual suggestion items when they are selected (hovered or selected by keyboard navigating (up/down arrows))
30
+ /// @param {Color} $icon-color [variables.$brand-black] - color of the clock, search and clear icon
31
+ /// @param {Number with size unit} $autocomplete-gap-between-items-in-row-mode [5px] - The vertical gap between the "list-style items", the individual suggestions that have the full width.
32
+ /// @param {Number with size unit} $autocomplete-gap-between-category-and-other [20px]- The vertical gap between the category and query suggestion sections
33
+ /// @param {Number with size unit} $autocomplete-gap-between-compact-suggestions [$autocomplete-gap-between-items-in-row-mode] - The horizontal gap between the individual query suggestions that show up in "compact" mode (multiple in the same row) when no query has been entered
34
+ /// @param {Color} $heading-color [variables.$brand-dark-grey] - The color of the heading of both the previous searches and the suggestions (all headings in the Autocomplete section)
35
+ /// @param {Number} $heading-font-weight [700] - The font weight of all headings in the Autocomplete section
36
+ /// @param {Map} $entries-without-highlight [("color": variables.$brand-dark-grey, "font-weight": 400)] - Map between *any* CSS property key to CSS value. The styling for the entries where nothing is highlighted, see the explanation above.
37
+ /// @param {Map} $entries-with-highlight [(
38
+ /// "highlighted-part": (
39
+ /// "color": variables.$brand-dark-grey,
40
+ /// "font-weight": 500
41
+ /// ),
42
+ /// "toned-down-part": (
43
+ /// "color": variables.$brand-dark-grey,
44
+ /// "font-weight": 400
45
+ /// )
46
+ /// )] - Map containing either "toned-down-part" which is a map and/or "highlighted-part" which is also a map. Both of the aforementioned maps can contain *any* CSS property key to CSS value. See the explanation above in the `Explanation of "entries without highlight" and "entries with highlight"`-section.
47
+ /// @example scss - Simple example adding a custom font for the highlighted part of the suggestions
48
+ /// @include search.Autocomplete(
49
+ /// $entries-with-highlight: (
50
+ /// "highlighted-part": (
51
+ /// "font-family": "Gotham Medium",
52
+ /// ),
53
+ /// )
54
+ /// );
55
+ /// @example scss - Example if having bold text doesn't fit your brand and you instead want to make what the user typed "light" but keep the rest "regular":
56
+ /// @include search.Autocomplete(
57
+ /// $entries-without-highlight: (
58
+ /// "font-weight": 400
59
+ /// ),
60
+ /// $entries-with-highlight: (
61
+ /// "highlighted-part": (
62
+ /// "font-weight": 400
63
+ /// ),
64
+ /// "toned-down-part": (
65
+ /// "font-weight": 300
66
+ /// )
67
+ /// )
68
+ /// );
69
+
70
+ @mixin Autocomplete(
71
+ $background: white,
72
+ $selected-background: #ffffff80,
73
+ $icon-color: variables.$brand-black,
74
+ $autocomplete-gap-between-items-in-row-mode: 5px,
75
+ $autocomplete-gap-between-category-and-other: 20px,
76
+ $autocomplete-gap-between-compact-suggestions: $autocomplete-gap-between-items-in-row-mode,
77
+ $heading-color: variables.$brand-dark-grey,
78
+ $heading-font-weight: 700,
79
+ $entries-without-highlight: (),
80
+ $entries-with-highlight: ()
81
+ ) {
82
+ $entries-without-highlight-defaults: (
83
+ "color": variables.$brand-dark-grey,
84
+ "font-weight": 400,
85
+ );
86
+ $entries-with-highlight-defaults: (
87
+ "highlighted-part": (
88
+ "color": variables.$brand-dark-grey,
89
+ "font-weight": 500,
90
+ ),
91
+ "toned-down-part": (
92
+ "color": variables.$brand-dark-grey,
93
+ "font-weight": 400,
94
+ ),
95
+ );
96
+ $merged-entries-without-highlight: map.merge($entries-without-highlight-defaults, $entries-without-highlight);
97
+ $merged-entries-with-highlight: map.merge($entries-with-highlight-defaults, $entries-with-highlight);
98
+ @include PreviousSearches.PreviousSearches(
99
+ $icon-color: $icon-color,
100
+ $item-color: map.get($merged-entries-without-highlight, "color"),
101
+ $gap-between-items: $autocomplete-gap-between-items-in-row-mode
102
+ );
103
+ .previous-searches,
104
+ .suggestions {
105
+ .text {
106
+ font-size: 16px;
107
+ font-weight: $heading-font-weight;
108
+ color: $heading-color;
109
+ margin-top: 0;
110
+ }
111
+ .item,
112
+ .suggestion {
113
+ background: $background;
114
+ &.selected {
115
+ background: $selected-background;
116
+ }
117
+
118
+ &:focus-visible {
119
+ outline: none;
120
+ filter: map.get(Buttons.get-secondary-button-properties(), "focus-visible-filter");
121
+ }
122
+ }
123
+ }
124
+ .suggestions {
125
+ display: flex;
126
+ flex-direction: column;
127
+ @include utils.flex-gap($autocomplete-gap-between-category-and-other, "column nowrap");
128
+
129
+ &:not(.compact) > .suggestion-container,
130
+ &.compact > .suggestion-container:not(.query) {
131
+ @include utils.flex-gap($autocomplete-gap-between-items-in-row-mode, "column nowrap");
132
+ }
133
+ .suggestion-container {
134
+ display: flex;
135
+ flex-direction: column;
136
+ .suggestion {
137
+ svg {
138
+ flex-shrink: 0;
139
+ }
140
+ display: flex;
141
+ justify-content: space-between;
142
+ overflow-wrap: anywhere;
143
+ align-items: center;
144
+ border-radius: variables.$border-radius;
145
+ @each $property, $value in $merged-entries-without-highlight {
146
+ #{$property}: $value;
147
+ }
148
+
149
+ padding: 10px 20px;
150
+
151
+ .search-icon {
152
+ max-width: 12px;
153
+ max-height: 13px;
154
+ svg {
155
+ transform: scale(0.6) translate(-6.9px, -7.2px);
156
+ path {
157
+ fill: $icon-color;
158
+ }
159
+ }
160
+ }
161
+
162
+ .has-history-match {
163
+ @each $property, $value in map.get($merged-entries-with-highlight, "toned-down-part") {
164
+ #{$property}: $value;
165
+ }
166
+ .highlighted-part {
167
+ @each $property, $value in map.get($merged-entries-with-highlight, "highlighted-part") {
168
+ #{$property}: $value;
169
+ }
170
+ }
171
+ }
172
+
173
+ .category {
174
+ margin-right: 20px;
175
+ }
176
+
177
+ .type {
178
+ color: #868689;
179
+ text-transform: capitalize;
180
+ }
181
+ }
182
+
183
+ &.query {
184
+ flex-direction: column;
185
+ .suggestion {
186
+ justify-content: flex-start;
187
+ @include utils.flex-gap(8px, "row nowrap");
188
+ }
189
+ }
190
+ }
191
+ &.compact > .suggestion-container.query {
192
+ flex-direction: row;
193
+ flex-wrap: wrap;
194
+ @include utils.flex-gap($autocomplete-gap-between-compact-suggestions, "row wrap");
195
+ }
196
+ }
197
+ }
@@ -0,0 +1,82 @@
1
+ @use "../../helpers/supports-hover";
2
+ @use "../../helpers/utils";
3
+ @use "../../variables";
4
+
5
+ /// CategorySuggestions is the component that displays suggested Categories on the SearchPage, above the results.
6
+ /// @param {Color} $card-background [white] - The background color of individual category "cards"
7
+ /// @param {false | Color} $hovered-card-background [false] - The background color of individual category "cards" when hovered. If false, a color is automatically obtained by lightening or darkening `$card-background`.
8
+ /// @param {Border | false} $card-border [false] - The border of individual category "cards". If false, no border is applied.
9
+ /// @param {Number with size unit} $card-border-radius [variables.$border-radius] - The border radius of individual category "cards"
10
+ /// @param {Number} $title-font-weight [420] - The font weight of the text on the category "cards"
11
+ /// @param {Number} $parent-title-font-weight [400] - The font weight of the text on the category "cards" that is the parent of proposed category (not always displayed)
12
+ /// @param {Boolean} $thin [true] - If true, the category title and parent category title are displayed besides each other (in the same row).
13
+ @mixin CategorySuggestions(
14
+ $card-background: white,
15
+ $hovered-card-background: false,
16
+ $card-border: false,
17
+ $card-border-radius: variables.$border-radius,
18
+ $title-font-weight: 420,
19
+ $parent-title-font-weight: 400,
20
+ $thin: true
21
+ ) {
22
+ .category-suggestions {
23
+ display: flex;
24
+
25
+ .sliding {
26
+ padding-bottom: 2px;
27
+ margin-bottom: -2px;
28
+ }
29
+
30
+ .title {
31
+ font-weight: $title-font-weight;
32
+ }
33
+ .category-suggestion {
34
+ background: $card-background;
35
+ transition: background 100ms ease-in-out;
36
+
37
+ &:focus {
38
+ @if $hovered-card-background {
39
+ background: $hovered-card-background;
40
+ } @else {
41
+ @include utils.highlight-background($normal-background: $card-background);
42
+ }
43
+ }
44
+ @include supports-hover.supports-hover() {
45
+ &:hover {
46
+ @if $hovered-card-background {
47
+ background: $hovered-card-background;
48
+ } @else {
49
+ @include utils.highlight-background($normal-background: $card-background);
50
+ }
51
+ }
52
+ }
53
+ border-radius: $card-border-radius;
54
+ @if $card-border {
55
+ border: $card-border;
56
+ }
57
+ padding: 10px 20px;
58
+ color: black;
59
+ display: flex;
60
+ height: 100%;
61
+ align-items: center;
62
+ @if $thin {
63
+ justify-content: space-between;
64
+ @include utils.flex-gap(10px, "row nowrap");
65
+ } @else {
66
+ justify-content: center;
67
+ flex-direction: column;
68
+ @include utils.flex-gap(10px, "column nowrap");
69
+ }
70
+
71
+ .parent-title {
72
+ font-weight: $parent-title-font-weight;
73
+ }
74
+
75
+ & > * {
76
+ white-space: nowrap;
77
+ font-size: 0.85em;
78
+ }
79
+ }
80
+ @content;
81
+ }
82
+ }
@@ -0,0 +1,122 @@
1
+ @use "../../helpers/utils";
2
+ @use "../../variables";
3
+
4
+ /// Mixin that styles the idividual product cards in the InstantResults in the SearchModal
5
+ /// @param {Color} $instant-card-sales-price-color [$instant-card-sales-price-color] - The color of the sales price
6
+ /// @param {Boolean} $instant-card-show-price [true] - Whether to show the price
7
+ /// @param {Boolean} $instant-card-show-tagline [true] - Whether to show the tagline (this can be different things depending on what backend sends)
8
+
9
+ @mixin InstantCard(
10
+ $instant-card-sales-price-color: variables.$instant-card-sales-price-color,
11
+ $instant-card-show-price: variables.$instant-card-show-price,
12
+ $instant-card-show-tagline: variables.$instant-card-show-tagline
13
+ ) {
14
+ .instant-results {
15
+ .instant-card {
16
+ $card-gap: 1.5vw;
17
+ &:hover,
18
+ &:focus {
19
+ box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.15), -4px -4px 4px rgba(255, 255, 255, 0.3);
20
+ z-index: 2;
21
+ }
22
+ overflow: hidden;
23
+ flex: 1 1 100%;
24
+ display: flex;
25
+ background: white;
26
+ padding-left: 20px;
27
+ padding-top: 5px;
28
+ padding-bottom: 5px;
29
+ padding-right: 20px;
30
+ border-radius: variables.$border-radius;
31
+ @include utils.flex-gap($card-gap, "row nowrap");
32
+
33
+ .img-part {
34
+ flex: 0 0 100px;
35
+ }
36
+
37
+ .right-part {
38
+ flex-grow: 1;
39
+ display: flex;
40
+ justify-content: space-between;
41
+ @include utils.flex-gap($card-gap, "row nowrap");
42
+
43
+ .title-brand-tagline {
44
+ display: flex;
45
+ justify-content: center;
46
+ align-items: center;
47
+ @media (min-width: 601px) {
48
+ @include utils.flex-gap($card-gap, "row nowrap");
49
+ }
50
+
51
+ @media (max-width: 600px) {
52
+ @include utils.flex-gap($card-gap, "column nowrap");
53
+ flex-direction: column;
54
+ align-items: flex-start;
55
+ }
56
+
57
+ .title {
58
+ text-overflow: ellipsis;
59
+ white-space: pre-line;
60
+ overflow-wrap: anywhere;
61
+ display: -webkit-box;
62
+ -webkit-box-orient: vertical;
63
+ -webkit-line-clamp: 2;
64
+ overflow: hidden;
65
+ word-break: break-word;
66
+ }
67
+
68
+ @if $instant-card-show-tagline {
69
+ .tagline {
70
+ font-size: 0.9em;
71
+ color: #868689;
72
+ }
73
+ } @else {
74
+ .tagline {
75
+ display: none;
76
+ }
77
+ }
78
+ }
79
+
80
+ .price-container {
81
+ @if $instant-card-show-price {
82
+ display: flex;
83
+
84
+ justify-content: center;
85
+ align-items: center;
86
+ @media (min-width: 601px) {
87
+ @include utils.flex-gap($card-gap, "row nowrap");
88
+ }
89
+
90
+ .price {
91
+ &:not(.orig) {
92
+ font-weight: 700;
93
+ color: #0f0f0f;
94
+ }
95
+ &.orig {
96
+ text-decoration: line-through;
97
+ color: #868689;
98
+ }
99
+ &.sales-price {
100
+ color: $instant-card-sales-price-color;
101
+ }
102
+ }
103
+ @media (max-width: 600px) {
104
+ @include utils.flex-gap($card-gap, "column nowrap");
105
+ flex-direction: column;
106
+
107
+ .price:not(.orig) {
108
+ order: 0;
109
+ }
110
+
111
+ .price.orig {
112
+ order: 1;
113
+ }
114
+ }
115
+ } @else {
116
+ display: none;
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
@@ -0,0 +1,12 @@
1
+ @use "../../helpers/utils";
2
+
3
+ /// Mixin that styles the container of the InstantResults in the SearchModal
4
+ /// @param {Number with size unit} $gap [5px] - The gap between the InstantResults
5
+ @mixin InstantResults($gap: 5px) {
6
+ .instant-results {
7
+ display: flex;
8
+ flex-direction: column;
9
+ @include utils.flex-gap($gap, "column nowrap");
10
+ @content;
11
+ }
12
+ }
@@ -0,0 +1,90 @@
1
+ @use "../../variables";
2
+ @use "../../helpers/utils";
3
+ @use "../PLP/Buttons";
4
+ @use "sass:map";
5
+
6
+ /// PreviousSearches is the component that shows the previous searches of the user in its own section, with a heading that says "Your previous searches" (key of the string is `previous_searches_text_` in the locales).
7
+ /// The component is only shown if the user has previous searches and the search field is empty.
8
+ ///
9
+ /// PreviousSearches is a sub-component of Autocomplete so you probably don't want to use it on its own. It can also be configured by configuring Autocomplete.
10
+ /// @param {Color} $icon-color [variables.$brand-black] - The color of the clock icon and clear icon. Keep in mind that it needs to have contrast with the hovered state of the delete icon
11
+ /// @param {Color} $item-color [variables.$brand-black] - The color of the text of the previous searches item
12
+ /// @param {Number with size unit} $gap-between-items [5px] - The gap between the individual previous searches items
13
+
14
+ @mixin PreviousSearches(
15
+ $icon-color: variables.$brand-dark-grey,
16
+ $item-color: variables.$brand-black,
17
+ $gap-between-items: 5px
18
+ ) {
19
+ .previous-searches {
20
+ display: flex;
21
+ flex-direction: column;
22
+ @include utils.flex-gap(15px, "column nowrap");
23
+
24
+ .list {
25
+ display: flex;
26
+ flex-direction: column;
27
+ @include utils.flex-gap($gap-between-items, "column nowrap");
28
+ .item {
29
+ color: $item-color;
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: space-between;
33
+ padding-top: 10px;
34
+ padding-bottom: 10px;
35
+ padding-left: 20px;
36
+ padding-right: 20px;
37
+ border-radius: variables.$border-radius;
38
+ overflow-wrap: anywhere;
39
+ .left {
40
+ @include utils.flex-gap(10px, "row nowrap");
41
+ display: flex;
42
+ align-items: center;
43
+ svg {
44
+ min-width: 12px;
45
+ path {
46
+ fill: $icon-color;
47
+ }
48
+ }
49
+ }
50
+ .delete {
51
+ height: 100%;
52
+ padding: 0 10px;
53
+ background: transparent;
54
+ cursor: pointer;
55
+ display: flex;
56
+ justify-content: center;
57
+ align-items: center;
58
+
59
+ &:focus {
60
+ outline: none;
61
+ }
62
+
63
+ svg {
64
+ transition-duration: 150ms;
65
+ width: 13px;
66
+ height: 13px;
67
+ path {
68
+ fill: $icon-color;
69
+ }
70
+ }
71
+ &:hover svg {
72
+ transform: scale(1.2);
73
+ path {
74
+ fill: #000;
75
+ }
76
+ }
77
+ &:focus-visible {
78
+ filter: map.get(Buttons.get-secondary-button-properties(), "focus-visible-filter");
79
+ svg {
80
+ transform: scale(1.2);
81
+ path {
82
+ fill: #000;
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,189 @@
1
+ @use "../../variables";
2
+ @use "../../helpers/supports-hover";
3
+ @use "../PLP/Buttons";
4
+ @use "sass:map";
5
+
6
+ /// QueryInput is the component that shows the search input, sometimes back button, clear button and the search button.
7
+ /// The version exported in the SDK it is called SearchField
8
+ /// @param {Number with size unit} $border-radius [variables.$border-radius * 2.5] - Border radius of the search input
9
+ /// @param {Number with size unit} $input-font-size [initial] - Font size of the `<input>` element
10
+ /// @param {Number} $input-font-weight [initial] - Font weight of the `<input>` element
11
+ /// @param {Color} $input-placeholder-color [initial] - Color of the placeholder text in the `<input>` element (the text that's visible when no search query has been entered)
12
+ /// @param {Color | false} $submit-background [false] If not false: the background color of the submit button
13
+ /// @param {Number} $submit-icon-size [1] - The scaling factor of the submit icon
14
+ /// @param {Color} $back-color [variables.$brand-dark-grey] - The color of the path of the back icon
15
+ /// @param {Color} $back-background [#fff] - The background color of the back button
16
+ /// @param {Color} $clear-color [variables.$brand-dark-grey] - The color of the path of the clear icon
17
+ /// @param {Color} $hovered-clear-color [variables.$brand-black] - The color of the path of the clear icon when hovered
18
+ /// @param {Color} $query-text-color [variables.$brand-dark-grey] - The color of the text in the search input
19
+ /// @param {Color} $query-background-color [#fff] - The background color of the `<input>` element
20
+ /// @param {Border} $query-border [none] - The border of the `<input>` element
21
+ /// @param {Color} $hovered-back-color [variables.$brand-black] - The color of the path of the back icon when hovered
22
+ /// @param {false | Color} $hovered-submit-color [false] - If not false: the color of the path of the submit icon when hovered
23
+ /// @param {Color} $focused-query-text-color [#000] - The color of the text in the search input when focused or hovered
24
+ /// @param {Shadow} $box-shadow [0px 4px 4px rgba(0, 0, 0, 0.05)] - The box shadow of the whole QueryInput component (including buttons, etc)
25
+
26
+ @mixin QueryInput(
27
+ $border-radius: calc(#{variables.$border-radius} * 2.5),
28
+ $input-font-size: initial,
29
+ $input-font-weight: initial,
30
+ $input-placeholder-color: initial,
31
+ $submit-background: false,
32
+ $submit-icon-size: 1,
33
+ $back-color: variables.$brand-dark-grey,
34
+ $back-background: #fff,
35
+ $clear-color: variables.$brand-dark-grey,
36
+ $hovered-clear-color: variables.$brand-black,
37
+ $query-text-color: variables.$brand-dark-grey,
38
+ $query-background-color: #fff,
39
+ $query-border: none,
40
+ $hovered-back-color: variables.$brand-black,
41
+ $hovered-submit-color: false,
42
+ $focused-query-text-color: #000,
43
+ $box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.05)
44
+ ) {
45
+ // TODO: Probably rename to SearchField?
46
+ .query-input {
47
+ input,
48
+ button {
49
+ margin: 0; // safari has some default margin
50
+ }
51
+ display: flex;
52
+ z-index: calc(#{variables.$search-page-base-z-index} + 5); // make shadow go above contents
53
+ box-shadow: $box-shadow;
54
+
55
+ .query {
56
+ border-radius: $border-radius 0 0 $border-radius;
57
+ border: $query-border;
58
+ flex-grow: 1;
59
+ padding-left: 20px;
60
+ padding-top: 14px;
61
+ padding-bottom: 14px;
62
+ padding-right: 55px;
63
+ width: 100%;
64
+ color: $query-text-color;
65
+ background-color: $query-background-color;
66
+
67
+ &::placeholder {
68
+ color: $input-placeholder-color;
69
+ }
70
+ &:focus {
71
+ outline: none;
72
+ color: $focused-query-text-color;
73
+ }
74
+ @include supports-hover.supports-hover() {
75
+ &:hover {
76
+ outline: none;
77
+ color: $focused-query-text-color;
78
+ }
79
+ }
80
+ font-size: $input-font-size;
81
+ font-weight: $input-font-weight;
82
+ &.has-adjacent-back-button {
83
+ border-bottom-left-radius: 0;
84
+ border-top-left-radius: 0;
85
+ padding-left: 0;
86
+ }
87
+ }
88
+
89
+ .field {
90
+ position: relative;
91
+ flex-grow: 1;
92
+ display: flex;
93
+ }
94
+
95
+ .back {
96
+ background: $back-background;
97
+ display: flex;
98
+ align-items: center;
99
+ justify-content: center;
100
+ border: none;
101
+ padding-left: 10px;
102
+ padding-top: 14px;
103
+ padding-bottom: 14px;
104
+ padding-right: 15px;
105
+ border-bottom-left-radius: $border-radius;
106
+ border-top-left-radius: $border-radius;
107
+ cursor: pointer;
108
+ svg path {
109
+ fill: $back-color;
110
+ }
111
+ &:focus {
112
+ outline: none;
113
+ }
114
+ &:focus-visible {
115
+ filter: map.get(Buttons.get-secondary-button-properties(), "focus-visible-filter");
116
+ svg path {
117
+ fill: $hovered-back-color;
118
+ }
119
+ }
120
+ @include supports-hover.supports-hover() {
121
+ &:hover {
122
+ svg path {
123
+ fill: $hovered-back-color;
124
+ }
125
+ }
126
+ }
127
+ }
128
+
129
+ .clear,
130
+ .submit {
131
+ cursor: pointer;
132
+ }
133
+
134
+ .clear {
135
+ position: absolute;
136
+ right: 30px;
137
+ top: 50%;
138
+ transform: translateY(-50%) scale(0.8);
139
+ background: transparent;
140
+ border: none;
141
+ padding: 0;
142
+ svg path {
143
+ fill: $clear-color;
144
+ }
145
+
146
+ &:focus {
147
+ outline: none;
148
+ }
149
+ &:focus-visible {
150
+ filter: map.get(Buttons.get-secondary-button-properties(), "focus-visible-filter");
151
+ svg path {
152
+ fill: $hovered-clear-color;
153
+ }
154
+ }
155
+ @include supports-hover.supports-hover() {
156
+ &:hover {
157
+ svg path {
158
+ fill: $hovered-clear-color;
159
+ }
160
+ }
161
+ }
162
+ }
163
+
164
+ .submit {
165
+ border: none;
166
+ padding: 0;
167
+ min-width: 50px;
168
+ border-radius: 0 $border-radius $border-radius 0;
169
+ svg {
170
+ transform: scale($submit-icon-size);
171
+ }
172
+
173
+ @if ($submit-background) {
174
+ background: $submit-background;
175
+ }
176
+
177
+ @if $hovered-submit-color {
178
+ @include supports-hover.supports-hover() {
179
+ &:hover {
180
+ svg path {
181
+ fill: $hovered-submit-color;
182
+ }
183
+ }
184
+ }
185
+ }
186
+ }
187
+ @content;
188
+ }
189
+ }