@depict-ai/react-ui 2.0.9 → 2.0.11

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 (47) hide show
  1. package/ES10/index.cjs +22 -7
  2. package/ES10/index.d.ts +1 -1
  3. package/ES10/index.js +23 -8
  4. package/dist/main.js +374 -140
  5. package/dist/module.js +364 -139
  6. package/dist/styles/components/PLP/Buttons.scss +93 -36
  7. package/dist/styles/components/PLP/MorphingSign.scss +2 -3
  8. package/dist/styles/components/PLP/PLPResults.scss +6 -0
  9. package/dist/styles/components/PLP/ProductListingPage.scss +28 -2
  10. package/dist/styles/components/PLP/ScrollStatus.scss +8 -1
  11. package/dist/styles/components/PLP/SelectedFilters.scss +10 -2
  12. package/dist/styles/components/PLP/SlidableItems.scss +22 -0
  13. package/dist/styles/components/PLP/SortAndFilter/FloatingButtons.scss +9 -0
  14. package/dist/styles/components/PLP/SortAndFilter/SortAndFilter.scss +90 -18
  15. package/dist/styles/components/PLP/SortAndFilter/SortAndFilterModal.scss +2 -4
  16. package/dist/styles/components/PLP/SortAndFilter/WhiteSortAndFilter.scss +6 -2
  17. package/dist/styles/components/PLP/Toast.scss +5 -0
  18. package/dist/styles/components/PLP/index.scss +12 -6
  19. package/dist/styles/components/category/BreadCrumbs.scss +13 -4
  20. package/dist/styles/components/category/CategoryTitle.scss +14 -2
  21. package/dist/styles/components/category/QuickLinks.scss +16 -7
  22. package/dist/styles/components/category/index.scss +5 -5
  23. package/dist/styles/components/search/Autocomplete.scss +99 -19
  24. package/dist/styles/components/search/CategorySuggestions.scss +8 -0
  25. package/dist/styles/components/search/InstantCard.scss +7 -2
  26. package/dist/styles/components/search/InstantResults.scss +2 -0
  27. package/dist/styles/components/search/PreviousSearches.scss +17 -4
  28. package/dist/styles/components/search/QueryInput.scss +28 -6
  29. package/dist/styles/components/search/SearchModal.scss +16 -10
  30. package/dist/styles/components/search/SearchRecommendations.scss +3 -0
  31. package/dist/styles/components/search/ShowingResultsFor.scss +3 -0
  32. package/dist/styles/components/search/index.scss +5 -5
  33. package/dist/styles/default.css +1 -1
  34. package/dist/styles/helpers/custom_input.scss +38 -6
  35. package/dist/styles/helpers/supports-hover.scss +2 -0
  36. package/dist/styles/helpers/utils.scss +9 -1
  37. package/dist/styles/variables.scss +17 -3
  38. package/latest/index.cjs +17 -7
  39. package/latest/index.d.ts +1 -1
  40. package/latest/index.js +18 -8
  41. package/package.json +2 -2
  42. package/server/ES10/index.cjs +17 -4
  43. package/server/ES10/index.d.ts +1 -1
  44. package/server/ES10/index.js +18 -5
  45. package/server/latest/index.cjs +14 -4
  46. package/server/latest/index.d.ts +1 -1
  47. package/server/latest/index.js +15 -5
@@ -2,39 +2,76 @@
2
2
  @use "../../helpers/supports-hover";
3
3
  @use "../../helpers/utils";
4
4
  @use "sass:color";
5
+ @use "sass:map";
5
6
 
6
- $primary-button-background: variables.$brand-black;
7
- $primary-button-color: #fff;
8
- $primary-button-border: 1px solid transparent; // so that the page doesn't jump when there's half a border when switching between having sort and filters open (the buttons switch between pimary and secondary)
9
- $primary-button-border-radius: variables.$border-radius;
10
- $primary-button-hover-filter: drop-shadow(-2px -2px 4px rgba(255, 255, 255, 0.25))
11
- drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.15));
12
- $primary-button-active-filter: drop-shadow(2px 2px 4px rgba(255, 255, 255, 0.25))
13
- drop-shadow(-2px -2px 4px rgba(0, 0, 0, 0.15));
14
- $primary-button-focus-visible-filter: drop-shadow(2px 2px 4px rgba(65, 143, 195, 0.8))
15
- drop-shadow(-2px -2px 4px rgba(65, 143, 195, 0.8));
7
+ $primary-button-overrides: ();
8
+ $secondary-button-overrides: ();
16
9
 
