@depict-ai/react-ui 0.0.80 → 0.0.81

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 (43) hide show
  1. package/README.md +3 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/main.js +1 -1
  4. package/dist/module.js +1 -1
  5. package/dist/styles/index.scss +1 -57
  6. package/dist/styles/plain-css-fallback-styling.css +1 -0
  7. package/dist-server/index.d.ts +1 -1
  8. package/dist-server/main.js +1 -1
  9. package/dist-server/module.js +1 -1
  10. package/package.json +18 -13
  11. package/dist/styles/components/PLP/Buttons.scss +0 -152
  12. package/dist/styles/components/PLP/MorphingSign.scss +0 -32
  13. package/dist/styles/components/PLP/PLPResults.scss +0 -27
  14. package/dist/styles/components/PLP/ProductListingPage.scss +0 -165
  15. package/dist/styles/components/PLP/ScrollStatus.scss +0 -28
  16. package/dist/styles/components/PLP/SelectedFilters.scss +0 -81
  17. package/dist/styles/components/PLP/SlidableItems.scss +0 -118
  18. package/dist/styles/components/PLP/SortAndFilter/FloatingButtons.scss +0 -76
  19. package/dist/styles/components/PLP/SortAndFilter/SortAndFilter.scss +0 -816
  20. package/dist/styles/components/PLP/SortAndFilter/SortAndFilterModal.scss +0 -157
  21. package/dist/styles/components/PLP/Toast.scss +0 -61
  22. package/dist/styles/components/PLP/index.scss +0 -15
  23. package/dist/styles/components/category/BreadCrumbs.scss +0 -25
  24. package/dist/styles/components/category/CategoryTitle.scss +0 -33
  25. package/dist/styles/components/category/QuickLinks.scss +0 -57
  26. package/dist/styles/components/category/index.scss +0 -7
  27. package/dist/styles/components/search/Autocomplete.scss +0 -182
  28. package/dist/styles/components/search/CategorySuggestions.scss +0 -53
  29. package/dist/styles/components/search/InstantCard.scss +0 -119
  30. package/dist/styles/components/search/InstantResults.scss +0 -12
  31. package/dist/styles/components/search/PreviousSearches.scss +0 -83
  32. package/dist/styles/components/search/SearchField.scss +0 -160
  33. package/dist/styles/components/search/SearchModal.scss +0 -86
  34. package/dist/styles/components/search/SearchRecommendations.scss +0 -28
  35. package/dist/styles/components/search/ShowingResultsFor.scss +0 -7
  36. package/dist/styles/components/search/index.scss +0 -12
  37. package/dist/styles/default.css +0 -1
  38. package/dist/styles/helpers/color_inference.scss +0 -112
  39. package/dist/styles/helpers/custom_input.scss +0 -194
  40. package/dist/styles/helpers/supports-hover.scss +0 -7
  41. package/dist/styles/helpers/utils.scss +0 -110
  42. package/dist/styles/package.json +0 -31
  43. package/dist/styles/variables.scss +0 -312
