@depict-ai/react-ui 0.0.79 → 0.0.80

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 (42) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/main.js +1 -1
  3. package/dist/module.js +1 -1
  4. package/dist/styles/components/PLP/Buttons.scss +152 -0
  5. package/dist/styles/components/PLP/MorphingSign.scss +32 -0
  6. package/dist/styles/components/PLP/PLPResults.scss +27 -0
  7. package/dist/styles/components/PLP/ProductListingPage.scss +165 -0
  8. package/dist/styles/components/PLP/ScrollStatus.scss +28 -0
  9. package/dist/styles/components/PLP/SelectedFilters.scss +81 -0
  10. package/dist/styles/components/PLP/SlidableItems.scss +118 -0
  11. package/dist/styles/components/PLP/SortAndFilter/FloatingButtons.scss +76 -0
  12. package/dist/styles/components/PLP/SortAndFilter/SortAndFilter.scss +816 -0
  13. package/dist/styles/components/PLP/SortAndFilter/SortAndFilterModal.scss +157 -0
  14. package/dist/styles/components/PLP/Toast.scss +61 -0
  15. package/dist/styles/components/PLP/index.scss +15 -0
  16. package/dist/styles/components/category/BreadCrumbs.scss +25 -0
  17. package/dist/styles/components/category/CategoryTitle.scss +33 -0
  18. package/dist/styles/components/category/QuickLinks.scss +57 -0
  19. package/dist/styles/components/category/index.scss +7 -0
  20. package/dist/styles/components/search/Autocomplete.scss +182 -0
  21. package/dist/styles/components/search/CategorySuggestions.scss +53 -0
  22. package/dist/styles/components/search/InstantCard.scss +119 -0
  23. package/dist/styles/components/search/InstantResults.scss +12 -0
  24. package/dist/styles/components/search/PreviousSearches.scss +83 -0
  25. package/dist/styles/components/search/SearchField.scss +160 -0
  26. package/dist/styles/components/search/SearchModal.scss +86 -0
  27. package/dist/styles/components/search/SearchRecommendations.scss +28 -0
  28. package/dist/styles/components/search/ShowingResultsFor.scss +7 -0
  29. package/dist/styles/components/search/index.scss +12 -0
  30. package/dist/styles/{plain-css-fallback-styling.css → default.css} +1 -1
  31. package/dist/styles/helpers/color_inference.scss +112 -0
  32. package/dist/styles/helpers/custom_input.scss +194 -0
  33. package/dist/styles/helpers/supports-hover.scss +7 -0
  34. package/dist/styles/helpers/utils.scss +110 -0
  35. package/dist/styles/index.scss +57 -1
  36. package/dist/styles/package.json +31 -0
  37. package/dist/styles/variables.scss +312 -0
  38. package/dist-server/index.d.ts +1 -1
  39. package/dist-server/main.js +1 -1
  40. package/dist-server/module.js +1 -1
  41. package/package.json +11 -18
  42. package/README.md +0 -3
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { BaseProductListingConfig, BaseProviderConfig, BaseSearchProviderConfig,
2
2
  import { Display } from "@depict-ai/utilishared";
3
3
  import React, { ReactNode, PropsWithChildren, ReactElement } from "react";
4
4
  import { Locale } from "@depict-ai/ui/locales";
5
- export const version = "0.0.79";
5
+ export const version = "0.0.80";
6
6
  interface PLPConfig<T extends Display> extends BaseProductListingConfig {
7
7
  /**
8
8
  * The product card to use for rendering products.
package/dist/main.js CHANGED
@@ -27,7 +27,7 @@ $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fb
27
27
  $parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
28
28
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
29
29
  // Note, if you add an export here, also add one in src-server/main.ts
30
- const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.79";
30
+ const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.80";
31
31
 
32
32
 
33
33
 
package/dist/module.js CHANGED
@@ -9,7 +9,7 @@ import {createPortal as $TZSbU$createPortal} from "react-dom";
9
9
 
10
10
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
11
11
  // Note, if you add an export here, also add one in src-server/main.ts
12
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.79";
12
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.80";
13
13
 
14
14
 
15
15
 
@@ -0,0 +1,152 @@
1
+ @use "../../variables";
2
+ @use "../../helpers/supports-hover";
3
+ @use "../../helpers/utils";
4
+ @use "sass:color";
5
+ @use "sass:map";
6
+
7
+ /// 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.
8
+ /// @example
9
+ /// filter: map.get(Buttons.get-primary-button-properties(), "focus-visible-filter");
10
+ @function get-primary-button-properties() {
11
+ $primary-button-properties: (
12
+ "background": variables.get-background-color("inverse", "default"),
13
+ "hover-background": variables.get-background-color("inverse", "hover"),
14
+ "active-background": variables.get-background-color("inverse", "pressed"),
15
+ "color": variables.get-text-icon-color("inverse", "default"),
16
+ "border": 1px solid transparent,
17
+ "border-radius": variables.$border-radius,
18
+ "hover-filter": drop-shadow(-2px -2px 4px rgba(255, 255, 255, 0.25)) drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.15)),
19
+ "active-filter": drop-shadow(2px 2px 4px rgba(255, 255, 255, 0.25)) drop-shadow(-2px -2px 4px rgba(0, 0, 0, 0.15)),
20
+ "focus-visible-filter": drop-shadow(2px 2px 4px rgba(65, 143, 195, 0.8))
21
+ drop-shadow(-2px -2px 4px rgba(65, 143, 195, 0.8)),
22
+ );
23
+ @return map.deep-merge($primary-button-properties, variables.$primary-button);
24
+ }
25
+
26
+ /// 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.
27
+ /// @example
28
+ /// filter: map.get(Buttons.get-secondary-button-properties(), "focus-visible-filter");
29
+ @function get-secondary-button-properties() {
30
+ $secondary-button-properties: (
31
+ "background": variables.get-background-color("base", "default"),
32
+ "hover-background": variables.get-background-color("base", "hover"),
33
+ "active-background": variables.get-background-color("base", "pressed"),
34
+ "color": variables.get-text-icon-color("base", "default"),
35
+ "border": variables.get-border-color("base", "default") 1px solid,
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.deep-merge($secondary-button-properties, variables.$secondary-button);
43
+ }
44
+
45
+ /// Generates styling for our primary buttons, including hover, active and focus-visible states
46
+ @mixin PrimaryButton(
47
+ $background: map.get(get-primary-button-properties(), "background"),
48
+ $hover-background: map.get(get-primary-button-properties(), "hover-background"),
49
+ $active-background: map.get(get-primary-button-properties(), "active-background"),
50
+ $color: map.get(get-primary-button-properties(), "color"),
51
+ $border: map.get(get-primary-button-properties(), "border"),
52
+ $border-radius: map.get(get-primary-button-properties(), "border-radius"),
53
+ $hover-filter: map.get(get-primary-button-properties(), "hover-filter"),
54
+ $active-filter: map.get(get-primary-button-properties(), "active-filter"),
55
+ $focus-visible-filter: map.get(get-primary-button-properties(), "focus-visible-filter")
56
+ ) {
57
+ button.major {
58
+ @include Button(
59
+ $background,
60
+ $hover-background,
61
+ $active-background,
62
+ $color,
63
+ $border,
64
+ $border-radius,
65
+ $hover-filter,
66
+ $active-filter,
67
+ $focus-visible-filter
68
+ ) {
69
+ @content;
70
+ }
71
+ }
72
+ }
73
+
74
+ /// Generates styling for our secondary buttons, including hover, active and focus-visible states
75
+
76
+ @mixin SecondaryButton(
77
+ $background: map.get(get-secondary-button-properties(), "background"),
78
+ $hover-background: map.get(get-secondary-button-properties(), "hover-background"),
79
+ $active-background: map.get(get-secondary-button-properties(), "active-background"),
80
+ $color: map.get(get-secondary-button-properties(), "color"),
81
+ $border: map.get(get-secondary-button-properties(), "border"),
82
+ $border-radius: map.get(get-secondary-button-properties(), "border-radius"),
83
+ $hover-filter: map.get(get-secondary-button-properties(), "hover-filter"),
84
+ $active-filter: map.get(get-secondary-button-properties(), "active-filter"),
85
+ $focus-visible-filter: map.get(get-secondary-button-properties(), "focus-visible-filter")
86
+ ) {
87
+ button.minor {
88
+ @include Button(
89
+ $background,
90
+ $hover-background,
91
+ $active-background,
92
+ $color,
93
+ $border,
94
+ $border-radius,
95
+ $hover-filter,
96
+ $active-filter,
97
+ $focus-visible-filter
98
+ ) {
99
+ @content;
100
+ }
101
+ }
102
+ }
103
+
104
+ @mixin Button(
105
+ $background,
106
+ $hover-background,
107
+ $active-background,
108
+ $color,
109
+ $border,
110
+ $border-radius,
111
+ $hover-filter,
112
+ $active-filter,
113
+ $focus-visible-filter,
114
+ $padding: 10px 20px
115
+ ) {
116
+ background: $background;
117
+ color: $color;
118
+ border: $border;
119
+ border-radius: $border-radius;
120
+ @if $padding {
121
+ padding: $padding;
122
+ }
123
+ display: flex;
124
+ white-space: pre-wrap; // can't have spaces otherwise
125
+ justify-content: center;
126
+ align-items: center;
127
+ cursor: pointer;
128
+ transition: filter 150ms ease-in-out, background 100ms ease-in-out;
129
+
130
+ svg path {
131
+ fill: $color; // treat icons the same as text
132
+ }
133
+
134
+ @include supports-hover.supports-hover() {
135
+ &:hover {
136
+ filter: $hover-filter;
137
+ background: $hover-background;
138
+ }
139
+ }
140
+ &:active {
141
+ filter: $active-filter;
142
+ background: $active-background;
143
+ }
144
+ &:focus {
145
+ outline-style: none;
146
+ }
147
+ &:focus-visible {
148
+ filter: $focus-visible-filter;
149
+ background: $hover-background;
150
+ }
151
+ @content;
152
+ }
@@ -0,0 +1,32 @@
1
+ @use "../../variables";
2
+
3
+ @mixin MorphingSign() {
4
+ .morphing-sign {
5
+ /* https://stackoverflow.com/a/38136283 */
6
+ border: 0;
7
+ position: relative;
8
+ width: 1.5em;
9
+ height: 1.5em;
10
+
11
+ span {
12
+ position: absolute;
13
+ background: variables.get-text-icon-color("neutral", "default");
14
+ border-radius: 2px;
15
+ }
16
+
17
+ /* Create the "+" shape by positioning the spans absolutely */
18
+ span:first-child {
19
+ top: 25%;
20
+ bottom: 25%;
21
+ width: 10%;
22
+ left: 45%;
23
+ }
24
+
25
+ span:last-child {
26
+ left: 25%;
27
+ right: 25%;
28
+ height: 10%;
29
+ top: 45%;
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,27 @@
1
+ @use "../../variables";
2
+ @use "../../helpers/utils";
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
+
7
+ @mixin PLPResults() {
8
+ .listing-page {
9
+ display: flex;
10
+ flex-direction: column;
11
+
12
+ .no-results {
13
+ background: variables.$page-background-color;
14
+ padding: 40px;
15
+ display: flex;
16
+ justify-content: flex-start;
17
+ align-items: center;
18
+ flex-direction: column;
19
+ flex-grow: 2;
20
+ .hint {
21
+ text-decoration: underline;
22
+ cursor: pointer;
23
+ color: variables.get-text-icon-color("neutral", "default");
24
+ }
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,165 @@
1
+ @use "../../helpers/utils";
2
+ @use "../../variables";
3
+ @use "sass:map";
4
+
5
+ /// 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.
6
+ ///
7
+ /// Note that for the gaps not the exact values will always be used but often multiples for different places where it's appropriate.
8
+
9
+ @mixin ProductListingPage() {
10
+ $spacing-to-filters: map.get(variables.get-gap("listing-page"), "spacing-to-filters");
11
+ $desktop-item-gap: map.get(variables.get-gap("listing-page"), "desktop-item-gap");
12
+ $mobile-item-gap: map.get(variables.get-gap("listing-page"), "mobile-item-gap");
13
+ .listing-page {
14
+ padding: $desktop-item-gap calc(#{$desktop-item-gap} / 2);
15
+ @include mobile_sizes() {
16
+ padding: $mobile-item-gap calc(#{$mobile-item-gap} / 2);
17
+ }
18
+
19
+ &,
20
+ & * {
21
+ box-sizing: border-box;
22
+ }
23
+
24
+ & > .filter-results-for-one-row,
25
+ & > .results-for {
26
+ margin-bottom: calc(#{$desktop-item-gap} / 2);
27
+ @include mobile_sizes() {
28
+ margin-bottom: calc(#{$mobile-item-gap} / 2);
29
+ }
30
+ }
31
+
32
+ & > .sort-and-filter-buttons {
33
+ margin-top: calc(#{$desktop-item-gap} / 2);
34
+ margin-bottom: calc(#{$desktop-item-gap} / 2);
35
+ @include mobile_sizes() {
36
+ margin-top: calc(#{$mobile-item-gap} / 2);
37
+ margin-bottom: calc(#{$mobile-item-gap} / 2);
38
+ }
39
+ }
40
+ .PLP-results {
41
+ margin-top: calc(#{$desktop-item-gap} / 2);
42
+ @include mobile_sizes() {
43
+ margin-top: calc(#{$mobile-item-gap} / 2);
44
+ }
45
+ display: flex;
46
+ & > {
47
+ .filters,
48
+ .sorting {
49
+ margin-left: $spacing-to-filters;
50
+ }
51
+ }
52
+ }
53
+ .cards {
54
+ // this is for all product lists, meaning PLPResults (category + search product lists) and SearchRecommendations
55
+ flex-wrap: wrap;
56
+ display: flex;
57
+ flex-direction: row;
58
+ flex-grow: 1;
59
+ overflow: hidden;
60
+ align-content: flex-start;
61
+ }
62
+ }
63
+ }
64
+
65
+ /// Styling that ties together the different components on the SearchPage. Mainly takes care of margins and paddings.
66
+ ///
67
+ /// Note that for the gaps not the exact values will always be used but often multiples for different places where it's appropriate.
68
+ ///
69
+
70
+ @mixin SearchPage() {
71
+ $spacing-to-filters: map.get(variables.get-gap("listing-page"), "spacing-to-filters");
72
+ $desktop-item-gap: map.get(variables.get-gap("listing-page"), "desktop-item-gap");
73
+ $mobile-item-gap: map.get(variables.get-gap("listing-page"), "mobile-item-gap");
74
+ $gap-to-recs-factor: map.get(map.get(variables.get-gap("listing-page"), "search"), "gap-to-recs-factor");
75
+ $spacing-above-search-field: map.get(
76
+ map.get(variables.get-gap("listing-page"), "search"),
77
+ "spacing-above-search-field"
78
+ );
79
+
80
+ .listing-page {
81
+ .search-field {
82
+ $max-width: variables.get-merged(variables.$search-modal-defaults, variables.$search-modal, "max-width");
83
+ width: min(100%, $max-width);
84
+ align-self: center;
85
+
86
+ @if $spacing-above-search-field {
87
+ margin-top: calc(#{$desktop-item-gap} * 2);
88
+ }
89
+ margin-bottom: $desktop-item-gap;
90
+ @include mobile_sizes() {
91
+ margin-bottom: $mobile-item-gap;
92
+ @if $spacing-above-search-field {
93
+ margin-top: calc(#{$mobile-item-gap});
94
+ }
95
+ }
96
+ ~ .category-suggestions .category-suggestion {
97
+ &:last-child {
98
+ margin-right: auto;
99
+ }
100
+ &:first-child {
101
+ margin-left: auto;
102
+ }
103
+ }
104
+ }
105
+ .category-suggestions {
106
+ margin-bottom: $desktop-item-gap;
107
+ @include mobile_sizes() {
108
+ margin-bottom: $mobile-item-gap;
109
+ }
110
+ }
111
+ .search-field {
112
+ // if there are no category suggestions we should have 2x the gap between where they should be and what's there, only for desktop tho
113
+ & + .filter-results-for-one-row,
114
+ & + .results-for {
115
+ @media (min-width: 652px) {
116
+ margin-top: $desktop-item-gap;
117
+ }
118
+ }
119
+ }
120
+ .search-recs {
121
+ // whole gap here so that we don't have to make the margin bottom of search-results conditional
122
+ margin-top: calc(#{$desktop-item-gap} * #{$gap-to-recs-factor});
123
+ // in between these there's the border, a visual line separating the results and recs
124
+ padding-top: calc(#{$desktop-item-gap} * #{$gap-to-recs-factor});
125
+ @include mobile_sizes() {
126
+ margin-top: calc(#{$mobile-item-gap} * #{$gap-to-recs-factor});
127
+ padding-top: calc(#{$mobile-item-gap} * #{$gap-to-recs-factor});
128
+ }
129
+ }
130
+ .PLP-results.nothing + .search-recs {
131
+ // if no results, bring us closer
132
+ margin-top: calc(#{$desktop-item-gap} * 1.5);
133
+ padding-top: calc(#{$desktop-item-gap} * 1.5);
134
+ @include mobile_sizes() {
135
+ margin-top: calc(#{$mobile-item-gap} * 1.5);
136
+ padding-top: calc(#{$mobile-item-gap} * 1.5);
137
+ }
138
+ }
139
+ }
140
+ }
141
+
142
+ /// Styling that ties together the different components on the CategoryPage. Mainly takes care of margins and paddings.
143
+ ///
144
+
145
+ @mixin CategoryPage() {
146
+ $desktop-item-gap: map.get(variables.get-gap("listing-page"), "desktop-item-gap");
147
+ $mobile-item-gap: map.get(variables.get-gap("listing-page"), "mobile-item-gap");
148
+ .listing-page {
149
+ .quicklinks,
150
+ .crumbs {
151
+ margin-bottom: $desktop-item-gap;
152
+ @include mobile_sizes() {
153
+ margin-bottom: $mobile-item-gap;
154
+ }
155
+ }
156
+ }
157
+ }
158
+
159
+ /// Internal mixin that dictates when the vertical spaces should switch to the "mobile" versions
160
+
161
+ @mixin mobile_sizes() {
162
+ @media (max-width: 651px) {
163
+ @content;
164
+ }
165
+ }
@@ -0,0 +1,28 @@
1
+ @use "../../variables";
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 {Number with size unit} $border-radius [variables.$border-radius * 5] - The border-radius of the scroll status.
8
+
9
+ @mixin ScrollStatus() {
10
+ .scroll-status {
11
+ pointer-events: none;
12
+ position: sticky;
13
+ bottom: 10vh;
14
+ white-space: nowrap;
15
+ display: flex;
16
+ justify-content: center;
17
+ z-index: calc(#{variables.$base-z-index} + 4);
18
+ align-items: center;
19
+ opacity: 0;
20
+
21
+ .text {
22
+ background: rgba(variables.get-background-color("inverse", "hover"), 0.75);
23
+ color: variables.get-text-icon-color("inverse", "default");
24
+ padding: 10px 20px;
25
+ border-radius: calc(#{variables.$border-radius} * 5);
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,81 @@
1
+ @use "../../variables";
2
+ @use "../../helpers/utils";
3
+ @use "../../helpers/supports-hover";
4
+ @use "Buttons";
5
+ @use "ProductListingPage";
6
+ @use "sass:map";
7
+
8
+ /// 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.
9
+
10
+ @mixin SelectedFilters() {
11
+ .listing-page .selected-filters {
12
+ .inner {
13
+ // this is in here because it's an ExpandingContainer and the animation gets borked otherwise
14
+ $margin-on-desktop: map.get(
15
+ map.get(variables.get-gap("listing-page"), "above-and-below-selected-filters"),
16
+ "desktop"
17
+ );
18
+ $margin-on-mobile: map.get(
19
+ map.get(variables.get-gap("listing-page"), "above-and-below-selected-filters"),
20
+ "mobile"
21
+ );
22
+ margin-top: $margin-on-desktop;
23
+ margin-bottom: $margin-on-desktop;
24
+ display: flex;
25
+ align-items: center;
26
+
27
+ .title {
28
+ margin-right: 10px;
29
+ }
30
+
31
+ @include ProductListingPage.mobile_sizes() {
32
+ margin-top: $margin-on-mobile;
33
+ margin-bottom: $margin-on-mobile;
34
+ }
35
+
36
+ .title {
37
+ @media (max-width: 600px) {
38
+ display: none;
39
+ }
40
+ font-size: 1.1em;
41
+ text-transform: variables.$uppercase-text-transform;
42
+ color: variables.get-text-icon-color("base", "default");
43
+ }
44
+
45
+ .depict-slider {
46
+ overflow: hidden;
47
+ width: unset;
48
+
49
+ .clear-filter {
50
+ border: 1px solid map.get(Buttons.get-primary-button-properties(), "background");
51
+
52
+ svg {
53
+ width: 12.64px;
54
+ height: 12.64px;
55
+ }
56
+ }
57
+
58
+ .clear-all-filters {
59
+ border: map.get(Buttons.get-secondary-button-properties(), "border");
60
+ }
61
+
62
+ .clear-filter,
63
+ .clear-all-filters {
64
+ flex: 0 0 auto;
65
+ box-sizing: border-box;
66
+ white-space: nowrap;
67
+ padding: 5px 10px;
68
+ display: flex;
69
+ @include utils.flex-gap(5px, "row nowrap");
70
+ align-items: center;
71
+ border-radius: variables.$border-radius;
72
+ font-size: 1em;
73
+ line-height: 1;
74
+ cursor: pointer;
75
+ }
76
+ }
77
+
78
+ @content;
79
+ }
80
+ }
81
+ }
@@ -0,0 +1,118 @@
1
+ // @use "../../../rendering/slider_button_positioning";
2
+ @use "../../helpers/utils";
3
+ @use "Buttons";
4
+ @use "../../variables";
5
+ @use "../../helpers/supports-hover";
6
+ @use "sass:map";
7
+
8
+ /// Mixin copy-pasted from @depict-ai/utilishared that helps with positioning slider buttons
9
+ @mixin button_positioning {
10
+ .d-navbutton {
11
+ position: absolute;
12
+ z-index: 2;
13
+ top: 50%;
14
+ transform: translateY(-50%);
15
+ -webkit-transform: translateY(-50%);
16
+ touch-action: manipulation;
17
+ transition-duration: 0.2s;
18
+ padding-right: 1px;
19
+ cursor: pointer;
20
+ &.hidden {
21
+ cursor: default;
22
+ opacity: 0;
23
+ animation-name: depict_slider_button_unclickable;
24
+ animation-duration: 5s;
25
+ animation-fill-mode: forwards;
26
+ }
27
+ &.left {
28
+ transform: translateY(-50%) rotate(180deg);
29
+ left: -1px; // fix chrome rendering half a px of not the button
30
+ }
31
+ &.right {
32
+ right: -1px;
33
+ }
34
+ img {
35
+ width: 100%;
36
+ height: 100%;
37
+ }
38
+ @content;
39
+ }
40
+ @keyframes depict_slider_button_unclickable {
41
+ 0% {
42
+ pointer-events: all;
43
+ }
44
+ 100% {
45
+ pointer-events: none;
46
+ visibility: hidden; // make not keyboard focusable with tab
47
+ }
48
+ }
49
+ }
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
+ @mixin SlidableItems() {
56
+ .depict-slider {
57
+ width: 100%;
58
+ position: relative;
59
+ .sliding {
60
+ height: 100%;
61
+ @include utils.flex-gap(10px, "row nowrap");
62
+ align-items: center;
63
+ display: flex;
64
+ flex-direction: row;
65
+ flex-wrap: nowrap;
66
+ overflow-x: scroll;
67
+ /* Internet Explorer 10+; next 3 properties stolen from: https://stackoverflow.com/a/38994837*/
68
+ -ms-overflow-style: none;
69
+ /* Firefox */
70
+ scrollbar-width: none;
71
+ // Chrome and Safari
72
+ &::-webkit-scrollbar {
73
+ display: none;
74
+ }
75
+ }
76
+ // TODO: break out button button positioning related lib code into a package and import that here instead of duplicating the code
77
+ // @include slider_button_positioning.button_positioning {
78
+ @include button_positioning {
79
+ height: calc(100% + 2px);
80
+ padding-top: 0;
81
+ padding-left: 0;
82
+ padding-bottom: 0;
83
+ width: 26px;
84
+ background: linear-gradient(270deg, variables.$page-background-color 50%, transparent 105%);
85
+ display: flex;
86
+ align-items: center;
87
+ justify-content: flex-end;
88
+ border: none;
89
+
90
+ & > div {
91
+ display: flex;
92
+ }
93
+
94
+ @include supports-hover.supports-hover() {
95
+ &:hover {
96
+ svg {
97
+ transform: scale(1.2);
98
+ }
99
+ }
100
+ }
101
+ &:focus-visible {
102
+ svg {
103
+ transform: scale(1.5);
104
+ path {
105
+ filter: map.get(Buttons.get-secondary-button-properties(), "focus-visible-filter");
106
+ }
107
+ }
108
+ }
109
+ svg {
110
+ transition-duration: 150ms;
111
+ }
112
+
113
+ &:active {
114
+ opacity: 0.9;
115
+ }
116
+ }
117
+ }
118
+ }