17
- $secondary-button-background: variables.$brand-lightest-grey;
18
- $secondary-button-color: variables.$brand-dark-grey;
19
- $secondary-button-border: 1px solid variables.$brand-black;
20
- $secondary-button-border-radius: variables.$border-radius;
21
- $secondary-button-hover-filter: drop-shadow(-2px -2px 4px rgba(255, 255, 255, 0.25))
22
- drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.15));
23
- $secondary-button-active-filter: drop-shadow(2px 2px 4px rgba(255, 255, 255, 0.25))
24
- drop-shadow(-2px -2px 4px rgba(0, 0, 0, 0.15));
25
- $secondary-button-focus-visible-filter: drop-shadow(-2px -2px 4px rgba(65, 143, 195, 0.8))
26
- drop-shadow(2px 2px 4px rgba(65, 143, 195, 0.8));
10
+ /// Used to get the current properties of the primary button. (`Buttons.$primary-button-overrides` merged into the default properties.) This is so that parts of the button styling can be re-used in other mixins in the state they were in as the mixins get called.
11
+ /// @example
12
+ /// filter: map.get(Buttons.get-primary-button-properties(), "focus-visible-filter");
13
+ @function get-primary-button-properties() {
14
+ $primary-button-properties: (
15
+ "background": variables.$brand-black,
16
+ "color": #fff,
17
+ // so that the page doesn't jump when there's half a border when switching between having sort and filters open (the buttons switch between pimary and secondary)
18
+ "border": 1px solid transparent,
19
+ "border-radius": variables.$border-radius,
20
+ "hover-filter": drop-shadow(-2px -2px 4px rgba(255, 255, 255, 0.25)) drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.15)),
21
+ "active-filter": drop-shadow(2px 2px 4px rgba(255, 255, 255, 0.25)) drop-shadow(-2px -2px 4px rgba(0, 0, 0, 0.15)),
22
+ "focus-visible-filter": drop-shadow(2px 2px 4px rgba(65, 143, 195, 0.8))
23
+ drop-shadow(-2px -2px 4px rgba(65, 143, 195, 0.8)),
24
+ );
25
+ @return map.merge($primary-button-properties, $primary-button-overrides);
26
+ }
27
+
28
+ /// Used to get the current properties of the secondary button. (`Buttons.$secondary-button-overrides` merged into the default properties.) This is so that parts of the button styling can be re-used in other mixins in the state they were in as the mixins get called.
29
+ /// @example
30
+ /// filter: map.get(Buttons.get-secondary-button-properties(), "focus-visible-filter");
31
+ @function get-secondary-button-properties() {
32
+ $secondary-button-properties: (
33
+ "background": variables.$brand-lightest-grey,
34
+ "color": variables.$brand-dark-grey,
35
+ "border": 1px solid variables.$brand-black,
36
+ "border-radius": variables.$border-radius,
37
+ "hover-filter": drop-shadow(-2px -2px 4px rgba(255, 255, 255, 0.25)) drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.15)),
38
+ "active-filter": drop-shadow(2px 2px 4px rgba(255, 255, 255, 0.25)) drop-shadow(-2px -2px 4px rgba(0, 0, 0, 0.15)),
39
+ "focus-visible-filter": drop-shadow(-2px -2px 4px rgba(65, 143, 195, 0.8))
40
+ drop-shadow(2px 2px 4px rgba(65, 143, 195, 0.8)),
41
+ );
42
+ @return map.merge($secondary-button-properties, $secondary-button-overrides);
43
+ }
44
+
45
+ /// Generates styling for our primary buttons, including hover, active and focus-visible states
46
+ ///
47
+ /// *Please only provide options to this mixin if you want to create styling for just a specific button.*
48
+ ///
49
+ /// This mixin and the SecondaryButton mixin are currently specialties in how they get customised using maps. Everything that isn't customised using maps is subject to change in the future.
50
+ ////
51
+ /// *For generally changing how the buttons look, override the $primary-button-overrides map with a custom map containing the properties you want to change.*
52
+ /// See the example below.
53
+ /// @example
54
+ /// // To override styling (see explanation in description)
55
+ /// Buttons.$primary-button-overrides: ("background": #3f322a, "color": rgb(240,240,240));
56
+ /// @param {Color} $background [map.get(get-primary-button-properties(), "background")] - The background color of the button. From this color other button states will be automatically inferred by lightening or darkening it.
57
+ ///
58
+ /// @param {Color} $color [map.get(get-primary-button-properties(), "color")] - The color of the button text
59
+ /// @param {Border} $border [map.get(get-primary-button-properties(), "border")] - The button border
60
+ /// @param {Number with unit} $border-radius [map.get(get-primary-button-properties(), "border-radius")] - The button border radius
61
+ /// @param {Filter} $hover-filter [map.get(get-primary-button-properties(), "hover-filter")] - The filter to apply on hover
62
+ /// @param {Filter} $active-filter [map.get(get-primary-button-properties(), "active-filter")] - The filter to apply on active
63
+ /// @param {Filter} $focus-visible-filter [map.get(get-primary-button-properties(), "focus-visible-filter")] - The filter to apply on focus-visible (when the button is focused using keyboard navigation)
27
64
 
