@wayke-se/components-react 3.1.0-beta.2 → 3.1.0
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.
- package/README.md +44 -52
- package/assets/ajax-loader.gif +0 -0
- package/assets/default.css +1 -0
- package/assets/fonts/slick.eot +0 -0
- package/assets/fonts/slick.svg +14 -0
- package/assets/fonts/slick.ttf +0 -0
- package/assets/fonts/slick.woff +0 -0
- package/dist-node/index.js +1 -70
- package/dist-node/index.js.map +1 -1
- package/dist-src/components/Gallery/wrapper.js +1 -70
- package/dist-web/index.js +1 -70
- package/dist-web/index.js.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
# Components React
|
|
2
2
|
|
|
3
|
-
This repository contains components for search and items to use on external websites.
|
|
3
|
+
> This repository contains components for search and items to use on external websites.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Notes
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
* Starting from version `2.0.0` and above will require import of `@wayke.se/components-react/assets/default.css` in order to apply basic styling to the gallery.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Usage
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Install
|
|
12
12
|
```bash
|
|
13
13
|
npm install @wayke-se/components-react
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Install peer dependencies
|
|
17
17
|
```bash
|
|
18
18
|
npm install react react-dom styled-components
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
### Basic usage
|
|
22
|
-
|
|
23
21
|
```javascript
|
|
24
22
|
import React from 'react';
|
|
25
23
|
import WaykeComposite from '@wayke-se/components-react'
|
|
26
|
-
import '@wayke-se/
|
|
24
|
+
import '@wayke-se/components-react/assets/default.css';
|
|
25
|
+
// Optional
|
|
26
|
+
import '@wayke-se/ecom-web/dist/index.css';
|
|
27
27
|
|
|
28
28
|
const ProviderSettings: WaykeProviderSettings = {
|
|
29
29
|
graphQlUrl: "https://gql.wayketech.se/query",
|
|
@@ -66,9 +66,10 @@ const ProviderSettings: WaykeProviderSettings = {
|
|
|
66
66
|
}
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
|
|
69
70
|
### WaykeComposite uses hash-route, i want to use path-route
|
|
70
71
|
|
|
71
|
-
In this case you need to make sure that you are in control of the routing, if the user reloads the page, where same html file is
|
|
72
|
+
In this case you need to make sure that you are in control of the routing, if the user reloads the page, where same html file is
|
|
72
73
|
served for `/your/path/to/this/component` and `/your/path/to/this/component/00000000-0000-0000-0000-000000000000`.
|
|
73
74
|
|
|
74
75
|
Examples given the application is located in `/search/vehicles`:
|
|
@@ -83,7 +84,9 @@ Examples given the application is located in `/search/vehicles`:
|
|
|
83
84
|
```javascript
|
|
84
85
|
import React from 'react';
|
|
85
86
|
import { WaykeCompositePath } from '@wayke-se/components-react'
|
|
86
|
-
import '@wayke
|
|
87
|
+
import '@wayke.se/components-react/assets/default.css';
|
|
88
|
+
// Optional
|
|
89
|
+
import '@wayke-se/ecom-web/dist/index.css';
|
|
87
90
|
|
|
88
91
|
const App = () => (
|
|
89
92
|
<WaykeCompositePath
|
|
@@ -116,6 +119,7 @@ const App = () => {
|
|
|
116
119
|
);
|
|
117
120
|
};
|
|
118
121
|
```
|
|
122
|
+
|
|
119
123
|
### I only want to use the Search Item component
|
|
120
124
|
|
|
121
125
|
It's recomended to place WaykeItemProvider close to app-root in order to keep the cache
|
|
@@ -123,7 +127,9 @@ It's recomended to place WaykeItemProvider close to app-root in order to keep th
|
|
|
123
127
|
```javascript
|
|
124
128
|
import React, { useCallback } from 'react';
|
|
125
129
|
import { WaykeItemProvider, WaykeSearchItem } from '@wayke-se/components-react'
|
|
126
|
-
import '@wayke
|
|
130
|
+
import '@wayke.se/components-react/assets/default.css';
|
|
131
|
+
// Optional
|
|
132
|
+
import '@wayke-se/ecom-web/dist/index.css';
|
|
127
133
|
|
|
128
134
|
const App = ({}) => {
|
|
129
135
|
const id = 'd01f79a3-7552-49c4-9d4d-deb3aa581c31';
|
|
@@ -158,7 +164,7 @@ const App = ({}) => {
|
|
|
158
164
|
| disableResetScrollOnInit | boolean | false | |
|
|
159
165
|
| placeholderImage | string | false | |
|
|
160
166
|
| onClickSearchItem | function | false | (id: string) => void |
|
|
161
|
-
| modifyDocumentTitleItem | boolean | false | |
|
|
167
|
+
| modifyDocumentTitleItem | boolean | false | |
|
|
162
168
|
|
|
163
169
|
* Required
|
|
164
170
|
* `id` - Guid that represents a vehicle.
|
|
@@ -432,7 +438,7 @@ To style the components, copy the following snippet into your *CSS* file and mod
|
|
|
432
438
|
}
|
|
433
439
|
```
|
|
434
440
|
|
|
435
|
-
...or if you want to use it as
|
|
441
|
+
...or if you want to use it as Sass (.scss):
|
|
436
442
|
|
|
437
443
|
```scss
|
|
438
444
|
.wayke__theme {
|
|
@@ -464,23 +470,17 @@ To style the components, copy the following snippet into your *CSS* file and mod
|
|
|
464
470
|
}
|
|
465
471
|
```
|
|
466
472
|
|
|
467
|
-
> **It is highly recommended to *NOT* add or remove any properties defined above in the color selectors**. However, since fonts usually requires more configuration we encourage you to add the necessary font styling required to match your current profile. If you add new properties to the font selectors, please be careful and ensure everything looks as intended before going into production.
|
|
468
|
-
|
|
469
473
|
### Ecom theme
|
|
474
|
+
The default ecom css can be found and imported `node_module/@wayke-se/ecom-web/dist/index.css`.
|
|
470
475
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
If you want to customize the look of the Ecom module we refer you to the documentation of [@wayke-se/ecom-web](https://www.npmjs.com/package/@wayke-se/ecom-web).
|
|
474
|
-
|
|
475
|
-
## Run example from this repository
|
|
476
|
-
|
|
477
|
-
This repository contains an example app that uses [@wayke-se/components-react](https://www.npmjs.com/package/@wayke-se/components-react).
|
|
476
|
+
> **It is highly recommended to *NOT* add or remove any properties defined above in the color selectors**. However, since fonts usually requires more configuration we encourage you to add the necessary font styling required to match your current profile. If you add new properties to the font selectors, please be careful and ensure everything looks as intended before going into production.
|
|
478
477
|
|
|
478
|
+
## Run example from repo
|
|
479
|
+
This repository contains a example app that uses [@wayke-se/components-react](https://www.npmjs.com/package/@wayke-se/components-react).
|
|
479
480
|
|
|
480
|
-
### Setup environment variables
|
|
481
481
|
|
|
482
|
-
To start the example create an `.env` file in root with the following content.
|
|
483
482
|
|
|
483
|
+
To start the example create an `.env` file in root.
|
|
484
484
|
```
|
|
485
485
|
WAYKE_HOST=YOUR_HOST_1,YOUR_HOST_2
|
|
486
486
|
WAYKE_SEARCH_URL=https://test-ext-api.wayketech.se/vehicles
|
|
@@ -491,15 +491,10 @@ WAYKE_ECOM_URL=https://ecom.wayketech.se
|
|
|
491
491
|
GOOGLE_MAPS_API_KEY=YOUR_GOOGLE_MAPS_STATIC_API_KEY
|
|
492
492
|
```
|
|
493
493
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
* `WAYKE_SEARCH_MLT_URL` - An *optional* flag. Will fetch related vehicles to current vehicle. If not provided
|
|
494
|
+
* `WAYKE_SEARCH_MLT_URL` - An *optional* flag. Will fetch related vehicles to current vehicle. If not provided
|
|
497
495
|
`WAYKE_SEARCH_URL` will be used instead, but will fetch latest vehicles.
|
|
498
496
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
Run the following commands to start the example app.
|
|
502
|
-
|
|
497
|
+
Then run the following:
|
|
503
498
|
```bash
|
|
504
499
|
npm install
|
|
505
500
|
cd example
|
|
@@ -507,38 +502,35 @@ npm install
|
|
|
507
502
|
npm start
|
|
508
503
|
```
|
|
509
504
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
`WAYKE_HOST` can be used instead of using and exposing the `WAYKE_SEARCH_X_API_KEY`. If, for example, your development host is `test.com.localhost`.
|
|
513
|
-
|
|
514
|
-
To do so update your local host file and add:
|
|
515
|
-
```txt
|
|
505
|
+
`WAYKE_HOST` can be used instead of using and exposing the `WAYKE_SEARCH_X_API_KEY`. If, for example, your development host is `test.com.localhost`
|
|
506
|
+
Update your local host file and add:
|
|
516
507
|
127.0.0.1 test.com.localhost
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
This will change the origin, while still pointing to `localhost`. Start the example app and open `test.com.localhost:5000` in your browser.
|
|
520
|
-
|
|
521
|
-
### Multiple hosts
|
|
508
|
+
This will change the origin, while still pointing to localhost.
|
|
509
|
+
Start the example and open `test.com.localhost:5000`.
|
|
522
510
|
|
|
523
|
-
To add
|
|
524
|
-
|
|
525
|
-
```txt
|
|
511
|
+
To add more hosts, add all to your local host file and then update `WAYKE_HOST` (comma separated):
|
|
512
|
+
```
|
|
526
513
|
WAYKE_HOST=a.com.localhost,b.com.localhost
|
|
527
514
|
```
|
|
528
|
-
|
|
529
515
|
`a.com.localhost:5000` and `b.com.localhost:5000` can now be accessed.
|
|
530
516
|
|
|
531
|
-
### Available routes (independent)
|
|
532
517
|
|
|
533
|
-
|
|
518
|
+
### Available Routes (Independent)
|
|
519
|
+
|
|
520
|
+
#### WaykeComposite
|
|
534
521
|
[http://localhost:5000](http://localhost:5000)
|
|
535
522
|
|
|
536
|
-
|
|
523
|
+
#### WaykeSearch With WaykeProvider
|
|
537
524
|
[http://localhost:5000/search](http://localhost:5000/search)
|
|
538
525
|
|
|
539
|
-
|
|
526
|
+
#### WaykeSearchItem With WaykeProvider
|
|
540
527
|
[http://localhost:5000/search-item/d01f79a3-7552-49c4-9d4d-deb3aa581c31](http://localhost:5000/search-item/d01f79a3-7552-49c4-9d4d-deb3aa581c31)
|
|
541
528
|
|
|
529
|
+
|
|
542
530
|
## Example repositories
|
|
543
531
|
|
|
544
|
-
|
|
532
|
+
### React and Typescript example
|
|
533
|
+
[https://github.com/wayke-se/components-react-boilerplate](https://github.com/wayke-se/components-react-boilerplate)
|
|
534
|
+
|
|
535
|
+
### Non-React with/without Typescript example
|
|
536
|
+
[https://github.com/wayke-se/components-react-example](https://github.com/wayke-se/components-react-example)
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@charset 'UTF-8';.slick-slider{position:relative;display:block;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-touch-callout:none;-khtml-user-select:none;-ms-touch-action:pan-y;touch-action:pan-y;-webkit-tap-highlight-color:transparent}.slick-list{position:relative;display:block;overflow:hidden;margin:0;padding:0}.slick-list:focus{outline:0}.slick-list.dragging{cursor:pointer;cursor:hand}.slick-slider .slick-list,.slick-slider .slick-track{-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.slick-track{position:relative;top:0;left:0;display:block;margin-left:auto;margin-right:auto}.slick-track:after,.slick-track:before{display:table;content:''}.slick-track:after{clear:both}.slick-loading .slick-track{visibility:hidden}.slick-slide{display:none;float:left;height:100%;min-height:1px}[dir=rtl] .slick-slide{float:right}.slick-slide img{display:block}.slick-slide.slick-loading img{display:none}.slick-slide.dragging img{pointer-events:none}.slick-initialized .slick-slide{display:block}.slick-loading .slick-slide{visibility:hidden}.slick-vertical .slick-slide{display:block;height:auto;border:1px solid transparent}.slick-arrow.slick-hidden{display:none}.slick-loading .slick-list{background:#fff url(ajax-loader.gif) center center no-repeat}@font-face{font-family:slick;font-weight:400;font-style:normal;src:url(fonts/slick.eot);src:url(fonts/slick.eot?#iefix) format('embedded-opentype'),url(fonts/slick.woff) format('woff'),url(fonts/slick.ttf) format('truetype'),url(fonts/slick.svg#slick) format('svg')}.slick-next,.slick-prev{font-size:0;line-height:0;position:absolute;top:50%;display:block;width:20px;height:20px;padding:0;-webkit-transform:translate(0,-50%);-ms-transform:translate(0,-50%);transform:translate(0,-50%);cursor:pointer;color:transparent;border:none;outline:0;background:0 0}.slick-next:focus,.slick-next:hover,.slick-prev:focus,.slick-prev:hover{color:transparent;outline:0;background:0 0}.slick-next:focus:before,.slick-next:hover:before,.slick-prev:focus:before,.slick-prev:hover:before{opacity:1}.slick-next.slick-disabled:before,.slick-prev.slick-disabled:before{opacity:.25}.slick-next:before,.slick-prev:before{font-family:slick;font-size:20px;line-height:1;opacity:.75;color:#fff;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.slick-prev{left:-25px}[dir=rtl] .slick-prev{right:-25px;left:auto}.slick-prev:before{content:'←'}[dir=rtl] .slick-prev:before{content:'→'}.slick-next{right:-25px}[dir=rtl] .slick-next{right:auto;left:-25px}.slick-next:before{content:'→'}[dir=rtl] .slick-next:before{content:'←'}.slick-dotted.slick-slider{margin-bottom:30px}.slick-dots{position:absolute;bottom:-25px;display:block;width:100%;padding:0;margin:0;list-style:none;text-align:center}.slick-dots li{position:relative;display:inline-block;width:20px;height:20px;margin:0 5px;padding:0;cursor:pointer}.slick-dots li button{font-size:0;line-height:0;display:block;width:20px;height:20px;padding:5px;cursor:pointer;color:transparent;border:0;outline:0;background:0 0}.slick-dots li button:focus,.slick-dots li button:hover{outline:0}.slick-dots li button:focus:before,.slick-dots li button:hover:before{opacity:1}.slick-dots li button:before{font-family:slick;font-size:6px;line-height:20px;position:absolute;top:0;left:0;width:20px;height:20px;content:'•';text-align:center;opacity:.25;color:#000;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.slick-dots li.slick-active button:before{opacity:.75;color:#000}
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<metadata>Generated by Fontastic.me</metadata>
|
|
5
|
+
<defs>
|
|
6
|
+
<font id="slick" horiz-adv-x="512">
|
|
7
|
+
<font-face font-family="slick" units-per-em="512" ascent="480" descent="-32"/>
|
|
8
|
+
<missing-glyph horiz-adv-x="512" />
|
|
9
|
+
|
|
10
|
+
<glyph unicode="→" d="M241 113l130 130c4 4 6 8 6 13 0 5-2 9-6 13l-130 130c-3 3-7 5-12 5-5 0-10-2-13-5l-29-30c-4-3-6-7-6-12 0-5 2-10 6-13l87-88-87-88c-4-3-6-8-6-13 0-5 2-9 6-12l29-30c3-3 8-5 13-5 5 0 9 2 12 5z m234 143c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
|
|
11
|
+
<glyph unicode="←" d="M296 113l29 30c4 3 6 7 6 12 0 5-2 10-6 13l-87 88 87 88c4 3 6 8 6 13 0 5-2 9-6 12l-29 30c-3 3-8 5-13 5-5 0-9-2-12-5l-130-130c-4-4-6-8-6-13 0-5 2-9 6-13l130-130c3-3 7-5 12-5 5 0 10 2 13 5z m179 143c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
|
|
12
|
+
<glyph unicode="•" d="M475 256c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
|
|
13
|
+
<glyph unicode="a" d="M475 439l0-128c0-5-1-9-5-13-4-4-8-5-13-5l-128 0c-8 0-13 3-17 11-3 7-2 14 4 20l40 39c-28 26-62 39-100 39-20 0-39-4-57-11-18-8-33-18-46-32-14-13-24-28-32-46-7-18-11-37-11-57 0-20 4-39 11-57 8-18 18-33 32-46 13-14 28-24 46-32 18-7 37-11 57-11 23 0 44 5 64 15 20 9 38 23 51 42 2 1 4 3 7 3 3 0 5-1 7-3l39-39c2-2 3-3 3-6 0-2-1-4-2-6-21-25-46-45-76-59-29-14-60-20-93-20-30 0-58 5-85 17-27 12-51 27-70 47-20 19-35 43-47 70-12 27-17 55-17 85 0 30 5 58 17 85 12 27 27 51 47 70 19 20 43 35 70 47 27 12 55 17 85 17 28 0 55-5 81-15 26-11 50-26 70-45l37 37c6 6 12 7 20 4 8-4 11-9 11-17z"/>
|
|
14
|
+
</font></defs></svg>
|
|
Binary file
|
|
Binary file
|
package/dist-node/index.js
CHANGED
|
@@ -3457,76 +3457,6 @@ const SliderWrapper = styled__default.div`
|
|
|
3457
3457
|
bottom: 0;
|
|
3458
3458
|
left: 0;
|
|
3459
3459
|
right: 0;
|
|
3460
|
-
user-select: none;
|
|
3461
|
-
touch-action: pan-y;
|
|
3462
|
-
-webkit-tap-highlight-color: transparent;
|
|
3463
|
-
|
|
3464
|
-
.slick-list,
|
|
3465
|
-
.slick-track {
|
|
3466
|
-
transform: translate3d(0, 0, 0);
|
|
3467
|
-
}
|
|
3468
|
-
}
|
|
3469
|
-
|
|
3470
|
-
.slick-list {
|
|
3471
|
-
position: relative;
|
|
3472
|
-
display: block;
|
|
3473
|
-
margin: 0;
|
|
3474
|
-
padding: 0;
|
|
3475
|
-
overflow: hidden;
|
|
3476
|
-
|
|
3477
|
-
&:focus {
|
|
3478
|
-
outline: none;
|
|
3479
|
-
}
|
|
3480
|
-
|
|
3481
|
-
&.dragging {
|
|
3482
|
-
cursor: pointer;
|
|
3483
|
-
cursor: hand;
|
|
3484
|
-
}
|
|
3485
|
-
}
|
|
3486
|
-
|
|
3487
|
-
.slick-track {
|
|
3488
|
-
position: relative;
|
|
3489
|
-
top: 0;
|
|
3490
|
-
left: 0;
|
|
3491
|
-
display: block;
|
|
3492
|
-
margin-left: auto;
|
|
3493
|
-
margin-right: auto;
|
|
3494
|
-
|
|
3495
|
-
&::before,
|
|
3496
|
-
&::after {
|
|
3497
|
-
content: '';
|
|
3498
|
-
display: table;
|
|
3499
|
-
}
|
|
3500
|
-
|
|
3501
|
-
&::after {
|
|
3502
|
-
clear: both;
|
|
3503
|
-
}
|
|
3504
|
-
}
|
|
3505
|
-
|
|
3506
|
-
.slick-slide {
|
|
3507
|
-
display: none;
|
|
3508
|
-
float: left;
|
|
3509
|
-
min-height: 1px;
|
|
3510
|
-
}
|
|
3511
|
-
|
|
3512
|
-
.slick-loading {
|
|
3513
|
-
.slick-track {
|
|
3514
|
-
visibility: hidden;
|
|
3515
|
-
}
|
|
3516
|
-
|
|
3517
|
-
img {
|
|
3518
|
-
display: none;
|
|
3519
|
-
}
|
|
3520
|
-
}
|
|
3521
|
-
|
|
3522
|
-
.slick-initialized {
|
|
3523
|
-
.slick-slide {
|
|
3524
|
-
display: block;
|
|
3525
|
-
}
|
|
3526
|
-
}
|
|
3527
|
-
|
|
3528
|
-
.slick-slide.dragging img {
|
|
3529
|
-
pointer-events: none;
|
|
3530
3460
|
}
|
|
3531
3461
|
|
|
3532
3462
|
${props => props.theme.breakpoint.LtMd} {
|
|
@@ -3539,6 +3469,7 @@ const SliderWrapper = styled__default.div`
|
|
|
3539
3469
|
|
|
3540
3470
|
.slick-slide {
|
|
3541
3471
|
border-right: ${size(1)} solid ${props => props.theme.color.bg};
|
|
3472
|
+
//transform: scale(0.95);
|
|
3542
3473
|
transform-origin: 0 50%;
|
|
3543
3474
|
transition: transform 150ms ease;
|
|
3544
3475
|
}
|