@@ -1,112 +0,0 @@
1
- @use "sass:map";
2
- @use "sass:color";
3
- @use "./utils";
4
-
5
- @function get-possible-inferred-or-merged-something($default-values-map, $user-overrides-map, $type, $state) {
6
- $value-from-merged-map: map.get(map.get(map.deep-merge($default-values-map, $user-overrides-map), $type), $state);
7
- // If the color is specified as override, just return it.
8
- @if map.has-key($user-overrides-map, $type) and map.has-key(map.get($user-overrides-map, $type), $state) {
9
- @return $value-from-merged-map;
10
- }
11
- $infer-defaults-return-value: infer-defaults($user-overrides-map, $type);
12
- $safe-overrides-map: map.get($infer-defaults-return-value, "map");
13
- $changed-direction: map.get($infer-defaults-return-value, "changed-direction");
14
- // If we don't have overrides or don't have a "default" override, don't infer and return from the merged map.
15
- @if (not map.has-key($safe-overrides-map, $type)) or (not map.has-key(map.get($safe-overrides-map, $type), "default"))
16
- {
17
- @return $value-from-merged-map;
18
- }
19
-
20
- // If the color is specified as override NOW, just return it.
21
- @if map.has-key($safe-overrides-map, $type) and map.has-key(map.get($safe-overrides-map, $type), $state) {
22
- @return map.get(map.get($safe-overrides-map, $type), $state);
23
- }
24
-
25
- // We're good to infer
26
- $our-color: map.get(map.get($safe-overrides-map, $type), "default");
27
- $direction-to-go: if(
28
- not $changed-direction,
29
- if(color.lightness($our-color) >= 50%, "darken", "lighten"),
30
- $changed-direction
31
- );
32
-
33
- //"hover": get-merged($base-colors-defaults, $base-colors, 600),
34
- //"pressed": get-merged($base-colors-defaults, $base-colors, 1000),
35
- //"disabled": get-merged($base-colors-defaults, $base-colors, 400),
36
- @if $direction-to-go == "darken" {
37
- @if $state == "hover" {
38
- @return color.adjust($our-color, $lightness: -12%, $saturation: -7%);
39
- } @else if $state == "pressed" {
40
- @return color.adjust($our-color, $lightness: -20%, $saturation: -10%);
41
- } @else if $state == "disabled" {
42
- @return color.adjust($our-color, $lightness: -30%, $saturation: -5%);
43
- }
44
- } @else {
45
- @if $state == "hover" {
46
- @return color.adjust($our-color, $lightness: 10%, $saturation: 5%);
47
- } @else if $state == "pressed" {
48
- @return color.adjust($our-color, $lightness: 20%);
49
- } @else if $state == "disabled" {
50
- @return color.adjust($our-color, $lightness: 30%);
51
- }
52
- }
53
- }
54
-
55
- @function infer-defaults($user-overrides-map, $type) {
56
- @if (not map.has-key($user-overrides-map, "base")) or
57
- (not map.has-key(map.get($user-overrides-map, "base"), "default"))
58
- {
59
- // If no base to fallback this function is useless
60
- @return ("map": $user-overrides-map, "changed-direction": false);
61
- }
62
- // Check if have default
63
- @if (not map.has-key($user-overrides-map, $type)) or (not map.has-key(map.get($user-overrides-map, $type), "default"))
64
- {
65
- $default-color: map.get(map.get($user-overrides-map, "base"), "default");
66
- // it's important to always go in the same direction with our inference but since
67
- // default color is the same for base, neutral and subtle we don't need to preserve the direction somewhere else, it will automatically be consistent
68
- $changed-color: black;
69
- $changed-direction: false;
70
- @if $type == "neutral" {
71
- @if color.lightness($default-color) >= 50% {
72
- $changed-color: color.adjust($default-color, $lightness: -25%, $saturation: -10%);
73
- $changed-direction: "darken";
74
- } @else {
75
- $changed-color: color.adjust($default-color, $lightness: 25%);
76
- $changed-direction: "lighten";
77
- }
78
- } @else if $type == "subtle" {
79
- @if color.lightness($default-color) >= 50% {
80
- // Please never change lightness by more than 50% as the distance won't be the same between neutral and subtle anymore
81
- // If you do, find out the max change possible for a certain color and only change neutral half of that (I think that's like using color.scale but that function doesn't work in the black-direction IIRC?)
82
- $changed-color: color.adjust($default-color, $lightness: -30%, $saturation: -20%);
83
- $changed-direction: "darken";
84
- } @else {
85
- $changed-color: color.adjust(
86
- $default-color,
87
- $lightness: 30%,
88
- $saturation:
89
- if((color.saturation($default-color)) < 30% and (color.saturation($default-color) > 2%), 20%, -20%)
90
- );
91
- $changed-direction: "lighten";
92
- }
93
- } @else if $type == "inverse" {
94
- // Invert color and ensure saturation is same as input color
95
- $changed-color: color.change(color.invert($default-color), $saturation: color.saturation($default-color));
96
- } @else {
97
- @debug "Unknown type: #{$type}";
98
- }
99
- // Merge in default
100
- $modified-map: map.deep-merge(
101
- $user-overrides-map,
102
- (
103
- $type: (
104
- "default": $changed-color,
105
- ),
106
- )
107
- );
108
- @return ("map": $modified-map, "changed-direction": $changed-direction);
109
- }
110
-
111
- @return ("map": $user-overrides-map, "changed-direction": false);
112
- }
@@ -1,194 +0,0 @@
1
- @use "sass:string";
2
- @use "sass:color";
3
- @use "supports-hover";
4
- @use "sass:map";
5
- @use "utils";
6
- @use "../components/PLP/Buttons";
7
-
8
- // https://selleo.com/til/posts/rc5qli22jp-pass-hex-color-to-fill-svg-in-background-url-scss
9
- @function escape-url-hex-color($hex_color) {
10
- $ie-color-string: color.ie-hex-str($hex_color);
11
- $string: string.quote($ie-color-string);
12
- $color: string.slice($string, 4);
13
- @return "%23" + $color;
14
- }
15
-
16
- @mixin custom_input(
17
- $checkbox-background-color,
18
- $checkbox-checked-background-color,
19
- $checkbox-checkmark-color,
20
- $checkbox-border-radius,
21
- $checkbox-border,
22
- $checkbox-left-offset,
23
- $checkbox-top-offset,
24
- $radio-border,
25
- $radio-background-color,
26
- $radio-selected-dot-color,
27
- $radio-selected-dot-size,
28
- $radio-selected-offset,
29
- $hovered-checkbox-bg,
30
- $hovered-checkbox-checked-background-color,
31
- $hovered-checkbox-border,
32
- $hovered-radio-border,
33
- $input-row-height,
34
- $largest-border-on-custom-input
35
- ) {
36
- $width-and-height: calc(
37
- #{$input-row-height} - calc(#{$largest-border-on-custom-input} * 2)
38
- ); // border is on both sides
39
- /* Customize the label (the container) */
40
- .input-row {
41
- position: relative;
42
- cursor: pointer;
43
-
44
- .custom-indicator {
45
- position: relative;
46
- // space to text
47
- margin-right: 10px;
48
- }
49
-
50
- /* Hide the browser's default radio/checkbox input element */
51
- input {
52
- position: absolute;
53
- opacity: 0;
54
- cursor: pointer;
55
- height: 0;
56
- width: 0;
57
- }
58
- /* Create the custom-indicator (hidden when not checked) */
59
- .custom-indicator:after {
60
- content: "";
61
- position: absolute;
62
- display: none;
63
- }
64
-
65
- /* Create a custom checkbox */
66
- input[type="checkbox"] {
67
- & ~ .custom-indicator {
68
- padding: calc(#{$width-and-height} / 2);
69
- background-color: $checkbox-background-color;
70
- border-radius: $checkbox-border-radius;
71
- &:not(.color) {
72
- border: $checkbox-border;
73
- }
74
- &.color {
75
- padding: calc(#{$input-row-height} / 2); // doesn't have border so needs more size
76
- &.outline {
77
- $border-width: 0.5px;
78
- padding: calc(calc(#{$input-row-height} - calc(#{$border-width} * 2)) / 2);
79
- border: $border-width solid #868689;
80
- }
81
- }
82
- }
83
- /* When the checkbox is checked, add a blue background */
84
- &:checked ~ .custom-indicator {
85
- // background-color: #000;
86
- background-color: $checkbox-checked-background-color;
87
- &:after {
88
- background-image: url('data:image/svg+xml;utf8,<svg fill="#{escape-url-hex-color($checkbox-checkmark-color)}" width="12" height="10" viewBox="0 0 12 10" xmlns="http://www.w3.org/2000/svg"><path d="M12 2.0001L10.6 0.600098L4 7.2001L1.4 4.6001L0 6.0001L4 10.0001L12 2.0001Z" /></svg>');
89
- fill: #fff;
90
- color: #fff;
91
- position: absolute;
92
- top: calc(50% + $checkbox-top-offset);
93
- left: calc(50% + $checkbox-left-offset);
94
- transform: translate(-50%, -50%);
95
-
96
- display: block; // Show the custom-indicator when checked
97
-
98
- /* Style the custom-indicator */
99
- width: 12px;
100
- height: 10px;
101
- }
102
- &.color:after {
103
- // Force this to be white for color checkboxes
104
- background-image: url('data:image/svg+xml;utf8,<svg fill="#{escape-url-hex-color(#fff)}" width="12" height="10" viewBox="0 0 12 10" xmlns="http://www.w3.org/2000/svg"><path d="M12 2.0001L10.6 0.600098L4 7.2001L1.4 4.6001L0 6.0001L4 10.0001L12 2.0001Z" /></svg>');
105
- }
106
- &.color.check-dark:after {
107
- background-image: url('data:image/svg+xml;utf8,<svg fill="#{escape-url-hex-color(#000)}" width="12" height="10" viewBox="0 0 12 10" xmlns="http://www.w3.org/2000/svg"><path d="M12 2.0001L10.6 0.600098L4 7.2001L1.4 4.6001L0 6.0001L4 10.0001L12 2.0001Z" /></svg>');
108
- }
109
- &.color.check-multi:after {
110
- background-image: url('data:image/svg+xml;utf8,<svg fill="#{escape-url-hex-color(#fff)}" width="12" height="10" viewBox="0 0 12 10" xmlns="http://www.w3.org/2000/svg"><path style="stroke:black;stroke-width:1px" d="M12 2.0001L10.6 0.600098L4 7.2001L1.4 4.6001L0 6.0001L4 10.0001L12 2.0001Z" /></svg>');
111
- }
112
- }
113
- &:focus-visible ~ .custom-indicator {
114
- background-color: $hovered-checkbox-bg;
115
- &.color {
116
- filter: map.get(Buttons.get-secondary-button-properties(), "focus-visible-filter");
117
- }
118
- }
119
- &:checked:focus-visible ~ .custom-indicator {
120
- background-color: $hovered-checkbox-checked-background-color;
121
- }
122
- }
123
- @include supports-hover.supports-hover() {
124
- &:hover input[type="checkbox"] {
125
- & ~ .custom-indicator {
126
- background-color: $hovered-checkbox-bg;
127
- &:not(.color) {
128
- border: $hovered-checkbox-border;
129
- $hovered-border-width: get_border_width($hovered-checkbox-border);
130
- $border-width: get_border_width($checkbox-border);
131
- padding: calc(calc(#{$width-and-height} / 2) - calc(#{$hovered-border-width} - #{$border-width}));
132
- }
133
- }
134
- &:checked ~ .custom-indicator {
135
- background-color: $hovered-checkbox-checked-background-color;
136
- }
137
- }
138
- }
139
-
140
- /* Create a custom radio button */
141
- input[type="radio"] {
142
- ~ .custom-indicator {
143
- padding: calc(#{$width-and-height} / 2);
144
- border-radius: 50%;
145
- border: $radio-border;
146
- background-color: $radio-background-color;
147
- }
148
- &:checked ~ .custom-indicator {
149
- background-color: transparent;
150
- &:after {
151
- display: block; // Show the custom-indicator when checked
152
-
153
- /* Style the custom-indicator */
154
- width: $radio-selected-dot-size;
155
- height: $radio-selected-dot-size;
156
- left: calc(50% + $radio-selected-offset);
157
- top: calc(50% + $radio-selected-offset);
158
- transform: translate(-50%, -50%);
159
-
160
- // width: 8px;
161
- // height: 8px;
162
- // top: 6px;
163
- // left: 6px;
164
- background-color: $radio-selected-dot-color;
165
- border-radius: 50%;
166
- }
167
- }
168
- &:focus-visible ~ .custom-indicator {
169
- @include utils.highlight-background($radio-background-color);
170
- }
171
- &:checked:focus-visible ~ .custom-indicator:after {
172
- @include utils.highlight-background($radio-selected-dot-color, 15%, 25%);
173
- }
174
- }
175
- @include supports-hover.supports-hover() {
176
- &:hover input[type="radio"] ~ .custom-indicator {
177
- border: $hovered-radio-border;
178
- $hovered-border-width: get_border_width($hovered-radio-border);
179
- $border-width: get_border_width($radio-border);
180
- padding: calc(calc(#{$width-and-height} / 2) - calc(#{$hovered-border-width} - #{$border-width}));
181
- }
182
- }
183
-
184
- @content;
185
- }
186
- }
187
-
188
- @function get_border_width($border-declaration) {
189
- @if $border-declaration == "none" or $border-declaration == "unset" {
190
- @return 0px;
191
- } @else {
192
- @return nth($border-declaration, 1);
193
- }
194
- }
@@ -1,7 +0,0 @@
1
- /// Wraps @content in a media query that targets devices that support `:hover` in a non-fallback way.
2
-
3
- @mixin supports-hover {
4
- @media not all and (hover: none) {
5
- @content;
6
- }
7
- }
@@ -1,110 +0,0 @@
1
- @use "sass:math";
2
- @use "sass:color";
3
-
4
- /// This mixin is used for the SortAndFilterModal and the SearchModal to color the backdrop behind the modal
5
- /// @param {Color} $background [rgba(0, 0, 0, 0.4)] - The background color of the backdrop, keep in mind it should be a transparent color
6
- /// @param {Number} $z-index - The z-index of the backdrop
7
- @mixin modal-backdrop($background: rgba(0, 0, 0, 0.4), $z-index) {
8
- position: fixed;
9
- background: $background;
10
- z-index: $z-index;
11
- left: 0;
12
- right: 0;
13
- bottom: 0;
14
- top: 0;
15
- touch-action: none;
16
- }
17
-
18
- /// This mixin sets the background property to the provided color but darkens it by the provided amounts if it is brighter or darker than 50%
19
- /// The purpose is to really easily create i.e. hover effects
20
- /// @param {Color} $normal-background - The color to darken or lighten
21
- /// @param {Percentage} $darken-factor [10%] - The amount to darken the color by
22
- /// @param {Percentage} $lighten-factor [10%] - The amount to lighten the color by
23
- /// @param {Percentage} $saturation-factor [$darken-factor] - The amount to decrease saturation by when the color is darkened
24
- @mixin highlight-background(
25
- $normal-background,
26
- $darken-factor: 10%,
27
- $lighten-factor: 10%,
28
- $saturation-factor: $darken-factor
29
- ) {
30
- @if color.lightness($normal-background) >= 50% {
31
- background: color.adjust($normal-background, $lightness: -$darken-factor, $saturation: -$saturation-factor);
32
- } @else {
33
- background: color.adjust($normal-background, $lightness: $lighten-factor);
34
- }
35
- }
36
-
37
- /// Like highlight-background mixin but returns color value
38
- @function highlight-color(
39
- $normal-background,
40
- $darken-factor: 10%,
41
- $lighten-factor: 10%,
42
- $saturation-factor: $darken-factor
43
- ) {
44
- @if color.lightness($normal-background) >= 50% {
45
- @return color.adjust($normal-background, $lightness: -$darken-factor, $saturation: -$saturation-factor);
46
- } @else {
47
- @return color.adjust($normal-background, $lightness: $lighten-factor);
48
- }
49
- }
50
-
51
- // source of below: https://gist.github.com/mashirozx/c0691c3b8ed3f1f63722883649d41c18
52
- /// We can't (or couldn't) use flex gap due to poor compatibility, this mixin is used instead of it and generates margins. We recommend reading the source code and applying thinking to the margin situation that will result.
53
- @mixin _flex-gap($gap, $row: true, $use_nth_child: true) {
54
- $margin: math.div($gap, 2);
55
- $transform: -$margin;
56
-
57
- @if $use_nth_child {
58
- > * {
59
- @if $row {
60
- // modified to be worse by Daniel (probable broke row-reverse and order property) due to him being opinionated on avoiding negative margins when possible
61
- &:not(:first-child) {
62
- margin-left: $margin;
63
- }
64
- &:not(:last-child) {
65
- margin-right: $margin;
66
- }
67
- } @else {
68
- &:not(:first-child) {
69
- margin-top: $margin;
70
- }
71
- &:not(:last-child) {
72
- margin-bottom: $margin;
73
- }
74
- }
75
- }
76
- } @else {
77
- @if $row {
78
- margin-left: $transform;
79
- margin-right: $transform;
80
- } @else {
81
- margin-top: $transform;
82
- margin-bottom: $transform;
83
- }
84
- > * {
85
- @if $row {
86
- margin-left: $margin;
87
- margin-right: $margin;
88
- } @else {
89
- margin-top: $margin;
90
- margin-bottom: $margin;
91
- }
92
- }
93
- }
94
- }
95
-
96
- @mixin flex-gap($gap, $flex-flow: "row nowrap") {
97
- @if $flex-flow== "row nowrap" or $flex-flow== "row-reverse nowrap" {
98
- @include _flex-gap($gap, true);
99
- } @else if $flex-flow== "column nowrap" or $flex-flow== "column-reverse nowrap" {
100
- @include _flex-gap($gap, false);
101
- } @else if $flex-flow== "row wrap" or $flex-flow== "row-reverse wrap" {
102
- @include _flex-gap($gap, true, false);
103
- @include _flex-gap($gap, false, false);
104
- } @else if $flex-flow== "column wrap" or $flex-flow== "column-reverse wrap" {
105
- @include _flex-gap($gap, true, false);
106
- @include _flex-gap($gap, false, false);
107
- } @else {
108
- @error "The second paramater $flex-flow is set to be '#{$flex-flow}', which is illegal.";
109
- }
110
- }
@@ -1,31 +0,0 @@
1
- {
2
- "name": "@depict-ai/plp-styling",
3
- "packageManager": "yarn@3.2.2",
4
- "scripts": {
5
- "publish": "yarn npm publish"
6
- },
7
- "files": [
8
- "components/",
9
- "helpers/",
10
- "index.scss",
11
- "variables.scss"
12
- ],
13
- "sass": "index.scss",
14
- "version": "0.0.20",
15
- "description": "Depict PLP UI SCSS Styling",
16
- "author": "Daniel Troger <daniel@depict.ai>",
17
- "contributors": [
18
- "Fabian Hedin <fabian@depict.ai>",
19
- "Sverre Westerlund <sverre@depict.ai>",
20
- "Joakim Olsson <joakim.olsson@depict.ai>",
21
- "Arnaud Cortisse <arnaud@depict.ai>",
22
- "Carl Riis <carl@depict.ai>"
23
- ],
24
- "license": "MIT",
25
- "devDependencies": {
26
- "sassdoc": "^2.7.4"
27
- },
28
- "publishConfig": {
29
- "access": "public"
30
- }
31
- }