28
65
  @mixin PrimaryButton(
29
- $background: $primary-button-background,
30
- $color: $primary-button-color,
31
- $border: $primary-button-border,
32
- $border-radius: $primary-button-border-radius,
33
- $hover-filter: $primary-button-hover-filter,
34
- $active-filter: $primary-button-active-filter,
35
- $focus-visible-filter: $primary-button-focus-visible-filter
66
+ $background: map.get(get-primary-button-properties(), "background"),
67
+ $color: map.get(get-primary-button-properties(), "color"),
68
+ $border: map.get(get-primary-button-properties(), "border"),
69
+ $border-radius: map.get(get-primary-button-properties(), "border-radius"),
70
+ $hover-filter: map.get(get-primary-button-properties(), "hover-filter"),
71
+ $active-filter: map.get(get-primary-button-properties(), "active-filter"),
72
+ $focus-visible-filter: map.get(get-primary-button-properties(), "focus-visible-filter")
36
73
  ) {
37
- // not using .primary since that's 100% going to conflict with existing declarations on sites
74
+ // not using button.primary since that's 100% going to conflict with existing declarations on sites
38
75
  button.major {
39
76
  @include Button(
40
77
  $background,
@@ -50,16 +87,36 @@ $secondary-button-focus-visible-filter: drop-shadow(-2px -2px 4px rgba(65, 143,
50
87
  }
51
88
  }
52
89
 
90
+ /// Generates styling for our secondary buttons, including hover, active and focus-visible states
91
+ ///
92
+ /// *Please only provide options to this mixin if you want to create styling for just a specific button.*
93
+ ///
94
+ /// This mixin and the SecondaryButton mixin are currently specialties in how they get customised using maps. Everything that isn't customised using maps is subject to change in the future.
95
+ ////
96
+ /// *For generally changing how the buttons look, override the $secondary-button-overrides map with a custom map containing the properties you want to change.*
97
+ /// See the example below.
98
+ /// @example
99
+ /// // To override styling (see explanation in description)
100
+ /// Buttons.$secondary-button-overrides: ("border": 1px solid #afafaf, "background": white);
101
+ /// @param {Color} $background [map.get(get-secondary-button-properties(), "background")] - The background color of the button. From this color other button states will be automatically inferred by lightening or darkening it.
102
+ ///
103
+ /// @param {Color} $color [map.get(get-secondary-button-properties(), "color")] - The color of the button text
104
+ /// @param {Border} $border [map.get(get-secondary-button-properties(), "border")] - The button border
105
+ /// @param {Number with unit} $border-radius [map.get(get-secondary-button-properties(), "border-radius")] - The button border radius
106
+ /// @param {Filter} $hover-filter [map.get(get-secondary-button-properties(), "hover-filter")] - The filter to apply on hover
107
+ /// @param {Filter} $active-filter [map.get(get-secondary-button-properties(), "active-filter")] - The filter to apply on active
108
+ /// @param {Filter} $focus-visible-filter [map.get(get-secondary-button-properties(), "focus-visible-filter")] - The filter to apply on focus-visible (when the button is focused using keyboard navigation)
109
+
53
110
  @mixin SecondaryButton(
54
- $background: $secondary-button-background,
55
- $color: $secondary-button-color,
56
- $border: $secondary-button-border,
57
- $border-radius: $secondary-button-border-radius,
58
- $hover-filter: $secondary-button-hover-filter,
59
- $active-filter: $secondary-button-active-filter,
60
- $focus-visible-filter: $secondary-button-focus-visible-filter
111
+ $background: map.get(get-secondary-button-properties(), "background"),
112
+ $color: map.get(get-secondary-button-properties(), "color"),
113
+ $border: map.get(get-secondary-button-properties(), "border"),
114
+ $border-radius: map.get(get-secondary-button-properties(), "border-radius"),
115
+ $hover-filter: map.get(get-secondary-button-properties(), "hover-filter"),
116
+ $active-filter: map.get(get-secondary-button-properties(), "active-filter"),
117
+ $focus-visible-filter: map.get(get-secondary-button-properties(), "focus-visible-filter")
61
118
  ) {
62
- // not using .secondary since that's 100% going to conflict with existing declarations on sites
119
+ // not using button.secondary since that's 100% going to conflict with existing declarations on sites
63
120
  button.minor {
64
121
  @include Button(
65
122
  $background,
@@ -2,10 +2,9 @@
2
2
  .morphing-sign {
3
3
  /* https://stackoverflow.com/a/38136283 */
4
4
  border: 0;
5
- font-size: 1.5em;
6
5
  position: relative;
7
- width: 1em;
8
- height: 1em;
6
+ width: 1.5em;
7
+ height: 1.5em;
9
8
 
10
9
  span {
11
10
  position: absolute;
@@ -1,8 +1,14 @@
1
1
  @use "../../variables";
2
2
  @use "../../helpers/utils";
3
3
 
4
+ /// Base styling (PLP) that applies to both category and search pages for the PLPResults component, the component which holds the product cards.
5
+ /// Another part of this styling is in the ProductListingPage mixin, which takes care about the overall layout of the page (which mostly means margins and paddings).
6
+
4
7
  @mixin PLPResults() {
5
8
  .listing-page {
9
+ display: flex;
10
+ flex-direction: column;
11
+
6
12
  .no-results {
7
13
  background: white;
8
14
  padding: 40px;
@@ -1,9 +1,15 @@
1
1
  @use "../../helpers/utils";
2
2
 
3
+ /// Styling that ties together the different components that are common to both Category and Search pages. Mainly takes care of margins and paddings but also sets the styling for .cards which is in both PLPResults and SearchRecommendations.
4
+ ///
5
+ /// Note that for the gaps not the exact values will always be used but often multiples for different places where it's appropriate.
6
+ ///
7
+ /// @param {Number with size unit} $spacing-to-filters [12px] - The spacing between the filters and content.
8
+ /// @param {Number with size unit} $desktop-item-gap [20px] - The vertical gap between the different items on desktop.
9
+ /// @param {Number with size unit} $mobile-item-gap [16px] - The vertical gap between the different items on mobile.
10
+
3
11
  @mixin ProductListingPage($spacing-to-filters: 12px, $desktop-item-gap: 20px, $mobile-item-gap: 16px) {
4
12
  .listing-page {
5
- display: flex;
6
- flex-direction: column;
7
13
  padding: $desktop-item-gap calc(#{$desktop-item-gap} / 2);
8
14
  @include mobile_sizes() {
9
15
  padding: $mobile-item-gap calc(#{$mobile-item-gap} / 2);
@@ -50,10 +56,22 @@
50
56
  flex-direction: row;
51
57
  flex-grow: 1;
52
58
  overflow: hidden;
59
+ align-content: flex-start;
53
60
  }
54
61
  }
55
62
  }
56
63
 
64
+ /// Styling that ties together the different components on the SearchPage. Mainly takes care of margins and paddings.
65
+ ///
66
+ /// Note that for the gaps not the exact values will always be used but often multiples for different places where it's appropriate.
67
+ ///
68
+ /// @param {Number with size unit} $spacing-to-filters [12px] - The spacing between the filters and content.
69
+ /// @param {Number with size unit} $desktop-item-gap [20px] - The vertical gap between the different items on desktop.
70
+ /// @param {Number with size unit} $mobile-item-gap [16px] - The vertical gap between the different items on mobile.
71
+ /// @param {Boolean} $spacing-above-search-field [true] - Whether to add equal spacing above the search field as below.
72
+ /// @param {Number with size unit} $query-input-width [800px] - The max width of the query input field (if present)
73
+ /// @param {Number} $gaps-to-recs-factor [3] - The factor to multiply the gaps with to get the spacing above the recommendations.
74
+
57
75
  @mixin SearchPage(
58
76
  $spacing-to-filters: 12px,
59
77
  $desktop-item-gap: 20px,
@@ -123,6 +141,12 @@
123
141
  }
124
142
  }
125
143
 
144
+ /// Styling that ties together the different components on the CategoryPage. Mainly takes care of margins and paddings.
145
+ ///
146
+ /// @param {Number with size unit} $spacing-to-filters [12px] - The spacing between the filters and content.
147
+ /// @param {Number with size unit} $desktop-item-gap [20px] - The vertical gap between the different items on desktop.
148
+ /// @param {Number with size unit} $mobile-item-gap [16px] - The vertical gap between the different items on mobile.
149
+
126
150
  @mixin CategoryPage($spacing-to-filters: 12px, $desktop-item-gap: 20px, $mobile-item-gap: 16px) {
127
151
  .listing-page {
128
152
  .quicklinks,
@@ -135,6 +159,8 @@
135
159
  }
136
160
  }
137
161
 
162
+ /// Internal mixin that dictates when the vertical spaces should switch to the "mobile" versions
163
+
138
164
  @mixin mobile_sizes() {
139
165
  @media (max-width: 651px) {
140
166
  @content;
@@ -1,8 +1,15 @@
1
1
  @use "../../variables";
2
2
 
3
+ /// ScrollStatus shows the user how many items are left to scroll through, if they scroll at a speed that indicates that they are no longer looking at each product but rather just trying to see how many there are.
4
+ ///
5
+ /// If you too think that blurring the background would look great here, please take a minute to upvote this chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1382360
6
+ ///
7
+ /// @param {Color} $scroll-status-background [rgba(100, 100, 100, 0.9)] - The background color of the scroll status. I recommend setting a slightly transparent color.
8
+ /// @param {Number with size unit} $border-radius [variables.$border-radius * 5] - The border-radius of the scroll status.
9
+
3
10
  @mixin ScrollStatus(
4
11
  $scroll-status-background: rgba(100, 100, 100, 0.9),
5
- $border-radius: calc(variables.$border-radius * 5)
12
+ $border-radius: calc(#{variables.$border-radius} * 5)
6
13
  ) {
7
14
  .scroll-status {
8
15
  pointer-events: none;
@@ -2,6 +2,14 @@
2
2
  @use "../../helpers/utils";
3
3
  @use "../../helpers/supports-hover";
4
4
  @use "./Buttons";
5
+ @use "sass:map";
6
+
7
+ /// Mixin that styles the SelectedFilters component, which is the component that shows the selected filters if both the sorting and filtering menus are currently hidden.
8
+ /// @param {Number with size unit} $border-radius [variables.$border-radius] - A local override of the border-radius variable.
9
+ /// @param {String} $title-color [variables.$brand-black] - The color of the text that says "Filters:" (the key of this string is `selected_filters_title_` in the locale files).
10
+ /// @param {String} $filter-title-transform [uppercase] - text-transform for the aforementioned "Filters:" string
11
+ /// @param {Number with size unit} $margin-on-desktop [0px] - Margin above/below SelectedFilters on desktop. This is set here because ExpandingContainer, our expanding component, gets confused when the margin isn't precisely on this element. Otherwise this value would be in ProductListingPage.scss.
12
+ /// @param {Boolean} $set-border-on-crumbs [true] - Whether to set a border on the "crumbs" (a crumb is one selected filter).
5
13
 
6
14
  @mixin SelectedFilters(
7
15
  $border-radius: variables.$border-radius,
@@ -40,7 +48,7 @@
40
48
 
41
49
  .clear-filter {
42
50
  @if $set-border-on-crumbs {
43
- border: 1px solid Buttons.$primary-button-background;
51
+ border: 1px solid map.get(Buttons.get-primary-button-properties(), "background");
44
52
  }
45
53
  svg {
46
54
  width: 12.64px;
@@ -49,7 +57,7 @@
49
57
  }
50
58
  .clear-all-filters {
51
59
  @if $set-border-on-crumbs {
52
- border: Buttons.$secondary-button-border;
60
+ border: map.get(Buttons.get-secondary-button-properties(), "border");
53
61
  }
54
62
  }
55
63
 
@@ -1,8 +1,11 @@
1
1
  // @use "../../../rendering/slider_button_positioning";
2
2
  @use "../../helpers/utils";
3
+ @use "../../components/PLP/Buttons";
3
4
  @use "../../variables";
4
5
  @use "../../helpers/supports-hover";
6
+ @use "sass:map";
5
7
 
8
+ /// Mixin copy-pasted from @depict-ai/utilishared that helps with positioning slider buttons
6
9
  @mixin button_positioning {
7
10
  .d-navbutton {
8
11
  position: absolute;
@@ -45,7 +48,14 @@
45
48
  }
46
49
  }
47
50
 
51
+ /// Styling for sliders used in the PLP.
52
+ /// Most of the times SlidableItems is used for items laid out horizontally that do not fit the screen width.
53
+ ///
54
+ /// Examples are the QuickLinks (used to navigate sideways or downwards in the category tree) and the SelectedFilters (if not all selected filters fit on the screen).
55
+ /// @param {Color} $fade-to [variables.$brand-lighter-grey] - The color the slider buttons fade to, set this to the background color behind the slider.
56
+ /// @param {Color} @fade-from [transparent] - The color the slider buttons fade from, you probably want to leave this at transparent.
48
57
  @mixin SlidableItems($fade-to: variables.$brand-lighter-grey, $fade-from: rgba(238, 238, 240, 0)) {
58
+ // TODO: we could probably infer these colours (and maybe some more) if we add some global background color variable
49
59
  .depict-slider {
50
60
  width: 100%;
51
61
  position: relative;
@@ -80,6 +90,10 @@
80
90
  justify-content: flex-end;
81
91
  border: none;
82
92
 
93
+ & > div {
94
+ display: flex;
95
+ }
96
+
83
97
  @include supports-hover.supports-hover() {
84
98
  &:hover {
85
99
  svg {
@@ -87,6 +101,14 @@
87
101
  }
88
102
  }
89
103
  }
104
+ &:focus-visible {
105
+ svg {
106
+ transform: scale(1.5);
107
+ path {
108
+ filter: map.get(Buttons.get-secondary-button-properties(), "focus-visible-filter");
109
+ }
110
+ }
111
+ }
90
112
  svg {
91
113
  transition-duration: 150ms;
92
114
  }
@@ -1,6 +1,15 @@
1
1
  @use "../../../variables";
2
2
  @use "../../../helpers/supports-hover";
3
3
 
4
+ /// Styles the FloatingButtons. FloatingButtons are three buttons, one button to open sorting, one button to open filters and one button to scroll to the top that show up when scrolling upwards for a while on a mobile device not really close to the top of the page.
5
+ /// @param {Color} $button-background [variables.$brand-lighter-grey] - The background color of the buttons.
6
+ /// @param {Color} $hovered-button-background [variables.$brand-lightest-grey] - The background color of the buttons when hovered.
7
+ /// @param {Color} $button-border-color [variables.$brand-black] - The border color of the buttons.
8
+ /// @param {Color} $icon-color [variables.$brand-dark-grey] - The color of the icons.
9
+ /// @param {Number with unit} $bottom-distance [12px] - The distance from the bottom of the buttons to the bottom of the screen.
10
+ /// @param {Number with unit} $side-distance [12px] - The distance from the `$position`-side of the buttons to the `$position`-side of the screen.
11
+ /// @param {"left" | "right"} $position [left] - The side of the screen the buttons should be aligned to.
12
+
4
13
  @mixin FloatingButtons(
5
14
  $button-background: variables.$brand-lighter-grey,
6
15
  $hovered-button-background: variables.$brand-lightest-grey,
@@ -6,6 +6,63 @@
6
6
  @use "../../../helpers/supports-hover";
7
7
  @use "../Buttons";
8
8
  @use "sass:color";
9
+ @use "sass:map";
10
+
11
+ /// Mixin that styles the sorting and filtering menus.
12
+ /// The way this is configured is soon going to be subject to change, therefore the parameters are not argumented.
13
+ /// @param {Color} $mobile-top-level-collapse-color [variables.$brand-black] -
14
+ /// @param {Color} $mobile-top-level-collapse-background [#fff] -
15
+ /// @param {Color} $custom-input-checked-background [#fff] -
16
+ /// @param {Color} $custom-input-background [#fff] -
17
+ /// @param {Color} $custom-input-indicator-color [variables.$brand-black] -
18
+ /// @param {Color} $checkbox-background-color [#fff] -
19
+ /// @param {Color} $checkbox-checked-background-color [variables.$brand-black] -
20
+ /// @param {Color} $checkbox-checkmark-color [#fff] -
21
+ /// @param {Number with size unit} $checkbox-border-radius [if(variables.$border-radius == 0, 0, if(variables.$border-radius == 0px, 0, 2px))] -
22
+ /// @param {Border} $checkbox-border [1px solid variables.$brand-dark-grey] -
23
+ /// @param {Number with size unit} $checkbox-top-offset [0px] -
24
+ /// @param {Number with size unit} $checkbox-left-offset [0px] -
25
+ /// @param {Border} $radio-border [1px solid variables.$brand-dark-grey] -
26
+ /// @param {Color} $radio-background-color [#fff] -
27
+ /// @param {Color} $radio-selected-dot-color [variables.$brand-black] -
28
+ /// @param {Number with size unit} $radio-selected-dot-size [14px] -
29
+ /// @param {Number with size unit} $radio-selected-offset [0px] -
30
+ /// @param {Color} $separator-color [variables.$brand-dark-grey] -
31
+ /// @param {Color} $price-range-min-max-text-color [variables.$brand-dark-grey] -
32
+ /// @param {Color} $range-input-bg-color [variables.$brand-lightest-grey] -
33
+ /// @param {Color} $top-level-summary-background [variables.$brand-black] -
34
+ /// @param {Color} $hovered-top-level-summary-background [variables.$brand-dark-grey] -
35
+ /// @param {Color} $hovered-range-input-bg-color [variables.$brand-lighter-grey] -
36
+ /// @param {Color} $hovered-checkbox-bg [variables.$brand-lighter-grey] -
37
+ /// @param {false | Color} $hovered-checkbox-checked-background-color [false] -
38
+ /// @param {Color} $input-row-label-color [variables.$brand-dark-grey] -
39
+ /// @param {Color} $checked-input-row-label-color [#000] -
40
+ /// @param {Number} $input-row-label-font-weight [400] -
41
+ /// @param {Number} $checked-input-row-label-font-weight [500] -
42
+ /// @param {Color} $showing-selected-subfilter-count-color [variables.$brand-grey] -
43
+ /// @param {Color} $filter-available-products-color [variables.$brand-grey] -
44
+ /// @param {Color} $count-zero-input-row-label-color [rgb(194, 194, 194)] -
45
+ /// @param {Number with size unit} $spacing_between_input_rows [10px] -
46
+ /// @param {Number with size unit} $ungrouped-top-margin [25px] -
47
+ /// @param {Border} $hovered-checkbox-border [2px solid variables.$brand-black] -
48
+ /// @param {Border} $hovered-radio-border [2px solid variables.$brand-black] -
49
+ /// @param {Padding} $sort-and-filter-button-padding [10px 20px] -
50
+ /// @param {Color} $expandable-seperator-color [variables.$brand-lightest-grey] -
51
+ /// @param {Color} $expandable-seperator-hover-color [variables.$brand-lighter-grey] -
52
+ /// @param {Number with size unit} $expandable-seperator-height [1px] -
53
+ /// @param {Color} $filter-group-heading-color [#fff] -
54
+ /// @param {Color} $filter-groups-morphing-sign-color [#fff] -
55
+ /// @param {Number with size unit} $filter-group-summary-border-radius [4px] -
56
+ /// @param {Color} $sort-and-filter-modal-background [variables.$brand-lighter-grey] -
57
+ /// @param {Number with size unit} $filter-group-heading-padding [10px] -
58
+ /// @param {Number with size unit} $filter-group-summary-spacings [10px] -
59
+ /// @param {Number with size unit} $range-input-field-border-radius [4px] -
60
+ /// @param {Border} $range-input-field-border [none] -
61
+ /// @param {false | Number} $filter-group-title-bold [false] -
62
+ /// @param {Color} $view-more-clear-background [rgb(253, 253, 253)] -
63
+ /// @param {Color} $filter-collapsible-body-background [rgb(238, 238, 240)] -
64
+ /// @param {Number | Boolean} $sort-and-filter-modal-section-title-font-weight [false] -
65
+ /// @param {Number | Boolean} $sort-and-filter-modal-section-expanded-title-font-weight [$sort-and-filter-modal-section-title-font-weight] -
9
66
 
10
67
  @mixin SortAndFilter(
11
68
  $mobile-top-level-collapse-color: variables.$brand-black,
@@ -18,10 +75,10 @@
18
75
  $checkbox-checkmark-color: #fff,
19
76
  $checkbox-border-radius: if(variables.$border-radius == 0, 0, if(variables.$border-radius == 0px, 0, 2px)),
20
77
  // if global border radius is 0 or 0px, don't round input fields in their default value
21
- $checkbox-border: 1px solid variables.$brand-black,
78
+ $checkbox-border: 1px solid variables.$brand-dark-grey,
22
79
  $checkbox-top-offset: 0px,
23
80
  $checkbox-left-offset: 0px,
24
- $radio-border: 1px solid variables.$brand-black,
81
+ $radio-border: 1px solid variables.$brand-dark-grey,
25
82
  $radio-background-color: #fff,
26
83
  $radio-selected-dot-color: variables.$brand-black,
27
84
  $radio-selected-dot-size: 14px,
@@ -63,7 +120,8 @@
63
120
  $sort-and-filter-modal-section-title-font-weight: false,
64
121
  $sort-and-filter-modal-section-expanded-title-font-weight: $sort-and-filter-modal-section-title-font-weight
65
122
  ) {
66
- $input-row-height-goal: 20px;
123
+ $input-row-height-goal: max(21px, 1em); // if text gets bigger we have to get bigger too to not cut off the text
124
+ // it was meant to be 20px but there was a bug so I'm setting it to 21px now so it doesn't change
67
125
  $count-distance-to-right: 30px;
68
126
  $largest-border-on-custom-input: max(
69
127
  custom_input.get_border_width($checkbox-border),
@@ -151,7 +209,7 @@
151
209
  align-items: center;
152
210
  transition: opacity 250ms ease-in-out;
153
211
  font-size: 12px;
154
- z-index: calc(variables.$search-page-base-z-index + 1);
212
+ z-index: calc(#{variables.$search-page-base-z-index} + 1);
155
213
  }
156
214
  .open-filters-button-container {
157
215
  position: relative;
@@ -191,7 +249,8 @@
191
249
  $hovered-checkbox-checked-background-color,
192
250
  $hovered-checkbox-border,
193
251
  $hovered-radio-border,
194
- $width-and-height: calc(#{$input-row-height-goal} - #{$largest-border-on-custom-input})
252
+ $input-row-height-goal,
253
+ $largest-border-on-custom-input
195
254
  );
196
255
  }
197
256
  .filters {
@@ -218,9 +277,7 @@
218
277
  }
219
278
  .text {
220
279
  //line-height: 1.8; /** Fix for ÅÄÖ getting cut-off **/
221
- line-height: calc(
222
- #{$input-row-height-goal} + #{$largest-border-on-custom-input}
223
- ); // Sorry ÅÄÖ, hope you survive this
280
+ line-height: $input-row-height-goal; // Sorry ÅÄÖ, hope you survive this
224
281
  display: -webkit-box;
225
282
  text-overflow: ellipsis;
226
283
  white-space: pre-line;
@@ -381,7 +438,7 @@
381
438
  }
382
439
  &:focus-visible {
383
440
  outline: none;
384
- filter: Buttons.$secondary-button-focus-visible-filter;
441
+ filter: map.get(Buttons.get-secondary-button-properties(), "focus-visible-filter");
385
442
  }
386
443
  }
387
444
  }
@@ -523,7 +580,7 @@
523
580
  }
524
581
  & > .summary {
525
582
  justify-content: flex-end;
526
- $morphing-sign-width: calc(#{$input-row-height-goal} + #{$largest-border-on-custom-input});
583
+ $morphing-sign-width: #{$input-row-height-goal};
527
584
  .count {
528
585
  margin-right: calc(#{$count-distance-to-right} - #{$morphing-sign-width});
529
586
  }
@@ -684,6 +741,7 @@
684
741
  }
685
742
  }
686
743
  }
744
+ @include CheckboxColor();
687
745
  }
688
746
  }
689
747
  .sorting {
@@ -712,17 +770,31 @@
712
770
  }
713
771
 
714
772
  @mixin default_morphing_sign_in_expandable {
715
- .morphing-sign span {
716
- background: #333333;
773
+ .morphing-sign {
774
+ span {
775
+ background: #333333;
717
776
 
718
- &:first-child {
719
- width: 5%;
720
- left: 47.5%;
777
+ &:first-child {
778
+ width: 5%;
779
+ left: 47.5%;
780
+ }
781
+
782
+ &:last-child {
783
+ height: 5%;
784
+ top: 47.5%;
785
+ }
721
786
  }
787
+ }
788
+ }
789
+
790
+ @mixin CheckboxColor() {
791
+ .checkbox-color {
792
+ display: flex;
793
+ flex-wrap: wrap;
794
+ justify-content: space-between;
722
795
 
723
- &:last-child {
724
- height: 5%;
725
- top: 47.5%;
796
+ .input-row {
797
+ width: calc(50% - 10px);
726
798
  }
727
799
  }
728
800
  }
@@ -1,9 +1,7 @@
1
1
  @use "../../../variables";
2
2
  @use "../../../helpers/utils";
3
3
 
4
- /*
5
- * Mobile modal - taking arguments from SortAndFilter mixin
6
- */
4
+ /// Mobile modal - taking arguments from SortAndFilter mixin so see SortAndFilter docs for more info
7
5
  @mixin SortAndFilterModal(
8
6
  $mobile-top-level-collapse-color,
9
7
  $mobile-top-level-collapse-background,
@@ -39,7 +37,7 @@
39
37
  }
40
38
 
41
39
  .filter-sort-modal {
42
- z-index: calc(variables.$base-z-index + 2);
40
+ z-index: calc(#{variables.$base-z-index} + 2);
43
41
  position: fixed;
44
42
  top: 0;
45
43
  left: 30px;
@@ -6,6 +6,10 @@
6
6
  @use "../../../helpers/supports-hover";
7
7
  @use "SortAndFilter";
8
8
 
9
+ /// A wrapper around SortAndFilter that styles the sorting and filtering menus for the white theme by providing a default set of white variables.
10
+ ///
11
+ /// ### Parameters
12
+ /// See [SortAndFilter](#undefined-mixin-SortAndFilter) for parameters.
9
13
  @mixin WhiteSortAndFilter(
10
14
  $mobile-top-level-collapse-color: variables.$brand-black,
11
15
  $mobile-top-level-collapse-background: #fff,
@@ -17,10 +21,10 @@
17
21
  $checkbox-checkmark-color: #fff,
18
22
  $checkbox-border-radius: if(variables.$border-radius == 0, 0, if(variables.$border-radius == 0px, 0, 2px)),
19
23
  // if global border radius is 0 or 0px, don't round input fields in their default value
20
- $checkbox-border: 1px solid variables.$brand-black,
24
+ $checkbox-border: 1px solid variables.$brand-dark-grey,
21
25
  $checkbox-top-offset: 0px,
22
26
  $checkbox-left-offset: 0px,
23
- $radio-border: 1px solid variables.$brand-black,
27
+ $radio-border: 1px solid variables.$brand-dark-grey,
24
28
  $radio-background-color: #fff,
25
29
  $radio-selected-dot-color: variables.$brand-black,
26
30
  $radio-selected-dot-size: 14px,
@@ -1,6 +1,11 @@
1
1
  @use "../../variables";
2
2
  @use "../../helpers/utils";
3
3
 
4
+ /// Toast is a small, unobtrusive, banner that appears at the bottom of the page when we clear their filters when going sideways in the category tree (or they do it manually). The Toast has a button that allows them to get their filters back (restore them) in case they want it back.
5
+ /// It's a general component otherwise and might also be used for other messages.
6
+ /// @param {Number} $z-index [variables.$base-z-index * 5] - The z-index of the Toast.
7
+ /// @param {Color} $progress-bar-color [variables.$brand-dark-grey] - The color of the progress bar below the toast that shows when it will auto-close.
8
+
4
9
  @mixin Toast($z-index: calc(#{variables.$base-z-index} + 5), $progress-bar-color: variables.$brand-dark-grey) {
5
10
  .depict.plp.toast {
6
11
  position: fixed;
@@ -1,6 +1,7 @@
1
1
  @use "sass:meta";
2
2
 
3
3
  // Component style mixins
4
+ @use "../../variables";
4
5
  @use "SelectedFilters";
5
6
  @use "ScrollStatus";
6
7
  @use "SlidableItems";
@@ -23,19 +24,24 @@
23
24
  @forward "ProductListingPage";
24
25
  @forward "Buttons";
25
26
 
26
- // Default variables
27
+ /// Default variables
27
28
  @forward "../../variables";
28
29
 
29
- // Load all mixins with default values. If only minor theming is needed styles in variables.scss can be
30
- // reassigned: https://sass-lang.com/documentation/at-rules/use#reassigning-variables
31
- // If more control is needed use these mixins separately and pass custom params
32
- @mixin all-components() {
30
+ /// Load all PLP mixins with default values. PLP encompasses both Search and Category page, so you will always need to include the mixins that this includes somehow. If only minor theming is needed styles in variables.scss can be
31
+ /// reassigned: https://sass-lang.com/documentation/at-rules/use#reassigning-variables
32
+ /// If more control is needed use these mixins separately and pass custom params
33
+
34
+ @mixin all-PLP-components() {
33
35
  .depict.plp {
34
36
  @include PLPResults.PLPResults();
35
37
  @include ProductListingPage.ProductListingPage();
36
38
  @include SelectedFilters.SelectedFilters();
37
39
  @include ScrollStatus.ScrollStatus();
38
- @include SortAndFilter.SortAndFilter();
40
+ @if variables.$white {
41
+ @include WhiteSortAndFilter.WhiteSortAndFilter();
42
+ } @else {
43
+ @include SortAndFilter.SortAndFilter();
44
+ }
39
45
  @include FloatingButtons.FloatingButtons();
40
46
  @include SlidableItems.SlidableItems();
41
47
  @include Buttons.PrimaryButton();