@depict-ai/react-ui 0.0.10 → 0.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 (35) hide show
  1. package/dist/main.js +19 -20
  2. package/dist/module.js +19 -20
  3. package/dist/styles/components/PLP/Buttons.scss +124 -0
  4. package/dist/styles/components/PLP/MorphingSign.scss +31 -0
  5. package/dist/styles/components/PLP/PLPResults.scss +20 -0
  6. package/dist/styles/components/PLP/ProductListingPage.scss +142 -0
  7. package/dist/styles/components/PLP/ScrollStatus.scss +24 -0
  8. package/dist/styles/components/PLP/SelectedFilters.scss +74 -0
  9. package/dist/styles/components/PLP/SlidableItems.scss +99 -0
  10. package/dist/styles/components/PLP/SortAndFilter/FloatingButtons.scss +75 -0
  11. package/dist/styles/components/PLP/SortAndFilter/SortAndFilter.scss +728 -0
  12. package/dist/styles/components/PLP/SortAndFilter/SortAndFilterModal.scss +160 -0
  13. package/dist/styles/components/PLP/SortAndFilter/WhiteSortAndFilter.scss +148 -0
  14. package/dist/styles/components/PLP/Toast.scss +54 -0
  15. package/dist/styles/components/PLP/index.scss +45 -0
  16. package/dist/styles/components/category/BreadCrumbs.scss +23 -0
  17. package/dist/styles/components/category/CategoryTitle.scss +28 -0
  18. package/dist/styles/components/category/QuickLinks.scss +71 -0
  19. package/dist/styles/components/category/index.scss +23 -0
  20. package/dist/styles/components/search/Autocomplete.scss +117 -0
  21. package/dist/styles/components/search/CategorySuggestions.scss +74 -0
  22. package/dist/styles/components/search/InstantCard.scss +94 -0
  23. package/dist/styles/components/search/InstantResults.scss +10 -0
  24. package/dist/styles/components/search/PreviousSearches.scss +77 -0
  25. package/dist/styles/components/search/QueryInput.scss +167 -0
  26. package/dist/styles/components/search/SearchModal.scss +90 -0
  27. package/dist/styles/components/search/SearchRecommendations.scss +25 -0
  28. package/dist/styles/components/search/ShowingResultsFor.scss +10 -0
  29. package/dist/styles/components/search/index.scss +40 -0
  30. package/dist/{styling → styles}/default.css +0 -0
  31. package/dist/styles/helpers/custom_input.scss +162 -0
  32. package/dist/styles/helpers/supports-hover.scss +5 -0
  33. package/dist/styles/helpers/utils.scss +82 -0
  34. package/dist/styles/variables.scss +10 -0
  35. package/package.json +8 -8
