@plurix/ecom-components 0.0.2-beta.8 → 1.0.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 +76 -48
- package/dist/assets/svgs/ArrowIcon.d.ts +1 -1
- package/dist/assets/svgs/ArrowIcon.js +3 -2
- package/dist/assets/svgs/ErrorIcon.d.ts +1 -1
- package/dist/main.d.ts +1 -0
- package/dist/main.js +4 -2
- package/dist/packages/Modal/Modal.d.ts +14 -0
- package/dist/packages/Modal/Modal.js +53 -0
- package/dist/packages/Onboarding/constants/tips.js +9 -9
- package/dist/packages/Onboarding/tips/Tip2.js +225 -236
- package/dist/packages/Onboarding/tips/Tip3.js +236 -225
- package/dist/packages/Regionalization/utils/localStorage.js +1 -1
- package/dist/styles/modal.global.css +1 -0
- package/package.json +72 -58
- package/dist/packages/Carousel/test/Carrousel.test.js +0 -80
- package/dist/packages/Coupons/test/Alert.test.js +0 -18
- package/dist/packages/Coupons/test/Breadcrumb.test.js +0 -41
- package/dist/packages/Coupons/test/ModalFooter.test.js +0 -32
- package/dist/packages/Coupons/test/ModalHeader.test.js +0 -23
- package/dist/packages/Coupons/test/NoCoupons.test.js +0 -17
- package/dist/packages/Tour/test/TooltipFooter.test.js +0 -68
- package/dist/packages/Tour/test/TooltipHeader.test.js +0 -18
- package/dist/packages/Tour/test/Tour.test.js +0 -45
- package/dist/packages/Tour/test/TourOverlay.test.js +0 -18
- package/dist/packages/Tour/test/TourTooltip.test.js +0 -40
- /package/dist/{packages/Regionalization/utils/constants.d.ts → constants/index.d.ts} +0 -0
- /package/dist/{packages/Regionalization/utils/constants.js → constants/index.js} +0 -0
package/README.md
CHANGED
|
@@ -1,48 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
# @plurix/ecom-components
|
|
2
|
+
|
|
3
|
+
## Dependencies
|
|
4
|
+
|
|
5
|
+
Use `yarn` to install all dependencies and prepare `husky` (used to run scripts in git steps).
|
|
6
|
+
|
|
7
|
+
## Folder Structure
|
|
8
|
+
|
|
9
|
+
- `lib`: files that will be compiled and published in the `@plurix/ecom-components` package
|
|
10
|
+
- `src`: local development
|
|
11
|
+
|
|
12
|
+
## How to Create a New Component in the Package
|
|
13
|
+
|
|
14
|
+
- Create a new folder in `lib/packages`, with your component name. Example: `MyComponent`;
|
|
15
|
+
- Create a `.tsx` file inside this new folder and export a component from there. Example:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
// lib/packages/MyComponent/MyComponent.tsx
|
|
19
|
+
|
|
20
|
+
export const MyComponent = () => {
|
|
21
|
+
return <h1>My Component</h1>
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- Export the new component in `lib/main.ts`. Example:
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
// lib/main.ts
|
|
29
|
+
|
|
30
|
+
export { MyComponent } from './packages/MyComponent/MyComponent'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- Create a new file called `<component-name>Example.tsx` in `src/examples` and import your component. Example:
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
// src/examples/MyComponentExample.tsx
|
|
37
|
+
|
|
38
|
+
import { MyComponent } from '../../lib/main'
|
|
39
|
+
|
|
40
|
+
export const MyComponentExample = () => {
|
|
41
|
+
return (
|
|
42
|
+
<div className="my-component-example-container">
|
|
43
|
+
<MyComponent />
|
|
44
|
+
</div>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- Export the new example component in `src/index.ts`. Example:
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
// src/examples/index.ts
|
|
53
|
+
|
|
54
|
+
export { MyComponentExample } from './MyComponentExample'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- Run `yarn dev`;
|
|
58
|
+
- Open the localhost link in the terminal;
|
|
59
|
+
- Choose your component in the sidebar. Now, you can develop your component and test it with `fast refresh`.
|
|
60
|
+
|
|
61
|
+
OBS: If you need to use `css` in your components, create them as `<component-name>.global.css` and import them in your Lib Component. Then, you are able to use that in `VTEX IO` and `VTEX Faststore`.
|
|
62
|
+
|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
## Publishing
|
|
66
|
+
|
|
67
|
+
- After finishing your component changes, upgrade the package version in `package.json` and create an entry in `CHANGELOG.md`.
|
|
68
|
+
- Commit and push your changes to the remote repository. It will run the husky scripts: commitlint, prettier, lint, tests, and build.
|
|
69
|
+
- After all scripts pass successfully, run `npm publish` in your terminal.
|
|
70
|
+
- Copy the published version from your terminal and install it in another repository.
|
|
71
|
+
- You can import the new component by using:
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { MyComponent } from '@plurix/ecom-components'
|
|
75
|
+
import '@plurix/ecom-components/dist/styles/my-component.global.css' // If you are using css
|
|
76
|
+
```
|
|
@@ -5,5 +5,5 @@ interface ArrowIconProps {
|
|
|
5
5
|
rotate?: Rotate;
|
|
6
6
|
}
|
|
7
7
|
type Rotate = 'Up' | 'Right' | 'Down' | 'Left';
|
|
8
|
-
export declare const ArrowIcon: ({ width, height, color, rotate
|
|
8
|
+
export declare const ArrowIcon: ({ width, height, color, rotate }: ArrowIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -4,7 +4,7 @@ const i = {
|
|
|
4
4
|
Right: 180,
|
|
5
5
|
Down: 270,
|
|
6
6
|
Left: 0
|
|
7
|
-
},
|
|
7
|
+
}, a = ({
|
|
8
8
|
width: r = 16,
|
|
9
9
|
height: t = 16,
|
|
10
10
|
color: e = "var(--color-grayScale)",
|
|
@@ -20,6 +20,7 @@ const i = {
|
|
|
20
20
|
viewBox: "0 0 16 16",
|
|
21
21
|
fill: "none",
|
|
22
22
|
xmlns: "http://www.w3.org/2000/svg",
|
|
23
|
+
"data-testid": "arrow-icon",
|
|
23
24
|
children: /* @__PURE__ */ o(
|
|
24
25
|
"path",
|
|
25
26
|
{
|
|
@@ -33,5 +34,5 @@ const i = {
|
|
|
33
34
|
}
|
|
34
35
|
);
|
|
35
36
|
export {
|
|
36
|
-
|
|
37
|
+
a as ArrowIcon
|
|
37
38
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
interface ErrorIconProps {
|
|
2
2
|
color?: string;
|
|
3
3
|
}
|
|
4
|
-
export declare const ErrorIcon: ({ color
|
|
4
|
+
export declare const ErrorIcon: ({ color }: ErrorIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export {};
|
package/dist/main.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export { Onboarding } from './packages/Onboarding/Onboarding';
|
|
|
5
5
|
export { Tour } from './packages/Tour/Tour';
|
|
6
6
|
export { Regionalization } from './packages/Regionalization/Regionalization';
|
|
7
7
|
export * from './packages/Regionalization/types';
|
|
8
|
+
export { Modal } from './packages/Modal/Modal';
|
package/dist/main.js
CHANGED
|
@@ -2,13 +2,15 @@ import { CartClubAlert as e } from "./packages/CartClubAlert/CartClubAlert.js";
|
|
|
2
2
|
import { Carousel as p } from "./packages/Carousel/Carousel.js";
|
|
3
3
|
import { Coupons as m } from "./packages/Coupons/Coupons.js";
|
|
4
4
|
import { Onboarding as a } from "./packages/Onboarding/Onboarding.js";
|
|
5
|
-
import { Tour as
|
|
5
|
+
import { Tour as n } from "./packages/Tour/Tour.js";
|
|
6
6
|
import { Regionalization as u } from "./packages/Regionalization/Regionalization.js";
|
|
7
|
+
import { Modal as b } from "./packages/Modal/Modal.js";
|
|
7
8
|
export {
|
|
8
9
|
p as Carousel,
|
|
9
10
|
e as CartClubAlert,
|
|
10
11
|
m as Coupons,
|
|
12
|
+
b as Modal,
|
|
11
13
|
a as Onboarding,
|
|
12
14
|
u as Regionalization,
|
|
13
|
-
|
|
15
|
+
n as Tour
|
|
14
16
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode, Dispatch, SetStateAction } from 'react';
|
|
2
|
+
|
|
3
|
+
interface ModalProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
title: string;
|
|
9
|
+
titleAction?: () => void;
|
|
10
|
+
hasTitleArrow?: boolean;
|
|
11
|
+
Footer?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const Modal: (props: ModalProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as o, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as s, useEffect as a } from "react";
|
|
3
|
+
import v from "react-outside-click-handler";
|
|
4
|
+
import { ArrowIcon as w } from "../../assets/svgs/ArrowIcon.js";
|
|
5
|
+
import { CloseIcon as C } from "../../assets/svgs/CloseIcon.js";
|
|
6
|
+
import { HAS_WINDOW as x } from "../../constants/index.js";
|
|
7
|
+
/* empty css */const I = (m) => {
|
|
8
|
+
const {
|
|
9
|
+
isOpen: e,
|
|
10
|
+
setIsOpen: f,
|
|
11
|
+
children: u,
|
|
12
|
+
className: h,
|
|
13
|
+
title: n,
|
|
14
|
+
titleAction: i,
|
|
15
|
+
hasTitleArrow: p,
|
|
16
|
+
Footer: c
|
|
17
|
+
} = m, r = s(null), l = s(null), d = () => f(!1);
|
|
18
|
+
return a(() => {
|
|
19
|
+
if (x)
|
|
20
|
+
return e ? window.document.body.classList.add("no-scroll") : window.document.body.classList.remove("no-scroll"), () => {
|
|
21
|
+
window.document.body.classList.remove("no-scroll");
|
|
22
|
+
};
|
|
23
|
+
}, [e]), a(() => {
|
|
24
|
+
l.current && r.current && (r.current.style.maxHeight = `calc(100% - 56px - ${l.current.offsetHeight}px)`);
|
|
25
|
+
}, [e]), e ? /* @__PURE__ */ o(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
id: "modal-container",
|
|
29
|
+
"data-testid": "modal-container",
|
|
30
|
+
className: h,
|
|
31
|
+
children: /* @__PURE__ */ o("div", { id: "modal-content-container", children: /* @__PURE__ */ o(v, { onOutsideClick: d, children: /* @__PURE__ */ t("div", { id: "modal-content", children: [
|
|
32
|
+
/* @__PURE__ */ t("header", { children: [
|
|
33
|
+
i ? /* @__PURE__ */ t("button", { onClick: i, className: "modal-title", children: [
|
|
34
|
+
p && /* @__PURE__ */ o(
|
|
35
|
+
w,
|
|
36
|
+
{
|
|
37
|
+
rotate: "Left",
|
|
38
|
+
color: "var(--color-support-links)"
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
n
|
|
42
|
+
] }) : /* @__PURE__ */ o("h2", { className: "modal-title", children: n }),
|
|
43
|
+
/* @__PURE__ */ o("button", { onClick: d, className: "modal-close", children: /* @__PURE__ */ o(C, { color: "var(--color-main)" }) })
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ o("div", { id: "modal-scroll", ref: r, children: u }),
|
|
46
|
+
c && /* @__PURE__ */ o("footer", { ref: l, children: c })
|
|
47
|
+
] }) }) })
|
|
48
|
+
}
|
|
49
|
+
) : null;
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
I as Modal
|
|
53
|
+
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { Tip1 as o } from "../tips/Tip1.js";
|
|
2
|
-
import { Tip2 as
|
|
3
|
-
import { Tip3 as
|
|
4
|
-
import { Tip4 as
|
|
2
|
+
import { Tip2 as i } from "../tips/Tip2.js";
|
|
3
|
+
import { Tip3 as a } from "../tips/Tip3.js";
|
|
4
|
+
import { Tip4 as e } from "../tips/Tip4.js";
|
|
5
5
|
import { Tip5 as s } from "../tips/Tip5.js";
|
|
6
|
-
const
|
|
6
|
+
const n = 5, u = [
|
|
7
7
|
{
|
|
8
8
|
svg: o,
|
|
9
9
|
isIllustration: !1,
|
|
10
10
|
tip: "O site e aplicativo vai ficando com a sua cara conforme você vai comprando, assim você tem uma experiência de acordo com seu padrão de compra"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
svg:
|
|
13
|
+
svg: i,
|
|
14
14
|
isIllustration: !0,
|
|
15
15
|
tip: "Veja produtos que você comprou anteriormente e adicione eles ao seu carrinho, fazendo suas compras com mais rapidez"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
svg:
|
|
18
|
+
svg: a,
|
|
19
19
|
isIllustration: !0,
|
|
20
|
-
tip: "Você também consegue
|
|
20
|
+
tip: "Você também consegue repetir um pedido adicionando ele inteiro ao seu carrinho, onde você pode aumentar ou diminuir a quantidade dos produtos"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
svg:
|
|
23
|
+
svg: e,
|
|
24
24
|
isIllustration: !0,
|
|
25
25
|
tip: "Você terá acesso aos corredores que você mais compra logo na tela inicial, assim você consegue conferir melhor a variedade dos produtos que você mais leva"
|
|
26
26
|
},
|
|
@@ -32,5 +32,5 @@ const p = 5, u = [
|
|
|
32
32
|
];
|
|
33
33
|
export {
|
|
34
34
|
u as TIPS,
|
|
35
|
-
|
|
35
|
+
n as TIPS_LENGTH
|
|
36
36
|
};
|