@@ -0,0 +1,162 @@
1
+ @use "sass:string";
2
+ @use "sass:color";
3
+ @use "supports-hover";
4
+ @use "./utils";
5
+
6
+ // https://selleo.com/til/posts/rc5qli22jp-pass-hex-color-to-fill-svg-in-background-url-scss
7
+ @function escape-url-hex-color($hex_color) {
8
+ $ie-color-string: color.ie-hex-str($hex_color);
9
+ $string: string.quote($ie-color-string);
10
+ $color: string.slice($string, 4);
11
+ @return "%23" + $color;
12
+ }
13
+
14
+ @mixin custom_input(
15
+ $checkbox-background-color,
16
+ $checkbox-checked-background-color,
17
+ $checkbox-checkmark-color,
18
+ $checkbox-border-radius,
19
+ $checkbox-border,
20
+ $checkbox-left-offset,
21
+ $checkbox-top-offset,
22
+ $radio-border,
23
+ $radio-background-color,
24
+ $radio-selected-dot-color,
25
+ $radio-selected-dot-size,
26
+ $radio-selected-offset,
27
+ $hovered-checkbox-bg,
28
+ $hovered-checkbox-checked-background-color,
29
+ $hovered-checkbox-border,
30
+ $hovered-radio-border,
31
+ $width-and-height
32
+ ) {
33
+ /* Customize the label (the container) */
34
+ .input_row {
35
+ position: relative;
36
+ cursor: pointer;
37
+
38
+ .custom-indicator {
39
+ position: relative;
40
+ // space to text
41
+ margin-right: 10px;
42
+ }
43
+
44
+ /* Hide the browser's default radio/checkbox input element */
45
+ input {
46
+ position: absolute;
47
+ opacity: 0;
48
+ cursor: pointer;
49
+ height: 0;
50
+ width: 0;
51
+ }
52
+ /* Create the custom-indicator (hidden when not checked) */
53
+ .custom-indicator:after {
54
+ content: "";
55
+ position: absolute;
56
+ display: none;
57
+ }
58
+
59
+ /* Create a custom checkbox */
60
+ input[type="checkbox"] {
61
+ & ~ .custom-indicator {
62
+ padding: calc(#{$width-and-height} / 2);
63
+ background-color: $checkbox-background-color;
64
+ border-radius: $checkbox-border-radius;
65
+ border: $checkbox-border;
66
+ }
67
+ /* When the checkbox is checked, add a blue background */
68
+ &:checked ~ .custom-indicator {
69
+ // background-color: #000;
70
+ background-color: $checkbox-checked-background-color;
71
+ &:after {
72
+ 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>');
73
+ fill: #fff;
74
+ color: #fff;
75
+ position: absolute;
76
+ top: calc(50% + $checkbox-top-offset);
77
+ left: calc(50% + $checkbox-left-offset);
78
+ transform: translate(-50%, -50%);
79
+
80
+ display: block; // Show the custom-indicator when checked
81
+
82
+ /* Style the custom-indicator */
83
+ width: 12px;
84
+ height: 10px;
85
+ }
86
+ }
87
+ &:focus-visible ~ .custom-indicator {
88
+ background-color: $hovered-checkbox-bg;
89
+ }
90
+ &:checked:focus-visible ~ .custom-indicator {
91
+ background-color: $hovered-checkbox-checked-background-color;
92
+ }
93
+ }
94
+ @include supports-hover.supports-hover() {
95
+ &:hover input[type="checkbox"] {
96
+ & ~ .custom-indicator {
97
+ background-color: $hovered-checkbox-bg;
98
+ border: $hovered-checkbox-border;
99
+ $hovered-border-width: get_border_width($hovered-checkbox-border);
100
+ $border-width: get_border_width($checkbox-border);
101
+ padding: calc(calc(#{$width-and-height} / 2) - calc(#{$hovered-border-width} - #{$border-width}));
102
+ }
103
+ &:checked ~ .custom-indicator {
104
+ background-color: $hovered-checkbox-checked-background-color;
105
+ }
106
+ }
107
+ }
108
+
109
+ /* Create a custom radio button */
110
+ input[type="radio"] {
111
+ ~ .custom-indicator {
112
+ padding: calc(#{$width-and-height} / 2);
113
+ border-radius: 50%;
114
+ border: $radio-border;
115
+ background-color: $radio-background-color;
116
+ }
117
+ &:checked ~ .custom-indicator {
118
+ background-color: transparent;
119
+ &:after {
120
+ display: block; // Show the custom-indicator when checked
121
+
122
+ /* Style the custom-indicator */
123
+ width: $radio-selected-dot-size;
124
+ height: $radio-selected-dot-size;
125
+ left: calc(50% + $radio-selected-offset);
126
+ top: calc(50% + $radio-selected-offset);
127
+ transform: translate(-50%, -50%);
128
+
129
+ // width: 8px;
130
+ // height: 8px;
131
+ // top: 6px;
132
+ // left: 6px;
133
+ background-color: $radio-selected-dot-color;
134
+ border-radius: 50%;
135
+ }
136
+ }
137
+ &:focus-visible ~ .custom-indicator {
138
+ @include utils.highlight-background($radio-background-color);
139
+ }
140
+ &:checked:focus-visible ~ .custom-indicator:after {
141
+ @include utils.highlight-background($radio-selected-dot-color, 15%, 25%);
142
+ }
143
+ }
144
+ @include supports-hover.supports-hover() {
145
+ &:hover input[type="radio"] ~ .custom-indicator {
146
+ border: $hovered-radio-border;
147
+ $hovered-border-width: get_border_width($hovered-radio-border);
148
+ $border-width: get_border_width($radio-border);
149
+ padding: calc(calc(#{$width-and-height} / 2) - calc(#{$hovered-border-width} - #{$border-width}));
150
+ }
151
+ }
152
+ @content;
153
+ }
154
+ }
155
+
156
+ @function get_border_width($border-declaration) {
157
+ @if $border-declaration == "none" or $border-declaration == "unset" {
158
+ @return 0px;
159
+ } @else {
160
+ @return nth($border-declaration, 1);
161
+ }
162
+ }
@@ -0,0 +1,5 @@
1
+ @mixin supports-hover {
2
+ @media not all and (hover: none) {
3
+ @content;
4
+ }
5
+ }
@@ -0,0 +1,82 @@
1
+ @use "sass:math";
2
+ @use "sass:color";
3
+
4
+ @mixin modal-backdrop($background: rgba(0, 0, 0, 0.4), $z-index) {
5
+ position: fixed;
6
+ background: $background;
7
+ z-index: $z-index;
8
+ left: 0;
9
+ right: 0;
10
+ bottom: 0;
11
+ top: 0;
12
+ touch-action: none;
13
+ }
14
+
15
+ @mixin highlight-background($normal-background, $darken-factor: 10%, $lighten-factor: 10%) {
16
+ @if color.lightness($normal-background) >= 50% {
17
+ background: color.adjust($normal-background, $lightness: -$darken-factor);
18
+ } @else {
19
+ background: color.adjust($normal-background, $lightness: $lighten-factor);
20
+ }
21
+ }
22
+
23
+ // can't use flex gap due to poor compatibility
24
+ // source of below: https://gist.github.com/mashirozx/c0691c3b8ed3f1f63722883649d41c18
25
+ @mixin _flex-gap($gap, $row: true, $use_nth_child: true) {
26
+ $margin: math.div($gap, 2);
27
+ $transform: -$margin;
28
+
29
+ @if $use_nth_child {
30
+ > * {
31
+ @if $row {
32
+ // modified to be worse by Daniel (probable broke row-reverse and order property) due to him being opinionated on avoiding negative margins when possible
33
+ &:not(:first-child) {
34
+ margin-left: $margin;
35
+ }
36
+ &:not(:last-child) {
37
+ margin-right: $margin;
38
+ }
39
+ } @else {
40
+ &:not(:first-child) {
41
+ margin-top: $margin;
42
+ }
43
+ &:not(:last-child) {
44
+ margin-bottom: $margin;
45
+ }
46
+ }
47
+ }
48
+ } @else {
49
+ @if $row {
50
+ margin-left: $transform;
51
+ margin-right: $transform;
52
+ } @else {
53
+ margin-top: $transform;
54
+ margin-bottom: $transform;
55
+ }
56
+ > * {
57
+ @if $row {
58
+ margin-left: $margin;
59
+ margin-right: $margin;
60
+ } @else {
61
+ margin-top: $margin;
62
+ margin-bottom: $margin;
63
+ }
64
+ }
65
+ }
66
+ }
67
+
68
+ @mixin flex-gap($gap, $flex-flow: "row nowrap") {
69
+ @if $flex-flow== "row nowrap" or $flex-flow== "row-reverse nowrap" {
70
+ @include _flex-gap($gap, true);
71
+ } @else if $flex-flow== "column nowrap" or $flex-flow== "column-reverse nowrap" {
72
+ @include _flex-gap($gap, false);
73
+ } @else if $flex-flow== "row wrap" or $flex-flow== "row-reverse wrap" {
74
+ @include _flex-gap($gap, true, false);
75
+ @include _flex-gap($gap, false, false);
76
+ } @else if $flex-flow== "column wrap" or $flex-flow== "column-reverse wrap" {
77
+ @include _flex-gap($gap, true, false);
78
+ @include _flex-gap($gap, false, false);
79
+ } @else {
80
+ @error "The second paramater $flex-flow is set to be '#{$flex-flow}', which is illegal.";
81
+ }
82
+ }
@@ -0,0 +1,10 @@
1
+ $brand-black: #0f0f0f;
2
+ $brand-grey: #868689;
3
+ $brand-dark-grey: #333335;
4
+ $brand-light-grey: #bcbcbe;
5
+ $brand-lighter-grey: #eeeef0;
6
+ $brand-lightest-grey: #fafafc;
7
+ $hovered-secondary-button-grey: #e7e8e7;
8
+ $base-z-index: 5000;
9
+ $search-page-base-z-index: 1;
10
+ $border-radius: 4px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/react-ui",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": "src/main.ts",
6
6
  "main": "dist/main.js",
@@ -9,7 +9,7 @@
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "clear-dist": "rm -r -f ./dist",
12
- "build": "yarn build-server && parcel build --no-source-maps",
12
+ "build": "yarn build-server && parcel build --no-source-maps && cp -a src/styles/plp-styling/. dist/styles/",
13
13
  "build-server": "yarn clear-dist && parcel build --no-source-maps ./src-server/main.ts && cp -r ./dist/ ./dist-server && yarn clear-dist",
14
14
  "print-included-package-files": "yarn pack --dry-run",
15
15
  "typecheck": "yarn g:tsc --build tsconfig.json"
@@ -32,7 +32,7 @@
32
32
  "optimize": false
33
33
  },
34
34
  "css": {
35
- "source": "src/styling/default.scss",
35
+ "source": "src/styles/default.scss",
36
36
  "distDir": "dist"
37
37
  }
38
38
  },
@@ -42,7 +42,7 @@
42
42
  "development": {
43
43
  "import": {
44
44
  "types": "./dist/index.d.ts",
45
- "default": "./dist/module.js"
45
+ "default": "./difstylst/module.js"
46
46
  },
47
47
  "require": "./dist/main.js"
48
48
  },
@@ -71,9 +71,9 @@
71
71
  },
72
72
  "require": "./dist/main.js"
73
73
  },
74
- "./styling/default.css": {
75
- "import": "./dist/styling/default.css",
76
- "require": "./dist/styling/default.css"
74
+ "./styles/default.css": {
75
+ "import": "./dist/styles/default.css",
76
+ "require": "./dist/styles/default.css"
77
77
  }
78
78
  },
79
79
  "files": [
@@ -81,7 +81,6 @@
81
81
  "/dist-server"
82
82
  ],
83
83
  "dependencies": {
84
- "@depict-ai/plp-styling": "^0.0.3",
85
84
  "@depict-ai/react-solid-bridge": "^1.0.26",
86
85
  "@depict-ai/ui": "^0.0.3",
87
86
  "@depict-ai/utilishared": "^0.0.3",
@@ -95,6 +94,7 @@
95
94
  "@babel/preset-typescript": "latest",
96
95
  "@babel/runtime": "latest",
97
96
  "@babel/runtime-corejs3": "latest",
97
+ "@depict-ai/plp-styling": "^0.0.3",
98
98
  "@jest/globals": "^29.3.1",
99
99
  "@parcel/babel-preset-env": "latest",
100
100
  "@parcel/resolver-default": "^2.8.0",